diff --git a/CHANGELOG.md b/CHANGELOG.md index 040961b638..9bde697a36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,19 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [1.19.0](https://github.com/aws/jsii/compare/v1.18.0...v1.19.0) (2021-02-02) + + +### Features + +* add runtime type info (fqn and version) to compiled sources ([481e7a4](https://github.com/aws/jsii/commit/481e7a47a8f4dd7348ba4aba683902b869d11c84)), closes [/github.com/aws/aws-cdk-rfcs/blob/master/text/0253-cdk-metadata-v2.md#appendix-1](https://github.com/aws//github.com/aws/aws-cdk-rfcs/blob/master/text/0253-cdk-metadata-v2.md/issues/appendix-1) +* **go:** version file in the generated module directory ([#2492](https://github.com/aws/jsii/issues/2492)) ([da3ea25](https://github.com/aws/jsii/commit/da3ea25330a8a73f3102db1dfc8f94ea1d6eca3c)) + + +### Bug Fixes + +* **go:** major version suffix is missing in module names for >=v2 ([#2507](https://github.com/aws/jsii/issues/2507)) ([32c0add](https://github.com/aws/jsii/commit/32c0add5edd0ed57d535241b483168e2b7e731ce)), closes [#2509](https://github.com/aws/jsii/issues/2509) + ## [1.18.0](https://github.com/aws/jsii/compare/v1.17.1...v1.18.0) (2021-01-28) diff --git a/lerna.json b/lerna.json index 9660387f7c..ca60cdd5df 100644 --- a/lerna.json +++ b/lerna.json @@ -10,5 +10,5 @@ "rejectCycles": true } }, - "version": "1.18.0" + "version": "1.19.0" } diff --git a/package.json b/package.json index f59d70224b..16853c0076 100644 --- a/package.json +++ b/package.json @@ -15,10 +15,10 @@ }, "devDependencies": { "@jest/types": "^26.6.2", - "@typescript-eslint/eslint-plugin": "^4.14.1", - "@typescript-eslint/parser": "^4.14.1", + "@typescript-eslint/eslint-plugin": "^4.14.2", + "@typescript-eslint/parser": "^4.14.2", "all-contributors-cli": "^6.19.0", - "eslint": "^7.18.0", + "eslint": "^7.19.0", "eslint-config-prettier": "^7.2.0", "eslint-import-resolver-node": "^0.3.4", "eslint-import-resolver-typescript": "^2.3.0", @@ -30,7 +30,7 @@ "lerna": "^3.22.1", "prettier": "^2.2.1", "standard-version": "^9.1.0", - "ts-jest": "^26.4.4", + "ts-jest": "^26.5.0", "ts-node": "^9.1.1", "typescript": "~3.9.7" }, diff --git a/packages/@jsii/go-runtime/package.json b/packages/@jsii/go-runtime/package.json index 9a3d30bc5e..27bb38bb3a 100644 --- a/packages/@jsii/go-runtime/package.json +++ b/packages/@jsii/go-runtime/package.json @@ -25,7 +25,7 @@ "@types/fs-extra": "^8.1.1", "@types/node": "^10.17.51", "codemaker": "^0.0.0", - "eslint": "^7.18.0", + "eslint": "^7.19.0", "fs-extra": "^9.1.0", "jsii-calc": "^0.0.0", "jsii-pacmak": "^0.0.0", diff --git a/packages/@jsii/integ-test/package.json b/packages/@jsii/integ-test/package.json index 4e10a2b17e..f14b26da54 100644 --- a/packages/@jsii/integ-test/package.json +++ b/packages/@jsii/integ-test/package.json @@ -32,7 +32,7 @@ "@types/jest": "^26.0.20", "@types/node": "^10.17.51", "@types/tar": "^4.0.4", - "eslint": "^7.18.0", + "eslint": "^7.19.0", "prettier": "^2.2.1", "typescript": "~3.9.7" } diff --git a/packages/@jsii/kernel/package.json b/packages/@jsii/kernel/package.json index 2863806f88..b7568982f8 100644 --- a/packages/@jsii/kernel/package.json +++ b/packages/@jsii/kernel/package.json @@ -43,13 +43,13 @@ "@types/jest-expect-message": "^1.0.3", "@types/node": "^10.17.51", "@types/tar": "^4.0.4", - "eslint": "^7.18.0", + "eslint": "^7.19.0", "jest": "^26.6.3", "jest-expect-message": "^1.0.2", "jsii-build-tools": "^0.0.0", "jsii-calc": "^0.0.0", "prettier": "^2.2.1", - "ts-jest": "^26.4.4", + "ts-jest": "^26.5.0", "typescript": "~3.9.7" } } diff --git a/packages/@jsii/runtime/package.json b/packages/@jsii/runtime/package.json index 5d66053efb..27e27b0c90 100644 --- a/packages/@jsii/runtime/package.json +++ b/packages/@jsii/runtime/package.json @@ -42,16 +42,16 @@ "@scope/jsii-calc-lib": "^0.0.0", "@types/jest": "^26.0.20", "@types/node": "^10.17.51", - "eslint": "^7.18.0", + "eslint": "^7.19.0", "jest": "^26.6.3", "jsii-build-tools": "^0.0.0", "jsii-calc": "^0.0.0", "prettier": "^2.2.1", "source-map-loader": "^2.0.0", - "ts-jest": "^26.4.4", + "ts-jest": "^26.5.0", "typescript": "~3.9.7", "wasm-loader": "^1.3.0", - "webpack": "^5.18.0", + "webpack": "^5.19.0", "webpack-cli": "^4.4.0" } } diff --git a/packages/@jsii/spec/package.json b/packages/@jsii/spec/package.json index 927d27e634..0bebfbb117 100644 --- a/packages/@jsii/spec/package.json +++ b/packages/@jsii/spec/package.json @@ -36,7 +36,7 @@ "devDependencies": { "@types/jest": "^26.0.20", "@types/node": "^10.17.51", - "eslint": "^7.18.0", + "eslint": "^7.19.0", "jest": "^26.6.3", "jsii-build-tools": "^0.0.0", "prettier": "^2.2.1", diff --git a/packages/codemaker/package.json b/packages/codemaker/package.json index 60afc4f3fb..d62c291782 100644 --- a/packages/codemaker/package.json +++ b/packages/codemaker/package.json @@ -39,7 +39,7 @@ "@types/fs-extra": "^8.1.1", "@types/jest": "^26.0.20", "@types/node": "^10.17.51", - "eslint": "^7.18.0", + "eslint": "^7.19.0", "jest": "^26.6.3", "prettier": "^2.2.1", "typescript": "~3.9.7" diff --git a/packages/jsii-calc/package.json b/packages/jsii-calc/package.json index 0388913eeb..a2be94b1cf 100644 --- a/packages/jsii-calc/package.json +++ b/packages/jsii-calc/package.json @@ -51,7 +51,7 @@ }, "devDependencies": { "@types/node": "^10.17.51", - "eslint": "^7.18.0", + "eslint": "^7.19.0", "jsii": "^0.0.0", "jsii-build-tools": "^0.0.0", "jsii-rosetta": "^0.0.0", diff --git a/packages/jsii-config/package.json b/packages/jsii-config/package.json index 56749cfc6e..612a33a437 100644 --- a/packages/jsii-config/package.json +++ b/packages/jsii-config/package.json @@ -24,7 +24,7 @@ "@types/jest-expect-message": "^1.0.3", "@types/node": "^10.17.51", "@types/yargs": "^15.0.12", - "eslint": "^7.18.0", + "eslint": "^7.19.0", "jest": "^26.6.3", "jest-expect-message": "^1.0.2", "prettier": "^2.2.1", diff --git a/packages/jsii-diff/package.json b/packages/jsii-diff/package.json index 2798a22489..7c05afe163 100644 --- a/packages/jsii-diff/package.json +++ b/packages/jsii-diff/package.json @@ -47,7 +47,7 @@ "@types/node": "^10.17.51", "@types/tar-fs": "^2.0.0", "@types/yargs": "^15.0.12", - "eslint": "^7.18.0", + "eslint": "^7.19.0", "jest": "^26.6.3", "jest-expect-message": "^1.0.2", "jsii": "^0.0.0", diff --git a/packages/jsii-pacmak/lib/targets/go.ts b/packages/jsii-pacmak/lib/targets/go.ts index 3706c171e2..55eb3a812c 100644 --- a/packages/jsii-pacmak/lib/targets/go.ts +++ b/packages/jsii-pacmak/lib/targets/go.ts @@ -44,8 +44,10 @@ export class Golang extends Target { // run `go build` with local.go.mod await go('build', ['-modfile', localGoMod], { cwd: pkgDir }); - // delete local.go.mod from the output directory so it doesn't get published - await fs.unlink(path.join(pkgDir, localGoMod)); + // delete local.go.mod and local.go.sum from the output directory so it doesn't get published + const localGoSum = `${path.basename(localGoMod, '.mod')}.sum`; + await fs.remove(path.join(pkgDir, localGoMod)); + await fs.remove(path.join(pkgDir, localGoSum)); } /** diff --git a/packages/jsii-pacmak/lib/targets/go/package.ts b/packages/jsii-pacmak/lib/targets/go/package.ts index 300717d0e5..feee8211d5 100644 --- a/packages/jsii-pacmak/lib/targets/go/package.ts +++ b/packages/jsii-pacmak/lib/targets/go/package.ts @@ -1,6 +1,7 @@ import { CodeMaker } from 'codemaker'; import { Assembly, Type, Submodule as JsiiSubmodule } from 'jsii-reflect'; import { join } from 'path'; +import * as semver from 'semver'; import { EmitContext } from './emit-context'; import { ReadmeFile } from './readme-file'; @@ -13,6 +14,7 @@ import { } from './runtime'; import { GoClass, GoType, Enum, Interface, Struct } from './types'; import { findTypeInTree, goPackageName, flatMap } from './util'; +import { VersionFile } from './version-file'; export const GOMOD_FILENAME = 'go.mod'; export const GO_VERSION = '1.15'; @@ -32,6 +34,7 @@ export abstract class Package { public readonly packageName: string, public readonly filePath: string, public readonly moduleName: string, + public readonly version: string, // If no root is provided, this module is the root root?: Package, ) { @@ -77,7 +80,8 @@ export abstract class Package { const prefix = moduleName !== '' ? `${moduleName}/` : ''; const rootPackageName = this.root.packageName; const suffix = this.filePath !== '' ? `/${this.filePath}` : ``; - return `${prefix}${rootPackageName}${suffix}`; + const versionSuffix = determineMajorVersionSuffix(this.version); + return `${prefix}${rootPackageName}${suffix}${versionSuffix}`; } /* @@ -181,6 +185,7 @@ export class RootPackage extends Package { public readonly assembly: Assembly; public readonly version: string; private readonly readme?: ReadmeFile; + private readonly versionFile: VersionFile; public constructor(assembly: Assembly) { const packageName = goPackageName(assembly.name); @@ -193,10 +198,12 @@ export class RootPackage extends Package { packageName, filePath, moduleName, + assembly.version, ); this.assembly = assembly; this.version = assembly.version; + this.versionFile = new VersionFile(this.version); if (this.assembly.readme?.markdown) { this.readme = new ReadmeFile( @@ -212,6 +219,7 @@ export class RootPackage extends Package { this.readme?.emit(context); this.emitGomod(context.code); + this.versionFile.emit(context.code); } private emitGomod(code: CodeMaker) { @@ -285,7 +293,7 @@ export class RootPackage extends Package { code.line('// Initialization endpoints of dependencies'); for (const pkg of dependencies) { code.line( - `${pkg.packageName} "${pkg.root.moduleName}/${pkg.root.packageName}/${JSII_INIT_PACKAGE}"`, + `${pkg.packageName} "${pkg.root.goModuleName}/${JSII_INIT_PACKAGE}"`, ); } } @@ -336,9 +344,40 @@ export class InternalPackage extends Package { packageName, filePath, root.moduleName, + root.version, root, ); this.parent = parent; } } + +/** + * Go requires that when a module major version is v2.0 and above, the module + * name will have a `/vNN` suffix (where `NN` is the major version). + * + * > Starting with major version 2, module paths must have a major version + * > suffix like /v2 that matches the major version. For example, if a module + * > has the path example.com/mod at v1.0.0, it must have the path + * > example.com/mod/v2 at version v2.0.0. + * + * @see https://golang.org/ref/mod#major-version-suffixes + * @param version The module version (e.g. `2.3.0`) + * @returns a suffix to append to the module name in the form (`/vNN`). If the + * module version is `0.x` or `1.x`, returns an empty string. + */ +function determineMajorVersionSuffix(version: string) { + const sv = semver.parse(version); + if (!sv) { + throw new Error( + `Unable to parse version "${version}" as a semantic version`, + ); + } + + // suffix is only needed for 2.0 and above + if (sv.major <= 1) { + return ''; + } + + return `/v${sv.major}`; +} diff --git a/packages/jsii-pacmak/lib/targets/go/version-file.ts b/packages/jsii-pacmak/lib/targets/go/version-file.ts new file mode 100644 index 0000000000..223126f8d9 --- /dev/null +++ b/packages/jsii-pacmak/lib/targets/go/version-file.ts @@ -0,0 +1,17 @@ +import { CodeMaker } from 'codemaker'; + +/** + * Represents the version of the go module. This is needed because the version is not + * available in standard go module files. + */ +export class VersionFile { + private static readonly NAME = 'version'; + + public constructor(private readonly version: string) {} + + public emit(code: CodeMaker) { + code.openFile(VersionFile.NAME); + code.line(this.version); + code.closeFile(VersionFile.NAME); + } +} diff --git a/packages/jsii-pacmak/package.json b/packages/jsii-pacmak/package.json index 2d4ae06d5f..d923e897d3 100644 --- a/packages/jsii-pacmak/package.json +++ b/packages/jsii-pacmak/package.json @@ -62,12 +62,12 @@ "@types/node": "^10.17.51", "@types/semver": "^7.3.4", "@types/yargs": "^15.0.12", - "eslint": "^7.18.0", + "eslint": "^7.19.0", "jest": "^26.6.3", "jsii-build-tools": "^0.0.0", "jsii-calc": "^0.0.0", "prettier": "^2.2.1", - "ts-jest": "^26.4.4", + "ts-jest": "^26.5.0", "typescript": "~3.9.7" }, "keywords": [ diff --git a/packages/jsii-pacmak/test/generated-code/__snapshots__/prerelease-identifiers.test.ts.snap b/packages/jsii-pacmak/test/generated-code/__snapshots__/prerelease-identifiers.test.ts.snap index 354526986a..912f8c63ca 100644 --- a/packages/jsii-pacmak/test/generated-code/__snapshots__/prerelease-identifiers.test.ts.snap +++ b/packages/jsii-pacmak/test/generated-code/__snapshots__/prerelease-identifiers.test.ts.snap @@ -17,9 +17,10 @@ exports[`foo@1.2.3 depends on bar@^2.0.0-rc.42: / 1`] = ` ┃ ┗━ 📁 foo ┃ ┣━ 📄 foo.go ┃ ┣━ 📄 go.mod - ┃ ┗━ 📁 jsii - ┃ ┣━ 📄 jsii.go - ┃ ┗━ 📄 tarball.embedded.go + ┃ ┣━ 📁 jsii + ┃ ┃ ┣━ 📄 jsii.go + ┃ ┃ ┗━ 📄 tarball.embedded.go + ┃ ┗━ 📄 version ┣━ 📁 java ┃ ┣━ 📄 pom.xml ┃ ┗━ 📁 src @@ -132,7 +133,7 @@ go 1.15 require ( github.com/aws/jsii-runtime-go v1337.42.1337 - bar v2.0.0-rc.42 + bar/v2 v2.0.0-rc.42 ) `; @@ -144,7 +145,7 @@ import ( rt "github.com/aws/jsii-runtime-go" "sync" // Initialization endpoints of dependencies - bar "/bar/jsii" + bar "bar/v2/jsii" ) var once sync.Once @@ -165,6 +166,11 @@ func Initialize() { exports[`foo@1.2.3 depends on bar@^2.0.0-rc.42: /go/foo/jsii/tarball.embedded.go 1`] = `go/foo/jsii/tarball.embedded.go embeds a tarball`; +exports[`foo@1.2.3 depends on bar@^2.0.0-rc.42: /go/foo/version 1`] = ` +1.2.3 + +`; + exports[`foo@1.2.3 depends on bar@^2.0.0-rc.42: /java/pom.xml 1`] = ` @@ -518,9 +524,10 @@ exports[`foo@1.2.3 depends on bar@^4.5.6-pre.1337: / 1`] = ` ┃ ┗━ 📁 foo ┃ ┣━ 📄 foo.go ┃ ┣━ 📄 go.mod - ┃ ┗━ 📁 jsii - ┃ ┣━ 📄 jsii.go - ┃ ┗━ 📄 tarball.embedded.go + ┃ ┣━ 📁 jsii + ┃ ┃ ┣━ 📄 jsii.go + ┃ ┃ ┗━ 📄 tarball.embedded.go + ┃ ┗━ 📄 version ┣━ 📁 java ┃ ┣━ 📄 pom.xml ┃ ┗━ 📁 src @@ -633,7 +640,7 @@ go 1.15 require ( github.com/aws/jsii-runtime-go v1337.42.1337 - bar v4.5.6-pre.1337 + bar/v4 v4.5.6-pre.1337 ) `; @@ -645,7 +652,7 @@ import ( rt "github.com/aws/jsii-runtime-go" "sync" // Initialization endpoints of dependencies - bar "/bar/jsii" + bar "bar/v4/jsii" ) var once sync.Once @@ -666,6 +673,11 @@ func Initialize() { exports[`foo@1.2.3 depends on bar@^4.5.6-pre.1337: /go/foo/jsii/tarball.embedded.go 1`] = `go/foo/jsii/tarball.embedded.go embeds a tarball`; +exports[`foo@1.2.3 depends on bar@^4.5.6-pre.1337: /go/foo/version 1`] = ` +1.2.3 + +`; + exports[`foo@1.2.3 depends on bar@^4.5.6-pre.1337: /java/pom.xml 1`] = ` @@ -1019,9 +1031,10 @@ exports[`foo@2.0.0-rc.42: / 1`] = ` ┃ ┗━ 📁 foo ┃ ┣━ 📄 foo.go ┃ ┣━ 📄 go.mod - ┃ ┗━ 📁 jsii - ┃ ┣━ 📄 jsii.go - ┃ ┗━ 📄 tarball.embedded.go + ┃ ┣━ 📁 jsii + ┃ ┃ ┣━ 📄 jsii.go + ┃ ┃ ┗━ 📄 tarball.embedded.go + ┃ ┗━ 📄 version ┣━ 📁 java ┃ ┣━ 📄 pom.xml ┃ ┗━ 📁 src @@ -1126,7 +1139,7 @@ import ( `; exports[`foo@2.0.0-rc.42: /go/foo/go.mod 1`] = ` -module foo +module foo/v2 go 1.15 @@ -1159,6 +1172,11 @@ func Initialize() { exports[`foo@2.0.0-rc.42: /go/foo/jsii/tarball.embedded.go 1`] = `go/foo/jsii/tarball.embedded.go embeds a tarball`; +exports[`foo@2.0.0-rc.42: /go/foo/version 1`] = ` +2.0.0-rc.42 + +`; + exports[`foo@2.0.0-rc.42: /java/pom.xml 1`] = ` @@ -1496,9 +1514,10 @@ exports[`foo@4.5.6-pre.1337: / 1`] = ` ┃ ┗━ 📁 foo ┃ ┣━ 📄 foo.go ┃ ┣━ 📄 go.mod - ┃ ┗━ 📁 jsii - ┃ ┣━ 📄 jsii.go - ┃ ┗━ 📄 tarball.embedded.go + ┃ ┣━ 📁 jsii + ┃ ┃ ┣━ 📄 jsii.go + ┃ ┃ ┗━ 📄 tarball.embedded.go + ┃ ┗━ 📄 version ┣━ 📁 java ┃ ┣━ 📄 pom.xml ┃ ┗━ 📁 src @@ -1603,7 +1622,7 @@ import ( `; exports[`foo@4.5.6-pre.1337: /go/foo/go.mod 1`] = ` -module foo +module foo/v4 go 1.15 @@ -1636,6 +1655,11 @@ func Initialize() { exports[`foo@4.5.6-pre.1337: /go/foo/jsii/tarball.embedded.go 1`] = `go/foo/jsii/tarball.embedded.go embeds a tarball`; +exports[`foo@4.5.6-pre.1337: /go/foo/version 1`] = ` +4.5.6-pre.1337 + +`; + exports[`foo@4.5.6-pre.1337: /java/pom.xml 1`] = ` diff --git a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-go.test.ts.snap b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-go.test.ts.snap index 1aa15c0284..636a6b8e52 100644 --- a/packages/jsii-pacmak/test/generated-code/__snapshots__/target-go.test.ts.snap +++ b/packages/jsii-pacmak/test/generated-code/__snapshots__/target-go.test.ts.snap @@ -8,7 +8,8 @@ exports[`Generated code for "@scope/jsii-calc-base": / 1`] = ` ┣━ 📁 jsii ┃ ┣━ 📄 jsii.go ┃ ┗━ 📄 tarball.embedded.go - ┗━ 📄 scopejsiicalcbase.go + ┣━ 📄 scopejsiicalcbase.go + ┗━ 📄 version `; exports[`Generated code for "@scope/jsii-calc-base": /go/scopejsiicalcbase/go.mod 1`] = ` @@ -202,6 +203,11 @@ func StaticConsumer_Consume(args interface{}) { } +`; + +exports[`Generated code for "@scope/jsii-calc-base": /go/scopejsiicalcbase/version 1`] = ` +0.0.0 + `; exports[`Generated code for "@scope/jsii-calc-base-of-base": / 1`] = ` @@ -212,7 +218,8 @@ exports[`Generated code for "@scope/jsii-calc-base-of-base": / 1`] = ` ┣━ 📁 jsii ┃ ┣━ 📄 jsii.go ┃ ┗━ 📄 tarball.embedded.go - ┗━ 📄 scopejsiicalcbaseofbase.go + ┣━ 📄 scopejsiicalcbaseofbase.go + ┗━ 📄 version `; exports[`Generated code for "@scope/jsii-calc-base-of-base": /go/scopejsiicalcbaseofbase/go.mod 1`] = ` @@ -360,6 +367,11 @@ func (v *VeryBaseProps) GetFoo() VeryIface { +`; + +exports[`Generated code for "@scope/jsii-calc-base-of-base": /go/scopejsiicalcbaseofbase/version 1`] = ` +0.0.0 + `; exports[`Generated code for "@scope/jsii-calc-lib": / 1`] = ` @@ -371,8 +383,9 @@ exports[`Generated code for "@scope/jsii-calc-lib": / 1`] = ` ┃ ┣━ 📄 jsii.go ┃ ┗━ 📄 tarball.embedded.go ┣━ 📄 scopejsiicalclib.go - ┗━ 📁 submodule - ┗━ 📄 submodule.go + ┣━ 📁 submodule + ┃ ┗━ 📄 submodule.go + ┗━ 📄 version `; exports[`Generated code for "@scope/jsii-calc-lib": /go/scopejsiicalclib/go.mod 1`] = ` @@ -1055,6 +1068,11 @@ func (r *Reflector) AsMap(reflectable IReflectableIface) map[string]interface{} } +`; + +exports[`Generated code for "@scope/jsii-calc-lib": /go/scopejsiicalclib/version 1`] = ` +0.0.0 + `; exports[`Generated code for "jsii-calc": / 1`] = ` @@ -1077,22 +1095,23 @@ exports[`Generated code for "jsii-calc": / 1`] = ` ┣━ 📁 pythonself ┃ ┗━ 📄 pythonself.go ┣━ 📄 README.md - ┗━ 📁 submodule - ┣━ 📁 backreferences - ┃ ┗━ 📄 backreferences.go - ┣━ 📁 child - ┃ ┗━ 📄 child.go - ┣━ 📁 isolated - ┃ ┗━ 📄 isolated.go - ┣━ 📁 nestedsubmodule - ┃ ┣━ 📁 deeplynested - ┃ ┃ ┗━ 📄 deeplynested.go - ┃ ┗━ 📄 nestedsubmodule.go - ┣━ 📁 param - ┃ ┗━ 📄 param.go - ┣━ 📁 returnsparam - ┃ ┗━ 📄 returnsparam.go - ┗━ 📄 submodule.go + ┣━ 📁 submodule + ┃ ┣━ 📁 backreferences + ┃ ┃ ┗━ 📄 backreferences.go + ┃ ┣━ 📁 child + ┃ ┃ ┗━ 📄 child.go + ┃ ┣━ 📁 isolated + ┃ ┃ ┗━ 📄 isolated.go + ┃ ┣━ 📁 nestedsubmodule + ┃ ┃ ┣━ 📁 deeplynested + ┃ ┃ ┃ ┗━ 📄 deeplynested.go + ┃ ┃ ┗━ 📄 nestedsubmodule.go + ┃ ┣━ 📁 param + ┃ ┃ ┗━ 📄 param.go + ┃ ┣━ 📁 returnsparam + ┃ ┃ ┗━ 📄 returnsparam.go + ┃ ┗━ 📄 submodule.go + ┗━ 📄 version `; exports[`Generated code for "jsii-calc": /go/jsiicalc/README.md 1`] = ` @@ -14282,4 +14301,9 @@ func (m *MyClass) MethodWithSpecialParam(param param.SpecialParameterIface) stri } +`; + +exports[`Generated code for "jsii-calc": /go/jsiicalc/version 1`] = ` +0.0.0 + `; diff --git a/packages/jsii-reflect/lib/assembly.ts b/packages/jsii-reflect/lib/assembly.ts index a96b1d71cf..08f3361258 100644 --- a/packages/jsii-reflect/lib/assembly.ts +++ b/packages/jsii-reflect/lib/assembly.ts @@ -155,7 +155,7 @@ export class Assembly extends ModuleLike { * Return the those submodules nested directly under the assembly */ public get submodules(): readonly Submodule[] { - const { submodules } = this._types; + const { submodules } = this._analyzeTypes(); return Object.entries(submodules) .filter(([name, _]) => name.split('.').length === 2) .map(([_, submodule]) => submodule); @@ -165,18 +165,10 @@ export class Assembly extends ModuleLike { * Return all submodules, even those transtively nested */ public get allSubmodules(): readonly Submodule[] { - const { submodules } = this._types; + const { submodules } = this._analyzeTypes(); return Object.values(submodules); } - /** - * All types in the assembly - */ - public get types(): readonly Type[] { - const { types } = this._types; - return Object.values(types); - } - public findType(fqn: string) { const type = this.tryFindType(fqn); if (!type) { @@ -195,6 +187,17 @@ export class Assembly extends ModuleLike { jsii.validateAssembly(this.spec); } + protected get submoduleMap(): Readonly> { + return this._analyzeTypes().submodules; + } + + /** + * All types in the root of the assembly + */ + protected get typeMap(): Readonly> { + return this._analyzeTypes().types; + } + private get _dependencies() { if (!this._dependencyCache) { this._dependencyCache = {}; @@ -212,7 +215,7 @@ export class Assembly extends ModuleLike { return this._dependencyCache; } - private get _types() { + private _analyzeTypes() { if (!this._typeCache || !this._submoduleCache) { this._typeCache = {}; @@ -255,7 +258,6 @@ export class Assembly extends ModuleLike { this._submoduleCache = mapValues(submoduleBuilders, (b) => b.build()); } - return { types: this._typeCache, submodules: this._submoduleCache }; } @@ -290,7 +292,7 @@ export class Assembly extends ModuleLike { * to translate */ class SubmoduleBuilder { - private readonly types = new Array(); + private readonly types: Record = {}; private _built?: Submodule; @@ -317,7 +319,7 @@ class SubmoduleBuilder { this.system, this.spec, this.fullName, - this.findSubmoduleBuilders().map((b) => b.build()), + mapValues(this.findSubmoduleBuilders(), (b) => b.build()), this.types, ); } @@ -328,13 +330,17 @@ class SubmoduleBuilder { * Return all the builders from the map that are nested underneath ourselves. */ private findSubmoduleBuilders() { - return Object.values(this.allModuleBuilders).filter((child) => - child.isChildOf(this), - ); + const ret: Record = {}; + for (const [k, child] of Object.entries(this.allModuleBuilders)) { + if (child.isChildOf(this)) { + ret[k] = child; + } + } + return ret; } public addType(type: Type) { - this.types.push(type); + this.types[type.fqn] = type; } } diff --git a/packages/jsii-reflect/lib/module-like.ts b/packages/jsii-reflect/lib/module-like.ts index a943106cc8..0ba8315320 100644 --- a/packages/jsii-reflect/lib/module-like.ts +++ b/packages/jsii-reflect/lib/module-like.ts @@ -10,12 +10,6 @@ import { TypeSystem } from './type-system'; export abstract class ModuleLike { public declare abstract readonly fqn: string; - /** - * Return direct submodules - */ - public declare abstract readonly submodules: readonly Submodule[]; - public declare abstract readonly types: readonly Type[]; - /** * A map of target name to configuration, which is used when generating packages for * various languages. @@ -23,8 +17,20 @@ export abstract class ModuleLike { public declare abstract readonly targets?: jsii.AssemblyTargets; public declare abstract readonly readme?: jsii.ReadMe; + protected declare abstract readonly submoduleMap: Readonly< + Record + >; + protected declare abstract readonly typeMap: Readonly>; + protected constructor(public readonly system: TypeSystem) {} + public get submodules(): readonly Submodule[] { + return Object.values(this.submoduleMap); + } + public get types(): readonly Type[] { + return Object.values(this.typeMap); + } + public get classes(): readonly ClassType[] { return this.types .filter((t) => t instanceof ClassType) @@ -44,7 +50,7 @@ export abstract class ModuleLike { } public tryFindType(fqn: string): Type | undefined { - const ownType = this.types.find((type) => type.fqn === fqn); + const ownType = this.typeMap[fqn]; if (ownType != null) { return ownType; } @@ -58,7 +64,7 @@ export abstract class ModuleLike { .split('.') .slice(0, myFqnLength + 1) .join('.'); - const sub = this.submodules.find((sub) => sub.fqn === subFqn); + const sub = this.submoduleMap[subFqn]; return sub?.tryFindType(fqn); } } diff --git a/packages/jsii-reflect/lib/submodule.ts b/packages/jsii-reflect/lib/submodule.ts index 1b6177cff5..56d84d4feb 100644 --- a/packages/jsii-reflect/lib/submodule.ts +++ b/packages/jsii-reflect/lib/submodule.ts @@ -14,8 +14,8 @@ export class Submodule extends ModuleLike { system: TypeSystem, public readonly spec: jsii.Submodule, public readonly fqn: string, - public readonly submodules: readonly Submodule[], - public readonly types: readonly Type[], + protected readonly submoduleMap: Readonly>, + protected readonly typeMap: Readonly>, ) { super(system); diff --git a/packages/jsii-reflect/package.json b/packages/jsii-reflect/package.json index 4d31d52691..ad14e0aeb0 100644 --- a/packages/jsii-reflect/package.json +++ b/packages/jsii-reflect/package.json @@ -46,7 +46,7 @@ "@types/jest": "^26.0.20", "@types/node": "^10.17.51", "@types/yargs": "^15.0.12", - "eslint": "^7.18.0", + "eslint": "^7.19.0", "jest": "^26.6.3", "jsii": "^0.0.0", "jsii-build-tools": "^0.0.0", diff --git a/packages/jsii-rosetta/package.json b/packages/jsii-rosetta/package.json index 0b6e095f71..2f037566f2 100644 --- a/packages/jsii-rosetta/package.json +++ b/packages/jsii-rosetta/package.json @@ -22,7 +22,7 @@ "@types/mock-fs": "^4.13.0", "@types/node": "^10.17.51", "@types/yargs": "^15.0.12", - "eslint": "^7.18.0", + "eslint": "^7.19.0", "jest": "^26.6.3", "jsii": "^0.0.0", "jsii-build-tools": "^0.0.0", diff --git a/packages/jsii/lib/assembler.ts b/packages/jsii/lib/assembler.ts index 5b6c7e920c..e77401eb56 100644 --- a/packages/jsii/lib/assembler.ts +++ b/packages/jsii/lib/assembler.ts @@ -21,6 +21,7 @@ import * as bindings from './node-bindings'; import { ProjectInfo } from './project-info'; import { isReservedName } from './reserved-words'; import { DeprecatedRemover } from './transforms/deprecated-remover'; +import { RuntimeTypeInfoInjector } from './transforms/runtime-info'; import { TsCommentReplacer } from './transforms/ts-comment-replacer'; import { combinedTransformers } from './transforms/utils'; import { Validator } from './validator'; @@ -37,6 +38,7 @@ const LOG = log4js.getLogger('jsii/assembler'); */ export class Assembler implements Emitter { private readonly commentReplacer = new TsCommentReplacer(); + private readonly runtimeTypeInfoInjector: RuntimeTypeInfoInjector; private readonly deprecatedRemover?: DeprecatedRemover; private readonly mainFile: string; @@ -92,11 +94,15 @@ export class Assembler implements Emitter { } this.mainFile = path.resolve(projectInfo.projectRoot, mainFile); + this.runtimeTypeInfoInjector = new RuntimeTypeInfoInjector( + projectInfo.version, + ); } public get customTransformers(): ts.CustomTransformers { return combinedTransformers( this.deprecatedRemover?.customTransformers ?? {}, + this.runtimeTypeInfoInjector.makeTransformers(), this.commentReplacer.makeTransformers(), ); } @@ -891,6 +897,9 @@ export class Assembler implements Emitter { this._typeChecker.getTypeAtLocation(node), context, ); + if (jsiiType) { + this.registerExportedClassFqn(node, jsiiType.fqn); + } } else if (ts.isInterfaceDeclaration(node) && _isExported(node)) { // export interface Name { ... } this._validateHeritageClauses(node.heritageClauses); @@ -2574,6 +2583,14 @@ export class Assembler implements Emitter { } } + /** + * Updates the runtime type info with the fully-qualified name for the current class definition. + * Used by the runtime type info injector to add this information to the compiled file. + */ + private registerExportedClassFqn(clazz: ts.ClassDeclaration, fqn: string) { + this.runtimeTypeInfoInjector.registerClassFqn(clazz, fqn); + } + /** * From the given JSIIDocs, re-render the TSDoc comment for the Node * diff --git a/packages/jsii/lib/transforms/runtime-info.ts b/packages/jsii/lib/transforms/runtime-info.ts new file mode 100644 index 0000000000..d980b14e0f --- /dev/null +++ b/packages/jsii/lib/transforms/runtime-info.ts @@ -0,0 +1,144 @@ +import * as ts from 'typescript'; + +/** + * Provides a TransformerFactory to annotate classes with runtime information + * (e.g., fully-qualified name, version). + * + * It does this by first inserting this definition at the top of each source file: + * ``` + * var JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti"); + * ``` + * + * Then, for each class that has registered runtime information during assembly, + * insert a static member to the class with its fqn and version: + * ``` + * private static readonly [JSII_RTTI_SYMBOL_1] = { fqn: "ModuleName.ClassName", version: "1.2.3" } + * ``` + */ +export class RuntimeTypeInfoInjector { + private readonly fqnsByClass = new Map(); + + public constructor(private readonly version: string) {} + + /** + * Register the fully-qualified name (fqn) of a class with its ClassDeclaration. + * Only ClassDeclarations with registered fqns will be annotated. + */ + public registerClassFqn(clazz: ts.ClassDeclaration, fqn: string) { + this.fqnsByClass.set(clazz, fqn); + } + + /** + * Return the set of Transformers to be used in TSC's program.emit() + */ + public makeTransformers(): ts.CustomTransformers { + return { + before: [this.runtimeTypeTransformer()], + }; + } + + public runtimeTypeTransformer(): ts.TransformerFactory { + return (context) => { + return (sourceFile) => { + const rttiSymbolIdentifier = ts.createUniqueName('JSII_RTTI_SYMBOL'); + + let classesAnnotated = false; + const visitor = (node: ts.Node): ts.Node => { + if (ts.isClassDeclaration(node)) { + const fqn = this.getClassFqn(node); + if (fqn) { + classesAnnotated = true; + return this.addRuntimeInfoToClass( + node, + fqn, + rttiSymbolIdentifier, + ); + } + } + return ts.visitEachChild(node, visitor, context); + }; + + // Visit the source file, annotating the classes. + let annotatedSourceFile = ts.visitNode(sourceFile, visitor); + + // Only add the symbol definition if it's actually used. + if (classesAnnotated) { + const rttiSymbol = ts.createCall( + ts.createPropertyAccess( + ts.createIdentifier('Symbol'), + ts.createIdentifier('for'), + ), + undefined, + [ts.createStringLiteral('jsii.rtti')], + ); + const rttiSymbolDeclaration = ts.createVariableDeclaration( + rttiSymbolIdentifier, + undefined, + rttiSymbol, + ); + const variableDeclaration = ts.createVariableStatement( + [], + ts.createVariableDeclarationList( + [rttiSymbolDeclaration], + ts.NodeFlags.Const, + ), + ); + + annotatedSourceFile = ts.updateSourceFileNode(annotatedSourceFile, [ + variableDeclaration, + ...annotatedSourceFile.statements, + ]); + } + + return annotatedSourceFile; + }; + }; + } + + /** Used instead of direct access to the map to faciliate testing. */ + protected getClassFqn(clazz: ts.ClassDeclaration): string | undefined { + return this.fqnsByClass.get(clazz); + } + + /** + * If the ClassDeclaration has an associated fully-qualified name registered, + * will append a static property to the class with the fqn and version. + */ + private addRuntimeInfoToClass( + node: ts.ClassDeclaration, + fqn: string, + rttiSymbol: ts.Identifier, + ): ts.ClassDeclaration { + const runtimeInfo = ts.createObjectLiteral([ + ts.createPropertyAssignment( + ts.createIdentifier('fqn'), + ts.createStringLiteral(fqn), + ), + ts.createPropertyAssignment( + ts.createIdentifier('version'), + ts.createStringLiteral(this.version), + ), + ]); + const runtimeProperty = ts.createProperty( + undefined, + ts.createModifiersFromModifierFlags( + ts.ModifierFlags.Private | + ts.ModifierFlags.Static | + ts.ModifierFlags.Readonly, + ), + ts.createComputedPropertyName(rttiSymbol), + undefined, + undefined, + runtimeInfo, + ); + return ts.updateClassDeclaration( + node, + node.decorators, + node.modifiers, + node.name, + node.typeParameters, + node.heritageClauses, + [runtimeProperty, ...node.members], + ); + } +} diff --git a/packages/jsii/package.json b/packages/jsii/package.json index 4a43d2863e..5279597de8 100644 --- a/packages/jsii/package.json +++ b/packages/jsii/package.json @@ -57,11 +57,11 @@ "@types/semver": "^7.3.4", "@types/yargs": "^15.0.12", "clone": "^2.1.2", - "eslint": "^7.18.0", + "eslint": "^7.19.0", "jest": "^26.6.3", "jest-expect-message": "^1.0.2", "jsii-build-tools": "^0.0.0", "prettier": "^2.2.1", - "ts-jest": "^26.4.4" + "ts-jest": "^26.5.0" } } diff --git a/packages/jsii/test/transforms/runtime-info.test.ts b/packages/jsii/test/transforms/runtime-info.test.ts new file mode 100644 index 0000000000..130b41f0b2 --- /dev/null +++ b/packages/jsii/test/transforms/runtime-info.test.ts @@ -0,0 +1,154 @@ +import * as ts from 'typescript'; + +import { RuntimeTypeInfoInjector } from '../../lib/transforms/runtime-info'; + +test('leaves files without classes unaltered', () => { + expect(transformedSource(EXAMPLE_NO_CLASS, 'Foo')).not.toContain( + 'JSII_RTTI_SYMBOL', + ); +}); + +test('leaves files without classes with metadata unaltered', () => { + expect(transformedSource(EXAMPLE_SINGLE_CLASS)).not.toContain( + 'JSII_RTTI_SYMBOL', + ); +}); + +test('adds jsii.rtti symbol at the top of each file when classes are present', () => { + expect(transformedSource(EXAMPLE_SINGLE_CLASS, 'Foo')).toContain( + 'const JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti");', + ); +}); + +test('adds runtime info for a class', () => { + expect(transformedSource(EXAMPLE_SINGLE_CLASS, 'Foo')).toContain( + 'private static readonly [JSII_RTTI_SYMBOL_1] = { fqn: "RuntimeInfoTest.Foo", version: "1.2.3" }', + ); +}); + +test('adds runtime info for each class', () => { + const transformed = transformedSource(EXAMPLE_MULTIPLE_CLASSES, 'Foo', 'Bar'); + expect(transformed).toContain( + 'private static readonly [JSII_RTTI_SYMBOL_1] = { fqn: "RuntimeInfoTest.Foo", version: "1.2.3" }', + ); + expect(transformed).toContain( + 'private static readonly [JSII_RTTI_SYMBOL_1] = { fqn: "RuntimeInfoTest.Bar", version: "1.2.3" }', + ); +}); + +test('skips runtime info if not available', () => { + const transformed = transformedSource(EXAMPLE_MULTIPLE_CLASSES, 'Foo'); + expect(transformed).toContain( + 'private static readonly [JSII_RTTI_SYMBOL_1] = { fqn: "RuntimeInfoTest.Foo", version: "1.2.3" }', + ); + expect(transformed).not.toContain( + 'private static readonly [JSII_RTTI_SYMBOL_1] = { fqn: "RuntimeInfoTest.Bar", version: "1.2.3" }', + ); +}); + +test('creates a unique name if the default is taken', () => { + // Conflicting example has existing variable for JSII_RTTI_SYMBOL_1, so transformation should use _2. + const transformed = transformedSource(EXAMPLE_CONFLICTING_NAME, 'Foo'); + expect(transformed).toContain( + 'const JSII_RTTI_SYMBOL_2 = Symbol.for("jsii.rtti");', + ); + expect(transformed).toContain( + 'private static readonly [JSII_RTTI_SYMBOL_2] = { fqn: "RuntimeInfoTest.Foo", version: "1.2.3" }', + ); +}); + +function transformedSource(source: string, ...classNames: string[]) { + const mockedTypeInfo = mockedTypeInfoForClasses(...classNames); + const injector = new TestRuntimeTypeInfoInjector(mockedTypeInfo); + const transformed = ts.transform( + ts.createSourceFile('source.ts', source, ts.ScriptTarget.Latest), + [injector.runtimeTypeTransformer()], + ); + return ts + .createPrinter() + .printBundle(ts.createBundle(transformed.transformed)); +} + +/** Test subclass of RuntimeTypeInfoInjector that accepts overrides for type info */ +class TestRuntimeTypeInfoInjector extends RuntimeTypeInfoInjector { + public constructor(private readonly typeInfo: Map) { + super('1.2.3'); + } + + protected getClassFqn(clazz: ts.ClassDeclaration): string | undefined { + return clazz.name ? this.typeInfo.get(clazz.name.text) : undefined; + } +} + +/** + * Mock the Map of classes to fqns. + * This assumes each class name only appears once in the source, + * which is a reasonable assumption for these tests. + */ +function mockedTypeInfoForClasses( + ...classNames: string[] +): Map { + const typeInfoMap = new Map(); + classNames.forEach((clazz) => + typeInfoMap.set(clazz, `RuntimeInfoTest.${clazz}`), + ); + return typeInfoMap; +} + +/** + * =============================== + * = EXAMPLE SOURCE FILES = + * =============================== + */ + +const EXAMPLE_NO_CLASS = ` +import * as ts from 'typescript'; + +interface Foo { + readonly foobar: string; +} +`; + +const EXAMPLE_SINGLE_CLASS = ` +import * as ts from 'typescript'; + +class Foo { + constructor(public readonly bar: string) {} +} +`; + +const EXAMPLE_MULTIPLE_CLASSES = ` +class Foo { + constructor(public readonly bar: string) {} + public doStuff() { return 42; } +} + +interface FooBar { + readonly answer: number; +} + +/** + * A bar. + */ +class Bar { + public doStuffToo() { + return new class implements FooBar { + public readonly answer = 21; + }(); + } +} + +export default class { + constructor() {} +} +`; + +const EXAMPLE_CONFLICTING_NAME = ` +import * as ts from 'typescript'; + +const JSII_RTTI_SYMBOL_1 = 42; + +class Foo { + constructor(public readonly bar: string) {} +} +`; diff --git a/packages/oo-ascii-tree/package.json b/packages/oo-ascii-tree/package.json index 09c25d5add..1c15a54dbe 100644 --- a/packages/oo-ascii-tree/package.json +++ b/packages/oo-ascii-tree/package.json @@ -33,7 +33,7 @@ "devDependencies": { "@types/jest": "^26.0.20", "@types/node": "^10.17.51", - "eslint": "^7.18.0", + "eslint": "^7.19.0", "jest": "^26.6.3", "jsii-build-tools": "^0.0.0", "prettier": "^2.2.1", diff --git a/yarn.lock b/yarn.lock index 6b9bd82bd9..480aed6ebe 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1710,13 +1710,13 @@ dependencies: "@types/yargs-parser" "*" -"@typescript-eslint/eslint-plugin@^4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.14.1.tgz#22dd301ce228aaab3416b14ead10b1db3e7d3180" - integrity sha512-5JriGbYhtqMS1kRcZTQxndz1lKMwwEXKbwZbkUZNnp6MJX0+OVXnG0kOlBZP4LUAxEyzu3cs+EXd/97MJXsGfw== +"@typescript-eslint/eslint-plugin@^4.14.2": + version "4.14.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.14.2.tgz#47a15803cfab89580b96933d348c2721f3d2f6fe" + integrity sha512-uMGfG7GFYK/nYutK/iqYJv6K/Xuog/vrRRZX9aEP4Zv1jsYXuvFUMDFLhUnc8WFv3D2R5QhNQL3VYKmvLS5zsQ== dependencies: - "@typescript-eslint/experimental-utils" "4.14.1" - "@typescript-eslint/scope-manager" "4.14.1" + "@typescript-eslint/experimental-utils" "4.14.2" + "@typescript-eslint/scope-manager" "4.14.2" debug "^4.1.1" functional-red-black-tree "^1.0.1" lodash "^4.17.15" @@ -1724,48 +1724,48 @@ semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/experimental-utils@4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.14.1.tgz#a5c945cb24dabb96747180e1cfc8487f8066f471" - integrity sha512-2CuHWOJwvpw0LofbyG5gvYjEyoJeSvVH2PnfUQSn0KQr4v8Dql2pr43ohmx4fdPQ/eVoTSFjTi/bsGEXl/zUUQ== +"@typescript-eslint/experimental-utils@4.14.2": + version "4.14.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.14.2.tgz#9df35049d1d36b6cbaba534d703648b9e1f05cbb" + integrity sha512-mV9pmET4C2y2WlyHmD+Iun8SAEqkLahHGBkGqDVslHkmoj3VnxnGP4ANlwuxxfq1BsKdl/MPieDbohCEQgKrwA== dependencies: "@types/json-schema" "^7.0.3" - "@typescript-eslint/scope-manager" "4.14.1" - "@typescript-eslint/types" "4.14.1" - "@typescript-eslint/typescript-estree" "4.14.1" + "@typescript-eslint/scope-manager" "4.14.2" + "@typescript-eslint/types" "4.14.2" + "@typescript-eslint/typescript-estree" "4.14.2" eslint-scope "^5.0.0" eslint-utils "^2.0.0" -"@typescript-eslint/parser@^4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.14.1.tgz#3bd6c24710cd557d8446625284bcc9c6d52817c6" - integrity sha512-mL3+gU18g9JPsHZuKMZ8Z0Ss9YP1S5xYZ7n68Z98GnPq02pYNQuRXL85b9GYhl6jpdvUc45Km7hAl71vybjUmw== +"@typescript-eslint/parser@^4.14.2": + version "4.14.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.14.2.tgz#31e216e4baab678a56e539f9db9862e2542c98d0" + integrity sha512-ipqSP6EuUsMu3E10EZIApOJgWSpcNXeKZaFeNKQyzqxnQl8eQCbV+TSNsl+s2GViX2d18m1rq3CWgnpOxDPgHg== dependencies: - "@typescript-eslint/scope-manager" "4.14.1" - "@typescript-eslint/types" "4.14.1" - "@typescript-eslint/typescript-estree" "4.14.1" + "@typescript-eslint/scope-manager" "4.14.2" + "@typescript-eslint/types" "4.14.2" + "@typescript-eslint/typescript-estree" "4.14.2" debug "^4.1.1" -"@typescript-eslint/scope-manager@4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.14.1.tgz#8444534254c6f370e9aa974f035ced7fe713ce02" - integrity sha512-F4bjJcSqXqHnC9JGUlnqSa3fC2YH5zTtmACS1Hk+WX/nFB0guuynVK5ev35D4XZbdKjulXBAQMyRr216kmxghw== +"@typescript-eslint/scope-manager@4.14.2": + version "4.14.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.14.2.tgz#64cbc9ca64b60069aae0c060b2bf81163243b266" + integrity sha512-cuV9wMrzKm6yIuV48aTPfIeqErt5xceTheAgk70N1V4/2Ecj+fhl34iro/vIssJlb7XtzcaD07hWk7Jk0nKghg== dependencies: - "@typescript-eslint/types" "4.14.1" - "@typescript-eslint/visitor-keys" "4.14.1" + "@typescript-eslint/types" "4.14.2" + "@typescript-eslint/visitor-keys" "4.14.2" -"@typescript-eslint/types@4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.14.1.tgz#b3d2eb91dafd0fd8b3fce7c61512ac66bd0364aa" - integrity sha512-SkhzHdI/AllAgQSxXM89XwS1Tkic7csPdndUuTKabEwRcEfR8uQ/iPA3Dgio1rqsV3jtqZhY0QQni8rLswJM2w== +"@typescript-eslint/types@4.14.2": + version "4.14.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.14.2.tgz#d96da62be22dc9dc6a06647f3633815350fb3174" + integrity sha512-LltxawRW6wXy4Gck6ZKlBD05tCHQUj4KLn4iR69IyRiDHX3d3NCAhO+ix5OR2Q+q9bjCrHE/HKt+riZkd1At8Q== -"@typescript-eslint/typescript-estree@4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.14.1.tgz#20d3b8c8e3cdc8f764bdd5e5b0606dd83da6075b" - integrity sha512-M8+7MbzKC1PvJIA8kR2sSBnex8bsR5auatLCnVlNTJczmJgqRn8M+sAlQfkEq7M4IY3WmaNJ+LJjPVRrREVSHQ== +"@typescript-eslint/typescript-estree@4.14.2": + version "4.14.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.14.2.tgz#9c5ebd8cae4d7b014f890acd81e8e17f309c9df9" + integrity sha512-ESiFl8afXxt1dNj8ENEZT12p+jl9PqRur+Y19m0Z/SPikGL6rqq4e7Me60SU9a2M28uz48/8yct97VQYaGl0Vg== dependencies: - "@typescript-eslint/types" "4.14.1" - "@typescript-eslint/visitor-keys" "4.14.1" + "@typescript-eslint/types" "4.14.2" + "@typescript-eslint/visitor-keys" "4.14.2" debug "^4.1.1" globby "^11.0.1" is-glob "^4.0.1" @@ -1773,12 +1773,12 @@ semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/visitor-keys@4.14.1": - version "4.14.1" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.14.1.tgz#e93c2ff27f47ee477a929b970ca89d60a117da91" - integrity sha512-TAblbDXOI7bd0C/9PE1G+AFo7R5uc+ty1ArDoxmrC1ah61Hn6shURKy7gLdRb1qKJmjHkqu5Oq+e4Kt0jwf1IA== +"@typescript-eslint/visitor-keys@4.14.2": + version "4.14.2" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.14.2.tgz#997cbe2cb0690e1f384a833f64794e98727c70c6" + integrity sha512-KBB+xLBxnBdTENs/rUgeUKO0UkPBRs2vD09oMRRIkj5BEN8PX1ToXV532desXfpQnZsYTyLLviS7JrPhdL154w== dependencies: - "@typescript-eslint/types" "4.14.1" + "@typescript-eslint/types" "4.14.2" eslint-visitor-keys "^2.0.0" "@webassemblyjs/ast@1.11.0": @@ -3792,10 +3792,10 @@ eslint-visitor-keys@^2.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8" integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== -eslint@^7.18.0: - version "7.18.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.18.0.tgz#7fdcd2f3715a41fe6295a16234bd69aed2c75e67" - integrity sha512-fbgTiE8BfUJZuBeq2Yi7J3RB3WGUQ9PNuNbmgi6jt9Iv8qrkxfy19Ds3OpL1Pm7zg3BtTVhvcUZbIRQ0wmSjAQ== +eslint@^7.19.0: + version "7.19.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.19.0.tgz#6719621b196b5fad72e43387981314e5d0dc3f41" + integrity sha512-CGlMgJY56JZ9ZSYhJuhow61lMPPjUzWmChFya71Z/jilVos7mR/jPgaEfVGgMBY5DshbKdG8Ezb8FDCHcoMEMg== dependencies: "@babel/code-frame" "^7.0.0" "@eslint/eslintrc" "^0.3.0" @@ -6036,11 +6036,6 @@ lodash.ismatch@^4.4.0: resolved "https://registry.yarnpkg.com/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz#756cb5150ca3ba6f11085a78849645f188f85f37" integrity sha1-dWy1FQyjum8RCFp4hJZF8Yj4Xzc= -lodash.memoize@4.x: - version "4.1.2" - resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" - integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4= - lodash.set@^4.3.2: version "4.3.2" resolved "https://registry.yarnpkg.com/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23" @@ -6071,7 +6066,7 @@ lodash.uniq@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= -lodash@^4.11.2, lodash@^4.17.12, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.2.1: +lodash@4.x, lodash@^4.11.2, lodash@^4.17.12, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.2.1: version "4.17.20" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== @@ -8709,10 +8704,10 @@ trim-off-newlines@^1.0.0: resolved "https://registry.yarnpkg.com/trim-off-newlines/-/trim-off-newlines-1.0.1.tgz#9f9ba9d9efa8764c387698bcbfeb2c848f11adb3" integrity sha1-n5up2e+odkw4dpi8v+sshI8RrbM= -ts-jest@^26.4.4: - version "26.4.4" - resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.4.4.tgz#61f13fb21ab400853c532270e52cc0ed7e502c49" - integrity sha512-3lFWKbLxJm34QxyVNNCgXX1u4o/RV0myvA2y2Bxm46iGIjKlaY0own9gIckbjZJPn+WaJEnfPPJ20HHGpoq4yg== +ts-jest@^26.5.0: + version "26.5.0" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-26.5.0.tgz#3e3417d91bc40178a6716d7dacc5b0505835aa21" + integrity sha512-Ya4IQgvIFNa2Mgq52KaO8yBw2W8tWp61Ecl66VjF0f5JaV8u50nGoptHVILOPGoI7SDnShmEqnYQEmyHdQ+56g== dependencies: "@types/jest" "26.x" bs-logger "0.x" @@ -8720,7 +8715,7 @@ ts-jest@^26.4.4: fast-json-stable-stringify "2.x" jest-util "^26.1.0" json5 "2.x" - lodash.memoize "4.x" + lodash "4.x" make-error "1.x" mkdirp "1.x" semver "7.x" @@ -9121,10 +9116,10 @@ webpack-sources@^2.1.1: source-list-map "^2.0.1" source-map "^0.6.1" -webpack@^5.18.0: - version "5.18.0" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.18.0.tgz#bbcf13094aa0da0534d513f27d7ee72d74e499c6" - integrity sha512-RmiP/iy6ROvVe/S+u0TrvL/oOmvP+2+Bs8MWjvBwwY/j82Q51XJyDJ75m0QAGntL1Wx6B//Xc0+4VPP/hlNHmw== +webpack@^5.19.0: + version "5.19.0" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.19.0.tgz#1a5fee84dd63557e68336b0774ac4a1c81aa2c73" + integrity sha512-egX19vAQ8fZ4cVYtA9Y941eqJtcZAK68mQq87MMv+GTXKZOc3TpKBBxdGX+HXUYlquPxiluNsJ1VHvwwklW7CQ== dependencies: "@types/eslint-scope" "^3.7.0" "@types/estree" "^0.0.46"