Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| addb689de9 | |||
| 2af8d28b82 | |||
| ddbc66813e |
+9
-1
@@ -1,5 +1,13 @@
|
||||
# Changelog
|
||||
|
||||
## v0.15.3
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/v0.15.2...v0.15.3)
|
||||
|
||||
### 🩹 Fixes
|
||||
|
||||
- **dev:** Reload `<name>/index.html` entrypoints properly on save ([#390](https://github.com/wxt-dev/wxt/pull/390))
|
||||
|
||||
## v0.15.2
|
||||
|
||||
[compare changes](https://github.com/wxt-dev/wxt/compare/v0.15.1...v0.15.2)
|
||||
@@ -14,7 +22,7 @@
|
||||
|
||||
### ❤️ Contributors
|
||||
|
||||
- Nenad Novaković
|
||||
- Nenad Novaković ([@dvlden](https://github.com/dvlden))
|
||||
|
||||
## v0.15.1
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "wxt",
|
||||
"type": "module",
|
||||
"version": "0.15.2",
|
||||
"version": "0.15.3",
|
||||
"description": "Next gen framework for developing web extensions",
|
||||
"engines": {
|
||||
"node": ">=18",
|
||||
|
||||
@@ -167,9 +167,9 @@ describe('Detect Dev Changes', () => {
|
||||
});
|
||||
|
||||
describe('HTML Pages', () => {
|
||||
it('should rebuild then reload only the effected pages', async () => {
|
||||
it('should detect changes to entrypoints/<name>.html files', async () => {
|
||||
const config = fakeInternalConfig();
|
||||
const changedPath = '/root/page1/index.html';
|
||||
const changedPath = '/root/page1.html';
|
||||
const htmlPage1 = fakePopupEntrypoint({
|
||||
inputPath: changedPath,
|
||||
});
|
||||
@@ -184,16 +184,66 @@ describe('Detect Dev Changes', () => {
|
||||
const step1: BuildStepOutput = {
|
||||
entrypoints: [htmlPage1, htmlPage2],
|
||||
chunks: [
|
||||
fakeOutputChunk({
|
||||
moduleIds: [fakeFile(), changedPath],
|
||||
fakeOutputAsset({
|
||||
fileName: 'page1.html',
|
||||
}),
|
||||
],
|
||||
};
|
||||
const step2: BuildStepOutput = {
|
||||
entrypoints: [htmlPage3],
|
||||
chunks: [
|
||||
fakeOutputChunk({
|
||||
moduleIds: [fakeFile(), fakeFile(), fakeFile()],
|
||||
fakeOutputAsset({
|
||||
fileName: 'page2.html',
|
||||
}),
|
||||
],
|
||||
};
|
||||
|
||||
const currentOutput: BuildOutput = {
|
||||
manifest: fakeManifest(),
|
||||
publicAssets: [],
|
||||
steps: [step1, step2],
|
||||
};
|
||||
const expected: DevModeChange = {
|
||||
type: 'html-reload',
|
||||
cachedOutput: {
|
||||
...currentOutput,
|
||||
steps: [step2],
|
||||
},
|
||||
rebuildGroups: [[htmlPage1, htmlPage2]],
|
||||
};
|
||||
|
||||
const actual = detectDevChanges(config, [changedPath], currentOutput);
|
||||
|
||||
expect(actual).toEqual(expected);
|
||||
});
|
||||
|
||||
it('should detect changes to entrypoints/<name>/index.html files', async () => {
|
||||
const config = fakeInternalConfig();
|
||||
const changedPath = '/root/page1/index.html';
|
||||
const htmlPage1 = fakePopupEntrypoint({
|
||||
inputPath: changedPath,
|
||||
});
|
||||
const htmlPage2 = fakeOptionsEntrypoint({
|
||||
inputPath: '/root/page2/index.html',
|
||||
});
|
||||
const htmlPage3 = fakeGenericEntrypoint({
|
||||
type: 'sandbox',
|
||||
inputPath: '/root/page3/index.html',
|
||||
});
|
||||
|
||||
const step1: BuildStepOutput = {
|
||||
entrypoints: [htmlPage1, htmlPage2],
|
||||
chunks: [
|
||||
fakeOutputAsset({
|
||||
fileName: 'page1.html',
|
||||
}),
|
||||
],
|
||||
};
|
||||
const step2: BuildStepOutput = {
|
||||
entrypoints: [htmlPage3],
|
||||
chunks: [
|
||||
fakeOutputAsset({
|
||||
fileName: 'page2.html',
|
||||
}),
|
||||
],
|
||||
};
|
||||
|
||||
@@ -123,11 +123,12 @@ function findEffectedSteps(
|
||||
const changedPath = normalizePath(changedFile);
|
||||
|
||||
const isChunkEffected = (chunk: OutputFile): boolean =>
|
||||
// If it's an HTML file with the same path, is is effected because HTML files need to be pre-rendered
|
||||
// fileName is normalized, relative bundle path
|
||||
(chunk.type === 'asset' && changedPath.endsWith(chunk.fileName)) ||
|
||||
// If it's an HTML file with the same path, is is effected because HTML files need to be re-rendered
|
||||
// - fileName is normalized, relative bundle path, "<entrypoint-name>.html"
|
||||
(chunk.type === 'asset' &&
|
||||
changedPath.replace('/index.html', '.html').endsWith(chunk.fileName)) ||
|
||||
// If it's a chunk that depends on the changed file, it is effected
|
||||
// moduleIds are absolute, normalized paths
|
||||
// - moduleIds are absolute, normalized paths
|
||||
(chunk.type === 'chunk' && chunk.moduleIds.includes(changedPath));
|
||||
|
||||
for (const step of currentOutput.steps) {
|
||||
|
||||
Reference in New Issue
Block a user