diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index df7d512..fb2e5e2 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -10,8 +10,8 @@ jobs: strategy: matrix: - os: [windows-latest, macos-latest, ubuntu-18.04] - node: [14, 16, 17] + os: [windows-latest, macos-latest, ubuntu-latest] + node: [14.19.0, 16, 17, 18] steps: - name: Checkout code diff --git a/README.md b/README.md index 7a67dc5..b880f27 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Downloads per month NPM version -Dependencies +Dependencies Contributors code style: prettier License: MIT @@ -64,9 +64,9 @@ If you are looking for a Typescript REPL, or a way to _execute_ a full Typescrip [Become a sponsor/backer](https://github.com/wessberg/ts-evaluator?sponsor=1) and get your logo listed here. -| Bubbles | Christopher Blanchard | Ideal Postcodes | Xerox | Trent Raymond | scrubtheweb | -| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | -| [Bubbles](https://usebubbles.com)
Twitter: [@usebubbles](https://twitter.com/usebubbles) | [Christopher Blanchard](https://github.com/cblanc) | [Ideal Postcodes](https://github.com/ideal-postcodes) | [Xerox](https://www.xerox.com) | [Trent Raymond](https://changelog.me) | [scrubtheweb](https://scrubtheweb.com) | +| Bubbles | Christopher Blanchard | Ideal Postcodes | Xerox | Trent Raymond | scrubtheweb | Joel | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | +| [Bubbles](https://usebubbles.com)
Twitter: [@usebubbles](https://twitter.com/usebubbles) | [Christopher Blanchard](https://github.com/cblanc) | [Ideal Postcodes](https://github.com/ideal-postcodes) | [Xerox](https://www.xerox.com) | [Trent Raymond](https://changelog.me) | [scrubtheweb](https://scrubtheweb.com) | [Joel](https://github.com/hjoelh) | ### Patreon @@ -128,7 +128,7 @@ $ pnpm add ts-evaluator `ts-evaluator` depends on `typescript`, so you need to manually install this as well. -You may also need to install additional peer dependencies such as `jsdom` or `chalk` depending on the features you are going to use. Refer to the documentation for the specific cases where any of these may be relevant. +You may also need to install `jsdom` depending on the features you are going to use. Refer to the documentation for the specific cases where it may be relevant. @@ -164,12 +164,14 @@ you don't have to evaluate the entire program to produce a value which may poten ### Setting up an environment -You can define the kind of environment that `evaluate()` assumes when evaluating the given Node. By default, a `Node` environment is assumed. +You can define the kind of environment that `evaluate()` assumes when evaluating the given Node. By default, a CommonJS-based `Node` environment is assumed, to align with what you would get simply by running `node` with no arguments. The following environment presets are supported: - `ECMA` - Assumes a pure ECMAScript environment. This means that no other globals than those that are defined in the ECMAScript spec such as `Math`, `Promise`, `Object`, etc, are available. -- `NODE` _(default)_ - Assumes a Node environment. This means that built-in modules such as `fs` and `path` can be resolved, and Node-specific globals such as `process` is present. +- `NODE` _(default)_ - Assumes a CommonJS-based Node.js environment. This means that built-in modules such as `fs` and `path` can be resolved, and Node-specific globals such as `process` is present, as well as ones that are only present in a CommonJS-based Node.js environment, such as `require`, `__dirname`, and `__filename`. +- `NODE_CJS` - An alias for `NODE`. +- `NODE_ESM` - Assumes an ESM-based Node.js environment. This means that built-in modules such as `fs` and `path` can be resolved, and Node-specific globals such as `process` is present, as well as ones that are only present in an ESM-based Node.js environment, such as `import.meta`. - `BROWSER` - Assumes a Browser environment. This means that DOM APIs are available and Browser-specific globals such as `window` is present. Beyond presets, you can provide additional globals or override those that comes from the presets. @@ -179,7 +181,7 @@ Here's how you can configure environment options: const result = evaluate({ // ... environment: { - // The "Node" environment is the default one. You can simply omit this key if you are targeting a Node environment + // The "Node" environment is the default one. You can simply omit this key if you are targeting a CommonJS-based Node environment preset: "NODE", extra: { someGlobal: "someValue" diff --git a/package.json b/package.json index 7fe2111..6025c0e 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,8 @@ "preversion": "pnpm run lint && pnpm run build", "version": "pnpm run generate:all && git add .", "release": "np --no-cleanup --no-yarn --no-tests", - "update:check": "pnpx npm-check-updates -x typescript-*,chalk,ava --dep dev,prod", - "update:commit": "pnpx npm-check-updates -u -x typescript-*,chalk,ava --dep dev,prod && pnpm update && pnpm install" + "update:check": "pnpx npm-check-updates -x typescript-*,ava --dep dev,prod", + "update:commit": "pnpx npm-check-updates -u -x typescript-*,ava --dep dev,prod && pnpm update && pnpm install" }, "keywords": [ "typescript", @@ -45,36 +45,36 @@ "license": "MIT", "devDependencies": { "@types/jsdom": "^16.2.14", - "@types/node": "^17.0.35", + "@types/node": "^17.0.37", "@types/object-path": "^0.11.1", "@types/semver": "^7.3.9", - "@typescript-eslint/eslint-plugin": "^5.26.0", - "@typescript-eslint/parser": "^5.26.0", + "@typescript-eslint/eslint-plugin": "^5.27.0", + "@typescript-eslint/parser": "^5.27.0", "@wessberg/ts-config": "^2.0.2", - "rollup-plugin-ts": "2.0.7", + "@wessberg/prettier-config": "^1.0.0", + "rollup-plugin-ts": "3.0.1", "ava": "^3.15.0", - "crosspath": "^1.0.0", + "crosspath": "^2.0.0", "eslint": "^8.16.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-import": "^2.26.0", - "eslint-plugin-jsdoc": "^39.3.1", + "eslint-plugin-jsdoc": "^39.3.2", "helpertypes": "^0.0.18", "husky": "^8.0.1", - "memfs": "^3.4.3", + "memfs": "^3.4.4", "np": "7.6.1", "npm-check-updates": "^13.0.3", - "pnpm": "^7.1.5", + "pnpm": "^7.1.7", "prettier": "^2.6.2", "pretty-quick": "^3.1.3", "rimraf": "^3.0.2", - "rollup": "^2.74.1", - "sandhog": "^1.0.43", + "rollup": "^2.75.4", + "sandhog": "^2.0.2", "semver": "7.3.7", "jsdom": "^19.0.0", - "chalk": "^4.1.2", "standard-changelog": "^2.0.27", "ts-node": "^10.8.0", - "typescript": "4.6.4", + "typescript": "^4.7.2", "typescript-3-4-1": "npm:typescript@3.4.1", "typescript-3-5-1": "npm:typescript@3.5.1", "typescript-3-6-2": "npm:typescript@3.6.2", @@ -90,27 +90,26 @@ "typescript-4-6-4": "npm:typescript@4.6.4" }, "dependencies": { + "ansi-colors": "^4.1.3", "object-path": "^0.11.8" }, "peerDependencies": { "typescript": ">=3.2.x || >= 4.x", - "jsdom": ">=14.x", - "chalk": ">=4.x" + "jsdom": ">=14.x" }, "peerDependenciesMeta": { "jsdom": { "optional": true - }, - "chalk": { - "optional": true } }, - "main": "./dist/cjs/index.js", - "module": "./dist/esm/index.js", - "browser": "./dist/esm/index.js", + "exports": { + "import": "./dist/esm/index.js", + "require": "./dist/cjs/index.cjs" + }, + "type": "module", "types": "./dist/esm/index.d.ts", - "typings": "./dist/esm/index.d.ts", - "es2015": "./dist/esm/index.js", + "main": "./dist/cjs/index.cjs", + "module": "./dist/esm/index.js", "funding": { "type": "github", "url": "https://github.com/wessberg/ts-evaluator?sponsor=1" @@ -123,22 +122,26 @@ "url": "https://github.com/wessberg/ts-evaluator/issues" }, "engines": { - "node": ">=10.1.0" + "node": ">=14.19.0" }, + "prettier": "@wessberg/prettier-config", "ava": { "files": [ "test/**/**.test.ts" ], "verbose": true, - "timeout": "300s", - "extensions": [ - "ts" + "timeout": "400s", + "nonSemVerExperiments": { + "configurableModuleFormat": true + }, + "extensions": { + "ts": "module" + }, + "nodeArguments": [ + "--loader=ts-node/esm" ], "environmentVariables": { - "NODE_OPTIONS": "--max_old_space_size=4096" - }, - "require": [ - "ts-node/register/transpile-only" - ] + "FORCE_COLOR": "3" + } } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f43efe4..3f3b324 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2,37 +2,38 @@ lockfileVersion: 5.4 specifiers: '@types/jsdom': ^16.2.14 - '@types/node': ^17.0.35 + '@types/node': ^17.0.41 '@types/object-path': ^0.11.1 '@types/semver': ^7.3.9 - '@typescript-eslint/eslint-plugin': ^5.26.0 - '@typescript-eslint/parser': ^5.26.0 - '@wessberg/ts-config': ^2.0.2 + '@typescript-eslint/eslint-plugin': ^5.27.1 + '@typescript-eslint/parser': ^5.27.1 + '@wessberg/prettier-config': ^1.0.0 + '@wessberg/ts-config': ^2.0.3 + ansi-colors: ^4.1.3 ava: ^3.15.0 - chalk: ^4.1.2 - crosspath: ^1.0.0 - eslint: ^8.16.0 + crosspath: ^2.0.0 + eslint: ^8.17.0 eslint-config-prettier: ^8.5.0 eslint-plugin-import: ^2.26.0 - eslint-plugin-jsdoc: ^39.3.1 + eslint-plugin-jsdoc: ^39.3.2 helpertypes: ^0.0.18 husky: ^8.0.1 jsdom: ^19.0.0 - memfs: ^3.4.3 + memfs: ^3.4.4 np: 7.6.1 - npm-check-updates: ^13.0.3 + npm-check-updates: ^13.1.1 object-path: ^0.11.8 - pnpm: ^7.1.5 + pnpm: ^7.1.9 prettier: ^2.6.2 pretty-quick: ^3.1.3 rimraf: ^3.0.2 - rollup: ^2.74.1 - rollup-plugin-ts: 2.0.7 - sandhog: ^1.0.43 + rollup: ^2.75.6 + rollup-plugin-ts: 3.0.1 + sandhog: ^2.0.2 semver: 7.3.7 standard-changelog: ^2.0.27 - ts-node: ^10.8.0 - typescript: 4.6.4 + ts-node: ^10.8.1 + typescript: ^4.7.3 typescript-3-4-1: npm:typescript@3.4.1 typescript-3-5-1: npm:typescript@3.5.1 typescript-3-6-2: npm:typescript@3.6.2 @@ -48,40 +49,41 @@ specifiers: typescript-4-6-4: npm:typescript@4.6.4 dependencies: + ansi-colors: 4.1.3 object-path: 0.11.8 devDependencies: '@types/jsdom': 16.2.14 - '@types/node': 17.0.35 + '@types/node': 17.0.41 '@types/object-path': 0.11.1 '@types/semver': 7.3.9 - '@typescript-eslint/eslint-plugin': 5.26.0_gu4clceiw6ditaem5r577qrdpi - '@typescript-eslint/parser': 5.26.0_utdtartgf6fqqgkivzeynh76la - '@wessberg/ts-config': 2.0.2 + '@typescript-eslint/eslint-plugin': 5.27.1_aq7uryhocdbvbqum33pitcm3y4 + '@typescript-eslint/parser': 5.27.1_ud6rd4xtew5bv4yhvkvu24pzm4 + '@wessberg/prettier-config': 1.0.0 + '@wessberg/ts-config': 2.0.3 ava: 3.15.0 - chalk: 4.1.2 - crosspath: 1.0.0 - eslint: 8.16.0 - eslint-config-prettier: 8.5.0_eslint@8.16.0 - eslint-plugin-import: 2.26.0_eslint@8.16.0 - eslint-plugin-jsdoc: 39.3.1_eslint@8.16.0 + crosspath: 2.0.0 + eslint: 8.17.0 + eslint-config-prettier: 8.5.0_eslint@8.17.0 + eslint-plugin-import: 2.26.0_pv5w3e62ssxduf5aiwxbc3knra + eslint-plugin-jsdoc: 39.3.2_eslint@8.17.0 helpertypes: 0.0.18 husky: 8.0.1 jsdom: 19.0.0 - memfs: 3.4.3 + memfs: 3.4.4 np: 7.6.1 - npm-check-updates: 13.0.3 - pnpm: 7.1.5 + npm-check-updates: 13.1.1 + pnpm: 7.1.9 prettier: 2.6.2 pretty-quick: 3.1.3_prettier@2.6.2 rimraf: 3.0.2 - rollup: 2.74.1 - rollup-plugin-ts: 2.0.7_lq4dy2bb4fhoyaf2vwyb4geyfa - sandhog: 1.0.43 + rollup: 2.75.6 + rollup-plugin-ts: 3.0.1_fgms252lqu3rk7srzpqqayl4ya + sandhog: 2.0.2 semver: 7.3.7 standard-changelog: 2.0.27 - ts-node: 10.8.0_ihi2kx3po6rqbrzdqgpcfvwinm - typescript: 4.6.4 + ts-node: 10.8.1_f5eqjuxkorpjvs4z7mviievvou + typescript: 4.7.3 typescript-3-4-1: /typescript/3.4.1 typescript-3-5-1: /typescript/3.5.1 typescript-3-6-2: /typescript/3.6.2 @@ -224,6 +226,13 @@ packages: fastq: 1.13.0 dev: true + /@npmcli/fs/1.1.1: + resolution: {integrity: sha512-8KG5RD0GVP4ydEzRn/I4BNDuxDtqVbOdm8675T49OIG/NGhaK0pjPX7ZcDlvKYbA+ulvVK3ztfcF4uBdOxuJbQ==} + dependencies: + '@gar/promisify': 1.1.3 + semver: 7.3.7 + dev: true + /@npmcli/fs/2.1.0: resolution: {integrity: sha512-DmfBvNXGaetMxj9LTp8NAN9vEidXURrf5ZTslQzEAi/6GbW+4yjaLFQc6Tue5cpZ9Frlk4OBo/Snf1Bh/S7qTQ==} engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} @@ -245,6 +254,8 @@ packages: promise-retry: 2.0.1 semver: 7.3.7 which: 2.0.2 + transitivePeerDependencies: + - bluebird dev: true /@npmcli/installed-package-contents/1.0.7: @@ -256,6 +267,14 @@ packages: npm-normalize-package-bin: 1.0.1 dev: true + /@npmcli/move-file/1.1.2: + resolution: {integrity: sha512-1SUf/Cg2GzGDyaf15aR9St9TWlb+XvbZXWpDx8YKs7MLzMH/BCeopv+y9vzrzgkfykCGuWOlSu3mZhj2+FQcrg==} + engines: {node: '>=10'} + dependencies: + mkdirp: 1.0.4 + rimraf: 3.0.2 + dev: true + /@npmcli/move-file/2.0.0: resolution: {integrity: sha512-UR6D5f4KEGWJV6BGPH3Qb2EtgH+t+1XQ1Tt85c7qicN6cezzuHPdZwwAxqZr4JLtnQu0LZsTza/5gmNmSl8XLg==} engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} @@ -276,15 +295,16 @@ packages: infer-owner: 1.0.4 dev: true - /@npmcli/run-script/3.0.2: - resolution: {integrity: sha512-vdjD/PMBl+OX9j9C9irx5sCCIKfp2PWkpPNH9zxvlJAfSZ3Qp5aU412v+O3PFJl3R1PFNwuyChCqHg4ma6ci2Q==} + /@npmcli/run-script/3.0.3: + resolution: {integrity: sha512-ZXL6qgC5NjwfZJ2nET+ZSLEz/PJgJ/5CU90C2S66dZY4Jw73DasS4ZCXuy/KHWYP0imjJ4VtA+Gebb5BxxKp9Q==} engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} dependencies: '@npmcli/node-gyp': 2.0.0 '@npmcli/promise-spawn': 3.0.0 - node-gyp: 9.0.0 + node-gyp: 8.4.1 read-package-json-fast: 2.0.3 transitivePeerDependencies: + - bluebird - supports-color dev: true @@ -308,8 +328,10 @@ packages: zen-observable: optional: true dependencies: - any-observable: 0.3.0 + any-observable: 0.3.0_rxjs@6.6.7 rxjs: 6.6.7 + transitivePeerDependencies: + - zenObservable dev: true /@sindresorhus/is/0.14.0: @@ -341,6 +363,11 @@ packages: defer-to-connect: 2.0.1 dev: true + /@tootallnate/once/1.1.2: + resolution: {integrity: sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==} + engines: {node: '>= 6'} + dev: true + /@tootallnate/once/2.0.0: resolution: {integrity: sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==} engines: {node: '>= 10'} @@ -367,7 +394,7 @@ packages: dependencies: '@types/http-cache-semantics': 4.0.1 '@types/keyv': 3.1.4 - '@types/node': 17.0.35 + '@types/node': 17.0.41 '@types/responselike': 1.0.0 dev: true @@ -378,7 +405,7 @@ packages: /@types/jsdom/16.2.14: resolution: {integrity: sha512-6BAy1xXEmMuHeAJ4Fv4yXKwBDTGTOseExKE3OaHiNycdHdZw59KfYzrt0DkDluvwmik1HRt6QS7bImxUmpSy+w==} dependencies: - '@types/node': 17.0.35 + '@types/node': 17.0.41 '@types/parse5': 6.0.3 '@types/tough-cookie': 4.0.2 dev: true @@ -398,7 +425,7 @@ packages: /@types/keyv/3.1.4: resolution: {integrity: sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==} dependencies: - '@types/node': 17.0.35 + '@types/node': 17.0.41 dev: true /@types/minimatch/3.0.5: @@ -409,12 +436,8 @@ packages: resolution: {integrity: sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ==} dev: true - /@types/node/16.11.36: - resolution: {integrity: sha512-FR5QJe+TaoZ2GsMHkjuwoNabr+UrJNRr2HNOo+r/7vhcuntM6Ee/pRPOnRhhL2XE9OOvX9VLEq+BcXl3VjNoWA==} - dev: true - - /@types/node/17.0.35: - resolution: {integrity: sha512-vu1SrqBjbbZ3J6vwY17jBs8Sr/BKA+/a/WtjRG+whKg1iuLFOosq872EXS0eXWILdO36DHQQeku/ZcL6hz2fpg==} + /@types/node/17.0.41: + resolution: {integrity: sha512-xA6drNNeqb5YyV5fO3OAEsnXLfO7uF0whiOfPTz5AeDo8KeZFmODKnvwPymMNO8qE/an8pVY/O50tig2SQCrGw==} dev: true /@types/normalize-package-data/2.4.1: @@ -433,14 +456,14 @@ packages: resolution: {integrity: sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==} dev: true - /@types/prettier/2.6.1: - resolution: {integrity: sha512-XFjFHmaLVifrAKaZ+EKghFHtHSUonyw8P2Qmy2/+osBnrKbH9UYtlK10zg8/kCt47MFilll/DEDKy3DHfJ0URw==} + /@types/prettier/2.6.3: + resolution: {integrity: sha512-ymZk3LEC/fsut+/Q5qejp6R9O1rMxz3XaRHDV6kX8MrGAhOSPqVARbDi+EZvInBpw+BnCX3TD240byVkOfQsHg==} dev: true /@types/responselike/1.0.0: resolution: {integrity: sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==} dependencies: - '@types/node': 17.0.35 + '@types/node': 17.0.41 dev: true /@types/semver/7.3.9: @@ -455,8 +478,8 @@ packages: resolution: {integrity: sha512-N1rW+njavs70y2cApeIw1vLMYXRwfBy+7trgavGuuTfOd7j1Yh7QTRc/yqsPl6ncokt72ZXuxEU0PiCp9bSwNQ==} dev: true - /@typescript-eslint/eslint-plugin/5.26.0_gu4clceiw6ditaem5r577qrdpi: - resolution: {integrity: sha512-oGCmo0PqnRZZndr+KwvvAUvD3kNE4AfyoGCwOZpoCncSh4MVD06JTE8XQa2u9u+NX5CsyZMBTEc2C72zx38eYA==} + /@typescript-eslint/eslint-plugin/5.27.1_aq7uryhocdbvbqum33pitcm3y4: + resolution: {integrity: sha512-6dM5NKT57ZduNnJfpY81Phe9nc9wolnMCnknb1im6brWi1RYv84nbMS3olJa27B6+irUVV1X/Wb+Am0FjJdGFw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: '@typescript-eslint/parser': ^5.0.0 @@ -466,24 +489,24 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/parser': 5.26.0_utdtartgf6fqqgkivzeynh76la - '@typescript-eslint/scope-manager': 5.26.0 - '@typescript-eslint/type-utils': 5.26.0_utdtartgf6fqqgkivzeynh76la - '@typescript-eslint/utils': 5.26.0_utdtartgf6fqqgkivzeynh76la + '@typescript-eslint/parser': 5.27.1_ud6rd4xtew5bv4yhvkvu24pzm4 + '@typescript-eslint/scope-manager': 5.27.1 + '@typescript-eslint/type-utils': 5.27.1_ud6rd4xtew5bv4yhvkvu24pzm4 + '@typescript-eslint/utils': 5.27.1_ud6rd4xtew5bv4yhvkvu24pzm4 debug: 4.3.4 - eslint: 8.16.0 + eslint: 8.17.0 functional-red-black-tree: 1.0.1 ignore: 5.2.0 regexpp: 3.2.0 semver: 7.3.7 - tsutils: 3.21.0_typescript@4.6.4 - typescript: 4.6.4 + tsutils: 3.21.0_typescript@4.7.3 + typescript: 4.7.3 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/parser/5.26.0_utdtartgf6fqqgkivzeynh76la: - resolution: {integrity: sha512-n/IzU87ttzIdnAH5vQ4BBDnLPly7rC5VnjN3m0xBG82HK6rhRxnCb3w/GyWbNDghPd+NktJqB/wl6+YkzZ5T5Q==} + /@typescript-eslint/parser/5.27.1_ud6rd4xtew5bv4yhvkvu24pzm4: + resolution: {integrity: sha512-7Va2ZOkHi5NP+AZwb5ReLgNF6nWLGTeUJfxdkVUAPPSaAdbWNnFZzLZ4EGGmmiCTg+AwlbE1KyUYTBglosSLHQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 @@ -492,26 +515,26 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 5.26.0 - '@typescript-eslint/types': 5.26.0 - '@typescript-eslint/typescript-estree': 5.26.0_typescript@4.6.4 + '@typescript-eslint/scope-manager': 5.27.1 + '@typescript-eslint/types': 5.27.1 + '@typescript-eslint/typescript-estree': 5.27.1_typescript@4.7.3 debug: 4.3.4 - eslint: 8.16.0 - typescript: 4.6.4 + eslint: 8.17.0 + typescript: 4.7.3 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/scope-manager/5.26.0: - resolution: {integrity: sha512-gVzTJUESuTwiju/7NiTb4c5oqod8xt5GhMbExKsCTp6adU3mya6AGJ4Pl9xC7x2DX9UYFsjImC0mA62BCY22Iw==} + /@typescript-eslint/scope-manager/5.27.1: + resolution: {integrity: sha512-fQEOSa/QroWE6fAEg+bJxtRZJTH8NTskggybogHt4H9Da8zd4cJji76gA5SBlR0MgtwF7rebxTbDKB49YUCpAg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.26.0 - '@typescript-eslint/visitor-keys': 5.26.0 + '@typescript-eslint/types': 5.27.1 + '@typescript-eslint/visitor-keys': 5.27.1 dev: true - /@typescript-eslint/type-utils/5.26.0_utdtartgf6fqqgkivzeynh76la: - resolution: {integrity: sha512-7ccbUVWGLmcRDSA1+ADkDBl5fP87EJt0fnijsMFTVHXKGduYMgienC/i3QwoVhDADUAPoytgjbZbCOMj4TY55A==} + /@typescript-eslint/type-utils/5.27.1_ud6rd4xtew5bv4yhvkvu24pzm4: + resolution: {integrity: sha512-+UC1vVUWaDHRnC2cQrCJ4QtVjpjjCgjNFpg8b03nERmkHv9JV9X5M19D7UFMd+/G7T/sgFwX2pGmWK38rqyvXw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: '*' @@ -520,22 +543,22 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/utils': 5.26.0_utdtartgf6fqqgkivzeynh76la + '@typescript-eslint/utils': 5.27.1_ud6rd4xtew5bv4yhvkvu24pzm4 debug: 4.3.4 - eslint: 8.16.0 - tsutils: 3.21.0_typescript@4.6.4 - typescript: 4.6.4 + eslint: 8.17.0 + tsutils: 3.21.0_typescript@4.7.3 + typescript: 4.7.3 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/types/5.26.0: - resolution: {integrity: sha512-8794JZFE1RN4XaExLWLI2oSXsVImNkl79PzTOOWt9h0UHROwJedNOD2IJyfL0NbddFllcktGIO2aOu10avQQyA==} + /@typescript-eslint/types/5.27.1: + resolution: {integrity: sha512-LgogNVkBhCTZU/m8XgEYIWICD6m4dmEDbKXESCbqOXfKZxRKeqpiJXQIErv66sdopRKZPo5l32ymNqibYEH/xg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /@typescript-eslint/typescript-estree/5.26.0_typescript@4.6.4: - resolution: {integrity: sha512-EyGpw6eQDsfD6jIqmXP3rU5oHScZ51tL/cZgFbFBvWuCwrIptl+oueUZzSmLtxFuSOQ9vDcJIs+279gnJkfd1w==} + /@typescript-eslint/typescript-estree/5.27.1_typescript@4.7.3: + resolution: {integrity: sha512-DnZvvq3TAJ5ke+hk0LklvxwYsnXpRdqUY5gaVS0D4raKtbznPz71UJGnPTHEFo0GDxqLOLdMkkmVZjSpET1hFw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: typescript: '*' @@ -543,51 +566,55 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 5.26.0 - '@typescript-eslint/visitor-keys': 5.26.0 + '@typescript-eslint/types': 5.27.1 + '@typescript-eslint/visitor-keys': 5.27.1 debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 semver: 7.3.7 - tsutils: 3.21.0_typescript@4.6.4 - typescript: 4.6.4 + tsutils: 3.21.0_typescript@4.7.3 + typescript: 4.7.3 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/utils/5.26.0_utdtartgf6fqqgkivzeynh76la: - resolution: {integrity: sha512-PJFwcTq2Pt4AMOKfe3zQOdez6InIDOjUJJD3v3LyEtxHGVVRK3Vo7Dd923t/4M9hSH2q2CLvcTdxlLPjcIk3eg==} + /@typescript-eslint/utils/5.27.1_ud6rd4xtew5bv4yhvkvu24pzm4: + resolution: {integrity: sha512-mZ9WEn1ZLDaVrhRaYgzbkXBkTPghPFsup8zDbbsYTxC5OmqrFE7skkKS/sraVsLP3TcT3Ki5CSyEFBRkLH/H/w==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: '@types/json-schema': 7.0.11 - '@typescript-eslint/scope-manager': 5.26.0 - '@typescript-eslint/types': 5.26.0 - '@typescript-eslint/typescript-estree': 5.26.0_typescript@4.6.4 - eslint: 8.16.0 + '@typescript-eslint/scope-manager': 5.27.1 + '@typescript-eslint/types': 5.27.1 + '@typescript-eslint/typescript-estree': 5.27.1_typescript@4.7.3 + eslint: 8.17.0 eslint-scope: 5.1.1 - eslint-utils: 3.0.0_eslint@8.16.0 + eslint-utils: 3.0.0_eslint@8.17.0 transitivePeerDependencies: - supports-color - typescript dev: true - /@typescript-eslint/visitor-keys/5.26.0: - resolution: {integrity: sha512-wei+ffqHanYDOQgg/fS6Hcar6wAWv0CUPQ3TZzOWd2BLfgP539rb49bwua8WRAs7R6kOSLn82rfEu2ro6Llt8Q==} + /@typescript-eslint/visitor-keys/5.27.1: + resolution: {integrity: sha512-xYs6ffo01nhdJgPieyk7HAOpjhTsx7r/oB9LWEhwAXgwn33tkr+W8DI2ChboqhZlC4q3TC6geDYPoiX8ROqyOQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - '@typescript-eslint/types': 5.26.0 + '@typescript-eslint/types': 5.27.1 eslint-visitor-keys: 3.3.0 dev: true + /@wessberg/prettier-config/1.0.0: + resolution: {integrity: sha512-iavB1OppqxDIIWqgakHC7gLVAZTBFckq/32CWJf+EOQYJ4cLdsNe4TF/QIcO4sqWgtzR8SDj8mSGhgKwZGqLBA==} + dev: true + /@wessberg/stringutil/1.0.19: resolution: {integrity: sha512-9AZHVXWlpN8Cn9k5BC/O0Dzb9E9xfEMXzYrNunwvkUTvuK7xgQPVRZpLo+jWCOZ5r8oBa8NIrHuPEu1hzbb6bg==} engines: {node: '>=8.0.0'} dev: true - /@wessberg/ts-config/2.0.2: - resolution: {integrity: sha512-iOgplpBVrf+eXCINeRFR2W+LnhzlQP9dFmo3lkB7cdER9a3M45/z8mEgXOHM2CWUwquX7b0jVKUlTKBZaOU9pA==} + /@wessberg/ts-config/2.0.3: + resolution: {integrity: sha512-j/ZQoPoB9mjdVsZduT74JzzKX13GqCDIdnXZUf3baegSzOHk4PdDNgefqTB1ozIWlJk0UFJBflBCVWDQ/98Dhw==} dev: true /JSONStream/1.3.5: @@ -690,6 +717,10 @@ packages: string-width: 4.2.3 dev: true + /ansi-colors/4.1.3: + resolution: {integrity: sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==} + engines: {node: '>=6'} + /ansi-escapes/3.2.0: resolution: {integrity: sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==} engines: {node: '>=4'} @@ -758,9 +789,19 @@ packages: engines: {node: '>=0.10.0'} dev: true - /any-observable/0.3.0: + /any-observable/0.3.0_rxjs@6.6.7: resolution: {integrity: sha512-/FQM1EDkTsf63Ub2C6O7GuYFDsSXUwsaZDurV0np41ocwq0jthUAYCmhBX9f+KwlaCgIuWyr/4WlUQUBfKfZog==} engines: {node: '>=6'} + peerDependencies: + rxjs: '*' + zenObservable: '*' + peerDependenciesMeta: + rxjs: + optional: true + zenObservable: + optional: true + dependencies: + rxjs: 6.6.7 dev: true /any-observable/0.5.1_rxjs@6.6.7: @@ -1024,7 +1065,7 @@ packages: '@types/semver': 7.3.9 '@types/ua-parser-js': 0.7.36 browserslist: 4.20.2 - caniuse-lite: 1.0.30001342 + caniuse-lite: 1.0.30001349 isbot: 3.4.5 object-path: 0.11.8 semver: 7.3.7 @@ -1036,20 +1077,20 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001342 - electron-to-chromium: 1.4.138 + caniuse-lite: 1.0.30001349 + electron-to-chromium: 1.4.147 escalade: 3.1.1 node-releases: 2.0.5 picocolors: 1.0.0 dev: true - /browserslist/4.20.3: - resolution: {integrity: sha512-NBhymBQl1zM0Y5dQT/O+xiLP9/rzOIQdKM/eMJBAq7yBgaB6krIYLGejrwVYnSHZdqjscB1SPuAjHwxjvN6Wdg==} + /browserslist/4.20.4: + resolution: {integrity: sha512-ok1d+1WpnU24XYN7oC3QWgTyMhY/avPJ/r9T00xxvUOIparA/gc+UPUMaod3i+G6s+nI2nUb9xZ5k794uIwShw==} engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001342 - electron-to-chromium: 1.4.138 + caniuse-lite: 1.0.30001349 + electron-to-chromium: 1.4.147 escalade: 3.1.1 node-releases: 2.0.5 picocolors: 1.0.0 @@ -1076,8 +1117,34 @@ packages: semver: 7.3.7 dev: true - /cacache/16.1.0: - resolution: {integrity: sha512-Pk4aQkwCW82A4jGKFvcGkQFqZcMspfP9YWq9Pr87/ldDvlWf718zeI6KWCdKt/jeihu6BytHRUicJPB1K2k8EQ==} + /cacache/15.3.0: + resolution: {integrity: sha512-VVdYzXEn+cnbXpFgWs5hTT7OScegHVmLhJIR8Ufqk3iFD6A6j5iSX1KuBTfNEv4tdJWE2PzA6IVFtcLC7fN9wQ==} + engines: {node: '>= 10'} + dependencies: + '@npmcli/fs': 1.1.1 + '@npmcli/move-file': 1.1.2 + chownr: 2.0.0 + fs-minipass: 2.1.0 + glob: 7.2.3 + infer-owner: 1.0.4 + lru-cache: 6.0.0 + minipass: 3.1.6 + minipass-collect: 1.0.2 + minipass-flush: 1.0.5 + minipass-pipeline: 1.2.4 + mkdirp: 1.0.4 + p-map: 4.0.0 + promise-inflight: 1.0.1 + rimraf: 3.0.2 + ssri: 8.0.1 + tar: 6.1.11 + unique-filename: 1.1.1 + transitivePeerDependencies: + - bluebird + dev: true + + /cacache/16.1.1: + resolution: {integrity: sha512-VDKN+LHyCQXaaYZ7rA/qtkURU+/yYhviUdvqEv2LT6QPZU8jpyzEkEVAcKlKLt5dJ5BRp11ym8lo3NKLluEPLg==} engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} dependencies: '@npmcli/fs': 2.1.0 @@ -1098,6 +1165,8 @@ packages: ssri: 9.0.1 tar: 6.1.11 unique-filename: 1.1.1 + transitivePeerDependencies: + - bluebird dev: true /cacheable-lookup/2.0.1: @@ -1165,8 +1234,8 @@ packages: engines: {node: '>=10'} dev: true - /caniuse-lite/1.0.30001342: - resolution: {integrity: sha512-bn6sOCu7L7jcbBbyNhLg0qzXdJ/PMbybZTH/BA6Roet9wxYRm6Tr9D0s0uhLkOZ6MSG+QU6txUgdpr3MXIVqjA==} + /caniuse-lite/1.0.30001349: + resolution: {integrity: sha512-VFaWW3jeo6DLU5rwdiasosxhYSduJgSGil4cSyX3/85fbctlE58pXAkWyuRmVA0r2RxsOSVYUTZcySJ8WpbTxw==} dev: true /chalk/1.1.3: @@ -1320,13 +1389,13 @@ packages: dev: true /clone-response/1.0.2: - resolution: {integrity: sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=} + resolution: {integrity: sha512-yjLXh88P599UOyPTFX0POsd7WxnbsVsGohcwzHOLspIhhpalPw1BcqED8NblyZLKcGrL8dTgMlcaZxV2jAD41Q==} dependencies: mimic-response: 1.0.1 dev: true /clone/1.0.4: - resolution: {integrity: sha1-2jCcwmPfFZlMaIypAheco8fNfH4=} + resolution: {integrity: sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==} engines: {node: '>=0.8'} dev: true @@ -1338,7 +1407,7 @@ packages: dev: true /code-point-at/1.1.0: - resolution: {integrity: sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=} + resolution: {integrity: sha512-RpAVKQA5T63xEj6/giIbUEtZwJ4UFIc3ZtvEkiaUERylqe8xb5IvqcgOurZLahv93CLKfxcw5YI+DZcUBRyLXA==} engines: {node: '>=0.10.0'} dev: true @@ -1363,7 +1432,7 @@ packages: dev: true /color-name/1.1.3: - resolution: {integrity: sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=} + resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==} dev: true /color-name/1.1.4: @@ -1387,13 +1456,8 @@ packages: delayed-stream: 1.0.0 dev: true - /commander/8.3.0: - resolution: {integrity: sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==} - engines: {node: '>= 12'} - dev: true - - /commander/9.2.0: - resolution: {integrity: sha512-e2i4wANQiSXgnrBlIatyHtP1odfUp0BbV5Y5nEGbxtIrStkEOAAzCUirvLBNXHLr7kwLvJl6V+4V3XV9x7Wd9w==} + /commander/9.3.0: + resolution: {integrity: sha512-hv95iU5uXPbK83mjrJKuZyFM/LBAoCV/XhVGkS5Je6tl7sxr6A0ITMw5WoRV46/UaJ46Nllm3Xt7IaJhXTIkzw==} engines: {node: ^12.20.0 || >=14} dev: true @@ -1413,14 +1477,14 @@ packages: dot-prop: 5.3.0 dev: true - /compatfactory/0.0.13_typescript@4.6.4: - resolution: {integrity: sha512-k9Sl/Qal3xQPnjAFZaRpl7jlCh0hDEhVaxyiTMfiHKC/w5TYn4Nds+7340X/v1OrAQC5xGBtaD2JpWgPhXWaAw==} - engines: {node: '>=10.0.0'} + /compatfactory/1.0.1_typescript@4.7.3: + resolution: {integrity: sha512-hR9u0HSZTKDNNchPtMHg6myeNx0XO+av7UZIJPsi4rPALJBHi/W5Mbwi19hC/xm6y3JkYpxVYjTqnSGsU5X/iw==} + engines: {node: '>=14.9.0'} peerDependencies: typescript: '>=3.x || >= 4.x' dependencies: helpertypes: 0.0.18 - typescript: 4.6.4 + typescript: 4.7.3 dev: true /compress-brotli/1.3.8: @@ -1478,7 +1542,7 @@ packages: dev: true /console-control-strings/1.1.0: - resolution: {integrity: sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=} + resolution: {integrity: sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==} dev: true /conventional-changelog-angular/5.0.13: @@ -1553,7 +1617,7 @@ packages: dev: true /convert-to-spaces/1.0.2: - resolution: {integrity: sha1-fj5Iu+bZl7FBfdyihoIEtNPYVxU=} + resolution: {integrity: sha512-cj09EBuObp9gZNQCzc7hByQyrs6jVGE+o9kSJmeUoj+GiPiJvi5LYqEH/Hmme4+MTLHM+Ejtq+FChpjjEnsPdQ==} engines: {node: '>= 4'} dev: true @@ -1585,11 +1649,11 @@ packages: which: 2.0.2 dev: true - /crosspath/1.0.0: - resolution: {integrity: sha512-mpjkSErNO6vioL/Cde2aF4UBysPFEMyn+1AN1t7Oc4yqvzSRWe8iBte4P8BHyjo64OmC+ZBxwjIqmpSpIWiQ7Q==} - engines: {node: '>=10.0.0'} + /crosspath/2.0.0: + resolution: {integrity: sha512-ju88BYCQ2uvjO2bR+SsgLSTwTSctU+6Vp2ePbKPgSCZyy4MWZxYsT738DlKVRE5utUjobjPRm1MkTYKJxCmpTA==} + engines: {node: '>=14.9.0'} dependencies: - '@types/node': 16.11.36 + '@types/node': 17.0.41 dev: true /crypto-random-string/2.0.0: @@ -1613,7 +1677,7 @@ packages: dev: true /currently-unhandled/0.4.1: - resolution: {integrity: sha1-mI3zP+qxke95mmE2nddsF635V+o=} + resolution: {integrity: sha512-/fITjgjGU50vjQ4FH6eUoYu+iUoUKIXws2hL15JJpIR+BbTxaXQsMuuyjtNh2WqsSBS5nsaZHFsFecyw5CCAng==} engines: {node: '>=0.10.0'} dependencies: array-find-index: 1.0.2 @@ -1650,12 +1714,22 @@ packages: /debug/2.6.9: resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true dependencies: ms: 2.0.0 dev: true /debug/3.2.7: resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true dependencies: ms: 2.1.3 dev: true @@ -1673,7 +1747,7 @@ packages: dev: true /decamelize-keys/1.1.0: - resolution: {integrity: sha1-0XGoeTMlKAfrPLYdwcFEXQeN8tk=} + resolution: {integrity: sha512-ocLWuYzRPoS9bfiSdDd3cxvrzovVMZnRDVEzAs+hWIVXGDbHxWMECij2OBuyB/An0FFW/nLuq6Kv1i/YC5Qfzg==} engines: {node: '>=0.10.0'} dependencies: decamelize: 1.2.0 @@ -1681,7 +1755,7 @@ packages: dev: true /decamelize/1.2.0: - resolution: {integrity: sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=} + resolution: {integrity: sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==} engines: {node: '>=0.10.0'} dev: true @@ -1690,7 +1764,7 @@ packages: dev: true /decompress-response/3.3.0: - resolution: {integrity: sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=} + resolution: {integrity: sha512-BzRPQuY1ip+qDonAOz42gRm/pg9F768C+npV/4JOsxRC2sq+Rlk+Q4ZCAsOhnIaMrgarILY+RMUIvMmmX1qAEA==} engines: {node: '>=4'} dependencies: mimic-response: 1.0.1 @@ -1713,7 +1787,7 @@ packages: dev: true /defaults/1.0.3: - resolution: {integrity: sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=} + resolution: {integrity: sha512-s82itHOnYrN0Ib8r+z7laQz3sdE+4FP3d9Q7VLO7U+KRT+CR0GsWuyHxzdAY82I7cXv0G/twrqomTJLOssO5HA==} dependencies: clone: 1.0.4 dev: true @@ -1750,21 +1824,21 @@ packages: dev: true /delayed-stream/1.0.0: - resolution: {integrity: sha1-3zrhmayt+31ECqrgsp4icrJOxhk=} + resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} dev: true /delegates/1.0.0: - resolution: {integrity: sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=} + resolution: {integrity: sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ==} dev: true /depd/1.1.2: - resolution: {integrity: sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=} + resolution: {integrity: sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==} engines: {node: '>= 0.6'} dev: true /diacritics-map/0.1.0: - resolution: {integrity: sha1-bfwP+dAQAKLt8oZTccrDFulJd68=} + resolution: {integrity: sha512-3omnDTYrGigU0i4cJjvaKwD52B8aoqyX/NEIkukFFkogBemsIbhSa1O414fpTp5nuszJG6lvQ5vBvDVNCbSsaQ==} engines: {node: '>=0.8.0'} dev: true @@ -1816,15 +1890,15 @@ packages: dev: true /duplexer3/0.1.4: - resolution: {integrity: sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=} + resolution: {integrity: sha512-CEj8FwwNA4cVH2uFCoHUrmojhYh1vmCdOaneKJXwkeY1i9jnlslVo9dx+hQ5Hl9GnH/Bwy/IjxAyOePyPKYnzA==} dev: true - /electron-to-chromium/1.4.138: - resolution: {integrity: sha512-IOyp2Seq3w4QLln+yZWcMF3VXhhduz4bwg9gfI+CnP5TkzwNXQ8FCZuwwPsnes73AfWdf5J2n2OXdUwDUspDPQ==} + /electron-to-chromium/1.4.147: + resolution: {integrity: sha512-czclPqxLMPqPMkahKcske4TaS5lcznsc26ByBlEFDU8grTBVK9C5W6K9I6oEEhm4Ai4jTihGnys90xY1yjXcRg==} dev: true /elegant-spinner/1.0.1: - resolution: {integrity: sha1-2wQ1IcldfjA/2PNFvtwzSc+wcp4=} + resolution: {integrity: sha512-B+ZM+RXvRqQaAmkMlO/oSe5nMUOaUnyfGYCEHoR8wrXsZR2mA0XVibsxV1bvTwxdRWah1PkQqso2EzhILGHtEQ==} engines: {node: '>=0.10.0'} dev: true @@ -1857,7 +1931,7 @@ packages: dev: true /equal-length/1.0.1: - resolution: {integrity: sha1-IcoRLUirJLTh5//A5TOdMf38J0w=} + resolution: {integrity: sha512-TK2m7MvWPt/v3dan0BCNp99pytIE5UGrUj7F0KZirNX8xz8fDFUAZfgm8uB5FuQq9u0sMeDocYBfEhsd1nwGoA==} engines: {node: '>=4'} dev: true @@ -1891,7 +1965,7 @@ packages: is-shared-array-buffer: 1.0.2 is-string: 1.0.7 is-weakref: 1.0.2 - object-inspect: 1.12.1 + object-inspect: 1.12.2 object-keys: 1.1.1 object.assign: 4.1.2 regexp.prototype.flags: 1.4.3 @@ -1931,7 +2005,7 @@ packages: dev: true /escape-string-regexp/1.0.5: - resolution: {integrity: sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=} + resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} engines: {node: '>=0.8.0'} dev: true @@ -1958,13 +2032,13 @@ packages: source-map: 0.6.1 dev: true - /eslint-config-prettier/8.5.0_eslint@8.16.0: + /eslint-config-prettier/8.5.0_eslint@8.17.0: resolution: {integrity: sha512-obmWKLUNCnhtQRKc+tmnYuQl0pFU1ibYJQ5BGhTVB08bHe9wC8qUeG7c08dj9XX+AuPj1YSGSQIHl1pnDHZR0Q==} hasBin: true peerDependencies: eslint: '>=7.0.0' dependencies: - eslint: 8.16.0 + eslint: 8.17.0 dev: true /eslint-import-resolver-node/0.3.6: @@ -1972,29 +2046,54 @@ packages: dependencies: debug: 3.2.7 resolve: 1.22.0 + transitivePeerDependencies: + - supports-color dev: true - /eslint-module-utils/2.7.3: + /eslint-module-utils/2.7.3_5uhabtgzo3akfzi73a5jap3i6a: resolution: {integrity: sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==} engines: {node: '>=4'} + peerDependencies: + '@typescript-eslint/parser': '*' + eslint-import-resolver-node: '*' + eslint-import-resolver-typescript: '*' + eslint-import-resolver-webpack: '*' + peerDependenciesMeta: + '@typescript-eslint/parser': + optional: true + eslint-import-resolver-node: + optional: true + eslint-import-resolver-typescript: + optional: true + eslint-import-resolver-webpack: + optional: true dependencies: + '@typescript-eslint/parser': 5.27.1_ud6rd4xtew5bv4yhvkvu24pzm4 debug: 3.2.7 + eslint-import-resolver-node: 0.3.6 find-up: 2.1.0 + transitivePeerDependencies: + - supports-color dev: true - /eslint-plugin-import/2.26.0_eslint@8.16.0: + /eslint-plugin-import/2.26.0_pv5w3e62ssxduf5aiwxbc3knra: resolution: {integrity: sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==} engines: {node: '>=4'} peerDependencies: + '@typescript-eslint/parser': '*' eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 + peerDependenciesMeta: + '@typescript-eslint/parser': + optional: true dependencies: + '@typescript-eslint/parser': 5.27.1_ud6rd4xtew5bv4yhvkvu24pzm4 array-includes: 3.1.5 array.prototype.flat: 1.3.0 debug: 2.6.9 doctrine: 2.1.0 - eslint: 8.16.0 + eslint: 8.17.0 eslint-import-resolver-node: 0.3.6 - eslint-module-utils: 2.7.3 + eslint-module-utils: 2.7.3_5uhabtgzo3akfzi73a5jap3i6a has: 1.0.3 is-core-module: 2.9.0 is-glob: 4.0.3 @@ -2002,10 +2101,14 @@ packages: object.values: 1.1.5 resolve: 1.22.0 tsconfig-paths: 3.14.1 + transitivePeerDependencies: + - eslint-import-resolver-typescript + - eslint-import-resolver-webpack + - supports-color dev: true - /eslint-plugin-jsdoc/39.3.1_eslint@8.16.0: - resolution: {integrity: sha512-EVee7DW7mIKjQ+i86O3sV8n1BdXXiBo0gqY7S7TYTMEBzZoo4B/xNg0fl+b9ktIJtj6H0einhO3eMpwY2jyJRg==} + /eslint-plugin-jsdoc/39.3.2_eslint@8.17.0: + resolution: {integrity: sha512-RSGN94RYzIJS/WfW3l6cXzRLfJWxvJgNQZ4w0WCaxJWDJMigtwTsILEAfKqmmPkT2rwMH/s3C7G5ChDE6cwPJg==} engines: {node: ^14 || ^16 || ^17 || ^18} peerDependencies: eslint: ^7.0.0 || ^8.0.0 @@ -2014,7 +2117,7 @@ packages: comment-parser: 1.3.1 debug: 4.3.4 escape-string-regexp: 4.0.0 - eslint: 8.16.0 + eslint: 8.17.0 esquery: 1.4.0 semver: 7.3.7 spdx-expression-parse: 3.0.1 @@ -2038,13 +2141,13 @@ packages: estraverse: 5.3.0 dev: true - /eslint-utils/3.0.0_eslint@8.16.0: + /eslint-utils/3.0.0_eslint@8.17.0: resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==} engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0} peerDependencies: eslint: '>=5' dependencies: - eslint: 8.16.0 + eslint: 8.17.0 eslint-visitor-keys: 2.1.0 dev: true @@ -2058,8 +2161,8 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /eslint/8.16.0: - resolution: {integrity: sha512-MBndsoXY/PeVTDJeWsYj7kLZ5hQpJOfMYLsF6LicLHQWbRDG19lK5jOix4DPl8yY4SUFcE3txy86OzFLWT+yoA==} + /eslint/8.17.0: + resolution: {integrity: sha512-gq0m0BTJfci60Fz4nczYxNAlED+sMcihltndR8t9t1evnU/azx53x3t2UHXC/uRjcbvRw/XctpaNygSTcQD+Iw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} hasBin: true dependencies: @@ -2072,7 +2175,7 @@ packages: doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.1.1 - eslint-utils: 3.0.0_eslint@8.16.0 + eslint-utils: 3.0.0_eslint@8.17.0 eslint-visitor-keys: 3.3.0 espree: 9.3.2 esquery: 1.4.0 @@ -2181,14 +2284,14 @@ packages: dev: true /expand-range/1.8.2: - resolution: {integrity: sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=} + resolution: {integrity: sha512-AFASGfIlnIbkKPQwX1yHaDjFvh/1gyKJODme52V6IORh69uEYgZp0o9C+qsIGNVEiuuhQU0CSSl++Rlegg1qvA==} engines: {node: '>=0.10.0'} dependencies: fill-range: 2.2.4 dev: true /extend-shallow/2.0.1: - resolution: {integrity: sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=} + resolution: {integrity: sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==} engines: {node: '>=0.10.0'} dependencies: is-extendable: 0.1.1 @@ -2227,7 +2330,7 @@ packages: dev: true /fast-levenshtein/2.0.6: - resolution: {integrity: sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=} + resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} dev: true /fast-memoize/2.5.2: @@ -2241,7 +2344,7 @@ packages: dev: true /figures/1.7.0: - resolution: {integrity: sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=} + resolution: {integrity: sha512-UxKlfCRuCBxSXU4C6t9scbDyWZ4VlaFFdojKtzJuSkuOBQ5CNFum+zZXFwHjo+CxBC1t6zlYPgHIgFjL8ggoEQ==} engines: {node: '>=0.10.0'} dependencies: escape-string-regexp: 1.0.5 @@ -2249,7 +2352,7 @@ packages: dev: true /figures/2.0.0: - resolution: {integrity: sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=} + resolution: {integrity: sha512-Oa2M9atig69ZkfwiApY8F2Yy+tzMbazyvqv21R0NsSC8floSOC09BbT1ITWAdoMGQvJ/aZnR1KMwdx9tvHnTNA==} engines: {node: '>=4'} dependencies: escape-string-regexp: 1.0.5 @@ -2288,7 +2391,7 @@ packages: dev: true /find-up/2.1.0: - resolution: {integrity: sha1-RdG35QbHF93UgndaK3eSCjwMV6c=} + resolution: {integrity: sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==} engines: {node: '>=4'} dependencies: locate-path: 2.0.0 @@ -2330,7 +2433,7 @@ packages: dev: true /for-in/1.0.2: - resolution: {integrity: sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=} + resolution: {integrity: sha512-7EwmXrOjyL+ChxMhmG5lnW9MPt1aIeZEwKhQzoBUdTV0N3zuwWDZYVJatDvZ2OyzPUvdIAZDsCetk3coyMfcnQ==} engines: {node: '>=0.10.0'} dev: true @@ -2349,7 +2452,7 @@ packages: dev: true /fs-access/1.0.1: - resolution: {integrity: sha1-1qh/JiJxzv6+wwxVNAf7mV2od3o=} + resolution: {integrity: sha512-05cXDIwNbFaoFWaz5gNHlUTbH5whiss/hr/ibzPd4MH3cR4w0ZKeIPiVdbyJurg3O5r/Bjpvn9KOb1/rPMf3nA==} engines: {node: '>=0.10.0'} dependencies: null-check: 1.0.0 @@ -2367,7 +2470,7 @@ packages: dev: true /fs.realpath/1.0.0: - resolution: {integrity: sha1-FQStJSMVjKpA20onh8sBQRmU6k8=} + resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} dev: true /fsevents/2.3.2: @@ -2393,7 +2496,7 @@ packages: dev: true /functional-red-black-tree/1.0.1: - resolution: {integrity: sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=} + resolution: {integrity: sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==} dev: true /functions-have-names/1.2.3: @@ -2483,7 +2586,7 @@ packages: dev: true /git-remote-origin-url/2.0.0: - resolution: {integrity: sha1-UoJlna4hBxRaERJhEq0yFuxfpl8=} + resolution: {integrity: sha512-eU+GGrZgccNJcsDH5LkXR3PB9M958hxc7sbA8DFJjrv9j4L2P/eZfKhM+QD6wyzpiv+b1BpK0XrYCxkovtjSLw==} engines: {node: '>=4'} dependencies: gitconfiglocal: 1.0.0 @@ -2500,13 +2603,13 @@ packages: dev: true /gitconfiglocal/1.0.0: - resolution: {integrity: sha1-QdBF84UaXqiPA/JMocYXgRRGS5s=} + resolution: {integrity: sha512-spLUXeTAVHxDtKsJc8FkFVgFtMdEN9qPGpL23VfSHx4fP4+Ds097IXLvymbnDH8FnmxX5Nr9bPw3A+AQ6mWEaQ==} dependencies: ini: 1.3.8 dev: true /github-url-from-git/1.5.0: - resolution: {integrity: sha1-+YX+3MCpqledyI16/waNVcxiUaA=} + resolution: {integrity: sha512-WWOec4aRI7YAykQ9+BHmzjyNlkfJFG8QLXnDTsLz/kZefq7qkzdfo4p6fkYYMIq1aj+gZcQs/1HQhQh3DPPxlQ==} dev: true /glob-parent/5.1.2: @@ -2625,7 +2728,7 @@ packages: dev: true /gray-matter/2.1.1: - resolution: {integrity: sha1-MELZrewqHe1qdwep7SOA+KF6Qw4=} + resolution: {integrity: sha512-vbmvP1Fe/fxuT2QuLVcqb2BfK7upGhhbLIt9/owWEvPYrZZEkelLcq2HqzxosV+PQ67dUFLaAeNpH7C4hhICAA==} engines: {node: '>=0.10.0'} dependencies: ansi-red: 0.1.1 @@ -2654,7 +2757,7 @@ packages: source-map: 0.6.1 wordwrap: 1.0.0 optionalDependencies: - uglify-js: 3.15.5 + uglify-js: 3.16.0 dev: true /hard-rejection/2.1.0: @@ -2663,7 +2766,7 @@ packages: dev: true /has-ansi/2.0.0: - resolution: {integrity: sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=} + resolution: {integrity: sha512-C8vBJ8DwUCx19vhm7urhTuUsr4/IyP6l4VzNQDv+ryHQObW3TTTp9yB68WpYgRe2bbaGuZ/se74IqFeVnMnLZg==} engines: {node: '>=0.10.0'} dependencies: ansi-regex: 2.1.1 @@ -2674,7 +2777,7 @@ packages: dev: true /has-flag/3.0.0: - resolution: {integrity: sha1-tdRU3CGZriJWmfNGfloH87lVuv0=} + resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} engines: {node: '>=4'} dev: true @@ -2702,7 +2805,7 @@ packages: dev: true /has-unicode/2.0.1: - resolution: {integrity: sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=} + resolution: {integrity: sha512-8Rf9Y83NBReMnx0gFzA8JImQACstCYWUplepDa9xprwwtmgEZUF0h/i5xSA625zB/I37EtrswSST6OXxwaaIJQ==} dev: true /has-yarn/2.1.0: @@ -2717,11 +2820,6 @@ packages: function-bind: 1.1.1 dev: true - /helpertypes/0.0.17: - resolution: {integrity: sha512-muWKRSBsqN3MzqLdh82QfV7vWWwAYvHh3On87z898X+xZ5H2tPRQ5Y6hHA3BXSE+TueztA07iw5bInjwAT3x8A==} - engines: {node: '>=10.0.0'} - dev: true - /helpertypes/0.0.18: resolution: {integrity: sha512-XRhfbSEmR+poXUC5/8AbmYNJb2riOT6qPzjGJZr0S9YedHiaY+/tzPYzWMUclYMEdCYo/1l8PDYrQFCj02v97w==} engines: {node: '>=10.0.0'} @@ -2763,6 +2861,17 @@ packages: resolution: {integrity: sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==} dev: true + /http-proxy-agent/4.0.1: + resolution: {integrity: sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==} + engines: {node: '>= 6'} + dependencies: + '@tootallnate/once': 1.1.2 + agent-base: 6.0.2 + debug: 4.3.4 + transitivePeerDependencies: + - supports-color + dev: true + /http-proxy-agent/5.0.0: resolution: {integrity: sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==} engines: {node: '>= 6'} @@ -2795,7 +2904,7 @@ packages: dev: true /humanize-ms/1.2.1: - resolution: {integrity: sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0=} + resolution: {integrity: sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==} dependencies: ms: 2.1.3 dev: true @@ -2856,7 +2965,7 @@ packages: dev: true /import-lazy/2.1.0: - resolution: {integrity: sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=} + resolution: {integrity: sha512-m7ZEHgtw69qOGw+jwxXkHlrlIPdTGkyh66zXZ1ajZbxkDBNjSY/LGbmjc7h0s2ELsUDTAhFr55TrPSSqJGPG0A==} engines: {node: '>=4'} dev: true @@ -2870,12 +2979,12 @@ packages: dev: true /imurmurhash/0.1.4: - resolution: {integrity: sha1-khi5srkoojixPcT7a21XbyMUU+o=} + resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} engines: {node: '>=0.8.19'} dev: true /indent-string/3.2.0: - resolution: {integrity: sha1-Sl/W0nzDMvN+VBmlBNu4NxBckok=} + resolution: {integrity: sha512-BYqTHXTGUIvg7t1r4sJNKcbDZkL92nkXA8YtRpbjFHRHGDL/NtUeiBJMeE60kIFN/Mg8ESaWQvftaYMGJzQZCQ==} engines: {node: '>=4'} dev: true @@ -2889,7 +2998,7 @@ packages: dev: true /inflight/1.0.6: - resolution: {integrity: sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=} + resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} dependencies: once: 1.4.0 wrappy: 1.0.2 @@ -2998,7 +3107,7 @@ packages: dev: true /is-arrayish/0.2.1: - resolution: {integrity: sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=} + resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} dev: true /is-bigint/1.0.4: @@ -3062,7 +3171,7 @@ packages: dev: true /is-extendable/0.1.1: - resolution: {integrity: sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=} + resolution: {integrity: sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==} engines: {node: '>=0.10.0'} dev: true @@ -3074,19 +3183,19 @@ packages: dev: true /is-extglob/2.1.1: - resolution: {integrity: sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=} + resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} engines: {node: '>=0.10.0'} dev: true /is-fullwidth-code-point/1.0.0: - resolution: {integrity: sha1-754xOG8DGn8NZDr4L95QxFfvAMs=} + resolution: {integrity: sha512-1pqUqRjkhPJ9miNq9SwMfdvi6lBJcd6eFxvfaivQhaH3SgisfiuudvFntdKOmxuee/77l+FPjKrQjWvmPjWrRw==} engines: {node: '>=0.10.0'} dependencies: number-is-nan: 1.0.1 dev: true /is-fullwidth-code-point/2.0.0: - resolution: {integrity: sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=} + resolution: {integrity: sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==} engines: {node: '>=4'} dev: true @@ -3124,7 +3233,7 @@ packages: dev: true /is-lambda/1.0.1: - resolution: {integrity: sha1-PZh3iZ5qU+/AFgUEzeFfgubwYdU=} + resolution: {integrity: sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==} dev: true /is-negative-zero/2.0.2: @@ -3145,7 +3254,7 @@ packages: dev: true /is-number/2.1.0: - resolution: {integrity: sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=} + resolution: {integrity: sha512-QUzH43Gfb9+5yckcrSA0VBDwEtDUchrk4F6tfJZQuNzDJbEDB9cZNzSfXGQ1jqmdDY/kl41lUOWM9syA8z8jlg==} engines: {node: '>=0.10.0'} dependencies: kind-of: 3.2.2 @@ -3184,7 +3293,7 @@ packages: dev: true /is-plain-obj/1.1.0: - resolution: {integrity: sha1-caUMhCnfync8kqOQpKA7OfzVHT4=} + resolution: {integrity: sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==} engines: {node: '>=0.10.0'} dev: true @@ -3234,7 +3343,7 @@ packages: dev: true /is-stream/1.1.0: - resolution: {integrity: sha1-EtSj3U5o4Lec6428hBc66A2RykQ=} + resolution: {integrity: sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==} engines: {node: '>=0.10.0'} dev: true @@ -3258,14 +3367,14 @@ packages: dev: true /is-text-path/1.0.1: - resolution: {integrity: sha1-Thqg+1G/vLPpJogAE5cgLBd1tm4=} + resolution: {integrity: sha512-xFuJpne9oFz5qDaodwmmG08e3CawH/2ZV8Qqza1Ko7Sk8POWbkRdwIoAWVhqvq0XeUzANEhKo2n0IXUGBm7A/w==} engines: {node: '>=0.10.0'} dependencies: text-extensions: 1.9.0 dev: true /is-typedarray/1.0.0: - resolution: {integrity: sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=} + resolution: {integrity: sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==} dev: true /is-unicode-supported/0.1.0: @@ -3296,7 +3405,7 @@ packages: dev: true /isarray/1.0.0: - resolution: {integrity: sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=} + resolution: {integrity: sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==} dev: true /isbot/3.4.5: @@ -3305,18 +3414,18 @@ packages: dev: true /isexe/2.0.0: - resolution: {integrity: sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=} + resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} dev: true /isobject/2.1.0: - resolution: {integrity: sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=} + resolution: {integrity: sha512-+OUdGJlgjOBZDfxnDjYYG6zp487z0JGNQq3cYQYg5f5hKR+syHMsaztzGeml/4kGG55CSpKSpWTY+jYGgsHLgA==} engines: {node: '>=0.10.0'} dependencies: isarray: 1.0.0 dev: true /isobject/3.0.1: - resolution: {integrity: sha1-TkMekrEalzFjaqH5yNHMvP2reN8=} + resolution: {integrity: sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==} engines: {node: '>=0.10.0'} dev: true @@ -3326,11 +3435,11 @@ packages: dev: true /jju/1.4.0: - resolution: {integrity: sha1-o6vicYryQaKykE+EpiWXDzia4yo=} + resolution: {integrity: sha512-8wb9Yw966OSxApiCt0K3yNJL8pnNeIv+OEq2YMidz4FKP6nonSRoOXc80iXY4JaN2FC11B9qsNmDsm+ZOfMROA==} dev: true /js-string-escape/1.0.1: - resolution: {integrity: sha1-4mJbrbwNZ8dTPp7cEGjFh65BN+8=} + resolution: {integrity: sha512-Smw4xcfIQ5LVjAOuJCvN/zIodzA/BBSsluuoSykP+lUvScIi4U6RJLfwHet5cxFnCswUjISV8oAXaqaJDY3chg==} engines: {node: '>= 0.8'} dev: true @@ -3392,7 +3501,7 @@ packages: whatwg-encoding: 2.0.0 whatwg-mimetype: 3.0.0 whatwg-url: 10.0.0 - ws: 8.6.0 + ws: 8.7.0 xml-name-validator: 4.0.0 transitivePeerDependencies: - bufferutil @@ -3401,7 +3510,7 @@ packages: dev: true /json-buffer/3.0.0: - resolution: {integrity: sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=} + resolution: {integrity: sha512-CuUqjv0FUZIdXkHPI8MezCnFCdaTAacej1TZYulLoAg1h/PhwkdXFN4V/gzY4g+fMBCOV2xF+rp7t2XD2ns/NQ==} dev: true /json-buffer/3.0.1: @@ -3417,7 +3526,7 @@ packages: dev: true /json-parse-helpfulerror/1.0.3: - resolution: {integrity: sha1-E/FM4C7tTpgSl7ZOueO5MuLdE9w=} + resolution: {integrity: sha512-XgP0FGR77+QhUxjXkwOMkC94k3WtqEBfcnjWqhRd82qTat4SWKRE+9kUnynz/shm3I4ea2+qISvTIeGTNU7kJg==} dependencies: jju: 1.4.0 dev: true @@ -3427,11 +3536,11 @@ packages: dev: true /json-stable-stringify-without-jsonify/1.0.1: - resolution: {integrity: sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=} + resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} dev: true /json-stringify-safe/5.0.1: - resolution: {integrity: sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=} + resolution: {integrity: sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==} dev: true /json5/1.0.1: @@ -3448,11 +3557,11 @@ packages: dev: true /jsonlines/0.1.1: - resolution: {integrity: sha1-T80kbcXQ44aRkHxEqwAveC0dlMw=} + resolution: {integrity: sha512-ekDrAGso79Cvf+dtm+mL8OBI2bmAOt3gssYs833De/C9NmIpWDWyUO4zPgB5x2/OhY366dkhgfPMYfwZF7yOZA==} dev: true /jsonparse/1.3.1: - resolution: {integrity: sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=} + resolution: {integrity: sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==} engines: {'0': node >= 0.2.0} dev: true @@ -3470,7 +3579,7 @@ packages: dev: true /kind-of/3.2.2: - resolution: {integrity: sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=} + resolution: {integrity: sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ==} engines: {node: '>=0.10.0'} dependencies: is-buffer: 1.1.6 @@ -3494,14 +3603,14 @@ packages: dev: true /lazy-cache/2.0.2: - resolution: {integrity: sha1-uRkKT5EzVGlIQIWfio9whNiCImQ=} + resolution: {integrity: sha512-7vp2Acd2+Kz4XkzxGxaB1FWOi8KjWIWsgdfD5MCb86DWvlLqhRPM+d6Pro3iNEL5VT9mstz5hKAlcd+QR6H3aA==} engines: {node: '>=0.10.0'} dependencies: set-getter: 0.1.1 dev: true /levn/0.3.0: - resolution: {integrity: sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=} + resolution: {integrity: sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==} engines: {node: '>= 0.8.0'} dependencies: prelude-ls: 1.1.2 @@ -3521,7 +3630,7 @@ packages: dev: true /list-item/1.1.1: - resolution: {integrity: sha1-DGXQDih8tmPMs8s4Sad+iewmilY=} + resolution: {integrity: sha512-S3D0WZ4J6hyM8o5SNKWaMYB1ALSacPZ2nHGEuCjmHZ+dc03gFeNZoNDcqfcnO4vDhTZmNrqrpYZCdXsRh22bzw==} engines: {node: '>=0.10.0'} dependencies: expand-range: 1.8.2 @@ -3541,7 +3650,7 @@ packages: dev: true /listr-silent-renderer/1.1.1: - resolution: {integrity: sha1-kktaN1cVN3C/Go4/v3S4u/P5JC4=} + resolution: {integrity: sha512-L26cIFm7/oZeSNVhWB6faeorXhMg4HNlb/dS/7jHhr708jxlXrtrBWo4YUxZQkc6dGoxEAe6J/D3juTRBUzjtA==} engines: {node: '>=4'} dev: true @@ -3587,10 +3696,11 @@ packages: rxjs: 6.6.7 transitivePeerDependencies: - zen-observable + - zenObservable dev: true /load-json-file/4.0.0: - resolution: {integrity: sha1-L19Fq5HjMhYjT9U62rZo607AmTs=} + resolution: {integrity: sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==} engines: {node: '>=4'} dependencies: graceful-fs: 4.2.10 @@ -3611,7 +3721,7 @@ packages: dev: true /locate-path/2.0.0: - resolution: {integrity: sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=} + resolution: {integrity: sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==} engines: {node: '>=4'} dependencies: p-locate: 2.0.0 @@ -3641,15 +3751,15 @@ packages: dev: true /lodash._reinterpolate/3.0.0: - resolution: {integrity: sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0=} + resolution: {integrity: sha512-xYHt68QRoYGjeeM/XOE1uJtvXQAgvszfBhjV4yvsQH0u2i9I6cI6c6/eG4Hh3UAOVn0y/xAXwmTzEay49Q//HA==} dev: true /lodash.isequal/4.5.0: - resolution: {integrity: sha1-QVxEePK8wwEgwizhDtMib30+GOA=} + resolution: {integrity: sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==} dev: true /lodash.ismatch/4.4.0: - resolution: {integrity: sha1-dWy1FQyjum8RCFp4hJZF8Yj4Xzc=} + resolution: {integrity: sha512-fPMfXjGQEV9Xsq/8MTSgUf255gawYRbjwMyDbcvDhXgV7enSZA0hynz6vMPnpAb5iONEzBHBPsT+0zes5Z301g==} dev: true /lodash.merge/4.6.2: @@ -3670,7 +3780,7 @@ packages: dev: true /lodash.zip/4.2.0: - resolution: {integrity: sha1-7GZi5IlkCO1KtsVCo5kLcswIACA=} + resolution: {integrity: sha512-C7IOaBBK/0gMORRBd8OETNx3kmOkgIWIPvyDpZSCTwUrpYmgZwJkjZeOD8ww4xbOUOs4/attY+pciKvadNfFbg==} dev: true /lodash/4.17.21: @@ -3678,7 +3788,7 @@ packages: dev: true /log-symbols/1.0.2: - resolution: {integrity: sha1-N2/3tY6jCGoPCfrMdGF+ylAeGhg=} + resolution: {integrity: sha512-mmPrW0Fh2fxOzdBbFv4g1m6pR72haFLPJ2G5SJEELf1y+iaQrDG6cWCPjy54RHYbZAt7X+ls690Kw62AdWXBzQ==} engines: {node: '>=0.10.0'} dependencies: chalk: 1.1.3 @@ -3693,7 +3803,7 @@ packages: dev: true /log-update/2.3.0: - resolution: {integrity: sha1-iDKP19HOeTiykoN0bwsbwSayRwg=} + resolution: {integrity: sha512-vlP11XfFGyeNQlmEn9tJ66rEW1coA/79m5z6BCkudjbAGE83uhAcGYrBFwfs3AdLiLzGRusRPAbSPK9xZteCmg==} engines: {node: '>=4'} dependencies: ansi-escapes: 3.2.0 @@ -3741,12 +3851,12 @@ packages: resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} dev: true - /make-fetch-happen/10.1.5: - resolution: {integrity: sha512-mucOj2H0Jn/ax7H9K9T1bf0p1nn/mBFa551Os7ed9xRfLEx20aZhZeLslmRYfAaAqXZUGipcs+m5KOKvOH0XKA==} + /make-fetch-happen/10.1.7: + resolution: {integrity: sha512-J/2xa2+7zlIUKqfyXDCXFpH3ypxO4k3rgkZHPSZkyUYcBT/hM80M3oyKLM/9dVriZFiGeGGS2Ei+0v2zfhqj3Q==} engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} dependencies: agentkeepalive: 4.2.1 - cacache: 16.1.0 + cacache: 16.1.1 http-cache-semantics: 4.1.0 http-proxy-agent: 5.0.0 https-proxy-agent: 5.0.1 @@ -3759,9 +3869,35 @@ packages: minipass-pipeline: 1.2.4 negotiator: 0.6.3 promise-retry: 2.0.1 - socks-proxy-agent: 6.2.0 + socks-proxy-agent: 7.0.0 ssri: 9.0.1 transitivePeerDependencies: + - bluebird + - supports-color + dev: true + + /make-fetch-happen/9.1.0: + resolution: {integrity: sha512-+zopwDy7DNknmwPQplem5lAZX/eCOzSvSNNcSKm5eVwTkOBzoktEfXsa9L23J/GIRhxRsaxzkPEhrJEpE2F4Gg==} + engines: {node: '>= 10'} + dependencies: + agentkeepalive: 4.2.1 + cacache: 15.3.0 + http-cache-semantics: 4.1.0 + http-proxy-agent: 4.0.1 + https-proxy-agent: 5.0.1 + is-lambda: 1.0.1 + lru-cache: 6.0.0 + minipass: 3.1.6 + minipass-collect: 1.0.2 + minipass-fetch: 1.4.1 + minipass-flush: 1.0.5 + minipass-pipeline: 1.2.4 + negotiator: 0.6.3 + promise-retry: 2.0.1 + socks-proxy-agent: 6.2.1 + ssri: 8.0.1 + transitivePeerDependencies: + - bluebird - supports-color dev: true @@ -3773,7 +3909,7 @@ packages: dev: true /map-obj/1.0.1: - resolution: {integrity: sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=} + resolution: {integrity: sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==} engines: {node: '>=0.10.0'} dev: true @@ -3783,7 +3919,7 @@ packages: dev: true /markdown-link/0.1.1: - resolution: {integrity: sha1-MsXGUZmmRXMWMi0eQinRNAfIx88=} + resolution: {integrity: sha512-TurLymbyLyo+kAUUAV9ggR9EPcDjP/ctlv9QAFiqUH7c+t6FlsbivPo9OKTU8xdOx9oNd2drW/Fi5RRElQbUqA==} engines: {node: '>=0.10.0'} dev: true @@ -3832,8 +3968,8 @@ packages: mimic-fn: 3.1.0 dev: true - /memfs/3.4.3: - resolution: {integrity: sha512-eivjfi7Ahr6eQTn44nvTnR60e4a1Fs1Via2kCR5lHo/kyNoiMWaXCNJ/GpSd0ilXas2JSOl9B5FTIhflXu0hlg==} + /memfs/3.4.4: + resolution: {integrity: sha512-W4gHNUE++1oSJVn8Y68jPXi+mkx3fXR5ITE/Ubz6EQ3xRpCN5k2CQ4AUR8094Z7211F876TyoBACGsIveqgiGA==} engines: {node: '>= 4.0.0'} dependencies: fs-monkey: 1.0.3 @@ -3948,6 +4084,17 @@ packages: minipass: 3.1.6 dev: true + /minipass-fetch/1.4.1: + resolution: {integrity: sha512-CGH1eblLq26Y15+Azk7ey4xh0J/XfJfrCox5LDJiKqI2Q2iwOLOKrlmIaODiSQS8d18jalF6y2K2ePUm0CmShw==} + engines: {node: '>=8'} + dependencies: + minipass: 3.1.6 + minipass-sized: 1.0.3 + minizlib: 2.1.2 + optionalDependencies: + encoding: 0.1.13 + dev: true + /minipass-fetch/2.1.0: resolution: {integrity: sha512-H9U4UVBGXEyyWJnqYDCLp1PwD8XIkJ4akNHp1aGVI+2Ym7wQMlxDKi4IB4JbmyU+pl9pEs/cVrK6cOuvmbK4Sg==} engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} @@ -4027,7 +4174,7 @@ packages: dev: true /ms/2.0.0: - resolution: {integrity: sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=} + resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==} dev: true /ms/2.1.2: @@ -4058,7 +4205,7 @@ packages: dev: true /natural-compare/1.4.0: - resolution: {integrity: sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=} + resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} dev: true /negotiator/0.6.3: @@ -4077,15 +4224,15 @@ packages: type-fest: 0.4.1 dev: true - /node-gyp/9.0.0: - resolution: {integrity: sha512-Ma6p4s+XCTPxCuAMrOA/IJRmVy16R8Sdhtwl4PrCr7IBlj4cPawF0vg/l7nOT1jPbuNS7lIRJpBSvVsXwEZuzw==} - engines: {node: ^12.22 || ^14.13 || >=16} + /node-gyp/8.4.1: + resolution: {integrity: sha512-olTJRgUtAb/hOXG0E93wZDs5YiJlgbXxTwQAFHyNlRsXQnYzUaF2aGgujZbw+hR8aF4ZG/rST57bWMWD16jr9w==} + engines: {node: '>= 10.12.0'} hasBin: true dependencies: env-paths: 2.2.1 glob: 7.2.3 graceful-fs: 4.2.10 - make-fetch-happen: 10.1.5 + make-fetch-happen: 9.1.0 nopt: 5.0.0 npmlog: 6.0.2 rimraf: 3.0.2 @@ -4093,6 +4240,7 @@ packages: tar: 6.1.11 which: 2.0.2 transitivePeerDependencies: + - bluebird - supports-color dev: true @@ -4198,6 +4346,7 @@ packages: update-notifier: 5.1.0 transitivePeerDependencies: - zen-observable + - zenObservable dev: true /npm-bundled/1.1.2: @@ -4206,15 +4355,15 @@ packages: npm-normalize-package-bin: 1.0.1 dev: true - /npm-check-updates/13.0.3: - resolution: {integrity: sha512-a8CVklJjXZhmN5Kup8rKiejArobCbOaMnubhvM/LkYVumO17dBuWuaHUuiSrYglQUb88lGSdbNNfHDNN7b+3pQ==} + /npm-check-updates/13.1.1: + resolution: {integrity: sha512-f4gLbUJJh5qvkNvrSG3b05y3ZvyZ4Sl3Uk95DSyCjIWwpwmAwzU9dMCA/Gg2AmIKqkH4ml6X9kxcZsu+tAd94g==} engines: {node: '>=14'} hasBin: true dependencies: chalk: 4.1.2 cint: 8.2.1 cli-table: 0.3.11 - commander: 9.2.0 + commander: 9.3.0 fast-memoize: 2.5.2 find-up: 5.0.0 fp-and-or: 0.1.3 @@ -4226,7 +4375,7 @@ packages: lodash: 4.17.21 minimatch: 5.1.0 p-map: 4.0.0 - pacote: 13.4.1 + pacote: 13.6.0 parse-github-url: 1.0.2 progress: 2.0.3 prompts: 2.4.2 @@ -4238,8 +4387,9 @@ packages: source-map-support: 0.5.21 spawn-please: 1.0.0 update-notifier: 5.1.0 - yaml: 2.1.0 + yaml: 2.1.1 transitivePeerDependencies: + - bluebird - supports-color dev: true @@ -4303,7 +4453,7 @@ packages: resolution: {integrity: sha512-5p8rwe6wQPLJ8dMqeTnA57Dp9Ox6GH9H60xkyJup07FmVlu3Mk7pf/kIIpl9gaN5bM8NM+UUx3emUWvDNTt39w==} engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} dependencies: - make-fetch-happen: 10.1.5 + make-fetch-happen: 10.1.7 minipass: 3.1.6 minipass-fetch: 2.1.0 minipass-json-stream: 1.0.1 @@ -4311,6 +4461,7 @@ packages: npm-package-arg: 9.0.2 proc-log: 2.0.1 transitivePeerDependencies: + - bluebird - supports-color dev: true @@ -4332,12 +4483,12 @@ packages: dev: true /null-check/1.0.0: - resolution: {integrity: sha1-l33/1xdgErnsMNKjnbXPcqBDnt0=} + resolution: {integrity: sha512-j8ZNHg19TyIQOWCGeeQJBuu6xZYIEurf8M1Qsfd8mFrGEfIZytbw18YjKWg+LcO25NowXGZXZpKAx+Ui3TFfDw==} engines: {node: '>=0.10.0'} dev: true /number-is-nan/1.0.1: - resolution: {integrity: sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=} + resolution: {integrity: sha512-4jbtZXNAsfZbAHiiqjLPBiCl16dES1zI4Hpzzxw61Tk+loF+sBDBKx1ICKKKwIqQ7M0mFn1TmkN7euSncWgHiQ==} engines: {node: '>=0.10.0'} dev: true @@ -4346,12 +4497,12 @@ packages: dev: true /object-assign/4.1.1: - resolution: {integrity: sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=} + resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} engines: {node: '>=0.10.0'} dev: true - /object-inspect/1.12.1: - resolution: {integrity: sha512-Y/jF6vnvEtOPGiKD1+q+X0CiUYRQtEHp89MLLUJ7TUivtH8Ugn2+3A7Rynqk7BRsAoqeOQWnFnjpDrKSxDgIGA==} + /object-inspect/1.12.2: + resolution: {integrity: sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==} dev: true /object-keys/1.1.1: @@ -4374,7 +4525,7 @@ packages: dev: true /object.pick/1.3.0: - resolution: {integrity: sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=} + resolution: {integrity: sha512-tqa/UMy/CCoYmj+H5qc07qvSL9dqcs/WZENZ1JbtWBlATP+iVOe778gE6MSijnyCnORzDuX6hU+LA4SZ09YjFQ==} engines: {node: '>=0.10.0'} dependencies: isobject: 3.0.1 @@ -4390,13 +4541,13 @@ packages: dev: true /once/1.4.0: - resolution: {integrity: sha1-WDsap3WWHUsROsF9nFC6753Xa9E=} + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} dependencies: wrappy: 1.0.2 dev: true /onetime/2.0.1: - resolution: {integrity: sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=} + resolution: {integrity: sha512-oyyPpiMaKARvvcgip+JV+7zci5L8D1W9RZIz2l1o08AM3pfspitVWnPt3mzHcBPp12oYMTy0pqrFs/C+m3EwsQ==} engines: {node: '>=4'} dependencies: mimic-fn: 1.2.0 @@ -4462,7 +4613,7 @@ packages: dev: true /os-tmpdir/1.0.2: - resolution: {integrity: sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=} + resolution: {integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==} engines: {node: '>=0.10.0'} dev: true @@ -4489,7 +4640,7 @@ packages: dev: true /p-defer/1.0.0: - resolution: {integrity: sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=} + resolution: {integrity: sha512-wB3wfAxZpk2AzOfUMJNL+d36xothRSyj8EXOa4f6GMqYDN9BJaaSISbsk+wS9abmnebVw95C2Kb5t85UmpCxuw==} engines: {node: '>=4'} dev: true @@ -4501,7 +4652,7 @@ packages: dev: true /p-finally/1.0.0: - resolution: {integrity: sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=} + resolution: {integrity: sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==} engines: {node: '>=4'} dev: true @@ -4527,7 +4678,7 @@ packages: dev: true /p-locate/2.0.0: - resolution: {integrity: sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=} + resolution: {integrity: sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==} engines: {node: '>=4'} dependencies: p-limit: 1.3.0 @@ -4608,7 +4759,7 @@ packages: dev: true /p-try/1.0.0: - resolution: {integrity: sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=} + resolution: {integrity: sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==} engines: {node: '>=4'} dev: true @@ -4627,16 +4778,16 @@ packages: semver: 6.3.0 dev: true - /pacote/13.4.1: - resolution: {integrity: sha512-FqlSWlD8n+ejCE17GF/lf0yasztMGFl4UFzYQk5njaK/qPPWfVDWnfQwqmqeXObWLSmIBew+O+CFD24vxkVDjg==} + /pacote/13.6.0: + resolution: {integrity: sha512-zHmuCwG4+QKnj47LFlW3LmArwKoglx2k5xtADiMCivVWPgNRP5QyLDGOIjGjwOe61lhl1rO63m/VxT16pEHLWg==} engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} hasBin: true dependencies: '@npmcli/git': 3.0.1 '@npmcli/installed-package-contents': 1.0.7 '@npmcli/promise-spawn': 3.0.0 - '@npmcli/run-script': 3.0.2 - cacache: 16.1.0 + '@npmcli/run-script': 3.0.3 + cacache: 16.1.1 chownr: 2.0.0 fs-minipass: 2.1.0 infer-owner: 1.0.4 @@ -4654,6 +4805,7 @@ packages: ssri: 9.0.1 tar: 6.1.11 transitivePeerDependencies: + - bluebird - supports-color dev: true @@ -4671,7 +4823,7 @@ packages: dev: true /parse-json/4.0.0: - resolution: {integrity: sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA=} + resolution: {integrity: sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==} engines: {node: '>=4'} dependencies: error-ex: 1.3.2 @@ -4698,7 +4850,7 @@ packages: dev: true /path-exists/3.0.0: - resolution: {integrity: sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=} + resolution: {integrity: sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==} engines: {node: '>=4'} dev: true @@ -4708,7 +4860,7 @@ packages: dev: true /path-is-absolute/1.0.1: - resolution: {integrity: sha1-F0uSaHNVNP+8es5r9TpanhtcX18=} + resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} engines: {node: '>=0.10.0'} dev: true @@ -4743,12 +4895,12 @@ packages: dev: true /pify/2.3.0: - resolution: {integrity: sha1-7RQaasBDqEnqWISY59yosVMw6Qw=} + resolution: {integrity: sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==} engines: {node: '>=0.10.0'} dev: true /pify/3.0.0: - resolution: {integrity: sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=} + resolution: {integrity: sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==} engines: {node: '>=4'} dev: true @@ -4786,14 +4938,14 @@ packages: irregular-plurals: 3.3.0 dev: true - /pnpm/7.1.5: - resolution: {integrity: sha512-Mkdb7mHUPbzsPjvKbhvNgHPPIX5NZlLcm7S6uFJWPJrkiiWnrq7tbqWHC09Spzwvao92R64mo6a6gGbrERNbrA==} + /pnpm/7.1.9: + resolution: {integrity: sha512-YWA+iqayHb0MndHTyqvVPKQVYVCOoBYlQNLP3hAf2DT/Iw2EHVcP18yCT+xnsPNvkC4VYfQepE6AZvySQue1TA==} engines: {node: '>=14.19'} hasBin: true dev: true /prelude-ls/1.1.2: - resolution: {integrity: sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=} + resolution: {integrity: sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==} engines: {node: '>= 0.8.0'} dev: true @@ -4803,7 +4955,7 @@ packages: dev: true /prepend-http/2.0.0: - resolution: {integrity: sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=} + resolution: {integrity: sha512-ravE6m9Atw9Z/jjttRUZ+clIXogdghyZAuWJ3qEzjT+jI/dL1ifAqhZeC5VHzQp1MSt1+jxKkFNemj/iO7tVUA==} engines: {node: '>=4'} dev: true @@ -4851,7 +5003,12 @@ packages: dev: true /promise-inflight/1.0.1: - resolution: {integrity: sha1-mEcocL8igTL8vdhoEputEsPAKeM=} + resolution: {integrity: sha512-6zWPyEOFaQBJYcGMHBKTKJ3u6TBsnMFOIZSa6ce1e/ZrrsOlnHRHbabMjLiBYKp+n44X9eUI6VUPaukCXHuG4g==} + peerDependencies: + bluebird: '*' + peerDependenciesMeta: + bluebird: + optional: true dev: true /promise-retry/2.0.1: @@ -4894,7 +5051,7 @@ packages: dev: true /q/1.5.1: - resolution: {integrity: sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=} + resolution: {integrity: sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw==} engines: {node: '>=0.6.0', teleport: '>=0.2.0'} dev: true @@ -4956,7 +5113,7 @@ packages: dev: true /read-pkg-up/3.0.0: - resolution: {integrity: sha1-PtSWaF26D4/hGNBpHcUfSh/5bwc=} + resolution: {integrity: sha512-YFzFrVvpC6frF1sz8psoHDBGF7fLPc+llq/8NB43oagqWkx8ar5zYtsTORtOjw9W2RHLpWP+zTWwBvf1bCmcSw==} engines: {node: '>=4'} dependencies: find-up: 2.1.0 @@ -4973,7 +5130,7 @@ packages: dev: true /read-pkg/3.0.0: - resolution: {integrity: sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k=} + resolution: {integrity: sha512-BLq/cCO9two+lBgiTYNqD6GdtK8s4NpaWrl6/rCO9w0TUS8oJl7cmToOZfRYllKTISY6nt1U7jQ53brmKqY6BA==} engines: {node: '>=4'} dependencies: load-json-file: 4.0.0 @@ -5075,12 +5232,12 @@ packages: dev: true /repeat-string/1.6.1: - resolution: {integrity: sha1-jcrkcOHIirwtYA//Sndihtp15jc=} + resolution: {integrity: sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==} engines: {node: '>=0.10'} dev: true /require-directory/2.1.1: - resolution: {integrity: sha1-jGStX9MNqxyXbiNE/+f3kqam30I=} + resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} engines: {node: '>=0.10.0'} dev: true @@ -5116,7 +5273,7 @@ packages: dev: true /responselike/1.0.2: - resolution: {integrity: sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=} + resolution: {integrity: sha512-/Fpe5guzJk1gPqdJLJR5u7eG/gNY4nImjbRDaVWVMRhne55TCmj2i9Q+54PBRfatRC8v/rIiv9BN0pMd9OV5EQ==} dependencies: lowercase-keys: 1.0.1 dev: true @@ -5128,7 +5285,7 @@ packages: dev: true /restore-cursor/2.0.0: - resolution: {integrity: sha1-n37ih/gv0ybU/RYpI9YhKe7g368=} + resolution: {integrity: sha512-6IzJLuGi4+R14vwagDHX+JrXmPVtPpn4mffDJ1UdR7/Edm87fl6yi8mMBIVvFtJaNTUvjughmW4hwLhRG7gC1Q==} engines: {node: '>=4'} dependencies: onetime: 2.0.1 @@ -5144,7 +5301,7 @@ packages: dev: true /retry/0.12.0: - resolution: {integrity: sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=} + resolution: {integrity: sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==} engines: {node: '>= 4'} dev: true @@ -5160,13 +5317,14 @@ packages: glob: 7.2.3 dev: true - /rollup-plugin-ts/2.0.7_lq4dy2bb4fhoyaf2vwyb4geyfa: - resolution: {integrity: sha512-M9sppRKX6y/b2KXbGdUdHid0tshAEK/sEeYLBHBJiBa4swukSsoFVXKGGZasLcjaXhgUnnizFuvFFj6znxwvSA==} - engines: {node: '>=10.0.0', npm: '>=7.0.0', pnpm: '>=3.2.0', yarn: '>=1.13'} + /rollup-plugin-ts/3.0.1_fgms252lqu3rk7srzpqqayl4ya: + resolution: {integrity: sha512-qb+FDZyq1pljgXE+e2LqZH8L+FvS3a47ju/o+4sDd1OcM8P+CR6iH3jT2tjz0YIoJm9h1sj6ITVVBkux3EZ+XA==} + engines: {node: '>=14.9.0', npm: '>=7.0.0', pnpm: '>=3.2.0', yarn: '>=1.13'} peerDependencies: '@babel/core': '>=6.x || >=7.x' '@babel/plugin-transform-runtime': '>=6.x || >=7.x' '@babel/preset-env': '>=6.x || >=7.x' + '@babel/preset-typescript': '>=6.x || >=7.x' '@babel/runtime': '>=6.x || >=7.x' '@swc/core': '>=1.x' '@swc/helpers': '>=0.2' @@ -5179,6 +5337,8 @@ packages: optional: true '@babel/preset-env': optional: true + '@babel/preset-typescript': + optional: true '@babel/runtime': optional: true '@swc/core': @@ -5188,20 +5348,20 @@ packages: dependencies: '@rollup/pluginutils': 4.2.1 '@wessberg/stringutil': 1.0.19 - browserslist: 4.20.3 + ansi-colors: 4.1.3 + browserslist: 4.20.4 browserslist-generator: 1.0.66 - chalk: 4.1.2 - compatfactory: 0.0.13_typescript@4.6.4 - crosspath: 1.0.0 + compatfactory: 1.0.1_typescript@4.7.3 + crosspath: 2.0.0 magic-string: 0.26.2 - rollup: 2.74.1 - ts-clone-node: 0.3.32_typescript@4.6.4 + rollup: 2.75.6 + ts-clone-node: 1.0.0_typescript@4.7.3 tslib: 2.4.0 - typescript: 4.6.4 + typescript: 4.7.3 dev: true - /rollup/2.74.1: - resolution: {integrity: sha512-K2zW7kV8Voua5eGkbnBtWYfMIhYhT9Pel2uhBk2WO5eMee161nPze/XRfvEQPFYz7KgrCCnmh2Wy0AMFLGGmMA==} + /rollup/2.75.6: + resolution: {integrity: sha512-OEf0TgpC9vU6WGROJIk1JA3LR5vk/yvqlzxqdrE2CzzXnqKXNzbAwlWUXis8RS3ZPe7LAq+YUxsRa0l3r27MLA==} engines: {node: '>=10.0.0'} hasBin: true optionalDependencies: @@ -5244,21 +5404,22 @@ packages: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} dev: true - /sandhog/1.0.43: - resolution: {integrity: sha512-K5/t6MiDcwilCHb4wtXnOUckJgfXeO1rzqXYVCOEfH6Aco3R4l+M1oS3qQm2Ou3VMtaCVHCycTA7NtHjzDHTlQ==} - engines: {node: '>=10.0.0'} + /sandhog/2.0.2: + resolution: {integrity: sha512-1jBNZPOEZ1PDUBtFbWrKWup2C5kFLDRDgDkrIFB4f5RMv3kAIskADsHUdfDCSrhgeiFQ2hhpqKVpmQyMMPU9Lw==} + engines: {node: '>=14.19.0'} hasBin: true dependencies: - '@types/prettier': 2.6.1 - chalk: 4.1.2 - commander: 8.3.0 - eslint: 8.16.0 - helpertypes: 0.0.17 + '@types/prettier': 2.6.3 + ansi-colors: 4.1.3 + commander: 9.3.0 + crosspath: 2.0.0 + eslint: 8.17.0 + helpertypes: 0.0.18 inquirer: 8.2.4 json5: 2.2.1 markdown-toc: 1.2.0 prettier: 2.6.2 - yaml: 1.10.2 + yaml: 2.1.1 transitivePeerDependencies: - supports-color dev: true @@ -5339,7 +5500,7 @@ packages: dependencies: call-bind: 1.0.2 get-intrinsic: 1.1.1 - object-inspect: 1.12.1 + object-inspect: 1.12.2 dev: true /signal-exit/3.0.7: @@ -5374,8 +5535,19 @@ packages: engines: {node: '>= 6.0.0', npm: '>= 3.0.0'} dev: true - /socks-proxy-agent/6.2.0: - resolution: {integrity: sha512-wWqJhjb32Q6GsrUqzuFkukxb/zzide5quXYcMVpIjxalDBBYy2nqKCFQ/9+Ie4dvOYSQdOk3hUlZSdzZOd3zMQ==} + /socks-proxy-agent/6.2.1: + resolution: {integrity: sha512-a6KW9G+6B3nWZ1yB8G7pJwL3ggLy1uTzKAgCb7ttblwqdz9fMGJUuTy3uFzEP48FAs9FLILlmzDlE2JJhVQaXQ==} + engines: {node: '>= 10'} + dependencies: + agent-base: 6.0.2 + debug: 4.3.4 + socks: 2.6.2 + transitivePeerDependencies: + - supports-color + dev: true + + /socks-proxy-agent/7.0.0: + resolution: {integrity: sha512-Fgl0YPZ902wEsAyiQ+idGd1A7rSFx/ayC1CQVMw5P+EQx2V0SgpGtf6OKFhVjPflPUl9YMmEOnmfjCdMUsygww==} engines: {node: '>= 10'} dependencies: agent-base: 6.0.2 @@ -5456,6 +5628,13 @@ packages: resolution: {integrity: sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==} dev: true + /ssri/8.0.1: + resolution: {integrity: sha512-97qShzy1AiyxvPNIkLWoGua7xoQzzPjQ0HAH4B0rWKo7SZ6USuPcrUiAFrws0UH8RrbWmgq3LMTObhPIHbbBeQ==} + engines: {node: '>= 8'} + dependencies: + minipass: 3.1.6 + dev: true + /ssri/9.0.1: resolution: {integrity: sha512-o57Wcn66jMQvfHG1FlYbWeZWW/dHZhJXjpIcTfXldXEk5nz5lStPo3mK0OJQfGR3RbZUlbISexbljkJzuEj/8Q==} engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} @@ -5784,18 +5963,18 @@ packages: engines: {node: '>=0.10.0'} dev: true - /ts-clone-node/0.3.32_typescript@4.6.4: - resolution: {integrity: sha512-YYGvoWy2Ba98/YC/0leD7IRsU/q5pu/KRg9dD8omzkbgoZ8g7gfYfED9mWMTyNp7J3CQiiKyvM62B7mXXHKU7Q==} - engines: {node: '>=10.0.0'} + /ts-clone-node/1.0.0_typescript@4.7.3: + resolution: {integrity: sha512-/cDYbr2HAXxFNeTT41c/xs/2bhLJjqnYheHsmA3AoHSt+n4JA4t0FL9Lk5O8kWnJ6jeB3kPcUoXIFtwERNzv6Q==} + engines: {node: '>=14.9.0'} peerDependencies: typescript: ^3.x || ^4.x dependencies: - compatfactory: 0.0.13_typescript@4.6.4 - typescript: 4.6.4 + compatfactory: 1.0.1_typescript@4.7.3 + typescript: 4.7.3 dev: true - /ts-node/10.8.0_ihi2kx3po6rqbrzdqgpcfvwinm: - resolution: {integrity: sha512-/fNd5Qh+zTt8Vt1KbYZjRHCE9sI5i7nqfD/dzBBRDeVXZXS6kToW6R7tTU6Nd4XavFs0mAVCg29Q//ML7WsZYA==} + /ts-node/10.8.1_f5eqjuxkorpjvs4z7mviievvou: + resolution: {integrity: sha512-Wwsnao4DQoJsN034wePSg5nZiw4YKXf56mPIAeD6wVmiv+RytNSWqc2f3fKvcUoV+Yn2+yocD71VOfQHbmVX4g==} hasBin: true peerDependencies: '@swc/core': '>=1.2.50' @@ -5813,14 +5992,14 @@ packages: '@tsconfig/node12': 1.0.9 '@tsconfig/node14': 1.0.1 '@tsconfig/node16': 1.0.2 - '@types/node': 17.0.35 + '@types/node': 17.0.41 acorn: 8.7.1 acorn-walk: 8.2.0 arg: 4.1.3 create-require: 1.1.1 diff: 4.0.2 make-error: 1.3.6 - typescript: 4.6.4 + typescript: 4.7.3 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 dev: true @@ -5842,14 +6021,14 @@ packages: resolution: {integrity: sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==} dev: true - /tsutils/3.21.0_typescript@4.6.4: + /tsutils/3.21.0_typescript@4.7.3: resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} engines: {node: '>= 6'} peerDependencies: typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' dependencies: tslib: 1.14.1 - typescript: 4.6.4 + typescript: 4.7.3 dev: true /type-check/0.3.2: @@ -5999,12 +6178,18 @@ packages: hasBin: true dev: true + /typescript/4.7.3: + resolution: {integrity: sha512-WOkT3XYvrpXx4vMMqlD+8R8R37fZkjyLGlxavMc4iB8lrl8L0DeTcHbYgw/v0N/z9wAFsgBhcsF0ruoySS22mA==} + engines: {node: '>=4.2.0'} + hasBin: true + dev: true + /ua-parser-js/1.0.2: resolution: {integrity: sha512-00y/AXhx0/SsnI51fTc0rLRmafiGOM4/O+ny10Ps7f+j/b8p/ZY11ytMgznXkOVo4GQ+KwQG5UQLkLGirsACRg==} dev: true - /uglify-js/3.15.5: - resolution: {integrity: sha512-hNM5q5GbBRB5xB+PMqVRcgYe4c8jbyZ1pzZhS6jbq54/4F2gFK869ZheiE5A8/t+W5jtTNpWef/5Q9zk639FNQ==} + /uglify-js/3.16.0: + resolution: {integrity: sha512-FEikl6bR30n0T3amyBh3LoiBdqHRy/f4H80+My34HOesOKyHfOsxAPAxOoqC0JUnC1amnO0IwkYC3sko51caSw==} engines: {node: '>=0.8.0'} hasBin: true requiresBuild: true @@ -6247,8 +6432,8 @@ packages: typedarray-to-buffer: 3.1.5 dev: true - /ws/8.6.0: - resolution: {integrity: sha512-AzmM3aH3gk0aX7/rZLYvjdvZooofDu3fFOzGqcSnQ1tOcTWwhM/o+q++E8mAyVVIyUdajrkzWUGftaVSDLn1bw==} + /ws/8.7.0: + resolution: {integrity: sha512-c2gsP0PRwcLFzUiA8Mkr37/MI7ilIlHQxaEAtd0uNMbVMoy8puJyafRlm0bV9MbGSabUPeLrRRaqIBcFcA2Pqg==} engines: {node: '>=10.0.0'} peerDependencies: bufferutil: ^4.0.1 @@ -6293,8 +6478,8 @@ packages: engines: {node: '>= 6'} dev: true - /yaml/2.1.0: - resolution: {integrity: sha512-OuAINfTsoJrY5H7CBWnKZhX6nZciXBydrMtTHr1dC4nP40X5jyTIVlogZHxSlVZM8zSgXRfgZGsaHF4+pV+JRw==} + /yaml/2.1.1: + resolution: {integrity: sha512-o96x3OPo8GjWeSLF+wOAbrPfhFOGY0W00GNaxCDv+9hkcDJEnev1yh8S7pgHF0ik6zc8sQLuL8hjHjJULZp8bw==} engines: {node: '>= 14'} dev: true diff --git a/prettier.config.js b/prettier.config.js deleted file mode 100644 index 761a1ff..0000000 --- a/prettier.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("@wessberg/ts-config/prettier.config"); diff --git a/rollup.config.js b/rollup.config.js index 6e584d1..e6fd051 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,20 +1,28 @@ import ts from "rollup-plugin-ts"; -import packageJSON from "./package.json"; +import pkg from "./package.json"; import {builtinModules} from "module"; +const SHARED_OUTPUT_OPTIONS = { + sourcemap: true, + hoistTransitiveImports: false, + generatedCode: "es2015", + compact: false, + minifyInternalExports: false +}; + // noinspection JSUnusedGlobalSymbols export default { input: "src/index.ts", output: [ { - file: packageJSON.main, + file: pkg.exports.require, format: "cjs", - sourcemap: true + ...SHARED_OUTPUT_OPTIONS }, { - file: packageJSON.module, + file: pkg.exports.import, format: "esm", - sourcemap: true + ...SHARED_OUTPUT_OPTIONS } ], treeshake: true, @@ -23,5 +31,5 @@ export default { tsconfig: "tsconfig.build.json" }) ], - external: [...builtinModules, ...Object.keys(packageJSON.dependencies), ...Object.keys(packageJSON.devDependencies)] + external: [...builtinModules, ...Object.keys(pkg.dependencies), ...Object.keys(pkg.devDependencies)] }; diff --git a/sandhog.config.js b/sandhog.config.js index 6314c39..2992f61 100644 --- a/sandhog.config.js +++ b/sandhog.config.js @@ -1,5 +1,7 @@ -module.exports = { - ...require("@wessberg/ts-config/sandhog.config"), +import baseConfig from "@wessberg/ts-config/sandhog.config.js"; + +export default { + ...baseConfig, logo: { url: "https://raw.githubusercontent.com/wessberg/ts-evaluator/master/documentation/asset/ts-evaluator-logo.png", height: 120 diff --git a/src/index.ts b/src/index.ts index 13eb8c2..62289e4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,29 +1,30 @@ -export {evaluate} from "./interpreter/evaluate"; -export {EvaluateResult} from "./interpreter/evaluate-result"; -export {EvaluateOptions as IEvaluateOptions} from "./interpreter/evaluate-options"; +export {evaluate} from "./interpreter/evaluate.js"; +export {EvaluateResult} from "./interpreter/evaluate-result.js"; +export {EvaluateOptions} from "./interpreter/evaluate-options.js"; // Logging -export {LogLevelKind} from "./interpreter/logger/log-level"; +export * from "./interpreter/logger/log-level.js"; // Environment -export {EnvironmentPresetKind} from "./interpreter/environment/environment-preset-kind"; -export {IEnvironment} from "./interpreter/environment/i-environment"; +export * from "./interpreter/environment/environment-preset-kind.js"; +export * from "./interpreter/environment/i-environment.js"; // Errors -export {EvaluationError} from "./interpreter/error/evaluation-error/evaluation-error"; -export {MissingCatchOrFinallyAfterTryError} from "./interpreter/error/missing-catch-or-finally-after-try-error/missing-catch-or-finally-after-try-error"; -export {ModuleNotFoundError} from "./interpreter/error/module-not-found-error/module-not-found-error"; -export {NotCallableError} from "./interpreter/error/not-callable-error/not-callable-error"; -export {PolicyError} from "./interpreter/error/policy-error/policy-error"; -export {UndefinedIdentifierError} from "./interpreter/error/undefined-identifier-error/undefined-identifier-error"; -export {UndefinedLeftValueError} from "./interpreter/error/undefined-left-value-error/undefined-left-value-error"; -export {UnexpectedNodeError} from "./interpreter/error/unexpected-node-error/unexpected-node-error"; -export {IoError} from "./interpreter/error/policy-error/io-error/io-error"; -export {MaxOpsExceededError} from "./interpreter/error/policy-error/max-ops-exceeded-error/max-ops-exceeded-error"; -export {MaxOpDurationExceededError} from "./interpreter/error/policy-error/max-op-duration-exceeded-error/max-op-duration-exceeded-error"; -export {NetworkError} from "./interpreter/error/policy-error/network-error/network-error"; -export {NonDeterministicError} from "./interpreter/error/policy-error/non-deterministic-error/non-deterministic-error"; -export {ProcessError} from "./interpreter/error/policy-error/process-error/process-error"; +export * from "./interpreter/error/evaluation-error/evaluation-error.js"; +export * from "./interpreter/error/missing-catch-or-finally-after-try-error/missing-catch-or-finally-after-try-error.js"; +export * from "./interpreter/error/module-not-found-error/module-not-found-error.js"; +export * from "./interpreter/error/not-callable-error/not-callable-error.js"; +export * from "./interpreter/error/policy-error/policy-error.js"; +export * from "./interpreter/error/undefined-identifier-error/undefined-identifier-error.js"; +export * from "./interpreter/error/undefined-left-value-error/undefined-left-value-error.js"; +export * from "./interpreter/error/unexpected-syntax-error/unexpected-syntax-error"; +export * from "./interpreter/error/unexpected-node-error/unexpected-node-error.js"; +export * from "./interpreter/error/policy-error/io-error/io-error.js"; +export * from "./interpreter/error/policy-error/max-ops-exceeded-error/max-ops-exceeded-error.js"; +export * from "./interpreter/error/policy-error/max-op-duration-exceeded-error/max-op-duration-exceeded-error.js"; +export * from "./interpreter/error/policy-error/network-error/network-error.js"; +export * from "./interpreter/error/policy-error/non-deterministic-error/non-deterministic-error.js"; +export * from "./interpreter/error/policy-error/process-error/process-error.js"; // Reporting -export {BindingReportCallback, IReportingOptions, ReportingOptions} from "./interpreter/reporting/i-reporting-options"; +export {BindingReportCallback, IReportingOptions, ReportingOptions} from "./interpreter/reporting/i-reporting-options.js"; diff --git a/src/interpreter/environment/browser/browser-globals.ts b/src/interpreter/environment/browser/browser-globals.ts index 2fe0249..e7c5087 100644 --- a/src/interpreter/environment/browser/browser-globals.ts +++ b/src/interpreter/environment/browser/browser-globals.ts @@ -1,8 +1,8 @@ -import {mergeDescriptors} from "../../util/descriptor/merge-descriptors"; -import {ECMA_GLOBALS} from "../ecma/ecma-globals"; -import {subtract} from "../../util/object/subtract"; -import {rafImplementation} from "./lib/raf"; -import {loadJsdom} from "../../util/loader/optional-peer-dependency-loader"; +import {mergeDescriptors} from "../../util/descriptor/merge-descriptors.js"; +import {ECMA_GLOBALS} from "../ecma/ecma-globals.js"; +import {subtract} from "../../util/object/subtract.js"; +import {rafImplementation} from "./lib/raf.js"; +import {loadJsdom} from "../../util/loader/optional-peer-dependency-loader.js"; export const BROWSER_GLOBALS = () => { const {JSDOM} = loadJsdom(true); diff --git a/src/interpreter/environment/create-sanitized-environment.ts b/src/interpreter/environment/create-sanitized-environment.ts index 3d7bc82..e2a5a9a 100644 --- a/src/interpreter/environment/create-sanitized-environment.ts +++ b/src/interpreter/environment/create-sanitized-environment.ts @@ -1,19 +1,19 @@ -import {IndexLiteral} from "../literal/literal"; -import {createPolicyProxy} from "../proxy/create-policy-proxy"; -import {stringifyPolicyTrapKindOnPath} from "../policy/policy-trap-kind"; -import {isNonDeterministic} from "../policy/nondeterministic/is-nondeterministic"; -import {NonDeterministicError} from "../error/policy-error/non-deterministic-error/non-deterministic-error"; -import {PolicyProxyHookOptions} from "../proxy/policy-proxy-hook"; -import {isIoRead} from "../policy/io/is-io-read"; -import {IoError} from "../error/policy-error/io-error/io-error"; -import {isIoWrite} from "../policy/io/is-io-write"; -import {isNetworkOperation} from "../policy/network/is-network-operation"; -import {NetworkError} from "../error/policy-error/network-error/network-error"; -import {isProcessExitOperation} from "../policy/process/is-process-exit-operation"; -import {ProcessError} from "../error/policy-error/process-error/process-error"; -import {isProcessSpawnChildOperation} from "../policy/process/is-process-spawn-child-operation"; -import {ICreateSanitizedEnvironmentOptions} from "./i-create-sanitized-environment-options"; -import {isConsoleOperation} from "../policy/console/is-console-operation"; +import {IndexLiteral} from "../literal/literal.js"; +import {createPolicyProxy} from "../proxy/create-policy-proxy.js"; +import {stringifyPolicyTrapKindOnPath} from "../policy/policy-trap-kind.js"; +import {isNonDeterministic} from "../policy/nondeterministic/is-nondeterministic.js"; +import {NonDeterministicError} from "../error/policy-error/non-deterministic-error/non-deterministic-error.js"; +import {PolicyProxyHookOptions} from "../proxy/policy-proxy-hook.js"; +import {isIoRead} from "../policy/io/is-io-read.js"; +import {IoError} from "../error/policy-error/io-error/io-error.js"; +import {isIoWrite} from "../policy/io/is-io-write.js"; +import {isNetworkOperation} from "../policy/network/is-network-operation.js"; +import {NetworkError} from "../error/policy-error/network-error/network-error.js"; +import {isProcessExitOperation} from "../policy/process/is-process-exit-operation.js"; +import {ProcessError} from "../error/policy-error/process-error/process-error.js"; +import {isProcessSpawnChildOperation} from "../policy/process/is-process-spawn-child-operation.js"; +import {ICreateSanitizedEnvironmentOptions} from "./i-create-sanitized-environment-options.js"; +import {isConsoleOperation} from "../policy/console/is-console-operation.js"; /** * Creates an environment that provide hooks into policy checks diff --git a/src/interpreter/environment/ecma/ecma-globals.ts b/src/interpreter/environment/ecma/ecma-globals.ts index af62169..13231cd 100644 --- a/src/interpreter/environment/ecma/ecma-globals.ts +++ b/src/interpreter/environment/ecma/ecma-globals.ts @@ -1,4 +1,4 @@ -import {IndexLiteral} from "../../literal/literal"; +import {IndexLiteral} from "../../literal/literal.js"; export const ECMA_GLOBALS = () => { /* eslint-disable @typescript-eslint/naming-convention */ @@ -37,6 +37,18 @@ export const ECMA_GLOBALS = () => { /* eslint-enable @typescript-eslint/naming-convention */ }; + try { + base.AggregateError = AggregateError; + } catch {} + + try { + base.FinalizationRegistry = FinalizationRegistry; + } catch {} + + try { + base.WeakRef = WeakRef; + } catch {} + try { base.BigInt = BigInt; } catch {} @@ -65,6 +77,26 @@ export const ECMA_GLOBALS = () => { base.Uint8Array = Uint8Array; } catch {} + try { + base.BigUint64Array = BigUint64Array; + } catch {} + + try { + base.BigInt64Array = BigInt64Array; + } catch {} + + try { + base.Atomics = Atomics; + } catch {} + + try { + base.SharedArrayBuffer = SharedArrayBuffer; + } catch {} + + try { + base.WebAssembly = WebAssembly; + } catch {} + try { base.Uint8ClampedArray = Uint8ClampedArray; } catch {} diff --git a/src/interpreter/environment/environment-preset-kind.ts b/src/interpreter/environment/environment-preset-kind.ts index 0f2cbf4..51b73be 100644 --- a/src/interpreter/environment/environment-preset-kind.ts +++ b/src/interpreter/environment/environment-preset-kind.ts @@ -1 +1 @@ -export type EnvironmentPresetKind = "NONE" | "ECMA" | "BROWSER" | "NODE"; +export type EnvironmentPresetKind = "NONE" | "ECMA" | "BROWSER" | "NODE" | "NODE_CJS" | "NODE_ESM"; diff --git a/src/interpreter/environment/i-create-sanitized-environment-options.ts b/src/interpreter/environment/i-create-sanitized-environment-options.ts index 08e0a9b..1ea8262 100644 --- a/src/interpreter/environment/i-create-sanitized-environment-options.ts +++ b/src/interpreter/environment/i-create-sanitized-environment-options.ts @@ -1,6 +1,6 @@ -import {EvaluatePolicySanitized} from "../policy/evaluate-policy"; -import {IndexLiteral} from "../literal/literal"; -import {TS} from "../../type/ts"; +import {EvaluatePolicySanitized} from "../policy/evaluate-policy.js"; +import {IndexLiteral} from "../literal/literal.js"; +import {TS} from "../../type/ts.js"; export interface ICreateSanitizedEnvironmentOptions { policy: EvaluatePolicySanitized; diff --git a/src/interpreter/environment/i-environment.ts b/src/interpreter/environment/i-environment.ts index 2e1b546..8e5bdd5 100644 --- a/src/interpreter/environment/i-environment.ts +++ b/src/interpreter/environment/i-environment.ts @@ -1,5 +1,5 @@ -import {EnvironmentPresetKind} from "./environment-preset-kind"; -import {LexicalEnvironment} from "../lexical-environment/lexical-environment"; +import {EnvironmentPresetKind} from "./environment-preset-kind.js"; +import {LexicalEnvironment} from "../lexical-environment/lexical-environment.js"; export interface IEnvironment { preset: EnvironmentPresetKind; diff --git a/src/interpreter/environment/node/node-built-ins-and-globals.ts b/src/interpreter/environment/node/node-built-ins-and-globals.ts index 1b72a4e..ea83392 100644 --- a/src/interpreter/environment/node/node-built-ins-and-globals.ts +++ b/src/interpreter/environment/node/node-built-ins-and-globals.ts @@ -1,3 +1,3 @@ -import {BuiltInModuleMap} from "../../policy/module/built-in-module-map"; +import {BuiltInModuleMap} from "../../policy/module/built-in-module-map.js"; export type NodeBuiltInsAndGlobals = BuiltInModuleMap & typeof global; diff --git a/src/interpreter/environment/node/node-globals.ts b/src/interpreter/environment/node/node-cjs-globals.ts similarity index 64% rename from src/interpreter/environment/node/node-globals.ts rename to src/interpreter/environment/node/node-cjs-globals.ts index 8ea09d6..d98329c 100644 --- a/src/interpreter/environment/node/node-globals.ts +++ b/src/interpreter/environment/node/node-cjs-globals.ts @@ -1,12 +1,14 @@ -import {mergeDescriptors} from "../../util/descriptor/merge-descriptors"; -import {ECMA_GLOBALS} from "../ecma/ecma-globals"; -import {subtract} from "../../util/object/subtract"; +/* eslint-disable @typescript-eslint/naming-convention */ +import {mergeDescriptors} from "../../util/descriptor/merge-descriptors.js"; +import {ECMA_GLOBALS} from "../ecma/ecma-globals.js"; +import {subtract} from "../../util/object/subtract.js"; import path from "crosspath"; +import {requireModule} from "../../util/loader/require-module.js"; -export const NODE_GLOBALS = () => { +export const NODE_CJS_GLOBALS = () => { const ecmaGlobals = ECMA_GLOBALS(); const merged = mergeDescriptors(subtract(global, ecmaGlobals), ecmaGlobals, { - require, + require: requireModule, process, __dirname: (fileName: string) => path.native.normalize(path.native.dirname(fileName)), __filename: (fileName: string) => path.native.normalize(fileName) diff --git a/src/interpreter/environment/node/node-esm-globals.ts b/src/interpreter/environment/node/node-esm-globals.ts new file mode 100644 index 0000000..a8cb833 --- /dev/null +++ b/src/interpreter/environment/node/node-esm-globals.ts @@ -0,0 +1,33 @@ +import {mergeDescriptors} from "../../util/descriptor/merge-descriptors.js"; +import {ECMA_GLOBALS} from "../ecma/ecma-globals.js"; +import {subtract} from "../../util/object/subtract.js"; +import path from "crosspath"; +export const NODE_ESM_GLOBALS = () => { + const ecmaGlobals = ECMA_GLOBALS(); + const merged = mergeDescriptors(subtract(global, ecmaGlobals), ecmaGlobals, { + import: { + meta: { + url: (fileName: string) => { + const normalized = path.normalize(fileName); + return `file:///${normalized.startsWith(`/`) ? normalized.slice(1) : normalized}`; + } + } + }, + process + }); + + Object.defineProperties(merged, { + global: { + get(): typeof merged { + return merged; + } + }, + globalThis: { + get(): typeof merged { + return merged; + } + } + }); + + return merged; +}; diff --git a/src/interpreter/error/async-iterator-not-supported-error/async-iterator-not-supported-error.ts b/src/interpreter/error/async-iterator-not-supported-error/async-iterator-not-supported-error.ts index 6792cd5..478a6f5 100644 --- a/src/interpreter/error/async-iterator-not-supported-error/async-iterator-not-supported-error.ts +++ b/src/interpreter/error/async-iterator-not-supported-error/async-iterator-not-supported-error.ts @@ -1,5 +1,5 @@ -import {EvaluationError} from "../evaluation-error/evaluation-error"; -import {IAsyncIteratorNotSupportedErrorOptions} from "./i-async-iterator-not-supported-error-options"; +import {EvaluationError} from "../evaluation-error/evaluation-error.js"; +import {IAsyncIteratorNotSupportedErrorOptions} from "./i-async-iterator-not-supported-error-options.js"; /** * An Error that can be thrown when an async iteration operation is attempted diff --git a/src/interpreter/error/async-iterator-not-supported-error/i-async-iterator-not-supported-error-options.ts b/src/interpreter/error/async-iterator-not-supported-error/i-async-iterator-not-supported-error-options.ts index 69ebc93..0cd4b10 100644 --- a/src/interpreter/error/async-iterator-not-supported-error/i-async-iterator-not-supported-error-options.ts +++ b/src/interpreter/error/async-iterator-not-supported-error/i-async-iterator-not-supported-error-options.ts @@ -1,5 +1,5 @@ -import {IEvaluationErrorOptions} from "../evaluation-error/i-evaluation-error-options"; -import {TS} from "../../../type/ts"; +import {IEvaluationErrorOptions} from "../evaluation-error/i-evaluation-error-options.js"; +import {TS} from "../../../type/ts.js"; export interface IAsyncIteratorNotSupportedErrorOptions extends Omit { typescript: typeof TS; diff --git a/src/interpreter/error/evaluation-error/evaluation-error.ts b/src/interpreter/error/evaluation-error/evaluation-error.ts index e6eb0cb..c85b479 100644 --- a/src/interpreter/error/evaluation-error/evaluation-error.ts +++ b/src/interpreter/error/evaluation-error/evaluation-error.ts @@ -1,5 +1,5 @@ -import {IEvaluationErrorOptions} from "./i-evaluation-error-options"; -import {TS} from "../../../type/ts"; +import {IEvaluationErrorOptions} from "./i-evaluation-error-options.js"; +import {TS} from "../../../type/ts.js"; /** * A Base class for EvaluationErrors diff --git a/src/interpreter/error/evaluation-error/i-evaluation-error-options.ts b/src/interpreter/error/evaluation-error/i-evaluation-error-options.ts index a103ca7..bce4ff3 100644 --- a/src/interpreter/error/evaluation-error/i-evaluation-error-options.ts +++ b/src/interpreter/error/evaluation-error/i-evaluation-error-options.ts @@ -1,4 +1,4 @@ -import {TS} from "../../../type/ts"; +import {TS} from "../../../type/ts.js"; export interface IEvaluationErrorOptions { node: TS.Node; diff --git a/src/interpreter/error/missing-catch-or-finally-after-try-error/i-missing-catch-or-finally-after-try-error-options.ts b/src/interpreter/error/missing-catch-or-finally-after-try-error/i-missing-catch-or-finally-after-try-error-options.ts index d4172b3..357c20a 100644 --- a/src/interpreter/error/missing-catch-or-finally-after-try-error/i-missing-catch-or-finally-after-try-error-options.ts +++ b/src/interpreter/error/missing-catch-or-finally-after-try-error/i-missing-catch-or-finally-after-try-error-options.ts @@ -1,5 +1,5 @@ -import {IEvaluationErrorOptions} from "../evaluation-error/i-evaluation-error-options"; -import {TS} from "../../../type/ts"; +import {IEvaluationErrorOptions} from "../evaluation-error/i-evaluation-error-options.js"; +import {TS} from "../../../type/ts.js"; export interface IMissingCatchOrFinallyAfterTryErrorOptions extends IEvaluationErrorOptions { node: TS.TryStatement; diff --git a/src/interpreter/error/missing-catch-or-finally-after-try-error/missing-catch-or-finally-after-try-error.ts b/src/interpreter/error/missing-catch-or-finally-after-try-error/missing-catch-or-finally-after-try-error.ts index 6ac38c8..1ae6be1 100644 --- a/src/interpreter/error/missing-catch-or-finally-after-try-error/missing-catch-or-finally-after-try-error.ts +++ b/src/interpreter/error/missing-catch-or-finally-after-try-error/missing-catch-or-finally-after-try-error.ts @@ -1,6 +1,6 @@ -import {EvaluationError} from "../evaluation-error/evaluation-error"; -import {IMissingCatchOrFinallyAfterTryErrorOptions} from "./i-missing-catch-or-finally-after-try-error-options"; -import {TS} from "../../../type/ts"; +import {EvaluationError} from "../evaluation-error/evaluation-error.js"; +import {IMissingCatchOrFinallyAfterTryErrorOptions} from "./i-missing-catch-or-finally-after-try-error-options.js"; +import {TS} from "../../../type/ts.js"; /** * An Error that can be thrown when a TryStatement is encountered without neither a catch {...} nor a finally {...} block diff --git a/src/interpreter/error/module-not-found-error/i-module-not-found-error-options.ts b/src/interpreter/error/module-not-found-error/i-module-not-found-error-options.ts index 8dfb825..06ebdf9 100644 --- a/src/interpreter/error/module-not-found-error/i-module-not-found-error-options.ts +++ b/src/interpreter/error/module-not-found-error/i-module-not-found-error-options.ts @@ -1,4 +1,4 @@ -import {IEvaluationErrorOptions} from "../evaluation-error/i-evaluation-error-options"; +import {IEvaluationErrorOptions} from "../evaluation-error/i-evaluation-error-options.js"; export interface IModuleNotFoundErrorOptions extends IEvaluationErrorOptions { path: string; diff --git a/src/interpreter/error/module-not-found-error/module-not-found-error.ts b/src/interpreter/error/module-not-found-error/module-not-found-error.ts index e4210a4..547ee04 100644 --- a/src/interpreter/error/module-not-found-error/module-not-found-error.ts +++ b/src/interpreter/error/module-not-found-error/module-not-found-error.ts @@ -1,5 +1,5 @@ -import {EvaluationError} from "../evaluation-error/evaluation-error"; -import {IModuleNotFoundErrorOptions} from "./i-module-not-found-error-options"; +import {EvaluationError} from "../evaluation-error/evaluation-error.js"; +import {IModuleNotFoundErrorOptions} from "./i-module-not-found-error-options.js"; /** * An Error that can be thrown when a moduleSpecifier couldn't be resolved diff --git a/src/interpreter/error/not-callable-error/i-not-callable-error-options.ts b/src/interpreter/error/not-callable-error/i-not-callable-error-options.ts index ac7eeb1..fd8191e 100644 --- a/src/interpreter/error/not-callable-error/i-not-callable-error-options.ts +++ b/src/interpreter/error/not-callable-error/i-not-callable-error-options.ts @@ -1,5 +1,5 @@ -import {IEvaluationErrorOptions} from "../evaluation-error/i-evaluation-error-options"; -import {Literal} from "../../literal/literal"; +import {IEvaluationErrorOptions} from "../evaluation-error/i-evaluation-error-options.js"; +import {Literal} from "../../literal/literal.js"; export interface INotCallableErrorOptions extends IEvaluationErrorOptions { value: Literal; diff --git a/src/interpreter/error/not-callable-error/not-callable-error.ts b/src/interpreter/error/not-callable-error/not-callable-error.ts index 89fc9e8..7d5aa46 100644 --- a/src/interpreter/error/not-callable-error/not-callable-error.ts +++ b/src/interpreter/error/not-callable-error/not-callable-error.ts @@ -1,6 +1,6 @@ -import {EvaluationError} from "../evaluation-error/evaluation-error"; -import {INotCallableErrorOptions} from "./i-not-callable-error-options"; -import {Literal, stringifyLiteral} from "../../literal/literal"; +import {EvaluationError} from "../evaluation-error/evaluation-error.js"; +import {INotCallableErrorOptions} from "./i-not-callable-error-options.js"; +import {Literal, stringifyLiteral} from "../../literal/literal.js"; /** * An Error that can be thrown when a value is attempted to be called, but isn't callable diff --git a/src/interpreter/error/policy-error/i-policy-error-options.ts b/src/interpreter/error/policy-error/i-policy-error-options.ts index d04e9fa..09bef77 100644 --- a/src/interpreter/error/policy-error/i-policy-error-options.ts +++ b/src/interpreter/error/policy-error/i-policy-error-options.ts @@ -1,5 +1,5 @@ -import {IEvaluationErrorOptions} from "../evaluation-error/i-evaluation-error-options"; -import {EvaluatePolicySanitized} from "../../policy/evaluate-policy"; +import {IEvaluationErrorOptions} from "../evaluation-error/i-evaluation-error-options.js"; +import {EvaluatePolicySanitized} from "../../policy/evaluate-policy.js"; export interface IPolicyErrorOptions extends IEvaluationErrorOptions { violation: keyof EvaluatePolicySanitized; diff --git a/src/interpreter/error/policy-error/io-error/i-io-error-options.ts b/src/interpreter/error/policy-error/io-error/i-io-error-options.ts index 48ee24b..85dcb19 100644 --- a/src/interpreter/error/policy-error/io-error/i-io-error-options.ts +++ b/src/interpreter/error/policy-error/io-error/i-io-error-options.ts @@ -1,5 +1,5 @@ -import {IEvaluationErrorOptions} from "../../evaluation-error/i-evaluation-error-options"; -import {EvaluateIOPolicy} from "../../../policy/evaluate-policy"; +import {IEvaluationErrorOptions} from "../../evaluation-error/i-evaluation-error-options.js"; +import {EvaluateIOPolicy} from "../../../policy/evaluate-policy.js"; export interface IIoErrorOptions extends IEvaluationErrorOptions { kind: keyof EvaluateIOPolicy; diff --git a/src/interpreter/error/policy-error/io-error/io-error.ts b/src/interpreter/error/policy-error/io-error/io-error.ts index c9eea25..56d540e 100644 --- a/src/interpreter/error/policy-error/io-error/io-error.ts +++ b/src/interpreter/error/policy-error/io-error/io-error.ts @@ -1,6 +1,6 @@ -import {IIoErrorOptions} from "./i-io-error-options"; -import {PolicyError} from "../policy-error"; -import {EvaluateIOPolicy} from "../../../policy/evaluate-policy"; +import {IIoErrorOptions} from "./i-io-error-options.js"; +import {PolicyError} from "../policy-error.js"; +import {EvaluateIOPolicy} from "../../../policy/evaluate-policy.js"; /** * An Error that can be thrown when an IO operation is attempted to be executed that is in violation of the context policy diff --git a/src/interpreter/error/policy-error/max-op-duration-exceeded-error/i-max-op-duration-exceeded-error-options.ts b/src/interpreter/error/policy-error/max-op-duration-exceeded-error/i-max-op-duration-exceeded-error-options.ts index 993c889..40993da 100644 --- a/src/interpreter/error/policy-error/max-op-duration-exceeded-error/i-max-op-duration-exceeded-error-options.ts +++ b/src/interpreter/error/policy-error/max-op-duration-exceeded-error/i-max-op-duration-exceeded-error-options.ts @@ -1,4 +1,4 @@ -import {IEvaluationErrorOptions} from "../../evaluation-error/i-evaluation-error-options"; +import {IEvaluationErrorOptions} from "../../evaluation-error/i-evaluation-error-options.js"; export interface IMaxOpDurationExceededErrorOptions extends IEvaluationErrorOptions { duration: number; diff --git a/src/interpreter/error/policy-error/max-op-duration-exceeded-error/max-op-duration-exceeded-error.ts b/src/interpreter/error/policy-error/max-op-duration-exceeded-error/max-op-duration-exceeded-error.ts index 81a2ae3..5894020 100644 --- a/src/interpreter/error/policy-error/max-op-duration-exceeded-error/max-op-duration-exceeded-error.ts +++ b/src/interpreter/error/policy-error/max-op-duration-exceeded-error/max-op-duration-exceeded-error.ts @@ -1,5 +1,5 @@ -import {IMaxOpDurationExceededErrorOptions} from "./i-max-op-duration-exceeded-error-options"; -import {PolicyError} from "../policy-error"; +import {IMaxOpDurationExceededErrorOptions} from "./i-max-op-duration-exceeded-error-options.js"; +import {PolicyError} from "../policy-error.js"; /** * An Error that can be thrown when the maximum amount of operations dictated by the policy is exceeded diff --git a/src/interpreter/error/policy-error/max-ops-exceeded-error/i-max-ops-exceeded-error-options.ts b/src/interpreter/error/policy-error/max-ops-exceeded-error/i-max-ops-exceeded-error-options.ts index f2c9eaa..dcd683f 100644 --- a/src/interpreter/error/policy-error/max-ops-exceeded-error/i-max-ops-exceeded-error-options.ts +++ b/src/interpreter/error/policy-error/max-ops-exceeded-error/i-max-ops-exceeded-error-options.ts @@ -1,4 +1,4 @@ -import {IEvaluationErrorOptions} from "../../evaluation-error/i-evaluation-error-options"; +import {IEvaluationErrorOptions} from "../../evaluation-error/i-evaluation-error-options.js"; export interface IMaxOpsExceededErrorOptions extends IEvaluationErrorOptions { ops: number; diff --git a/src/interpreter/error/policy-error/max-ops-exceeded-error/max-ops-exceeded-error.ts b/src/interpreter/error/policy-error/max-ops-exceeded-error/max-ops-exceeded-error.ts index 9b63449..e28e9a1 100644 --- a/src/interpreter/error/policy-error/max-ops-exceeded-error/max-ops-exceeded-error.ts +++ b/src/interpreter/error/policy-error/max-ops-exceeded-error/max-ops-exceeded-error.ts @@ -1,5 +1,5 @@ -import {IMaxOpsExceededErrorOptions} from "./i-max-ops-exceeded-error-options"; -import {PolicyError} from "../policy-error"; +import {IMaxOpsExceededErrorOptions} from "./i-max-ops-exceeded-error-options.js"; +import {PolicyError} from "../policy-error.js"; /** * An Error that can be thrown when the maximum amount of operations dictated by the policy is exceeded diff --git a/src/interpreter/error/policy-error/network-error/i-network-error-options.ts b/src/interpreter/error/policy-error/network-error/i-network-error-options.ts index 9d90432..6beca96 100644 --- a/src/interpreter/error/policy-error/network-error/i-network-error-options.ts +++ b/src/interpreter/error/policy-error/network-error/i-network-error-options.ts @@ -1,4 +1,4 @@ -import {IEvaluationErrorOptions} from "../../evaluation-error/i-evaluation-error-options"; +import {IEvaluationErrorOptions} from "../../evaluation-error/i-evaluation-error-options.js"; export interface INetworkErrorOptions extends IEvaluationErrorOptions { operation: string; diff --git a/src/interpreter/error/policy-error/network-error/network-error.ts b/src/interpreter/error/policy-error/network-error/network-error.ts index 9f05e95..2d3124b 100644 --- a/src/interpreter/error/policy-error/network-error/network-error.ts +++ b/src/interpreter/error/policy-error/network-error/network-error.ts @@ -1,5 +1,5 @@ -import {INetworkErrorOptions} from "./i-network-error-options"; -import {PolicyError} from "../policy-error"; +import {INetworkErrorOptions} from "./i-network-error-options.js"; +import {PolicyError} from "../policy-error.js"; /** * An Error that can be thrown when a network operation is attempted to be executed that is in violation of the context policy diff --git a/src/interpreter/error/policy-error/non-deterministic-error/i-non-deterministic-error-options.ts b/src/interpreter/error/policy-error/non-deterministic-error/i-non-deterministic-error-options.ts index 61d21ed..a547e73 100644 --- a/src/interpreter/error/policy-error/non-deterministic-error/i-non-deterministic-error-options.ts +++ b/src/interpreter/error/policy-error/non-deterministic-error/i-non-deterministic-error-options.ts @@ -1,4 +1,4 @@ -import {IEvaluationErrorOptions} from "../../evaluation-error/i-evaluation-error-options"; +import {IEvaluationErrorOptions} from "../../evaluation-error/i-evaluation-error-options.js"; export interface INonDeterministicErrorOptions extends IEvaluationErrorOptions { operation: string; diff --git a/src/interpreter/error/policy-error/non-deterministic-error/non-deterministic-error.ts b/src/interpreter/error/policy-error/non-deterministic-error/non-deterministic-error.ts index 2cc76ad..f0fe6ef 100644 --- a/src/interpreter/error/policy-error/non-deterministic-error/non-deterministic-error.ts +++ b/src/interpreter/error/policy-error/non-deterministic-error/non-deterministic-error.ts @@ -1,5 +1,5 @@ -import {INonDeterministicErrorOptions} from "./i-non-deterministic-error-options"; -import {PolicyError} from "../policy-error"; +import {INonDeterministicErrorOptions} from "./i-non-deterministic-error-options.js"; +import {PolicyError} from "../policy-error.js"; /** * An Error that can be thrown when something nondeterministic is attempted to be evaluated and has been disallowed to be so diff --git a/src/interpreter/error/policy-error/policy-error.ts b/src/interpreter/error/policy-error/policy-error.ts index 70e35fb..3783590 100644 --- a/src/interpreter/error/policy-error/policy-error.ts +++ b/src/interpreter/error/policy-error/policy-error.ts @@ -1,6 +1,6 @@ -import {EvaluationError} from "../evaluation-error/evaluation-error"; -import {IPolicyErrorOptions} from "./i-policy-error-options"; -import {EvaluatePolicySanitized} from "../../policy/evaluate-policy"; +import {EvaluationError} from "../evaluation-error/evaluation-error.js"; +import {IPolicyErrorOptions} from "./i-policy-error-options.js"; +import {EvaluatePolicySanitized} from "../../policy/evaluate-policy.js"; /** * An Error that can be thrown when a policy is violated diff --git a/src/interpreter/error/policy-error/process-error/i-process-error-options.ts b/src/interpreter/error/policy-error/process-error/i-process-error-options.ts index e714948..4400a1b 100644 --- a/src/interpreter/error/policy-error/process-error/i-process-error-options.ts +++ b/src/interpreter/error/policy-error/process-error/i-process-error-options.ts @@ -1,5 +1,5 @@ -import {IEvaluationErrorOptions} from "../../evaluation-error/i-evaluation-error-options"; -import {EvaluateProcessPolicy} from "../../../policy/evaluate-policy"; +import {IEvaluationErrorOptions} from "../../evaluation-error/i-evaluation-error-options.js"; +import {EvaluateProcessPolicy} from "../../../policy/evaluate-policy.js"; export interface IProcessErrorOptions extends IEvaluationErrorOptions { kind: keyof EvaluateProcessPolicy; diff --git a/src/interpreter/error/policy-error/process-error/process-error.ts b/src/interpreter/error/policy-error/process-error/process-error.ts index 6591138..4e13dd5 100644 --- a/src/interpreter/error/policy-error/process-error/process-error.ts +++ b/src/interpreter/error/policy-error/process-error/process-error.ts @@ -1,6 +1,6 @@ -import {IProcessErrorOptions} from "./i-process-error-options"; -import {PolicyError} from "../policy-error"; -import {EvaluateProcessPolicy} from "../../../policy/evaluate-policy"; +import {IProcessErrorOptions} from "./i-process-error-options.js"; +import {PolicyError} from "../policy-error.js"; +import {EvaluateProcessPolicy} from "../../../policy/evaluate-policy.js"; /** * An Error that can be thrown when a Process operation is attempted to be executed that is in violation of the context policy diff --git a/src/interpreter/error/undefined-identifier-error/i-undefined-identifier-error-options.ts b/src/interpreter/error/undefined-identifier-error/i-undefined-identifier-error-options.ts index b871c46..3d5c7cf 100644 --- a/src/interpreter/error/undefined-identifier-error/i-undefined-identifier-error-options.ts +++ b/src/interpreter/error/undefined-identifier-error/i-undefined-identifier-error-options.ts @@ -1,5 +1,5 @@ -import {IEvaluationErrorOptions} from "../evaluation-error/i-evaluation-error-options"; -import {TS} from "../../../type/ts"; +import {IEvaluationErrorOptions} from "../evaluation-error/i-evaluation-error-options.js"; +import {TS} from "../../../type/ts.js"; export interface IUndefinedIdentifierErrorOptions extends IEvaluationErrorOptions { node: TS.Identifier | TS.PrivateIdentifier; diff --git a/src/interpreter/error/undefined-identifier-error/undefined-identifier-error.ts b/src/interpreter/error/undefined-identifier-error/undefined-identifier-error.ts index 12dffe2..e6d3597 100644 --- a/src/interpreter/error/undefined-identifier-error/undefined-identifier-error.ts +++ b/src/interpreter/error/undefined-identifier-error/undefined-identifier-error.ts @@ -1,6 +1,6 @@ -import {EvaluationError} from "../evaluation-error/evaluation-error"; -import {IUndefinedIdentifierErrorOptions} from "./i-undefined-identifier-error-options"; -import {TS} from "../../../type/ts"; +import {EvaluationError} from "../evaluation-error/evaluation-error.js"; +import {IUndefinedIdentifierErrorOptions} from "./i-undefined-identifier-error-options.js"; +import {TS} from "../../../type/ts.js"; /** * An Error that can be thrown when an undefined identifier is encountered diff --git a/src/interpreter/error/undefined-left-value-error/i-undefined-left-value-error-options.ts b/src/interpreter/error/undefined-left-value-error/i-undefined-left-value-error-options.ts index b852495..7a9c385 100644 --- a/src/interpreter/error/undefined-left-value-error/i-undefined-left-value-error-options.ts +++ b/src/interpreter/error/undefined-left-value-error/i-undefined-left-value-error-options.ts @@ -1,3 +1,3 @@ -import {IEvaluationErrorOptions} from "../evaluation-error/i-evaluation-error-options"; +import {IEvaluationErrorOptions} from "../evaluation-error/i-evaluation-error-options.js"; export interface IUndefinedLeftValueErrorOptions extends IEvaluationErrorOptions {} diff --git a/src/interpreter/error/undefined-left-value-error/undefined-left-value-error.ts b/src/interpreter/error/undefined-left-value-error/undefined-left-value-error.ts index 4c57ed0..4187ad5 100644 --- a/src/interpreter/error/undefined-left-value-error/undefined-left-value-error.ts +++ b/src/interpreter/error/undefined-left-value-error/undefined-left-value-error.ts @@ -1,5 +1,5 @@ -import {EvaluationError} from "../evaluation-error/evaluation-error"; -import {IUndefinedLeftValueErrorOptions} from "./i-undefined-left-value-error-options"; +import {EvaluationError} from "../evaluation-error/evaluation-error.js"; +import {IUndefinedLeftValueErrorOptions} from "./i-undefined-left-value-error-options.js"; /** * An Error that can be thrown when an undefined leftValue is encountered diff --git a/src/interpreter/error/unexpected-node-error/i-unexpected-node-error-options.ts b/src/interpreter/error/unexpected-node-error/i-unexpected-node-error-options.ts index f483261..a505858 100644 --- a/src/interpreter/error/unexpected-node-error/i-unexpected-node-error-options.ts +++ b/src/interpreter/error/unexpected-node-error/i-unexpected-node-error-options.ts @@ -1,5 +1,5 @@ -import {IEvaluationErrorOptions} from "../evaluation-error/i-evaluation-error-options"; -import {TS} from "../../../type/ts"; +import {IEvaluationErrorOptions} from "../evaluation-error/i-evaluation-error-options.js"; +import {TS} from "../../../type/ts.js"; export interface IUnexpectedNodeErrorOptions extends IEvaluationErrorOptions { typescript: typeof TS; diff --git a/src/interpreter/error/unexpected-node-error/unexpected-node-error.ts b/src/interpreter/error/unexpected-node-error/unexpected-node-error.ts index 54e51e3..97bf0a1 100644 --- a/src/interpreter/error/unexpected-node-error/unexpected-node-error.ts +++ b/src/interpreter/error/unexpected-node-error/unexpected-node-error.ts @@ -1,5 +1,5 @@ -import {EvaluationError} from "../evaluation-error/evaluation-error"; -import {IUnexpectedNodeErrorOptions} from "./i-unexpected-node-error-options"; +import {EvaluationError} from "../evaluation-error/evaluation-error.js"; +import {IUnexpectedNodeErrorOptions} from "./i-unexpected-node-error-options.js"; /** * An Error that can be thrown when an unexpected node is encountered diff --git a/src/interpreter/error/unexpected-syntax-error/i-unexpected-syntax-error-options.ts b/src/interpreter/error/unexpected-syntax-error/i-unexpected-syntax-error-options.ts new file mode 100644 index 0000000..6b9ecd3 --- /dev/null +++ b/src/interpreter/error/unexpected-syntax-error/i-unexpected-syntax-error-options.ts @@ -0,0 +1,3 @@ +import {IEvaluationErrorOptions} from "../evaluation-error/i-evaluation-error-options.js"; + +export interface IUnexpectedSyntaxErrorOptions extends IEvaluationErrorOptions {} diff --git a/src/interpreter/error/unexpected-syntax-error/unexpected-syntax-error.ts b/src/interpreter/error/unexpected-syntax-error/unexpected-syntax-error.ts new file mode 100644 index 0000000..0dd3aab --- /dev/null +++ b/src/interpreter/error/unexpected-syntax-error/unexpected-syntax-error.ts @@ -0,0 +1,11 @@ +import {EvaluationError} from "../evaluation-error/evaluation-error.js"; +import {IUnexpectedSyntaxErrorOptions} from "./i-unexpected-syntax-error-options.js"; + +/** + * An Error that can be thrown when a certain usage is to be considered a SyntaxError + */ +export class UnexpectedSyntaxError extends EvaluationError { + constructor({node, message = `'SyntaxError'`}: IUnexpectedSyntaxErrorOptions) { + super({message, node}); + } +} diff --git a/src/interpreter/evaluate-options.ts b/src/interpreter/evaluate-options.ts index aa6e8fa..a1e9bc4 100644 --- a/src/interpreter/evaluate-options.ts +++ b/src/interpreter/evaluate-options.ts @@ -1,8 +1,8 @@ -import {LogLevelKind} from "./logger/log-level"; -import {EvaluatePolicy} from "./policy/evaluate-policy"; -import {IEnvironment} from "./environment/i-environment"; -import {ReportingOptions} from "./reporting/i-reporting-options"; -import {TS} from "../type/ts"; +import {LogLevelKind} from "./logger/log-level.js"; +import {EvaluatePolicy} from "./policy/evaluate-policy.js"; +import {IEnvironment} from "./environment/i-environment.js"; +import {ReportingOptions} from "./reporting/i-reporting-options.js"; +import {TS} from "../type/ts.js"; export interface EvaluateOptions { node: TS.Statement | TS.Declaration | TS.Expression; diff --git a/src/interpreter/evaluate-result.ts b/src/interpreter/evaluate-result.ts index 99145cf..d7b5a98 100644 --- a/src/interpreter/evaluate-result.ts +++ b/src/interpreter/evaluate-result.ts @@ -1,4 +1,4 @@ -import {EvaluationError} from "./error/evaluation-error/evaluation-error"; +import {EvaluationError} from "./error/evaluation-error/evaluation-error.js"; export interface IEvaluateResultBase { success: boolean; diff --git a/src/interpreter/evaluate.ts b/src/interpreter/evaluate.ts index 331b6ac..8c866e6 100644 --- a/src/interpreter/evaluate.ts +++ b/src/interpreter/evaluate.ts @@ -1,24 +1,24 @@ import * as TSModule from "typescript"; -import {EvaluateOptions} from "./evaluate-options"; -import {createLexicalEnvironment} from "./lexical-environment/lexical-environment"; -import {EvaluateResult} from "./evaluate-result"; -import {evaluateSimpleLiteral} from "./evaluator/simple/evaluate-simple-literal"; -import {createNodeEvaluator} from "./evaluator/node-evaluator/create-node-evaluator"; -import {LogLevelKind} from "./logger/log-level"; -import {Logger} from "./logger/logger"; -import {createStatementTraversalStack} from "./stack/traversal-stack/statement-traversal-stack"; -import {isExpression} from "./util/expression/is-expression"; -import {Literal} from "./literal/literal"; -import {isStatement} from "./util/statement/is-statement"; -import {createStack, Stack} from "./stack/stack"; -import {isDeclaration} from "./util/declaration/is-declaration"; -import {UnexpectedNodeError} from "./error/unexpected-node-error/unexpected-node-error"; -import {EvaluatePolicySanitized} from "./policy/evaluate-policy"; -import {reportError} from "./util/reporting/report-error"; -import {createReportedErrorSet} from "./reporting/reported-error-set"; -import {ReportingOptionsSanitized} from "./reporting/i-reporting-options"; -import {TS} from "../type/ts"; -import { EvaluationError } from "./error/evaluation-error/evaluation-error"; +import {EvaluateOptions} from "./evaluate-options.js"; +import {createLexicalEnvironment} from "./lexical-environment/lexical-environment.js"; +import {EvaluateResult} from "./evaluate-result.js"; +import {evaluateSimpleLiteral} from "./evaluator/simple/evaluate-simple-literal.js"; +import {createNodeEvaluator} from "./evaluator/node-evaluator/create-node-evaluator.js"; +import {LogLevelKind} from "./logger/log-level.js"; +import {Logger} from "./logger/logger.js"; +import {createStatementTraversalStack} from "./stack/traversal-stack/statement-traversal-stack.js"; +import {isExpression} from "./util/expression/is-expression.js"; +import {Literal} from "./literal/literal.js"; +import {isStatement} from "./util/statement/is-statement.js"; +import {createStack, Stack} from "./stack/stack.js"; +import {isDeclaration} from "./util/declaration/is-declaration.js"; +import {UnexpectedNodeError} from "./error/unexpected-node-error/unexpected-node-error.js"; +import {EvaluatePolicySanitized} from "./policy/evaluate-policy.js"; +import {reportError} from "./util/reporting/report-error.js"; +import {createReportedErrorSet} from "./reporting/reported-error-set.js"; +import {ReportingOptionsSanitized} from "./reporting/i-reporting-options.js"; +import {TS} from "../type/ts.js"; +import {EvaluationError} from "./error/evaluation-error/evaluation-error.js"; /** * Will get a literal value for the given Expression, ExpressionStatement, or Declaration. diff --git a/src/interpreter/evaluator/evaluate-array-binding-pattern.ts b/src/interpreter/evaluator/evaluate-array-binding-pattern.ts index bf1a107..d982d55 100644 --- a/src/interpreter/evaluator/evaluate-array-binding-pattern.ts +++ b/src/interpreter/evaluator/evaluate-array-binding-pattern.ts @@ -1,6 +1,6 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {Literal} from "../literal/literal"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {Literal} from "../literal/literal.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, an ArrayBindingPattern, based on an initializer diff --git a/src/interpreter/evaluator/evaluate-array-literal-expression.ts b/src/interpreter/evaluator/evaluate-array-literal-expression.ts index b4adb35..f022a61 100644 --- a/src/interpreter/evaluator/evaluate-array-literal-expression.ts +++ b/src/interpreter/evaluator/evaluate-array-literal-expression.ts @@ -1,8 +1,8 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {Literal} from "../literal/literal"; -import {getFromLexicalEnvironment} from "../lexical-environment/lexical-environment"; -import {isIterable} from "../util/iterable/is-iterable"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {Literal} from "../literal/literal.js"; +import {getFromLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import {isIterable} from "../util/iterable/is-iterable.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a ArrayLiteralExpression diff --git a/src/interpreter/evaluator/evaluate-arrow-function-expression.ts b/src/interpreter/evaluator/evaluate-arrow-function-expression.ts index e64586a..2df4c32 100644 --- a/src/interpreter/evaluator/evaluate-arrow-function-expression.ts +++ b/src/interpreter/evaluator/evaluate-arrow-function-expression.ts @@ -1,11 +1,11 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {getFromLexicalEnvironment, LexicalEnvironment, pathInLexicalEnvironmentEquals, setInLexicalEnvironment} from "../lexical-environment/lexical-environment"; -import {cloneLexicalEnvironment} from "../lexical-environment/clone-lexical-environment"; -import {Literal} from "../literal/literal"; -import {evaluateParameterDeclarations} from "./evaluate-parameter-declarations"; -import {RETURN_SYMBOL} from "../util/return/return-symbol"; -import {hasModifier} from "../util/modifier/has-modifier"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {getFromLexicalEnvironment, LexicalEnvironment, pathInLexicalEnvironmentEquals, setInLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import {cloneLexicalEnvironment} from "../lexical-environment/clone-lexical-environment.js"; +import {Literal} from "../literal/literal.js"; +import {evaluateParameterDeclarations} from "./evaluate-parameter-declarations.js"; +import {RETURN_SYMBOL} from "../util/return/return-symbol.js"; +import {hasModifier} from "../util/modifier/has-modifier.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, an ArrowFunction @@ -16,7 +16,7 @@ export function evaluateArrowFunctionExpression(options: EvaluatorOptions { // Prepare a lexical environment for the function context - const localLexicalEnvironment: LexicalEnvironment = cloneLexicalEnvironment(environment); + const localLexicalEnvironment: LexicalEnvironment = cloneLexicalEnvironment(environment, node); // Define a new binding for a return symbol within the environment setInLexicalEnvironment({env: localLexicalEnvironment, path: RETURN_SYMBOL, value: false, newBinding: true, reporting, node}); @@ -55,7 +55,7 @@ export function evaluateArrowFunctionExpression(options: EvaluatorOptions { // Prepare a lexical environment for the function context - const localLexicalEnvironment: LexicalEnvironment = cloneLexicalEnvironment(environment); + const localLexicalEnvironment: LexicalEnvironment = cloneLexicalEnvironment(environment, node); // Define a new binding for a return symbol within the environment setInLexicalEnvironment({env: localLexicalEnvironment, path: RETURN_SYMBOL, value: false, newBinding: true, reporting, node}); diff --git a/src/interpreter/evaluator/evaluate-as-expression.ts b/src/interpreter/evaluator/evaluate-as-expression.ts index 887e356..a271e55 100644 --- a/src/interpreter/evaluator/evaluate-as-expression.ts +++ b/src/interpreter/evaluator/evaluate-as-expression.ts @@ -1,6 +1,6 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {Literal} from "../literal/literal"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {Literal} from "../literal/literal.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, an AsExpression diff --git a/src/interpreter/evaluator/evaluate-await-expression.ts b/src/interpreter/evaluator/evaluate-await-expression.ts index 6bbc67f..e15fae1 100644 --- a/src/interpreter/evaluator/evaluate-await-expression.ts +++ b/src/interpreter/evaluator/evaluate-await-expression.ts @@ -1,7 +1,7 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {Literal} from "../literal/literal"; -import {MaxOpDurationExceededError} from "../error/policy-error/max-op-duration-exceeded-error/max-op-duration-exceeded-error"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {Literal} from "../literal/literal.js"; +import {MaxOpDurationExceededError} from "../error/policy-error/max-op-duration-exceeded-error/max-op-duration-exceeded-error.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, an AwaitExpression diff --git a/src/interpreter/evaluator/evaluate-big-int-literal.ts b/src/interpreter/evaluator/evaluate-big-int-literal.ts index 3f2207f..686e031 100644 --- a/src/interpreter/evaluator/evaluate-big-int-literal.ts +++ b/src/interpreter/evaluator/evaluate-big-int-literal.ts @@ -1,7 +1,7 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {Literal} from "../literal/literal"; -import {getFromLexicalEnvironment} from "../lexical-environment/lexical-environment"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {Literal} from "../literal/literal.js"; +import {getFromLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a BigIntLiteral diff --git a/src/interpreter/evaluator/evaluate-binary-expression.ts b/src/interpreter/evaluator/evaluate-binary-expression.ts index 9196cce..eccdccc 100644 --- a/src/interpreter/evaluator/evaluate-binary-expression.ts +++ b/src/interpreter/evaluator/evaluate-binary-expression.ts @@ -1,16 +1,17 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {getDotPathFromNode} from "../lexical-environment/get-dot-path-from-node"; -import {setInLexicalEnvironment} from "../lexical-environment/lexical-environment"; -import {Literal} from "../literal/literal"; -import {UnexpectedNodeError} from "../error/unexpected-node-error/unexpected-node-error"; -import {UndefinedLeftValueError} from "../error/undefined-left-value-error/undefined-left-value-error"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {getDotPathFromNode} from "../lexical-environment/get-dot-path-from-node.js"; +import {findLexicalEnvironmentInSameContext, setInLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import {Literal} from "../literal/literal.js"; +import {UnexpectedNodeError} from "../error/unexpected-node-error/unexpected-node-error.js"; +import {UndefinedLeftValueError} from "../error/undefined-left-value-error/undefined-left-value-error.js"; +import {TS} from "../../type/ts.js"; +import {getInnerNode} from "../util/node/get-inner-node.js"; /** * Evaluates, or attempts to evaluate, a BinaryExpression */ export function evaluateBinaryExpression(options: EvaluatorOptions): Literal { - const {node, environment, evaluate, logger, statementTraversalStack, reporting, typescript} = options; + const {node, environment, evaluate, logger, typeChecker, statementTraversalStack, reporting, typescript} = options; const leftValue = evaluate.expression(node.left, environment, statementTraversalStack) as number; const rightValue = evaluate.expression(node.right, environment, statementTraversalStack) as number; @@ -146,8 +147,16 @@ export function evaluateBinaryExpression(options: EvaluatorOptions): void { // Prepare a lexical environment for the Block context - const localLexicalEnvironment: LexicalEnvironment = cloneLexicalEnvironment(environment); + const localLexicalEnvironment: LexicalEnvironment = cloneLexicalEnvironment(environment, node); for (let i = 0; i < node.statements.length; i++) { const statement = node.statements[i]; diff --git a/src/interpreter/evaluator/evaluate-boolean-literal.ts b/src/interpreter/evaluator/evaluate-boolean-literal.ts index a6418a6..55d2506 100644 --- a/src/interpreter/evaluator/evaluate-boolean-literal.ts +++ b/src/interpreter/evaluator/evaluate-boolean-literal.ts @@ -1,6 +1,6 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {Literal} from "../literal/literal"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {Literal} from "../literal/literal.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a BooleanLiteral diff --git a/src/interpreter/evaluator/evaluate-break-statement.ts b/src/interpreter/evaluator/evaluate-break-statement.ts index a192615..a6ddd0a 100644 --- a/src/interpreter/evaluator/evaluate-break-statement.ts +++ b/src/interpreter/evaluator/evaluate-break-statement.ts @@ -1,7 +1,7 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {setInLexicalEnvironment} from "../lexical-environment/lexical-environment"; -import {BREAK_SYMBOL} from "../util/break/break-symbol"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {setInLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import {BREAK_SYMBOL} from "../util/break/break-symbol.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a BreakStatement diff --git a/src/interpreter/evaluator/evaluate-call-expression.ts b/src/interpreter/evaluator/evaluate-call-expression.ts index edb14bb..0a6b3b2 100644 --- a/src/interpreter/evaluator/evaluate-call-expression.ts +++ b/src/interpreter/evaluator/evaluate-call-expression.ts @@ -1,10 +1,10 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {isLazyCall, Literal} from "../literal/literal"; -import {NotCallableError} from "../error/not-callable-error/not-callable-error"; -import {getFromLexicalEnvironment} from "../lexical-environment/lexical-environment"; -import {THIS_SYMBOL} from "../util/this/this-symbol"; -import {expressionContainsSuperKeyword} from "../util/expression/expression-contains-super-keyword"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {isLazyCall, Literal} from "../literal/literal.js"; +import {NotCallableError} from "../error/not-callable-error/not-callable-error.js"; +import {getFromLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import {THIS_SYMBOL} from "../util/this/this-symbol.js"; +import {expressionContainsSuperKeyword} from "../util/expression/expression-contains-super-keyword.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a CallExpression diff --git a/src/interpreter/evaluator/evaluate-case-block.ts b/src/interpreter/evaluator/evaluate-case-block.ts index 5449788..f9b41cd 100644 --- a/src/interpreter/evaluator/evaluate-case-block.ts +++ b/src/interpreter/evaluator/evaluate-case-block.ts @@ -1,18 +1,18 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {pathInLexicalEnvironmentEquals, setInLexicalEnvironment} from "../lexical-environment/lexical-environment"; -import {cloneLexicalEnvironment} from "../lexical-environment/clone-lexical-environment"; -import {BREAK_SYMBOL} from "../util/break/break-symbol"; -import {CONTINUE_SYMBOL} from "../util/continue/continue-symbol"; -import {RETURN_SYMBOL} from "../util/return/return-symbol"; -import {Literal} from "../literal/literal"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {pathInLexicalEnvironmentEquals, setInLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import {cloneLexicalEnvironment} from "../lexical-environment/clone-lexical-environment.js"; +import {BREAK_SYMBOL} from "../util/break/break-symbol.js"; +import {CONTINUE_SYMBOL} from "../util/continue/continue-symbol.js"; +import {RETURN_SYMBOL} from "../util/return/return-symbol.js"; +import {Literal} from "../literal/literal.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a CaseBlock, based on a switch expression */ export function evaluateCaseBlock({node, evaluate, environment, reporting, statementTraversalStack}: EvaluatorOptions, switchExpression: Literal): void { // Prepare a lexical environment for the case block - const localEnvironment = cloneLexicalEnvironment(environment); + const localEnvironment = cloneLexicalEnvironment(environment, node); // Define a new binding for a break symbol within the environment setInLexicalEnvironment({env: localEnvironment, path: BREAK_SYMBOL, value: false, newBinding: true, reporting, node}); diff --git a/src/interpreter/evaluator/evaluate-case-clause.ts b/src/interpreter/evaluator/evaluate-case-clause.ts index fa841da..288ec1d 100644 --- a/src/interpreter/evaluator/evaluate-case-clause.ts +++ b/src/interpreter/evaluator/evaluate-case-clause.ts @@ -1,10 +1,10 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {pathInLexicalEnvironmentEquals} from "../lexical-environment/lexical-environment"; -import {BREAK_SYMBOL} from "../util/break/break-symbol"; -import {CONTINUE_SYMBOL} from "../util/continue/continue-symbol"; -import {RETURN_SYMBOL} from "../util/return/return-symbol"; -import {Literal} from "../literal/literal"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {pathInLexicalEnvironmentEquals} from "../lexical-environment/lexical-environment.js"; +import {BREAK_SYMBOL} from "../util/break/break-symbol.js"; +import {CONTINUE_SYMBOL} from "../util/continue/continue-symbol.js"; +import {RETURN_SYMBOL} from "../util/return/return-symbol.js"; +import {Literal} from "../literal/literal.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a CaseClause, based on a switch expression diff --git a/src/interpreter/evaluator/evaluate-catch-clause.ts b/src/interpreter/evaluator/evaluate-catch-clause.ts index b07ce16..61ab044 100644 --- a/src/interpreter/evaluator/evaluate-catch-clause.ts +++ b/src/interpreter/evaluator/evaluate-catch-clause.ts @@ -1,13 +1,13 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {cloneLexicalEnvironment} from "../lexical-environment/clone-lexical-environment"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {cloneLexicalEnvironment} from "../lexical-environment/clone-lexical-environment.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a CatchClause, based on a given Error */ export function evaluateCatchClause({node, evaluate, environment, statementTraversalStack}: EvaluatorOptions, ex: Error): void { // If a catch binding is provided, we must provide a local lexical environment for the CatchBlock - const catchEnvironment = node.variableDeclaration == null ? environment : cloneLexicalEnvironment(environment); + const catchEnvironment = node.variableDeclaration == null ? environment : cloneLexicalEnvironment(environment, node); // Evaluate the catch binding, if any is provided if (node.variableDeclaration != null) { diff --git a/src/interpreter/evaluator/evaluate-class-declaration.ts b/src/interpreter/evaluator/evaluate-class-declaration.ts index d2789b8..b24107c 100644 --- a/src/interpreter/evaluator/evaluate-class-declaration.ts +++ b/src/interpreter/evaluator/evaluate-class-declaration.ts @@ -1,8 +1,8 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {setInLexicalEnvironment} from "../lexical-environment/lexical-environment"; -import {generateClassDeclaration} from "../util/class/generate-class-declaration"; -import {hasModifier} from "../util/modifier/has-modifier"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {setInLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import {generateClassDeclaration} from "../util/class/generate-class-declaration.js"; +import {hasModifier} from "../util/modifier/has-modifier.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a ClassDeclaration diff --git a/src/interpreter/evaluator/evaluate-class-expression.ts b/src/interpreter/evaluator/evaluate-class-expression.ts index 16e2710..5ec387a 100644 --- a/src/interpreter/evaluator/evaluate-class-expression.ts +++ b/src/interpreter/evaluator/evaluate-class-expression.ts @@ -1,9 +1,9 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {setInLexicalEnvironment} from "../lexical-environment/lexical-environment"; -import {generateClassDeclaration} from "../util/class/generate-class-declaration"; -import {hasModifier} from "../util/modifier/has-modifier"; -import {Literal} from "../literal/literal"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {setInLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import {generateClassDeclaration} from "../util/class/generate-class-declaration.js"; +import {hasModifier} from "../util/modifier/has-modifier.js"; +import {Literal} from "../literal/literal.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a ClassExpression diff --git a/src/interpreter/evaluator/evaluate-computed-property-name.ts b/src/interpreter/evaluator/evaluate-computed-property-name.ts index f6789c5..03b7cc1 100644 --- a/src/interpreter/evaluator/evaluate-computed-property-name.ts +++ b/src/interpreter/evaluator/evaluate-computed-property-name.ts @@ -1,6 +1,6 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {Literal} from "../literal/literal"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {Literal} from "../literal/literal.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a ComputedPropertyName diff --git a/src/interpreter/evaluator/evaluate-conditional-expression.ts b/src/interpreter/evaluator/evaluate-conditional-expression.ts index 8c4a435..679f1d3 100644 --- a/src/interpreter/evaluator/evaluate-conditional-expression.ts +++ b/src/interpreter/evaluator/evaluate-conditional-expression.ts @@ -1,6 +1,6 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {Literal} from "../literal/literal"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {Literal} from "../literal/literal.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a ConditionalExpression diff --git a/src/interpreter/evaluator/evaluate-constructor-declaration.ts b/src/interpreter/evaluator/evaluate-constructor-declaration.ts index b58f359..6d48cbc 100644 --- a/src/interpreter/evaluator/evaluate-constructor-declaration.ts +++ b/src/interpreter/evaluator/evaluate-constructor-declaration.ts @@ -1,11 +1,11 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {LexicalEnvironment, pathInLexicalEnvironmentEquals, setInLexicalEnvironment} from "../lexical-environment/lexical-environment"; -import {cloneLexicalEnvironment} from "../lexical-environment/clone-lexical-environment"; -import {IndexLiteral, Literal} from "../literal/literal"; -import {evaluateParameterDeclarations} from "./evaluate-parameter-declarations"; -import {THIS_SYMBOL} from "../util/this/this-symbol"; -import {RETURN_SYMBOL} from "../util/return/return-symbol"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {LexicalEnvironment, pathInLexicalEnvironmentEquals, setInLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import {cloneLexicalEnvironment} from "../lexical-environment/clone-lexical-environment.js"; +import {IndexLiteral, Literal} from "../literal/literal.js"; +import {evaluateParameterDeclarations} from "./evaluate-parameter-declarations.js"; +import {THIS_SYMBOL} from "../util/this/this-symbol.js"; +import {RETURN_SYMBOL} from "../util/return/return-symbol.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a ConstructorDeclaration @@ -20,7 +20,7 @@ export function evaluateConstructorDeclaration(options: EvaluatorOptions): void { // Prepare a lexical environment for the ForStatement - const forEnvironment = cloneLexicalEnvironment(environment); + const forEnvironment = cloneLexicalEnvironment(environment, node); // Evaluate the initializer if it is given if (node.initializer !== undefined) { @@ -26,7 +26,7 @@ export function evaluateForStatement({node, environment, evaluate, reporting, st while (true) { // Prepare a lexical environment for the current iteration - const iterationEnvironment = cloneLexicalEnvironment(forEnvironment); + const iterationEnvironment = cloneLexicalEnvironment(forEnvironment, node); // Define a new binding for a break symbol within the environment setInLexicalEnvironment({env: iterationEnvironment, path: BREAK_SYMBOL, value: false, newBinding: true, reporting, node}); diff --git a/src/interpreter/evaluator/evaluate-function-declaration.ts b/src/interpreter/evaluator/evaluate-function-declaration.ts index 11594b6..5f7b7f8 100644 --- a/src/interpreter/evaluator/evaluate-function-declaration.ts +++ b/src/interpreter/evaluator/evaluate-function-declaration.ts @@ -1,13 +1,13 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {getFromLexicalEnvironment, LexicalEnvironment, pathInLexicalEnvironmentEquals, setInLexicalEnvironment} from "../lexical-environment/lexical-environment"; -import {cloneLexicalEnvironment} from "../lexical-environment/clone-lexical-environment"; -import {Literal} from "../literal/literal"; -import {evaluateParameterDeclarations} from "./evaluate-parameter-declarations"; -import {THIS_SYMBOL} from "../util/this/this-symbol"; -import {RETURN_SYMBOL} from "../util/return/return-symbol"; -import {getImplementationForDeclarationWithinDeclarationFile} from "../util/module/get-implementation-for-declaration-within-declaration-file"; -import {hasModifier} from "../util/modifier/has-modifier"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {getFromLexicalEnvironment, LexicalEnvironment, pathInLexicalEnvironmentEquals, setInLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import {cloneLexicalEnvironment} from "../lexical-environment/clone-lexical-environment.js"; +import {Literal} from "../literal/literal.js"; +import {evaluateParameterDeclarations} from "./evaluate-parameter-declarations.js"; +import {THIS_SYMBOL} from "../util/this/this-symbol.js"; +import {RETURN_SYMBOL} from "../util/return/return-symbol.js"; +import {getImplementationForDeclarationWithinDeclarationFile} from "../util/module/get-implementation-for-declaration-within-declaration-file.js"; +import {hasModifier} from "../util/modifier/has-modifier.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a FunctionDeclaration @@ -20,7 +20,7 @@ export function evaluateFunctionDeclaration(options: EvaluatorOptions): Literal | void { + switch (node.keywordToken) { + case typescript.SyntaxKind.NewKeyword: { + switch (node.name.text) { + case "target": + return getFromLexicalEnvironment(node, environment, "[[NewTarget]]")?.literal; + default: + throw new UnexpectedSyntaxError({node: node.name}); + } + } + + case typescript.SyntaxKind.ImportKeyword: { + switch (node.name.text) { + case "meta": + return getFromLexicalEnvironment(node, environment, "import.meta")?.literal; + default: + throw new UnexpectedSyntaxError({node: node.name}); + } + } + } +} diff --git a/src/interpreter/evaluator/evaluate-method-declaration.ts b/src/interpreter/evaluator/evaluate-method-declaration.ts index 0ffd32c..b7d7113 100644 --- a/src/interpreter/evaluator/evaluate-method-declaration.ts +++ b/src/interpreter/evaluator/evaluate-method-declaration.ts @@ -1,14 +1,14 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {getFromLexicalEnvironment, LexicalEnvironment, pathInLexicalEnvironmentEquals, setInLexicalEnvironment} from "../lexical-environment/lexical-environment"; -import {cloneLexicalEnvironment} from "../lexical-environment/clone-lexical-environment"; -import {IndexLiteral, IndexLiteralKey, Literal} from "../literal/literal"; -import {evaluateParameterDeclarations} from "./evaluate-parameter-declarations"; -import {THIS_SYMBOL} from "../util/this/this-symbol"; -import {RETURN_SYMBOL} from "../util/return/return-symbol"; -import {SUPER_SYMBOL} from "../util/super/super-symbol"; -import {inStaticContext} from "../util/static/in-static-context"; -import {hasModifier} from "../util/modifier/has-modifier"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {getFromLexicalEnvironment, LexicalEnvironment, pathInLexicalEnvironmentEquals, setInLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import {cloneLexicalEnvironment} from "../lexical-environment/clone-lexical-environment.js"; +import {IndexLiteral, IndexLiteralKey, Literal} from "../literal/literal.js"; +import {evaluateParameterDeclarations} from "./evaluate-parameter-declarations.js"; +import {THIS_SYMBOL} from "../util/this/this-symbol.js"; +import {RETURN_SYMBOL} from "../util/return/return-symbol.js"; +import {SUPER_SYMBOL} from "../util/super/super-symbol.js"; +import {inStaticContext} from "../util/static/in-static-context.js"; +import {hasModifier} from "../util/modifier/has-modifier.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a MethodDeclaration, before setting it on the given parent @@ -33,7 +33,7 @@ export function evaluateMethodDeclaration(options: EvaluatorOptions): Literal { +export function evaluateNewExpression({node, environment, evaluate, statementTraversalStack, reporting}: EvaluatorOptions): Literal { const evaluatedArgs: Literal[] = []; if (node.arguments != null) { @@ -17,5 +18,10 @@ export function evaluateNewExpression({node, environment, evaluate, statementTra // Evaluate the expression const expressionResult = evaluate.expression(node.expression, environment, statementTraversalStack) as new (...args: Literal[]) => Literal; + // If the expression evaluated to a function, mark it as the [[NewTarget]], as per https://tc39.es/ecma262/multipage/executable-code-and-execution-contexts.html#sec-getnewtarget + if (typeof expressionResult === "function") { + setInLexicalEnvironment({env: environment, path: "[[NewTarget]]", value: expressionResult, newBinding: true, reporting, node}); + } + return new expressionResult(...evaluatedArgs); } diff --git a/src/interpreter/evaluator/evaluate-node-with-argument.ts b/src/interpreter/evaluator/evaluate-node-with-argument.ts index 5c79a0b..1d1ae29 100644 --- a/src/interpreter/evaluator/evaluate-node-with-argument.ts +++ b/src/interpreter/evaluator/evaluate-node-with-argument.ts @@ -1,27 +1,27 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {IndexLiteral, Literal} from "../literal/literal"; -import {evaluateBindingName} from "./evaluate-binding-name"; -import {evaluateGetAccessorDeclaration} from "./evaluate-get-accessor-declaration"; -import {evaluateSetAccessorDeclaration} from "./evaluate-set-accessor-declaration"; -import {evaluatePropertyAssignment} from "./evaluate-property-assignment"; -import {evaluateParameterDeclaration} from "./evaluate-parameter-declaration"; -import {evaluateShorthandPropertyAssignment} from "./evaluate-shorthand-property-assignment"; -import {evaluateSpreadAssignment} from "./evaluate-spread-assignment"; -import {evaluateMethodDeclaration} from "./evaluate-method-declaration"; -import {evaluateArrayBindingPattern} from "./evaluate-array-binding-pattern"; -import {evaluateBindingElement} from "./evaluate-binding-element"; -import {evaluateObjectBindingPattern} from "./evaluate-object-binding-pattern"; -import {UnexpectedNodeError} from "../error/unexpected-node-error/unexpected-node-error"; -import {evaluateCaseBlock} from "./evaluate-case-block"; -import {evaluateCaseClause} from "./evaluate-case-clause"; -import {evaluateDefaultClause} from "./evaluate-default-clause"; -import {evaluateVariableDeclaration} from "./evaluate-variable-declaration"; -import {evaluateCatchClause} from "./evaluate-catch-clause"; -import {evaluateOmittedExpression} from "./evaluate-omitted-expression"; -import {evaluatePropertyDeclaration} from "./evaluate-property-declaration"; -import {evaluateDecorator} from "./evaluate-decorator"; -import {evaluateEnumMember} from "./evaluate-enum-member"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {IndexLiteral, Literal} from "../literal/literal.js"; +import {evaluateBindingName} from "./evaluate-binding-name.js"; +import {evaluateGetAccessorDeclaration} from "./evaluate-get-accessor-declaration.js"; +import {evaluateSetAccessorDeclaration} from "./evaluate-set-accessor-declaration.js"; +import {evaluatePropertyAssignment} from "./evaluate-property-assignment.js"; +import {evaluateParameterDeclaration} from "./evaluate-parameter-declaration.js"; +import {evaluateShorthandPropertyAssignment} from "./evaluate-shorthand-property-assignment.js"; +import {evaluateSpreadAssignment} from "./evaluate-spread-assignment.js"; +import {evaluateMethodDeclaration} from "./evaluate-method-declaration.js"; +import {evaluateArrayBindingPattern} from "./evaluate-array-binding-pattern.js"; +import {evaluateBindingElement} from "./evaluate-binding-element.js"; +import {evaluateObjectBindingPattern} from "./evaluate-object-binding-pattern.js"; +import {UnexpectedNodeError} from "../error/unexpected-node-error/unexpected-node-error.js"; +import {evaluateCaseBlock} from "./evaluate-case-block.js"; +import {evaluateCaseClause} from "./evaluate-case-clause.js"; +import {evaluateDefaultClause} from "./evaluate-default-clause.js"; +import {evaluateVariableDeclaration} from "./evaluate-variable-declaration.js"; +import {evaluateCatchClause} from "./evaluate-catch-clause.js"; +import {evaluateOmittedExpression} from "./evaluate-omitted-expression.js"; +import {evaluatePropertyDeclaration} from "./evaluate-property-declaration.js"; +import {evaluateDecorator} from "./evaluate-decorator.js"; +import {evaluateEnumMember} from "./evaluate-enum-member.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates a given node with the provided argument diff --git a/src/interpreter/evaluator/evaluate-node-with-value.ts b/src/interpreter/evaluator/evaluate-node-with-value.ts index 6e0d10b..cfc3b2e 100644 --- a/src/interpreter/evaluator/evaluate-node-with-value.ts +++ b/src/interpreter/evaluator/evaluate-node-with-value.ts @@ -1,8 +1,8 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {Literal} from "../literal/literal"; -import {NodeWithValue} from "./node-evaluator/node-evaluator"; -import {evaluatePropertyName} from "./evaluate-property-name"; -import {UnexpectedNodeError} from "../error/unexpected-node-error/unexpected-node-error"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {Literal} from "../literal/literal.js"; +import {NodeWithValue} from "./node-evaluator/node-evaluator.js"; +import {evaluatePropertyName} from "./evaluate-property-name.js"; +import {UnexpectedNodeError} from "../error/unexpected-node-error/unexpected-node-error.js"; /** * Evaluates a given node with the provided argument diff --git a/src/interpreter/evaluator/evaluate-node.ts b/src/interpreter/evaluator/evaluate-node.ts index fe5136d..eddd6ca 100644 --- a/src/interpreter/evaluator/evaluate-node.ts +++ b/src/interpreter/evaluator/evaluate-node.ts @@ -1,74 +1,75 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {evaluateVariableDeclaration} from "./evaluate-variable-declaration"; -import {evaluateBinaryExpression} from "./evaluate-binary-expression"; -import {evaluateCallExpression} from "./evaluate-call-expression"; -import {evaluateParenthesizedExpression} from "./evaluate-parenthesized-expression"; -import {evaluateArrowFunctionExpression} from "./evaluate-arrow-function-expression"; -import {evaluateStringLiteral} from "./evaluate-string-literal"; -import {evaluateNumericLiteral} from "./evaluate-numeric-literal"; -import {evaluateBooleanLiteral} from "./evaluate-boolean-literal"; -import {evaluateRegularExpressionLiteral} from "./evaluate-regular-expression-literal"; -import {evaluateObjectLiteralExpression} from "./evaluate-object-literal-expression"; -import {evaluateArrayLiteralExpression} from "./evaluate-array-literal-expression"; -import {evaluateIdentifier} from "./evaluate-identifier"; -import {evaluateBlock} from "./evaluate-block"; -import {evaluateReturnStatement} from "./evaluate-return-statement"; -import {evaluateVariableStatement} from "./evaluate-variable-statement"; -import {evaluateVariableDeclarationList} from "./evaluate-variable-declaration-list"; -import {evaluatePrefixUnaryExpression} from "./evaluate-prefix-unary-expression"; -import {evaluatePropertyAccessExpression} from "./evaluate-property-access-expression"; -import {evaluateElementAccessExpression} from "./evaluate-element-access-expression"; -import {evaluateComputedPropertyName} from "./evaluate-computed-property-name"; -import {evaluateFunctionDeclaration} from "./evaluate-function-declaration"; -import {evaluateIfStatement} from "./evaluate-if-statement"; -import {evaluateExpressionStatement} from "./evaluate-expression-statement"; -import {evaluateTemplateExpression} from "./evaluate-template-expression"; -import {evaluateTypeAssertion} from "./evaluate-type-assertion-expression"; -import {evaluatePostfixUnaryExpression} from "./evaluate-postfix-unary-expression"; -import {evaluateNewExpression} from "./evaluate-new-expression"; -import {evaluateNonNullExpression} from "./evaluate-non-null-expression"; -import {evaluateAsExpression} from "./evaluate-as-expression"; -import {evaluateSwitchStatement} from "./evaluate-switch-statement"; -import {evaluateForOfStatement} from "./evaluate-for-of-statement"; -import {UnexpectedNodeError} from "../error/unexpected-node-error/unexpected-node-error"; -import {isBooleanLiteral} from "../util/node/is-boolean-literal"; -import {isThisExpression} from "../util/node/is-this-expression"; -import {evaluateThisExpression} from "./evaluate-this-expression"; -import {evaluateBreakStatement} from "./evaluate-break-statement"; -import {evaluateContinueStatement} from "./evaluate-continue-statement"; -import {evaluateForStatement} from "./evaluate-for-statement"; -import {evaluateWhileStatement} from "./evaluate-while-statement"; -import {evaluateForInStatement} from "./evaluate-for-in-statement"; -import {evaluateFunctionExpression} from "./evaluate-function-expression"; -import {evaluateTryStatement} from "./evaluate-try-statement"; -import {evaluateClassDeclaration} from "./evaluate-class-declaration"; -import {evaluateConstructorDeclaration} from "./evaluate-constructor-declaration"; -import {isSuperExpression} from "../util/node/is-super-expression"; -import {evaluateSuperExpression} from "./evaluate-super-expression"; -import {evaluateSpreadElement} from "./evaluate-spread-element"; -import {evaluateClassExpression} from "./evaluate-class-expression"; -import {isNullLiteral} from "../util/node/is-null-literal"; -import {evaluateNullLiteral} from "./evaluate-null-literal"; -import {evaluateVoidExpression} from "./evaluate-void-expression"; -import {evaluateTypeOfExpression} from "./evaluate-type-of-expression"; -import {evaluateBigIntLiteral} from "./evaluate-big-int-literal"; -import {evaluateEnumDeclaration} from "./evaluate-enum-declaration"; -import {evaluateSourceFileAsNamespaceObject} from "./evaluate-source-file-as-namespace-object"; -import {evaluateModuleDeclaration} from "./evaluate-module-declaration"; -import {evaluateImportDeclaration} from "./evaluate-import-declaration"; -import {evaluateThrowStatement} from "./evaluate-throw-statement"; -import {evaluateImportEqualsDeclaration} from "./evaluate-import-equals-declaration"; -import {evaluateAwaitExpression} from "./evaluate-await-expression"; -import {evaluateConditionalExpression} from "./evaluate-conditional-expression"; -import {evaluateMethodDeclaration} from "./evaluate-method-declaration"; -import {evaluatePropertyDeclaration} from "./evaluate-property-declaration"; -import {evaluateGetAccessorDeclaration} from "./evaluate-get-accessor-declaration"; -import {TS} from "../../type/ts"; -import {evaluateTypeAliasDeclaration} from "./evaluate-type-alias-declaration"; -import {evaluateInterfaceDeclaration} from "./evaluate-interface-declaration"; -import { evaluateImportClause } from "./evaluate-import-clause"; -import { evaluateImportSpecifier } from "./evaluate-import-specifier"; -import { evaluateNamespaceImport } from "./evaluate-namespace-import"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {evaluateVariableDeclaration} from "./evaluate-variable-declaration.js"; +import {evaluateBinaryExpression} from "./evaluate-binary-expression.js"; +import {evaluateCallExpression} from "./evaluate-call-expression.js"; +import {evaluateParenthesizedExpression} from "./evaluate-parenthesized-expression.js"; +import {evaluateArrowFunctionExpression} from "./evaluate-arrow-function-expression.js"; +import {evaluateStringLiteral} from "./evaluate-string-literal.js"; +import {evaluateNumericLiteral} from "./evaluate-numeric-literal.js"; +import {evaluateBooleanLiteral} from "./evaluate-boolean-literal.js"; +import {evaluateRegularExpressionLiteral} from "./evaluate-regular-expression-literal.js"; +import {evaluateObjectLiteralExpression} from "./evaluate-object-literal-expression.js"; +import {evaluateArrayLiteralExpression} from "./evaluate-array-literal-expression.js"; +import {evaluateIdentifier} from "./evaluate-identifier.js"; +import {evaluateBlock} from "./evaluate-block.js"; +import {evaluateReturnStatement} from "./evaluate-return-statement.js"; +import {evaluateVariableStatement} from "./evaluate-variable-statement.js"; +import {evaluateVariableDeclarationList} from "./evaluate-variable-declaration-list.js"; +import {evaluatePrefixUnaryExpression} from "./evaluate-prefix-unary-expression.js"; +import {evaluatePropertyAccessExpression} from "./evaluate-property-access-expression.js"; +import {evaluateElementAccessExpression} from "./evaluate-element-access-expression.js"; +import {evaluateComputedPropertyName} from "./evaluate-computed-property-name.js"; +import {evaluateFunctionDeclaration} from "./evaluate-function-declaration.js"; +import {evaluateIfStatement} from "./evaluate-if-statement.js"; +import {evaluateExpressionStatement} from "./evaluate-expression-statement.js"; +import {evaluateTemplateExpression} from "./evaluate-template-expression.js"; +import {evaluateTypeAssertion} from "./evaluate-type-assertion-expression.js"; +import {evaluatePostfixUnaryExpression} from "./evaluate-postfix-unary-expression.js"; +import {evaluateNewExpression} from "./evaluate-new-expression.js"; +import {evaluateNonNullExpression} from "./evaluate-non-null-expression.js"; +import {evaluateAsExpression} from "./evaluate-as-expression.js"; +import {evaluateSwitchStatement} from "./evaluate-switch-statement.js"; +import {evaluateForOfStatement} from "./evaluate-for-of-statement.js"; +import {UnexpectedNodeError} from "../error/unexpected-node-error/unexpected-node-error.js"; +import {isBooleanLiteral} from "../util/node/is-boolean-literal.js"; +import {isThisExpression} from "../util/node/is-this-expression.js"; +import {evaluateThisExpression} from "./evaluate-this-expression.js"; +import {evaluateBreakStatement} from "./evaluate-break-statement.js"; +import {evaluateContinueStatement} from "./evaluate-continue-statement.js"; +import {evaluateForStatement} from "./evaluate-for-statement.js"; +import {evaluateWhileStatement} from "./evaluate-while-statement.js"; +import {evaluateForInStatement} from "./evaluate-for-in-statement.js"; +import {evaluateFunctionExpression} from "./evaluate-function-expression.js"; +import {evaluateTryStatement} from "./evaluate-try-statement.js"; +import {evaluateClassDeclaration} from "./evaluate-class-declaration.js"; +import {evaluateConstructorDeclaration} from "./evaluate-constructor-declaration.js"; +import {isSuperExpression} from "../util/node/is-super-expression.js"; +import {evaluateSuperExpression} from "./evaluate-super-expression.js"; +import {evaluateSpreadElement} from "./evaluate-spread-element.js"; +import {evaluateClassExpression} from "./evaluate-class-expression.js"; +import {isNullLiteral} from "../util/node/is-null-literal.js"; +import {evaluateNullLiteral} from "./evaluate-null-literal.js"; +import {evaluateVoidExpression} from "./evaluate-void-expression.js"; +import {evaluateTypeOfExpression} from "./evaluate-type-of-expression.js"; +import {evaluateBigIntLiteral} from "./evaluate-big-int-literal.js"; +import {evaluateEnumDeclaration} from "./evaluate-enum-declaration.js"; +import {evaluateSourceFileAsNamespaceObject} from "./evaluate-source-file-as-namespace-object.js"; +import {evaluateModuleDeclaration} from "./evaluate-module-declaration.js"; +import {evaluateImportDeclaration} from "./evaluate-import-declaration.js"; +import {evaluateThrowStatement} from "./evaluate-throw-statement.js"; +import {evaluateImportEqualsDeclaration} from "./evaluate-import-equals-declaration.js"; +import {evaluateAwaitExpression} from "./evaluate-await-expression.js"; +import {evaluateConditionalExpression} from "./evaluate-conditional-expression.js"; +import {evaluateMethodDeclaration} from "./evaluate-method-declaration.js"; +import {evaluatePropertyDeclaration} from "./evaluate-property-declaration.js"; +import {evaluateGetAccessorDeclaration} from "./evaluate-get-accessor-declaration.js"; +import {TS} from "../../type/ts.js"; +import {evaluateTypeAliasDeclaration} from "./evaluate-type-alias-declaration.js"; +import {evaluateInterfaceDeclaration} from "./evaluate-interface-declaration.js"; +import {evaluateImportClause} from "./evaluate-import-clause.js"; +import {evaluateImportSpecifier} from "./evaluate-import-specifier.js"; +import {evaluateNamespaceImport} from "./evaluate-namespace-import.js"; +import { evaluateMetaProperty } from "./evaluate-meta-property.js"; /** * Will get a literal value for the given Node. If it doesn't succeed, the value will be 'undefined' @@ -134,6 +135,8 @@ export function evaluateNode({node, ...rest}: EvaluatorOptions): unknow return evaluateNamespaceImport({node, ...rest}); } else if (rest.typescript.isImportEqualsDeclaration(node)) { return evaluateImportEqualsDeclaration({node, ...rest}); + } else if (rest.typescript.isMetaProperty(node)) { + return evaluateMetaProperty({node, ...rest}); } else if (rest.typescript.isThrowStatement(node)) { return evaluateThrowStatement({node, ...rest}); } else if (rest.typescript.isVariableDeclaration(node)) { diff --git a/src/interpreter/evaluator/evaluate-non-null-expression.ts b/src/interpreter/evaluator/evaluate-non-null-expression.ts index 90336fe..bd70ce2 100644 --- a/src/interpreter/evaluator/evaluate-non-null-expression.ts +++ b/src/interpreter/evaluator/evaluate-non-null-expression.ts @@ -1,6 +1,6 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {Literal} from "../literal/literal"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {Literal} from "../literal/literal.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a NonNullExpression diff --git a/src/interpreter/evaluator/evaluate-null-literal.ts b/src/interpreter/evaluator/evaluate-null-literal.ts index e9fc2a0..d018edf 100644 --- a/src/interpreter/evaluator/evaluate-null-literal.ts +++ b/src/interpreter/evaluator/evaluate-null-literal.ts @@ -1,6 +1,6 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {Literal} from "../literal/literal"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {Literal} from "../literal/literal.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a NullLiteral diff --git a/src/interpreter/evaluator/evaluate-numeric-literal.ts b/src/interpreter/evaluator/evaluate-numeric-literal.ts index 34fe6f3..e6d447b 100644 --- a/src/interpreter/evaluator/evaluate-numeric-literal.ts +++ b/src/interpreter/evaluator/evaluate-numeric-literal.ts @@ -1,6 +1,6 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {Literal} from "../literal/literal"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {Literal} from "../literal/literal.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a NumericLiteral diff --git a/src/interpreter/evaluator/evaluate-object-binding-pattern.ts b/src/interpreter/evaluator/evaluate-object-binding-pattern.ts index e796d9e..6b3973f 100644 --- a/src/interpreter/evaluator/evaluate-object-binding-pattern.ts +++ b/src/interpreter/evaluator/evaluate-object-binding-pattern.ts @@ -1,6 +1,6 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {Literal} from "../literal/literal"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {Literal} from "../literal/literal.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, an ObjectBindingPattern, based on an initializer diff --git a/src/interpreter/evaluator/evaluate-object-literal-expression.ts b/src/interpreter/evaluator/evaluate-object-literal-expression.ts index 22cc426..914a335 100644 --- a/src/interpreter/evaluator/evaluate-object-literal-expression.ts +++ b/src/interpreter/evaluator/evaluate-object-literal-expression.ts @@ -1,8 +1,8 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {IndexLiteral, Literal} from "../literal/literal"; -import {getFromLexicalEnvironment, setInLexicalEnvironment} from "../lexical-environment/lexical-environment"; -import {THIS_SYMBOL} from "../util/this/this-symbol"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {IndexLiteral, Literal} from "../literal/literal.js"; +import {getFromLexicalEnvironment, setInLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import {THIS_SYMBOL} from "../util/this/this-symbol.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a ObjectLiteralExpression diff --git a/src/interpreter/evaluator/evaluate-omitted-expression.ts b/src/interpreter/evaluator/evaluate-omitted-expression.ts index 5a4326d..e21d12e 100644 --- a/src/interpreter/evaluator/evaluate-omitted-expression.ts +++ b/src/interpreter/evaluator/evaluate-omitted-expression.ts @@ -1,5 +1,5 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a OmittedExpression diff --git a/src/interpreter/evaluator/evaluate-parameter-declaration.ts b/src/interpreter/evaluator/evaluate-parameter-declaration.ts index 7e8d9fa..94a8b80 100644 --- a/src/interpreter/evaluator/evaluate-parameter-declaration.ts +++ b/src/interpreter/evaluator/evaluate-parameter-declaration.ts @@ -1,6 +1,6 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {Literal} from "../literal/literal"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {Literal} from "../literal/literal.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a ParameterDeclaration diff --git a/src/interpreter/evaluator/evaluate-parameter-declarations.ts b/src/interpreter/evaluator/evaluate-parameter-declarations.ts index 094452e..442f5e1 100644 --- a/src/interpreter/evaluator/evaluate-parameter-declarations.ts +++ b/src/interpreter/evaluator/evaluate-parameter-declarations.ts @@ -1,8 +1,8 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {IndexLiteral, Literal} from "../literal/literal"; -import {hasModifier} from "../util/modifier/has-modifier"; -import {getFromLexicalEnvironment} from "../lexical-environment/lexical-environment"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {IndexLiteral, Literal} from "../literal/literal.js"; +import {hasModifier} from "../util/modifier/has-modifier.js"; +import {getFromLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a NodeArray of ParameterDeclarations diff --git a/src/interpreter/evaluator/evaluate-parenthesized-expression.ts b/src/interpreter/evaluator/evaluate-parenthesized-expression.ts index 0a59151..1d4793c 100644 --- a/src/interpreter/evaluator/evaluate-parenthesized-expression.ts +++ b/src/interpreter/evaluator/evaluate-parenthesized-expression.ts @@ -1,6 +1,6 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {Literal} from "../literal/literal"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {Literal} from "../literal/literal.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a ParenthesizedExpression diff --git a/src/interpreter/evaluator/evaluate-postfix-unary-expression.ts b/src/interpreter/evaluator/evaluate-postfix-unary-expression.ts index e915220..5ed05cb 100644 --- a/src/interpreter/evaluator/evaluate-postfix-unary-expression.ts +++ b/src/interpreter/evaluator/evaluate-postfix-unary-expression.ts @@ -1,8 +1,8 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {Literal} from "../literal/literal"; -import {getRelevantDictFromLexicalEnvironment} from "../lexical-environment/lexical-environment"; -import {UnexpectedNodeError} from "../error/unexpected-node-error/unexpected-node-error"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {Literal} from "../literal/literal.js"; +import {getRelevantDictFromLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import {UnexpectedNodeError} from "../error/unexpected-node-error/unexpected-node-error.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a PostfixUnaryExpression diff --git a/src/interpreter/evaluator/evaluate-prefix-unary-expression.ts b/src/interpreter/evaluator/evaluate-prefix-unary-expression.ts index 6e81419..289a13d 100644 --- a/src/interpreter/evaluator/evaluate-prefix-unary-expression.ts +++ b/src/interpreter/evaluator/evaluate-prefix-unary-expression.ts @@ -1,8 +1,8 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {getRelevantDictFromLexicalEnvironment} from "../lexical-environment/lexical-environment"; -import {UnexpectedNodeError} from "../error/unexpected-node-error/unexpected-node-error"; -import {Literal} from "../literal/literal"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {getRelevantDictFromLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import {UnexpectedNodeError} from "../error/unexpected-node-error/unexpected-node-error.js"; +import {Literal} from "../literal/literal.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a PrefixUnaryExpression diff --git a/src/interpreter/evaluator/evaluate-property-access-expression.ts b/src/interpreter/evaluator/evaluate-property-access-expression.ts index 67ced4e..975e1e5 100644 --- a/src/interpreter/evaluator/evaluate-property-access-expression.ts +++ b/src/interpreter/evaluator/evaluate-property-access-expression.ts @@ -1,7 +1,7 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {IndexLiteral, LAZY_CALL_FLAG, LazyCall, Literal, LiteralFlagKind} from "../literal/literal"; -import {isBindCallApply} from "../util/function/is-bind-call-apply"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {IndexLiteral, LAZY_CALL_FLAG, LazyCall, Literal, LiteralFlagKind} from "../literal/literal.js"; +import {isBindCallApply} from "../util/function/is-bind-call-apply.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a PropertyAccessExpression diff --git a/src/interpreter/evaluator/evaluate-property-assignment.ts b/src/interpreter/evaluator/evaluate-property-assignment.ts index e5993f0..3b9374e 100644 --- a/src/interpreter/evaluator/evaluate-property-assignment.ts +++ b/src/interpreter/evaluator/evaluate-property-assignment.ts @@ -1,6 +1,6 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {IndexLiteral, IndexLiteralKey} from "../literal/literal"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {IndexLiteral, IndexLiteralKey} from "../literal/literal.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a PropertyAssignment, before applying it on the given parent diff --git a/src/interpreter/evaluator/evaluate-property-declaration.ts b/src/interpreter/evaluator/evaluate-property-declaration.ts index 1c7d390..0e0ec7f 100644 --- a/src/interpreter/evaluator/evaluate-property-declaration.ts +++ b/src/interpreter/evaluator/evaluate-property-declaration.ts @@ -1,7 +1,7 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {IndexLiteral, IndexLiteralKey} from "../literal/literal"; -import {inStaticContext} from "../util/static/in-static-context"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {IndexLiteral, IndexLiteralKey} from "../literal/literal.js"; +import {inStaticContext} from "../util/static/in-static-context.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a PropertyDeclaration, before applying it on the given parent diff --git a/src/interpreter/evaluator/evaluate-property-name.ts b/src/interpreter/evaluator/evaluate-property-name.ts index 7e2344b..5c6f335 100644 --- a/src/interpreter/evaluator/evaluate-property-name.ts +++ b/src/interpreter/evaluator/evaluate-property-name.ts @@ -1,6 +1,6 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {IndexLiteralKey, Literal} from "../literal/literal"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {IndexLiteralKey, Literal} from "../literal/literal.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a PropertyName diff --git a/src/interpreter/evaluator/evaluate-regular-expression-literal.ts b/src/interpreter/evaluator/evaluate-regular-expression-literal.ts index 1459917..5c08030 100644 --- a/src/interpreter/evaluator/evaluate-regular-expression-literal.ts +++ b/src/interpreter/evaluator/evaluate-regular-expression-literal.ts @@ -1,7 +1,7 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {Literal} from "../literal/literal"; -import {getFromLexicalEnvironment} from "../lexical-environment/lexical-environment"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {Literal} from "../literal/literal.js"; +import {getFromLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a RegularExpressionLiteral diff --git a/src/interpreter/evaluator/evaluate-return-statement.ts b/src/interpreter/evaluator/evaluate-return-statement.ts index cefe2c4..64dbcc9 100644 --- a/src/interpreter/evaluator/evaluate-return-statement.ts +++ b/src/interpreter/evaluator/evaluate-return-statement.ts @@ -1,7 +1,7 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {setInLexicalEnvironment} from "../lexical-environment/lexical-environment"; -import {RETURN_SYMBOL} from "../util/return/return-symbol"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {setInLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import {RETURN_SYMBOL} from "../util/return/return-symbol.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a ReturnStatement diff --git a/src/interpreter/evaluator/evaluate-set-accessor-declaration.ts b/src/interpreter/evaluator/evaluate-set-accessor-declaration.ts index 56625b7..9058b2c 100644 --- a/src/interpreter/evaluator/evaluate-set-accessor-declaration.ts +++ b/src/interpreter/evaluator/evaluate-set-accessor-declaration.ts @@ -1,13 +1,13 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {LexicalEnvironment, setInLexicalEnvironment} from "../lexical-environment/lexical-environment"; -import {cloneLexicalEnvironment} from "../lexical-environment/clone-lexical-environment"; -import {IndexLiteral, IndexLiteralKey, Literal} from "../literal/literal"; -import {THIS_SYMBOL} from "../util/this/this-symbol"; -import {RETURN_SYMBOL} from "../util/return/return-symbol"; -import {inStaticContext} from "../util/static/in-static-context"; -import {SUPER_SYMBOL} from "../util/super/super-symbol"; -import {evaluateParameterDeclarations} from "./evaluate-parameter-declarations"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {LexicalEnvironment, setInLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import {cloneLexicalEnvironment} from "../lexical-environment/clone-lexical-environment.js"; +import {IndexLiteral, IndexLiteralKey, Literal} from "../literal/literal.js"; +import {THIS_SYMBOL} from "../util/this/this-symbol.js"; +import {RETURN_SYMBOL} from "../util/return/return-symbol.js"; +import {inStaticContext} from "../util/static/in-static-context.js"; +import {SUPER_SYMBOL} from "../util/super/super-symbol.js"; +import {evaluateParameterDeclarations} from "./evaluate-parameter-declarations.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a SetAccessorDeclaration, before setting it on the given parent @@ -23,7 +23,7 @@ export function evaluateSetAccessorDeclaration(options: EvaluatorOptions, parent: IndexLiteral): void { +export function evaluateShorthandPropertyAssignment( + {evaluate, statementTraversalStack, environment, node}: EvaluatorOptions, + parent: IndexLiteral +): void { const identifier = node.name.text; const initializer = evaluate.expression(node.name, environment, statementTraversalStack); - + parent[identifier] = initializer; } diff --git a/src/interpreter/evaluator/evaluate-source-file-as-namespace-object.ts b/src/interpreter/evaluator/evaluate-source-file-as-namespace-object.ts index 02a7146..3f5f89a 100644 --- a/src/interpreter/evaluator/evaluate-source-file-as-namespace-object.ts +++ b/src/interpreter/evaluator/evaluate-source-file-as-namespace-object.ts @@ -1,7 +1,7 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {IndexLiteral} from "../literal/literal"; -import {getFromLexicalEnvironment} from "../lexical-environment/lexical-environment"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {IndexLiteral} from "../literal/literal.js"; +import {getFromLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a SourceFile as a namespace object diff --git a/src/interpreter/evaluator/evaluate-spread-assignment.ts b/src/interpreter/evaluator/evaluate-spread-assignment.ts index 13fa91a..142307f 100644 --- a/src/interpreter/evaluator/evaluate-spread-assignment.ts +++ b/src/interpreter/evaluator/evaluate-spread-assignment.ts @@ -1,6 +1,6 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {IndexLiteral} from "../literal/literal"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {IndexLiteral} from "../literal/literal.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a SpreadAssignment, before applying it on the given parent diff --git a/src/interpreter/evaluator/evaluate-spread-element.ts b/src/interpreter/evaluator/evaluate-spread-element.ts index b5dddac..cad2fc3 100644 --- a/src/interpreter/evaluator/evaluate-spread-element.ts +++ b/src/interpreter/evaluator/evaluate-spread-element.ts @@ -1,6 +1,6 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {Literal} from "../literal/literal"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {Literal} from "../literal/literal.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a SpreadElement, before applying it on the given parent diff --git a/src/interpreter/evaluator/evaluate-statement.ts b/src/interpreter/evaluator/evaluate-statement.ts index e0d7e17..430d2d2 100644 --- a/src/interpreter/evaluator/evaluate-statement.ts +++ b/src/interpreter/evaluator/evaluate-statement.ts @@ -1,7 +1,7 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {evaluateNode} from "./evaluate-node"; -import {createStatementTraversalStack} from "../stack/traversal-stack/statement-traversal-stack"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {evaluateNode} from "./evaluate-node.js"; +import {createStatementTraversalStack} from "../stack/traversal-stack/statement-traversal-stack.js"; +import {TS} from "../../type/ts.js"; /** * Will get a literal value for the given Statement. If it doesn't succeed, the value will be 'undefined' diff --git a/src/interpreter/evaluator/evaluate-string-literal.ts b/src/interpreter/evaluator/evaluate-string-literal.ts index 4c34c8f..c6361f3 100644 --- a/src/interpreter/evaluator/evaluate-string-literal.ts +++ b/src/interpreter/evaluator/evaluate-string-literal.ts @@ -1,6 +1,6 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {Literal} from "../literal/literal"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {Literal} from "../literal/literal.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a StringLiteralLike diff --git a/src/interpreter/evaluator/evaluate-super-expression.ts b/src/interpreter/evaluator/evaluate-super-expression.ts index 48b11fd..cdceb13 100644 --- a/src/interpreter/evaluator/evaluate-super-expression.ts +++ b/src/interpreter/evaluator/evaluate-super-expression.ts @@ -1,8 +1,8 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {Literal} from "../literal/literal"; -import {getFromLexicalEnvironment} from "../lexical-environment/lexical-environment"; -import {SUPER_SYMBOL} from "../util/super/super-symbol"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {Literal} from "../literal/literal.js"; +import {getFromLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import {SUPER_SYMBOL} from "../util/super/super-symbol.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a SuperExpression diff --git a/src/interpreter/evaluator/evaluate-switch-statement.ts b/src/interpreter/evaluator/evaluate-switch-statement.ts index 8e41d14..e9ef5b2 100644 --- a/src/interpreter/evaluator/evaluate-switch-statement.ts +++ b/src/interpreter/evaluator/evaluate-switch-statement.ts @@ -1,5 +1,5 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a SwitchStatement diff --git a/src/interpreter/evaluator/evaluate-template-expression.ts b/src/interpreter/evaluator/evaluate-template-expression.ts index a4f4c3a..47ebf1b 100644 --- a/src/interpreter/evaluator/evaluate-template-expression.ts +++ b/src/interpreter/evaluator/evaluate-template-expression.ts @@ -1,6 +1,6 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {Literal} from "../literal/literal"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {Literal} from "../literal/literal.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a TemplateExpression diff --git a/src/interpreter/evaluator/evaluate-this-expression.ts b/src/interpreter/evaluator/evaluate-this-expression.ts index c28d8b7..f968c8a 100644 --- a/src/interpreter/evaluator/evaluate-this-expression.ts +++ b/src/interpreter/evaluator/evaluate-this-expression.ts @@ -1,8 +1,8 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {Literal} from "../literal/literal"; -import {getFromLexicalEnvironment} from "../lexical-environment/lexical-environment"; -import {THIS_SYMBOL} from "../util/this/this-symbol"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {Literal} from "../literal/literal.js"; +import {getFromLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import {THIS_SYMBOL} from "../util/this/this-symbol.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a ThisExpression diff --git a/src/interpreter/evaluator/evaluate-throw-statement.ts b/src/interpreter/evaluator/evaluate-throw-statement.ts index f427434..d4e27c5 100644 --- a/src/interpreter/evaluator/evaluate-throw-statement.ts +++ b/src/interpreter/evaluator/evaluate-throw-statement.ts @@ -1,5 +1,5 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a ThrowStatement diff --git a/src/interpreter/evaluator/evaluate-try-statement.ts b/src/interpreter/evaluator/evaluate-try-statement.ts index 5e1b16c..8360955 100644 --- a/src/interpreter/evaluator/evaluate-try-statement.ts +++ b/src/interpreter/evaluator/evaluate-try-statement.ts @@ -1,8 +1,8 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {MissingCatchOrFinallyAfterTryError} from "../error/missing-catch-or-finally-after-try-error/missing-catch-or-finally-after-try-error"; -import {clearBindingFromLexicalEnvironment, setInLexicalEnvironment} from "../lexical-environment/lexical-environment"; -import {TRY_SYMBOL} from "../util/try/try-symbol"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {MissingCatchOrFinallyAfterTryError} from "../error/missing-catch-or-finally-after-try-error/missing-catch-or-finally-after-try-error.js"; +import {clearBindingFromLexicalEnvironment, setInLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import {TRY_SYMBOL} from "../util/try/try-symbol.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a TryStatement diff --git a/src/interpreter/evaluator/evaluate-type-alias-declaration.ts b/src/interpreter/evaluator/evaluate-type-alias-declaration.ts index 1c42c4f..2c4e0c7 100644 --- a/src/interpreter/evaluator/evaluate-type-alias-declaration.ts +++ b/src/interpreter/evaluator/evaluate-type-alias-declaration.ts @@ -1,5 +1,5 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a TypeAliasDeclaration diff --git a/src/interpreter/evaluator/evaluate-type-assertion-expression.ts b/src/interpreter/evaluator/evaluate-type-assertion-expression.ts index 938df1a..32ebfa6 100644 --- a/src/interpreter/evaluator/evaluate-type-assertion-expression.ts +++ b/src/interpreter/evaluator/evaluate-type-assertion-expression.ts @@ -1,6 +1,6 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {Literal} from "../literal/literal"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {Literal} from "../literal/literal.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a TypeAssertion diff --git a/src/interpreter/evaluator/evaluate-type-of-expression.ts b/src/interpreter/evaluator/evaluate-type-of-expression.ts index 5f16135..c2fd02b 100644 --- a/src/interpreter/evaluator/evaluate-type-of-expression.ts +++ b/src/interpreter/evaluator/evaluate-type-of-expression.ts @@ -1,6 +1,6 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {Literal} from "../literal/literal"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {Literal} from "../literal/literal.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a TypeOfExpression diff --git a/src/interpreter/evaluator/evaluate-variable-declaration-list.ts b/src/interpreter/evaluator/evaluate-variable-declaration-list.ts index eed5bbc..faed599 100644 --- a/src/interpreter/evaluator/evaluate-variable-declaration-list.ts +++ b/src/interpreter/evaluator/evaluate-variable-declaration-list.ts @@ -1,5 +1,5 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a VariableDeclarationList diff --git a/src/interpreter/evaluator/evaluate-variable-declaration.ts b/src/interpreter/evaluator/evaluate-variable-declaration.ts index fe9a465..9a00492 100644 --- a/src/interpreter/evaluator/evaluate-variable-declaration.ts +++ b/src/interpreter/evaluator/evaluate-variable-declaration.ts @@ -1,7 +1,7 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {EvaluationError} from "../error/evaluation-error/evaluation-error"; -import {Literal} from "../literal/literal"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {EvaluationError} from "../error/evaluation-error/evaluation-error.js"; +import {Literal} from "../literal/literal.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a VariableDeclaration diff --git a/src/interpreter/evaluator/evaluate-variable-statement.ts b/src/interpreter/evaluator/evaluate-variable-statement.ts index 3f86a27..1e90b7b 100644 --- a/src/interpreter/evaluator/evaluate-variable-statement.ts +++ b/src/interpreter/evaluator/evaluate-variable-statement.ts @@ -1,6 +1,6 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {evaluateVariableDeclarationList} from "./evaluate-variable-declaration-list"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {evaluateVariableDeclarationList} from "./evaluate-variable-declaration-list.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a VariableStatement diff --git a/src/interpreter/evaluator/evaluate-void-expression.ts b/src/interpreter/evaluator/evaluate-void-expression.ts index c90b5a6..5a32b85 100644 --- a/src/interpreter/evaluator/evaluate-void-expression.ts +++ b/src/interpreter/evaluator/evaluate-void-expression.ts @@ -1,6 +1,6 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {Literal} from "../literal/literal"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {Literal} from "../literal/literal.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a VoidExpression diff --git a/src/interpreter/evaluator/evaluate-while-statement.ts b/src/interpreter/evaluator/evaluate-while-statement.ts index f83d268..f1a275a 100644 --- a/src/interpreter/evaluator/evaluate-while-statement.ts +++ b/src/interpreter/evaluator/evaluate-while-statement.ts @@ -1,10 +1,10 @@ -import {EvaluatorOptions} from "./evaluator-options"; -import {cloneLexicalEnvironment} from "../lexical-environment/clone-lexical-environment"; -import {pathInLexicalEnvironmentEquals, setInLexicalEnvironment} from "../lexical-environment/lexical-environment"; -import {BREAK_SYMBOL} from "../util/break/break-symbol"; -import {CONTINUE_SYMBOL} from "../util/continue/continue-symbol"; -import {RETURN_SYMBOL} from "../util/return/return-symbol"; -import {TS} from "../../type/ts"; +import {EvaluatorOptions} from "./evaluator-options.js"; +import {cloneLexicalEnvironment} from "../lexical-environment/clone-lexical-environment.js"; +import {pathInLexicalEnvironmentEquals, setInLexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import {BREAK_SYMBOL} from "../util/break/break-symbol.js"; +import {CONTINUE_SYMBOL} from "../util/continue/continue-symbol.js"; +import {RETURN_SYMBOL} from "../util/return/return-symbol.js"; +import {TS} from "../../type/ts.js"; /** * Evaluates, or attempts to evaluate, a WhileStatement @@ -14,7 +14,7 @@ export function evaluateWhileStatement({node, environment, evaluate, logger, rep while (condition) { // Prepare a lexical environment for the current iteration - const iterationEnvironment = cloneLexicalEnvironment(environment); + const iterationEnvironment = cloneLexicalEnvironment(environment, node); // Define a new binding for a break symbol within the environment setInLexicalEnvironment({env: iterationEnvironment, path: BREAK_SYMBOL, value: false, newBinding: true, reporting, node}); diff --git a/src/interpreter/evaluator/evaluator-options.ts b/src/interpreter/evaluator/evaluator-options.ts index a245f52..c3e1464 100644 --- a/src/interpreter/evaluator/evaluator-options.ts +++ b/src/interpreter/evaluator/evaluator-options.ts @@ -1,11 +1,11 @@ -import {LexicalEnvironment} from "../lexical-environment/lexical-environment"; -import {NodeEvaluator} from "./node-evaluator/node-evaluator"; -import {Logger} from "../logger/logger"; -import {StatementTraversalStack} from "../stack/traversal-stack/statement-traversal-stack"; -import {Stack} from "../stack/stack"; -import {EvaluatePolicySanitized} from "../policy/evaluate-policy"; -import {ReportingOptionsSanitized} from "../reporting/i-reporting-options"; -import {TS} from "../../type/ts"; +import {LexicalEnvironment} from "../lexical-environment/lexical-environment.js"; +import {NodeEvaluator} from "./node-evaluator/node-evaluator.js"; +import {Logger} from "../logger/logger.js"; +import {StatementTraversalStack} from "../stack/traversal-stack/statement-traversal-stack.js"; +import {Stack} from "../stack/stack.js"; +import {EvaluatePolicySanitized} from "../policy/evaluate-policy.js"; +import {ReportingOptionsSanitized} from "../reporting/i-reporting-options.js"; +import {TS} from "../../type/ts.js"; export interface EvaluatorOptions> { node: T; diff --git a/src/interpreter/evaluator/node-evaluator/create-node-evaluator.ts b/src/interpreter/evaluator/node-evaluator/create-node-evaluator.ts index df4d88b..5e9ceb7 100644 --- a/src/interpreter/evaluator/node-evaluator/create-node-evaluator.ts +++ b/src/interpreter/evaluator/node-evaluator/create-node-evaluator.ts @@ -1,18 +1,18 @@ -import {ICreateNodeEvaluatorOptions} from "./i-create-node-evaluator-options"; -import {NodeEvaluator, NodeWithValue} from "./node-evaluator"; -import {MaxOpsExceededError} from "../../error/policy-error/max-ops-exceeded-error/max-ops-exceeded-error"; -import {LexicalEnvironment, pathInLexicalEnvironmentEquals} from "../../lexical-environment/lexical-environment"; -import {evaluateStatement} from "../evaluate-statement"; -import {Literal} from "../../literal/literal"; -import {evaluateExpression} from "../evaluate-expression"; -import {EvaluatorOptions} from "../evaluator-options"; -import {evaluateDeclaration} from "../evaluate-declaration"; -import {evaluateNodeWithArgument} from "../evaluate-node-with-argument"; -import {evaluateNodeWithValue} from "../evaluate-node-with-value"; -import {createStatementTraversalStack, StatementTraversalStack} from "../../stack/traversal-stack/statement-traversal-stack"; -import {reportError} from "../../util/reporting/report-error"; -import {TRY_SYMBOL} from "../../util/try/try-symbol"; -import {TS} from "../../../type/ts"; +import {ICreateNodeEvaluatorOptions} from "./i-create-node-evaluator-options.js"; +import {NodeEvaluator, NodeWithValue} from "./node-evaluator.js"; +import {MaxOpsExceededError} from "../../error/policy-error/max-ops-exceeded-error/max-ops-exceeded-error.js"; +import {LexicalEnvironment, pathInLexicalEnvironmentEquals} from "../../lexical-environment/lexical-environment.js"; +import {evaluateStatement} from "../evaluate-statement.js"; +import {Literal} from "../../literal/literal.js"; +import {evaluateExpression} from "../evaluate-expression.js"; +import {EvaluatorOptions} from "../evaluator-options.js"; +import {evaluateDeclaration} from "../evaluate-declaration.js"; +import {evaluateNodeWithArgument} from "../evaluate-node-with-argument.js"; +import {evaluateNodeWithValue} from "../evaluate-node-with-value.js"; +import {createStatementTraversalStack, StatementTraversalStack} from "../../stack/traversal-stack/statement-traversal-stack.js"; +import {reportError} from "../../util/reporting/report-error.js"; +import {TRY_SYMBOL} from "../../util/try/try-symbol.js"; +import {TS} from "../../../type/ts.js"; /** * Creates a Node Evaluator diff --git a/src/interpreter/evaluator/node-evaluator/i-create-node-evaluator-options.ts b/src/interpreter/evaluator/node-evaluator/i-create-node-evaluator-options.ts index 1cc9c4b..2c2a4ec 100644 --- a/src/interpreter/evaluator/node-evaluator/i-create-node-evaluator-options.ts +++ b/src/interpreter/evaluator/node-evaluator/i-create-node-evaluator-options.ts @@ -1,8 +1,8 @@ -import {Logger} from "../../logger/logger"; -import {Stack} from "../../stack/stack"; -import {EvaluatePolicySanitized} from "../../policy/evaluate-policy"; -import {ReportingOptionsSanitized} from "../../reporting/i-reporting-options"; -import {TS} from "../../../type/ts"; +import {Logger} from "../../logger/logger.js"; +import {Stack} from "../../stack/stack.js"; +import {EvaluatePolicySanitized} from "../../policy/evaluate-policy.js"; +import {ReportingOptionsSanitized} from "../../reporting/i-reporting-options.js"; +import {TS} from "../../../type/ts.js"; export interface ICreateNodeEvaluatorOptions { typeChecker: TS.TypeChecker; diff --git a/src/interpreter/evaluator/node-evaluator/node-evaluator.ts b/src/interpreter/evaluator/node-evaluator/node-evaluator.ts index 87e0756..3ccb232 100644 --- a/src/interpreter/evaluator/node-evaluator/node-evaluator.ts +++ b/src/interpreter/evaluator/node-evaluator/node-evaluator.ts @@ -1,7 +1,7 @@ -import {LexicalEnvironment} from "../../lexical-environment/lexical-environment"; -import {Literal} from "../../literal/literal"; -import {StatementTraversalStack} from "../../stack/traversal-stack/statement-traversal-stack"; -import {TS} from "../../../type/ts"; +import {LexicalEnvironment} from "../../lexical-environment/lexical-environment.js"; +import {Literal} from "../../literal/literal.js"; +import {StatementTraversalStack} from "../../stack/traversal-stack/statement-traversal-stack.js"; +import {TS} from "../../../type/ts.js"; export type NodeWithValue = TS.PropertyName; diff --git a/src/interpreter/evaluator/simple/evaluate-simple-literal-result.ts b/src/interpreter/evaluator/simple/evaluate-simple-literal-result.ts index 6b4425f..dd2488e 100644 --- a/src/interpreter/evaluator/simple/evaluate-simple-literal-result.ts +++ b/src/interpreter/evaluator/simple/evaluate-simple-literal-result.ts @@ -1,4 +1,4 @@ -import {Literal} from "../../literal/literal"; +import {Literal} from "../../literal/literal.js"; export interface IEvaluateSimpleLiteralResultBase { success: boolean; diff --git a/src/interpreter/evaluator/simple/evaluate-simple-literal.ts b/src/interpreter/evaluator/simple/evaluate-simple-literal.ts index 19996ae..37155a8 100644 --- a/src/interpreter/evaluator/simple/evaluate-simple-literal.ts +++ b/src/interpreter/evaluator/simple/evaluate-simple-literal.ts @@ -1,7 +1,7 @@ -import {EvaluateSimpleLiteralResult} from "./evaluate-simple-literal-result"; -import {isBooleanLiteral} from "../../util/node/is-boolean-literal"; -import {isNullLiteral} from "../../util/node/is-null-literal"; -import {TS} from "../../../type/ts"; +import {EvaluateSimpleLiteralResult} from "./evaluate-simple-literal-result.js"; +import {isBooleanLiteral} from "../../util/node/is-boolean-literal.js"; +import {isNullLiteral} from "../../util/node/is-null-literal.js"; +import {TS} from "../../../type/ts.js"; /** * This is a tiny function that avoids the costs of building up an evaluation environment diff --git a/src/interpreter/lexical-environment/clone-lexical-environment.ts b/src/interpreter/lexical-environment/clone-lexical-environment.ts index 08ac82c..cc21959 100644 --- a/src/interpreter/lexical-environment/clone-lexical-environment.ts +++ b/src/interpreter/lexical-environment/clone-lexical-environment.ts @@ -1,11 +1,13 @@ -import {LexicalEnvironment} from "./lexical-environment"; +import { TS } from "../../type/ts.js"; +import {LexicalEnvironment} from "./lexical-environment.js"; /** * Clones the given LexicalEnvironment */ -export function cloneLexicalEnvironment(environment: LexicalEnvironment): LexicalEnvironment { +export function cloneLexicalEnvironment(environment: LexicalEnvironment, startingNode: TS.Node): LexicalEnvironment { return { parentEnv: environment, + startingNode, env: {} }; } diff --git a/src/interpreter/lexical-environment/get-dot-path-from-node.ts b/src/interpreter/lexical-environment/get-dot-path-from-node.ts index a151620..7f6e880 100644 --- a/src/interpreter/lexical-environment/get-dot-path-from-node.ts +++ b/src/interpreter/lexical-environment/get-dot-path-from-node.ts @@ -1,9 +1,9 @@ -import {isThisExpression} from "../util/node/is-this-expression"; -import {THIS_SYMBOL} from "../util/this/this-symbol"; -import {isSuperExpression} from "../util/node/is-super-expression"; -import {SUPER_SYMBOL} from "../util/super/super-symbol"; -import {EvaluatorOptions} from "../evaluator/evaluator-options"; -import {TS} from "../../type/ts"; +import {isThisExpression} from "../util/node/is-this-expression.js"; +import {THIS_SYMBOL} from "../util/this/this-symbol.js"; +import {isSuperExpression} from "../util/node/is-super-expression.js"; +import {SUPER_SYMBOL} from "../util/super/super-symbol.js"; +import {EvaluatorOptions} from "../evaluator/evaluator-options.js"; +import {TS} from "../../type/ts.js"; /** * Gets the path to "dot" into an object with based on the node. For example, if the node is a simple identifier, say, 'foo', the dot path is simply "foo". @@ -45,3 +45,5 @@ export function getDotPathFromNode(options: EvaluatorOptions< return undefined; } + + diff --git a/src/interpreter/lexical-environment/i-create-lexical-environment-options.ts b/src/interpreter/lexical-environment/i-create-lexical-environment-options.ts index 6261cfe..d55566e 100644 --- a/src/interpreter/lexical-environment/i-create-lexical-environment-options.ts +++ b/src/interpreter/lexical-environment/i-create-lexical-environment-options.ts @@ -1,6 +1,6 @@ -import {IEnvironment} from "../environment/i-environment"; -import {EvaluatePolicySanitized} from "../policy/evaluate-policy"; -import {TS} from "../../type/ts"; +import {IEnvironment} from "../environment/i-environment.js"; +import {EvaluatePolicySanitized} from "../policy/evaluate-policy.js"; +import {TS} from "../../type/ts.js"; export interface ICreateLexicalEnvironmentOptions { inputEnvironment: IEnvironment; diff --git a/src/interpreter/lexical-environment/i-set-in-lexical-environment-options.ts b/src/interpreter/lexical-environment/i-set-in-lexical-environment-options.ts index 2b5ecf5..7c9c1af 100644 --- a/src/interpreter/lexical-environment/i-set-in-lexical-environment-options.ts +++ b/src/interpreter/lexical-environment/i-set-in-lexical-environment-options.ts @@ -1,7 +1,7 @@ -import {Literal} from "../literal/literal"; -import {LexicalEnvironment} from "./lexical-environment"; -import {ReportingOptionsSanitized} from "../reporting/i-reporting-options"; -import {TS} from "../../type/ts"; +import {Literal} from "../literal/literal.js"; +import {LexicalEnvironment} from "./lexical-environment.js"; +import {ReportingOptionsSanitized} from "../reporting/i-reporting-options.js"; +import {TS} from "../../type/ts.js"; export interface ISetInLexicalEnvironmentOptions { env: LexicalEnvironment; diff --git a/src/interpreter/lexical-environment/lexical-environment.ts b/src/interpreter/lexical-environment/lexical-environment.ts index 8925d07..7a928ae 100644 --- a/src/interpreter/lexical-environment/lexical-environment.ts +++ b/src/interpreter/lexical-environment/lexical-environment.ts @@ -1,36 +1,35 @@ -import {IndexLiteral, Literal, LiteralMatch} from "../literal/literal"; -import {del, get, has, set} from "object-path"; -import {createSanitizedEnvironment} from "../environment/create-sanitized-environment"; -import {ECMA_GLOBALS} from "../environment/ecma/ecma-globals"; -import {NODE_GLOBALS} from "../environment/node/node-globals"; -import {EnvironmentPresetKind} from "../environment/environment-preset-kind"; -import {BROWSER_GLOBALS} from "../environment/browser/browser-globals"; -import {mergeDescriptors} from "../util/descriptor/merge-descriptors"; -import {ISetInLexicalEnvironmentOptions} from "./i-set-in-lexical-environment-options"; -import {RETURN_SYMBOL} from "../util/return/return-symbol"; -import {BREAK_SYMBOL} from "../util/break/break-symbol"; -import {CONTINUE_SYMBOL} from "../util/continue/continue-symbol"; -import {THIS_SYMBOL} from "../util/this/this-symbol"; -import {SUPER_SYMBOL} from "../util/super/super-symbol"; -import {ICreateLexicalEnvironmentOptions} from "./i-create-lexical-environment-options"; -import {TS} from "../../type/ts"; +import {IndexLiteral, Literal, LiteralMatch} from "../literal/literal.js"; +import objectPath from "object-path"; +import {createSanitizedEnvironment} from "../environment/create-sanitized-environment.js"; +import {ECMA_GLOBALS} from "../environment/ecma/ecma-globals.js"; +import {NODE_CJS_GLOBALS} from "../environment/node/node-cjs-globals.js"; +import {EnvironmentPresetKind} from "../environment/environment-preset-kind.js"; +import {BROWSER_GLOBALS} from "../environment/browser/browser-globals.js"; +import {mergeDescriptors} from "../util/descriptor/merge-descriptors.js"; +import {ISetInLexicalEnvironmentOptions} from "./i-set-in-lexical-environment-options.js"; +import {RETURN_SYMBOL} from "../util/return/return-symbol.js"; +import {BREAK_SYMBOL} from "../util/break/break-symbol.js"; +import {CONTINUE_SYMBOL} from "../util/continue/continue-symbol.js"; +import {THIS_SYMBOL} from "../util/this/this-symbol.js"; +import {SUPER_SYMBOL} from "../util/super/super-symbol.js"; +import {ICreateLexicalEnvironmentOptions} from "./i-create-lexical-environment-options.js"; +import {TS} from "../../type/ts.js"; +import {NODE_ESM_GLOBALS} from "../environment/node/node-esm-globals.js"; +import {getStatementContext} from "../util/node/find-nearest-parent-node-of-kind.js"; export interface LexicalEnvironment { parentEnv: LexicalEnvironment | undefined; env: IndexLiteral; + startingNode: TS.Node; preset?: EnvironmentPresetKind; } /** * Gets a value from a Lexical Environment - * - * @param env - * @param path - * @returns */ export function getRelevantDictFromLexicalEnvironment(env: LexicalEnvironment, path: string): LexicalEnvironment["env"] | undefined { const [firstBinding] = path.split("."); - if (has(env.env, firstBinding)) return env.env; + if (objectPath.has(env.env, firstBinding)) return env.env; if (env.parentEnv != null) return getRelevantDictFromLexicalEnvironment(env.parentEnv, path); return undefined; } @@ -44,19 +43,48 @@ export function getPresetForLexicalEnvironment(env: LexicalEnvironment): Environ else return "NONE"; } +/** + * Gets a value from a Lexical Environment + */ +export function findLexicalEnvironmentUp(from: LexicalEnvironment, path: string): LexicalEnvironment | undefined { + const [firstBinding] = path.split("."); + if (objectPath.has(from.env, firstBinding)) return from; + if (from.parentEnv != null) return findLexicalEnvironmentUp(from.parentEnv, path); + return undefined; +} + +export function findLexicalEnvironmentInSameContext(from: LexicalEnvironment, node: TS.Node, typescript: typeof TS): LexicalEnvironment | undefined { + const startingNodeContext = getStatementContext(from.startingNode, typescript); + const nodeContext = getStatementContext(node, typescript); + + if (startingNodeContext?.pos === nodeContext?.pos) { + return from; + } + + if (from.parentEnv == null) { + return undefined; + } + + return findLexicalEnvironmentInSameContext(from.parentEnv, node, typescript); +} + /** * Gets a value from a Lexical Environment */ export function getFromLexicalEnvironment(node: TS.Node | undefined, env: LexicalEnvironment, path: string): LiteralMatch | undefined { const [firstBinding] = path.split("."); - if (has(env.env, firstBinding)) { - const literal = get(env.env, path); + if (objectPath.has(env.env, firstBinding)) { + const literal = objectPath.get(env.env, path); switch (path) { // If we're in a Node environment, the "__dirname" and "__filename" meta-properties should report the current directory or file of the SourceFile and not the parent process case "__dirname": case "__filename": { const preset = getPresetForLexicalEnvironment(env); - return preset === "NODE" && typeof literal === "function" && node != null ? {literal: literal(node.getSourceFile().fileName)} : {literal}; + return (preset === "NODE" || preset === "NODE_CJS") && typeof literal === "function" && node != null ? {literal: literal(node.getSourceFile().fileName)} : {literal}; + } + case "import.meta": { + const preset = getPresetForLexicalEnvironment(env); + return (preset === "NODE_ESM" || preset === "BROWSER" || preset === "ECMA") && typeof literal === "object" && literal != null && typeof literal.url === "function" && node != null ? {literal: {url: literal.url(node.getSourceFile().fileName)}} : {literal}; } default: return {literal}; @@ -70,9 +98,9 @@ export function getFromLexicalEnvironment(node: TS.Node | undefined, env: Lexica /** * Returns true if a path maps to an identifier that has been declared within the Lexical Environment */ - export function hasInLexicalEnvironment(node: TS.Node | undefined, env: LexicalEnvironment, path: string): boolean { +export function hasInLexicalEnvironment(node: TS.Node | undefined, env: LexicalEnvironment, path: string): boolean { const [firstBinding] = path.split("."); - if (has(env.env, firstBinding)) { + if (objectPath.has(env.env, firstBinding)) { return true; } @@ -94,9 +122,6 @@ export function pathInLexicalEnvironmentEquals(node: TS.Node, env: LexicalEnviro /** * Returns true if the given value represents an internal symbol - * - * @param value - * @return */ export function isInternalSymbol(value: Literal): boolean { switch (value) { @@ -116,12 +141,13 @@ export function isInternalSymbol(value: Literal): boolean { */ export function setInLexicalEnvironment({env, path, value, reporting, node, newBinding = false}: ISetInLexicalEnvironmentOptions): void { const [firstBinding] = path.split("."); - if (has(env.env, firstBinding) || newBinding || env.parentEnv == null) { + + if (objectPath.has(env.env, firstBinding) || newBinding || env.parentEnv == null) { // If the value didn't change, do no more - if (has(env.env, path) && get(env.env, path) === value) return; + if (objectPath.has(env.env, path) && objectPath.get(env.env, path) === value) return; // Otherwise, mutate it - set(env.env, path, value); + objectPath.set(env.env, path, value); // Inform reporting hooks if any is given if (reporting.reportBindings != null && !isInternalSymbol(path)) { @@ -130,12 +156,12 @@ export function setInLexicalEnvironment({env, path, value, reporting, node, newB } else { let currentParentEnv: LexicalEnvironment | undefined = env.parentEnv; while (currentParentEnv != null) { - if (has(currentParentEnv.env, firstBinding)) { + if (objectPath.has(currentParentEnv.env, firstBinding)) { // If the value didn't change, do no more - if (has(currentParentEnv.env, path) && get(currentParentEnv.env, path) === value) return; + if (objectPath.has(currentParentEnv.env, path) && objectPath.get(currentParentEnv.env, path) === value) return; // Otherwise, mutate it - set(currentParentEnv.env, path, value); + objectPath.set(currentParentEnv.env, path, value); // Inform reporting hooks if any is given if (reporting.reportBindings != null && !isInternalSymbol(path)) { @@ -143,7 +169,17 @@ export function setInLexicalEnvironment({env, path, value, reporting, node, newB } return; } else { - currentParentEnv = currentParentEnv.parentEnv; + if (currentParentEnv.parentEnv == null) { + // Otherwise, mutate it + objectPath.set(currentParentEnv.env, path, value); + + // Inform reporting hooks if any is given + if (reporting.reportBindings != null && !isInternalSymbol(path)) { + reporting.reportBindings({path, value, node}); + } + } else { + currentParentEnv = currentParentEnv.parentEnv; + } } } } @@ -154,13 +190,13 @@ export function setInLexicalEnvironment({env, path, value, reporting, node, newB */ export function clearBindingFromLexicalEnvironment(env: LexicalEnvironment, path: string): void { const [firstBinding] = path.split("."); - if (has(env.env, firstBinding)) { - del(env.env, path); + if (objectPath.has(env.env, firstBinding)) { + objectPath.del(env.env, path); } else { let currentParentEnv: LexicalEnvironment | undefined = env.parentEnv; while (currentParentEnv != null) { - if (has(currentParentEnv.env, firstBinding)) { - del(currentParentEnv.env, path); + if (objectPath.has(currentParentEnv.env, firstBinding)) { + objectPath.del(currentParentEnv.env, path); return; } else { currentParentEnv = currentParentEnv.parentEnv; @@ -169,6 +205,20 @@ export function clearBindingFromLexicalEnvironment(env: LexicalEnvironment, path } } +export function simplifyEnvironment(environment: LexicalEnvironment, typescript: typeof TS): Record { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const {arguments: _arguments, ...rest} = environment.env; + + const strippedEnv = Object.fromEntries(Object.entries(rest).filter(([key]) => !(key in globalThis))); + + return { + ...(environment.preset == null ? {} : {preset: environment.preset}), + parentEnv: environment.parentEnv == null ? undefined : simplifyEnvironment(environment.parentEnv, typescript), + env: environment.preset != null ? strippedEnv : rest, + startingNode: typescript.SyntaxKind[environment.startingNode.kind] + }; +} + /** * Creates a Lexical Environment */ @@ -185,7 +235,12 @@ export function createLexicalEnvironment({inputEnvironment: {extra, preset}, pol break; case "NODE": - envInput = mergeDescriptors(NODE_GLOBALS(), extra); + case "NODE_CJS": + envInput = mergeDescriptors(NODE_CJS_GLOBALS(), extra); + break; + + case "NODE_ESM": + envInput = mergeDescriptors(NODE_ESM_GLOBALS(), extra); break; case "BROWSER": @@ -200,6 +255,7 @@ export function createLexicalEnvironment({inputEnvironment: {extra, preset}, pol return { preset, parentEnv: undefined, + startingNode: getCurrentNode(), env: createSanitizedEnvironment({ policy, env: envInput, diff --git a/src/interpreter/logger/logger.ts b/src/interpreter/logger/logger.ts index 0825d2c..290647a 100644 --- a/src/interpreter/logger/logger.ts +++ b/src/interpreter/logger/logger.ts @@ -1,12 +1,12 @@ -import {LogLevelKind} from "./log-level"; -import {stringifySyntaxKind} from "../util/syntax-kind/stringify-syntax-kind"; -import {Literal, stringifyLiteral} from "../literal/literal"; -import {Stack} from "../stack/stack"; -import {StatementTraversalStack} from "../stack/traversal-stack/statement-traversal-stack"; +import {LogLevelKind} from "./log-level.js"; +import {stringifySyntaxKind} from "../util/syntax-kind/stringify-syntax-kind.js"; +import {Literal, stringifyLiteral} from "../literal/literal.js"; +import {Stack} from "../stack/stack.js"; +import {StatementTraversalStack} from "../stack/traversal-stack/statement-traversal-stack.js"; import {inspect} from "util"; -import {TS} from "../../type/ts"; +import {TS} from "../../type/ts.js"; import {PartialDeep} from "helpertypes"; -import {loadChalk} from "../util/loader/optional-peer-dependency-loader"; +import color from "ansi-colors"; export type LoggerColor = "white" | "cyan" | "yellow" | "magenta" | "gray" | "red"; @@ -184,8 +184,7 @@ export class Logger { return inspect(value, {depth: 0, colors: true, compact: true, maxArrayLength: 5}); } - private formatWithColor(color: LoggerColor, message: string): string { - const chalk = loadChalk(false); - return chalk != null ? chalk[color](message) : message; + private formatWithColor(loggerColor: LoggerColor, message: string): string { + return color[loggerColor](message); } } diff --git a/src/interpreter/policy/console/console-map.ts b/src/interpreter/policy/console/console-map.ts index b33843b..43ce7e6 100644 --- a/src/interpreter/policy/console/console-map.ts +++ b/src/interpreter/policy/console/console-map.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import {PolicyTrapKind} from "../policy-trap-kind"; -import {TrapConditionMap} from "../trap-condition-map"; -import {NodeBuiltInsAndGlobals} from "../../environment/node/node-built-ins-and-globals"; +import {PolicyTrapKind} from "../policy-trap-kind.js"; +import {TrapConditionMap} from "../trap-condition-map.js"; +import {NodeBuiltInsAndGlobals} from "../../environment/node/node-built-ins-and-globals.js"; /** * A Map between built-in modules (as well as 'console' and the operations that print to console @@ -10,6 +10,5 @@ export const CONSOLE_MAP: TrapConditionMap = { "node:console": "console", console: { [PolicyTrapKind.APPLY]: true - }, - + } }; diff --git a/src/interpreter/policy/console/is-console-operation.ts b/src/interpreter/policy/console/is-console-operation.ts index d9cc4a7..1689bb2 100644 --- a/src/interpreter/policy/console/is-console-operation.ts +++ b/src/interpreter/policy/console/is-console-operation.ts @@ -1,7 +1,7 @@ -import {PolicyProxyHookOptions} from "../../proxy/policy-proxy-hook"; -import {isTrapConditionMet} from "../is-trap-condition-met"; -import {CONSOLE_MAP} from "./console-map"; -import {NodeBuiltInsAndGlobals} from "../../environment/node/node-built-ins-and-globals"; +import {PolicyProxyHookOptions} from "../../proxy/policy-proxy-hook.js"; +import {isTrapConditionMet} from "../is-trap-condition-met.js"; +import {CONSOLE_MAP} from "./console-map.js"; +import {NodeBuiltInsAndGlobals} from "../../environment/node/node-built-ins-and-globals.js"; /** * Returns true if the given item represents an operation that prints to console diff --git a/src/interpreter/policy/io/io-map.ts b/src/interpreter/policy/io/io-map.ts index 6277341..f8e0e4a 100644 --- a/src/interpreter/policy/io/io-map.ts +++ b/src/interpreter/policy/io/io-map.ts @@ -1,8 +1,8 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import {TrapConditionMap} from "../trap-condition-map"; -import {PolicyTrapKind} from "../policy-trap-kind"; -import {EvaluateIOPolicy} from "../evaluate-policy"; -import {NodeBuiltInsAndGlobals} from "../../environment/node/node-built-ins-and-globals"; +import {TrapConditionMap} from "../trap-condition-map.js"; +import {PolicyTrapKind} from "../policy-trap-kind.js"; +import {EvaluateIOPolicy} from "../evaluate-policy.js"; +import {NodeBuiltInsAndGlobals} from "../../environment/node/node-built-ins-and-globals.js"; /** * A Map between built-in modules and the kind of IO operations their members performs diff --git a/src/interpreter/policy/io/is-io-read.ts b/src/interpreter/policy/io/is-io-read.ts index 5479b48..975c32d 100644 --- a/src/interpreter/policy/io/is-io-read.ts +++ b/src/interpreter/policy/io/is-io-read.ts @@ -1,7 +1,7 @@ -import {IO_MAP} from "./io-map"; -import {isTrapConditionMet} from "../is-trap-condition-met"; -import {PolicyProxyHookOptions} from "../../proxy/policy-proxy-hook"; -import {NodeBuiltInsAndGlobals} from "../../environment/node/node-built-ins-and-globals"; +import {IO_MAP} from "./io-map.js"; +import {isTrapConditionMet} from "../is-trap-condition-met.js"; +import {PolicyProxyHookOptions} from "../../proxy/policy-proxy-hook.js"; +import {NodeBuiltInsAndGlobals} from "../../environment/node/node-built-ins-and-globals.js"; /** * Returns true if the given member represents a READ operation from IO diff --git a/src/interpreter/policy/io/is-io-write.ts b/src/interpreter/policy/io/is-io-write.ts index 0a5bac5..b80c66e 100644 --- a/src/interpreter/policy/io/is-io-write.ts +++ b/src/interpreter/policy/io/is-io-write.ts @@ -1,7 +1,7 @@ -import {PolicyProxyHookOptions} from "../../proxy/policy-proxy-hook"; -import {isTrapConditionMet} from "../is-trap-condition-met"; -import {IO_MAP} from "./io-map"; -import {NodeBuiltInsAndGlobals} from "../../environment/node/node-built-ins-and-globals"; +import {PolicyProxyHookOptions} from "../../proxy/policy-proxy-hook.js"; +import {isTrapConditionMet} from "../is-trap-condition-met.js"; +import {IO_MAP} from "./io-map.js"; +import {NodeBuiltInsAndGlobals} from "../../environment/node/node-built-ins-and-globals.js"; /** * Returns true if the given member represents a WRITE operation from IO diff --git a/src/interpreter/policy/is-trap-condition-met.ts b/src/interpreter/policy/is-trap-condition-met.ts index 44e39af..ed049e3 100644 --- a/src/interpreter/policy/is-trap-condition-met.ts +++ b/src/interpreter/policy/is-trap-condition-met.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/ban-types */ -import {isTrapCondition, isTrapConditionFunction, PolicyTrapKindToTrapConditionMap, TrapCondition, TrapConditionMap, TrapConditionMemberMap} from "./trap-condition-map"; -import {IPolicyProxyApplyHookOptions, IPolicyProxyConstructHookOptions, PolicyProxyHookOptions} from "../proxy/policy-proxy-hook"; +import {isTrapCondition, isTrapConditionFunction, PolicyTrapKindToTrapConditionMap, TrapCondition, TrapConditionMap, TrapConditionMemberMap} from "./trap-condition-map.js"; +import {IPolicyProxyApplyHookOptions, IPolicyProxyConstructHookOptions, PolicyProxyHookOptions} from "../proxy/policy-proxy-hook.js"; /** * Returns true if the given path represents something that is nondeterministic. diff --git a/src/interpreter/policy/network/is-network-operation.ts b/src/interpreter/policy/network/is-network-operation.ts index 77a4597..929ba4c 100644 --- a/src/interpreter/policy/network/is-network-operation.ts +++ b/src/interpreter/policy/network/is-network-operation.ts @@ -1,7 +1,7 @@ -import {PolicyProxyHookOptions} from "../../proxy/policy-proxy-hook"; -import {isTrapConditionMet} from "../is-trap-condition-met"; -import {NETWORK_MAP} from "./network-map"; -import {NodeBuiltInsAndGlobals} from "../../environment/node/node-built-ins-and-globals"; +import {PolicyProxyHookOptions} from "../../proxy/policy-proxy-hook.js"; +import {isTrapConditionMet} from "../is-trap-condition-met.js"; +import {NETWORK_MAP} from "./network-map.js"; +import {NodeBuiltInsAndGlobals} from "../../environment/node/node-built-ins-and-globals.js"; /** * Returns true if the given item represents a network operation diff --git a/src/interpreter/policy/network/network-map.ts b/src/interpreter/policy/network/network-map.ts index 2313a35..4182804 100644 --- a/src/interpreter/policy/network/network-map.ts +++ b/src/interpreter/policy/network/network-map.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import {PolicyTrapKind} from "../policy-trap-kind"; -import {TrapConditionMap} from "../trap-condition-map"; -import {NodeBuiltInsAndGlobals} from "../../environment/node/node-built-ins-and-globals"; +import {PolicyTrapKind} from "../policy-trap-kind.js"; +import {TrapConditionMap} from "../trap-condition-map.js"; +import {NodeBuiltInsAndGlobals} from "../../environment/node/node-built-ins-and-globals.js"; /** * A Map between built-in modules and the kind of IO operations their members performs diff --git a/src/interpreter/policy/nondeterministic/is-nondeterministic.ts b/src/interpreter/policy/nondeterministic/is-nondeterministic.ts index 4973037..f0da13f 100644 --- a/src/interpreter/policy/nondeterministic/is-nondeterministic.ts +++ b/src/interpreter/policy/nondeterministic/is-nondeterministic.ts @@ -1,7 +1,7 @@ -import {PolicyProxyHookOptions} from "../../proxy/policy-proxy-hook"; -import {NONDETERMINISTIC_MAP} from "./nondeterministic-map"; -import {isTrapConditionMet} from "../is-trap-condition-met"; -import {NodeBuiltInsAndGlobals} from "../../environment/node/node-built-ins-and-globals"; +import {PolicyProxyHookOptions} from "../../proxy/policy-proxy-hook.js"; +import {NONDETERMINISTIC_MAP} from "./nondeterministic-map.js"; +import {isTrapConditionMet} from "../is-trap-condition-met.js"; +import {NodeBuiltInsAndGlobals} from "../../environment/node/node-built-ins-and-globals.js"; /** * Returns true if the given path represents something that is nondeterministic. diff --git a/src/interpreter/policy/nondeterministic/nondeterministic-map.ts b/src/interpreter/policy/nondeterministic/nondeterministic-map.ts index be48d4f..e48c837 100644 --- a/src/interpreter/policy/nondeterministic/nondeterministic-map.ts +++ b/src/interpreter/policy/nondeterministic/nondeterministic-map.ts @@ -1,8 +1,8 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import {PolicyTrapKind} from "../policy-trap-kind"; -import {TrapConditionMap} from "../trap-condition-map"; -import {NETWORK_MAP} from "../network/network-map"; -import {NodeBuiltInsAndGlobals} from "../../environment/node/node-built-ins-and-globals"; +import {PolicyTrapKind} from "../policy-trap-kind.js"; +import {TrapConditionMap} from "../trap-condition-map.js"; +import {NETWORK_MAP} from "../network/network-map.js"; +import {NodeBuiltInsAndGlobals} from "../../environment/node/node-built-ins-and-globals.js"; /** * A Map between built-in identifiers and the members that produce non-deterministic results. diff --git a/src/interpreter/policy/process/is-process-exit-operation.ts b/src/interpreter/policy/process/is-process-exit-operation.ts index 963209c..ea8b90d 100644 --- a/src/interpreter/policy/process/is-process-exit-operation.ts +++ b/src/interpreter/policy/process/is-process-exit-operation.ts @@ -1,7 +1,7 @@ -import {PolicyProxyHookOptions} from "../../proxy/policy-proxy-hook"; -import {isTrapConditionMet} from "../is-trap-condition-met"; -import {PROCESS_MAP} from "./process-map"; -import {NodeBuiltInsAndGlobals} from "../../environment/node/node-built-ins-and-globals"; +import {PolicyProxyHookOptions} from "../../proxy/policy-proxy-hook.js"; +import {isTrapConditionMet} from "../is-trap-condition-met.js"; +import {PROCESS_MAP} from "./process-map.js"; +import {NodeBuiltInsAndGlobals} from "../../environment/node/node-built-ins-and-globals.js"; /** * Returns true if the given item represents a process operation that exits the process diff --git a/src/interpreter/policy/process/is-process-spawn-child-operation.ts b/src/interpreter/policy/process/is-process-spawn-child-operation.ts index f11c9c6..603f7a1 100644 --- a/src/interpreter/policy/process/is-process-spawn-child-operation.ts +++ b/src/interpreter/policy/process/is-process-spawn-child-operation.ts @@ -1,7 +1,7 @@ -import {PolicyProxyHookOptions} from "../../proxy/policy-proxy-hook"; -import {isTrapConditionMet} from "../is-trap-condition-met"; -import {PROCESS_MAP} from "./process-map"; -import {NodeBuiltInsAndGlobals} from "../../environment/node/node-built-ins-and-globals"; +import {PolicyProxyHookOptions} from "../../proxy/policy-proxy-hook.js"; +import {isTrapConditionMet} from "../is-trap-condition-met.js"; +import {PROCESS_MAP} from "./process-map.js"; +import {NodeBuiltInsAndGlobals} from "../../environment/node/node-built-ins-and-globals.js"; /** * Returns true if the given item represents a process operation that spawns a child diff --git a/src/interpreter/policy/process/process-map.ts b/src/interpreter/policy/process/process-map.ts index b106270..eaa1107 100644 --- a/src/interpreter/policy/process/process-map.ts +++ b/src/interpreter/policy/process/process-map.ts @@ -1,8 +1,8 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import {PolicyTrapKind} from "../policy-trap-kind"; -import {TrapConditionMap} from "../trap-condition-map"; -import {EvaluateProcessPolicy} from "../evaluate-policy"; -import {NodeBuiltInsAndGlobals} from "../../environment/node/node-built-ins-and-globals"; +import {PolicyTrapKind} from "../policy-trap-kind.js"; +import {TrapConditionMap} from "../trap-condition-map.js"; +import {EvaluateProcessPolicy} from "../evaluate-policy.js"; +import {NodeBuiltInsAndGlobals} from "../../environment/node/node-built-ins-and-globals.js"; /** * A Map between built-in modules (as well as 'process' and the kind of IO operations their members performs @@ -14,17 +14,17 @@ export const PROCESS_MAP: TrapConditionMap = (...args: unknown[]) => ConditionType; export type TrapCondition = ConditionType | TrapConditionFunction; diff --git a/src/interpreter/proxy/create-policy-proxy.ts b/src/interpreter/proxy/create-policy-proxy.ts index f96954a..0e34250 100644 --- a/src/interpreter/proxy/create-policy-proxy.ts +++ b/src/interpreter/proxy/create-policy-proxy.ts @@ -1,8 +1,8 @@ /* eslint-disable @typescript-eslint/ban-types */ -import {canBeObserved} from "../util/proxy/can-be-observed"; -import {ICreatePolicyProxyOptions} from "./i-create-policy-proxy-options"; -import {isBindCallApply} from "../util/function/is-bind-call-apply"; -import {PolicyTrapKind} from "../policy/policy-trap-kind"; +import {canBeObserved} from "../util/proxy/can-be-observed.js"; +import {ICreatePolicyProxyOptions} from "./i-create-policy-proxy-options.js"; +import {isBindCallApply} from "../util/function/is-bind-call-apply.js"; +import {PolicyTrapKind} from "../policy/policy-trap-kind.js"; /** * Stringifies the given PropertyKey path diff --git a/src/interpreter/proxy/i-create-policy-proxy-options.ts b/src/interpreter/proxy/i-create-policy-proxy-options.ts index f60a3fe..4af3034 100644 --- a/src/interpreter/proxy/i-create-policy-proxy-options.ts +++ b/src/interpreter/proxy/i-create-policy-proxy-options.ts @@ -1,5 +1,5 @@ -import {EvaluatePolicySanitized} from "../policy/evaluate-policy"; -import {PolicyProxyHook} from "./policy-proxy-hook"; +import {EvaluatePolicySanitized} from "../policy/evaluate-policy.js"; +import {PolicyProxyHook} from "./policy-proxy-hook.js"; // eslint-disable-next-line @typescript-eslint/ban-types export interface ICreatePolicyProxyOptions { diff --git a/src/interpreter/proxy/policy-proxy-hook.ts b/src/interpreter/proxy/policy-proxy-hook.ts index 4cf343d..18d1b49 100644 --- a/src/interpreter/proxy/policy-proxy-hook.ts +++ b/src/interpreter/proxy/policy-proxy-hook.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/ban-types */ -import {EvaluatePolicySanitized} from "../policy/evaluate-policy"; -import {PolicyTrapKind} from "../policy/policy-trap-kind"; +import {EvaluatePolicySanitized} from "../policy/evaluate-policy.js"; +import {PolicyTrapKind} from "../policy/policy-trap-kind.js"; export interface IPolicyProxyHookOptions { kind: PolicyTrapKind; diff --git a/src/interpreter/reporting/i-reporting-options.ts b/src/interpreter/reporting/i-reporting-options.ts index 4d54567..a228580 100644 --- a/src/interpreter/reporting/i-reporting-options.ts +++ b/src/interpreter/reporting/i-reporting-options.ts @@ -1,5 +1,5 @@ -import {ReportedErrorSet} from "./reported-error-set"; -import {TS} from "../../type/ts"; +import {ReportedErrorSet} from "./reported-error-set.js"; +import {TS} from "../../type/ts.js"; export interface IBindingReportEntry { path: string; diff --git a/src/interpreter/stack/stack.ts b/src/interpreter/stack/stack.ts index f4bfbe9..e68a1cb 100644 --- a/src/interpreter/stack/stack.ts +++ b/src/interpreter/stack/stack.ts @@ -1,4 +1,4 @@ -import {Literal} from "../literal/literal"; +import {Literal} from "../literal/literal.js"; export interface Stack { readonly length: number; diff --git a/src/interpreter/stack/traversal-stack/statement-traversal-stack.ts b/src/interpreter/stack/traversal-stack/statement-traversal-stack.ts index c23cfc8..08c16d1 100644 --- a/src/interpreter/stack/traversal-stack/statement-traversal-stack.ts +++ b/src/interpreter/stack/traversal-stack/statement-traversal-stack.ts @@ -1,4 +1,4 @@ -import {TS} from "../../../type/ts"; +import {TS} from "../../../type/ts.js"; export type StatementTraversalStack = TS.SyntaxKind[]; diff --git a/src/interpreter/util/class/generate-class-declaration.ts b/src/interpreter/util/class/generate-class-declaration.ts index ea73aa9..28ffae6 100644 --- a/src/interpreter/util/class/generate-class-declaration.ts +++ b/src/interpreter/util/class/generate-class-declaration.ts @@ -1,4 +1,4 @@ -import {IGenerateClassDeclarationOptions} from "./i-generate-class-declaration-options"; +import {IGenerateClassDeclarationOptions} from "./i-generate-class-declaration-options.js"; /** * A function that uses 'new Function' to auto-generate a class with a dynamic name and extended type diff --git a/src/interpreter/util/class/i-generate-class-declaration-options.ts b/src/interpreter/util/class/i-generate-class-declaration-options.ts index a8ae34b..00c15aa 100644 --- a/src/interpreter/util/class/i-generate-class-declaration-options.ts +++ b/src/interpreter/util/class/i-generate-class-declaration-options.ts @@ -1,4 +1,4 @@ -import {Literal} from "../../literal/literal"; +import {Literal} from "../../literal/literal.js"; export interface IGenerateClassDeclarationOptions { name: string; diff --git a/src/interpreter/util/declaration/get-declaration-name.ts b/src/interpreter/util/declaration/get-declaration-name.ts index a830aa1..fa5a19a 100644 --- a/src/interpreter/util/declaration/get-declaration-name.ts +++ b/src/interpreter/util/declaration/get-declaration-name.ts @@ -1,6 +1,6 @@ -import {EvaluatorOptions} from "../../evaluator/evaluator-options"; -import {UnexpectedNodeError} from "../../error/unexpected-node-error/unexpected-node-error"; -import {TS} from "../../../type/ts"; +import {EvaluatorOptions} from "../../evaluator/evaluator-options.js"; +import {UnexpectedNodeError} from "../../error/unexpected-node-error/unexpected-node-error.js"; +import {TS} from "../../../type/ts.js"; /** * Gets the name of the given declaration diff --git a/src/interpreter/util/declaration/is-declaration.ts b/src/interpreter/util/declaration/is-declaration.ts index 2b4df6d..bc358d3 100644 --- a/src/interpreter/util/declaration/is-declaration.ts +++ b/src/interpreter/util/declaration/is-declaration.ts @@ -1,4 +1,4 @@ -import {TS} from "../../../type/ts"; +import {TS} from "../../../type/ts.js"; /** * Returns true if the given Node is a Declaration diff --git a/src/interpreter/util/expression/expression-contains-super-keyword.ts b/src/interpreter/util/expression/expression-contains-super-keyword.ts index c0265f2..69582ca 100644 --- a/src/interpreter/util/expression/expression-contains-super-keyword.ts +++ b/src/interpreter/util/expression/expression-contains-super-keyword.ts @@ -1,5 +1,5 @@ -import {isSuperExpression} from "../node/is-super-expression"; -import {TS} from "../../../type/ts"; +import {isSuperExpression} from "../node/is-super-expression.js"; +import {TS} from "../../../type/ts.js"; /** * Returns true if the given expression contains a 'super' keyword diff --git a/src/interpreter/util/expression/is-expression.ts b/src/interpreter/util/expression/is-expression.ts index 1a09e4d..f47de82 100644 --- a/src/interpreter/util/expression/is-expression.ts +++ b/src/interpreter/util/expression/is-expression.ts @@ -1,4 +1,4 @@ -import {TS} from "../../../type/ts"; +import {TS} from "../../../type/ts.js"; /** * Returns true if the given Node is an Expression. diff --git a/src/interpreter/util/flags/is-var-declaration.ts b/src/interpreter/util/flags/is-var-declaration.ts index 48d7814..0f9f642 100644 --- a/src/interpreter/util/flags/is-var-declaration.ts +++ b/src/interpreter/util/flags/is-var-declaration.ts @@ -1,4 +1,4 @@ -import {TS} from "../../../type/ts"; +import {TS} from "../../../type/ts.js"; /** * Returns true if the given VariableDeclarationList is declared with a 'var' keyword diff --git a/src/interpreter/util/function/is-bind-call-apply.ts b/src/interpreter/util/function/is-bind-call-apply.ts index 1bde856..9b55ed0 100644 --- a/src/interpreter/util/function/is-bind-call-apply.ts +++ b/src/interpreter/util/function/is-bind-call-apply.ts @@ -1,4 +1,4 @@ -import {getFromLexicalEnvironment, LexicalEnvironment} from "../../lexical-environment/lexical-environment"; +import {getFromLexicalEnvironment, LexicalEnvironment} from "../../lexical-environment/lexical-environment.js"; /** * Returns true if the given function is either Function.prototype.bind, Function.prototype.call, or Function.prototype.apply diff --git a/src/interpreter/util/iterable/is-iterable.ts b/src/interpreter/util/iterable/is-iterable.ts index 58b6797..a461164 100644 --- a/src/interpreter/util/iterable/is-iterable.ts +++ b/src/interpreter/util/iterable/is-iterable.ts @@ -1,4 +1,4 @@ -import {Literal} from "../../literal/literal"; +import {Literal} from "../../literal/literal.js"; /** * Returns true if the given item is an Iterable diff --git a/src/interpreter/util/loader/optional-peer-dependency-loader.ts b/src/interpreter/util/loader/optional-peer-dependency-loader.ts index 1a18fc4..1e91f69 100644 --- a/src/interpreter/util/loader/optional-peer-dependency-loader.ts +++ b/src/interpreter/util/loader/optional-peer-dependency-loader.ts @@ -1,23 +1,11 @@ -import {Chalk} from "../../../type/chalk"; -import {JSDOM} from "../../../type/jsdom"; - -/** - * The chalk module is optionally imported on-demand as needed - */ -let chalkModule: typeof Chalk | undefined; +import {JSDOM} from "../../../type/jsdom.js"; +import { requireModule } from "./require-module.js"; /** * The jsdom module is optionally imported on-demand as needed */ let jsdomModule: typeof JSDOM | undefined; -export function loadChalk(required: true): typeof Chalk; -export function loadChalk(required: false): typeof Chalk | undefined; -export function loadChalk(required?: boolean): typeof Chalk | undefined; -export function loadChalk(required = false): typeof Chalk | undefined { - return (chalkModule ??= loadModules("use logging", required, "chalk")); -} - export function loadJsdom(required: true): typeof JSDOM; export function loadJsdom(required: false): typeof JSDOM | undefined; export function loadJsdom(required?: boolean): typeof JSDOM | undefined; @@ -27,8 +15,7 @@ export function loadJsdom(required = false): typeof JSDOM | undefined { function loadModules(description: string, required: boolean, moduleSpecifier = description): T | undefined { try { - // eslint-disable-next-line @typescript-eslint/no-require-imports,@typescript-eslint/no-var-requires - return require(moduleSpecifier) as T; + return requireModule(moduleSpecifier) as T; } catch (ex) { if (required) { throw new ReferenceError(`You must install the peer dependency '${moduleSpecifier}' in order to ${description} with ts-evaluator`); diff --git a/src/interpreter/util/loader/require-module.ts b/src/interpreter/util/loader/require-module.ts new file mode 100644 index 0000000..908fa48 --- /dev/null +++ b/src/interpreter/util/loader/require-module.ts @@ -0,0 +1,4 @@ +import {createRequire} from "module"; + +// Until import.meta.resolve becomes stable, we'll have to do this instead +export const requireModule = createRequire(import.meta.url); \ No newline at end of file diff --git a/src/interpreter/util/modifier/has-modifier.ts b/src/interpreter/util/modifier/has-modifier.ts index 03c6e92..a12e5e1 100644 --- a/src/interpreter/util/modifier/has-modifier.ts +++ b/src/interpreter/util/modifier/has-modifier.ts @@ -1,4 +1,4 @@ -import {TS} from "../../../type/ts"; +import {TS} from "../../../type/ts.js"; /** * Returns true if the given Node has the given kind of Modifier diff --git a/src/interpreter/util/module/get-implementation-for-declaration-within-declaration-file.ts b/src/interpreter/util/module/get-implementation-for-declaration-within-declaration-file.ts index 7cace89..e9005d6 100644 --- a/src/interpreter/util/module/get-implementation-for-declaration-within-declaration-file.ts +++ b/src/interpreter/util/module/get-implementation-for-declaration-within-declaration-file.ts @@ -1,12 +1,12 @@ -import {findNearestParentNodeOfKind} from "../node/find-nearest-parent-node-of-kind"; -import {Literal} from "../../literal/literal"; -import {ModuleNotFoundError} from "../../error/module-not-found-error/module-not-found-error"; -import {UnexpectedNodeError} from "../../error/unexpected-node-error/unexpected-node-error"; -import {EvaluatorOptions} from "../../evaluator/evaluator-options"; -import {getDeclarationName} from "../declaration/get-declaration-name"; -import {EvaluationError} from "../../error/evaluation-error/evaluation-error"; -import {getFromLexicalEnvironment} from "../../lexical-environment/lexical-environment"; -import {TS} from "../../../type/ts"; +import {findNearestParentNodeOfKind} from "../node/find-nearest-parent-node-of-kind.js"; +import {Literal} from "../../literal/literal.js"; +import {ModuleNotFoundError} from "../../error/module-not-found-error/module-not-found-error.js"; +import {UnexpectedNodeError} from "../../error/unexpected-node-error/unexpected-node-error.js"; +import {EvaluatorOptions} from "../../evaluator/evaluator-options.js"; +import {getDeclarationName} from "../declaration/get-declaration-name.js"; +import {EvaluationError} from "../../error/evaluation-error/evaluation-error.js"; +import {getFromLexicalEnvironment} from "../../lexical-environment/lexical-environment.js"; +import {TS} from "../../../type/ts.js"; /** * Gets an implementation for the given declaration that lives within a declaration file diff --git a/src/interpreter/util/module/get-module-name-for-node.ts b/src/interpreter/util/module/get-module-name-for-node.ts index 9007949..eaccf2c 100644 --- a/src/interpreter/util/module/get-module-name-for-node.ts +++ b/src/interpreter/util/module/get-module-name-for-node.ts @@ -1,5 +1,5 @@ -import {findNearestParentNodeOfKind} from "../node/find-nearest-parent-node-of-kind"; -import {TS} from "../../../type/ts"; +import {findNearestParentNodeOfKind} from "../node/find-nearest-parent-node-of-kind.js"; +import {TS} from "../../../type/ts.js"; /** * Gets the name of the module that contains the given Node diff --git a/src/interpreter/util/node/find-nearest-parent-node-of-kind.ts b/src/interpreter/util/node/find-nearest-parent-node-of-kind.ts index 42fd2a1..96be40e 100644 --- a/src/interpreter/util/node/find-nearest-parent-node-of-kind.ts +++ b/src/interpreter/util/node/find-nearest-parent-node-of-kind.ts @@ -1,4 +1,5 @@ -import {TS} from "../../../type/ts"; +import {TS} from "../../../type/ts.js"; +import {isDeclaration} from "../declaration/is-declaration.js"; /** * Finds the nearest parent node of the given kind from the given Node @@ -17,3 +18,14 @@ export function findNearestParentNodeOfKind(from: TS.Node, ki if (typescript.isSourceFile(currentParent)) return undefined; } } + +export function getStatementContext(from: TS.Node, typescript: typeof TS): T | undefined { + let currentParent = from; + while (true) { + currentParent = currentParent.parent; + if (currentParent == null) return undefined; + if (isDeclaration(currentParent, typescript) || typescript.isSourceFile(currentParent)) { + return currentParent as T; + } + } +} diff --git a/src/interpreter/util/node/get-inner-node.ts b/src/interpreter/util/node/get-inner-node.ts new file mode 100644 index 0000000..321c7f8 --- /dev/null +++ b/src/interpreter/util/node/get-inner-node.ts @@ -0,0 +1,11 @@ +import { TS } from "../../../type/ts.js"; + +export function getInnerNode(node: TS.Node, typescript: typeof TS): T { + if (typescript.isParenthesizedExpression(node)) return getInnerNode(node.expression, typescript); + else if (typescript.isAsExpression(node)) return getInnerNode(node.expression, typescript); + else if (typescript.isTypeAssertionExpression?.(node)) return getInnerNode(node.expression, typescript); + else if (typescript.isTypeAssertion?.(node)) return getInnerNode(node.expression, typescript); + else { + return node as T; + } +} diff --git a/src/interpreter/util/node/is-boolean-literal.ts b/src/interpreter/util/node/is-boolean-literal.ts index 134c9f1..0585663 100644 --- a/src/interpreter/util/node/is-boolean-literal.ts +++ b/src/interpreter/util/node/is-boolean-literal.ts @@ -1,4 +1,4 @@ -import {TS} from "../../../type/ts"; +import {TS} from "../../../type/ts.js"; /** * Returns true if the given node is a BooleanLiteral diff --git a/src/interpreter/util/node/is-null-literal.ts b/src/interpreter/util/node/is-null-literal.ts index 96c2df0..e153ea2 100644 --- a/src/interpreter/util/node/is-null-literal.ts +++ b/src/interpreter/util/node/is-null-literal.ts @@ -1,4 +1,4 @@ -import {TS} from "../../../type/ts"; +import {TS} from "../../../type/ts.js"; /** * Returns true if the given node is a NullLiteral diff --git a/src/interpreter/util/node/is-super-expression.ts b/src/interpreter/util/node/is-super-expression.ts index 32243cd..e958da5 100644 --- a/src/interpreter/util/node/is-super-expression.ts +++ b/src/interpreter/util/node/is-super-expression.ts @@ -1,4 +1,4 @@ -import {TS} from "../../../type/ts"; +import {TS} from "../../../type/ts.js"; /** * Returns true if the given node is a SuperExpression diff --git a/src/interpreter/util/node/is-this-expression.ts b/src/interpreter/util/node/is-this-expression.ts index 5ecde55..2ada00e 100644 --- a/src/interpreter/util/node/is-this-expression.ts +++ b/src/interpreter/util/node/is-this-expression.ts @@ -1,4 +1,4 @@ -import {TS} from "../../../type/ts"; +import {TS} from "../../../type/ts.js"; /** * Returns true if the given node is a ThisExpression diff --git a/src/interpreter/util/reporting/report-error.ts b/src/interpreter/util/reporting/report-error.ts index 6d9427f..a91c965 100644 --- a/src/interpreter/util/reporting/report-error.ts +++ b/src/interpreter/util/reporting/report-error.ts @@ -1,6 +1,6 @@ -import {ReportingOptionsSanitized} from "../../reporting/i-reporting-options"; -import {EvaluationError} from "../../error/evaluation-error/evaluation-error"; -import {TS} from "../../../type/ts"; +import {ReportingOptionsSanitized} from "../../reporting/i-reporting-options.js"; +import {EvaluationError} from "../../error/evaluation-error/evaluation-error.js"; +import {TS} from "../../../type/ts.js"; /** * Reports an error diff --git a/src/interpreter/util/statement/is-statement.ts b/src/interpreter/util/statement/is-statement.ts index 9185692..69a8440 100644 --- a/src/interpreter/util/statement/is-statement.ts +++ b/src/interpreter/util/statement/is-statement.ts @@ -1,4 +1,4 @@ -import {TS} from "../../../type/ts"; +import {TS} from "../../../type/ts.js"; /** * Returns true if the given Node is a Statement diff --git a/src/interpreter/util/static/in-static-context.ts b/src/interpreter/util/static/in-static-context.ts index b564cc6..7cc7ab3 100644 --- a/src/interpreter/util/static/in-static-context.ts +++ b/src/interpreter/util/static/in-static-context.ts @@ -1,5 +1,5 @@ -import {hasModifier} from "../modifier/has-modifier"; -import {TS} from "../../../type/ts"; +import {hasModifier} from "../modifier/has-modifier.js"; +import {TS} from "../../../type/ts.js"; /** * Returns true if the given Node exists within a static context diff --git a/src/interpreter/util/syntax-kind/stringify-syntax-kind.ts b/src/interpreter/util/syntax-kind/stringify-syntax-kind.ts index b13c4bc..b2f3575 100644 --- a/src/interpreter/util/syntax-kind/stringify-syntax-kind.ts +++ b/src/interpreter/util/syntax-kind/stringify-syntax-kind.ts @@ -1,4 +1,4 @@ -import {TS} from "../../../type/ts"; +import {TS} from "../../../type/ts.js"; /** * Stringifies the given SyntaxKind diff --git a/src/type/chalk.ts b/src/type/chalk.ts deleted file mode 100644 index 361323a..0000000 --- a/src/type/chalk.ts +++ /dev/null @@ -1,2 +0,0 @@ -import type * as Chalk from "chalk"; -export {Chalk}; diff --git a/src/type/ts.ts b/src/type/ts.ts index 5082252..3f87866 100644 --- a/src/type/ts.ts +++ b/src/type/ts.ts @@ -1,2 +1,2 @@ import type * as TS from "typescript"; -export {TS}; +export type {TS}; diff --git a/test/array-binding-pattern/array-binding-pattern.test.ts b/test/array-binding-pattern/array-binding-pattern.test.ts index 3ea61d9..c28bda1 100644 --- a/test/array-binding-pattern/array-binding-pattern.test.ts +++ b/test/array-binding-pattern/array-binding-pattern.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; test("Can handle ArrayBindingPatterns in VariableDeclarations. #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/array-literal-expression/array-literal-expression.test.ts b/test/array-literal-expression/array-literal-expression.test.ts index 76162b3..b03ab93 100644 --- a/test/array-literal-expression/array-literal-expression.test.ts +++ b/test/array-literal-expression/array-literal-expression.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; test("Can handle ArrayLiteralExpressions. #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/assignments/assignments.test.ts b/test/assignments/assignments.test.ts index 07a44c9..9c72f43 100644 --- a/test/assignments/assignments.test.ts +++ b/test/assignments/assignments.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; test("Can evaluate a CallExpression for a function with variable assignments. #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/await-expression/await-expression.test.ts b/test/await-expression/await-expression.test.ts index 6dff39f..6d8c32a 100644 --- a/test/await-expression/await-expression.test.ts +++ b/test/await-expression/await-expression.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; test("Can evaluate an AwaitExpression #1", withTypeScript, async (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/binary-expression/binary-expression.test.ts b/test/binary-expression/binary-expression.test.ts index c2612c6..50d8b8e 100644 --- a/test/binary-expression/binary-expression.test.ts +++ b/test/binary-expression/binary-expression.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript, withTypeScriptVersions} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript, withTypeScriptVersions} from "../setup/ts-macro.js"; test("Can evaluate a simple arithmetic BinaryExpression #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram(`2 + 2`, {typescript}); diff --git a/test/call-expression/call-bind-apply.test.ts b/test/call-expression/call-bind-apply.test.ts index fd43529..64d0139 100644 --- a/test/call-expression/call-bind-apply.test.ts +++ b/test/call-expression/call-bind-apply.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; test("Can evaluate a CallExpression that is called with another 'this' value. #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/class-declaration/class-declaration.test.ts b/test/class-declaration/class-declaration.test.ts index f50adae..3cfde5d 100644 --- a/test/class-declaration/class-declaration.test.ts +++ b/test/class-declaration/class-declaration.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript, withTypeScriptVersions} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript, withTypeScriptVersions} from "../setup/ts-macro.js"; test("Can handle ClassDeclarations and preserves their names. #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( @@ -295,4 +295,4 @@ test("Can handle instance properties set via Constructor arguments. #1", withTyp const instance = new (result.value as new () => {foo: number})(); t.deepEqual(instance.foo, 2); } -}); +}); \ No newline at end of file diff --git a/test/class-expression/class-expression.test.ts b/test/class-expression/class-expression.test.ts index 8ecf4a2..72a57e0 100644 --- a/test/class-expression/class-expression.test.ts +++ b/test/class-expression/class-expression.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; test("Can handle ClassExpressions. #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/conditional-expression/conditional-expression.test.ts b/test/conditional-expression/conditional-expression.test.ts index d27c75f..92a710e 100644 --- a/test/conditional-expression/conditional-expression.test.ts +++ b/test/conditional-expression/conditional-expression.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; test("Can handle ConditionalExpressions. #1", withTypeScript, (t, {typescript}) => { // noinspection BadExpressionStatementJS diff --git a/test/decorator/decorator.test.ts b/test/decorator/decorator.test.ts index 3a1ba1c..cfbf8fd 100644 --- a/test/decorator/decorator.test.ts +++ b/test/decorator/decorator.test.ts @@ -1,7 +1,7 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; -import {IndexLiteral} from "../../src/interpreter/literal/literal"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; +import {IndexLiteral} from "../../src/interpreter/literal/literal.js"; test("Can handle Class Decorators. #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/enum-declaration/enum-declaration.test.ts b/test/enum-declaration/enum-declaration.test.ts index bd4008d..6b2b55a 100644 --- a/test/enum-declaration/enum-declaration.test.ts +++ b/test/enum-declaration/enum-declaration.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; test("Can handle EnumDeclarations. #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/environment/browser.test.ts b/test/environment/browser.test.ts index 08623d6..aafd2c7 100644 --- a/test/environment/browser.test.ts +++ b/test/environment/browser.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; test("Can handle a Browser environment. #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/environment/node-cjs.test.ts b/test/environment/node-cjs.test.ts new file mode 100644 index 0000000..662622b --- /dev/null +++ b/test/environment/node-cjs.test.ts @@ -0,0 +1,75 @@ +import test from "ava"; +import path from "crosspath"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; + +test("Can handle the '__dirname' and '__filename' meta properties in a CommonJS-based Node environment. #1", withTypeScript, (t, {typescript}) => { + const {result, setup} = executeProgram( + // language=TypeScript + { + text: ` + (() => { + return {dirname: __dirname, filename: __filename}; + })();`, + fileName: "bar.ts" + }, + "(() =>", + { + cwd: "/Users/someone/development/foo", + typescript, + environment: { + preset: "NODE" + } + } + ); + + if (!result.success) t.fail(result.reason.stack); + else { + t.deepEqual(result.value, {dirname: path.native.join(setup.fileStructure.dir.src), filename: path.native.join(setup.fileStructure.dir.src, "bar.ts")}); + } +}); + +test("Can handle the '__dirname' and '__filename' meta properties in a CommonJS-based Node environment. #2", withTypeScript, (t, {typescript}) => { + const {result, setup} = executeProgram( + // language=TypeScript + { + text: ` + (() => { + return {dirname: __dirname, filename: __filename}; + })();`, + fileName: "bar.ts" + }, + "(() =>", + { + cwd: "/Users/someone/development/foo", + typescript, + environment: { + preset: "NODE_CJS" + } + } + ); + + if (!result.success) t.fail(result.reason.stack); + else { + console.log(result.value); + t.deepEqual(result.value, {dirname: path.native.join(setup.fileStructure.dir.src), filename: path.native.join(setup.fileStructure.dir.src, "bar.ts")}); + } +}); + +test("Can handle 'process.cwd()' in a CommonJS-based Node environment. #1", withTypeScript, (t, {typescript}) => { + const {result} = executeProgram( + // language=TypeScript + ` + (() => { + return process.cwd(); + })(); + `, + "(() =>", + {typescript} + ); + + if (!result.success) t.fail(result.reason.stack); + else { + t.deepEqual(result.value, process.cwd()); + } +}); diff --git a/test/environment/node-esm.test.ts b/test/environment/node-esm.test.ts new file mode 100644 index 0000000..c884cc1 --- /dev/null +++ b/test/environment/node-esm.test.ts @@ -0,0 +1,30 @@ +import test from "ava"; +import path from "crosspath"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; + +test("Can handle the import.meta.url meta property in an ESM-based Node environment. #1", withTypeScript, (t, {typescript}) => { + const {result, setup} = executeProgram( + // language=TypeScript + { + text: ` + (() => { + return {filename: import.meta.url}; + })();`, + fileName: "bar.ts" + }, + "(() =>", + { + cwd: "/Users/someone/development/foo", + typescript, + environment: { + preset: "NODE_ESM" + } + } + ); + + if (!result.success) t.fail(result.reason.stack); + else { + t.deepEqual(result.value, {filename: `file://${path.join(setup.fileStructure.dir.src, "bar.ts")}`}); + } +}); \ No newline at end of file diff --git a/test/environment/node.test.ts b/test/environment/node.test.ts deleted file mode 100644 index 4fdc7e3..0000000 --- a/test/environment/node.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import test from "ava"; -import path from "crosspath"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; - -test("Can handle the '__dirname' and '__filename' meta properties in a Node environment. #1", withTypeScript, (t, {typescript}) => { - const {result, setup} = executeProgram( - // language=TypeScript - { - text: ` - (() => { - return {dirname: __dirname, filename: __filename}; - })();`, - fileName: "bar.ts" - }, - "(() =>", - { - cwd: "/Users/someone/development/foo", - typescript, - environment: { - preset: "NODE" - } - } - ); - - if (!result.success) t.fail(result.reason.stack); - else { - t.deepEqual(result.value, {dirname: path.native.join(setup.fileStructure.dir.src), filename: path.native.join(setup.fileStructure.dir.src, "bar.ts")}); - } -}); - -test("Can handle 'process.cwd()' in a Node environment. #1", withTypeScript, (t, {typescript}) => { - const {result} = executeProgram( - // language=TypeScript - ` - (() => { - return process.cwd(); - })(); - `, - "(() =>", - {typescript} - ); - - if (!result.success) t.fail(result.reason.stack); - else { - t.deepEqual(result.value, process.cwd()); - } -}); diff --git a/test/for-in/for-in.test.ts b/test/for-in/for-in.test.ts index 65eaf40..8e84abc 100644 --- a/test/for-in/for-in.test.ts +++ b/test/for-in/for-in.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; test("Can evaluate a CallExpression with a ForInStatement. #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/for-of/for-of.test.ts b/test/for-of/for-of.test.ts index 73aec10..6d4ce71 100644 --- a/test/for-of/for-of.test.ts +++ b/test/for-of/for-of.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; test("Can evaluate a CallExpression with a ForOfStatement. #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/for/for.test.ts b/test/for/for.test.ts index 38d810d..18b5512 100644 --- a/test/for/for.test.ts +++ b/test/for/for.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; test("Can evaluate a CallExpression with a ForStatement. #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/function-declaration/arithmetic.test.ts b/test/function-declaration/arithmetic.test.ts index d822177..f49ed92 100644 --- a/test/function-declaration/arithmetic.test.ts +++ b/test/function-declaration/arithmetic.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; test("Can evaluate a simple '(number, number) => number' function. #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/function-declaration/recursion.test.ts b/test/function-declaration/recursion.test.ts index 2b733ee..daffa2c 100644 --- a/test/function-declaration/recursion.test.ts +++ b/test/function-declaration/recursion.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; test("Can evaluate a CallExpression for a recursive function. #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/get-accessor-declaration/get-accessor-declaration.test.ts b/test/get-accessor-declaration/get-accessor-declaration.test.ts index 5fdb2ca..1e2f3b4 100644 --- a/test/get-accessor-declaration/get-accessor-declaration.test.ts +++ b/test/get-accessor-declaration/get-accessor-declaration.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; test("Can evaluate and retrieve a GetAccessorDeclaration. #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/hoisting/hoisting.test.ts b/test/hoisting/hoisting.test.ts index 0ba9e5f..0ac0d90 100644 --- a/test/hoisting/hoisting.test.ts +++ b/test/hoisting/hoisting.test.ts @@ -1,8 +1,8 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; -import {UndefinedIdentifierError} from "../../src/interpreter/error/undefined-identifier-error/undefined-identifier-error"; -import {NotCallableError} from "../../src/interpreter/error/not-callable-error/not-callable-error"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; +import {UndefinedIdentifierError} from "../../src/interpreter/error/undefined-identifier-error/undefined-identifier-error.js"; +import {NotCallableError} from "../../src/interpreter/error/not-callable-error/not-callable-error.js"; test("Throws when attempting to reference an identifier that is still not defined within the current scope. #2", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/import-declaration/import-declaration.test.ts b/test/import-declaration/import-declaration.test.ts index e90d33c..49b55ac 100644 --- a/test/import-declaration/import-declaration.test.ts +++ b/test/import-declaration/import-declaration.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript, withTypeScriptVersions} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript, withTypeScriptVersions} from "../setup/ts-macro.js"; import path from "crosspath"; test("Can resolve symbols via ImportDeclarations. #1", withTypeScript, (t, {typescript}) => { @@ -196,7 +196,7 @@ test("Can resolve symbols via ImportDeclarations for built-in node modules. #3", import {readFileSync} from "fs"; const alias = readFileSync; - const foo = JSON.parse(readFileSync("${path.join(__dirname, "../../package.json").replace(/\\/g, "\\\\")}")).name; + const foo = JSON.parse(readFileSync("${path.join(path.dirname(path.urlToFilename(import.meta.url)), "../../package.json").replace(/\\/g, "\\\\")}")).name; ` ], "foo", diff --git a/test/interface-declaration/interface-declaration.test.ts b/test/interface-declaration/interface-declaration.test.ts index 9c1d875..0a7d204 100644 --- a/test/interface-declaration/interface-declaration.test.ts +++ b/test/interface-declaration/interface-declaration.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; test("Understands InterfaceDeclarations. #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/logical-assignment/logical-assignment.test.ts b/test/logical-assignment/logical-assignment.test.ts index ef0ee7f..2f23400 100644 --- a/test/logical-assignment/logical-assignment.test.ts +++ b/test/logical-assignment/logical-assignment.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScriptVersions} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScriptVersions} from "../setup/ts-macro.js"; test("Supports logical assignment. #1", withTypeScriptVersions(">=4.0"), (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/method-declaration/method-declaration.test.ts b/test/method-declaration/method-declaration.test.ts index 37420e7..66996f7 100644 --- a/test/method-declaration/method-declaration.test.ts +++ b/test/method-declaration/method-declaration.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript, withTypeScriptVersions} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript, withTypeScriptVersions} from "../setup/ts-macro.js"; test("Can evaluate and retrieve a MethodDeclaration. #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/new-target/new-target.test.ts b/test/new-target/new-target.test.ts new file mode 100644 index 0000000..0228674 --- /dev/null +++ b/test/new-target/new-target.test.ts @@ -0,0 +1,26 @@ +import test from "ava"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; + +test("Can handle new.target syntax. #1", withTypeScript, (t, {typescript}) => { + const {result} = executeProgram( + ` + let result: boolean|undefined; + function Foo() { + if (!new.target) result = false; + else result = true; + } + (() => { + new Foo(); + return result; + })(); + `, + "(() =>", + {typescript} + ); + + if (!result.success) t.fail(result.reason.stack); + else { + t.deepEqual(result.value, true); + } +}); \ No newline at end of file diff --git a/test/nullish-coalescing/nullish-coalescing.test.ts b/test/nullish-coalescing/nullish-coalescing.test.ts index 79ff89d..425878c 100644 --- a/test/nullish-coalescing/nullish-coalescing.test.ts +++ b/test/nullish-coalescing/nullish-coalescing.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScriptVersions} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScriptVersions} from "../setup/ts-macro.js"; test("Supports nullish coalescing with null-like values. #1", withTypeScriptVersions(">=3.7"), (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/object-binding-pattern/object-binding-pattern.test.ts b/test/object-binding-pattern/object-binding-pattern.test.ts index f3fffbb..eccb230 100644 --- a/test/object-binding-pattern/object-binding-pattern.test.ts +++ b/test/object-binding-pattern/object-binding-pattern.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; test("Can handle ObjectBindingPatterns in VariableDeclarations. #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/object-literal-expression/object-literal-expression.test.ts b/test/object-literal-expression/object-literal-expression.test.ts index ef5174a..5e461c9 100644 --- a/test/object-literal-expression/object-literal-expression.test.ts +++ b/test/object-literal-expression/object-literal-expression.test.ts @@ -1,7 +1,7 @@ import test from "ava"; -import { UndefinedIdentifierError } from "../../src/interpreter/error/undefined-identifier-error/undefined-identifier-error"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; +import { UndefinedIdentifierError } from "../../src/interpreter/error/undefined-identifier-error/undefined-identifier-error.js"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; test("Can handle ObjectLiteralExpressions. #1", withTypeScript, (t, {typescript}) => { // noinspection BadExpressionStatementJS diff --git a/test/optional-chaining/optional-chaining.test.ts b/test/optional-chaining/optional-chaining.test.ts index 15758c3..51d9fd3 100644 --- a/test/optional-chaining/optional-chaining.test.ts +++ b/test/optional-chaining/optional-chaining.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScriptVersions} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScriptVersions} from "../setup/ts-macro.js"; test("Supports optional CallExpressions. #1", withTypeScriptVersions(">=3.7"), (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/policy/policy.test.ts b/test/policy/policy.test.ts index aa4e8c9..d33c983 100644 --- a/test/policy/policy.test.ts +++ b/test/policy/policy.test.ts @@ -1,11 +1,11 @@ /* eslint-disable @typescript-eslint/naming-convention */ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; -import {IoError} from "../../src/interpreter/error/policy-error/io-error/io-error"; -import {NonDeterministicError} from "../../src/interpreter/error/policy-error/non-deterministic-error/non-deterministic-error"; -import {NetworkError} from "../../src/interpreter/error/policy-error/network-error/network-error"; -import {ProcessError} from "../../src/interpreter/error/policy-error/process-error/process-error"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; +import {IoError} from "../../src/interpreter/error/policy-error/io-error/io-error.js"; +import {NonDeterministicError} from "../../src/interpreter/error/policy-error/non-deterministic-error/non-deterministic-error.js"; +import {NetworkError} from "../../src/interpreter/error/policy-error/network-error/network-error.js"; +import {ProcessError} from "../../src/interpreter/error/policy-error/process-error/process-error.js"; test("Throws on IO read if the policy requires it. #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/postfix-unary-expression/postfix-unary-expression.test.ts b/test/postfix-unary-expression/postfix-unary-expression.test.ts index 713664f..30bb4c6 100644 --- a/test/postfix-unary-expression/postfix-unary-expression.test.ts +++ b/test/postfix-unary-expression/postfix-unary-expression.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; test("Can handle PostfixUnaryExpressions. #1", withTypeScript, (t, {typescript}) => { // noinspection BadExpressionStatementJS diff --git a/test/property-declaration/property-declaration.test.ts b/test/property-declaration/property-declaration.test.ts index 7d7d90f..f319f17 100644 --- a/test/property-declaration/property-declaration.test.ts +++ b/test/property-declaration/property-declaration.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript, withTypeScriptVersions} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript, withTypeScriptVersions} from "../setup/ts-macro.js"; test("Can evaluate and retrieve a PropertyDeclaration. #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/setup/cached-fs.ts b/test/setup/cached-fs.ts index b905fba..f98a26c 100644 --- a/test/setup/cached-fs.ts +++ b/test/setup/cached-fs.ts @@ -1,6 +1,6 @@ -import { TS } from "../../src/type/ts"; -import { FileSystem } from "../../src/type/file-system"; -import {CachedWorker, CachedWorkerOptions} from "./cached-worker"; +import { TS } from "../../src/type/ts.js"; +import { FileSystem } from "../../src/type/file-system.js"; +import {CachedWorker, CachedWorkerOptions} from "./cached-worker.js"; export interface CachedFsWorkerOptions extends CachedWorkerOptions { fs: TS.System | FileSystem; diff --git a/test/setup/create-compiler-host.ts b/test/setup/create-compiler-host.ts index 5341fa6..eb48598 100644 --- a/test/setup/create-compiler-host.ts +++ b/test/setup/create-compiler-host.ts @@ -1,5 +1,5 @@ -import {FileSystem} from "../../src/type/file-system"; -import {TS} from "../../src/type/ts"; +import {FileSystem} from "../../src/type/file-system.js"; +import {TS} from "../../src/type/ts.js"; import path from "crosspath"; export interface CreateCompilerHostOptions { diff --git a/test/setup/create-virtual-file-system.ts b/test/setup/create-virtual-file-system.ts index 6ea7183..4c71448 100644 --- a/test/setup/create-virtual-file-system.ts +++ b/test/setup/create-virtual-file-system.ts @@ -1,6 +1,6 @@ import path from "crosspath"; -import {FileSystem} from "../../src/type/file-system"; -import {TestFileRecord} from "./test-file"; +import {FileSystem} from "../../src/type/file-system.js"; +import {TestFileRecord} from "./test-file.js"; import {Volume, createFsFromVolume} from "memfs"; export function createVirtualFileSystem(files: TestFileRecord[]): FileSystem { diff --git a/test/setup/execute-program.ts b/test/setup/execute-program.ts index 45cfaed..c21092a 100644 --- a/test/setup/execute-program.ts +++ b/test/setup/execute-program.ts @@ -1,12 +1,12 @@ -import {TS} from "../../src/type/ts"; -import {TestResult} from "./test-result"; -import {createBuiltInModuleTestFiles, TestFile, TestFileEntry} from "./test-file"; -import {TestContext} from "./test-context"; -import {createTestSetup} from "./test-setup"; +import {TS} from "../../src/type/ts.js"; +import {TestResult} from "./test-result.js"; +import {createBuiltInModuleTestFiles, TestFile, TestFileEntry} from "./test-file.js"; +import {TestContext} from "./test-context.js"; +import {createTestSetup} from "./test-setup.js"; import {MaybeArray, PartialExcept} from "helpertypes"; import path from "crosspath"; -import {evaluate} from "../../src/interpreter/evaluate"; -import {ensureArray} from "../../src/interpreter/util/array/ensure-array"; +import {evaluate} from "../../src/interpreter/evaluate.js"; +import {ensureArray} from "../../src/interpreter/util/array/ensure-array.js"; /** * Prepares a test @@ -27,10 +27,9 @@ export function executeProgram( const options = arguments.length === 3 ? (optionsOrUndefined as Exclude) : (inputEntryOrOptions as Exclude); - if (options.environment?.preset == null || options.environment.preset === "NODE") { - inputFiles = [ - ...ensureArray(inputFiles), - ...createBuiltInModuleTestFiles("child_process", "fs", "http", "path", "assert")]; + const useCommonJs = options.environment?.preset == null || options.environment.preset === "NODE" || options.environment.preset === "NODE_CJS"; + if (options.environment?.preset == null || options.environment.preset === "NODE" || options.environment.preset === "NODE_CJS" || options.environment.preset === "NODE_ESM") { + inputFiles = [...ensureArray(inputFiles), ...createBuiltInModuleTestFiles("child_process", "fs", "http", "path", "assert")]; } const setup = createTestSetup(inputFiles, inputEntry, options); @@ -48,7 +47,8 @@ export function executeProgram( allowJs: true, sourceMap: false, outDir: dir.dist, - rootDir: dir.root + rootDir: dir.root, + module: useCommonJs ? typescript.ModuleKind.CommonJS : typescript.ModuleKind.ESNext }; const program = typescript.createProgram({ diff --git a/test/setup/test-context.ts b/test/setup/test-context.ts index b512500..4a8c8aa 100644 --- a/test/setup/test-context.ts +++ b/test/setup/test-context.ts @@ -1,6 +1,6 @@ import {PartialExcept} from "helpertypes"; -import {EvaluateOptions} from "../../src/interpreter/evaluate-options"; -import {LogLevelKind} from "../../src/interpreter/logger/log-level"; +import {EvaluateOptions} from "../../src/interpreter/evaluate-options.js"; +import {LogLevelKind} from "../../src/interpreter/logger/log-level.js"; const _process = process; export interface TestContext extends PartialExcept, "typescript"> { diff --git a/test/setup/test-file.ts b/test/setup/test-file.ts index 6a3bc2a..ae9fcef 100644 --- a/test/setup/test-file.ts +++ b/test/setup/test-file.ts @@ -1,11 +1,11 @@ import path from "crosspath"; import fs from "fs"; -import {TestContext} from "./test-context"; -import {generateRandomPath} from "../../src/interpreter/util/path/generate-random-path"; -import {ensureArray} from "../../src/interpreter/util/array/ensure-array"; +import {TestContext} from "./test-context.js"; +import {generateRandomPath} from "../../src/interpreter/util/path/generate-random-path.js"; +import {ensureArray} from "../../src/interpreter/util/array/ensure-array.js"; import {MaybeArray} from "helpertypes"; -import {BuiltInModuleMap} from "../../src/interpreter/policy/module/built-in-module-map"; -import {CachedFs} from "./cached-fs"; +import {CachedFs} from "./cached-fs.js"; +import { requireModule } from "../../src/interpreter/util/loader/require-module.js"; export interface TestFileRecord { fileName: string; @@ -29,7 +29,7 @@ const VIRTUAL_ROOT = "#root"; const VIRTUAL_SRC = "src"; const VIRTUAL_DIST = "dist"; -const nodeTypesDir = path.dirname(require.resolve("@types/node/package.json")); +const nodeTypesDir = path.dirname(requireModule.resolve("@types/node/package.json")); const fsWorker = new CachedFs({fs}); export interface TestFileDirectories { @@ -44,7 +44,13 @@ export interface TestFileStructure { entry: TestFileEntryRefRecord; } -export function createBuiltInModuleTestFiles(...modules: (keyof BuiltInModuleMap)[]): TestFile[] { +function stripNodePrefixFromModuleSpecifier(moduleSpecifier: string): string { + return moduleSpecifier.startsWith("node:") ? moduleSpecifier.slice("node:".length) : moduleSpecifier; +} + +export type SupportedBuiltInModuleBase = "child_process" | "fs" | "globals" | "buffer" | "dns" | "http" | "path" | "assert"; +export type SuppportedBuiltInModule = SupportedBuiltInModuleBase | `node:${SupportedBuiltInModuleBase}`; +export function createBuiltInModuleTestFiles(...modules: SuppportedBuiltInModule[]): TestFile[] { return [ { fileName: "node_modules/@types/node/package.json", @@ -56,16 +62,18 @@ export function createBuiltInModuleTestFiles(...modules: (keyof BuiltInModuleMap } ` }, - { - fileName: "node_modules/@types/node/index.d.ts", - text: ` - /// - ` - }, - ...modules.map(module => ({ - fileName: `node_modules/@types/node/${module}.d.ts`, - text: fsWorker.readFile(path.native.join(nodeTypesDir, `${module}.d.ts`)) ?? "" - })) + ...modules.flatMap(module => [ + { + fileName: "node_modules/@types/node/index.d.ts", + text: ` + /// + ` + }, + { + fileName: `node_modules/@types/node/${stripNodePrefixFromModuleSpecifier(module)}.d.ts`, + text: fsWorker.readFile(path.native.join(nodeTypesDir, `${stripNodePrefixFromModuleSpecifier(module)}.d.ts`)) ?? "" + } + ]) ]; } diff --git a/test/setup/test-result.ts b/test/setup/test-result.ts index cad5707..628331c 100644 --- a/test/setup/test-result.ts +++ b/test/setup/test-result.ts @@ -1,5 +1,5 @@ -import {EvaluateResult} from "../../src/interpreter/evaluate-result"; -import { TestSetup } from "./test-setup"; +import {EvaluateResult} from "../../src/interpreter/evaluate-result.js"; +import { TestSetup } from "./test-setup.js"; export interface TestResult { result: EvaluateResult; diff --git a/test/setup/test-setup.ts b/test/setup/test-setup.ts index 425e8f9..38c414c 100644 --- a/test/setup/test-setup.ts +++ b/test/setup/test-setup.ts @@ -1,9 +1,9 @@ -import {createTestContext, TestContext} from "./test-context"; -import {FileSystem} from "../../src/type/file-system"; -import {createTestFileStructure, TestFile, TestFileEntry, TestFileStructure} from "./test-file"; -import {createVirtualFileSystem} from "./create-virtual-file-system"; -import {TS} from "../../src/type/ts"; -import {createCompilerHost} from "./create-compiler-host"; +import {createTestContext, TestContext} from "./test-context.js"; +import {FileSystem} from "../../src/type/file-system.js"; +import {createTestFileStructure, TestFile, TestFileEntry, TestFileStructure} from "./test-file.js"; +import {createVirtualFileSystem} from "./create-virtual-file-system.js"; +import {TS} from "../../src/type/ts.js"; +import {createCompilerHost} from "./create-compiler-host.js"; import {MaybeArray, PartialExcept} from "helpertypes"; export interface TestSetup { diff --git a/test/setup/ts-macro.ts b/test/setup/ts-macro.ts index ac64cc1..7c1c675 100644 --- a/test/setup/ts-macro.ts +++ b/test/setup/ts-macro.ts @@ -1,7 +1,24 @@ -import {satisfies} from "semver"; -import pkg from "../../package.json"; +import semver from "semver"; import type {ExecutionContext, OneOrMoreMacros, Macro} from "ava"; -import type {TS} from "../../src/type/ts"; +import type {TS} from "../../src/type/ts.js"; +import path from "crosspath"; +import fs from "fs"; + +function getNearestPackageJson(from = import.meta.url): Record | undefined { + // There may be a file protocol in from of the path + const normalizedFrom = path.urlToFilename(from); + const currentDir = path.dirname(normalizedFrom); + + const pkgPath = path.join(currentDir, "package.json"); + if (fs.existsSync(pkgPath)) { + return JSON.parse(fs.readFileSync(pkgPath, "utf-8")); + } else if (currentDir !== normalizedFrom) { + return getNearestPackageJson(currentDir); + } else { + return undefined; + } +} +const pkg = getNearestPackageJson(); // ava macros export interface ExtendedImplementationArgumentOptions { @@ -10,7 +27,13 @@ export interface ExtendedImplementationArgumentOptions { } export type ExtendedImplementation = (t: ExecutionContext, options: ExtendedImplementationArgumentOptions) => void | Promise; function makeTypeScriptMacro(version: string, specifier: string) { - const macro: Macro<[ExtendedImplementation]> = async (t, impl) => impl(t, {typescript: await import(specifier), typescriptModuleSpecifier: specifier}); + const macro: Macro<[ExtendedImplementation]> = async (t, impl) => { + let typescript = await import(specifier); + if ("default" in typescript) { + typescript = typescript.default; + } + return impl(t, {typescript, typescriptModuleSpecifier: specifier}); + }; macro.title = (provided = "") => `${provided} (TypeScript v${version})`; return macro; @@ -36,7 +59,7 @@ for (const [specifier, range] of Object.entries(devDependencies)) { const [, context, version] = match; if (context === "npm:typescript@" || specifier === "typescript") { availableTsVersions.add(version); - if (filter === undefined || (filter.toUpperCase() === "CURRENT" && specifier === "typescript") || satisfies(version, filter, {includePrerelease: true})) { + if (filter === undefined || (filter.toUpperCase() === "CURRENT" && specifier === "typescript") || semver.satisfies(version, filter, {includePrerelease: true})) { macros.set(version, makeTypeScriptMacro(version, specifier)); } } @@ -50,7 +73,7 @@ Available TypeScript versions: ${[...availableTsVersions].join(", ")}`); } export function withTypeScriptVersions(extraFilter: string): OneOrMoreMacros<[ExtendedImplementation], unknown> { - const filteredMacros = [...macros.entries()].filter(([version]) => satisfies(version, extraFilter, {includePrerelease: true})).map(([, macro]) => macro); + const filteredMacros = [...macros.entries()].filter(([version]) => semver.satisfies(version, extraFilter, {includePrerelease: true})).map(([, macro]) => macro); if (filteredMacros.length === 0) { filteredMacros.push(noMatchingVersionMacro); diff --git a/test/spread-assignment/spread-assignment.test.ts b/test/spread-assignment/spread-assignment.test.ts index 338d07a..8281b7b 100644 --- a/test/spread-assignment/spread-assignment.test.ts +++ b/test/spread-assignment/spread-assignment.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; test("Can handle Spread assignments to objects. #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/spread-element/spread-element.test.ts b/test/spread-element/spread-element.test.ts index 61228b0..c348da7 100644 --- a/test/spread-element/spread-element.test.ts +++ b/test/spread-element/spread-element.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; test("Can handle Spread Elements in arrays. #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/switch/switch.test.ts b/test/switch/switch.test.ts index bd9b31a..1e12d07 100644 --- a/test/switch/switch.test.ts +++ b/test/switch/switch.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; test("Can evaluate a CallExpression with a SwitchStatement. #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/try-catch/try-catch.test.ts b/test/try-catch/try-catch.test.ts index 51141ef..406e605 100644 --- a/test/try-catch/try-catch.test.ts +++ b/test/try-catch/try-catch.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; test("Can capture errors that would otherwise throw with try-catch. #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/type-alias-declaration/type-alias-declaration.test.ts b/test/type-alias-declaration/type-alias-declaration.test.ts index 72b1773..61bb7b1 100644 --- a/test/type-alias-declaration/type-alias-declaration.test.ts +++ b/test/type-alias-declaration/type-alias-declaration.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; test("Understands TypeAliasDeclarations. #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/type-of-expression/type-of-expression.test.ts b/test/type-of-expression/type-of-expression.test.ts index 7b6a221..217269a 100644 --- a/test/type-of-expression/type-of-expression.test.ts +++ b/test/type-of-expression/type-of-expression.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; test("Can evaluate a TypeOfExpression #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/void-expression/void-expression.test.ts b/test/void-expression/void-expression.test.ts index eac68d0..d80cb83 100644 --- a/test/void-expression/void-expression.test.ts +++ b/test/void-expression/void-expression.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; test("Can evaluate VoidExpressions #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( diff --git a/test/while/while.test.ts b/test/while/while.test.ts index 73f714d..cf71a18 100644 --- a/test/while/while.test.ts +++ b/test/while/while.test.ts @@ -1,6 +1,6 @@ import test from "ava"; -import {executeProgram} from "../setup/execute-program"; -import {withTypeScript} from "../setup/ts-macro"; +import {executeProgram} from "../setup/execute-program.js"; +import {withTypeScript} from "../setup/ts-macro.js"; test("Can evaluate a CallExpression with a WhileStatement. #1", withTypeScript, (t, {typescript}) => { const {result} = executeProgram( diff --git a/tsconfig.build.json b/tsconfig.build.json index cd77555..b82c0cf 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -4,7 +4,7 @@ "src/**/*.*" ], "compilerOptions": { - "module": "esnext", - "declaration": true + "declaration": true, + "declarationMap": false } } \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 7b67079..119819e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,8 +1,9 @@ { "extends": "@wessberg/ts-config", + "include": ["src/**/*.*", "test/**/*.*"], "compilerOptions": { - "module": "commonjs", - "target": "es2018", + "module": "esnext", + "target": "es2019", "importHelpers": false } }