diff --git a/package-lock.json b/package-lock.json index 560aeeb6..9fbe3b63 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1855,6 +1855,26 @@ "node": ">=0.1.90" } }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, "node_modules/@ef4/addon-template": { "resolved": "packages/addon-template", "link": true @@ -4080,6 +4100,26 @@ "node": ">= 10" } }, + "node_modules/@tsconfig/node10": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", + "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==" + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==" + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==" + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==" + }, "node_modules/@types/babel__core": { "version": "7.20.3", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.3.tgz", @@ -35809,39 +35849,6 @@ "node": ">=0.10.0" } }, - "node_modules/ts-node": { - "version": "9.1.1", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.1.1.tgz", - "integrity": "sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg==", - "dependencies": { - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "source-map-support": "^0.5.17", - "yn": "3.1.1" - }, - "bin": { - "ts-node": "dist/bin.js", - "ts-node-script": "dist/bin-script.js", - "ts-node-transpile-only": "dist/bin-transpile.js", - "ts-script": "dist/bin-script-deprecated.js" - }, - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "typescript": ">=2.7" - } - }, - "node_modules/ts-node/node_modules/diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "engines": { - "node": ">=0.3.1" - } - }, "node_modules/tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", @@ -36008,6 +36015,7 @@ "version": "4.3.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz", "integrity": "sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -36467,6 +36475,11 @@ "integrity": "sha512-ocyWc3bAHBB/guyqJQVI5o4BZkPhznPYUG2ea80Gond/BgNWpap8TOmLSeeQG7bnh2KMISxskdADG59j7zruhw==", "dev": true }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==" + }, "node_modules/validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", @@ -37950,7 +37963,7 @@ } }, "packages/ember-auto-import": { - "version": "2.7.2", + "version": "2.7.4", "license": "MIT", "dependencies": { "@babel/core": "^7.16.7", @@ -38017,7 +38030,7 @@ "quick-temp": "^0.1.8", "qunit": "^2.17.2", "qunit-assertions-extra": "^0.8.5", - "typescript": "4.3.5" + "typescript": "5.5.3" }, "engines": { "node": "12.* || 14.* || >= 16" @@ -38160,6 +38173,19 @@ "node": ">= 12" } }, + "packages/ember-auto-import/node_modules/typescript": { + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz", + "integrity": "sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, "packages/v2-addon-template": { "name": "@ef4/v2-addon-template", "version": "0.0.1", @@ -38176,7 +38202,7 @@ "jsdom": "^11.11.0", "qunit": "^2.6.1", "scenario-tester": "^2.1.2", - "ts-node": "^9.1.1" + "ts-node": "^10.9.2" }, "devDependencies": { "@ef4/addon-template": "*", @@ -38227,6 +38253,28 @@ "node": ">=6.9.0" } }, + "test-scenarios/node_modules/acorn": { + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "test-scenarios/node_modules/acorn-walk": { + "version": "8.3.3", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.3.tgz", + "integrity": "sha512-MxXdReSRhGO7VlFe1bRG/oI7/mdLV9B9JJT0N8vZOhF7gFRR5l3M8W9G8JxmKV+JC5mGqJ0QvqfSOLsCPa4nUw==", + "dependencies": { + "acorn": "^8.11.0" + }, + "engines": { + "node": ">=0.4.0" + } + }, "test-scenarios/node_modules/anymatch": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", @@ -39025,6 +39073,56 @@ "matcher-collection": "^1.0.0" } }, + "test-scenarios/node_modules/ts-node": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "test-scenarios/node_modules/ts-node/node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "engines": { + "node": ">=0.3.1" + } + }, "test-scenarios/node_modules/validate-npm-package-name": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-5.0.0.tgz", diff --git a/packages/ember-auto-import/package.json b/packages/ember-auto-import/package.json index 85045874..79558263 100644 --- a/packages/ember-auto-import/package.json +++ b/packages/ember-auto-import/package.json @@ -97,7 +97,7 @@ "quick-temp": "^0.1.8", "qunit": "^2.17.2", "qunit-assertions-extra": "^0.8.5", - "typescript": "4.3.5" + "typescript": "5.5.3" }, "engines": { "node": "12.* || 14.* || >= 16" diff --git a/packages/ember-auto-import/ts/analyzer.ts b/packages/ember-auto-import/ts/analyzer.ts index 3bdb3d40..420381e3 100644 --- a/packages/ember-auto-import/ts/analyzer.ts +++ b/packages/ember-auto-import/ts/analyzer.ts @@ -192,7 +192,7 @@ export default class Analyzer extends Funnel { try { transformSync(source, options); } catch (err) { - if (err.name !== 'SyntaxError') { + if (err instanceof Error && err.name !== 'SyntaxError') { throw err; } debug('Ignoring an unparseable file'); diff --git a/packages/ember-auto-import/ts/tests/analyzer-test.ts b/packages/ember-auto-import/ts/tests/analyzer-test.ts index a7717d14..327e820c 100644 --- a/packages/ember-auto-import/ts/tests/analyzer-test.ts +++ b/packages/ember-auto-import/ts/tests/analyzer-test.ts @@ -454,7 +454,7 @@ Qmodule('analyzer', function (hooks) { throw new Error(`expected not to get here, build was supposed to fail`); } catch (err) { assert.contains( - err.message, + err instanceof Error ? err.message : String(err), 'import() is only allowed to contain string literals or template string literals' ); } diff --git a/packages/ember-auto-import/ts/tests/splitter-test.ts b/packages/ember-auto-import/ts/tests/splitter-test.ts index 13f39f3a..383012f4 100644 --- a/packages/ember-auto-import/ts/tests/splitter-test.ts +++ b/packages/ember-auto-import/ts/tests/splitter-test.ts @@ -317,7 +317,7 @@ Qmodule('splitter', function (hooks) { throw new Error(`expected not to get here, build was supposed to fail`); } catch (err) { assert.contains( - err.message, + err instanceof Error ? err.message : String(err), 'Dynamic imports must target unambiguous package names' ); } @@ -333,7 +333,7 @@ Qmodule('splitter', function (hooks) { throw new Error(`expected not to get here, build was supposed to fail`); } catch (err) { assert.contains( - err.message, + err instanceof Error ? err.message : String(err), 'Dynamic imports must target unambiguous package names' ); } @@ -349,7 +349,7 @@ Qmodule('splitter', function (hooks) { throw new Error(`expected not to get here, build was supposed to fail`); } catch (err) { assert.contains( - err.message, + err instanceof Error ? err.message : String(err), `ember-auto-import does not support dynamic relative imports. "./thing" is relative. To make this work, you need to upgrade to Embroider.` ); } diff --git a/packages/ember-auto-import/ts/webpack.ts b/packages/ember-auto-import/ts/webpack.ts index 68b74518..1b49480b 100644 --- a/packages/ember-auto-import/ts/webpack.ts +++ b/packages/ember-auto-import/ts/webpack.ts @@ -11,7 +11,7 @@ import { join, dirname, resolve, relative, posix, isAbsolute } from 'path'; import { createHash } from 'crypto'; import { mergeWith, flatten, zip } from 'lodash'; import { writeFileSync, realpathSync, readFileSync } from 'fs'; -import { compile, registerHelper } from 'handlebars'; +import Handlebars from 'handlebars'; import jsStringEscape from 'js-string-escape'; import { BundleDependencies, ResolvedTemplateImport } from './splitter'; import { BuildResult, Bundler, BundlerOptions } from './bundler'; @@ -32,8 +32,8 @@ const EXTENSIONS = ['.js', '.ts', '.json']; const debug = makeDebug('ember-auto-import:webpack'); -registerHelper('js-string-escape', jsStringEscape); -registerHelper('join', function (list, connector) { +Handlebars.registerHelper('js-string-escape', jsStringEscape); +Handlebars.registerHelper('join', function (list, connector) { return list.join(connector); }); @@ -56,9 +56,9 @@ function idToModule(id: string) { return moduleIdMap.get(id) ?? id; } -registerHelper('module-to-id', moduleToId); +Handlebars.registerHelper('module-to-id', moduleToId); -const entryTemplate = compile( +const entryTemplate = Handlebars.compile( ` module.exports = (function(){ var d = _eai_d; @@ -441,7 +441,7 @@ export default class WebpackBundler extends Plugin implements Bundler { return callback(undefined, 'commonjs ' + request); } } catch (err) { - if (err.code !== 'MODULE_NOT_FOUND') { + if ((err as NodeJS.ErrnoException).code !== 'MODULE_NOT_FOUND') { throw err; } // real package doesn't exist, so externalize it diff --git a/test-scenarios/package.json b/test-scenarios/package.json index df37a2c5..0f3165ff 100644 --- a/test-scenarios/package.json +++ b/test-scenarios/package.json @@ -5,7 +5,7 @@ "dependencies": { "@types/qunit": "^2.11.1", "qunit": "^2.6.1", - "ts-node": "^9.1.1", + "ts-node": "^10.9.2", "scenario-tester": "^2.1.2", "jsdom": "^11.11.0" },