From 58d414c306604aafa6a1012a18111b2054b8f7ab Mon Sep 17 00:00:00 2001 From: Patrick Pircher Date: Wed, 10 Jul 2024 11:31:06 +0200 Subject: [PATCH 1/2] Revert "Add just the necessary files to rollup watch mode" --- packages/addon-dev/package.json | 8 -------- packages/addon-dev/src/rollup-keep-assets.ts | 8 ++++++-- packages/addon-dev/src/rollup-public-entrypoints.ts | 4 ++-- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/packages/addon-dev/package.json b/packages/addon-dev/package.json index d30c35fba..aab22a3a1 100644 --- a/packages/addon-dev/package.json +++ b/packages/addon-dev/package.json @@ -25,14 +25,6 @@ "scripts": { "test": "jest" }, - "peerDependencies": { - "rollup": "^4.6.0" - }, - "peerDependenciesMeta": { - "rollup": { - "optional": true - } - }, "dependencies": { "@embroider/core": "workspace:^", "@rollup/pluginutils": "^4.1.1", diff --git a/packages/addon-dev/src/rollup-keep-assets.ts b/packages/addon-dev/src/rollup-keep-assets.ts index a8f213d30..fba42a421 100644 --- a/packages/addon-dev/src/rollup-keep-assets.ts +++ b/packages/addon-dev/src/rollup-keep-assets.ts @@ -14,6 +14,12 @@ export default function keepAssets({ return { name: 'copy-assets', + // Prior to https://github.com/rollup/rollup/pull/5270, we cannot call this + // from within `generateBundle` + buildStart() { + this.addWatchFile(from); + }, + // imports of assets should be left alone in the source code. This can cover // the case of .css as defined in the embroider v2 addon spec. async resolveId(source, importer, options) { @@ -38,8 +44,6 @@ export default function keepAssets({ globs: include, directories: false, })) { - this.addWatchFile(join(from, name)); - this.emitFile({ type: 'asset', fileName: name, diff --git a/packages/addon-dev/src/rollup-public-entrypoints.ts b/packages/addon-dev/src/rollup-public-entrypoints.ts index 367f270e2..e0839b13e 100644 --- a/packages/addon-dev/src/rollup-public-entrypoints.ts +++ b/packages/addon-dev/src/rollup-public-entrypoints.ts @@ -16,14 +16,14 @@ export default function publicEntrypoints(args: { return { name: 'addon-modules', async buildStart() { + this.addWatchFile(args.srcDir); + let matches = walkSync(args.srcDir, { globs: [...args.include, '**/*.hbs', '**/*.ts', '**/*.gts', '**/*.gjs'], ignore: args.exclude, }); for (let name of matches) { - this.addWatchFile(path.join(args.srcDir, name)); - // the matched file, but with the extension swapped with .js let normalizedName = normalizeFileExt(name); From a8549f734a6ccfcc136c1550bfcb0503871735e2 Mon Sep 17 00:00:00 2001 From: Patrick Pircher Date: Wed, 10 Jul 2024 11:32:29 +0200 Subject: [PATCH 2/2] add rollup peer dep back --- packages/addon-dev/package.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/addon-dev/package.json b/packages/addon-dev/package.json index aab22a3a1..d30c35fba 100644 --- a/packages/addon-dev/package.json +++ b/packages/addon-dev/package.json @@ -25,6 +25,14 @@ "scripts": { "test": "jest" }, + "peerDependencies": { + "rollup": "^4.6.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + }, "dependencies": { "@embroider/core": "workspace:^", "@rollup/pluginutils": "^4.1.1",