From da42d46b9119ae9c17ee53ae902cfd5b2cf30cbd Mon Sep 17 00:00:00 2001 From: Simon Ihmig Date: Tue, 11 Jun 2024 11:55:10 +0200 Subject: [PATCH 01/51] Hide base path from public URL of rollup-public-assets --- packages/addon-dev/src/rollup-public-assets.ts | 2 +- tests/scenarios/v2-addon-dev-test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/addon-dev/src/rollup-public-assets.ts b/packages/addon-dev/src/rollup-public-assets.ts index 10aabb5bbf..10c6d7655a 100644 --- a/packages/addon-dev/src/rollup-public-assets.ts +++ b/packages/addon-dev/src/rollup-public-assets.ts @@ -51,7 +51,7 @@ export default function publicAssets( }); const publicAssets: Record = filenames.reduce( (acc: Record, v): Record => { - const namespace = opts?.namespace ?? join(pkg.name, path); + const namespace = opts?.namespace ?? pkg.name; acc[`./${path}/${v}`] = resolve('/' + join(namespace, v)); return acc; diff --git a/tests/scenarios/v2-addon-dev-test.ts b/tests/scenarios/v2-addon-dev-test.ts index b0928e0bb5..52d6ad05b5 100644 --- a/tests/scenarios/v2-addon-dev-test.ts +++ b/tests/scenarios/v2-addon-dev-test.ts @@ -393,7 +393,7 @@ export { SingleFileComponent as default }; let expectNoNamespaceFile = expectFilesAt(inDependency(app, 'v2-addon-no-namespace').dir, { qunit: assert }); expectFile('package.json').json('ember-addon.public-assets').deepEquals({ - './public/thing.txt': '/v2-addon/public/thing.txt', + './public/thing.txt': '/v2-addon/thing.txt', }); expectNoNamespaceFile('package.json').json('ember-addon.public-assets').deepEquals({ './public/other.txt': '/other.txt', From 19ab9db361fa5ba81651bd21e232e278f113023d Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Fri, 30 Aug 2024 15:08:35 -0400 Subject: [PATCH 02/51] Implement ember's component-template-resolving deprecation When using embroider with staticComponents enabled, users will never see Ember's [component-template-resolving](https://deprecations.emberjs.com/id/component-template-resolving/) deprecation, since Embroider takes care of implementing the whole feature at build time before Ember can see it at runtime. This implements the same deprecation logic in Embroider apps so everybody can stay consistent. --- packages/core/package.json | 2 ++ packages/core/src/module-resolver.ts | 17 +++++++++++++++++ packages/core/src/virtual-content.ts | 16 ++++++++++++++++ pnpm-lock.yaml | 9 ++++++--- 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index 63989b0c8d..299b931128 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -42,6 +42,7 @@ "lodash": "^4.17.21", "resolve": "^1.20.0", "resolve-package-path": "^4.0.1", + "semver": "^7.3.5", "typescript-memoize": "^1.0.1", "walk-sync": "^3.0.0" }, @@ -59,6 +60,7 @@ "@types/lodash": "^4.14.170", "@types/node": "^15.12.2", "@types/resolve": "^1.20.0", + "@types/semver": "^7.3.5", "@types/tmp": "^0.1.0", "fixturify": "^2.1.1", "tmp": "^0.1.0", diff --git a/packages/core/src/module-resolver.ts b/packages/core/src/module-resolver.ts index 386feafd3e..0ee58822b5 100644 --- a/packages/core/src/module-resolver.ts +++ b/packages/core/src/module-resolver.ts @@ -24,6 +24,7 @@ import { Memoize } from 'typescript-memoize'; import { describeExports } from './describe-exports'; import { readFileSync } from 'fs'; import type UserOptions from './options'; +import { satisfies } from 'semver'; const debug = makeDebug('embroider:resolver'); function logTransition(reason: string, before: R, after: R = before): R { @@ -513,6 +514,11 @@ export class Resolver { } if (hbsModule) { + if (!this.emberVersionSupportsSeparateTemplates) { + throw new Error( + `Components with separately resolved templates were removed at Ember 6.0. Migrate to either co-located js/ts + hbs files or to gjs/gts. https://deprecations.emberjs.com/id/component-template-resolving/. Bad template was: ${hbsModule}.` + ); + } return logTransition( `resolveComponent found legacy HBS`, request, @@ -723,6 +729,17 @@ export class Resolver { return owningEngine; } + get emberVersion(): string { + return this.packageCache.get(this.options.engines[0].root).dependencies.find(d => d.name === 'ember-source')! + .version; + } + + @Memoize() get emberVersionSupportsSeparateTemplates(): boolean { + return satisfies(this.emberVersion, '< 6.0.0-alpha.0', { + includePrerelease: true, + }); + } + private handleRewrittenPackages(request: R): R { if (request.isVirtual) { return request; diff --git a/packages/core/src/virtual-content.ts b/packages/core/src/virtual-content.ts index 63afd4a4bf..14cf9c0443 100644 --- a/packages/core/src/virtual-content.ts +++ b/packages/core/src/virtual-content.ts @@ -67,6 +67,22 @@ function renderESExternalShim({ moduleName, exports }: { moduleName: string; exp const pairedComponentShim = compile(` import { setComponentTemplate } from "@ember/component"; import template from "{{{js-string-escape relativeHBSModule}}}"; +import { deprecate } from "@ember/debug"; + + +deprecate("Components with separately resolved templates are deprecated. Migrate to either co-located js/ts + hbs files or to gjs/gts. Tried to lookup '{{debugName}}'.", + false, { + id: 'component-template-resolving', + url: 'https://deprecations.emberjs.com/id/component-template-resolving', + until: '6.0.0', + for: 'ember-source', + since: { + available: '5.10.0', + enabled: '5.10.0', + }, + } +); + {{#if relativeJSModule}} import component from "{{{js-string-escape relativeJSModule}}}"; export default setComponentTemplate(template, component); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 465b972a4e..8b89f0b586 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -421,6 +421,9 @@ importers: resolve-package-path: specifier: ^4.0.1 version: 4.0.3 + semver: + specifier: ^7.3.5 + version: 7.6.2 typescript-memoize: specifier: ^1.0.1 version: 1.1.1 @@ -467,6 +470,9 @@ importers: '@types/resolve': specifier: ^1.20.0 version: 1.20.6 + '@types/semver': + specifier: ^7.3.5 + version: 7.5.8 '@types/tmp': specifier: ^0.1.0 version: 0.1.0 @@ -8899,9 +8905,6 @@ packages: /ajv-formats@2.1.1: resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==} - peerDependenciesMeta: - ajv: - optional: true dependencies: ajv: 8.16.0 From 00bdcd2f69f457022e5d81685e8b02de92c26657 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Fri, 20 Sep 2024 14:37:18 -0400 Subject: [PATCH 03/51] update core resolver tests --- tests/scenarios/core-resolver-test.ts | 92 +++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/tests/scenarios/core-resolver-test.ts b/tests/scenarios/core-resolver-test.ts index c4fa429a7d..885fd0a542 100644 --- a/tests/scenarios/core-resolver-test.ts +++ b/tests/scenarios/core-resolver-test.ts @@ -13,6 +13,8 @@ const { module: Qmodule, test } = QUnit; Scenarios.fromProject(() => new Project()) .map('core-resolver-test', app => { + app.linkDevDependency('ember-source', { baseDir: __dirname }); + let appMeta: AppMeta = { type: 'app', version: 2, @@ -182,6 +184,21 @@ Scenarios.fromProject(() => new Project()) pairModule.codeEquals(` import { setComponentTemplate } from "@ember/component"; import template from "../hello-world.hbs"; + import { deprecate } from "@ember/debug"; + deprecate( + "Components with separately resolved templates are deprecated. Migrate to either co-located js/ts + hbs files or to gjs/gts. Tried to lookup 'hello-world'.", + false, + { + id: "component-template-resolving", + url: "https://deprecations.emberjs.com/id/component-template-resolving", + until: "6.0.0", + for: "ember-source", + since: { + available: "5.10.0", + enabled: "5.10.0", + }, + } + ); import component from "../../../components/hello-world.js"; export default setComponentTemplate(template, component); `); @@ -206,6 +223,21 @@ Scenarios.fromProject(() => new Project()) pairModule.codeEquals(` import { setComponentTemplate } from "@ember/component"; import template from "../hello-world.hbs"; + import { deprecate } from "@ember/debug"; + deprecate( + "Components with separately resolved templates are deprecated. Migrate to either co-located js/ts + hbs files or to gjs/gts. Tried to lookup 'hello-world'.", + false, + { + id: "component-template-resolving", + url: "https://deprecations.emberjs.com/id/component-template-resolving", + until: "6.0.0", + for: "ember-source", + since: { + available: "5.10.0", + enabled: "5.10.0", + }, + } + ); import templateOnlyComponent from "@ember/component/template-only"; export default setComponentTemplate(template, templateOnlyComponent(undefined, "hello-world")); `); @@ -304,6 +336,21 @@ Scenarios.fromProject(() => new Project()) pairModule.codeEquals(` import { setComponentTemplate } from "@ember/component"; import template from "../template.hbs"; + import { deprecate } from "@ember/debug"; + deprecate( + "Components with separately resolved templates are deprecated. Migrate to either co-located js/ts + hbs files or to gjs/gts. Tried to lookup 'template'.", + false, + { + id: "component-template-resolving", + url: "https://deprecations.emberjs.com/id/component-template-resolving", + until: "6.0.0", + for: "ember-source", + since: { + available: "5.10.0", + enabled: "5.10.0", + }, + } + ); import templateOnlyComponent from "@ember/component/template-only"; export default setComponentTemplate(template, templateOnlyComponent(undefined, "template")); `); @@ -327,6 +374,21 @@ Scenarios.fromProject(() => new Project()) pairModule.codeEquals(` import { setComponentTemplate } from "@ember/component"; import template from "../template.hbs"; + import { deprecate } from "@ember/debug"; + deprecate( + "Components with separately resolved templates are deprecated. Migrate to either co-located js/ts + hbs files or to gjs/gts. Tried to lookup 'template'.", + false, + { + id: "component-template-resolving", + url: "https://deprecations.emberjs.com/id/component-template-resolving", + until: "6.0.0", + for: "ember-source", + since: { + available: "5.10.0", + enabled: "5.10.0", + }, + } + ); import templateOnlyComponent from "@ember/component/template-only"; export default setComponentTemplate(template, templateOnlyComponent(undefined, "template")); `); @@ -351,6 +413,21 @@ Scenarios.fromProject(() => new Project()) pairModule.codeEquals(` import { setComponentTemplate } from "@ember/component"; import template from "../template.hbs"; + import { deprecate } from "@ember/debug"; + deprecate( + "Components with separately resolved templates are deprecated. Migrate to either co-located js/ts + hbs files or to gjs/gts. Tried to lookup 'template'.", + false, + { + id: "component-template-resolving", + url: "https://deprecations.emberjs.com/id/component-template-resolving", + until: "6.0.0", + for: "ember-source", + since: { + available: "5.10.0", + enabled: "5.10.0", + }, + } + ); import component from "../component.js"; export default setComponentTemplate(template, component); `); @@ -376,6 +453,21 @@ Scenarios.fromProject(() => new Project()) pairModule.codeEquals(` import { setComponentTemplate } from "@ember/component"; import template from "../template.hbs"; + import { deprecate } from "@ember/debug"; + deprecate( + "Components with separately resolved templates are deprecated. Migrate to either co-located js/ts + hbs files or to gjs/gts. Tried to lookup 'template'.", + false, + { + id: "component-template-resolving", + url: "https://deprecations.emberjs.com/id/component-template-resolving", + until: "6.0.0", + for: "ember-source", + since: { + available: "5.10.0", + enabled: "5.10.0", + }, + } + ); import component from "../component.js"; export default setComponentTemplate(template, component); `); From 47e1e038331b9e6136f962a5501c4570059774d9 Mon Sep 17 00:00:00 2001 From: patrickpircher Date: Fri, 20 Sep 2024 23:27:13 +0200 Subject: [PATCH 04/51] backport #1855 addon-dev: incremental updates to output --- packages/addon-dev/package.json | 3 +- packages/addon-dev/src/rollup-gjs-plugin.ts | 4 +- packages/addon-dev/src/rollup-hbs-plugin.ts | 144 +++++++------- .../src/rollup-incremental-plugin.ts | 79 ++++++++ packages/addon-dev/src/rollup.ts | 12 +- packages/shared-internals/src/colocation.ts | 39 ++++ packages/shared-internals/src/index.ts | 1 + pnpm-lock.yaml | 49 +---- tests/scenarios/v2-addon-dev-watch-test.ts | 180 +++++++++++++++++- 9 files changed, 386 insertions(+), 125 deletions(-) create mode 100644 packages/addon-dev/src/rollup-incremental-plugin.ts create mode 100644 packages/shared-internals/src/colocation.ts diff --git a/packages/addon-dev/package.json b/packages/addon-dev/package.json index d30c35fbaf..fb89e63678 100644 --- a/packages/addon-dev/package.json +++ b/packages/addon-dev/package.json @@ -40,7 +40,6 @@ "fs-extra": "^10.0.0", "minimatch": "^3.0.4", "rollup-plugin-copy-assets": "^2.0.3", - "rollup-plugin-delete": "^2.0.0", "walk-sync": "^3.0.0", "yargs": "^17.0.1" }, @@ -52,7 +51,7 @@ "@types/yargs": "^17.0.3", "rollup": "^3.23.0", "tmp": "^0.1.0", - "typescript": "^5.1.6" + "typescript": "^5.4.5" }, "engines": { "node": "12.* || 14.* || >= 16" diff --git a/packages/addon-dev/src/rollup-gjs-plugin.ts b/packages/addon-dev/src/rollup-gjs-plugin.ts index af90405bd6..375f9dce5d 100644 --- a/packages/addon-dev/src/rollup-gjs-plugin.ts +++ b/packages/addon-dev/src/rollup-gjs-plugin.ts @@ -1,6 +1,5 @@ import { createFilter } from '@rollup/pluginutils'; import type { Plugin } from 'rollup'; -import { readFileSync } from 'fs'; import { Preprocessor } from 'content-tag'; const PLUGIN_NAME = 'rollup-gjs-plugin'; @@ -14,11 +13,10 @@ export default function rollupGjsPlugin( return { name: PLUGIN_NAME, - load(id: string) { + transform(input: string, id: string) { if (!gjsFilter(id)) { return null; } - let input = readFileSync(id, 'utf8'); let code = processor.process(input, { filename: id, inline_source_map, diff --git a/packages/addon-dev/src/rollup-hbs-plugin.ts b/packages/addon-dev/src/rollup-hbs-plugin.ts index db35a35fd7..a0841511bc 100644 --- a/packages/addon-dev/src/rollup-hbs-plugin.ts +++ b/packages/addon-dev/src/rollup-hbs-plugin.ts @@ -1,8 +1,15 @@ +import type { Plugin, PluginContext } from 'rollup'; import { createFilter } from '@rollup/pluginutils'; -import type { Plugin, PluginContext, CustomPluginOptions } from 'rollup'; -import { readFileSync } from 'fs'; -import { correspondingTemplate, hbsToJS } from '@embroider/core'; import minimatch from 'minimatch'; +import { + hbsToJS, + templateOnlyComponentSource, + needsSyntheticComponentJS, + syntheticJStoHBS, +} from '@embroider/core'; +import { extname } from 'path'; + +const hbsFilter = createFilter('**/*.hbs?([?]*)'); export default function rollupHbsPlugin({ excludeColocation, @@ -12,48 +19,88 @@ export default function rollupHbsPlugin({ return { name: 'rollup-hbs-plugin', async resolveId(source: string, importer: string | undefined, options) { + if (options.custom?.embroider?.isExtensionSearch) { + return null; + } + let resolution = await this.resolve(source, importer, { skipSelf: true, - ...options, }); - if (resolution) { - return resolution; - } else { - return maybeSynthesizeComponentJS( - this, - source, - importer, - options, - excludeColocation + if (!resolution && extname(source) === '') { + resolution = await this.resolve(source + '.hbs', importer, { + skipSelf: true, + }); + } + + if (!resolution) { + let hbsSource = syntheticJStoHBS(source); + if (hbsSource) { + resolution = await this.resolve(hbsSource, importer, { + skipSelf: true, + custom: { + embroider: { + isExtensionSearch: true, + }, + }, + }); + } + + if (!resolution) { + return null; + } + } + + if (resolution && resolution.id.endsWith('.hbs')) { + let isExcluded = excludeColocation?.some((glob) => + minimatch(resolution!.id, glob) ); + if (isExcluded) { + return resolution; + } + } + + let syntheticId = needsSyntheticComponentJS(source, resolution.id); + if (syntheticId) { + this.addWatchFile(source); + return { + id: syntheticId, + meta: { + 'rollup-hbs-plugin': { + type: 'template-only-component-js', + }, + }, + }; } }, load(id: string) { - if (hbsFilter(id)) { - return getHbsToJSCode(id); - } - let meta = getMeta(this, id); - if (meta) { - if (meta?.type === 'template-js') { - const hbsFile = id.replace(/\.js$/, '.hbs'); - return getHbsToJSCode(hbsFile); - } + if (getMeta(this, id)?.type === 'template-only-component-js') { + this.addWatchFile(id); return { - code: templateOnlyComponent, + code: templateOnlyComponentSource(), }; } }, + + transform(code: string, id: string) { + let hbsFilename = id.replace(/\.\w{1,3}$/, '') + '.hbs'; + if (hbsFilename !== id) { + this.addWatchFile(hbsFilename); + if (getMeta(this, id)?.type === 'template-only-component-js') { + this.addWatchFile(id); + } + } + if (!hbsFilter(id)) { + return null; + } + return hbsToJS(code); + }, }; } -const templateOnlyComponent = - `import templateOnly from '@ember/component/template-only';\n` + - `export default templateOnly();\n`; - type Meta = { - type: 'template-only-component-js' | 'template-js'; + type: 'template-only-component-js'; }; function getMeta(context: PluginContext, id: string): Meta | null { @@ -64,44 +111,3 @@ function getMeta(context: PluginContext, id: string): Meta | null { return null; } } - -function getHbsToJSCode(file: string): { code: string } { - let input = readFileSync(file, 'utf8'); - let code = hbsToJS(input); - return { - code, - }; -} - -async function maybeSynthesizeComponentJS( - context: PluginContext, - source: string, - importer: string | undefined, - options: { custom?: CustomPluginOptions; isEntry: boolean }, - excludeColocation: string[] | undefined -) { - let hbsFilename = correspondingTemplate(source); - let templateResolution = await context.resolve(hbsFilename, importer, { - skipSelf: true, - ...options, - }); - if (!templateResolution) { - return null; - } - let type = excludeColocation?.some((glob) => minimatch(hbsFilename, glob)) - ? 'template-js' - : 'template-only-component-js'; - // we're trying to resolve a JS module but only the corresponding HBS - // file exists. Synthesize the JS. The meta states if the hbs corresponds - // to a template-only component or a simple template like a route template. - return { - id: templateResolution.id.replace(/\.hbs$/, '.js'), - meta: { - 'rollup-hbs-plugin': { - type, - }, - }, - }; -} - -const hbsFilter = createFilter('**/*.hbs'); diff --git a/packages/addon-dev/src/rollup-incremental-plugin.ts b/packages/addon-dev/src/rollup-incremental-plugin.ts new file mode 100644 index 0000000000..19cca3033f --- /dev/null +++ b/packages/addon-dev/src/rollup-incremental-plugin.ts @@ -0,0 +1,79 @@ +import walkSync from 'walk-sync'; +import { rmSync } from 'fs'; +import { join } from 'path'; +import type { Plugin } from 'rollup'; +import { existsSync } from 'fs-extra'; + +export default function incremental(): Plugin { + const generatedAssets = new Map(); + const generatedFiles = new Set(); + + function isEqual(v1: string | Uint8Array, v2: string | Uint8Array): boolean { + if (typeof v1 === 'string' && typeof v2 === 'string') { + return v1 === v2; + } + if (Buffer.isBuffer(v1) && Buffer.isBuffer(v2)) { + return v1.equals(v2); + } + return false; + } + + let firstTime = true; + + function initGeneratedFiles(outDir: string) { + if (existsSync(outDir)) { + const files = walkSync(outDir, { + globs: ['*/**'], + directories: false, + }); + for (const file of files) { + generatedFiles.add(file); + } + } + } + + function deleteRemovedFiles(bundle: Record, outDir: string) { + for (const file of generatedFiles) { + if (!bundle[file]) { + generatedAssets.delete(file); + rmSync(join(outDir, file)); + } + } + generatedFiles.clear(); + for (const file of Object.keys(bundle)) { + generatedFiles.add(file); + } + } + + function syncFiles(bundle: Record) { + for (const checkKey of Object.keys(bundle)) { + if (bundle[checkKey]) { + let module = bundle[checkKey] as any; + let code = module.source || module.code; + if ( + generatedAssets.has(checkKey) && + isEqual(code, generatedAssets.get(checkKey)) + ) { + delete bundle[checkKey]; + } else { + generatedAssets.set(checkKey, code); + } + } + } + } + + return { + name: 'incremental', + generateBundle(options, bundle) { + if (firstTime) { + firstTime = false; + initGeneratedFiles(options.dir!); + } + if (existsSync(options.dir!)) { + deleteRemovedFiles(bundle, options.dir!); + } + + syncFiles(bundle); + }, + }; +} diff --git a/packages/addon-dev/src/rollup.ts b/packages/addon-dev/src/rollup.ts index 50d9f3bc85..ce035cc406 100644 --- a/packages/addon-dev/src/rollup.ts +++ b/packages/addon-dev/src/rollup.ts @@ -2,14 +2,13 @@ import { default as hbs } from './rollup-hbs-plugin'; import { default as gjs } from './rollup-gjs-plugin'; import { default as publicEntrypoints } from './rollup-public-entrypoints'; import { default as appReexports } from './rollup-app-reexports'; -import type { Options as DelOptions } from 'rollup-plugin-delete'; -import { default as clean } from 'rollup-plugin-delete'; import { default as keepAssets } from './rollup-keep-assets'; import { default as dependencies } from './rollup-addon-dependencies'; import { default as publicAssets, type PublicAssetsOptions, } from './rollup-public-assets'; +import { default as clean } from './rollup-incremental-plugin'; import type { Plugin } from 'rollup'; export class Addon { @@ -64,10 +63,11 @@ export class Addon { return gjs(options); } - // By default rollup does not clear the output directory between builds. This - // does that. - clean(options: DelOptions) { - return clean({ targets: `${this.#destDir}/*`, ...options }); + // this does incremental updates to the dist files and also deletes files that are not part of the generated bundle + // rollup already supports incremental transforms of files, + // this extends it to the dist files + clean() { + return clean(); } // V2 Addons are allowed to contain imports of .css files. This tells rollup diff --git a/packages/shared-internals/src/colocation.ts b/packages/shared-internals/src/colocation.ts new file mode 100644 index 0000000000..b83f11a9ad --- /dev/null +++ b/packages/shared-internals/src/colocation.ts @@ -0,0 +1,39 @@ +import { existsSync } from 'fs-extra'; +import { cleanUrl } from './paths'; +import { sep } from 'path'; + +export function syntheticJStoHBS(source: string): string | null { + // explicit js is the only case we care about here. Synthetic template JS is + // only ever JS (never TS or anything else). And extensionless imports are + // handled by the default resolving system doing extension search. + if (cleanUrl(source).endsWith('.js')) { + return source.replace(/.js(\?.*)?/, '.hbs$1'); + } + + return null; +} + +export function needsSyntheticComponentJS(requestedSpecifier: string, foundFile: string): string | null { + requestedSpecifier = cleanUrl(requestedSpecifier); + foundFile = cleanUrl(foundFile); + if ( + discoveredImplicitHBS(requestedSpecifier, foundFile) && + !foundFile.split(sep).join('/').endsWith('/template.hbs') && + !correspondingJSExists(foundFile) + ) { + return foundFile.slice(0, -3) + 'js'; + } + return null; +} + +function discoveredImplicitHBS(source: string, id: string): boolean { + return !source.endsWith('.hbs') && id.endsWith('.hbs'); +} + +function correspondingJSExists(id: string): boolean { + return ['js', 'ts'].some(ext => existsSync(id.slice(0, -3) + ext)); +} + +export function templateOnlyComponentSource() { + return `import templateOnly from '@ember/component/template-only';\nexport default templateOnly();\n`; +} diff --git a/packages/shared-internals/src/index.ts b/packages/shared-internals/src/index.ts index 2cb7f5b421..e6a9201ceb 100644 --- a/packages/shared-internals/src/index.ts +++ b/packages/shared-internals/src/index.ts @@ -25,3 +25,4 @@ export { export { locateEmbroiderWorkingDir } from './working-dir'; export * from './dep-validation'; +export * from './colocation'; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 465b972a4e..40c5d5afb7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -75,9 +75,6 @@ importers: rollup-plugin-copy-assets: specifier: ^2.0.3 version: 2.0.3(rollup@3.29.4) - rollup-plugin-delete: - specifier: ^2.0.0 - version: 2.0.0 walk-sync: specifier: ^3.0.0 version: 3.0.0 @@ -107,7 +104,7 @@ importers: specifier: ^0.1.0 version: 0.1.0 typescript: - specifier: ^5.1.6 + specifier: ^5.4.5 version: 5.5.3 packages/addon-shim: @@ -8896,6 +8893,7 @@ packages: dependencies: clean-stack: 2.2.0 indent-string: 4.0.0 + dev: true /ajv-formats@2.1.1: resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==} @@ -12270,20 +12268,6 @@ packages: is-descriptor: 1.0.3 isobject: 3.0.1 - /del@5.1.0: - resolution: {integrity: sha512-wH9xOVHnczo9jN2IW68BabcecVPxacIA3g/7z6vhSU/4stOKQzeCRK0yD0A24WiAAUJmmVpWqrERcTxnLo3AnA==} - engines: {node: '>=8'} - dependencies: - globby: 10.0.2 - graceful-fs: 4.2.11 - is-glob: 4.0.3 - is-path-cwd: 2.2.0 - is-path-inside: 3.0.3 - p-map: 3.0.0 - rimraf: 3.0.2 - slash: 3.0.0 - dev: false - /delayed-stream@1.0.0: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} @@ -18495,20 +18479,6 @@ packages: merge2: 1.4.1 slash: 3.0.0 - /globby@10.0.2: - resolution: {integrity: sha512-7dUi7RvCoT/xast/o/dLN53oqND4yk0nsHkhRgn9w65C4PofCLOoJ39iSOg+qVDdWQPIEj+eszMHQ+aLVwwQSg==} - engines: {node: '>=8'} - dependencies: - '@types/glob': 7.2.0 - array-union: 2.1.0 - dir-glob: 3.0.1 - fast-glob: 3.3.2 - glob: 7.2.3 - ignore: 5.3.1 - merge2: 1.4.1 - slash: 3.0.0 - dev: false - /globby@11.1.0: resolution: {integrity: sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==} engines: {node: '>=10'} @@ -18976,6 +18946,7 @@ packages: /indent-string@4.0.0: resolution: {integrity: sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==} engines: {node: '>=8'} + dev: true /indent-string@5.0.0: resolution: {integrity: sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==} @@ -19342,14 +19313,10 @@ packages: resolution: {integrity: sha512-2rRIahhZr2UWb45fIOuvZGpFtz0TyOZLf32KxBbSoUCeZR495zCKlWUKKUByk3geS2eAs7ZAABt0Y/Rx0GiQGA==} dev: true - /is-path-cwd@2.2.0: - resolution: {integrity: sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ==} - engines: {node: '>=6'} - dev: false - /is-path-inside@3.0.3: resolution: {integrity: sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==} engines: {node: '>=8'} + dev: true /is-plain-obj@1.1.0: resolution: {integrity: sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==} @@ -21774,6 +21741,7 @@ packages: engines: {node: '>=8'} dependencies: aggregate-error: 3.1.0 + dev: true /p-map@4.0.0: resolution: {integrity: sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==} @@ -22892,13 +22860,6 @@ packages: rollup: 3.29.4 dev: false - /rollup-plugin-delete@2.0.0: - resolution: {integrity: sha512-/VpLMtDy+8wwRlDANuYmDa9ss/knGsAgrDhM+tEwB1npHwNu4DYNmDfUL55csse/GHs9Q+SMT/rw9uiaZ3pnzA==} - engines: {node: '>=10'} - dependencies: - del: 5.1.0 - dev: false - /rollup-pluginutils@2.8.2: resolution: {integrity: sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==} dependencies: diff --git a/tests/scenarios/v2-addon-dev-watch-test.ts b/tests/scenarios/v2-addon-dev-watch-test.ts index 365e92110f..e57bd905d0 100644 --- a/tests/scenarios/v2-addon-dev-watch-test.ts +++ b/tests/scenarios/v2-addon-dev-watch-test.ts @@ -3,6 +3,7 @@ import { baseV2Addon } from './scenarios'; import type { PreparedApp } from 'scenario-tester'; import { Scenarios } from 'scenario-tester'; import fs from 'fs/promises'; +import { existsSync } from 'fs'; import QUnit from 'qunit'; import merge from 'lodash/merge'; import { DevWatcher, becomesModified, isNotModified } from './helpers'; @@ -51,6 +52,7 @@ Scenarios.fromProject(() => baseV2Addon()) plugins: [ addon.publicEntrypoints(['components/**/*.js']), addon.appReexports(['components/**/*.js']), + addon.gjs(), addon.hbs(), addon.dependencies(), addon.publicAssets('custom-public'), @@ -67,11 +69,13 @@ Scenarios.fromProject(() => baseV2Addon()) }, src: { components: { + 'test.gts': '', 'button.hbs': ` `, + 'other.hbs': '
', 'out.hbs': `{{yield}}`, 'demo.js': ` import Component from '@glimmer/component'; @@ -134,6 +138,181 @@ Scenarios.fromProject(() => baseV2Addon()) }); Qmodule('Watching the addon via rollup -c -w', function () { + Qmodule('files are correctly synced', function (hooks) { + let watcher: DevWatcher | null = null; + let demoHbs = ''; + let demoJs = ''; + let distPath = ''; + let distPathDemoComp = ''; + let srcPathOther = ''; + let distPathOther = ''; + let distAppReExportPathOther = ''; + + let origContent = ''; + let demoContent = ''; + let demoJsContent = ''; + + hooks.before(async () => { + demoHbs = path.join(addon.dir, 'src/components/demo.hbs'); + demoJs = path.join(addon.dir, 'src/components/demo.js'); + distPath = path.join(addon.dir, 'dist/components/test.js'); + distPathDemoComp = path.join(addon.dir, 'dist/components/demo.js'); + srcPathOther = path.join(addon.dir, 'src/components/other.hbs'); + distPathOther = path.join(addon.dir, 'dist/components/other.js'); + distAppReExportPathOther = path.join(addon.dir, 'dist/_app_/components/other.js'); + + origContent = (await fs.readFile(srcPathOther)).toString(); + demoContent = (await fs.readFile(demoHbs)).toString(); + demoJsContent = (await fs.readFile(demoJs)).toString(); + watcher = new DevWatcher(addon); + await watcher.start(); + }); + + hooks.after(async () => { + await watcher?.stop(); + }); + + test('deleting a component from src should delete it from dist', async function (assert) { + assert.strictEqual( + existsSync(distAppReExportPathOther), + true, + `Expected ${distAppReExportPathOther} to exist` + ); + + await fs.rm(srcPathOther); + await watcher?.nextBuild(); + assert.strictEqual( + existsSync(distAppReExportPathOther), + false, + `Expected ${distAppReExportPathOther} to be deleted` + ); + }); + + test('create a component in src should create it in dist', async function (assert) { + await fs.writeFile(srcPathOther, origContent); + await watcher?.nextBuild(); + assert.strictEqual( + existsSync(distAppReExportPathOther), + true, + `Expected ${distAppReExportPathOther} to exist` + ); + }); + + test('updating hbs modifies generated colocated js', async function (assert) { + await becomesModified({ + filePath: distPathDemoComp, + assert, + // Update a component + fn: async () => { + let someContent = await fs.readFile(demoHbs); + + // generally it's bad to introduce time dependencies to a test, but we need to wait long enough + // to guess for how long it'll take for the file system to update our file. + // + // the `stat` is measured in `ms`, so it's still pretty fast + await fs.writeFile(demoHbs, someContent + `\n`); + await aBit(10); + await watcher?.nextBuild(); + }, + }); + }); + + test('deleting hbs file updates dist component file', async function (assert) { + await becomesModified({ + filePath: distPathDemoComp, + assert, + // Update a component + fn: async () => { + // generally it's bad to introduce time dependencies to a test, but we need to wait long enough + // to guess for how long it'll take for the file system to update our file. + // + // the `stat` is measured in `ms`, so it's still pretty fast + await aBit(10); + await fs.rm(demoHbs); + await watcher?.nextBuild(); + }, + }); + }); + + test('updating hbs content should not update unrelated files', async function (assert) { + await fs.writeFile(demoHbs, demoContent); + await watcher?.nextBuild(); + + await isNotModified({ + filePath: distPath, + assert, + // Update a component + fn: async () => { + let someContent = await fs.readFile(demoHbs); + + // generally it's bad to introduce time dependencies to a test, but we need to wait long enough + // to guess for how long it'll take for the file system to update our file. + // + // the `stat` is measured in `ms`, so it's still pretty fast + await fs.writeFile(demoHbs, someContent + `\n\n`); + await aBit(10); + await watcher?.nextBuild(); + }, + }); + }); + + test('updating hbs content should not update resulting app re-exported component', async function (assert) { + distPath = path.join(addon.dir, 'dist/_app_/components/test.js'); + await isNotModified({ + filePath: distPath, + assert, + // Update a component + fn: async () => { + let someContent = await fs.readFile(demoHbs); + + // generally it's bad to introduce time dependencies to a test, but we need to wait long enough + // to guess for how long it'll take for the file system to update our file. + // + // the `stat` is measured in `ms`, so it's still pretty fast + await fs.writeFile(demoHbs, someContent + `\n`); + await aBit(10); + await watcher?.nextBuild(); + }, + }); + }); + + test('updating template only should update the dist output', async function (assert) { + await becomesModified({ + filePath: distPathOther, + assert, + // Update a component + fn: async () => { + await aBit(100); + let someContent = await fs.readFile(srcPathOther); + + // generally it's bad to introduce time dependencies to a test, but we need to wait long enough + // to guess for how long it'll take for the file system to update our file. + // + // the `stat` is measured in `ms`, so it's still pretty fast + await fs.writeFile(srcPathOther, someContent + `test\n`); + await aBit(10); + await watcher?.nextBuild(); + }, + }); + }); + + test('deleting demo.js should make demo a template only component', async function (assert) { + await aBit(100); + await fs.rm(demoJs); + await watcher?.nextBuild(); + let distPathDemoCompContent = await fs.readFile(distPathDemoComp); + assert.true(distPathDemoCompContent.includes('templateOnly')); + }); + + test('creating demo.js should make demo a template colocated component', async function (assert) { + await aBit(100); + void fs.writeFile(demoJs, demoJsContent); + await watcher?.nextBuild(); + let distPathDemoCompContent = await fs.readFile(distPathDemoComp); + assert.false(distPathDemoCompContent.includes('templateOnly')); + }); + }); + test('the package.json is not updated since it would be the same', async function (assert) { watcher = new DevWatcher(addon); @@ -166,7 +345,6 @@ Scenarios.fromProject(() => baseV2Addon()) await watcher.start(); let manifestPath = path.join(addon.dir, 'package.json'); - await becomesModified({ filePath: manifestPath, assert, From ab4875ae2e1e0e5afc515824c0dcaa7c1990faa6 Mon Sep 17 00:00:00 2001 From: ef4 <319282+ef4@users.noreply.github.com> Date: Fri, 20 Sep 2024 22:33:27 +0000 Subject: [PATCH 05/51] Prepare Release using 'release-plan' --- .release-plan.json | 64 +++++--------------------------------- CHANGELOG.md | 11 +++++++ packages/core/package.json | 2 +- 3 files changed, 20 insertions(+), 57 deletions(-) diff --git a/.release-plan.json b/.release-plan.json index b952ce76ff..d6f01ed835 100644 --- a/.release-plan.json +++ b/.release-plan.json @@ -10,33 +10,16 @@ "oldVersion": "3.1.1" }, "@embroider/compat": { - "impact": "patch", - "oldVersion": "3.6.0", - "newVersion": "3.6.1", - "constraints": [ - { - "impact": "patch", - "reason": "Has dependency `workspace:*` on @embroider/macros" - }, - { - "impact": "patch", - "reason": "Appears in changelog section :bug: Bug Fix" - } - ], - "pkgJSONPath": "./packages/compat/package.json" + "oldVersion": "3.6.1" }, "@embroider/core": { "impact": "patch", - "oldVersion": "3.4.14", - "newVersion": "3.4.15", + "oldVersion": "3.4.15", + "newVersion": "3.4.16", "constraints": [ { "impact": "patch", - "reason": "Has dependency `workspace:*` on @embroider/shared-internals" - }, - { - "impact": "patch", - "reason": "Has dependency `workspace:*` on @embroider/macros" + "reason": "Appears in changelog section :bug: Bug Fix" } ], "pkgJSONPath": "./packages/core/package.json" @@ -45,16 +28,7 @@ "oldVersion": "3.0.3" }, "@embroider/macros": { - "impact": "patch", - "oldVersion": "1.16.5", - "newVersion": "1.16.6", - "constraints": [ - { - "impact": "patch", - "reason": "Has dependency `workspace:*` on @embroider/shared-internals" - } - ], - "pkgJSONPath": "./packages/macros/package.json" + "oldVersion": "1.16.6" }, "@embroider/reverse-exports": { "oldVersion": "0.1.0" @@ -63,16 +37,7 @@ "oldVersion": "2.1.8" }, "@embroider/shared-internals": { - "impact": "patch", - "oldVersion": "2.6.2", - "newVersion": "2.6.3", - "constraints": [ - { - "impact": "patch", - "reason": "Appears in changelog section :bug: Bug Fix" - } - ], - "pkgJSONPath": "./packages/shared-internals/package.json" + "oldVersion": "2.6.3" }, "@embroider/test-setup": { "oldVersion": "4.0.0" @@ -84,21 +49,8 @@ "oldVersion": "0.2.0" }, "@embroider/webpack": { - "impact": "patch", - "oldVersion": "4.0.4", - "newVersion": "4.0.5", - "constraints": [ - { - "impact": "patch", - "reason": "Has dependency `workspace:*` on @embroider/shared-internals" - }, - { - "impact": "patch", - "reason": "Appears in changelog section :house: Internal" - } - ], - "pkgJSONPath": "./packages/webpack/package.json" + "oldVersion": "4.0.5" } }, - "description": "## Release (2024-08-30)\n\n@embroider/compat 3.6.1 (patch)\n@embroider/core 3.4.15 (patch)\n@embroider/macros 1.16.6 (patch)\n@embroider/shared-internals 2.6.3 (patch)\n@embroider/webpack 4.0.5 (patch)\n\n#### :bug: Bug Fix\n* `@embroider/shared-internals`\n * [#2075](https://github.com/embroider-build/embroider/pull/2075) Update ember standard modules to include @ember/renderer and @ember/-internals and ember-testing ([@NullVoxPopuli](https://github.com/NullVoxPopuli))\n* `@embroider/compat`\n * [#2067](https://github.com/embroider-build/embroider/pull/2067) codemod fixes ([@void-mAlex](https://github.com/void-mAlex))\n\n#### :memo: Documentation\n* [#2055](https://github.com/embroider-build/embroider/pull/2055) document templateTagCodemod usage ([@void-mAlex](https://github.com/void-mAlex))\n\n#### :house: Internal\n* `@embroider/webpack`\n * [#2076](https://github.com/embroider-build/embroider/pull/2076) [Stable]: Follow upstream type change from webpack ([@NullVoxPopuli](https://github.com/NullVoxPopuli))\n* Other\n * [#2058](https://github.com/embroider-build/embroider/pull/2058) Set the packageManager field ([@NullVoxPopuli](https://github.com/NullVoxPopuli))\n\n#### Committers: 2\n- Alex ([@void-mAlex](https://github.com/void-mAlex))\n- [@NullVoxPopuli](https://github.com/NullVoxPopuli)\n" + "description": "## Release (2024-09-20)\n\n@embroider/core 3.4.16 (patch)\n\n#### :bug: Bug Fix\n* `@embroider/core`, `@embroider/test-scenarios`\n * [#2088](https://github.com/embroider-build/embroider/pull/2088) Implement ember's component-template-resolving deprecation ([@ef4](https://github.com/ef4))\n\n#### Committers: 1\n- Edward Faulkner ([@ef4](https://github.com/ef4))\n" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ffd05cd24..efec08c5b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ # Embroider Changelog +## Release (2024-09-20) + +@embroider/core 3.4.16 (patch) + +#### :bug: Bug Fix +* `@embroider/core`, `@embroider/test-scenarios` + * [#2088](https://github.com/embroider-build/embroider/pull/2088) Implement ember's component-template-resolving deprecation ([@ef4](https://github.com/ef4)) + +#### Committers: 1 +- Edward Faulkner ([@ef4](https://github.com/ef4)) + ## Release (2024-08-30) @embroider/compat 3.6.1 (patch) diff --git a/packages/core/package.json b/packages/core/package.json index 299b931128..b78f0b0cd3 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@embroider/core", - "version": "3.4.15", + "version": "3.4.16", "private": false, "description": "A build system for EmberJS applications.", "repository": { From 4128db483527d0ba1331d3d595ac12bb0e4713e5 Mon Sep 17 00:00:00 2001 From: Patrick Pircher Date: Fri, 20 Sep 2024 23:43:20 +0200 Subject: [PATCH 06/51] speedup windows ci on stable --- .github/workflows/ci.yml | 3 +++ packages/shared-internals/src/paths.ts | 2 +- tests/scenarios/compat-renaming-test.ts | 6 +++--- tests/scenarios/core-resolver-test.ts | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b67ebc2d8c..bec14ff65f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -52,6 +52,9 @@ jobs: - uses: ./.github/actions/setup with: use_lockfile: false + - name: Work around windows short path alias # https://github.com/actions/runner-images/issues/712 + if: runner.os == 'Windows' + run: new-item D:\temp -ItemType Directory; echo "TEMP=D:\temp" >> $env:GITHUB_ENV - name: suite run: ${{ matrix.command }} working-directory: ${{ matrix.dir }} diff --git a/packages/shared-internals/src/paths.ts b/packages/shared-internals/src/paths.ts index 5d5ea6dbef..84797443f5 100644 --- a/packages/shared-internals/src/paths.ts +++ b/packages/shared-internals/src/paths.ts @@ -12,7 +12,7 @@ export function explicitRelative(fromDir: string, toFile: string) { if (!isAbsolute(result) && !result.startsWith('.')) { result = './' + result; } - if (isAbsolute(toFile) && result.endsWith(toFile)) { + if (isAbsolute(toFile) && result.split(sep).join('/').endsWith(toFile)) { // this prevents silly "relative" paths like // "../../../../../Users/you/projects/your/stuff" when we could have just // said "/Users/you/projects/your/stuff". The silly path isn't incorrect, diff --git a/tests/scenarios/compat-renaming-test.ts b/tests/scenarios/compat-renaming-test.ts index 70b2c69853..eea1ae7269 100644 --- a/tests/scenarios/compat-renaming-test.ts +++ b/tests/scenarios/compat-renaming-test.ts @@ -1,7 +1,7 @@ import type { PreparedApp } from 'scenario-tester'; import { appScenarios, baseAddon } from './scenarios'; import QUnit from 'qunit'; -import { resolve, sep } from 'path'; +import { resolve } from 'path'; const { module: Qmodule, test } = QUnit; import type { ExpectFile } from '@embroider/test-support/file-assertions/qunit'; @@ -238,12 +238,12 @@ appScenarios expectAudit .module('./components/import-somebody-elses-original.js') .resolves('somebody-elses-package') - .to(resolve('/@embroider/ext-cjs/somebody-elses-package').split(sep).join('/')); + .to('/@embroider/ext-cjs/somebody-elses-package'); expectAudit .module('./components/import-somebody-elses-original.js') .resolves('somebody-elses-package/deeper') - .to(resolve('/@embroider/ext-cjs/somebody-elses-package/deeper').split(sep).join('/')); + .to('/@embroider/ext-cjs/somebody-elses-package/deeper'); }); test('single file package gets captured and renamed', function () { expectAudit diff --git a/tests/scenarios/core-resolver-test.ts b/tests/scenarios/core-resolver-test.ts index c4fa429a7d..cab82f709c 100644 --- a/tests/scenarios/core-resolver-test.ts +++ b/tests/scenarios/core-resolver-test.ts @@ -1,6 +1,6 @@ import type { AddonMeta, AppMeta, RewrittenPackageIndex } from '@embroider/shared-internals'; import { outputFileSync, readJsonSync, writeJSONSync } from 'fs-extra'; -import { resolve, sep } from 'path'; +import { resolve } from 'path'; import QUnit from 'qunit'; import type { PreparedApp } from 'scenario-tester'; import { Project, Scenarios } from 'scenario-tester'; @@ -609,7 +609,7 @@ Scenarios.fromProject(() => new Project()) 'app.js': `import "rsvp"`, }); await configure({}); - expectAudit.module('./app.js').resolves('rsvp').to(resolve('/@embroider/ext-cjs/rsvp').split(sep).join('/')); + expectAudit.module('./app.js').resolves('rsvp').to('/@embroider/ext-cjs/rsvp'); }); test(`known ember-source-provided virtual packages are not externalized when explicitly included in deps`, async function () { From 2036122d2147e47aa68a45e5965029eb5cf6c143 Mon Sep 17 00:00:00 2001 From: Patrick Pircher Date: Sat, 21 Sep 2024 00:22:40 +0200 Subject: [PATCH 07/51] fix --- tests/scenarios/compat-renaming-test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/scenarios/compat-renaming-test.ts b/tests/scenarios/compat-renaming-test.ts index eea1ae7269..6918e75f0b 100644 --- a/tests/scenarios/compat-renaming-test.ts +++ b/tests/scenarios/compat-renaming-test.ts @@ -1,7 +1,6 @@ import type { PreparedApp } from 'scenario-tester'; import { appScenarios, baseAddon } from './scenarios'; import QUnit from 'qunit'; -import { resolve } from 'path'; const { module: Qmodule, test } = QUnit; import type { ExpectFile } from '@embroider/test-support/file-assertions/qunit'; From 3f1ae3311b3d510f1e83a3e7d87ebbe59d634f6d Mon Sep 17 00:00:00 2001 From: patrickpircher Date: Fri, 20 Sep 2024 16:57:53 +0200 Subject: [PATCH 08/51] fix gts in v1 addon --- packages/compat/src/v1-addon.ts | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/packages/compat/src/v1-addon.ts b/packages/compat/src/v1-addon.ts index 3425db2579..6d6bfc4727 100644 --- a/packages/compat/src/v1-addon.ts +++ b/packages/compat/src/v1-addon.ts @@ -116,9 +116,10 @@ export default class V1Addon { @Memoize() private get templateCompilerBabelPlugin(): PluginItem | undefined { let plugins = loadAstPlugins(this.addonInstance.registry); + let hasTemplateTag = this.addonInstance.addons.find((a: any) => a.name === 'ember-template-imports'); // our macros don't run here in stage1 plugins = plugins.filter((p: any) => !isEmbroiderMacrosPlugin(p)); - if (plugins.length > 0) { + if (plugins.length > 0 || hasTemplateTag) { let compilerPath = require.resolve('ember-source/dist/ember-template-compiler.js', { paths: [findTopmostAddon(this.addonInstance).parent.root], }); @@ -205,6 +206,34 @@ export default class V1Addon { // the older inline template compiler is present return true; } + if (this.addonInstance.addons.find((a: any) => a.name === 'ember-template-imports')) { + /** + * Stage1 will always run custom broccoli preprocessors. So that's enough to convert: + * + * import Thing from './thing'; + * + * to + * + * import Thing from './thing'; + * import { template } from '@ember/template-compiler'; + * export default template("Thing", { + * eval: function() { return eval(arguments[0]) } }) + * }); + * This is really all we need to do at stage1, since this is now valid Javascript that could appear in a v2 addon. + * + * But if the addon is also using TS, we also need to run the typescript transform before it will be valid JS. And if the typescript transform was being truly correct it would not try to delete the import because the eval can see the imported binding. That's why we have an eval. It's a standards-compliant want of gaining access to everything in scope. + * + * Normally we only use babel-plugin-ember-template-compilation in stage1 to run custom AST transforms. Since there are none in the addon, we don't add it. The fix here is helping because there is a new reason to add it. It will further convert the above example to: + * + * import Thing from './thing'; + * import { template } from '@ember/template-compiler'; + * export default template("Thing", { + * scope: () => ({ Thing }) + * }); + * which typescript then respects. + */ + return true; + } if ( this.addonInstance.addons.find( From d8ee8dbcbea01e07422d0345ce8f2d0fb51f1839 Mon Sep 17 00:00:00 2001 From: patrick Date: Wed, 25 Sep 2024 11:58:22 +0200 Subject: [PATCH 09/51] add test --- pnpm-lock.yaml | 15 ++++- tests/scenarios/compat-stage2-test.ts | 80 +++++++++++++++++++++++++++ tests/scenarios/package.json | 1 + 3 files changed, 95 insertions(+), 1 deletion(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 465b972a4e..cc7320fd56 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1759,6 +1759,9 @@ importers: ember-source-latest: specifier: npm:ember-source@latest version: /ember-source@5.9.0(@babel/core@7.24.7) + ember-template-imports: + specifier: ^4.1.2 + version: 4.1.2 ember-truth-helpers: specifier: ^3.0.0 version: 3.1.1 @@ -11828,7 +11831,6 @@ packages: /content-tag@2.0.1: resolution: {integrity: sha512-jxsETSDs5NbNwyiDuIp672fUMhUyu8Qxc5MOBOJOcgW/fQESI6o5K1LBDrnEE7Bh810a685lWEZHTF4jQYGEEw==} - dev: false /content-type@1.0.5: resolution: {integrity: sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==} @@ -16358,6 +16360,17 @@ packages: - supports-color dev: true + /ember-template-imports@4.1.2: + resolution: {integrity: sha512-6A7s+9QlmKkkpTkI0VGDFqyX+HrAsHQKB32VB/vbj/ITTDN/l/CCtEfvN4/LANKoG5yAvbg6q9wzcOjK9XwmWw==} + engines: {node: 16.* || >= 18} + dependencies: + broccoli-stew: 3.0.0 + content-tag: 2.0.1 + ember-cli-version-checker: 5.1.2 + transitivePeerDependencies: + - supports-color + dev: true + /ember-template-lint@3.16.0: resolution: {integrity: sha512-hbP4JefkOLx9tMkrZ3UIvdBNoEnrT7rg6c70tIxpB9F+KpPneDbmpGMBsQVhhK4BirTXIFwAIfnwKcwkIk3bPQ==} engines: {node: '>= 10.24 < 11 || 12.* || >= 14.*'} diff --git a/tests/scenarios/compat-stage2-test.ts b/tests/scenarios/compat-stage2-test.ts index b34999c095..8928ec823b 100644 --- a/tests/scenarios/compat-stage2-test.ts +++ b/tests/scenarios/compat-stage2-test.ts @@ -253,6 +253,86 @@ stage2Scenarios }); }); +stage2Scenarios + .map('gts-files-in-addons-are-pre-processed-with-template-compilation', app => { + let depA = addAddon(app, 'dep-a'); + depA.linkDependency('ember-template-imports', { baseDir: __dirname }); + depA.linkDependency('ember-cli-babel', { baseDir: __dirname, resolveName: 'ember-cli-babel-latest' }); + + merge(depA.files, { + 'index.js': ` + 'use strict'; + module.exports = { + name: require('./package').name, + options: { + 'ember-cli-babel': { enableTypeScriptTransform: true }, + }, + };`, + addon: { + components: { + 'other.gts': ` + import Component from '@glimmer/component'; + + export default class extends Component { + abc: string; + + }; + `, + 'gts-component.gts': ` + import Component from '@glimmer/component'; + import OtherComponent from './other'; + + export default class extends Component { + abc: string; + + }; + `, + }, + }, + app: { + components: { + 'gts-component.js': 'export { default } from "dep-a/components/gts-component"', + }, + }, + }); + }) + .forEachScenario(scenario => { + Qmodule(scenario.name, function (hooks) { + throwOnWarnings(hooks); + + let app: PreparedApp; + + hooks.before(async assert => { + app = await scenario.prepare(); + let result = await app.execute('ember build', { env: { STAGE2_ONLY: 'true' } }); + assert.equal(result.exitCode, 0, result.output); + }); + + let expectAudit = setupAuditTest(hooks, () => ({ app: app.dir, 'reuse-build': true })); + + test('no audit issues', function () { + expectAudit.hasNoFindings(); + }); + + test('gts is processed with template-compilation', function () { + let expectModule = expectAudit.module('./assets/my-app.js'); + // this is to make sure that the babel plugin template compilation runs and thus + // make imports that are only used in templates bound and not removed by typescript + expectModule + .resolves('my-app/components/gts-component.js') + .toModule() + .resolves('dep-a/components/gts-component') + .toModule() + .codeContains(`import OtherComponent from './other';`); + }); + }); + }); + stage2Scenarios .map('static-with-rules', app => { app.addDependency('some-library', '1.0.0'); diff --git a/tests/scenarios/package.json b/tests/scenarios/package.json index 6f037cc7f0..b7843b677a 100644 --- a/tests/scenarios/package.json +++ b/tests/scenarios/package.json @@ -94,6 +94,7 @@ "ember-source-canary": "https://s3.amazonaws.com/builds.emberjs.com/canary/shas/756f0e3f98b8ca5edf443fe57318b4dac692bffa.tgz", "ember-source-latest": "npm:ember-source@latest", "ember-truth-helpers": "^3.0.0", + "ember-template-imports": "^4.1.2", "execa": "^5.1.1", "popper.js": "^1.16.1", "tslib": "^2.6.0", From 67d1e0fb23ae7b74cb9b5b5d6e089848c006433f Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Wed, 25 Sep 2024 11:19:59 -0400 Subject: [PATCH 10/51] Bump jsdom to fix punycode deprecation messages from tr46 and whatwg-url --- packages/compat/package.json | 2 +- packages/core/package.json | 2 +- packages/vite/package.json | 2 +- packages/webpack/package.json | 2 +- tests/scenarios/package.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/compat/package.json b/packages/compat/package.json index 1dc447ea99..795fbb1fe8 100644 --- a/packages/compat/package.json +++ b/packages/compat/package.json @@ -54,7 +54,7 @@ "fast-sourcemap-concat": "^2.1.1", "fs-extra": "^9.1.0", "fs-tree-diff": "^2.0.1", - "jsdom": "^16.6.0", + "jsdom": "^25.0.0", "lodash": "^4.17.21", "pkg-up": "^3.1.0", "resolve": "^1.20.0", diff --git a/packages/core/package.json b/packages/core/package.json index b78f0b0cd3..0a20749e8a 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -38,7 +38,7 @@ "fs-tree-diff": "^2.0.1", "handlebars": "^4.7.7", "js-string-escape": "^1.0.1", - "jsdom": "^16.6.0", + "jsdom": "^25.0.0", "lodash": "^4.17.21", "resolve": "^1.20.0", "resolve-package-path": "^4.0.1", diff --git a/packages/vite/package.json b/packages/vite/package.json index 6d2daa3eb9..1ef4e29132 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -15,7 +15,7 @@ "content-tag": "^2.0.1", "debug": "^4.3.2", "fs-extra": "^10.0.0", - "jsdom": "^16.6.0", + "jsdom": "^25.0.0", "source-map-url": "^0.4.1", "terser": "^5.7.0" }, diff --git a/packages/webpack/package.json b/packages/webpack/package.json index e35b793ef4..5b84b6f2f7 100644 --- a/packages/webpack/package.json +++ b/packages/webpack/package.json @@ -31,7 +31,7 @@ "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "fs-extra": "^9.1.0", - "jsdom": "^16.6.0", + "jsdom": "^25.0.0", "lodash": "^4.17.21", "mini-css-extract-plugin": "^2.5.3", "semver": "^7.3.5", diff --git a/tests/scenarios/package.json b/tests/scenarios/package.json index 6f037cc7f0..e72a5373a8 100644 --- a/tests/scenarios/package.json +++ b/tests/scenarios/package.json @@ -15,7 +15,7 @@ "fs-extra": "^10.0.0", "globby": "^11.0.3", "js-yaml": "^4.1.0", - "jsdom": "^16.2.2", + "jsdom": "^25.0.0", "lodash": "^4.17.20", "qunit": "^2.16.0", "resolve": "^1.20.0", From 0409bfe41cec13baed1c598553bed60dd9f712a2 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Wed, 25 Sep 2024 11:37:48 -0400 Subject: [PATCH 11/51] Update lockfile --- pnpm-lock.yaml | 351 +++++++++++++++++++++++++++---------------------- 1 file changed, 192 insertions(+), 159 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index eda2993746..a0c683eca8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -247,8 +247,8 @@ importers: specifier: ^2.0.1 version: 2.0.1 jsdom: - specifier: ^16.6.0 - version: 16.7.0(supports-color@8.1.1) + specifier: ^25.0.0 + version: 25.0.1(supports-color@8.1.1) lodash: specifier: ^4.17.21 version: 4.17.21 @@ -407,8 +407,8 @@ importers: specifier: ^1.0.1 version: 1.0.1 jsdom: - specifier: ^16.6.0 - version: 16.7.0(supports-color@8.1.1) + specifier: ^25.0.0 + version: 25.0.1(supports-color@8.1.1) lodash: specifier: ^4.17.21 version: 4.17.21 @@ -929,8 +929,8 @@ importers: specifier: ^10.0.0 version: 10.1.0 jsdom: - specifier: ^16.6.0 - version: 16.7.0(supports-color@8.1.1) + specifier: ^25.0.0 + version: 25.0.1(supports-color@8.1.1) source-map-url: specifier: ^0.4.1 version: 0.4.1 @@ -999,8 +999,8 @@ importers: specifier: ^9.1.0 version: 9.1.0 jsdom: - specifier: ^16.6.0 - version: 16.7.0(supports-color@8.1.1) + specifier: ^25.0.0 + version: 25.0.1(supports-color@8.1.1) lodash: specifier: ^4.17.21 version: 4.17.21 @@ -1555,8 +1555,8 @@ importers: specifier: ^4.1.0 version: 4.1.0 jsdom: - specifier: ^16.2.2 - version: 16.7.0(supports-color@8.1.1) + specifier: ^25.0.0 + version: 25.0.1(supports-color@8.1.1) lodash: specifier: ^4.17.20 version: 4.17.21 @@ -7958,6 +7958,7 @@ packages: /@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==} @@ -8878,7 +8879,7 @@ packages: engines: {node: '>=0.4.0'} hasBin: true - /agent-base@6.0.2(supports-color@8.1.1): + /agent-base@6.0.2: resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} engines: {node: '>= 6.0.0'} dependencies: @@ -8886,6 +8887,15 @@ packages: transitivePeerDependencies: - supports-color + /agent-base@7.1.1(supports-color@8.1.1): + resolution: {integrity: sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==} + engines: {node: '>= 14'} + dependencies: + debug: 4.3.5(supports-color@8.1.1) + transitivePeerDependencies: + - supports-color + dev: false + /agentkeepalive@4.5.0: resolution: {integrity: sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==} engines: {node: '>= 8.0.0'} @@ -12057,10 +12067,6 @@ packages: /cssom@0.3.8: resolution: {integrity: sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg==} - /cssom@0.4.4: - resolution: {integrity: sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw==} - dev: false - /cssom@0.5.0: resolution: {integrity: sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==} @@ -12070,6 +12076,13 @@ packages: dependencies: cssom: 0.3.8 + /cssstyle@4.1.0: + resolution: {integrity: sha512-h66W1URKpBS5YMI/V8PyXvTMFT8SupJ1IzoIV8IeBC/ji8WVmrO8dGlTi+2dh6whmdk6BiKJLD/ZBkhWbcg6nA==} + engines: {node: '>=18'} + dependencies: + rrweb-cssom: 0.7.1 + dev: false + /dag-map@2.0.2: resolution: {integrity: sha512-xnsprIzYuDeiyu5zSKwilV/ajRHxnoMlAhEREfyfTgTSViMVY2fGP1ZcHJbtwup26oCkofySU/m6oKJ3HrkW7w==} @@ -12077,15 +12090,6 @@ packages: resolution: {integrity: sha512-ND9qDTLc6diwj+Xe5cdAgVTbLVdXbtxTJRXRhli8Mowuaan+0EJOtdqJ0QCHNSSPyoXGx9HX2/VMnKeC34AChA==} dev: false - /data-urls@2.0.0: - resolution: {integrity: sha512-X5eWTSXO/BJmpdIKCRuKUgSCgAN0OwliVK3yPKbwIWU1Tdw5BRajxlzMidvh+gwko9AfQ9zIj52pzF91Q3YAvQ==} - engines: {node: '>=10'} - dependencies: - abab: 2.0.6 - whatwg-mimetype: 2.3.0 - whatwg-url: 8.7.0 - dev: false - /data-urls@3.0.2: resolution: {integrity: sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ==} engines: {node: '>=12'} @@ -12094,6 +12098,14 @@ packages: whatwg-mimetype: 3.0.0 whatwg-url: 11.0.0 + /data-urls@5.0.0: + resolution: {integrity: sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==} + engines: {node: '>=18'} + dependencies: + whatwg-mimetype: 4.0.0 + whatwg-url: 14.0.0 + dev: false + /data-view-buffer@1.0.1: resolution: {integrity: sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA==} engines: {node: '>= 0.4'} @@ -12375,14 +12387,6 @@ packages: resolution: {integrity: sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==} dev: true - /domexception@2.0.1: - resolution: {integrity: sha512-yxJ2mFy/sibVQlu5qHjOkf9J3K6zgmCxgJ94u2EdvDOV09H+32LtRswEcUsmUWN72pVLOEnTSRaIVVzVQgS0dg==} - engines: {node: '>=8'} - deprecated: Use your platform's native DOMException instead - dependencies: - webidl-conversions: 5.0.0 - dev: false - /domexception@4.0.0: resolution: {integrity: sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==} engines: {node: '>=12'} @@ -16610,6 +16614,11 @@ packages: engines: {node: '>=0.12'} dev: true + /entities@4.5.0: + resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} + engines: {node: '>=0.12'} + dev: false + /err-code@2.0.3: resolution: {integrity: sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==} dev: true @@ -18010,15 +18019,6 @@ packages: signal-exit: 4.1.0 dev: true - /form-data@3.0.1: - resolution: {integrity: sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==} - engines: {node: '>= 6'} - dependencies: - asynckit: 0.4.0 - combined-stream: 1.0.8 - mime-types: 2.1.35 - dev: false - /form-data@4.0.0: resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} engines: {node: '>= 6'} @@ -18767,19 +18767,19 @@ packages: lru-cache: 10.3.0 dev: true - /html-encoding-sniffer@2.0.1: - resolution: {integrity: sha512-D5JbOMBIR/TVZkubHT+OyT2705QvogUW4IBn6nHd756OwieSF9aDYFj4dv6HHEVGYbHaLETa3WggZYWWMyy3ZQ==} - engines: {node: '>=10'} - dependencies: - whatwg-encoding: 1.0.5 - dev: false - /html-encoding-sniffer@3.0.0: resolution: {integrity: sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==} engines: {node: '>=12'} dependencies: whatwg-encoding: 2.0.0 + /html-encoding-sniffer@4.0.0: + resolution: {integrity: sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==} + engines: {node: '>=18'} + dependencies: + whatwg-encoding: 3.1.1 + dev: false + /html-escaper@2.0.2: resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==} dev: true @@ -18819,26 +18819,37 @@ packages: /http-parser-js@0.5.8: resolution: {integrity: sha512-SGeBX54F94Wgu5RH3X5jsDtf4eHyRogWX1XGT3b4HuW3tQPM4AaBzoUji/4AAJNXCEOWZ5O0DgZmJw1947gD5Q==} - /http-proxy-agent@4.0.1(supports-color@8.1.1): + /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(supports-color@8.1.1) + agent-base: 6.0.2 debug: 4.3.5(supports-color@8.1.1) transitivePeerDependencies: - supports-color + dev: true /http-proxy-agent@5.0.0: resolution: {integrity: sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==} engines: {node: '>= 6'} dependencies: '@tootallnate/once': 2.0.0 - agent-base: 6.0.2(supports-color@8.1.1) + agent-base: 6.0.2 debug: 4.3.5(supports-color@8.1.1) transitivePeerDependencies: - supports-color + /http-proxy-agent@7.0.2(supports-color@8.1.1): + resolution: {integrity: sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==} + engines: {node: '>= 14'} + dependencies: + agent-base: 7.1.1(supports-color@8.1.1) + debug: 4.3.5(supports-color@8.1.1) + transitivePeerDependencies: + - supports-color + dev: false + /http-proxy@1.18.1: resolution: {integrity: sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==} engines: {node: '>=8.0.0'} @@ -18849,14 +18860,24 @@ packages: transitivePeerDependencies: - debug - /https-proxy-agent@5.0.1(supports-color@8.1.1): + /https-proxy-agent@5.0.1: resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==} engines: {node: '>= 6'} dependencies: - agent-base: 6.0.2(supports-color@8.1.1) + agent-base: 6.0.2 + debug: 4.3.5(supports-color@8.1.1) + transitivePeerDependencies: + - supports-color + + /https-proxy-agent@7.0.5(supports-color@8.1.1): + resolution: {integrity: sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==} + engines: {node: '>= 14'} + dependencies: + agent-base: 7.1.1(supports-color@8.1.1) debug: 4.3.5(supports-color@8.1.1) transitivePeerDependencies: - supports-color + dev: false /https@1.0.0: resolution: {integrity: sha512-4EC57ddXrkaF0x83Oj8sM6SLQHAWXw90Skqu2M4AEWENZ3F02dFJE/GARA8igO79tcgYqGrD7ae4f5L3um2lgg==} @@ -20016,48 +20037,6 @@ packages: resolution: {integrity: sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==} dev: true - /jsdom@16.7.0(supports-color@8.1.1): - resolution: {integrity: sha512-u9Smc2G1USStM+s/x1ru5Sxrl6mPYCbByG1U/hUmqaVsm4tbNyS7CicOSRyuGQYZhTu0h84qkZZQ/I+dzizSVw==} - engines: {node: '>=10'} - peerDependencies: - canvas: ^2.5.0 - peerDependenciesMeta: - canvas: - optional: true - dependencies: - abab: 2.0.6 - acorn: 8.12.1 - acorn-globals: 6.0.0 - cssom: 0.4.4 - cssstyle: 2.3.0 - data-urls: 2.0.0 - decimal.js: 10.4.3 - domexception: 2.0.1 - escodegen: 2.1.0 - form-data: 3.0.1 - html-encoding-sniffer: 2.0.1 - http-proxy-agent: 4.0.1(supports-color@8.1.1) - https-proxy-agent: 5.0.1(supports-color@8.1.1) - is-potential-custom-element-name: 1.0.1 - nwsapi: 2.2.10 - parse5: 6.0.1 - saxes: 5.0.1 - symbol-tree: 3.2.4 - tough-cookie: 4.1.4 - w3c-hr-time: 1.0.2 - w3c-xmlserializer: 2.0.0 - webidl-conversions: 6.1.0 - whatwg-encoding: 1.0.5 - whatwg-mimetype: 2.3.0 - whatwg-url: 8.7.0 - ws: 7.5.10 - xml-name-validator: 3.0.0 - transitivePeerDependencies: - - bufferutil - - supports-color - - utf-8-validate - dev: false - /jsdom@19.0.0: resolution: {integrity: sha512-RYAyjCbxy/vri/CfnjUWJQQtZ3LKlLnDqj+9XLNnJPgEGeirZs3hllKR20re8LUZ6o1b1X4Jat+Qd26zmP41+A==} engines: {node: '>=12'} @@ -20079,7 +20058,7 @@ packages: form-data: 4.0.0 html-encoding-sniffer: 3.0.0 http-proxy-agent: 5.0.0 - https-proxy-agent: 5.0.1(supports-color@8.1.1) + https-proxy-agent: 5.0.1 is-potential-custom-element-name: 1.0.1 nwsapi: 2.2.10 parse5: 6.0.1 @@ -20099,6 +20078,42 @@ packages: - supports-color - utf-8-validate + /jsdom@25.0.1(supports-color@8.1.1): + resolution: {integrity: sha512-8i7LzZj7BF8uplX+ZyOlIz86V6TAsSs+np6m1kpW9u0JWi4z/1t+FzcK1aek+ybTnAC4KhBL4uXCNT0wcUIeCw==} + engines: {node: '>=18'} + peerDependencies: + canvas: ^2.11.2 + peerDependenciesMeta: + canvas: + optional: true + dependencies: + cssstyle: 4.1.0 + data-urls: 5.0.0 + decimal.js: 10.4.3 + form-data: 4.0.0 + html-encoding-sniffer: 4.0.0 + http-proxy-agent: 7.0.2(supports-color@8.1.1) + https-proxy-agent: 7.0.5(supports-color@8.1.1) + is-potential-custom-element-name: 1.0.1 + nwsapi: 2.2.12 + parse5: 7.1.2 + rrweb-cssom: 0.7.1 + saxes: 6.0.0 + symbol-tree: 3.2.4 + tough-cookie: 5.0.0 + w3c-xmlserializer: 5.0.0 + webidl-conversions: 7.0.0 + whatwg-encoding: 3.1.1 + whatwg-mimetype: 4.0.0 + whatwg-url: 14.0.0 + ws: 8.18.0 + xml-name-validator: 5.0.0 + transitivePeerDependencies: + - bufferutil + - supports-color + - utf-8-validate + dev: false + /jsesc@0.5.0: resolution: {integrity: sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==} hasBin: true @@ -20624,8 +20639,8 @@ packages: agentkeepalive: 4.5.0 cacache: 15.3.0 http-cache-semantics: 4.1.1 - http-proxy-agent: 4.0.1(supports-color@8.1.1) - https-proxy-agent: 5.0.1(supports-color@8.1.1) + http-proxy-agent: 4.0.1 + https-proxy-agent: 5.0.1 is-lambda: 1.0.1 lru-cache: 6.0.0 minipass: 3.3.6 @@ -21449,6 +21464,10 @@ packages: /nwsapi@2.2.10: resolution: {integrity: sha512-QK0sRs7MKv0tKe1+5uZIQk/C8XGza4DAnztJG8iD+TpJIORARrCxczA738awHrZoHeTjSSoHqao2teO0dC/gFQ==} + /nwsapi@2.2.12: + resolution: {integrity: sha512-qXDmcVlZV4XRtKFzddidpfVP4oMSGhga+xdMc25mv8kaLUHtgzCDhUxkrN8exkGdTlLNaXj7CV3GtON7zuGZ+w==} + dev: false + /object-assign@4.1.1: resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} engines: {node: '>=0.10.0'} @@ -21840,6 +21859,12 @@ packages: /parse5@6.0.1: resolution: {integrity: sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==} + /parse5@7.1.2: + resolution: {integrity: sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==} + dependencies: + entities: 4.5.0 + dev: false + /parseurl@1.3.3: resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} engines: {node: '>= 0.8'} @@ -22916,6 +22941,10 @@ packages: route-recognizer: 0.3.4 dev: true + /rrweb-cssom@0.7.1: + resolution: {integrity: sha512-TrEMa7JGdVm0UThDJSx7ddw5nVm3UJS9o9CCIZ72B1vSyEZoziDqBYP3XIoi/12lKrJR8rE3jeFHMok2F/Mnsg==} + dev: false + /rsvp@3.2.1: resolution: {integrity: sha512-Rf4YVNYpKjZ6ASAmibcwTNciQ5Co5Ztq6iZPEykHpkoflnD/K5ryE/rHehFsTm4NJj8nKDhbi3eKBWGogmNnkg==} @@ -23054,6 +23083,13 @@ packages: dependencies: xmlchars: 2.2.0 + /saxes@6.0.0: + resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==} + engines: {node: '>=v12.22.7'} + dependencies: + xmlchars: 2.2.0 + dev: false + /scenario-tester@2.1.2: resolution: {integrity: sha512-fuwZoavM2v3CyfghIc3gCi36vFDSzIAW1mdgxjUXVQIsoR0aTG657CMnwYAagIN8Aqn1Qt9oJMuqIpggOvybQg==} hasBin: true @@ -23366,7 +23402,7 @@ packages: resolution: {integrity: sha512-a6KW9G+6B3nWZ1yB8G7pJwL3ggLy1uTzKAgCb7ttblwqdz9fMGJUuTy3uFzEP48FAs9FLILlmzDlE2JJhVQaXQ==} engines: {node: '>= 10'} dependencies: - agent-base: 6.0.2(supports-color@8.1.1) + agent-base: 6.0.2 debug: 4.3.5(supports-color@8.1.1) socks: 2.8.3 transitivePeerDependencies: @@ -24240,6 +24276,17 @@ packages: transitivePeerDependencies: - supports-color + /tldts-core@6.1.47: + resolution: {integrity: sha512-6SWyFMnlst1fEt7GQVAAu16EGgFK0cLouH/2Mk6Ftlwhv3Ol40L0dlpGMcnnNiiOMyD2EV/aF3S+U2nKvvLvrA==} + dev: false + + /tldts@6.1.47: + resolution: {integrity: sha512-R/K2tZ5MiY+mVrnSkNJkwqYT2vUv1lcT6wJvd2emGaMJ7PHUGRY4e3tUsdFCXgqxi2QgbHjL3yJgXCo40v9Hxw==} + hasBin: true + dependencies: + tldts-core: 6.1.47 + dev: false + /tmp@0.0.28: resolution: {integrity: sha512-c2mmfiBmND6SOVxzogm1oda0OJ1HZVIk/5n26N59dDTh80MUeavpiCls4PGAdkX1PFkKokLpcf7prSjCeXLsJg==} engines: {node: '>=0.4.0'} @@ -24319,22 +24366,29 @@ packages: universalify: 0.2.0 url-parse: 1.5.10 - /tr46@0.0.3: - resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} - - /tr46@2.1.0: - resolution: {integrity: sha512-15Ih7phfcdP5YxqiB+iDtLoaTz4Nd35+IiAv0kQ5FNKHzXgdWqPoTIqEDDJmXceQt4JZk6lVPT8lnDlPpGDppw==} - engines: {node: '>=8'} + /tough-cookie@5.0.0: + resolution: {integrity: sha512-FRKsF7cz96xIIeMZ82ehjC3xW2E+O2+v11udrDYewUbszngYhsGa8z6YUMMzO9QJZzzyd0nGGXnML/TReX6W8Q==} + engines: {node: '>=16'} dependencies: - punycode: 2.3.1 + tldts: 6.1.47 dev: false + /tr46@0.0.3: + resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} + /tr46@3.0.0: resolution: {integrity: sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA==} engines: {node: '>=12'} dependencies: punycode: 2.3.1 + /tr46@5.0.0: + resolution: {integrity: sha512-tk2G5R2KRwBd+ZN0zaEXpmzdKyOYksXwywulIX95MBODjSzMIuQnQ3m8JxgbhnL1LeVo7lqQKsYa1O3Htl7K5g==} + engines: {node: '>=18'} + dependencies: + punycode: 2.3.1 + dev: false + /tracked-built-ins@3.3.0: resolution: {integrity: sha512-ewKFrW/AQs05oLPM5isOUb/1aOwBRfHfmF408CCzTk21FLAhKrKVOP5Q5ebX+zCT4kvg81PGBGwrBiEGND1nWA==} dependencies: @@ -24874,19 +24928,19 @@ packages: dependencies: browser-process-hrtime: 1.0.0 - /w3c-xmlserializer@2.0.0: - resolution: {integrity: sha512-4tzD0mF8iSiMiNs30BiLO3EpfGLZUT2MSX/G+o7ZywDzliWQ3OPtTZ0PTC3B3ca1UAf4cJMHB+2Bf56EriJuRA==} - engines: {node: '>=10'} - dependencies: - xml-name-validator: 3.0.0 - dev: false - /w3c-xmlserializer@3.0.0: resolution: {integrity: sha512-3WFqGEgSXIyGhOmAFtlicJNMjEps8b1MG31NCA0/vOF9+nKMUW1ckhi9cnNHmf88Rzw5V+dwIwsm2C7X8k9aQg==} engines: {node: '>=12'} dependencies: xml-name-validator: 4.0.0 + /w3c-xmlserializer@5.0.0: + resolution: {integrity: sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==} + engines: {node: '>=18'} + dependencies: + xml-name-validator: 5.0.0 + dev: false + /walk-sync@0.2.7: resolution: {integrity: sha512-OH8GdRMowEFr0XSHQeX5fGweO6zSVHo7bG/0yJQx6LAj9Oukz0C8heI3/FYectT66gY0IPGe89kOvU410/UNpg==} dependencies: @@ -24968,16 +25022,6 @@ packages: /webidl-conversions@3.0.1: resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} - /webidl-conversions@5.0.0: - resolution: {integrity: sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA==} - engines: {node: '>=8'} - dev: false - - /webidl-conversions@6.1.0: - resolution: {integrity: sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w==} - engines: {node: '>=10.4'} - dev: false - /webidl-conversions@7.0.0: resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==} engines: {node: '>=12'} @@ -25037,30 +25081,32 @@ packages: resolution: {integrity: sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==} engines: {node: '>=0.8.0'} - /whatwg-encoding@1.0.5: - resolution: {integrity: sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw==} - dependencies: - iconv-lite: 0.4.24 - dev: false - /whatwg-encoding@2.0.0: resolution: {integrity: sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==} engines: {node: '>=12'} dependencies: iconv-lite: 0.6.3 + /whatwg-encoding@3.1.1: + resolution: {integrity: sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==} + engines: {node: '>=18'} + dependencies: + iconv-lite: 0.6.3 + dev: false + /whatwg-fetch@3.6.20: resolution: {integrity: sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg==} dev: true - /whatwg-mimetype@2.3.0: - resolution: {integrity: sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g==} - dev: false - /whatwg-mimetype@3.0.0: resolution: {integrity: sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==} engines: {node: '>=12'} + /whatwg-mimetype@4.0.0: + resolution: {integrity: sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==} + engines: {node: '>=18'} + dev: false + /whatwg-url@10.0.0: resolution: {integrity: sha512-CLxxCmdUby142H5FZzn4D8ikO1cmypvXVQktsgosNy4a4BHrDHeciBBGZhb0bNoR5/MltoCatso+vFjjGx8t0w==} engines: {node: '>=12'} @@ -25075,21 +25121,20 @@ packages: tr46: 3.0.0 webidl-conversions: 7.0.0 + /whatwg-url@14.0.0: + resolution: {integrity: sha512-1lfMEm2IEr7RIV+f4lUNPOqfFL+pO+Xw3fJSqmjX9AbXcXcYOkCe1P6+9VBZB6n94af16NfZf+sSk0JCBZC9aw==} + engines: {node: '>=18'} + dependencies: + tr46: 5.0.0 + webidl-conversions: 7.0.0 + dev: false + /whatwg-url@5.0.0: resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} dependencies: tr46: 0.0.3 webidl-conversions: 3.0.1 - /whatwg-url@8.7.0: - resolution: {integrity: sha512-gAojqb/m9Q8a5IV96E3fHJM70AzCkgt4uXYX2O7EmuyOnLrViCQlsEBmF9UQIu3/aeAIp2U17rtbpZWNntQqdg==} - engines: {node: '>=10'} - dependencies: - lodash: 4.17.21 - tr46: 2.1.0 - webidl-conversions: 6.1.0 - dev: false - /which-boxed-primitive@1.0.2: resolution: {integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==} dependencies: @@ -25230,19 +25275,6 @@ packages: write-file-atomic: 5.0.1 dev: false - /ws@7.5.10: - resolution: {integrity: sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==} - engines: {node: '>=8.3.0'} - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: ^5.0.2 - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - dev: false - /ws@8.17.1: resolution: {integrity: sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==} engines: {node: '>=10.0.0'} @@ -25271,14 +25303,15 @@ packages: resolution: {integrity: sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==} engines: {node: '>=8'} - /xml-name-validator@3.0.0: - resolution: {integrity: sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==} - dev: false - /xml-name-validator@4.0.0: resolution: {integrity: sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==} engines: {node: '>=12'} + /xml-name-validator@5.0.0: + resolution: {integrity: sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==} + engines: {node: '>=18'} + dev: false + /xmlchars@2.2.0: resolution: {integrity: sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==} From 577d96632bff576dd6147a603b2f0a7d102e09a9 Mon Sep 17 00:00:00 2001 From: simonihmig <1325249+simonihmig@users.noreply.github.com> Date: Tue, 1 Oct 2024 08:06:42 +0000 Subject: [PATCH 12/51] Prepare Release using 'release-plan' --- .release-plan.json | 96 +++++++++++++++++++++++--- CHANGELOG.md | 29 ++++++++ packages/addon-dev/package.json | 2 +- packages/compat/package.json | 2 +- packages/core/package.json | 2 +- packages/macros/package.json | 2 +- packages/shared-internals/package.json | 2 +- packages/vite/package.json | 2 +- packages/webpack/package.json | 2 +- 9 files changed, 123 insertions(+), 16 deletions(-) diff --git a/.release-plan.json b/.release-plan.json index d6f01ed835..9760b71815 100644 --- a/.release-plan.json +++ b/.release-plan.json @@ -1,7 +1,20 @@ { "solution": { "@embroider/addon-dev": { - "oldVersion": "5.0.0" + "impact": "major", + "oldVersion": "5.0.0", + "newVersion": "6.0.0", + "constraints": [ + { + "impact": "major", + "reason": "Appears in changelog section :boom: Breaking Change" + }, + { + "impact": "minor", + "reason": "Appears in changelog section :rocket: Enhancement" + } + ], + "pkgJSONPath": "./packages/addon-dev/package.json" }, "@embroider/addon-shim": { "oldVersion": "1.8.9" @@ -10,13 +23,34 @@ "oldVersion": "3.1.1" }, "@embroider/compat": { - "oldVersion": "3.6.1" + "impact": "patch", + "oldVersion": "3.6.1", + "newVersion": "3.6.2", + "constraints": [ + { + "impact": "patch", + "reason": "Has dependency `workspace:*` on @embroider/macros" + }, + { + "impact": "patch", + "reason": "Appears in changelog section :bug: Bug Fix" + } + ], + "pkgJSONPath": "./packages/compat/package.json" }, "@embroider/core": { "impact": "patch", - "oldVersion": "3.4.15", - "newVersion": "3.4.16", + "oldVersion": "3.4.16", + "newVersion": "3.4.17", "constraints": [ + { + "impact": "patch", + "reason": "Has dependency `workspace:*` on @embroider/shared-internals" + }, + { + "impact": "patch", + "reason": "Has dependency `workspace:*` on @embroider/macros" + }, { "impact": "patch", "reason": "Appears in changelog section :bug: Bug Fix" @@ -28,7 +62,16 @@ "oldVersion": "3.0.3" }, "@embroider/macros": { - "oldVersion": "1.16.6" + "impact": "patch", + "oldVersion": "1.16.6", + "newVersion": "1.16.7", + "constraints": [ + { + "impact": "patch", + "reason": "Has dependency `workspace:*` on @embroider/shared-internals" + } + ], + "pkgJSONPath": "./packages/macros/package.json" }, "@embroider/reverse-exports": { "oldVersion": "0.1.0" @@ -37,7 +80,20 @@ "oldVersion": "2.1.8" }, "@embroider/shared-internals": { - "oldVersion": "2.6.3" + "impact": "minor", + "oldVersion": "2.6.3", + "newVersion": "2.7.0", + "constraints": [ + { + "impact": "minor", + "reason": "Appears in changelog section :rocket: Enhancement" + }, + { + "impact": "patch", + "reason": "Appears in changelog section :bug: Bug Fix" + } + ], + "pkgJSONPath": "./packages/shared-internals/package.json" }, "@embroider/test-setup": { "oldVersion": "4.0.0" @@ -46,11 +102,33 @@ "oldVersion": "1.13.2" }, "@embroider/vite": { - "oldVersion": "0.2.0" + "impact": "patch", + "oldVersion": "0.2.0", + "newVersion": "0.2.1", + "constraints": [ + { + "impact": "patch", + "reason": "Appears in changelog section :bug: Bug Fix" + } + ], + "pkgJSONPath": "./packages/vite/package.json" }, "@embroider/webpack": { - "oldVersion": "4.0.5" + "impact": "patch", + "oldVersion": "4.0.5", + "newVersion": "4.0.6", + "constraints": [ + { + "impact": "patch", + "reason": "Has dependency `workspace:*` on @embroider/shared-internals" + }, + { + "impact": "patch", + "reason": "Appears in changelog section :bug: Bug Fix" + } + ], + "pkgJSONPath": "./packages/webpack/package.json" } }, - "description": "## Release (2024-09-20)\n\n@embroider/core 3.4.16 (patch)\n\n#### :bug: Bug Fix\n* `@embroider/core`, `@embroider/test-scenarios`\n * [#2088](https://github.com/embroider-build/embroider/pull/2088) Implement ember's component-template-resolving deprecation ([@ef4](https://github.com/ef4))\n\n#### Committers: 1\n- Edward Faulkner ([@ef4](https://github.com/ef4))\n" + "description": "## Release (2024-10-01)\n\n@embroider/addon-dev 6.0.0 (major)\n@embroider/compat 3.6.2 (patch)\n@embroider/core 3.4.17 (patch)\n@embroider/macros 1.16.7 (patch)\n@embroider/shared-internals 2.7.0 (minor)\n@embroider/vite 0.2.1 (patch)\n@embroider/webpack 4.0.6 (patch)\n\n#### :boom: Breaking Change\n* `@embroider/addon-dev`, `@embroider/test-scenarios`\n * [#2082](https://github.com/embroider-build/embroider/pull/2082) Hide base path from public URL of rollup-public-assets ([@simonihmig](https://github.com/simonihmig))\n\n#### :rocket: Enhancement\n* `@embroider/addon-dev`, `@embroider/shared-internals`, `@embroider/test-scenarios`\n * [#2121](https://github.com/embroider-build/embroider/pull/2121) backport #1855 addon-dev: incremental updates to output ([@patricklx](https://github.com/patricklx))\n\n#### :bug: Bug Fix\n* `@embroider/compat`, `@embroider/core`, `@embroider/vite`, `@embroider/webpack`, `@embroider/test-scenarios`\n * [#2127](https://github.com/embroider-build/embroider/pull/2127) Bump jsdom to fix punycode deprecation messages from tr46, psl, and whatwg-url ([@NullVoxPopuli](https://github.com/NullVoxPopuli))\n* `@embroider/shared-internals`, `@embroider/test-scenarios`\n * [#2122](https://github.com/embroider-build/embroider/pull/2122) speedup windows ci on stable ([@patricklx](https://github.com/patricklx))\n\n#### Committers: 3\n- Patrick Pircher ([@patricklx](https://github.com/patricklx))\n- Simon Ihmig ([@simonihmig](https://github.com/simonihmig))\n- [@NullVoxPopuli](https://github.com/NullVoxPopuli)\n" } diff --git a/CHANGELOG.md b/CHANGELOG.md index efec08c5b0..c8f480249d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,34 @@ # Embroider Changelog +## Release (2024-10-01) + +@embroider/addon-dev 6.0.0 (major) +@embroider/compat 3.6.2 (patch) +@embroider/core 3.4.17 (patch) +@embroider/macros 1.16.7 (patch) +@embroider/shared-internals 2.7.0 (minor) +@embroider/vite 0.2.1 (patch) +@embroider/webpack 4.0.6 (patch) + +#### :boom: Breaking Change +* `@embroider/addon-dev`, `@embroider/test-scenarios` + * [#2082](https://github.com/embroider-build/embroider/pull/2082) Hide base path from public URL of rollup-public-assets ([@simonihmig](https://github.com/simonihmig)) + +#### :rocket: Enhancement +* `@embroider/addon-dev`, `@embroider/shared-internals`, `@embroider/test-scenarios` + * [#2121](https://github.com/embroider-build/embroider/pull/2121) backport #1855 addon-dev: incremental updates to output ([@patricklx](https://github.com/patricklx)) + +#### :bug: Bug Fix +* `@embroider/compat`, `@embroider/core`, `@embroider/vite`, `@embroider/webpack`, `@embroider/test-scenarios` + * [#2127](https://github.com/embroider-build/embroider/pull/2127) Bump jsdom to fix punycode deprecation messages from tr46, psl, and whatwg-url ([@NullVoxPopuli](https://github.com/NullVoxPopuli)) +* `@embroider/shared-internals`, `@embroider/test-scenarios` + * [#2122](https://github.com/embroider-build/embroider/pull/2122) speedup windows ci on stable ([@patricklx](https://github.com/patricklx)) + +#### Committers: 3 +- Patrick Pircher ([@patricklx](https://github.com/patricklx)) +- Simon Ihmig ([@simonihmig](https://github.com/simonihmig)) +- [@NullVoxPopuli](https://github.com/NullVoxPopuli) + ## Release (2024-09-20) @embroider/core 3.4.16 (patch) diff --git a/packages/addon-dev/package.json b/packages/addon-dev/package.json index fb89e63678..5190fcf062 100644 --- a/packages/addon-dev/package.json +++ b/packages/addon-dev/package.json @@ -1,6 +1,6 @@ { "name": "@embroider/addon-dev", - "version": "5.0.0", + "version": "6.0.0", "description": "Utilities for addon authors", "repository": { "type": "git", diff --git a/packages/compat/package.json b/packages/compat/package.json index 795fbb1fe8..2f26ec6d9b 100644 --- a/packages/compat/package.json +++ b/packages/compat/package.json @@ -1,6 +1,6 @@ { "name": "@embroider/compat", - "version": "3.6.1", + "version": "3.6.2", "private": false, "description": "Backward compatibility layer for the Embroider build system.", "repository": { diff --git a/packages/core/package.json b/packages/core/package.json index 0a20749e8a..b3200a523b 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@embroider/core", - "version": "3.4.16", + "version": "3.4.17", "private": false, "description": "A build system for EmberJS applications.", "repository": { diff --git a/packages/macros/package.json b/packages/macros/package.json index 5811c48076..027ac6c56d 100644 --- a/packages/macros/package.json +++ b/packages/macros/package.json @@ -1,6 +1,6 @@ { "name": "@embroider/macros", - "version": "1.16.6", + "version": "1.16.7", "private": false, "description": "Standardized build-time macros for ember apps.", "keywords": [ diff --git a/packages/shared-internals/package.json b/packages/shared-internals/package.json index 032f4c48f2..b4e8580267 100644 --- a/packages/shared-internals/package.json +++ b/packages/shared-internals/package.json @@ -1,6 +1,6 @@ { "name": "@embroider/shared-internals", - "version": "2.6.3", + "version": "2.7.0", "private": false, "description": "Utilities shared among the other embroider packages", "repository": { diff --git a/packages/vite/package.json b/packages/vite/package.json index 1ef4e29132..728617db5e 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -1,6 +1,6 @@ { "name": "@embroider/vite", - "version": "0.2.0", + "version": "0.2.1", "main": "index.mjs", "peerDependencies": { "@embroider/core": "workspace:^", diff --git a/packages/webpack/package.json b/packages/webpack/package.json index 5b84b6f2f7..9e7c940977 100644 --- a/packages/webpack/package.json +++ b/packages/webpack/package.json @@ -1,6 +1,6 @@ { "name": "@embroider/webpack", - "version": "4.0.5", + "version": "4.0.6", "private": false, "description": "Builds EmberJS apps with Webpack", "repository": { From 65eabc659f5190d010b6827272f8e855e94ed106 Mon Sep 17 00:00:00 2001 From: void_malex Date: Tue, 1 Oct 2024 21:16:52 +0100 Subject: [PATCH 13/51] add @babel/plugin-syntax-typescript to support parsing ts syntax for template tag codemod --- packages/compat/package.json | 1 + pnpm-lock.yaml | 125 ++++++++++++++++++++--------------- 2 files changed, 74 insertions(+), 52 deletions(-) diff --git a/packages/compat/package.json b/packages/compat/package.json index 795fbb1fe8..e46c0ebaba 100644 --- a/packages/compat/package.json +++ b/packages/compat/package.json @@ -27,6 +27,7 @@ "@babel/core": "^7.14.5", "@babel/plugin-syntax-decorators": "^7.24.7", "@babel/plugin-syntax-dynamic-import": "^7.8.3", + "@babel/plugin-syntax-typescript": "^7.25.4", "@babel/plugin-transform-runtime": "^7.14.5", "@babel/preset-env": "^7.14.5", "@babel/runtime": "^7.18.6", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a0c683eca8..3a7daae03b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -165,6 +165,9 @@ importers: '@babel/plugin-syntax-dynamic-import': specifier: ^7.8.3 version: 7.8.3(@babel/core@7.24.7) + '@babel/plugin-syntax-typescript': + specifier: ^7.25.4 + version: 7.25.4(@babel/core@7.24.7) '@babel/plugin-transform-runtime': specifier: ^7.14.5 version: 7.24.7(@babel/core@7.24.7) @@ -2294,7 +2297,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-annotate-as-pure': 7.24.7 regexpu-core: 5.3.2 semver: 6.3.1 @@ -2405,6 +2408,11 @@ packages: resolution: {integrity: sha512-Rq76wjt7yz9AAc1KnlRKNAi/dMSVWgDRx43FHoJEbcYU6xOWaE2dVPwcdTukJrjxS65GITyfbvEYHvkirZ6uEg==} engines: {node: '>=6.9.0'} + /@babel/helper-plugin-utils@7.24.8: + resolution: {integrity: sha512-FFWx5142D8h2Mgr/iPVGH5G7w6jDn4jUSpZTyDnQO0Yn7Ks2Kuz6Pci8H6MPCoUJegd/UZQ3tAvfLCxQSnWWwg==} + engines: {node: '>=6.9.0'} + dev: false + /@babel/helper-remap-async-to-generator@7.24.7(@babel/core@7.24.7): resolution: {integrity: sha512-9pKLcTlZ92hNZMQfGCHImUpDOlAgkkpqalWEeftW5FBya75k8Li2ilerxkM/uBEj01iBZXcCIB/bwvDYgWyibA==} engines: {node: '>=6.9.0'} @@ -2535,7 +2543,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-environment-visitor': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 @@ -2545,7 +2553,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.24.7(@babel/core@7.24.7): @@ -2581,7 +2589,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-environment-visitor': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 @@ -2630,7 +2638,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 /@babel/plugin-proposal-private-property-in-object@7.21.11(@babel/core@7.24.7): resolution: {integrity: sha512-0QZ8qP/3RLDVBwBFoWAwCtgcDZJVwA5LUJRZU8x2YFfKNuFq161wK3cuGrALu5yiPu+vzwTAg/sMWVNeWeNyaw==} @@ -2652,7 +2660,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-syntax-bigint@7.8.3(@babel/core@7.24.7): @@ -2669,7 +2677,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-syntax-class-static-block@7.14.5(@babel/core@7.24.7): @@ -2678,7 +2686,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-syntax-decorators@7.24.7(@babel/core@7.24.7): @@ -2703,7 +2711,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-syntax-import-assertions@7.24.7(@babel/core@7.24.7): @@ -2712,7 +2720,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-syntax-import-attributes@7.24.7(@babel/core@7.24.7): @@ -2721,7 +2729,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-syntax-import-meta@7.10.4(@babel/core@7.24.7): @@ -2729,7 +2737,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-syntax-json-strings@7.8.3(@babel/core@7.24.7): @@ -2737,7 +2745,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-syntax-jsx@7.24.7(@babel/core@7.24.7): @@ -2755,7 +2763,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-syntax-nullish-coalescing-operator@7.8.3(@babel/core@7.24.7): @@ -2763,7 +2771,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-syntax-numeric-separator@7.10.4(@babel/core@7.24.7): @@ -2771,7 +2779,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-syntax-object-rest-spread@7.8.3(@babel/core@7.24.7): @@ -2779,7 +2787,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-syntax-optional-catch-binding@7.8.3(@babel/core@7.24.7): @@ -2787,7 +2795,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-syntax-optional-chaining@7.8.3(@babel/core@7.24.7): @@ -2804,7 +2812,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-syntax-top-level-await@7.14.5(@babel/core@7.24.7): @@ -2813,7 +2821,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-syntax-typescript@7.24.7(@babel/core@7.24.7): @@ -2825,13 +2833,23 @@ packages: '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 + /@babel/plugin-syntax-typescript@7.25.4(@babel/core@7.24.7): + resolution: {integrity: sha512-uMOCoHVU52BsSWxPOMVv5qKRdeSlPuImUCB2dlPuBSU+W2/ROE7/Zg8F2Kepbk+8yBa68LlRKxO+xgEVWorsDg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + dependencies: + '@babel/core': 7.24.7 + '@babel/helper-plugin-utils': 7.24.8 + dev: false + /@babel/plugin-syntax-unicode-sets-regex@7.18.6(@babel/core@7.24.7): resolution: {integrity: sha512-727YkEAPwSIQTv5im8QHz3upqp92JTWhidIC81Tdx4VJYIte/VndKf1qKrfnnhPLiPghStWfvC/iFaMCQu7Nqg==} engines: {node: '>=6.9.0'} peerDependencies: '@babel/core': ^7.0.0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-create-regexp-features-plugin': 7.24.7(@babel/core@7.24.7) '@babel/helper-plugin-utils': 7.24.7 @@ -2841,7 +2859,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-transform-async-generator-functions@7.24.7(@babel/core@7.24.7): @@ -2906,7 +2924,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-transform-block-scoping@7.24.7(@babel/core@7.24.7): @@ -3013,7 +3031,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 '@babel/template': 7.24.7 @@ -3023,7 +3041,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-transform-dotall-regex@7.24.7(@babel/core@7.24.7): @@ -3032,7 +3050,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-create-regexp-features-plugin': 7.24.7(@babel/core@7.24.7) '@babel/helper-plugin-utils': 7.24.7 @@ -3042,7 +3060,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-transform-dynamic-import@7.24.7(@babel/core@7.24.7): @@ -3051,7 +3069,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 '@babel/plugin-syntax-dynamic-import': 7.8.3(@babel/core@7.24.7) @@ -3086,7 +3104,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 '@babel/plugin-syntax-export-namespace-from': 7.8.3(@babel/core@7.24.7) @@ -3121,7 +3139,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-compilation-targets': 7.24.7 '@babel/helper-function-name': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 @@ -3132,7 +3150,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 '@babel/plugin-syntax-json-strings': 7.8.3(@babel/core@7.24.7) @@ -3142,7 +3160,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-transform-logical-assignment-operators@7.24.7(@babel/core@7.24.7): @@ -3151,7 +3169,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 '@babel/plugin-syntax-logical-assignment-operators': 7.10.4(@babel/core@7.24.7) @@ -3161,7 +3179,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-transform-modules-amd@7.24.7(@babel/core@7.24.7): @@ -3276,7 +3294,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-create-regexp-features-plugin': 7.24.7(@babel/core@7.24.7) '@babel/helper-plugin-utils': 7.24.7 @@ -3286,7 +3304,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-transform-nullish-coalescing-operator@7.24.7(@babel/core@7.24.7): @@ -3295,7 +3313,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 '@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3(@babel/core@7.24.7) @@ -3305,7 +3323,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 '@babel/plugin-syntax-numeric-separator': 7.10.4(@babel/core@7.24.7) @@ -3324,7 +3342,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-compilation-targets': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 '@babel/plugin-syntax-object-rest-spread': 7.8.3(@babel/core@7.24.7) @@ -3361,7 +3379,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 '@babel/plugin-syntax-optional-catch-binding': 7.8.3(@babel/core@7.24.7) @@ -3461,7 +3479,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-transform-regenerator@7.24.7(@babel/core@7.24.7): @@ -3470,7 +3488,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 regenerator-transform: 0.15.2 @@ -3480,7 +3498,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-transform-runtime@7.24.7(@babel/core@7.24.7): @@ -3505,7 +3523,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-transform-spread@7.24.7(@babel/core@7.24.7): @@ -3539,7 +3557,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-transform-template-literals@7.24.7(@babel/core@7.24.7): @@ -3548,7 +3566,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-transform-typeof-symbol@7.24.7(@babel/core@7.24.7): @@ -3557,7 +3575,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-transform-typescript@7.24.7(@babel/core@7.24.7): @@ -3602,7 +3620,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 /@babel/plugin-transform-unicode-property-regex@7.24.7(@babel/core@7.24.7): @@ -3611,7 +3629,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-create-regexp-features-plugin': 7.24.7(@babel/core@7.24.7) '@babel/helper-plugin-utils': 7.24.7 @@ -3621,7 +3639,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-create-regexp-features-plugin': 7.24.7(@babel/core@7.24.7) '@babel/helper-plugin-utils': 7.24.7 @@ -3631,7 +3649,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-create-regexp-features-plugin': 7.24.7(@babel/core@7.24.7) '@babel/helper-plugin-utils': 7.24.7 @@ -3830,7 +3848,7 @@ packages: peerDependencies: '@babel/core': ^7.0.0-0 || ^8.0.0-0 <8.0.0 dependencies: - '@babel/core': 7.24.7(supports-color@8.1.1) + '@babel/core': 7.24.7 '@babel/helper-plugin-utils': 7.24.7 '@babel/types': 7.24.7 esutils: 2.0.3 @@ -8913,6 +8931,9 @@ packages: /ajv-formats@2.1.1: resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==} + peerDependenciesMeta: + ajv: + optional: true dependencies: ajv: 8.16.0 From e3fa578844d49a639f7d20a38c70279bb6cb95b5 Mon Sep 17 00:00:00 2001 From: void_malex Date: Tue, 1 Oct 2024 21:20:24 +0100 Subject: [PATCH 14/51] enable ts support fix ambiguous import path replacement use byte positions to insert data in backing class to avoid reformatting code --- packages/compat/src/template-tag-codemod.ts | 146 ++++++++++++-------- 1 file changed, 92 insertions(+), 54 deletions(-) diff --git a/packages/compat/src/template-tag-codemod.ts b/packages/compat/src/template-tag-codemod.ts index 5e3a70476c..0b53bc310a 100644 --- a/packages/compat/src/template-tag-codemod.ts +++ b/packages/compat/src/template-tag-codemod.ts @@ -1,14 +1,13 @@ import { default as compatBuild } from './default-pipeline'; import type { EmberAppInstance } from '@embroider/core'; import type { Node, InputNode } from 'broccoli-node-api'; -import { join, relative, resolve } from 'path'; +import { join, relative, resolve, extname } from 'path'; import type { types as t } from '@babel/core'; import type { NodePath } from '@babel/traverse'; import { statSync, readdirSync, readFileSync, writeFileSync } from 'fs'; import Plugin from 'broccoli-plugin'; import { transformSync } from '@babel/core'; import { hbsToJS, ResolverLoader } from '@embroider/core'; -import { ImportUtil } from 'babel-import-util'; import ResolverTransform from './resolver-transform'; import { spawn } from 'child_process'; import { locateEmbroiderWorkingDir } from '@embroider/core'; @@ -39,6 +38,10 @@ export default function templateTagCodemod( { shouldTransformPath, dryRun } ); } + +const TEMPLATE_ONLY_MARKER = `import templateOnlyComponent from '@ember/component/template-only';`; +const TEMPLATE_COLOCATION_MARKER = /\/\* import __COLOCATED_TEMPLATE__ from (.*) \*\//; + class TemplateTagCodemodPlugin extends Plugin { constructor(inputNodes: InputNode[], readonly options: TemplateTagCodemodOptions) { super(inputNodes, { @@ -83,12 +86,17 @@ class TemplateTagCodemodPlugin extends Plugin { const babel_plugin_syntax_decorators = require.resolve('@babel/plugin-syntax-decorators', { paths: [embroider_compat_path], }); + const babel_plugin_syntax_typescript = require.resolve('@babel/plugin-syntax-typescript', { + paths: [embroider_compat_path], + }); for await (const current_file of walkSync(tmp_path)) { if (hbs_file_test.test(current_file) && this.options.shouldTransformPath(current_file)) { const template_file_src = readFileSync(current_file).toLocaleString(); - let src = + // run the template transformations using embroider resolver information + // to replace template values with js import syntax used in g(j/t)s + let transformed_source = transformSync(hbsToJS(template_file_src), { plugins: [ [ @@ -102,9 +110,13 @@ class TemplateTagCodemodPlugin extends Plugin { ], filename: current_file, })?.code ?? ''; + + // using transformSync to parse and traverse in one go + // we're only extracting the transformed template information from previous step + // and preserving it for later assembly in the backing class const import_bucket: NodePath[] = []; - let transformed_template_value = ''; - transformSync(src, { + let template_tag_value = ''; + transformSync(transformed_source, { plugins: [ function template_tag_extractor(): unknown { return { @@ -114,11 +126,19 @@ class TemplateTagCodemodPlugin extends Plugin { if (extractor) { const result = resolver.nodeResolve(extractor[0], current_file); if (result.type === 'real') { - // find package + // find package there the resolver is pointing const owner_package = resolver.packageCache.ownerOfFile(result.filename); - // change import to real one - import_declaration.node.source.value = - owner_package!.name + '/' + extractor[1] + '/' + extractor[2]; + let relative_import_path = relative(owner_package!.root, result.filename); + // for addons strip off appPublicationDir from relative path + // we do this on app files as well as they don't contain the + // path that we strip off + // this makes sure that ambiguous imports get properly attributed + relative_import_path = relative_import_path.replace('_app_/', ''); + // remove the extension to match what a developer would normally write + relative_import_path = relative_import_path.slice(0, -extname(relative_import_path).length); + + // change import path to real one + import_declaration.node.source.value = owner_package!.name + '/' + relative_import_path; import_bucket.push(import_declaration); } } else if (import_declaration.node.source.value.indexOf('@ember/template-compilation') === -1) { @@ -134,7 +154,7 @@ class TemplateTagCodemodPlugin extends Plugin { path.node.arguments && 'value' in path.node.arguments[0] ) { - transformed_template_value = ``; + template_tag_value = ``; } }, }, @@ -150,55 +170,40 @@ class TemplateTagCodemodPlugin extends Plugin { ); const backing_class_filename = 'filename' in backing_class_resolution ? backing_class_resolution.filename : ''; + // this can be either a generated js file in case of template only components + // the js or ts file depending on what the app is configured const backing_class_src = readFileSync(backing_class_filename).toString(); - const magic_string = '__MAGIC_STRING_FOR_TEMPLATE_TAG_REPLACE__'; - const is_template_only = - backing_class_src.indexOf("import templateOnlyComponent from '@ember/component/template-only';") !== -1; - src = transformSync(backing_class_src, { + const is_typescript = extname(backing_class_filename) === '.ts'; + + let insert_imports_byte_count = null; + let insert_template_byte_count = null; + + const is_template_only = backing_class_src.indexOf(TEMPLATE_ONLY_MARKER) !== -1; + + // we parse the backing class to find the insert points for imports and template + transformSync(backing_class_src, { plugins: [ - [babel_plugin_syntax_decorators, { decoratorsBeforeExport: true }], - function glimmer_syntax_creator(babel): unknown { + [ + is_typescript ? babel_plugin_syntax_typescript : babel_plugin_syntax_decorators, + { decoratorsBeforeExport: true }, + ], + function glimmer_syntax_creator(/* babel */): unknown { return { name: 'test', visitor: { - Program: { - enter(path: NodePath) { - // Always instantiate the ImportUtil instance at the Program scope - const importUtil = new ImportUtil(babel.types, path); - const first_node = path.get('body')[0]; - if ( - first_node && - first_node.node && - first_node.node.leadingComments && - first_node.node.leadingComments[0]?.value.includes('__COLOCATED_TEMPLATE__') - ) { - //remove magic comment - first_node.node.leadingComments.splice(0, 1); - } - for (const template_import of import_bucket) { - for (let i = 0, len = template_import.node.specifiers.length; i < len; ++i) { - const specifier = template_import.node.specifiers[i]; - if (specifier.type === 'ImportDefaultSpecifier') { - importUtil.import(path, template_import.node.source.value, 'default', specifier.local.name); - } else if (specifier.type === 'ImportSpecifier') { - importUtil.import(path, template_import.node.source.value, specifier.local.name); - } - } - } - }, - }, ImportDeclaration(import_declaration: NodePath) { - if (import_declaration.node.source.value.indexOf('@ember/component/template-only') !== -1) { - import_declaration.remove(); - } + insert_imports_byte_count = import_declaration.node.end; }, ExportDefaultDeclaration(path: NodePath) { + // convention is that we have a default export for each component + // we look for the closing bracket of the class body path.traverse({ ClassBody(path) { - const classbody_nodes = path.get('body'); - //add magic string to be replaces with the contents of the template tag - classbody_nodes[classbody_nodes.length - 1].addComment('trailing', magic_string, false); + // we substract 1 to find the byte right before the final closing bracket `}` + // this is the default insert point for template tag though it could live anywhere inside the class body + // possible future point to add option for putting template first thing in class + insert_template_byte_count = path.node.end ? path.node.end - 1 : 0; }, }); }, @@ -206,23 +211,56 @@ class TemplateTagCodemodPlugin extends Plugin { }; }, ], - })!.code!.replace(`/*${magic_string}*/`, transformed_template_value); + }); + + // list of imports needed by the previous hbs template extracted in second step + const hbs_template_required_imports = import_bucket.join('\n'); + + // we extracted all we needed from transformed_source so we switch to the second phase + // transforming the backing class into what will be our final output + transformed_source = backing_class_src; if (is_template_only) { // because we can't inject a comment as the default export // we replace the known exported string - src = src.replace('templateOnlyComponent()', transformed_template_value); + transformed_source = transformed_source.replace('templateOnlyComponent()', template_tag_value); + // we clean known markers from generated files + transformed_source = transformed_source.replace(TEMPLATE_ONLY_MARKER, hbs_template_required_imports); + transformed_source = transformed_source.replace(TEMPLATE_COLOCATION_MARKER, ''); + } else { + // we modify the source from end to start in order to keep our byte counts valid through the transforms + if (insert_template_byte_count) { + // first we split the backing class at the byte count we found during backing class parsing + // then concat the string back together adding the transformed template in the middle + transformed_source = + transformed_source.substring(0, insert_template_byte_count) + + '\n' + + template_tag_value + + '\n' + + transformed_source.substring(insert_template_byte_count, transformed_source.length); + } + if (insert_imports_byte_count) { + // first we split the backing class at the byte count we found during backing class parsing + // then concat the string back together adding the transformed template in the middle + transformed_source = + transformed_source.substring(0, insert_imports_byte_count) + + '\n' + + hbs_template_required_imports + + '\n' + + transformed_source.substring(insert_imports_byte_count, transformed_source.length); + } + transformed_source = transformed_source.replace(TEMPLATE_COLOCATION_MARKER, ''); } const dryRun = this.options.dryRun ? '--dry-run' : ''; // work out original file path in app tree const app_relative_path = join('app', relative(tmp_path, current_file)); - const new_file_path = app_relative_path.slice(0, -4) + '.gjs'; + const new_file_path = app_relative_path.slice(0, -4) + (is_typescript ? '.gts' : '.gjs'); // write glimmer file out if (this.options.dryRun) { - console.log('Write new file', new_file_path, src); + console.log('Write new file', new_file_path, transformed_source); } else { - writeFileSync(join(process.cwd(), new_file_path), src, { flag: 'wx+' }); + writeFileSync(join(process.cwd(), new_file_path), transformed_source, { flag: 'wx+' }); } // git rm old files (js/ts if exists + hbs) @@ -233,7 +271,7 @@ class TemplateTagCodemodPlugin extends Plugin { if (!is_template_only) { // remove backing class only if it's not a template only component - // resolve repative path to rewritten-app + // resolve relative path to rewritten-app const app_relative_path = join('app', relative(tmp_path, backing_class_filename)); let rm_js = await execute(`git rm ${app_relative_path} ${dryRun}`, { pwd: process.cwd(), From 74d2521250f2ec9c26cf3f47f8245b89c68540ce Mon Sep 17 00:00:00 2001 From: void_malex Date: Tue, 1 Oct 2024 22:04:47 +0100 Subject: [PATCH 15/51] adjust test to match output without babel code transform processing --- tests/scenarios/template-tag-codemod-test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/scenarios/template-tag-codemod-test.ts b/tests/scenarios/template-tag-codemod-test.ts index 2d9a08f7f2..1f253d250a 100644 --- a/tests/scenarios/template-tag-codemod-test.ts +++ b/tests/scenarios/template-tag-codemod-test.ts @@ -36,7 +36,9 @@ module.exports = function (defaults) { const fileContents = readFileSync(join(app.dir, 'app/components/face.gjs'), 'utf-8'); assert.equal( fileContents, - `export default