From 6621d6b9f2f289c97465d2706acdb5ede7498228 Mon Sep 17 00:00:00 2001 From: patrick Date: Mon, 6 May 2024 09:58:30 +0200 Subject: [PATCH] rename to incremental --- ...rollup-clean-plugin.ts => rollup-incremental-plugin.ts} | 6 +----- packages/addon-dev/src/rollup.ts | 7 ++++--- 2 files changed, 5 insertions(+), 8 deletions(-) rename packages/addon-dev/src/{rollup-clean-plugin.ts => rollup-incremental-plugin.ts} (89%) diff --git a/packages/addon-dev/src/rollup-clean-plugin.ts b/packages/addon-dev/src/rollup-incremental-plugin.ts similarity index 89% rename from packages/addon-dev/src/rollup-clean-plugin.ts rename to packages/addon-dev/src/rollup-incremental-plugin.ts index 9a1eb1ef7..ba4029589 100644 --- a/packages/addon-dev/src/rollup-clean-plugin.ts +++ b/packages/addon-dev/src/rollup-incremental-plugin.ts @@ -4,7 +4,7 @@ import { join } from 'path'; import type { OutputAsset, Plugin } from 'rollup'; import { existsSync } from 'fs-extra'; -export default function clean(): Plugin { +export default function incremental(): Plugin { const changed = new Set(); const generatedAssets = new Map(); return { @@ -15,9 +15,7 @@ export default function clean(): Plugin { // could also be done directly in the babel plugin // by passing rollup context into it let hbsFilename = id.replace(/\.\w{1,3}$/, '') + '.hbs'; - console.log('watch', hbsFilename, '?'); if (hbsFilename !== id && existsSync(hbsFilename)) { - console.log('watch', hbsFilename, 'for', id); this.addWatchFile(hbsFilename); } }, @@ -63,10 +61,8 @@ export default function clean(): Plugin { ) ) { delete bundle[key]; - console.log('deleted', key); continue; } - console.log('not deleted', key); } changed.clear(); }, diff --git a/packages/addon-dev/src/rollup.ts b/packages/addon-dev/src/rollup.ts index f59d1ba3f..ce035cc40 100644 --- a/packages/addon-dev/src/rollup.ts +++ b/packages/addon-dev/src/rollup.ts @@ -8,7 +8,7 @@ import { default as publicAssets, type PublicAssetsOptions, } from './rollup-public-assets'; -import { default as clean } from './rollup-clean-plugin'; +import { default as clean } from './rollup-incremental-plugin'; import type { Plugin } from 'rollup'; export class Addon { @@ -63,8 +63,9 @@ export class Addon { return gjs(options); } - // By default rollup does not clear the output directory between builds. This - // does that. It only deletes files that are not part of the generated bundle + // 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(); }