diff --git a/browser/package.json b/browser/package.json index 0e40a1a48df..c85358228c3 100644 --- a/browser/package.json +++ b/browser/package.json @@ -1,6 +1,6 @@ { "name": "@rollup/browser", - "version": "3.0.0-6", + "version": "3.0.0-7", "description": "Next-generation ES module bundler browser build", "main": "dist/rollup.browser.js", "module": "dist/es/rollup.browser.js", diff --git a/docs/05-plugin-development.md b/docs/05-plugin-development.md index 82b02b91d2c..e927847fe84 100644 --- a/docs/05-plugin-development.md +++ b/docs/05-plugin-development.md @@ -722,7 +722,7 @@ If there are no dynamic imports, this will create exactly three chunks where the Note that even though any module id can be used in `implicitlyLoadedAfterOneOf`, Rollup will throw an error if such an id cannot be uniquely associated with a chunk, e.g. because the `id` cannot be reached implicitly or explicitly from the existing static entry points, or because the file is completely tree-shaken. Using only entry points, either defined by the user or of previously emitted chunks, will always work, though. -If the `type` is _`asset`_, then this emits an arbitrary new file with the given `source` as content. It is possible to defer setting the `source` via [`this.setAssetSource(referenceId, source)`](guide/en/#thissetassetsource) to a later time to be able to reference a file during the build phase while setting the source separately for each output during the generate phase. Assets with a specified `fileName` will always generate separate files while other emitted assets may be deduplicated with existing assets if they have the same source even if the `name` does not match. If such an asset is not deduplicated, the [`output.assetFileNames`](guide/en/#outputassetfilenames) name pattern will be used. +If the `type` is _`asset`_, then this emits an arbitrary new file with the given `source` as content. It is possible to defer setting the `source` via [`this.setAssetSource(referenceId, source)`](guide/en/#thissetassetsource) to a later time to be able to reference a file during the build phase while setting the source separately for each output during the generate phase. Assets with a specified `fileName` will always generate separate files while other emitted assets may be deduplicated with existing assets if they have the same `string` source even if the `name` does not match. If the source is not a string but a typed array or `Buffer`, no deduplication will occur for performance reasons. If an asset without a `fileName` is not deduplicated, the [`output.assetFileNames`](guide/en/#outputassetfilenames) name pattern will be used. #### `this.error` diff --git a/package.json b/package.json index 75331338d66..526a2fecbf4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rollup", - "version": "3.0.0-6", + "version": "3.0.0-7", "description": "Next-generation ES module bundler", "main": "dist/rollup.js", "module": "dist/es/rollup.js", diff --git a/src/utils/FileEmitter.ts b/src/utils/FileEmitter.ts index b00cc813a64..6515f48c3ee 100644 --- a/src/utils/FileEmitter.ts +++ b/src/utils/FileEmitter.ts @@ -61,7 +61,7 @@ function generateAssetFileName( function reserveFileNameInBundle( fileName: string, - bundle: OutputBundleWithPlaceholders, + { bundle }: FileEmitterOutput, warn: WarningHandler ) { if (bundle[lowercaseBundleKeys].has(fileName.toLowerCase())) { @@ -151,11 +151,17 @@ function getChunkFileName( return error(errChunkNotGeneratedForFileName(file.fileName || file.name)); } +interface FileEmitterOutput { + bundle: OutputBundleWithPlaceholders; + fileNamesBySource: Map; + outputOptions: NormalizedOutputOptions; +} + export class FileEmitter { - private bundle: OutputBundleWithPlaceholders | null = null; private facadeChunkByModule: ReadonlyMap | null = null; private readonly filesByReferenceId: Map; - private outputOptions: NormalizedOutputOptions | null = null; + private nextIdBase = 1; + private output: FileEmitterOutput | null = null; constructor( private readonly graph: Graph, @@ -222,8 +228,8 @@ export class FileEmitter { return error(errAssetSourceAlreadySet(consumedFile.name || referenceId)); } const source = getValidSource(requestedSource, consumedFile, referenceId); - if (this.bundle) { - this.finalizeAsset(consumedFile, source, referenceId, this.bundle); + if (this.output) { + this.finalizeAsset(consumedFile, source, referenceId, this.output); } else { consumedFile.source = source; } @@ -237,16 +243,19 @@ export class FileEmitter { bundle: OutputBundleWithPlaceholders, outputOptions: NormalizedOutputOptions ): void => { - this.outputOptions = outputOptions; - this.bundle = bundle; + const fileNamesBySource = new Map(); + const output = (this.output = { bundle, fileNamesBySource, outputOptions }); for (const emittedFile of this.filesByReferenceId.values()) { if (emittedFile.fileName) { - reserveFileNameInBundle(emittedFile.fileName, bundle, this.options.onwarn); + reserveFileNameInBundle(emittedFile.fileName, output, this.options.onwarn); + if (emittedFile.type === 'asset' && typeof emittedFile.source === 'string') { + fileNamesBySource.set(emittedFile.source, emittedFile.fileName); + } } } for (const [referenceId, consumedFile] of this.filesByReferenceId) { if (consumedFile.type === 'asset' && consumedFile.source !== undefined) { - this.finalizeAsset(consumedFile, consumedFile.source, referenceId, bundle); + this.finalizeAsset(consumedFile, consumedFile.source, referenceId, output); } } }; @@ -278,14 +287,14 @@ export class FileEmitter { }; const referenceId = this.assignReferenceId( consumedAsset, - emittedAsset.fileName || emittedAsset.name || emittedAsset.type + emittedAsset.fileName || emittedAsset.name || String(this.nextIdBase++) ); - if (this.bundle) { + if (this.output) { if (emittedAsset.fileName) { - reserveFileNameInBundle(emittedAsset.fileName, this.bundle, this.options.onwarn); + reserveFileNameInBundle(emittedAsset.fileName, this.output, this.options.onwarn); } if (source !== undefined) { - this.finalizeAsset(consumedAsset, source, referenceId, this.bundle); + this.finalizeAsset(consumedAsset, source, referenceId, this.output); } } return referenceId; @@ -323,16 +332,19 @@ export class FileEmitter { consumedFile: ConsumedFile, source: string | Uint8Array, referenceId: string, - bundle: OutputBundleWithPlaceholders + { bundle, fileNamesBySource, outputOptions }: FileEmitterOutput ): void { const fileName = consumedFile.fileName || - findExistingAssetFileNameWithSource(bundle, source) || - generateAssetFileName(consumedFile.name, source, this.outputOptions!, bundle); + (typeof source === 'string' && fileNamesBySource.get(source)) || + generateAssetFileName(consumedFile.name, source, outputOptions, bundle); // We must not modify the original assets to avoid interaction between outputs const assetWithFileName = { ...consumedFile, fileName, source }; this.filesByReferenceId.set(referenceId, assetWithFileName); + if (typeof source === 'string') { + fileNamesBySource.set(source, fileName); + } bundle[fileName] = { fileName, name: consumedFile.name, @@ -341,40 +353,3 @@ export class FileEmitter { }; } } - -// TODO This can lead to a performance problem when many assets are emitted. -// Instead, we should only deduplicate string assets and use their sources as -// object keys for better performance. -function findExistingAssetFileNameWithSource( - bundle: OutputBundleWithPlaceholders, - source: string | Uint8Array -): string | null { - for (const [fileName, outputFile] of Object.entries(bundle)) { - if (outputFile.type === 'asset' && areSourcesEqual(source, outputFile.source)) return fileName; - } - return null; -} - -function areSourcesEqual( - sourceA: string | Uint8Array | Buffer, - sourceB: string | Uint8Array | Buffer -): boolean { - if (typeof sourceA === 'string') { - return sourceA === sourceB; - } - if (typeof sourceB === 'string') { - return false; - } - if ('equals' in sourceA) { - return sourceA.equals(sourceB); - } - if (sourceA.length !== sourceB.length) { - return false; - } - for (let index = 0; index < sourceA.length; index++) { - if (sourceA[index] !== sourceB[index]) { - return false; - } - } - return true; -} diff --git a/test/chunking-form/samples/emit-file/deduplicate-assets/_config.js b/test/chunking-form/samples/emit-file/deduplicate-assets/_config.js index e9f0e506a81..1f37410f516 100644 --- a/test/chunking-form/samples/emit-file/deduplicate-assets/_config.js +++ b/test/chunking-form/samples/emit-file/deduplicate-assets/_config.js @@ -4,26 +4,11 @@ module.exports = { input: ['main.js'], plugins: { buildStart() { - this.emitFile({ type: 'asset', name: 'string.txt', source: 'hello world' }); - this.emitFile({ type: 'asset', name: 'otherString.txt', source: 'hello world' }); - this.emitFile({ - type: 'asset', - name: 'buffer.txt', - source: Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]) - }); - this.emitFile({ - type: 'asset', - name: 'otherBuffer.txt', - source: Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]) - }); + this.emitFile({ type: 'asset', name: 'string.txt', source: 'string' }); + this.emitFile({ type: 'asset', name: 'otherString.txt', source: 'otherString' }); // specific file names will not be deduplicated - this.emitFile({ type: 'asset', fileName: 'named/string.txt', source: 'hello world' }); - this.emitFile({ - type: 'asset', - fileName: 'named/buffer.txt', - source: Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]) - }); + this.emitFile({ type: 'asset', fileName: 'named/string.txt', source: 'named' }); return null; } } diff --git a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/amd/assets/buffer-d0ca8c2a.txt b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/amd/assets/buffer-d0ca8c2a.txt deleted file mode 100644 index ea75f1e9c19..00000000000 --- a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/amd/assets/buffer-d0ca8c2a.txt +++ /dev/null @@ -1 +0,0 @@ -buffer \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/amd/assets/otherString-e296c1ca.txt b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/amd/assets/otherString-e296c1ca.txt new file mode 100644 index 00000000000..f0d609c8c8d --- /dev/null +++ b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/amd/assets/otherString-e296c1ca.txt @@ -0,0 +1 @@ +otherString \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/amd/assets/string-473287f8.txt b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/amd/assets/string-473287f8.txt new file mode 100644 index 00000000000..ec186f1f349 --- /dev/null +++ b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/amd/assets/string-473287f8.txt @@ -0,0 +1 @@ +string \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/amd/assets/string-b94d27b9.txt b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/amd/assets/string-b94d27b9.txt deleted file mode 100644 index 95d09f2b101..00000000000 --- a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/amd/assets/string-b94d27b9.txt +++ /dev/null @@ -1 +0,0 @@ -hello world \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/amd/named/buffer.txt b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/amd/named/buffer.txt deleted file mode 100644 index ea75f1e9c19..00000000000 --- a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/amd/named/buffer.txt +++ /dev/null @@ -1 +0,0 @@ -buffer \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/amd/named/string.txt b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/amd/named/string.txt index 95d09f2b101..eab15049cea 100644 --- a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/amd/named/string.txt +++ b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/amd/named/string.txt @@ -1 +1 @@ -hello world \ No newline at end of file +named \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/cjs/assets/buffer-d0ca8c2a.txt b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/cjs/assets/buffer-d0ca8c2a.txt deleted file mode 100644 index ea75f1e9c19..00000000000 --- a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/cjs/assets/buffer-d0ca8c2a.txt +++ /dev/null @@ -1 +0,0 @@ -buffer \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/cjs/assets/otherString-e296c1ca.txt b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/cjs/assets/otherString-e296c1ca.txt new file mode 100644 index 00000000000..f0d609c8c8d --- /dev/null +++ b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/cjs/assets/otherString-e296c1ca.txt @@ -0,0 +1 @@ +otherString \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/cjs/assets/string-473287f8.txt b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/cjs/assets/string-473287f8.txt new file mode 100644 index 00000000000..ec186f1f349 --- /dev/null +++ b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/cjs/assets/string-473287f8.txt @@ -0,0 +1 @@ +string \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/cjs/assets/string-b94d27b9.txt b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/cjs/assets/string-b94d27b9.txt deleted file mode 100644 index 95d09f2b101..00000000000 --- a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/cjs/assets/string-b94d27b9.txt +++ /dev/null @@ -1 +0,0 @@ -hello world \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/cjs/named/buffer.txt b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/cjs/named/buffer.txt deleted file mode 100644 index ea75f1e9c19..00000000000 --- a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/cjs/named/buffer.txt +++ /dev/null @@ -1 +0,0 @@ -buffer \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/cjs/named/string.txt b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/cjs/named/string.txt index 95d09f2b101..eab15049cea 100644 --- a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/cjs/named/string.txt +++ b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/cjs/named/string.txt @@ -1 +1 @@ -hello world \ No newline at end of file +named \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/es/assets/buffer-d0ca8c2a.txt b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/es/assets/buffer-d0ca8c2a.txt deleted file mode 100644 index ea75f1e9c19..00000000000 --- a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/es/assets/buffer-d0ca8c2a.txt +++ /dev/null @@ -1 +0,0 @@ -buffer \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/es/assets/otherString-e296c1ca.txt b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/es/assets/otherString-e296c1ca.txt new file mode 100644 index 00000000000..f0d609c8c8d --- /dev/null +++ b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/es/assets/otherString-e296c1ca.txt @@ -0,0 +1 @@ +otherString \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/es/assets/string-473287f8.txt b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/es/assets/string-473287f8.txt new file mode 100644 index 00000000000..ec186f1f349 --- /dev/null +++ b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/es/assets/string-473287f8.txt @@ -0,0 +1 @@ +string \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/es/assets/string-b94d27b9.txt b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/es/assets/string-b94d27b9.txt deleted file mode 100644 index 95d09f2b101..00000000000 --- a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/es/assets/string-b94d27b9.txt +++ /dev/null @@ -1 +0,0 @@ -hello world \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/es/named/buffer.txt b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/es/named/buffer.txt deleted file mode 100644 index ea75f1e9c19..00000000000 --- a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/es/named/buffer.txt +++ /dev/null @@ -1 +0,0 @@ -buffer \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/es/named/string.txt b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/es/named/string.txt index 95d09f2b101..eab15049cea 100644 --- a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/es/named/string.txt +++ b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/es/named/string.txt @@ -1 +1 @@ -hello world \ No newline at end of file +named \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/system/assets/buffer-d0ca8c2a.txt b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/system/assets/buffer-d0ca8c2a.txt deleted file mode 100644 index ea75f1e9c19..00000000000 --- a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/system/assets/buffer-d0ca8c2a.txt +++ /dev/null @@ -1 +0,0 @@ -buffer \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/system/assets/otherString-e296c1ca.txt b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/system/assets/otherString-e296c1ca.txt new file mode 100644 index 00000000000..f0d609c8c8d --- /dev/null +++ b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/system/assets/otherString-e296c1ca.txt @@ -0,0 +1 @@ +otherString \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/system/assets/string-473287f8.txt b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/system/assets/string-473287f8.txt new file mode 100644 index 00000000000..ec186f1f349 --- /dev/null +++ b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/system/assets/string-473287f8.txt @@ -0,0 +1 @@ +string \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/system/assets/string-b94d27b9.txt b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/system/assets/string-b94d27b9.txt deleted file mode 100644 index 95d09f2b101..00000000000 --- a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/system/assets/string-b94d27b9.txt +++ /dev/null @@ -1 +0,0 @@ -hello world \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/system/named/buffer.txt b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/system/named/buffer.txt deleted file mode 100644 index ea75f1e9c19..00000000000 --- a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/system/named/buffer.txt +++ /dev/null @@ -1 +0,0 @@ -buffer \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/system/named/string.txt b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/system/named/string.txt index 95d09f2b101..eab15049cea 100644 --- a/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/system/named/string.txt +++ b/test/chunking-form/samples/emit-file/deduplicate-assets/_expected/system/named/string.txt @@ -1 +1 @@ -hello world \ No newline at end of file +named \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_config.js b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_config.js index 25e3d03dcaa..4ef7b6e67d7 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_config.js +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_config.js @@ -5,54 +5,78 @@ module.exports = { plugins: { buildStart() { this.emitFile({ type: 'asset', name: 'buildStart.txt', source: 'buildStart' }); - this.emitFile({ type: 'asset', fileName: 'custom/buildStart.txt', source: 'buildStart' }); + this.emitFile({ + type: 'asset', + fileName: 'custom/buildStart.txt', + source: 'buildStart-custom' + }); }, resolveId() { this.emitFile({ type: 'asset', name: 'resolveId.txt', source: 'resolveId' }); - this.emitFile({ type: 'asset', fileName: 'custom/resolveId.txt', source: 'resolveId' }); + this.emitFile({ + type: 'asset', + fileName: 'custom/resolveId.txt', + source: 'resolveId-custom' + }); }, load() { this.emitFile({ type: 'asset', name: 'load.txt', source: 'load' }); - this.emitFile({ type: 'asset', fileName: 'custom/load.txt', source: 'load' }); + this.emitFile({ type: 'asset', fileName: 'custom/load.txt', source: 'load-custom' }); }, transform() { this.emitFile({ type: 'asset', name: 'transform.txt', source: 'transform' }); - this.emitFile({ type: 'asset', fileName: 'custom/transform.txt', source: 'transform' }); + this.emitFile({ + type: 'asset', + fileName: 'custom/transform.txt', + source: 'transform-custom' + }); }, buildEnd() { this.emitFile({ type: 'asset', name: 'buildEnd.txt', source: 'buildEnd' }); - this.emitFile({ type: 'asset', fileName: 'custom/buildEnd.txt', source: 'buildEnd' }); + this.emitFile({ + type: 'asset', + fileName: 'custom/buildEnd.txt', + source: 'buildEnd-custom' + }); }, renderStart() { this.emitFile({ type: 'asset', name: 'renderStart.txt', source: 'renderStart' }); - this.emitFile({ type: 'asset', fileName: 'custom/renderStart.txt', source: 'renderStart' }); + this.emitFile({ + type: 'asset', + fileName: 'custom/renderStart.txt', + source: 'renderStart-custom' + }); }, banner() { this.emitFile({ type: 'asset', name: 'banner.txt', source: 'banner' }); - this.emitFile({ type: 'asset', fileName: 'custom/banner.txt', source: 'banner' }); + this.emitFile({ type: 'asset', fileName: 'custom/banner.txt', source: 'banner-custom' }); }, footer() { this.emitFile({ type: 'asset', name: 'footer.txt', source: 'footer' }); - this.emitFile({ type: 'asset', fileName: 'custom/footer.txt', source: 'footer' }); + this.emitFile({ type: 'asset', fileName: 'custom/footer.txt', source: 'footer-custom' }); }, intro() { this.emitFile({ type: 'asset', name: 'intro.txt', source: 'intro' }); - this.emitFile({ type: 'asset', fileName: 'custom/intro.txt', source: 'intro' }); + this.emitFile({ type: 'asset', fileName: 'custom/intro.txt', source: 'intro-custom' }); }, outro() { this.emitFile({ type: 'asset', name: 'outro.txt', source: 'outro' }); - this.emitFile({ type: 'asset', fileName: 'custom/outro.txt', source: 'outro' }); + this.emitFile({ type: 'asset', fileName: 'custom/outro.txt', source: 'outro-custom' }); }, renderChunk() { this.emitFile({ type: 'asset', name: 'renderChunk.txt', source: 'renderChunk' }); - this.emitFile({ type: 'asset', fileName: 'custom/renderChunk.txt', source: 'renderChunk' }); + this.emitFile({ + type: 'asset', + fileName: 'custom/renderChunk.txt', + source: 'renderChunk-custom' + }); }, generateBundle() { this.emitFile({ type: 'asset', name: 'generateBundle.txt', source: 'generateBundle' }); this.emitFile({ type: 'asset', fileName: 'custom/generateBundle.txt', - source: 'generateBundle' + source: 'generateBundle-custom' }); } } diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/banner.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/banner.txt index 12577274ecd..b64fd741450 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/banner.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/banner.txt @@ -1 +1 @@ -banner \ No newline at end of file +banner-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/buildEnd.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/buildEnd.txt index bbb07acb9fc..845ccdb645d 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/buildEnd.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/buildEnd.txt @@ -1 +1 @@ -buildEnd \ No newline at end of file +buildEnd-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/buildStart.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/buildStart.txt index 0cb77258e0a..e45aee41d15 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/buildStart.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/buildStart.txt @@ -1 +1 @@ -buildStart \ No newline at end of file +buildStart-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/footer.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/footer.txt index a56ca533272..8c589a50af2 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/footer.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/footer.txt @@ -1 +1 @@ -footer \ No newline at end of file +footer-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/generateBundle.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/generateBundle.txt index de472563b28..155523bd6b3 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/generateBundle.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/generateBundle.txt @@ -1 +1 @@ -generateBundle \ No newline at end of file +generateBundle-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/intro.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/intro.txt index 29fbe946bf9..3e663da2b46 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/intro.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/intro.txt @@ -1 +1 @@ -intro \ No newline at end of file +intro-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/load.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/load.txt index 024e67c1f24..7bac7254119 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/load.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/load.txt @@ -1 +1 @@ -load \ No newline at end of file +load-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/outro.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/outro.txt index 31035209b9e..77a881ecde8 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/outro.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/outro.txt @@ -1 +1 @@ -outro \ No newline at end of file +outro-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/renderChunk.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/renderChunk.txt index 22f947650b0..3930812883e 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/renderChunk.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/renderChunk.txt @@ -1 +1 @@ -renderChunk \ No newline at end of file +renderChunk-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/renderStart.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/renderStart.txt index 3cdc0005056..a3d2c08e3fb 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/renderStart.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/renderStart.txt @@ -1 +1 @@ -renderStart \ No newline at end of file +renderStart-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/resolveId.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/resolveId.txt index 53029113abd..7286bfbd602 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/resolveId.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/resolveId.txt @@ -1 +1 @@ -resolveId \ No newline at end of file +resolveId-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/transform.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/transform.txt index 3f001116657..ce2fb1d6c39 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/transform.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/amd/custom/transform.txt @@ -1 +1 @@ -transform \ No newline at end of file +transform-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/banner.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/banner.txt index 12577274ecd..b64fd741450 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/banner.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/banner.txt @@ -1 +1 @@ -banner \ No newline at end of file +banner-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/buildEnd.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/buildEnd.txt index bbb07acb9fc..845ccdb645d 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/buildEnd.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/buildEnd.txt @@ -1 +1 @@ -buildEnd \ No newline at end of file +buildEnd-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/buildStart.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/buildStart.txt index 0cb77258e0a..e45aee41d15 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/buildStart.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/buildStart.txt @@ -1 +1 @@ -buildStart \ No newline at end of file +buildStart-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/footer.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/footer.txt index a56ca533272..8c589a50af2 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/footer.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/footer.txt @@ -1 +1 @@ -footer \ No newline at end of file +footer-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/generateBundle.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/generateBundle.txt index de472563b28..155523bd6b3 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/generateBundle.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/generateBundle.txt @@ -1 +1 @@ -generateBundle \ No newline at end of file +generateBundle-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/intro.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/intro.txt index 29fbe946bf9..3e663da2b46 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/intro.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/intro.txt @@ -1 +1 @@ -intro \ No newline at end of file +intro-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/load.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/load.txt index 024e67c1f24..7bac7254119 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/load.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/load.txt @@ -1 +1 @@ -load \ No newline at end of file +load-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/outro.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/outro.txt index 31035209b9e..77a881ecde8 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/outro.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/outro.txt @@ -1 +1 @@ -outro \ No newline at end of file +outro-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/renderChunk.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/renderChunk.txt index 22f947650b0..3930812883e 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/renderChunk.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/renderChunk.txt @@ -1 +1 @@ -renderChunk \ No newline at end of file +renderChunk-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/renderStart.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/renderStart.txt index 3cdc0005056..a3d2c08e3fb 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/renderStart.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/renderStart.txt @@ -1 +1 @@ -renderStart \ No newline at end of file +renderStart-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/resolveId.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/resolveId.txt index 53029113abd..7286bfbd602 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/resolveId.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/resolveId.txt @@ -1 +1 @@ -resolveId \ No newline at end of file +resolveId-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/transform.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/transform.txt index 3f001116657..ce2fb1d6c39 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/transform.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/cjs/custom/transform.txt @@ -1 +1 @@ -transform \ No newline at end of file +transform-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/banner.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/banner.txt index 12577274ecd..b64fd741450 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/banner.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/banner.txt @@ -1 +1 @@ -banner \ No newline at end of file +banner-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/buildEnd.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/buildEnd.txt index bbb07acb9fc..845ccdb645d 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/buildEnd.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/buildEnd.txt @@ -1 +1 @@ -buildEnd \ No newline at end of file +buildEnd-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/buildStart.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/buildStart.txt index 0cb77258e0a..e45aee41d15 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/buildStart.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/buildStart.txt @@ -1 +1 @@ -buildStart \ No newline at end of file +buildStart-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/footer.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/footer.txt index a56ca533272..8c589a50af2 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/footer.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/footer.txt @@ -1 +1 @@ -footer \ No newline at end of file +footer-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/generateBundle.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/generateBundle.txt index de472563b28..155523bd6b3 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/generateBundle.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/generateBundle.txt @@ -1 +1 @@ -generateBundle \ No newline at end of file +generateBundle-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/intro.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/intro.txt index 29fbe946bf9..3e663da2b46 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/intro.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/intro.txt @@ -1 +1 @@ -intro \ No newline at end of file +intro-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/load.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/load.txt index 024e67c1f24..7bac7254119 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/load.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/load.txt @@ -1 +1 @@ -load \ No newline at end of file +load-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/outro.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/outro.txt index 31035209b9e..77a881ecde8 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/outro.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/outro.txt @@ -1 +1 @@ -outro \ No newline at end of file +outro-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/renderChunk.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/renderChunk.txt index 22f947650b0..3930812883e 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/renderChunk.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/renderChunk.txt @@ -1 +1 @@ -renderChunk \ No newline at end of file +renderChunk-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/renderStart.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/renderStart.txt index 3cdc0005056..a3d2c08e3fb 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/renderStart.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/renderStart.txt @@ -1 +1 @@ -renderStart \ No newline at end of file +renderStart-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/resolveId.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/resolveId.txt index 53029113abd..7286bfbd602 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/resolveId.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/resolveId.txt @@ -1 +1 @@ -resolveId \ No newline at end of file +resolveId-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/transform.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/transform.txt index 3f001116657..ce2fb1d6c39 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/transform.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/es/custom/transform.txt @@ -1 +1 @@ -transform \ No newline at end of file +transform-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/banner.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/banner.txt index 12577274ecd..b64fd741450 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/banner.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/banner.txt @@ -1 +1 @@ -banner \ No newline at end of file +banner-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/buildEnd.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/buildEnd.txt index bbb07acb9fc..845ccdb645d 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/buildEnd.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/buildEnd.txt @@ -1 +1 @@ -buildEnd \ No newline at end of file +buildEnd-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/buildStart.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/buildStart.txt index 0cb77258e0a..e45aee41d15 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/buildStart.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/buildStart.txt @@ -1 +1 @@ -buildStart \ No newline at end of file +buildStart-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/footer.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/footer.txt index a56ca533272..8c589a50af2 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/footer.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/footer.txt @@ -1 +1 @@ -footer \ No newline at end of file +footer-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/generateBundle.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/generateBundle.txt index de472563b28..155523bd6b3 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/generateBundle.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/generateBundle.txt @@ -1 +1 @@ -generateBundle \ No newline at end of file +generateBundle-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/intro.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/intro.txt index 29fbe946bf9..3e663da2b46 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/intro.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/intro.txt @@ -1 +1 @@ -intro \ No newline at end of file +intro-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/load.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/load.txt index 024e67c1f24..7bac7254119 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/load.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/load.txt @@ -1 +1 @@ -load \ No newline at end of file +load-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/outro.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/outro.txt index 31035209b9e..77a881ecde8 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/outro.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/outro.txt @@ -1 +1 @@ -outro \ No newline at end of file +outro-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/renderChunk.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/renderChunk.txt index 22f947650b0..3930812883e 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/renderChunk.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/renderChunk.txt @@ -1 +1 @@ -renderChunk \ No newline at end of file +renderChunk-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/renderStart.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/renderStart.txt index 3cdc0005056..a3d2c08e3fb 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/renderStart.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/renderStart.txt @@ -1 +1 @@ -renderStart \ No newline at end of file +renderStart-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/resolveId.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/resolveId.txt index 53029113abd..7286bfbd602 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/resolveId.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/resolveId.txt @@ -1 +1 @@ -resolveId \ No newline at end of file +resolveId-custom \ No newline at end of file diff --git a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/transform.txt b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/transform.txt index 3f001116657..ce2fb1d6c39 100644 --- a/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/transform.txt +++ b/test/chunking-form/samples/emit-file/emits-files-from-various-hooks/_expected/system/custom/transform.txt @@ -1 +1 @@ -transform \ No newline at end of file +transform-custom \ No newline at end of file diff --git a/test/form/samples/emit-uint8array-no-buffer/_config.js b/test/form/samples/emit-uint8array-no-buffer/_config.js index 501a5319eca..d4f140bcef7 100644 --- a/test/form/samples/emit-uint8array-no-buffer/_config.js +++ b/test/form/samples/emit-uint8array-no-buffer/_config.js @@ -1,8 +1,7 @@ const Buffer = global.Buffer; module.exports = { - description: - 'supports emitting assets as Uint8Arrays when Buffer is not available with deduplication', + description: 'supports emitting assets as Uint8Arrays when Buffer is not available', before() { delete global.Buffer; }, @@ -20,7 +19,7 @@ module.exports = { if (id.startsWith('asset')) { return `export default import.meta.ROLLUP_FILE_URL_${this.emitFile({ type: 'asset', - source: Uint8Array.from(Array.from(id.slice(0, -1)).map(char => char.charCodeAt(0))) + source: Uint8Array.from(Array.from(id, char => char.charCodeAt(0))) })};`; } } diff --git a/test/form/samples/emit-uint8array-no-buffer/_expected/amd.js b/test/form/samples/emit-uint8array-no-buffer/_expected/amd.js index 87efea4471d..4dd0a3d99aa 100644 --- a/test/form/samples/emit-uint8array-no-buffer/_expected/amd.js +++ b/test/form/samples/emit-uint8array-no-buffer/_expected/amd.js @@ -1,15 +1,11 @@ define(['require'], (function (require) { 'use strict'; - var asset1a = new URL(require.toUrl('./assets/asset-8e3dd2ea'), document.baseURI).href; + var asset1 = new URL(require.toUrl('./assets/asset-8e3dd2ea'), document.baseURI).href; - var asset1b = new URL(require.toUrl('./assets/asset-8e3dd2ea'), document.baseURI).href; + var asset2 = new URL(require.toUrl('./assets/asset-75590fc1'), document.baseURI).href; - var asset2a = new URL(require.toUrl('./assets/asset-75590fc1'), document.baseURI).href; + var asset99 = new URL(require.toUrl('./assets/asset-60cc5dc9'), document.baseURI).href; - var asset2b = new URL(require.toUrl('./assets/asset-75590fc1'), document.baseURI).href; - - var asset99a = new URL(require.toUrl('./assets/asset-60cc5dc9'), document.baseURI).href; - - console.log(asset1a, asset1b, asset2a, asset2b, asset99a); + console.log(asset1, asset2, asset99); })); diff --git a/test/form/samples/emit-uint8array-no-buffer/_expected/cjs.js b/test/form/samples/emit-uint8array-no-buffer/_expected/cjs.js index 083e9204889..bea7aef1c6d 100644 --- a/test/form/samples/emit-uint8array-no-buffer/_expected/cjs.js +++ b/test/form/samples/emit-uint8array-no-buffer/_expected/cjs.js @@ -1,13 +1,9 @@ 'use strict'; -var asset1a = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __dirname + '/assets/asset-8e3dd2ea').href : new URL('assets/asset-8e3dd2ea', document.currentScript && document.currentScript.src || document.baseURI).href); +var asset1 = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __dirname + '/assets/asset-8e3dd2ea').href : new URL('assets/asset-8e3dd2ea', document.currentScript && document.currentScript.src || document.baseURI).href); -var asset1b = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __dirname + '/assets/asset-8e3dd2ea').href : new URL('assets/asset-8e3dd2ea', document.currentScript && document.currentScript.src || document.baseURI).href); +var asset2 = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __dirname + '/assets/asset-75590fc1').href : new URL('assets/asset-75590fc1', document.currentScript && document.currentScript.src || document.baseURI).href); -var asset2a = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __dirname + '/assets/asset-75590fc1').href : new URL('assets/asset-75590fc1', document.currentScript && document.currentScript.src || document.baseURI).href); +var asset99 = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __dirname + '/assets/asset-60cc5dc9').href : new URL('assets/asset-60cc5dc9', document.currentScript && document.currentScript.src || document.baseURI).href); -var asset2b = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __dirname + '/assets/asset-75590fc1').href : new URL('assets/asset-75590fc1', document.currentScript && document.currentScript.src || document.baseURI).href); - -var asset99a = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __dirname + '/assets/asset-60cc5dc9').href : new URL('assets/asset-60cc5dc9', document.currentScript && document.currentScript.src || document.baseURI).href); - -console.log(asset1a, asset1b, asset2a, asset2b, asset99a); +console.log(asset1, asset2, asset99); diff --git a/test/form/samples/emit-uint8array-no-buffer/_expected/es.js b/test/form/samples/emit-uint8array-no-buffer/_expected/es.js index f61d2fab4e9..b534c76f8fb 100644 --- a/test/form/samples/emit-uint8array-no-buffer/_expected/es.js +++ b/test/form/samples/emit-uint8array-no-buffer/_expected/es.js @@ -1,11 +1,7 @@ -var asset1a = new URL('assets/asset-8e3dd2ea', import.meta.url).href; +var asset1 = new URL('assets/asset-8e3dd2ea', import.meta.url).href; -var asset1b = new URL('assets/asset-8e3dd2ea', import.meta.url).href; +var asset2 = new URL('assets/asset-75590fc1', import.meta.url).href; -var asset2a = new URL('assets/asset-75590fc1', import.meta.url).href; +var asset99 = new URL('assets/asset-60cc5dc9', import.meta.url).href; -var asset2b = new URL('assets/asset-75590fc1', import.meta.url).href; - -var asset99a = new URL('assets/asset-60cc5dc9', import.meta.url).href; - -console.log(asset1a, asset1b, asset2a, asset2b, asset99a); +console.log(asset1, asset2, asset99); diff --git a/test/form/samples/emit-uint8array-no-buffer/_expected/iife.js b/test/form/samples/emit-uint8array-no-buffer/_expected/iife.js index 7735d95046d..0f2545ae033 100644 --- a/test/form/samples/emit-uint8array-no-buffer/_expected/iife.js +++ b/test/form/samples/emit-uint8array-no-buffer/_expected/iife.js @@ -1,16 +1,12 @@ (function () { 'use strict'; - var asset1a = new URL('assets/asset-8e3dd2ea', document.currentScript && document.currentScript.src || document.baseURI).href; + var asset1 = new URL('assets/asset-8e3dd2ea', document.currentScript && document.currentScript.src || document.baseURI).href; - var asset1b = new URL('assets/asset-8e3dd2ea', document.currentScript && document.currentScript.src || document.baseURI).href; + var asset2 = new URL('assets/asset-75590fc1', document.currentScript && document.currentScript.src || document.baseURI).href; - var asset2a = new URL('assets/asset-75590fc1', document.currentScript && document.currentScript.src || document.baseURI).href; + var asset99 = new URL('assets/asset-60cc5dc9', document.currentScript && document.currentScript.src || document.baseURI).href; - var asset2b = new URL('assets/asset-75590fc1', document.currentScript && document.currentScript.src || document.baseURI).href; - - var asset99a = new URL('assets/asset-60cc5dc9', document.currentScript && document.currentScript.src || document.baseURI).href; - - console.log(asset1a, asset1b, asset2a, asset2b, asset99a); + console.log(asset1, asset2, asset99); })(); diff --git a/test/form/samples/emit-uint8array-no-buffer/_expected/system.js b/test/form/samples/emit-uint8array-no-buffer/_expected/system.js index dc3b8c0c825..6ea30debbf4 100644 --- a/test/form/samples/emit-uint8array-no-buffer/_expected/system.js +++ b/test/form/samples/emit-uint8array-no-buffer/_expected/system.js @@ -3,17 +3,13 @@ System.register([], (function (exports, module) { return { execute: (function () { - var asset1a = new URL('assets/asset-8e3dd2ea', module.meta.url).href; + var asset1 = new URL('assets/asset-8e3dd2ea', module.meta.url).href; - var asset1b = new URL('assets/asset-8e3dd2ea', module.meta.url).href; + var asset2 = new URL('assets/asset-75590fc1', module.meta.url).href; - var asset2a = new URL('assets/asset-75590fc1', module.meta.url).href; + var asset99 = new URL('assets/asset-60cc5dc9', module.meta.url).href; - var asset2b = new URL('assets/asset-75590fc1', module.meta.url).href; - - var asset99a = new URL('assets/asset-60cc5dc9', module.meta.url).href; - - console.log(asset1a, asset1b, asset2a, asset2b, asset99a); + console.log(asset1, asset2, asset99); }) }; diff --git a/test/form/samples/emit-uint8array-no-buffer/_expected/umd.js b/test/form/samples/emit-uint8array-no-buffer/_expected/umd.js index 18c43ff8451..2edce821bb2 100644 --- a/test/form/samples/emit-uint8array-no-buffer/_expected/umd.js +++ b/test/form/samples/emit-uint8array-no-buffer/_expected/umd.js @@ -3,16 +3,12 @@ factory(); })((function () { 'use strict'; - var asset1a = (typeof document === 'undefined' && typeof location === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __dirname + '/assets/asset-8e3dd2ea').href : new URL('assets/asset-8e3dd2ea', typeof document === 'undefined' ? location.href : document.currentScript && document.currentScript.src || document.baseURI).href); + var asset1 = (typeof document === 'undefined' && typeof location === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __dirname + '/assets/asset-8e3dd2ea').href : new URL('assets/asset-8e3dd2ea', typeof document === 'undefined' ? location.href : document.currentScript && document.currentScript.src || document.baseURI).href); - var asset1b = (typeof document === 'undefined' && typeof location === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __dirname + '/assets/asset-8e3dd2ea').href : new URL('assets/asset-8e3dd2ea', typeof document === 'undefined' ? location.href : document.currentScript && document.currentScript.src || document.baseURI).href); + var asset2 = (typeof document === 'undefined' && typeof location === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __dirname + '/assets/asset-75590fc1').href : new URL('assets/asset-75590fc1', typeof document === 'undefined' ? location.href : document.currentScript && document.currentScript.src || document.baseURI).href); - var asset2a = (typeof document === 'undefined' && typeof location === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __dirname + '/assets/asset-75590fc1').href : new URL('assets/asset-75590fc1', typeof document === 'undefined' ? location.href : document.currentScript && document.currentScript.src || document.baseURI).href); + var asset99 = (typeof document === 'undefined' && typeof location === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __dirname + '/assets/asset-60cc5dc9').href : new URL('assets/asset-60cc5dc9', typeof document === 'undefined' ? location.href : document.currentScript && document.currentScript.src || document.baseURI).href); - var asset2b = (typeof document === 'undefined' && typeof location === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __dirname + '/assets/asset-75590fc1').href : new URL('assets/asset-75590fc1', typeof document === 'undefined' ? location.href : document.currentScript && document.currentScript.src || document.baseURI).href); - - var asset99a = (typeof document === 'undefined' && typeof location === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __dirname + '/assets/asset-60cc5dc9').href : new URL('assets/asset-60cc5dc9', typeof document === 'undefined' ? location.href : document.currentScript && document.currentScript.src || document.baseURI).href); - - console.log(asset1a, asset1b, asset2a, asset2b, asset99a); + console.log(asset1, asset2, asset99); })); diff --git a/test/form/samples/emit-uint8array-no-buffer/main.js b/test/form/samples/emit-uint8array-no-buffer/main.js index ce1ffc35765..443b7587476 100644 --- a/test/form/samples/emit-uint8array-no-buffer/main.js +++ b/test/form/samples/emit-uint8array-no-buffer/main.js @@ -1,7 +1,5 @@ -import asset1a from 'asset1a'; -import asset1b from 'asset1b'; -import asset2a from 'asset2a'; -import asset2b from 'asset2b'; -import asset99a from 'asset99a'; +import asset1 from 'asset1'; +import asset2 from 'asset2'; +import asset99 from 'asset99'; -console.log(asset1a, asset1b, asset2a, asset2b, asset99a); +console.log(asset1, asset2, asset99); diff --git a/test/function/samples/emit-file/asset-source-invalid3/_config.js b/test/function/samples/emit-file/asset-source-invalid3/_config.js index 63d0f7cd843..411b195433c 100644 --- a/test/function/samples/emit-file/asset-source-invalid3/_config.js +++ b/test/function/samples/emit-file/asset-source-invalid3/_config.js @@ -13,7 +13,7 @@ module.exports = { code: 'PLUGIN_ERROR', hook: 'buildStart', message: - 'Could not set source for asset "d59386e0", asset source needs to be a string, Uint8Array or Buffer.', + 'Could not set source for asset "6b86b273", asset source needs to be a string, Uint8Array or Buffer.', plugin: 'test-plugin', pluginCode: 'VALIDATION_ERROR' } diff --git a/test/function/samples/emit-file/asset-source-missing2/_config.js b/test/function/samples/emit-file/asset-source-missing2/_config.js index fad75fd1542..20a1975c3b5 100644 --- a/test/function/samples/emit-file/asset-source-missing2/_config.js +++ b/test/function/samples/emit-file/asset-source-missing2/_config.js @@ -10,6 +10,6 @@ module.exports = { }, generateError: { code: 'ASSET_SOURCE_MISSING', - message: 'Plugin error creating asset "d59386e0" - no asset source set.' + message: 'Plugin error creating asset "6b86b273" - no asset source set.' } }; diff --git a/test/function/samples/emit-file/asset-source-missing4/_config.js b/test/function/samples/emit-file/asset-source-missing4/_config.js index 2ff72ef342b..b55fb138b78 100644 --- a/test/function/samples/emit-file/asset-source-missing4/_config.js +++ b/test/function/samples/emit-file/asset-source-missing4/_config.js @@ -13,7 +13,7 @@ module.exports = { code: 'PLUGIN_ERROR', hook: 'buildStart', message: - 'Plugin error - Unable to get file name for asset "d59386e0". Ensure that the source is set and that generate is called first. If you reference assets via import.meta.ROLLUP_FILE_URL_, you need to either have set their source after "renderStart" or need to provide an explicit "fileName" when emitting them.', + 'Plugin error - Unable to get file name for asset "6b86b273". Ensure that the source is set and that generate is called first. If you reference assets via import.meta.ROLLUP_FILE_URL_, you need to either have set their source after "renderStart" or need to provide an explicit "fileName" when emitting them.', plugin: 'test-plugin', pluginCode: 'ASSET_NOT_FINALISED' } diff --git a/test/function/samples/emit-file/set-asset-source-twice2/_config.js b/test/function/samples/emit-file/set-asset-source-twice2/_config.js index b02d47bfa18..92e38307cc0 100644 --- a/test/function/samples/emit-file/set-asset-source-twice2/_config.js +++ b/test/function/samples/emit-file/set-asset-source-twice2/_config.js @@ -13,7 +13,7 @@ module.exports = { error: { code: 'PLUGIN_ERROR', hook: 'buildEnd', - message: 'Unable to set the source for asset "d59386e0", source already set.', + message: 'Unable to set the source for asset "6b86b273", source already set.', plugin: 'test-plugin', pluginCode: 'ASSET_SOURCE_ALREADY_SET' }