Skip to content

Commit

Permalink
rename to incremental
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklx committed May 16, 2024
1 parent fedc3d2 commit 6621d6b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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);
}
},
Expand Down Expand Up @@ -63,10 +61,8 @@ export default function clean(): Plugin {
)
) {
delete bundle[key];
console.log('deleted', key);
continue;
}
console.log('not deleted', key);
}
changed.clear();
},
Expand Down
7 changes: 4 additions & 3 deletions packages/addon-dev/src/rollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit 6621d6b

Please sign in to comment.