Document runtime exclusions and verify offline transfer savings
This commit is contained in:
@@ -55,7 +55,6 @@ export function createAssetManifest(publicDir = './public', { hashing = true, bu
|
||||
else {
|
||||
const content = readFileSync(path);
|
||||
bytes.set(url, content);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -91,7 +90,7 @@ export function createAssetManifest(publicDir = './public', { hashing = true, bu
|
||||
const swSource = bytes.get('/sw.js')?.toString() ?? null;
|
||||
// Derived build metadata cannot be an input to its own hash. Canonicalize
|
||||
// the index meta and SW injected tag, then publish hashes of the final bytes.
|
||||
// All original bytes (including index/SW source) remain inputs via source hashes.
|
||||
// All runtime source bytes (including index/SW source) remain inputs via source hashes.
|
||||
let canonicalIndex = source === null ? null : stampIndex(embedAssets(source, files, groups, '__BUILD_TAG__', hashing), files, { hashing });
|
||||
const canonical = { assetSync, files: { ...files }, groups, contracts };
|
||||
if (canonicalIndex !== null && hashing) canonical.files['/index.html'] = { ...files['/index.html'], h: assetHash(canonicalIndex), s: Buffer.byteLength(canonicalIndex), source: files['/index.html'].h };
|
||||
|
||||
@@ -94,7 +94,7 @@ test('non-runtime files stay deliverable but never affect manifest or build iden
|
||||
for (const hashing of [true, false]) {
|
||||
const first = createAssetManifest(dir, { hashing });
|
||||
mkdirSync(join(dir, 'perf'), { recursive: true });
|
||||
for (const name of ['app.test.js', 'app.test.mjs', 'README.md', 'license.txt', 'admin.html', 'perf/fixture.js']) {
|
||||
for (const name of ['app.test.js', 'app.test.mjs', 'README.md', 'license.txt', 'admin.html', 'perf/fixture.js', 'sha256.c', 'framework.entry.js']) {
|
||||
writeFileSync(join(dir, name), 'non-runtime');
|
||||
const next = createAssetManifest(dir, { hashing });
|
||||
expect(next.manifest.buildTag).toBe(first.manifest.buildTag);
|
||||
|
||||
Reference in New Issue
Block a user