diff --git a/.eslintrc.js b/.eslintrc.js index c26b7c1c426..c40b7adf8ad 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -74,7 +74,11 @@ module.exports = { '@typescript-eslint/no-empty-function': 'off', '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-non-null-assertion': 'off', - '@typescript-eslint/no-unused-vars': 'off', + '@typescript-eslint/no-unused-vars': [ + 'error', + { argsIgnorePattern: '^_', ignoreRestSiblings: true, varsIgnorePattern: '^_' } + ], + 'arrow-body-style': ['error', 'as-needed'], 'dot-notation': 'error', 'import/no-unresolved': [ 'error', diff --git a/browser/package.json b/browser/package.json index 59f30d54713..35f4e533114 100644 --- a/browser/package.json +++ b/browser/package.json @@ -1,6 +1,6 @@ { "name": "@rollup/browser", - "version": "3.2.5", + "version": "3.3.0-0", "description": "Next-generation ES module bundler browser build", "main": "dist/rollup.browser.js", "module": "dist/es/rollup.browser.js", diff --git a/docs/999-big-list-of-options.md b/docs/999-big-list-of-options.md index 0eff6b40e3c..2f87c1887b0 100755 --- a/docs/999-big-list-of-options.md +++ b/docs/999-big-list-of-options.md @@ -1890,6 +1890,16 @@ Type: `number`
CLI: `--experimentalCacheExpiry `
Default: Determines after how many runs cached assets that are no longer used by plugins should be removed. +#### experimentalMinChunkSize + +Type: `number`
CLI: `--experimentalMinChunkSize `
Default: `0` + +Set a minimal chunk size target in Byte for code-splitting setups. When this value is greater than `0`, Rollup will try to merge any chunk that does not have side effects when executed, i.e. any chunk that only contains function definitions etc., and is below this size limit into another chunk that is likely to be loaded under similar conditions. + +This will mean that the generated bundle will possibly load code that is not required yet in order to reduce the number of chunks. The condition for the merged chunks to be side effect free ensures that this does not change behaviour. + +Unfortunately, due to the way chunking works, chunk size is measured before any chunk rendering plugins like minifiers ran, which means you should use a high enough limit to take this into account. + #### perf Type: `boolean`
CLI: `--perf`/`--no-perf`
Default: `false` diff --git a/package-lock.json b/package-lock.json index 0daf0cc81ac..181f122115b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rollup", - "version": "3.2.5", + "version": "3.3.0-0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "rollup", - "version": "3.2.5", + "version": "3.3.0-0", "license": "MIT", "bin": { "rollup": "dist/bin/rollup" diff --git a/package.json b/package.json index d9eaa45b58c..1086375784d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rollup", - "version": "3.2.5", + "version": "3.3.0-0", "description": "Next-generation ES module bundler", "main": "dist/rollup.js", "module": "dist/es/rollup.js", diff --git a/src/Bundle.ts b/src/Bundle.ts index 0fa74c6acbd..5969c4f2891 100644 --- a/src/Bundle.ts +++ b/src/Bundle.ts @@ -158,7 +158,8 @@ export default class Bundle { bundle: OutputBundleWithPlaceholders, getHashPlaceholder: HashPlaceholderGenerator ): Promise { - const { inlineDynamicImports, manualChunks, preserveModules } = this.outputOptions; + const { experimentalMinChunkSize, inlineDynamicImports, manualChunks, preserveModules } = + this.outputOptions; const manualChunkAliasByEntry = typeof manualChunks === 'object' ? await this.addManualChunks(manualChunks) @@ -177,7 +178,11 @@ export default class Bundle { ? [{ alias: null, modules: includedModules }] : preserveModules ? includedModules.map(module => ({ alias: null, modules: [module] })) - : getChunkAssignments(this.graph.entryModules, manualChunkAliasByEntry)) { + : getChunkAssignments( + this.graph.entryModules, + manualChunkAliasByEntry, + experimentalMinChunkSize + )) { sortByExecutionOrder(modules); const chunk = new Chunk( modules, diff --git a/src/Module.ts b/src/Module.ts index 9beefc79190..c7057240875 100644 --- a/src/Module.ts +++ b/src/Module.ts @@ -219,6 +219,7 @@ export default class Module { readonly info: ModuleInfo; isExecuted = false; isUserDefinedEntryPoint = false; + declare magicString: MagicString; declare namespace: NamespaceVariable; needsExportShim = false; declare originalCode: string; @@ -241,7 +242,6 @@ export default class Module { private exportNamesByVariable: Map | null = null; private readonly exportShimVariable = new ExportShimVariable(this); private readonly exports = new Map(); - private declare magicString: MagicString; private readonly namespaceReexportsByName = new Map< string, [variable: Variable | null, indirectExternal?: boolean] diff --git a/src/finalisers/es.ts b/src/finalisers/es.ts index 3e0b3abab5a..f40cf512b7d 100644 --- a/src/finalisers/es.ts +++ b/src/finalisers/es.ts @@ -62,11 +62,11 @@ function getImportBlock(dependencies: ChunkDependency[], { _ }: GenerateCodeSnip } else if (importedNames.length > 0) { importBlock.push( `import ${defaultImport ? `${defaultImport.local},${_}` : ''}{${_}${importedNames - .map(specifier => { - return specifier.imported === specifier.local + .map(specifier => + specifier.imported === specifier.local ? specifier.imported - : `${specifier.imported} as ${specifier.local}`; - }) + : `${specifier.imported} as ${specifier.local}` + ) .join(`,${_}`)}${_}}${_}from${_}${pathWithAssertion}` ); } @@ -105,11 +105,11 @@ function getImportBlock(dependencies: ChunkDependency[], { _ }: GenerateCodeSnip if (namedReexports.length > 0) { importBlock.push( `export${_}{${_}${namedReexports - .map(specifier => { - return specifier.imported === specifier.reexported + .map(specifier => + specifier.imported === specifier.reexported ? specifier.imported - : `${specifier.imported} as ${specifier.reexported}`; - }) + : `${specifier.imported} as ${specifier.reexported}` + ) .join(`,${_}`)}${_}}${_}from${_}${pathWithAssertion}` ); } diff --git a/src/rollup/types.d.ts b/src/rollup/types.d.ts index 70805021277..f40a3c8804b 100644 --- a/src/rollup/types.d.ts +++ b/src/rollup/types.d.ts @@ -639,6 +639,7 @@ export interface OutputOptions { dynamicImportInCjs?: boolean; entryFileNames?: string | ((chunkInfo: PreRenderedChunk) => string); esModule?: boolean | 'if-default-prop'; + experimentalMinChunkSize?: number; exports?: 'default' | 'named' | 'none' | 'auto'; extend?: boolean; externalImportAssertions?: boolean; @@ -691,6 +692,7 @@ export interface NormalizedOutputOptions { dynamicImportInCjs: boolean; entryFileNames: string | ((chunkInfo: PreRenderedChunk) => string); esModule: boolean | 'if-default-prop'; + experimentalMinChunkSize: number; exports: 'default' | 'named' | 'none' | 'auto'; extend: boolean; externalImportAssertions: boolean; diff --git a/src/utils/chunkAssignment.ts b/src/utils/chunkAssignment.ts index 4a42e3da78a..945a7393b7f 100644 --- a/src/utils/chunkAssignment.ts +++ b/src/utils/chunkAssignment.ts @@ -1,21 +1,26 @@ import ExternalModule from '../ExternalModule'; import Module from '../Module'; import { getOrCreate } from './getOrCreate'; +import { concatLazy } from './iterators'; +import { timeEnd, timeStart } from './timers'; type DependentModuleMap = Map>; type ChunkDefinitions = { alias: string | null; modules: Module[] }[]; export function getChunkAssignments( entryModules: readonly Module[], - manualChunkAliasByEntry: ReadonlyMap + manualChunkAliasByEntry: ReadonlyMap, + minChunkSize: number ): ChunkDefinitions { const chunkDefinitions: ChunkDefinitions = []; const modulesInManualChunks = new Set(manualChunkAliasByEntry.keys()); const manualChunkModulesByAlias: Record = Object.create(null); for (const [entry, alias] of manualChunkAliasByEntry) { - const chunkModules = (manualChunkModulesByAlias[alias] = - manualChunkModulesByAlias[alias] || []); - addStaticDependenciesToManualChunk(entry, chunkModules, modulesInManualChunks); + addStaticDependenciesToManualChunk( + entry, + (manualChunkModulesByAlias[alias] ||= []), + modulesInManualChunks + ); } for (const [alias, modules] of Object.entries(manualChunkModulesByAlias)) { chunkDefinitions.push({ alias, modules }); @@ -87,7 +92,11 @@ export function getChunkAssignments( } chunkDefinitions.push( - ...createChunks([...entryModules, ...dynamicEntryModules], assignedEntryPointsByModule) + ...createChunks( + [...entryModules, ...dynamicEntryModules], + assignedEntryPointsByModule, + minChunkSize + ) ); return chunkDefinitions; } @@ -163,15 +172,93 @@ function getDynamicDependentEntryPoints( return dynamicallyDependentEntryPointsByDynamicEntry; } +interface ChunkDescription { + alias: null; + modules: Module[]; + signature: string; + size: number | null; +} + +interface MergeableChunkDescription extends ChunkDescription { + size: number; +} + function createChunks( allEntryPoints: readonly Module[], - assignedEntryPointsByModule: DependentModuleMap + assignedEntryPointsByModule: DependentModuleMap, + minChunkSize: number ): ChunkDefinitions { + const chunkModulesBySignature = getChunkModulesBySignature( + assignedEntryPointsByModule, + allEntryPoints + ); + return minChunkSize === 0 + ? Object.values(chunkModulesBySignature).map(modules => ({ + alias: null, + modules + })) + : getOptimizedChunks(chunkModulesBySignature, minChunkSize); +} + +function getOptimizedChunks( + chunkModulesBySignature: { [chunkSignature: string]: Module[] }, + minChunkSize: number +) { + timeStart('optimize chunks', 3); + const { chunksToBeMerged, unmergeableChunks } = getMergeableChunks( + chunkModulesBySignature, + minChunkSize + ); + for (const sourceChunk of chunksToBeMerged) { + chunksToBeMerged.delete(sourceChunk); + let closestChunk: ChunkDescription | null = null; + let closestChunkDistance = Infinity; + const { signature, size, modules } = sourceChunk; + + for (const targetChunk of concatLazy(chunksToBeMerged, unmergeableChunks)) { + const distance = getSignatureDistance( + signature, + targetChunk.signature, + !chunksToBeMerged.has(targetChunk) + ); + if (distance === 1) { + closestChunk = targetChunk; + break; + } else if (distance < closestChunkDistance) { + closestChunk = targetChunk; + closestChunkDistance = distance; + } + } + if (closestChunk) { + closestChunk.modules.push(...modules); + if (chunksToBeMerged.has(closestChunk)) { + closestChunk.signature = mergeSignatures(signature, closestChunk.signature); + if ((closestChunk.size += size) > minChunkSize) { + chunksToBeMerged.delete(closestChunk); + unmergeableChunks.push(closestChunk); + } + } + } else { + unmergeableChunks.push(sourceChunk); + } + } + timeEnd('optimize chunks', 3); + return unmergeableChunks; +} + +const CHAR_DEPENDENT = 'X'; +const CHAR_INDEPENDENT = '_'; +const CHAR_CODE_DEPENDENT = CHAR_DEPENDENT.charCodeAt(0); + +function getChunkModulesBySignature( + assignedEntryPointsByModule: Map>, + allEntryPoints: readonly Module[] +) { const chunkModules: { [chunkSignature: string]: Module[] } = Object.create(null); for (const [module, assignedEntryPoints] of assignedEntryPointsByModule) { let chunkSignature = ''; for (const entry of allEntryPoints) { - chunkSignature += assignedEntryPoints.has(entry) ? 'X' : '_'; + chunkSignature += assignedEntryPoints.has(entry) ? CHAR_DEPENDENT : CHAR_INDEPENDENT; } const chunk = chunkModules[chunkSignature]; if (chunk) { @@ -180,8 +267,66 @@ function createChunks( chunkModules[chunkSignature] = [module]; } } - return Object.values(chunkModules).map(modules => ({ - alias: null, - modules - })); + return chunkModules; +} + +function getMergeableChunks( + chunkModulesBySignature: { [chunkSignature: string]: Module[] }, + minChunkSize: number +) { + const chunksToBeMerged = new Set() as Set & { + has(chunk: unknown): chunk is MergeableChunkDescription; + }; + const unmergeableChunks: ChunkDescription[] = []; + const alias = null; + for (const [signature, modules] of Object.entries(chunkModulesBySignature)) { + let size = 0; + checkModules: { + for (const module of modules) { + if (module.hasEffects()) { + break checkModules; + } + size += module.magicString.toString().length; + if (size > minChunkSize) { + break checkModules; + } + } + chunksToBeMerged.add({ alias, modules, signature, size }); + continue; + } + unmergeableChunks.push({ alias, modules, signature, size: null }); + } + return { chunksToBeMerged, unmergeableChunks }; +} + +function getSignatureDistance( + sourceSignature: string, + targetSignature: string, + enforceSubset: boolean +): number { + let distance = 0; + const { length } = sourceSignature; + for (let index = 0; index < length; index++) { + const sourceValue = sourceSignature.charCodeAt(index); + if (sourceValue !== targetSignature.charCodeAt(index)) { + if (enforceSubset && sourceValue === CHAR_CODE_DEPENDENT) { + return Infinity; + } + distance++; + } + } + return distance; +} + +function mergeSignatures(sourceSignature: string, targetSignature: string): string { + let signature = ''; + const { length } = sourceSignature; + for (let index = 0; index < length; index++) { + signature += + sourceSignature.charCodeAt(index) === CHAR_CODE_DEPENDENT || + targetSignature.charCodeAt(index) === CHAR_CODE_DEPENDENT + ? CHAR_DEPENDENT + : CHAR_INDEPENDENT; + } + return signature; } diff --git a/src/utils/iterators.ts b/src/utils/iterators.ts new file mode 100644 index 00000000000..afbe9eb1850 --- /dev/null +++ b/src/utils/iterators.ts @@ -0,0 +1,10 @@ +/** + * Concatenate a number of iterables to a new iterable without fully evaluating + * their iterators. Useful when e.g. working with large sets or lists and when + * there is a chance that the iterators will not be fully exhausted. + */ +export function* concatLazy(...iterables: Iterable[]) { + for (const iterable of iterables) { + yield* iterable; + } +} diff --git a/src/utils/options/mergeOptions.ts b/src/utils/options/mergeOptions.ts index be429cfb598..84426118b93 100644 --- a/src/utils/options/mergeOptions.ts +++ b/src/utils/options/mergeOptions.ts @@ -232,6 +232,7 @@ async function mergeOutputOptions( dynamicImportInCjs: getOption('dynamicImportInCjs'), entryFileNames: getOption('entryFileNames'), esModule: getOption('esModule'), + experimentalMinChunkSize: getOption('experimentalMinChunkSize'), exports: getOption('exports'), extend: getOption('extend'), externalImportAssertions: getOption('externalImportAssertions'), diff --git a/src/utils/options/normalizeOutputOptions.ts b/src/utils/options/normalizeOutputOptions.ts index e03e92eba9b..8fc7974a4b1 100644 --- a/src/utils/options/normalizeOutputOptions.ts +++ b/src/utils/options/normalizeOutputOptions.ts @@ -50,6 +50,7 @@ export async function normalizeOutputOptions( dynamicImportInCjs: config.dynamicImportInCjs ?? true, entryFileNames: getEntryFileNames(config, unsetOptions), esModule: config.esModule ?? 'if-default-prop', + experimentalMinChunkSize: config.experimentalMinChunkSize || 0, exports: getExports(config, unsetOptions), extend: config.extend || false, externalImportAssertions: config.externalImportAssertions ?? true, diff --git a/src/utils/resolveIdViaPlugins.ts b/src/utils/resolveIdViaPlugins.ts index e842ac7a901..968754eb158 100644 --- a/src/utils/resolveIdViaPlugins.ts +++ b/src/utils/resolveIdViaPlugins.ts @@ -24,16 +24,15 @@ export function resolveIdViaPlugins( } replaceContext = (pluginContext, plugin): PluginContext => ({ ...pluginContext, - resolve: (source, importer, { assertions, custom, isEntry, skipSelf } = BLANK) => { - return moduleLoaderResolveId( + resolve: (source, importer, { assertions, custom, isEntry, skipSelf } = BLANK) => + moduleLoaderResolveId( source, importer, custom, isEntry, assertions || EMPTY_OBJECT, skipSelf ? [...skip, { importer, plugin, source }] : skip - ); - } + ) }); } return pluginDriver.hookFirst( diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_config.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_config.js new file mode 100644 index 00000000000..ca1b905a639 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_config.js @@ -0,0 +1,19 @@ +module.exports = { + description: 'uses the merge target that is closest', + options: { + input: [ + 'main1.js', + 'main2.js', + 'main3.js', + 'main4.js', + 'main5.js', + 'main6.js', + 'main7.js', + 'main8.js', + 'main9.js' + ], + output: { + experimentalMinChunkSize: 100 + } + } +}; diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/generated-small3.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/generated-small3.js new file mode 100644 index 00000000000..49e6098bfc0 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/generated-small3.js @@ -0,0 +1,10 @@ +define(['exports'], (function (exports) { 'use strict'; + + const small1 = '12345678901234567890123456789012345678901234567890'; + + const small3 = '12345678901234567890123456789012345678901234567890'; + + exports.small1 = small1; + exports.small3 = small3; + +})); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/generated-small4.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/generated-small4.js new file mode 100644 index 00000000000..daf2c213f67 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/generated-small4.js @@ -0,0 +1,10 @@ +define(['exports'], (function (exports) { 'use strict'; + + const small2 = '12345678901234567890123456789012345678901234567890'; + + const small4 = '12345678901234567890123456789012345678901234567890'; + + exports.small2 = small2; + exports.small4 = small4; + +})); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/main1.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/main1.js new file mode 100644 index 00000000000..f074a6d5def --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/main1.js @@ -0,0 +1,5 @@ +define(['./generated-small3'], (function (small3) { 'use strict'; + + console.log(small3.small1, small3.small3); + +})); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/main2.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/main2.js new file mode 100644 index 00000000000..44bef49d72c --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/main2.js @@ -0,0 +1,5 @@ +define(['./generated-small4'], (function (small4) { 'use strict'; + + console.log(small4.small2, small4.small4); + +})); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/main3.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/main3.js new file mode 100644 index 00000000000..0785e712ab3 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/main3.js @@ -0,0 +1,5 @@ +define(['./generated-small3', './generated-small4'], (function (small3, small4) { 'use strict'; + + console.log(small3.small1, small4.small2, small3.small3); + +})); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/main4.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/main4.js new file mode 100644 index 00000000000..12b20b02070 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/main4.js @@ -0,0 +1,5 @@ +define(['./generated-small4', './generated-small3'], (function (small4, small3) { 'use strict'; + + console.log(small4.small2, small3.small3, small4.small4); + +})); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/main5.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/main5.js new file mode 100644 index 00000000000..1a1b040b4e1 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/main5.js @@ -0,0 +1,5 @@ +define(['./generated-small3', './generated-small4'], (function (small3, small4) { 'use strict'; + + console.log(small3.small1, small4.small2, small3.small3, small4.small4); + +})); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/main6.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/main6.js new file mode 100644 index 00000000000..fc661223ef6 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/main6.js @@ -0,0 +1,5 @@ +define(['./generated-small3'], (function (small3) { 'use strict'; + + console.log(small3.small1); + +})); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/main7.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/main7.js new file mode 100644 index 00000000000..a3cb8a97dc1 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/main7.js @@ -0,0 +1,5 @@ +define(['./generated-small4'], (function (small4) { 'use strict'; + + console.log(small4.small2); + +})); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/main8.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/main8.js new file mode 100644 index 00000000000..3a158711344 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/main8.js @@ -0,0 +1,5 @@ +define(['./generated-small3'], (function (small3) { 'use strict'; + + console.log(small3.small3); + +})); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/main9.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/main9.js new file mode 100644 index 00000000000..6b8c31423f9 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/amd/main9.js @@ -0,0 +1,5 @@ +define(['./generated-small4'], (function (small4) { 'use strict'; + + console.log(small4.small4); + +})); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/generated-small3.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/generated-small3.js new file mode 100644 index 00000000000..18069fd3f58 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/generated-small3.js @@ -0,0 +1,8 @@ +'use strict'; + +const small1 = '12345678901234567890123456789012345678901234567890'; + +const small3 = '12345678901234567890123456789012345678901234567890'; + +exports.small1 = small1; +exports.small3 = small3; diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/generated-small4.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/generated-small4.js new file mode 100644 index 00000000000..21aa5ce965e --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/generated-small4.js @@ -0,0 +1,8 @@ +'use strict'; + +const small2 = '12345678901234567890123456789012345678901234567890'; + +const small4 = '12345678901234567890123456789012345678901234567890'; + +exports.small2 = small2; +exports.small4 = small4; diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/main1.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/main1.js new file mode 100644 index 00000000000..c646be4cd02 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/main1.js @@ -0,0 +1,5 @@ +'use strict'; + +var small3 = require('./generated-small3.js'); + +console.log(small3.small1, small3.small3); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/main2.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/main2.js new file mode 100644 index 00000000000..cf6c1d83230 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/main2.js @@ -0,0 +1,5 @@ +'use strict'; + +var small4 = require('./generated-small4.js'); + +console.log(small4.small2, small4.small4); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/main3.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/main3.js new file mode 100644 index 00000000000..7d7d2d0408d --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/main3.js @@ -0,0 +1,6 @@ +'use strict'; + +var small3 = require('./generated-small3.js'); +var small4 = require('./generated-small4.js'); + +console.log(small3.small1, small4.small2, small3.small3); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/main4.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/main4.js new file mode 100644 index 00000000000..bf856f12b5e --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/main4.js @@ -0,0 +1,6 @@ +'use strict'; + +var small4 = require('./generated-small4.js'); +var small3 = require('./generated-small3.js'); + +console.log(small4.small2, small3.small3, small4.small4); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/main5.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/main5.js new file mode 100644 index 00000000000..717cc3bd42c --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/main5.js @@ -0,0 +1,6 @@ +'use strict'; + +var small3 = require('./generated-small3.js'); +var small4 = require('./generated-small4.js'); + +console.log(small3.small1, small4.small2, small3.small3, small4.small4); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/main6.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/main6.js new file mode 100644 index 00000000000..18b40850296 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/main6.js @@ -0,0 +1,5 @@ +'use strict'; + +var small3 = require('./generated-small3.js'); + +console.log(small3.small1); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/main7.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/main7.js new file mode 100644 index 00000000000..acc70495643 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/main7.js @@ -0,0 +1,5 @@ +'use strict'; + +var small4 = require('./generated-small4.js'); + +console.log(small4.small2); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/main8.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/main8.js new file mode 100644 index 00000000000..75828acc595 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/main8.js @@ -0,0 +1,5 @@ +'use strict'; + +var small3 = require('./generated-small3.js'); + +console.log(small3.small3); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/main9.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/main9.js new file mode 100644 index 00000000000..ca6f97d273b --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/cjs/main9.js @@ -0,0 +1,5 @@ +'use strict'; + +var small4 = require('./generated-small4.js'); + +console.log(small4.small4); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/generated-small3.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/generated-small3.js new file mode 100644 index 00000000000..36334b79679 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/generated-small3.js @@ -0,0 +1,5 @@ +const small1 = '12345678901234567890123456789012345678901234567890'; + +const small3 = '12345678901234567890123456789012345678901234567890'; + +export { small3 as a, small1 as s }; diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/generated-small4.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/generated-small4.js new file mode 100644 index 00000000000..40d723d32e9 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/generated-small4.js @@ -0,0 +1,5 @@ +const small2 = '12345678901234567890123456789012345678901234567890'; + +const small4 = '12345678901234567890123456789012345678901234567890'; + +export { small4 as a, small2 as s }; diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/main1.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/main1.js new file mode 100644 index 00000000000..5d5b1f0dfb4 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/main1.js @@ -0,0 +1,3 @@ +import { s as small1, a as small3 } from './generated-small3.js'; + +console.log(small1, small3); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/main2.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/main2.js new file mode 100644 index 00000000000..59889e86399 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/main2.js @@ -0,0 +1,3 @@ +import { s as small2, a as small4 } from './generated-small4.js'; + +console.log(small2, small4); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/main3.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/main3.js new file mode 100644 index 00000000000..62ec7ca146c --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/main3.js @@ -0,0 +1,4 @@ +import { s as small1, a as small3 } from './generated-small3.js'; +import { s as small2 } from './generated-small4.js'; + +console.log(small1, small2, small3); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/main4.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/main4.js new file mode 100644 index 00000000000..d619901318e --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/main4.js @@ -0,0 +1,4 @@ +import { s as small2, a as small4 } from './generated-small4.js'; +import { a as small3 } from './generated-small3.js'; + +console.log(small2, small3, small4); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/main5.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/main5.js new file mode 100644 index 00000000000..3f66bbac955 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/main5.js @@ -0,0 +1,4 @@ +import { s as small1, a as small3 } from './generated-small3.js'; +import { s as small2, a as small4 } from './generated-small4.js'; + +console.log(small1, small2, small3, small4); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/main6.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/main6.js new file mode 100644 index 00000000000..f20d527cc99 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/main6.js @@ -0,0 +1,3 @@ +import { s as small1 } from './generated-small3.js'; + +console.log(small1); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/main7.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/main7.js new file mode 100644 index 00000000000..feb560c7ef1 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/main7.js @@ -0,0 +1,3 @@ +import { s as small2 } from './generated-small4.js'; + +console.log(small2); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/main8.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/main8.js new file mode 100644 index 00000000000..89638c4dde1 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/main8.js @@ -0,0 +1,3 @@ +import { a as small3 } from './generated-small3.js'; + +console.log(small3); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/main9.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/main9.js new file mode 100644 index 00000000000..2d15dc3b226 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/es/main9.js @@ -0,0 +1,3 @@ +import { a as small4 } from './generated-small4.js'; + +console.log(small4); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/generated-small3.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/generated-small3.js new file mode 100644 index 00000000000..ea38d4313cd --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/generated-small3.js @@ -0,0 +1,12 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + const small1 = exports('s', '12345678901234567890123456789012345678901234567890'); + + const small3 = exports('a', '12345678901234567890123456789012345678901234567890'); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/generated-small4.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/generated-small4.js new file mode 100644 index 00000000000..2ef00acfb34 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/generated-small4.js @@ -0,0 +1,12 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + const small2 = exports('s', '12345678901234567890123456789012345678901234567890'); + + const small4 = exports('a', '12345678901234567890123456789012345678901234567890'); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/main1.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/main1.js new file mode 100644 index 00000000000..88018d85dec --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/main1.js @@ -0,0 +1,15 @@ +System.register(['./generated-small3.js'], (function () { + 'use strict'; + var small1, small3; + return { + setters: [function (module) { + small1 = module.s; + small3 = module.a; + }], + execute: (function () { + + console.log(small1, small3); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/main2.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/main2.js new file mode 100644 index 00000000000..98383c7ab5e --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/main2.js @@ -0,0 +1,15 @@ +System.register(['./generated-small4.js'], (function () { + 'use strict'; + var small2, small4; + return { + setters: [function (module) { + small2 = module.s; + small4 = module.a; + }], + execute: (function () { + + console.log(small2, small4); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/main3.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/main3.js new file mode 100644 index 00000000000..d8f0bbb6977 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/main3.js @@ -0,0 +1,17 @@ +System.register(['./generated-small3.js', './generated-small4.js'], (function () { + 'use strict'; + var small1, small3, small2; + return { + setters: [function (module) { + small1 = module.s; + small3 = module.a; + }, function (module) { + small2 = module.s; + }], + execute: (function () { + + console.log(small1, small2, small3); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/main4.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/main4.js new file mode 100644 index 00000000000..b2b5a623b50 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/main4.js @@ -0,0 +1,17 @@ +System.register(['./generated-small4.js', './generated-small3.js'], (function () { + 'use strict'; + var small2, small4, small3; + return { + setters: [function (module) { + small2 = module.s; + small4 = module.a; + }, function (module) { + small3 = module.a; + }], + execute: (function () { + + console.log(small2, small3, small4); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/main5.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/main5.js new file mode 100644 index 00000000000..4a9d1ec994f --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/main5.js @@ -0,0 +1,18 @@ +System.register(['./generated-small3.js', './generated-small4.js'], (function () { + 'use strict'; + var small1, small3, small2, small4; + return { + setters: [function (module) { + small1 = module.s; + small3 = module.a; + }, function (module) { + small2 = module.s; + small4 = module.a; + }], + execute: (function () { + + console.log(small1, small2, small3, small4); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/main6.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/main6.js new file mode 100644 index 00000000000..78f62d05c7c --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/main6.js @@ -0,0 +1,14 @@ +System.register(['./generated-small3.js'], (function () { + 'use strict'; + var small1; + return { + setters: [function (module) { + small1 = module.s; + }], + execute: (function () { + + console.log(small1); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/main7.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/main7.js new file mode 100644 index 00000000000..f1fa78b8e8b --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/main7.js @@ -0,0 +1,14 @@ +System.register(['./generated-small4.js'], (function () { + 'use strict'; + var small2; + return { + setters: [function (module) { + small2 = module.s; + }], + execute: (function () { + + console.log(small2); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/main8.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/main8.js new file mode 100644 index 00000000000..f35ef372918 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/main8.js @@ -0,0 +1,14 @@ +System.register(['./generated-small3.js'], (function () { + 'use strict'; + var small3; + return { + setters: [function (module) { + small3 = module.a; + }], + execute: (function () { + + console.log(small3); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/main9.js b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/main9.js new file mode 100644 index 00000000000..918f32f15a3 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/_expected/system/main9.js @@ -0,0 +1,14 @@ +System.register(['./generated-small4.js'], (function () { + 'use strict'; + var small4; + return { + setters: [function (module) { + small4 = module.a; + }], + execute: (function () { + + console.log(small4); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/main1.js b/test/chunking-form/samples/minChunkSize/best-merge-target/main1.js new file mode 100644 index 00000000000..ff00ad482a2 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/main1.js @@ -0,0 +1,4 @@ +import { small1 } from './small1'; +import { small3 } from './small3'; + +console.log(small1, small3); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/main2.js b/test/chunking-form/samples/minChunkSize/best-merge-target/main2.js new file mode 100644 index 00000000000..b25ce08596e --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/main2.js @@ -0,0 +1,4 @@ +import { small2 } from './small2'; +import { small4 } from './small4'; + +console.log(small2, small4); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/main3.js b/test/chunking-form/samples/minChunkSize/best-merge-target/main3.js new file mode 100644 index 00000000000..8b799fc2a7b --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/main3.js @@ -0,0 +1,5 @@ +import { small1 } from './small1'; +import { small2 } from './small2'; +import { small3 } from './small3'; + +console.log(small1, small2, small3); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/main4.js b/test/chunking-form/samples/minChunkSize/best-merge-target/main4.js new file mode 100644 index 00000000000..8a49a8ebc7b --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/main4.js @@ -0,0 +1,5 @@ +import { small2 } from './small2'; +import { small3 } from './small3'; +import { small4 } from './small4'; + +console.log(small2, small3, small4); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/main5.js b/test/chunking-form/samples/minChunkSize/best-merge-target/main5.js new file mode 100644 index 00000000000..8f8fc42d6c6 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/main5.js @@ -0,0 +1,6 @@ +import { small1 } from './small1'; +import { small2 } from './small2'; +import { small3 } from './small3'; +import { small4 } from './small4'; + +console.log(small1, small2, small3, small4); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/main6.js b/test/chunking-form/samples/minChunkSize/best-merge-target/main6.js new file mode 100644 index 00000000000..e7180b14932 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/main6.js @@ -0,0 +1,3 @@ +import { small1 } from './small1'; + +console.log(small1); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/main7.js b/test/chunking-form/samples/minChunkSize/best-merge-target/main7.js new file mode 100644 index 00000000000..5104c70fc70 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/main7.js @@ -0,0 +1,3 @@ +import { small2 } from './small2'; + +console.log(small2); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/main8.js b/test/chunking-form/samples/minChunkSize/best-merge-target/main8.js new file mode 100644 index 00000000000..9b3e32cd341 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/main8.js @@ -0,0 +1,3 @@ +import { small3 } from './small3'; + +console.log(small3); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/main9.js b/test/chunking-form/samples/minChunkSize/best-merge-target/main9.js new file mode 100644 index 00000000000..87d1370ae33 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/main9.js @@ -0,0 +1,3 @@ +import { small4 } from './small4'; + +console.log(small4); diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/small1.js b/test/chunking-form/samples/minChunkSize/best-merge-target/small1.js new file mode 100644 index 00000000000..076d519a29d --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/small1.js @@ -0,0 +1 @@ +export const small1 = '12345678901234567890123456789012345678901234567890'; diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/small2.js b/test/chunking-form/samples/minChunkSize/best-merge-target/small2.js new file mode 100644 index 00000000000..1baf7456bcb --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/small2.js @@ -0,0 +1 @@ +export const small2 = '12345678901234567890123456789012345678901234567890'; diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/small3.js b/test/chunking-form/samples/minChunkSize/best-merge-target/small3.js new file mode 100644 index 00000000000..ca3abd77d3e --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/small3.js @@ -0,0 +1 @@ +export const small3 = '12345678901234567890123456789012345678901234567890'; diff --git a/test/chunking-form/samples/minChunkSize/best-merge-target/small4.js b/test/chunking-form/samples/minChunkSize/best-merge-target/small4.js new file mode 100644 index 00000000000..98e02ed47e9 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/best-merge-target/small4.js @@ -0,0 +1 @@ +export const small4 = '12345678901234567890123456789012345678901234567890'; diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_config.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_config.js new file mode 100644 index 00000000000..1b184ed33a0 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_config.js @@ -0,0 +1,10 @@ +module.exports = { + description: + 'merges small chunks into shared chunks that are loaded by a non-close super-set of entry points', + options: { + input: ['main1.js', 'main2.js', 'main3.js', 'main4.js'], + output: { + experimentalMinChunkSize: 100 + } + } +}; diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/amd/generated-shared.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/amd/generated-shared.js new file mode 100644 index 00000000000..14143b2a6af --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/amd/generated-shared.js @@ -0,0 +1,11 @@ +define(['exports'], (function (exports) { 'use strict'; + + const small = '1'; + + const shared = '1'; + console.log('effect'); + + exports.shared = shared; + exports.small = small; + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/amd/main1.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/amd/main1.js new file mode 100644 index 00000000000..da13f87a714 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/amd/main1.js @@ -0,0 +1,5 @@ +define(['./generated-shared'], (function (shared) { 'use strict'; + + console.log(shared.shared, shared.small); + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/amd/main2.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/amd/main2.js new file mode 100644 index 00000000000..da13f87a714 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/amd/main2.js @@ -0,0 +1,5 @@ +define(['./generated-shared'], (function (shared) { 'use strict'; + + console.log(shared.shared, shared.small); + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/amd/main3.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/amd/main3.js new file mode 100644 index 00000000000..4402ec2e891 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/amd/main3.js @@ -0,0 +1,5 @@ +define(['./generated-shared'], (function (shared) { 'use strict'; + + console.log(shared.shared); + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/amd/main4.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/amd/main4.js new file mode 100644 index 00000000000..4402ec2e891 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/amd/main4.js @@ -0,0 +1,5 @@ +define(['./generated-shared'], (function (shared) { 'use strict'; + + console.log(shared.shared); + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/cjs/generated-shared.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/cjs/generated-shared.js new file mode 100644 index 00000000000..2de6f6481e3 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/cjs/generated-shared.js @@ -0,0 +1,9 @@ +'use strict'; + +const small = '1'; + +const shared = '1'; +console.log('effect'); + +exports.shared = shared; +exports.small = small; diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/cjs/main1.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/cjs/main1.js new file mode 100644 index 00000000000..d789523b554 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/cjs/main1.js @@ -0,0 +1,5 @@ +'use strict'; + +var shared = require('./generated-shared.js'); + +console.log(shared.shared, shared.small); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/cjs/main2.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/cjs/main2.js new file mode 100644 index 00000000000..d789523b554 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/cjs/main2.js @@ -0,0 +1,5 @@ +'use strict'; + +var shared = require('./generated-shared.js'); + +console.log(shared.shared, shared.small); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/cjs/main3.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/cjs/main3.js new file mode 100644 index 00000000000..ca2995738b8 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/cjs/main3.js @@ -0,0 +1,5 @@ +'use strict'; + +var shared = require('./generated-shared.js'); + +console.log(shared.shared); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/cjs/main4.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/cjs/main4.js new file mode 100644 index 00000000000..ca2995738b8 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/cjs/main4.js @@ -0,0 +1,5 @@ +'use strict'; + +var shared = require('./generated-shared.js'); + +console.log(shared.shared); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/es/generated-shared.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/es/generated-shared.js new file mode 100644 index 00000000000..5f64665d615 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/es/generated-shared.js @@ -0,0 +1,6 @@ +const small = '1'; + +const shared = '1'; +console.log('effect'); + +export { small as a, shared as s }; diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/es/main1.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/es/main1.js new file mode 100644 index 00000000000..7632ccbb92d --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/es/main1.js @@ -0,0 +1,3 @@ +import { s as shared, a as small } from './generated-shared.js'; + +console.log(shared, small); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/es/main2.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/es/main2.js new file mode 100644 index 00000000000..7632ccbb92d --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/es/main2.js @@ -0,0 +1,3 @@ +import { s as shared, a as small } from './generated-shared.js'; + +console.log(shared, small); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/es/main3.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/es/main3.js new file mode 100644 index 00000000000..5fa03d326a0 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/es/main3.js @@ -0,0 +1,3 @@ +import { s as shared } from './generated-shared.js'; + +console.log(shared); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/es/main4.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/es/main4.js new file mode 100644 index 00000000000..5fa03d326a0 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/es/main4.js @@ -0,0 +1,3 @@ +import { s as shared } from './generated-shared.js'; + +console.log(shared); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/system/generated-shared.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/system/generated-shared.js new file mode 100644 index 00000000000..55a1c5bbefd --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/system/generated-shared.js @@ -0,0 +1,13 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + const small = exports('a', '1'); + + const shared = exports('s', '1'); + console.log('effect'); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/system/main1.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/system/main1.js new file mode 100644 index 00000000000..46b5be2e994 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/system/main1.js @@ -0,0 +1,15 @@ +System.register(['./generated-shared.js'], (function () { + 'use strict'; + var shared, small; + return { + setters: [function (module) { + shared = module.s; + small = module.a; + }], + execute: (function () { + + console.log(shared, small); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/system/main2.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/system/main2.js new file mode 100644 index 00000000000..46b5be2e994 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/system/main2.js @@ -0,0 +1,15 @@ +System.register(['./generated-shared.js'], (function () { + 'use strict'; + var shared, small; + return { + setters: [function (module) { + shared = module.s; + small = module.a; + }], + execute: (function () { + + console.log(shared, small); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/system/main3.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/system/main3.js new file mode 100644 index 00000000000..f926486d97e --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/system/main3.js @@ -0,0 +1,14 @@ +System.register(['./generated-shared.js'], (function () { + 'use strict'; + var shared; + return { + setters: [function (module) { + shared = module.s; + }], + execute: (function () { + + console.log(shared); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/system/main4.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/system/main4.js new file mode 100644 index 00000000000..f926486d97e --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/_expected/system/main4.js @@ -0,0 +1,14 @@ +System.register(['./generated-shared.js'], (function () { + 'use strict'; + var shared; + return { + setters: [function (module) { + shared = module.s; + }], + execute: (function () { + + console.log(shared); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/main1.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/main1.js new file mode 100644 index 00000000000..93f92a531bb --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/main1.js @@ -0,0 +1,4 @@ +import { small } from './small'; +import { shared } from './shared'; + +console.log(shared, small); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/main2.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/main2.js new file mode 100644 index 00000000000..93f92a531bb --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/main2.js @@ -0,0 +1,4 @@ +import { small } from './small'; +import { shared } from './shared'; + +console.log(shared, small); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/main3.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/main3.js new file mode 100644 index 00000000000..72cff2a340b --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/main3.js @@ -0,0 +1,3 @@ +import { shared } from './shared'; + +console.log(shared); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/main4.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/main4.js new file mode 100644 index 00000000000..72cff2a340b --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/main4.js @@ -0,0 +1,3 @@ +import { shared } from './shared'; + +console.log(shared); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/shared.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/shared.js new file mode 100644 index 00000000000..fda6d079f86 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/shared.js @@ -0,0 +1,2 @@ +export const shared = '1'; +console.log('effect'); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/small.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/small.js new file mode 100644 index 00000000000..64e15634102 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-distant-shared/small.js @@ -0,0 +1 @@ +export const small = '1'; diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_config.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_config.js new file mode 100644 index 00000000000..a6b8f26fbba --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_config.js @@ -0,0 +1,10 @@ +module.exports = { + description: + 'merges small chunks into shared chunks that are loaded by a super-set of entry points', + options: { + input: ['main1.js', 'main2.js', 'main3.js'], + output: { + experimentalMinChunkSize: 100 + } + } +}; diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/amd/generated-small.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/amd/generated-small.js new file mode 100644 index 00000000000..1353d019769 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/amd/generated-small.js @@ -0,0 +1,10 @@ +define(['exports'], (function (exports) { 'use strict'; + + const big = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; + + const small = '1'; + + exports.big = big; + exports.small = small; + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/amd/main1.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/amd/main1.js new file mode 100644 index 00000000000..ec8f5125645 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/amd/main1.js @@ -0,0 +1,5 @@ +define(['./generated-small'], (function (small) { 'use strict'; + + console.log(small.big, small.small); + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/amd/main2.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/amd/main2.js new file mode 100644 index 00000000000..ec8f5125645 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/amd/main2.js @@ -0,0 +1,5 @@ +define(['./generated-small'], (function (small) { 'use strict'; + + console.log(small.big, small.small); + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/amd/main3.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/amd/main3.js new file mode 100644 index 00000000000..7691effe419 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/amd/main3.js @@ -0,0 +1,5 @@ +define(['./generated-small'], (function (small) { 'use strict'; + + console.log(small.big); + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/cjs/generated-small.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/cjs/generated-small.js new file mode 100644 index 00000000000..9834f833d9c --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/cjs/generated-small.js @@ -0,0 +1,8 @@ +'use strict'; + +const big = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; + +const small = '1'; + +exports.big = big; +exports.small = small; diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/cjs/main1.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/cjs/main1.js new file mode 100644 index 00000000000..8d1efac502d --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/cjs/main1.js @@ -0,0 +1,5 @@ +'use strict'; + +var small = require('./generated-small.js'); + +console.log(small.big, small.small); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/cjs/main2.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/cjs/main2.js new file mode 100644 index 00000000000..8d1efac502d --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/cjs/main2.js @@ -0,0 +1,5 @@ +'use strict'; + +var small = require('./generated-small.js'); + +console.log(small.big, small.small); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/cjs/main3.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/cjs/main3.js new file mode 100644 index 00000000000..168bfc47fb1 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/cjs/main3.js @@ -0,0 +1,5 @@ +'use strict'; + +var small = require('./generated-small.js'); + +console.log(small.big); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/es/generated-small.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/es/generated-small.js new file mode 100644 index 00000000000..3a60fcf90de --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/es/generated-small.js @@ -0,0 +1,5 @@ +const big = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; + +const small = '1'; + +export { big as b, small as s }; diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/es/main1.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/es/main1.js new file mode 100644 index 00000000000..f72ae2e2c0b --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/es/main1.js @@ -0,0 +1,3 @@ +import { b as big, s as small } from './generated-small.js'; + +console.log(big, small); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/es/main2.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/es/main2.js new file mode 100644 index 00000000000..f72ae2e2c0b --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/es/main2.js @@ -0,0 +1,3 @@ +import { b as big, s as small } from './generated-small.js'; + +console.log(big, small); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/es/main3.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/es/main3.js new file mode 100644 index 00000000000..68f15d2638c --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/es/main3.js @@ -0,0 +1,3 @@ +import { b as big } from './generated-small.js'; + +console.log(big); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/system/generated-small.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/system/generated-small.js new file mode 100644 index 00000000000..58f4f322104 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/system/generated-small.js @@ -0,0 +1,12 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + const big = exports('b', '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'); + + const small = exports('s', '1'); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/system/main1.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/system/main1.js new file mode 100644 index 00000000000..d9c93667327 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/system/main1.js @@ -0,0 +1,15 @@ +System.register(['./generated-small.js'], (function () { + 'use strict'; + var big, small; + return { + setters: [function (module) { + big = module.b; + small = module.s; + }], + execute: (function () { + + console.log(big, small); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/system/main2.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/system/main2.js new file mode 100644 index 00000000000..d9c93667327 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/system/main2.js @@ -0,0 +1,15 @@ +System.register(['./generated-small.js'], (function () { + 'use strict'; + var big, small; + return { + setters: [function (module) { + big = module.b; + small = module.s; + }], + execute: (function () { + + console.log(big, small); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/system/main3.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/system/main3.js new file mode 100644 index 00000000000..90ebf97d750 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/_expected/system/main3.js @@ -0,0 +1,14 @@ +System.register(['./generated-small.js'], (function () { + 'use strict'; + var big; + return { + setters: [function (module) { + big = module.b; + }], + execute: (function () { + + console.log(big); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/big.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/big.js new file mode 100644 index 00000000000..aa804924cba --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/big.js @@ -0,0 +1 @@ +export const big = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/main1.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/main1.js new file mode 100644 index 00000000000..ca84399ef67 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/main1.js @@ -0,0 +1,4 @@ +import { big } from './big'; +import { small } from './small'; + +console.log(big, small); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/main2.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/main2.js new file mode 100644 index 00000000000..ca84399ef67 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/main2.js @@ -0,0 +1,4 @@ +import { big } from './big'; +import { small } from './small'; + +console.log(big, small); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/main3.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/main3.js new file mode 100644 index 00000000000..99752c1c3b4 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/main3.js @@ -0,0 +1,3 @@ +import { big } from './big'; + +console.log(big); diff --git a/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/small.js b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/small.js new file mode 100644 index 00000000000..64e15634102 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-chunk-into-shared/small.js @@ -0,0 +1 @@ +export const small = '1'; diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_config.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_config.js new file mode 100644 index 00000000000..69504dba2e8 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_config.js @@ -0,0 +1,9 @@ +module.exports = { + description: 'merges small chunks into other small chunks first before merging into a big chunk', + options: { + input: ['main1.js', 'main2.js', 'main3.js', 'main4.js', 'main5.js'], + output: { + experimentalMinChunkSize: 100 + } + } +}; diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/amd/generated-big.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/amd/generated-big.js new file mode 100644 index 00000000000..1c86c5f3245 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/amd/generated-big.js @@ -0,0 +1,7 @@ +define(['exports'], (function (exports) { 'use strict'; + + const big = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; + + exports.big = big; + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/amd/generated-small3.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/amd/generated-small3.js new file mode 100644 index 00000000000..625da1771ec --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/amd/generated-small3.js @@ -0,0 +1,13 @@ +define(['exports'], (function (exports) { 'use strict'; + + const small1 = '123456789012345678901234567890'; + + const small2 = '123456789012345678901234567890'; + + const small3 = '123456789012345678901234567890'; + + exports.small1 = small1; + exports.small2 = small2; + exports.small3 = small3; + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/amd/main1.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/amd/main1.js new file mode 100644 index 00000000000..d0d2cfb93b8 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/amd/main1.js @@ -0,0 +1,5 @@ +define(['./generated-big', './generated-small3'], (function (big, small3) { 'use strict'; + + console.log(big.big, small3.small1, small3.small2, small3.small3); + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/amd/main2.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/amd/main2.js new file mode 100644 index 00000000000..d0d2cfb93b8 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/amd/main2.js @@ -0,0 +1,5 @@ +define(['./generated-big', './generated-small3'], (function (big, small3) { 'use strict'; + + console.log(big.big, small3.small1, small3.small2, small3.small3); + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/amd/main3.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/amd/main3.js new file mode 100644 index 00000000000..9d2010b95eb --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/amd/main3.js @@ -0,0 +1,5 @@ +define(['./generated-big', './generated-small3'], (function (big, small3) { 'use strict'; + + console.log(big.big, small3.small1, small3.small2); + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/amd/main4.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/amd/main4.js new file mode 100644 index 00000000000..7312a27862b --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/amd/main4.js @@ -0,0 +1,5 @@ +define(['./generated-big', './generated-small3'], (function (big, small3) { 'use strict'; + + console.log(big.big, small3.small1); + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/amd/main5.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/amd/main5.js new file mode 100644 index 00000000000..1bddbc92f18 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/amd/main5.js @@ -0,0 +1,5 @@ +define(['./generated-big'], (function (big) { 'use strict'; + + console.log(big.big); + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/cjs/generated-big.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/cjs/generated-big.js new file mode 100644 index 00000000000..02f83e81fc3 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/cjs/generated-big.js @@ -0,0 +1,5 @@ +'use strict'; + +const big = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; + +exports.big = big; diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/cjs/generated-small3.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/cjs/generated-small3.js new file mode 100644 index 00000000000..87d7d067ca9 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/cjs/generated-small3.js @@ -0,0 +1,11 @@ +'use strict'; + +const small1 = '123456789012345678901234567890'; + +const small2 = '123456789012345678901234567890'; + +const small3 = '123456789012345678901234567890'; + +exports.small1 = small1; +exports.small2 = small2; +exports.small3 = small3; diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/cjs/main1.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/cjs/main1.js new file mode 100644 index 00000000000..d9f3890d96c --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/cjs/main1.js @@ -0,0 +1,6 @@ +'use strict'; + +var big = require('./generated-big.js'); +var small3 = require('./generated-small3.js'); + +console.log(big.big, small3.small1, small3.small2, small3.small3); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/cjs/main2.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/cjs/main2.js new file mode 100644 index 00000000000..d9f3890d96c --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/cjs/main2.js @@ -0,0 +1,6 @@ +'use strict'; + +var big = require('./generated-big.js'); +var small3 = require('./generated-small3.js'); + +console.log(big.big, small3.small1, small3.small2, small3.small3); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/cjs/main3.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/cjs/main3.js new file mode 100644 index 00000000000..73003dba83d --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/cjs/main3.js @@ -0,0 +1,6 @@ +'use strict'; + +var big = require('./generated-big.js'); +var small3 = require('./generated-small3.js'); + +console.log(big.big, small3.small1, small3.small2); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/cjs/main4.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/cjs/main4.js new file mode 100644 index 00000000000..6fcbd15c395 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/cjs/main4.js @@ -0,0 +1,6 @@ +'use strict'; + +var big = require('./generated-big.js'); +var small3 = require('./generated-small3.js'); + +console.log(big.big, small3.small1); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/cjs/main5.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/cjs/main5.js new file mode 100644 index 00000000000..5a574b96fe4 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/cjs/main5.js @@ -0,0 +1,5 @@ +'use strict'; + +var big = require('./generated-big.js'); + +console.log(big.big); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/es/generated-big.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/es/generated-big.js new file mode 100644 index 00000000000..f26e52dae36 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/es/generated-big.js @@ -0,0 +1,3 @@ +const big = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; + +export { big as b }; diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/es/generated-small3.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/es/generated-small3.js new file mode 100644 index 00000000000..93e17caa740 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/es/generated-small3.js @@ -0,0 +1,7 @@ +const small1 = '123456789012345678901234567890'; + +const small2 = '123456789012345678901234567890'; + +const small3 = '123456789012345678901234567890'; + +export { small2 as a, small3 as b, small1 as s }; diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/es/main1.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/es/main1.js new file mode 100644 index 00000000000..caa52941627 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/es/main1.js @@ -0,0 +1,4 @@ +import { b as big } from './generated-big.js'; +import { s as small1, a as small2, b as small3 } from './generated-small3.js'; + +console.log(big, small1, small2, small3); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/es/main2.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/es/main2.js new file mode 100644 index 00000000000..caa52941627 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/es/main2.js @@ -0,0 +1,4 @@ +import { b as big } from './generated-big.js'; +import { s as small1, a as small2, b as small3 } from './generated-small3.js'; + +console.log(big, small1, small2, small3); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/es/main3.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/es/main3.js new file mode 100644 index 00000000000..da18f44ef36 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/es/main3.js @@ -0,0 +1,4 @@ +import { b as big } from './generated-big.js'; +import { s as small1, a as small2 } from './generated-small3.js'; + +console.log(big, small1, small2); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/es/main4.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/es/main4.js new file mode 100644 index 00000000000..49c455f0f55 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/es/main4.js @@ -0,0 +1,4 @@ +import { b as big } from './generated-big.js'; +import { s as small1 } from './generated-small3.js'; + +console.log(big, small1); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/es/main5.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/es/main5.js new file mode 100644 index 00000000000..00748695997 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/es/main5.js @@ -0,0 +1,3 @@ +import { b as big } from './generated-big.js'; + +console.log(big); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/system/generated-big.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/system/generated-big.js new file mode 100644 index 00000000000..c924360b7cd --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/system/generated-big.js @@ -0,0 +1,10 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + const big = exports('b', '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/system/generated-small3.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/system/generated-small3.js new file mode 100644 index 00000000000..472c8458bcb --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/system/generated-small3.js @@ -0,0 +1,14 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + const small1 = exports('s', '123456789012345678901234567890'); + + const small2 = exports('a', '123456789012345678901234567890'); + + const small3 = exports('b', '123456789012345678901234567890'); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/system/main1.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/system/main1.js new file mode 100644 index 00000000000..0eac3017079 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/system/main1.js @@ -0,0 +1,18 @@ +System.register(['./generated-big.js', './generated-small3.js'], (function () { + 'use strict'; + var big, small1, small2, small3; + return { + setters: [function (module) { + big = module.b; + }, function (module) { + small1 = module.s; + small2 = module.a; + small3 = module.b; + }], + execute: (function () { + + console.log(big, small1, small2, small3); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/system/main2.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/system/main2.js new file mode 100644 index 00000000000..0eac3017079 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/system/main2.js @@ -0,0 +1,18 @@ +System.register(['./generated-big.js', './generated-small3.js'], (function () { + 'use strict'; + var big, small1, small2, small3; + return { + setters: [function (module) { + big = module.b; + }, function (module) { + small1 = module.s; + small2 = module.a; + small3 = module.b; + }], + execute: (function () { + + console.log(big, small1, small2, small3); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/system/main3.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/system/main3.js new file mode 100644 index 00000000000..a468ee7d78b --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/system/main3.js @@ -0,0 +1,17 @@ +System.register(['./generated-big.js', './generated-small3.js'], (function () { + 'use strict'; + var big, small1, small2; + return { + setters: [function (module) { + big = module.b; + }, function (module) { + small1 = module.s; + small2 = module.a; + }], + execute: (function () { + + console.log(big, small1, small2); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/system/main4.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/system/main4.js new file mode 100644 index 00000000000..9a715d3675e --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/system/main4.js @@ -0,0 +1,16 @@ +System.register(['./generated-big.js', './generated-small3.js'], (function () { + 'use strict'; + var big, small1; + return { + setters: [function (module) { + big = module.b; + }, function (module) { + small1 = module.s; + }], + execute: (function () { + + console.log(big, small1); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/system/main5.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/system/main5.js new file mode 100644 index 00000000000..9d92d0a9972 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/_expected/system/main5.js @@ -0,0 +1,14 @@ +System.register(['./generated-big.js'], (function () { + 'use strict'; + var big; + return { + setters: [function (module) { + big = module.b; + }], + execute: (function () { + + console.log(big); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/big.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/big.js new file mode 100644 index 00000000000..aa804924cba --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/big.js @@ -0,0 +1 @@ +export const big = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/main1.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/main1.js new file mode 100644 index 00000000000..e70a88fd206 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/main1.js @@ -0,0 +1,6 @@ +import { big } from './big'; +import { small1 } from './small1'; +import { small2 } from './small2'; +import { small3 } from './small3'; + +console.log(big, small1, small2, small3); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/main2.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/main2.js new file mode 100644 index 00000000000..e70a88fd206 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/main2.js @@ -0,0 +1,6 @@ +import { big } from './big'; +import { small1 } from './small1'; +import { small2 } from './small2'; +import { small3 } from './small3'; + +console.log(big, small1, small2, small3); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/main3.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/main3.js new file mode 100644 index 00000000000..fdd9ede4919 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/main3.js @@ -0,0 +1,5 @@ +import { big } from './big'; +import { small1 } from './small1'; +import { small2 } from './small2'; + +console.log(big, small1, small2); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/main4.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/main4.js new file mode 100644 index 00000000000..c1f7ef30971 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/main4.js @@ -0,0 +1,4 @@ +import { big } from './big'; +import { small1 } from './small1'; + +console.log(big, small1); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/main5.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/main5.js new file mode 100644 index 00000000000..99752c1c3b4 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/main5.js @@ -0,0 +1,3 @@ +import { big } from './big'; + +console.log(big); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/small1.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/small1.js new file mode 100644 index 00000000000..c904f7abf7f --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/small1.js @@ -0,0 +1 @@ +export const small1 = '123456789012345678901234567890'; diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/small2.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/small2.js new file mode 100644 index 00000000000..5e0bda4f9dc --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/small2.js @@ -0,0 +1 @@ +export const small2 = '123456789012345678901234567890'; diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/small3.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/small3.js new file mode 100644 index 00000000000..7f85958f33f --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-a/small3.js @@ -0,0 +1 @@ +export const small3 = '123456789012345678901234567890'; diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_config.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_config.js new file mode 100644 index 00000000000..69504dba2e8 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_config.js @@ -0,0 +1,9 @@ +module.exports = { + description: 'merges small chunks into other small chunks first before merging into a big chunk', + options: { + input: ['main1.js', 'main2.js', 'main3.js', 'main4.js', 'main5.js'], + output: { + experimentalMinChunkSize: 100 + } + } +}; diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/amd/generated-big.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/amd/generated-big.js new file mode 100644 index 00000000000..1c86c5f3245 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/amd/generated-big.js @@ -0,0 +1,7 @@ +define(['exports'], (function (exports) { 'use strict'; + + const big = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; + + exports.big = big; + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/amd/generated-small1.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/amd/generated-small1.js new file mode 100644 index 00000000000..d9c528caa84 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/amd/generated-small1.js @@ -0,0 +1,13 @@ +define(['exports'], (function (exports) { 'use strict'; + + const small3 = '12345678901234567890'; + + const small2 = '12345678901234567890'; + + const small1 = '12345678901234567890'; + + exports.small1 = small1; + exports.small2 = small2; + exports.small3 = small3; + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/amd/main1.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/amd/main1.js new file mode 100644 index 00000000000..5df77865a27 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/amd/main1.js @@ -0,0 +1,5 @@ +define(['./generated-big', './generated-small1'], (function (big, small1) { 'use strict'; + + console.log(big.big, small1.small1, small1.small2, small1.small3); + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/amd/main2.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/amd/main2.js new file mode 100644 index 00000000000..5df77865a27 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/amd/main2.js @@ -0,0 +1,5 @@ +define(['./generated-big', './generated-small1'], (function (big, small1) { 'use strict'; + + console.log(big.big, small1.small1, small1.small2, small1.small3); + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/amd/main3.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/amd/main3.js new file mode 100644 index 00000000000..b0a3dab9e69 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/amd/main3.js @@ -0,0 +1,5 @@ +define(['./generated-big', './generated-small1'], (function (big, small1) { 'use strict'; + + console.log(big.big, small1.small1, small1.small2); + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/amd/main4.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/amd/main4.js new file mode 100644 index 00000000000..446e8f47e4b --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/amd/main4.js @@ -0,0 +1,5 @@ +define(['./generated-big', './generated-small1'], (function (big, small1) { 'use strict'; + + console.log(big.big, small1.small1); + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/amd/main5.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/amd/main5.js new file mode 100644 index 00000000000..1bddbc92f18 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/amd/main5.js @@ -0,0 +1,5 @@ +define(['./generated-big'], (function (big) { 'use strict'; + + console.log(big.big); + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/cjs/generated-big.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/cjs/generated-big.js new file mode 100644 index 00000000000..02f83e81fc3 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/cjs/generated-big.js @@ -0,0 +1,5 @@ +'use strict'; + +const big = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; + +exports.big = big; diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/cjs/generated-small1.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/cjs/generated-small1.js new file mode 100644 index 00000000000..a5ceab98a97 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/cjs/generated-small1.js @@ -0,0 +1,11 @@ +'use strict'; + +const small3 = '12345678901234567890'; + +const small2 = '12345678901234567890'; + +const small1 = '12345678901234567890'; + +exports.small1 = small1; +exports.small2 = small2; +exports.small3 = small3; diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/cjs/main1.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/cjs/main1.js new file mode 100644 index 00000000000..bb36b0d98c0 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/cjs/main1.js @@ -0,0 +1,6 @@ +'use strict'; + +var big = require('./generated-big.js'); +var small1 = require('./generated-small1.js'); + +console.log(big.big, small1.small1, small1.small2, small1.small3); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/cjs/main2.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/cjs/main2.js new file mode 100644 index 00000000000..bb36b0d98c0 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/cjs/main2.js @@ -0,0 +1,6 @@ +'use strict'; + +var big = require('./generated-big.js'); +var small1 = require('./generated-small1.js'); + +console.log(big.big, small1.small1, small1.small2, small1.small3); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/cjs/main3.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/cjs/main3.js new file mode 100644 index 00000000000..8c1c9e18ea4 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/cjs/main3.js @@ -0,0 +1,6 @@ +'use strict'; + +var big = require('./generated-big.js'); +var small1 = require('./generated-small1.js'); + +console.log(big.big, small1.small1, small1.small2); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/cjs/main4.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/cjs/main4.js new file mode 100644 index 00000000000..33d5232d2ab --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/cjs/main4.js @@ -0,0 +1,6 @@ +'use strict'; + +var big = require('./generated-big.js'); +var small1 = require('./generated-small1.js'); + +console.log(big.big, small1.small1); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/cjs/main5.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/cjs/main5.js new file mode 100644 index 00000000000..5a574b96fe4 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/cjs/main5.js @@ -0,0 +1,5 @@ +'use strict'; + +var big = require('./generated-big.js'); + +console.log(big.big); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/es/generated-big.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/es/generated-big.js new file mode 100644 index 00000000000..f26e52dae36 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/es/generated-big.js @@ -0,0 +1,3 @@ +const big = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; + +export { big as b }; diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/es/generated-small1.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/es/generated-small1.js new file mode 100644 index 00000000000..a0e70170a83 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/es/generated-small1.js @@ -0,0 +1,7 @@ +const small3 = '12345678901234567890'; + +const small2 = '12345678901234567890'; + +const small1 = '12345678901234567890'; + +export { small2 as a, small3 as b, small1 as s }; diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/es/main1.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/es/main1.js new file mode 100644 index 00000000000..4f2df12daa4 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/es/main1.js @@ -0,0 +1,4 @@ +import { b as big } from './generated-big.js'; +import { s as small1, a as small2, b as small3 } from './generated-small1.js'; + +console.log(big, small1, small2, small3); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/es/main2.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/es/main2.js new file mode 100644 index 00000000000..4f2df12daa4 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/es/main2.js @@ -0,0 +1,4 @@ +import { b as big } from './generated-big.js'; +import { s as small1, a as small2, b as small3 } from './generated-small1.js'; + +console.log(big, small1, small2, small3); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/es/main3.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/es/main3.js new file mode 100644 index 00000000000..38a9dbbe51a --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/es/main3.js @@ -0,0 +1,4 @@ +import { b as big } from './generated-big.js'; +import { s as small1, a as small2 } from './generated-small1.js'; + +console.log(big, small1, small2); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/es/main4.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/es/main4.js new file mode 100644 index 00000000000..5ca874ae49a --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/es/main4.js @@ -0,0 +1,4 @@ +import { b as big } from './generated-big.js'; +import { s as small1 } from './generated-small1.js'; + +console.log(big, small1); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/es/main5.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/es/main5.js new file mode 100644 index 00000000000..00748695997 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/es/main5.js @@ -0,0 +1,3 @@ +import { b as big } from './generated-big.js'; + +console.log(big); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/system/generated-big.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/system/generated-big.js new file mode 100644 index 00000000000..c924360b7cd --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/system/generated-big.js @@ -0,0 +1,10 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + const big = exports('b', '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/system/generated-small1.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/system/generated-small1.js new file mode 100644 index 00000000000..f473b370ca8 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/system/generated-small1.js @@ -0,0 +1,14 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + const small3 = exports('b', '12345678901234567890'); + + const small2 = exports('a', '12345678901234567890'); + + const small1 = exports('s', '12345678901234567890'); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/system/main1.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/system/main1.js new file mode 100644 index 00000000000..fe599e7228c --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/system/main1.js @@ -0,0 +1,18 @@ +System.register(['./generated-big.js', './generated-small1.js'], (function () { + 'use strict'; + var big, small1, small2, small3; + return { + setters: [function (module) { + big = module.b; + }, function (module) { + small1 = module.s; + small2 = module.a; + small3 = module.b; + }], + execute: (function () { + + console.log(big, small1, small2, small3); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/system/main2.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/system/main2.js new file mode 100644 index 00000000000..fe599e7228c --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/system/main2.js @@ -0,0 +1,18 @@ +System.register(['./generated-big.js', './generated-small1.js'], (function () { + 'use strict'; + var big, small1, small2, small3; + return { + setters: [function (module) { + big = module.b; + }, function (module) { + small1 = module.s; + small2 = module.a; + small3 = module.b; + }], + execute: (function () { + + console.log(big, small1, small2, small3); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/system/main3.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/system/main3.js new file mode 100644 index 00000000000..d60c23e1ce3 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/system/main3.js @@ -0,0 +1,17 @@ +System.register(['./generated-big.js', './generated-small1.js'], (function () { + 'use strict'; + var big, small1, small2; + return { + setters: [function (module) { + big = module.b; + }, function (module) { + small1 = module.s; + small2 = module.a; + }], + execute: (function () { + + console.log(big, small1, small2); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/system/main4.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/system/main4.js new file mode 100644 index 00000000000..6cd5881a16c --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/system/main4.js @@ -0,0 +1,16 @@ +System.register(['./generated-big.js', './generated-small1.js'], (function () { + 'use strict'; + var big, small1; + return { + setters: [function (module) { + big = module.b; + }, function (module) { + small1 = module.s; + }], + execute: (function () { + + console.log(big, small1); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/system/main5.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/system/main5.js new file mode 100644 index 00000000000..9d92d0a9972 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/_expected/system/main5.js @@ -0,0 +1,14 @@ +System.register(['./generated-big.js'], (function () { + 'use strict'; + var big; + return { + setters: [function (module) { + big = module.b; + }], + execute: (function () { + + console.log(big); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/big.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/big.js new file mode 100644 index 00000000000..aa804924cba --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/big.js @@ -0,0 +1 @@ +export const big = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/main1.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/main1.js new file mode 100644 index 00000000000..862c33c94df --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/main1.js @@ -0,0 +1,6 @@ +import { big } from './big'; +import { small3 } from './small3'; +import { small2 } from './small2'; +import { small1 } from './small1'; + +console.log(big, small1, small2, small3); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/main2.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/main2.js new file mode 100644 index 00000000000..862c33c94df --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/main2.js @@ -0,0 +1,6 @@ +import { big } from './big'; +import { small3 } from './small3'; +import { small2 } from './small2'; +import { small1 } from './small1'; + +console.log(big, small1, small2, small3); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/main3.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/main3.js new file mode 100644 index 00000000000..9d7a846ceee --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/main3.js @@ -0,0 +1,5 @@ +import { big } from './big'; +import { small2 } from './small2'; +import { small1 } from './small1'; + +console.log(big, small1, small2); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/main4.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/main4.js new file mode 100644 index 00000000000..c1f7ef30971 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/main4.js @@ -0,0 +1,4 @@ +import { big } from './big'; +import { small1 } from './small1'; + +console.log(big, small1); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/main5.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/main5.js new file mode 100644 index 00000000000..99752c1c3b4 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/main5.js @@ -0,0 +1,3 @@ +import { big } from './big'; + +console.log(big); diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/small1.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/small1.js new file mode 100644 index 00000000000..252f8149a51 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/small1.js @@ -0,0 +1 @@ +export const small1 = '12345678901234567890'; diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/small2.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/small2.js new file mode 100644 index 00000000000..b0de5c31cd3 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/small2.js @@ -0,0 +1 @@ +export const small2 = '12345678901234567890'; diff --git a/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/small3.js b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/small3.js new file mode 100644 index 00000000000..16389e0bbd3 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-three-small-chunks-b/small3.js @@ -0,0 +1 @@ +export const small3 = '12345678901234567890'; diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_config.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_config.js new file mode 100644 index 00000000000..2b0b389db7d --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_config.js @@ -0,0 +1,9 @@ +module.exports = { + description: 'merges small chunks into other small chunks first before merging into a big chunk', + options: { + input: ['main1.js', 'main2.js', 'main3.js', 'main4.js'], + output: { + experimentalMinChunkSize: 100 + } + } +}; diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/amd/generated-big.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/amd/generated-big.js new file mode 100644 index 00000000000..1c86c5f3245 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/amd/generated-big.js @@ -0,0 +1,7 @@ +define(['exports'], (function (exports) { 'use strict'; + + const big = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; + + exports.big = big; + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/amd/generated-small2.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/amd/generated-small2.js new file mode 100644 index 00000000000..2f2c139dfb3 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/amd/generated-small2.js @@ -0,0 +1,10 @@ +define(['exports'], (function (exports) { 'use strict'; + + const small1 = '12345678901234567890123456789012345678901234567890'; + + const small2 = '12345678901234567890123456789012345678901234567890'; + + exports.small1 = small1; + exports.small2 = small2; + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/amd/main1.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/amd/main1.js new file mode 100644 index 00000000000..bc4923ac6d3 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/amd/main1.js @@ -0,0 +1,5 @@ +define(['./generated-big', './generated-small2'], (function (big, small2) { 'use strict'; + + console.log(big.big, small2.small1, small2.small2); + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/amd/main2.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/amd/main2.js new file mode 100644 index 00000000000..bc4923ac6d3 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/amd/main2.js @@ -0,0 +1,5 @@ +define(['./generated-big', './generated-small2'], (function (big, small2) { 'use strict'; + + console.log(big.big, small2.small1, small2.small2); + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/amd/main3.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/amd/main3.js new file mode 100644 index 00000000000..8e153b9ed3b --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/amd/main3.js @@ -0,0 +1,5 @@ +define(['./generated-big', './generated-small2'], (function (big, small2) { 'use strict'; + + console.log(big.big, small2.small1); + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/amd/main4.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/amd/main4.js new file mode 100644 index 00000000000..1bddbc92f18 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/amd/main4.js @@ -0,0 +1,5 @@ +define(['./generated-big'], (function (big) { 'use strict'; + + console.log(big.big); + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/cjs/generated-big.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/cjs/generated-big.js new file mode 100644 index 00000000000..02f83e81fc3 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/cjs/generated-big.js @@ -0,0 +1,5 @@ +'use strict'; + +const big = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; + +exports.big = big; diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/cjs/generated-small2.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/cjs/generated-small2.js new file mode 100644 index 00000000000..2de161519be --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/cjs/generated-small2.js @@ -0,0 +1,8 @@ +'use strict'; + +const small1 = '12345678901234567890123456789012345678901234567890'; + +const small2 = '12345678901234567890123456789012345678901234567890'; + +exports.small1 = small1; +exports.small2 = small2; diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/cjs/main1.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/cjs/main1.js new file mode 100644 index 00000000000..5568961ddb9 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/cjs/main1.js @@ -0,0 +1,6 @@ +'use strict'; + +var big = require('./generated-big.js'); +var small2 = require('./generated-small2.js'); + +console.log(big.big, small2.small1, small2.small2); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/cjs/main2.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/cjs/main2.js new file mode 100644 index 00000000000..5568961ddb9 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/cjs/main2.js @@ -0,0 +1,6 @@ +'use strict'; + +var big = require('./generated-big.js'); +var small2 = require('./generated-small2.js'); + +console.log(big.big, small2.small1, small2.small2); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/cjs/main3.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/cjs/main3.js new file mode 100644 index 00000000000..5e0f9817ff2 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/cjs/main3.js @@ -0,0 +1,6 @@ +'use strict'; + +var big = require('./generated-big.js'); +var small2 = require('./generated-small2.js'); + +console.log(big.big, small2.small1); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/cjs/main4.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/cjs/main4.js new file mode 100644 index 00000000000..5a574b96fe4 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/cjs/main4.js @@ -0,0 +1,5 @@ +'use strict'; + +var big = require('./generated-big.js'); + +console.log(big.big); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/es/generated-big.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/es/generated-big.js new file mode 100644 index 00000000000..f26e52dae36 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/es/generated-big.js @@ -0,0 +1,3 @@ +const big = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; + +export { big as b }; diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/es/generated-small2.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/es/generated-small2.js new file mode 100644 index 00000000000..f553b8cf7b9 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/es/generated-small2.js @@ -0,0 +1,5 @@ +const small1 = '12345678901234567890123456789012345678901234567890'; + +const small2 = '12345678901234567890123456789012345678901234567890'; + +export { small2 as a, small1 as s }; diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/es/main1.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/es/main1.js new file mode 100644 index 00000000000..c1241a35e57 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/es/main1.js @@ -0,0 +1,4 @@ +import { b as big } from './generated-big.js'; +import { s as small1, a as small2 } from './generated-small2.js'; + +console.log(big, small1, small2); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/es/main2.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/es/main2.js new file mode 100644 index 00000000000..c1241a35e57 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/es/main2.js @@ -0,0 +1,4 @@ +import { b as big } from './generated-big.js'; +import { s as small1, a as small2 } from './generated-small2.js'; + +console.log(big, small1, small2); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/es/main3.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/es/main3.js new file mode 100644 index 00000000000..faec0a7604b --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/es/main3.js @@ -0,0 +1,4 @@ +import { b as big } from './generated-big.js'; +import { s as small1 } from './generated-small2.js'; + +console.log(big, small1); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/es/main4.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/es/main4.js new file mode 100644 index 00000000000..00748695997 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/es/main4.js @@ -0,0 +1,3 @@ +import { b as big } from './generated-big.js'; + +console.log(big); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/system/generated-big.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/system/generated-big.js new file mode 100644 index 00000000000..c924360b7cd --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/system/generated-big.js @@ -0,0 +1,10 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + const big = exports('b', '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/system/generated-small2.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/system/generated-small2.js new file mode 100644 index 00000000000..e873de9734e --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/system/generated-small2.js @@ -0,0 +1,12 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + const small1 = exports('s', '12345678901234567890123456789012345678901234567890'); + + const small2 = exports('a', '12345678901234567890123456789012345678901234567890'); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/system/main1.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/system/main1.js new file mode 100644 index 00000000000..4a0d3a436f0 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/system/main1.js @@ -0,0 +1,17 @@ +System.register(['./generated-big.js', './generated-small2.js'], (function () { + 'use strict'; + var big, small1, small2; + return { + setters: [function (module) { + big = module.b; + }, function (module) { + small1 = module.s; + small2 = module.a; + }], + execute: (function () { + + console.log(big, small1, small2); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/system/main2.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/system/main2.js new file mode 100644 index 00000000000..4a0d3a436f0 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/system/main2.js @@ -0,0 +1,17 @@ +System.register(['./generated-big.js', './generated-small2.js'], (function () { + 'use strict'; + var big, small1, small2; + return { + setters: [function (module) { + big = module.b; + }, function (module) { + small1 = module.s; + small2 = module.a; + }], + execute: (function () { + + console.log(big, small1, small2); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/system/main3.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/system/main3.js new file mode 100644 index 00000000000..d6bdd772385 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/system/main3.js @@ -0,0 +1,16 @@ +System.register(['./generated-big.js', './generated-small2.js'], (function () { + 'use strict'; + var big, small1; + return { + setters: [function (module) { + big = module.b; + }, function (module) { + small1 = module.s; + }], + execute: (function () { + + console.log(big, small1); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/system/main4.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/system/main4.js new file mode 100644 index 00000000000..9d92d0a9972 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/_expected/system/main4.js @@ -0,0 +1,14 @@ +System.register(['./generated-big.js'], (function () { + 'use strict'; + var big; + return { + setters: [function (module) { + big = module.b; + }], + execute: (function () { + + console.log(big); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/big.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/big.js new file mode 100644 index 00000000000..aa804924cba --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/big.js @@ -0,0 +1 @@ +export const big = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/main1.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/main1.js new file mode 100644 index 00000000000..fdd9ede4919 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/main1.js @@ -0,0 +1,5 @@ +import { big } from './big'; +import { small1 } from './small1'; +import { small2 } from './small2'; + +console.log(big, small1, small2); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/main2.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/main2.js new file mode 100644 index 00000000000..fdd9ede4919 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/main2.js @@ -0,0 +1,5 @@ +import { big } from './big'; +import { small1 } from './small1'; +import { small2 } from './small2'; + +console.log(big, small1, small2); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/main3.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/main3.js new file mode 100644 index 00000000000..c1f7ef30971 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/main3.js @@ -0,0 +1,4 @@ +import { big } from './big'; +import { small1 } from './small1'; + +console.log(big, small1); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/main4.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/main4.js new file mode 100644 index 00000000000..99752c1c3b4 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/main4.js @@ -0,0 +1,3 @@ +import { big } from './big'; + +console.log(big); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/small1.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/small1.js new file mode 100644 index 00000000000..076d519a29d --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/small1.js @@ -0,0 +1 @@ +export const small1 = '12345678901234567890123456789012345678901234567890'; diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/small2.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/small2.js new file mode 100644 index 00000000000..1baf7456bcb --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-a/small2.js @@ -0,0 +1 @@ +export const small2 = '12345678901234567890123456789012345678901234567890'; diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_config.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_config.js new file mode 100644 index 00000000000..2b0b389db7d --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_config.js @@ -0,0 +1,9 @@ +module.exports = { + description: 'merges small chunks into other small chunks first before merging into a big chunk', + options: { + input: ['main1.js', 'main2.js', 'main3.js', 'main4.js'], + output: { + experimentalMinChunkSize: 100 + } + } +}; diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/amd/generated-big.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/amd/generated-big.js new file mode 100644 index 00000000000..1c86c5f3245 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/amd/generated-big.js @@ -0,0 +1,7 @@ +define(['exports'], (function (exports) { 'use strict'; + + const big = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; + + exports.big = big; + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/amd/generated-small2.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/amd/generated-small2.js new file mode 100644 index 00000000000..2f2c139dfb3 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/amd/generated-small2.js @@ -0,0 +1,10 @@ +define(['exports'], (function (exports) { 'use strict'; + + const small1 = '12345678901234567890123456789012345678901234567890'; + + const small2 = '12345678901234567890123456789012345678901234567890'; + + exports.small1 = small1; + exports.small2 = small2; + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/amd/main1.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/amd/main1.js new file mode 100644 index 00000000000..bc4923ac6d3 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/amd/main1.js @@ -0,0 +1,5 @@ +define(['./generated-big', './generated-small2'], (function (big, small2) { 'use strict'; + + console.log(big.big, small2.small1, small2.small2); + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/amd/main2.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/amd/main2.js new file mode 100644 index 00000000000..bc4923ac6d3 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/amd/main2.js @@ -0,0 +1,5 @@ +define(['./generated-big', './generated-small2'], (function (big, small2) { 'use strict'; + + console.log(big.big, small2.small1, small2.small2); + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/amd/main3.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/amd/main3.js new file mode 100644 index 00000000000..8e5db6f86a2 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/amd/main3.js @@ -0,0 +1,5 @@ +define(['./generated-big', './generated-small2'], (function (big, small2) { 'use strict'; + + console.log(big.big, small2.small2); + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/amd/main4.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/amd/main4.js new file mode 100644 index 00000000000..1bddbc92f18 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/amd/main4.js @@ -0,0 +1,5 @@ +define(['./generated-big'], (function (big) { 'use strict'; + + console.log(big.big); + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/cjs/generated-big.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/cjs/generated-big.js new file mode 100644 index 00000000000..02f83e81fc3 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/cjs/generated-big.js @@ -0,0 +1,5 @@ +'use strict'; + +const big = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; + +exports.big = big; diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/cjs/generated-small2.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/cjs/generated-small2.js new file mode 100644 index 00000000000..2de161519be --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/cjs/generated-small2.js @@ -0,0 +1,8 @@ +'use strict'; + +const small1 = '12345678901234567890123456789012345678901234567890'; + +const small2 = '12345678901234567890123456789012345678901234567890'; + +exports.small1 = small1; +exports.small2 = small2; diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/cjs/main1.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/cjs/main1.js new file mode 100644 index 00000000000..5568961ddb9 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/cjs/main1.js @@ -0,0 +1,6 @@ +'use strict'; + +var big = require('./generated-big.js'); +var small2 = require('./generated-small2.js'); + +console.log(big.big, small2.small1, small2.small2); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/cjs/main2.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/cjs/main2.js new file mode 100644 index 00000000000..5568961ddb9 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/cjs/main2.js @@ -0,0 +1,6 @@ +'use strict'; + +var big = require('./generated-big.js'); +var small2 = require('./generated-small2.js'); + +console.log(big.big, small2.small1, small2.small2); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/cjs/main3.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/cjs/main3.js new file mode 100644 index 00000000000..123fd6d3984 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/cjs/main3.js @@ -0,0 +1,6 @@ +'use strict'; + +var big = require('./generated-big.js'); +var small2 = require('./generated-small2.js'); + +console.log(big.big, small2.small2); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/cjs/main4.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/cjs/main4.js new file mode 100644 index 00000000000..5a574b96fe4 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/cjs/main4.js @@ -0,0 +1,5 @@ +'use strict'; + +var big = require('./generated-big.js'); + +console.log(big.big); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/es/generated-big.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/es/generated-big.js new file mode 100644 index 00000000000..f26e52dae36 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/es/generated-big.js @@ -0,0 +1,3 @@ +const big = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; + +export { big as b }; diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/es/generated-small2.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/es/generated-small2.js new file mode 100644 index 00000000000..f553b8cf7b9 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/es/generated-small2.js @@ -0,0 +1,5 @@ +const small1 = '12345678901234567890123456789012345678901234567890'; + +const small2 = '12345678901234567890123456789012345678901234567890'; + +export { small2 as a, small1 as s }; diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/es/main1.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/es/main1.js new file mode 100644 index 00000000000..c1241a35e57 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/es/main1.js @@ -0,0 +1,4 @@ +import { b as big } from './generated-big.js'; +import { s as small1, a as small2 } from './generated-small2.js'; + +console.log(big, small1, small2); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/es/main2.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/es/main2.js new file mode 100644 index 00000000000..c1241a35e57 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/es/main2.js @@ -0,0 +1,4 @@ +import { b as big } from './generated-big.js'; +import { s as small1, a as small2 } from './generated-small2.js'; + +console.log(big, small1, small2); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/es/main3.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/es/main3.js new file mode 100644 index 00000000000..665add312b7 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/es/main3.js @@ -0,0 +1,4 @@ +import { b as big } from './generated-big.js'; +import { a as small2 } from './generated-small2.js'; + +console.log(big, small2); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/es/main4.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/es/main4.js new file mode 100644 index 00000000000..00748695997 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/es/main4.js @@ -0,0 +1,3 @@ +import { b as big } from './generated-big.js'; + +console.log(big); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/system/generated-big.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/system/generated-big.js new file mode 100644 index 00000000000..c924360b7cd --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/system/generated-big.js @@ -0,0 +1,10 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + const big = exports('b', '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/system/generated-small2.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/system/generated-small2.js new file mode 100644 index 00000000000..e873de9734e --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/system/generated-small2.js @@ -0,0 +1,12 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + const small1 = exports('s', '12345678901234567890123456789012345678901234567890'); + + const small2 = exports('a', '12345678901234567890123456789012345678901234567890'); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/system/main1.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/system/main1.js new file mode 100644 index 00000000000..4a0d3a436f0 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/system/main1.js @@ -0,0 +1,17 @@ +System.register(['./generated-big.js', './generated-small2.js'], (function () { + 'use strict'; + var big, small1, small2; + return { + setters: [function (module) { + big = module.b; + }, function (module) { + small1 = module.s; + small2 = module.a; + }], + execute: (function () { + + console.log(big, small1, small2); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/system/main2.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/system/main2.js new file mode 100644 index 00000000000..4a0d3a436f0 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/system/main2.js @@ -0,0 +1,17 @@ +System.register(['./generated-big.js', './generated-small2.js'], (function () { + 'use strict'; + var big, small1, small2; + return { + setters: [function (module) { + big = module.b; + }, function (module) { + small1 = module.s; + small2 = module.a; + }], + execute: (function () { + + console.log(big, small1, small2); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/system/main3.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/system/main3.js new file mode 100644 index 00000000000..065b4d1c19e --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/system/main3.js @@ -0,0 +1,16 @@ +System.register(['./generated-big.js', './generated-small2.js'], (function () { + 'use strict'; + var big, small2; + return { + setters: [function (module) { + big = module.b; + }, function (module) { + small2 = module.a; + }], + execute: (function () { + + console.log(big, small2); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/system/main4.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/system/main4.js new file mode 100644 index 00000000000..9d92d0a9972 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/_expected/system/main4.js @@ -0,0 +1,14 @@ +System.register(['./generated-big.js'], (function () { + 'use strict'; + var big; + return { + setters: [function (module) { + big = module.b; + }], + execute: (function () { + + console.log(big); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/big.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/big.js new file mode 100644 index 00000000000..aa804924cba --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/big.js @@ -0,0 +1 @@ +export const big = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/main1.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/main1.js new file mode 100644 index 00000000000..fdd9ede4919 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/main1.js @@ -0,0 +1,5 @@ +import { big } from './big'; +import { small1 } from './small1'; +import { small2 } from './small2'; + +console.log(big, small1, small2); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/main2.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/main2.js new file mode 100644 index 00000000000..fdd9ede4919 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/main2.js @@ -0,0 +1,5 @@ +import { big } from './big'; +import { small1 } from './small1'; +import { small2 } from './small2'; + +console.log(big, small1, small2); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/main3.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/main3.js new file mode 100644 index 00000000000..2071c835839 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/main3.js @@ -0,0 +1,4 @@ +import { big } from './big'; +import { small2 } from './small2'; + +console.log(big, small2); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/main4.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/main4.js new file mode 100644 index 00000000000..99752c1c3b4 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/main4.js @@ -0,0 +1,3 @@ +import { big } from './big'; + +console.log(big); diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/small1.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/small1.js new file mode 100644 index 00000000000..076d519a29d --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/small1.js @@ -0,0 +1 @@ +export const small1 = '12345678901234567890123456789012345678901234567890'; diff --git a/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/small2.js b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/small2.js new file mode 100644 index 00000000000..1baf7456bcb --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-two-small-chunks-b/small2.js @@ -0,0 +1 @@ +export const small2 = '12345678901234567890123456789012345678901234567890'; diff --git a/test/chunking-form/samples/minChunkSize/merge-unrelated/_config.js b/test/chunking-form/samples/minChunkSize/merge-unrelated/_config.js new file mode 100644 index 00000000000..7bc0924b1a2 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-unrelated/_config.js @@ -0,0 +1,9 @@ +module.exports = { + description: 'merges unrelated small chunks if there is no better alternative', + options: { + input: ['main1.js', 'main2.js', 'main3.js'], + output: { + experimentalMinChunkSize: 100 + } + } +}; diff --git a/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/amd/generated-small2.js b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/amd/generated-small2.js new file mode 100644 index 00000000000..0329d284b07 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/amd/generated-small2.js @@ -0,0 +1,10 @@ +define(['exports'], (function (exports) { 'use strict'; + + const small1 = '1'; + + const small2 = '1'; + + exports.small1 = small1; + exports.small2 = small2; + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/amd/main1.js b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/amd/main1.js new file mode 100644 index 00000000000..189d163ea42 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/amd/main1.js @@ -0,0 +1,5 @@ +define(['./generated-small2'], (function (small2) { 'use strict'; + + console.log(small2.small1, small2.small2); + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/amd/main2.js b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/amd/main2.js new file mode 100644 index 00000000000..933e6f8fc01 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/amd/main2.js @@ -0,0 +1,5 @@ +define(['./generated-small2'], (function (small2) { 'use strict'; + + console.log(small2.small1); + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/amd/main3.js b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/amd/main3.js new file mode 100644 index 00000000000..f7a8bc388f2 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/amd/main3.js @@ -0,0 +1,5 @@ +define(['./generated-small2'], (function (small2) { 'use strict'; + + console.log(small2.small2); + +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/cjs/generated-small2.js b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/cjs/generated-small2.js new file mode 100644 index 00000000000..73ed4392701 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/cjs/generated-small2.js @@ -0,0 +1,8 @@ +'use strict'; + +const small1 = '1'; + +const small2 = '1'; + +exports.small1 = small1; +exports.small2 = small2; diff --git a/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/cjs/main1.js b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/cjs/main1.js new file mode 100644 index 00000000000..dd3c763d78a --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/cjs/main1.js @@ -0,0 +1,5 @@ +'use strict'; + +var small2 = require('./generated-small2.js'); + +console.log(small2.small1, small2.small2); diff --git a/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/cjs/main2.js b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/cjs/main2.js new file mode 100644 index 00000000000..680aff2ffe1 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/cjs/main2.js @@ -0,0 +1,5 @@ +'use strict'; + +var small2 = require('./generated-small2.js'); + +console.log(small2.small1); diff --git a/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/cjs/main3.js b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/cjs/main3.js new file mode 100644 index 00000000000..cfd5e278dbd --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/cjs/main3.js @@ -0,0 +1,5 @@ +'use strict'; + +var small2 = require('./generated-small2.js'); + +console.log(small2.small2); diff --git a/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/es/generated-small2.js b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/es/generated-small2.js new file mode 100644 index 00000000000..2f0c5c65af4 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/es/generated-small2.js @@ -0,0 +1,5 @@ +const small1 = '1'; + +const small2 = '1'; + +export { small2 as a, small1 as s }; diff --git a/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/es/main1.js b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/es/main1.js new file mode 100644 index 00000000000..c0544864943 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/es/main1.js @@ -0,0 +1,3 @@ +import { s as small1, a as small2 } from './generated-small2.js'; + +console.log(small1, small2); diff --git a/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/es/main2.js b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/es/main2.js new file mode 100644 index 00000000000..e30e3ce1ca9 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/es/main2.js @@ -0,0 +1,3 @@ +import { s as small1 } from './generated-small2.js'; + +console.log(small1); diff --git a/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/es/main3.js b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/es/main3.js new file mode 100644 index 00000000000..edc8ae8b0c0 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/es/main3.js @@ -0,0 +1,3 @@ +import { a as small2 } from './generated-small2.js'; + +console.log(small2); diff --git a/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/system/generated-small2.js b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/system/generated-small2.js new file mode 100644 index 00000000000..e636d763844 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/system/generated-small2.js @@ -0,0 +1,12 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + const small1 = exports('s', '1'); + + const small2 = exports('a', '1'); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/system/main1.js b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/system/main1.js new file mode 100644 index 00000000000..cfb4b5a9ceb --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/system/main1.js @@ -0,0 +1,15 @@ +System.register(['./generated-small2.js'], (function () { + 'use strict'; + var small1, small2; + return { + setters: [function (module) { + small1 = module.s; + small2 = module.a; + }], + execute: (function () { + + console.log(small1, small2); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/system/main2.js b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/system/main2.js new file mode 100644 index 00000000000..a9fde34525d --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/system/main2.js @@ -0,0 +1,14 @@ +System.register(['./generated-small2.js'], (function () { + 'use strict'; + var small1; + return { + setters: [function (module) { + small1 = module.s; + }], + execute: (function () { + + console.log(small1); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/system/main3.js b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/system/main3.js new file mode 100644 index 00000000000..114aa710b39 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-unrelated/_expected/system/main3.js @@ -0,0 +1,14 @@ +System.register(['./generated-small2.js'], (function () { + 'use strict'; + var small2; + return { + setters: [function (module) { + small2 = module.a; + }], + execute: (function () { + + console.log(small2); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/merge-unrelated/main1.js b/test/chunking-form/samples/minChunkSize/merge-unrelated/main1.js new file mode 100644 index 00000000000..b8159efe933 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-unrelated/main1.js @@ -0,0 +1,4 @@ +import { small1 } from './small1'; +import { small2 } from './small2'; + +console.log(small1, small2); diff --git a/test/chunking-form/samples/minChunkSize/merge-unrelated/main2.js b/test/chunking-form/samples/minChunkSize/merge-unrelated/main2.js new file mode 100644 index 00000000000..e7180b14932 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-unrelated/main2.js @@ -0,0 +1,3 @@ +import { small1 } from './small1'; + +console.log(small1); diff --git a/test/chunking-form/samples/minChunkSize/merge-unrelated/main3.js b/test/chunking-form/samples/minChunkSize/merge-unrelated/main3.js new file mode 100644 index 00000000000..5104c70fc70 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-unrelated/main3.js @@ -0,0 +1,3 @@ +import { small2 } from './small2'; + +console.log(small2); diff --git a/test/chunking-form/samples/minChunkSize/merge-unrelated/small1.js b/test/chunking-form/samples/minChunkSize/merge-unrelated/small1.js new file mode 100644 index 00000000000..7d722b9f6d7 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-unrelated/small1.js @@ -0,0 +1 @@ +export const small1 = '1'; diff --git a/test/chunking-form/samples/minChunkSize/merge-unrelated/small2.js b/test/chunking-form/samples/minChunkSize/merge-unrelated/small2.js new file mode 100644 index 00000000000..53ce25e7164 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/merge-unrelated/small2.js @@ -0,0 +1 @@ +export const small2 = '1'; diff --git a/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_config.js b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_config.js new file mode 100644 index 00000000000..5146a813748 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_config.js @@ -0,0 +1,9 @@ +module.exports = { + description: 'does not merge small chunks that have side effects', + options: { + input: ['main1.js', 'main2.js', 'main3.js'], + output: { + experimentalMinChunkSize: 100 + } + } +}; diff --git a/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/amd/generated-big.js b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/amd/generated-big.js new file mode 100644 index 00000000000..1c86c5f3245 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/amd/generated-big.js @@ -0,0 +1,7 @@ +define(['exports'], (function (exports) { 'use strict'; + + const big = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; + + exports.big = big; + +})); diff --git a/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/amd/generated-small.js b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/amd/generated-small.js new file mode 100644 index 00000000000..60ddec3c69f --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/amd/generated-small.js @@ -0,0 +1,8 @@ +define(['exports'], (function (exports) { 'use strict'; + + console.log('effect'); + const small = '1'; + + exports.small = small; + +})); diff --git a/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/amd/main1.js b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/amd/main1.js new file mode 100644 index 00000000000..9f1e89308c2 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/amd/main1.js @@ -0,0 +1,5 @@ +define(['./generated-big', './generated-small'], (function (big, small) { 'use strict'; + + console.log(big.big, small.small); + +})); diff --git a/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/amd/main2.js b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/amd/main2.js new file mode 100644 index 00000000000..9f1e89308c2 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/amd/main2.js @@ -0,0 +1,5 @@ +define(['./generated-big', './generated-small'], (function (big, small) { 'use strict'; + + console.log(big.big, small.small); + +})); diff --git a/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/amd/main3.js b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/amd/main3.js new file mode 100644 index 00000000000..1bddbc92f18 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/amd/main3.js @@ -0,0 +1,5 @@ +define(['./generated-big'], (function (big) { 'use strict'; + + console.log(big.big); + +})); diff --git a/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/cjs/generated-big.js b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/cjs/generated-big.js new file mode 100644 index 00000000000..02f83e81fc3 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/cjs/generated-big.js @@ -0,0 +1,5 @@ +'use strict'; + +const big = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; + +exports.big = big; diff --git a/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/cjs/generated-small.js b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/cjs/generated-small.js new file mode 100644 index 00000000000..f28ad7e891d --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/cjs/generated-small.js @@ -0,0 +1,6 @@ +'use strict'; + +console.log('effect'); +const small = '1'; + +exports.small = small; diff --git a/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/cjs/main1.js b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/cjs/main1.js new file mode 100644 index 00000000000..b3a7679c4a0 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/cjs/main1.js @@ -0,0 +1,6 @@ +'use strict'; + +var big = require('./generated-big.js'); +var small = require('./generated-small.js'); + +console.log(big.big, small.small); diff --git a/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/cjs/main2.js b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/cjs/main2.js new file mode 100644 index 00000000000..b3a7679c4a0 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/cjs/main2.js @@ -0,0 +1,6 @@ +'use strict'; + +var big = require('./generated-big.js'); +var small = require('./generated-small.js'); + +console.log(big.big, small.small); diff --git a/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/cjs/main3.js b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/cjs/main3.js new file mode 100644 index 00000000000..5a574b96fe4 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/cjs/main3.js @@ -0,0 +1,5 @@ +'use strict'; + +var big = require('./generated-big.js'); + +console.log(big.big); diff --git a/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/es/generated-big.js b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/es/generated-big.js new file mode 100644 index 00000000000..f26e52dae36 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/es/generated-big.js @@ -0,0 +1,3 @@ +const big = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; + +export { big as b }; diff --git a/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/es/generated-small.js b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/es/generated-small.js new file mode 100644 index 00000000000..71d7aa578ee --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/es/generated-small.js @@ -0,0 +1,4 @@ +console.log('effect'); +const small = '1'; + +export { small as s }; diff --git a/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/es/main1.js b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/es/main1.js new file mode 100644 index 00000000000..003370663b0 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/es/main1.js @@ -0,0 +1,4 @@ +import { b as big } from './generated-big.js'; +import { s as small } from './generated-small.js'; + +console.log(big, small); diff --git a/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/es/main2.js b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/es/main2.js new file mode 100644 index 00000000000..003370663b0 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/es/main2.js @@ -0,0 +1,4 @@ +import { b as big } from './generated-big.js'; +import { s as small } from './generated-small.js'; + +console.log(big, small); diff --git a/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/es/main3.js b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/es/main3.js new file mode 100644 index 00000000000..00748695997 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/es/main3.js @@ -0,0 +1,3 @@ +import { b as big } from './generated-big.js'; + +console.log(big); diff --git a/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/system/generated-big.js b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/system/generated-big.js new file mode 100644 index 00000000000..c924360b7cd --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/system/generated-big.js @@ -0,0 +1,10 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + const big = exports('b', '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/system/generated-small.js b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/system/generated-small.js new file mode 100644 index 00000000000..ca96da94b50 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/system/generated-small.js @@ -0,0 +1,11 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + console.log('effect'); + const small = exports('s', '1'); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/system/main1.js b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/system/main1.js new file mode 100644 index 00000000000..1b80803b9e5 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/system/main1.js @@ -0,0 +1,16 @@ +System.register(['./generated-big.js', './generated-small.js'], (function () { + 'use strict'; + var big, small; + return { + setters: [function (module) { + big = module.b; + }, function (module) { + small = module.s; + }], + execute: (function () { + + console.log(big, small); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/system/main2.js b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/system/main2.js new file mode 100644 index 00000000000..1b80803b9e5 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/system/main2.js @@ -0,0 +1,16 @@ +System.register(['./generated-big.js', './generated-small.js'], (function () { + 'use strict'; + var big, small; + return { + setters: [function (module) { + big = module.b; + }, function (module) { + small = module.s; + }], + execute: (function () { + + console.log(big, small); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/system/main3.js b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/system/main3.js new file mode 100644 index 00000000000..9d92d0a9972 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/_expected/system/main3.js @@ -0,0 +1,14 @@ +System.register(['./generated-big.js'], (function () { + 'use strict'; + var big; + return { + setters: [function (module) { + big = module.b; + }], + execute: (function () { + + console.log(big); + + }) + }; +})); diff --git a/test/chunking-form/samples/minChunkSize/no-merge-side-effects/big.js b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/big.js new file mode 100644 index 00000000000..aa804924cba --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/big.js @@ -0,0 +1 @@ +export const big = '1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'; diff --git a/test/chunking-form/samples/minChunkSize/no-merge-side-effects/main1.js b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/main1.js new file mode 100644 index 00000000000..ca84399ef67 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/main1.js @@ -0,0 +1,4 @@ +import { big } from './big'; +import { small } from './small'; + +console.log(big, small); diff --git a/test/chunking-form/samples/minChunkSize/no-merge-side-effects/main2.js b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/main2.js new file mode 100644 index 00000000000..ca84399ef67 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/main2.js @@ -0,0 +1,4 @@ +import { big } from './big'; +import { small } from './small'; + +console.log(big, small); diff --git a/test/chunking-form/samples/minChunkSize/no-merge-side-effects/main3.js b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/main3.js new file mode 100644 index 00000000000..99752c1c3b4 --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/main3.js @@ -0,0 +1,3 @@ +import { big } from './big'; + +console.log(big); diff --git a/test/chunking-form/samples/minChunkSize/no-merge-side-effects/small.js b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/small.js new file mode 100644 index 00000000000..d41bd10033c --- /dev/null +++ b/test/chunking-form/samples/minChunkSize/no-merge-side-effects/small.js @@ -0,0 +1,2 @@ +console.log('effect'); +export const small = '1'; diff --git a/test/chunking-form/samples/render-chunk-transform/_config.js b/test/chunking-form/samples/render-chunk-transform/_config.js index 02ec529781f..b623fa23427 100644 --- a/test/chunking-form/samples/render-chunk-transform/_config.js +++ b/test/chunking-form/samples/render-chunk-transform/_config.js @@ -1,5 +1,4 @@ const assert = require('node:assert'); -const path = require('node:path'); const { replaceDirectoryInStringifiedObject } = require('../../../utils'); module.exports = { diff --git a/test/cli/samples/unfulfilled-hook-actions-manual-exit/rollup.config.js b/test/cli/samples/unfulfilled-hook-actions-manual-exit/rollup.config.js index f63dae4d349..0c565b2e067 100644 --- a/test/cli/samples/unfulfilled-hook-actions-manual-exit/rollup.config.js +++ b/test/cli/samples/unfulfilled-hook-actions-manual-exit/rollup.config.js @@ -1,5 +1,3 @@ -const path = require('node:path'); - let resolveA; const waitForA = new Promise(resolve => (resolveA = resolve)); diff --git a/test/cli/samples/watch/bundle-error/main.js b/test/cli/samples/watch/bundle-error/main.js deleted file mode 100644 index a4012bff06c..00000000000 --- a/test/cli/samples/watch/bundle-error/main.js +++ /dev/null @@ -1 +0,0 @@ -export default 42; \ No newline at end of file diff --git a/test/cli/samples/watch/no-config-file/_config.js b/test/cli/samples/watch/no-config-file/_config.js index d7aa14e8e79..c671e90a607 100644 --- a/test/cli/samples/watch/no-config-file/_config.js +++ b/test/cli/samples/watch/no-config-file/_config.js @@ -1,5 +1,3 @@ -const path = require('node:path'); - module.exports = { description: 'watches without a config file', command: 'rollup main.js --watch --format es --file _actual/main.js', diff --git a/test/cli/samples/watch/node-config-file/_config.js b/test/cli/samples/watch/node-config-file/_config.js index 62fcf51923b..1cbfcf60c82 100644 --- a/test/cli/samples/watch/node-config-file/_config.js +++ b/test/cli/samples/watch/node-config-file/_config.js @@ -1,5 +1,3 @@ -const path = require('node:path'); - module.exports = { description: 'watches using a node_modules config files', command: 'rollup --watch --config node:custom', diff --git a/test/form/samples/dynamic-import-this-arrow/_config.js b/test/form/samples/dynamic-import-this-arrow/_config.js index 972c5922768..2a4145afc99 100644 --- a/test/form/samples/dynamic-import-this-arrow/_config.js +++ b/test/form/samples/dynamic-import-this-arrow/_config.js @@ -1,5 +1,3 @@ -const assert = require('node:assert'); - module.exports = { description: 'uses correct "this" in dynamic imports when using arrow functions', options: { diff --git a/test/form/samples/dynamic-import-this-function/_config.js b/test/form/samples/dynamic-import-this-function/_config.js index 6c22d856484..53feb9f5913 100644 --- a/test/form/samples/dynamic-import-this-function/_config.js +++ b/test/form/samples/dynamic-import-this-function/_config.js @@ -1,5 +1,3 @@ -const assert = require('node:assert'); - module.exports = { description: 'uses correct "this" in dynamic imports when not using arrow functions', options: { diff --git a/test/form/samples/enforce-addon-order/_config.js b/test/form/samples/enforce-addon-order/_config.js index 800a0e9b4a1..0814c90772b 100644 --- a/test/form/samples/enforce-addon-order/_config.js +++ b/test/form/samples/enforce-addon-order/_config.js @@ -1,11 +1,3 @@ -const assert = require('node:assert'); -const fs = require('node:fs'); -const path = require('node:path'); -const acorn = require('acorn'); - -const ID_MAIN = path.join(__dirname, 'main.js'); -const code = fs.readFileSync(ID_MAIN, 'utf8'); - const hooks = ['banner', 'footer', 'intro', 'outro']; const plugins = []; diff --git a/test/form/samples/generated-code-compact/reserved-names-as-props-false/_config.js b/test/form/samples/generated-code-compact/reserved-names-as-props-false/_config.js index f7631ff116c..0fff50bba3a 100644 --- a/test/form/samples/generated-code-compact/reserved-names-as-props-false/_config.js +++ b/test/form/samples/generated-code-compact/reserved-names-as-props-false/_config.js @@ -14,7 +14,7 @@ module.exports = { }, plugins: [ { - transform(code, id) { + transform() { return { syntheticNamedExports: true }; } } diff --git a/test/form/samples/generated-code-compact/reserved-names-as-props-true/_config.js b/test/form/samples/generated-code-compact/reserved-names-as-props-true/_config.js index d40ba895944..5687b9a5fa4 100644 --- a/test/form/samples/generated-code-compact/reserved-names-as-props-true/_config.js +++ b/test/form/samples/generated-code-compact/reserved-names-as-props-true/_config.js @@ -14,7 +14,7 @@ module.exports = { }, plugins: [ { - transform(code, id) { + transform() { return { syntheticNamedExports: true }; } } diff --git a/test/form/samples/import-assertions/keep-dynamic-assertions/_config.js b/test/form/samples/import-assertions/keep-dynamic-assertions/_config.js index e2571b057c7..d46209bfcea 100644 --- a/test/form/samples/import-assertions/keep-dynamic-assertions/_config.js +++ b/test/form/samples/import-assertions/keep-dynamic-assertions/_config.js @@ -8,7 +8,7 @@ module.exports = { }, plugins: [ { - resolveDynamicImport(specifier, importer) { + resolveDynamicImport(specifier) { if (typeof specifier === 'object') { if (specifier.type === 'TemplateLiteral') { return "'resolvedString'"; diff --git a/test/form/samples/import-assertions/removes-dynamic-assertions/_config.js b/test/form/samples/import-assertions/removes-dynamic-assertions/_config.js index b939795fd58..74a50e2c816 100644 --- a/test/form/samples/import-assertions/removes-dynamic-assertions/_config.js +++ b/test/form/samples/import-assertions/removes-dynamic-assertions/_config.js @@ -8,7 +8,7 @@ module.exports = { }, plugins: [ { - resolveDynamicImport(specifier, importer) { + resolveDynamicImport(specifier) { if (typeof specifier === 'object') { if (specifier.type === 'TemplateLiteral') { return "'resolvedString'"; diff --git a/test/form/samples/return-after-error/_config.js b/test/form/samples/return-after-error/_config.js index db8aa326bbb..e45fd11d277 100644 --- a/test/form/samples/return-after-error/_config.js +++ b/test/form/samples/return-after-error/_config.js @@ -1,5 +1,3 @@ -const path = require('node:path'); - module.exports = { description: 'tree-shakes entities referenced in a return statement after an error' }; diff --git a/test/function/samples/deconflicts-interop/_config.js b/test/function/samples/deconflicts-interop/_config.js index 63729a30fe5..e569d383180 100644 --- a/test/function/samples/deconflicts-interop/_config.js +++ b/test/function/samples/deconflicts-interop/_config.js @@ -25,8 +25,7 @@ module.exports = { } }, context: { - require: () => { - return Object.defineProperty({ foo: 'foo', default: 'bar' }, '__esModule', { value: true }); - } + require: () => + Object.defineProperty({ foo: 'foo', default: 'bar' }, '__esModule', { value: true }) } }; diff --git a/test/function/samples/external-function/_config.js b/test/function/samples/external-function/_config.js index cabe004fca3..05832e1686a 100644 --- a/test/function/samples/external-function/_config.js +++ b/test/function/samples/external-function/_config.js @@ -1,9 +1,7 @@ module.exports = { description: 'allows external option to be a function (#522)', options: { - external: id => { - return id === 'external'; - } + external: id => id === 'external' }, context: { require: id => { diff --git a/test/function/samples/import-assertions/plugin-assertions-this-resolve/_config.js b/test/function/samples/import-assertions/plugin-assertions-this-resolve/_config.js index 42c28ecd730..37eb8231488 100644 --- a/test/function/samples/import-assertions/plugin-assertions-this-resolve/_config.js +++ b/test/function/samples/import-assertions/plugin-assertions-this-resolve/_config.js @@ -6,7 +6,7 @@ module.exports = { plugins: [ { name: 'first', - async resolveId(source, importer, { assertions }) { + async resolveId() { assert.deepStrictEqual( await this.resolve('external', undefined, { skipSelf: true, diff --git a/test/function/samples/modify-this-via-getter/deoptimized-props-with-getter/_config.js b/test/function/samples/modify-this-via-getter/deoptimized-props-with-getter/_config.js index 4b7c9b3ebb3..d5d93d31690 100644 --- a/test/function/samples/modify-this-via-getter/deoptimized-props-with-getter/_config.js +++ b/test/function/samples/modify-this-via-getter/deoptimized-props-with-getter/_config.js @@ -1,7 +1,7 @@ module.exports = { description: 'handles fully deoptimized objects', context: { - require(id) { + require() { return { unknown: 'prop' }; } }, diff --git a/test/function/samples/modify-this-via-getter/unknown-prop-unknown-access/_config.js b/test/function/samples/modify-this-via-getter/unknown-prop-unknown-access/_config.js index 884460d181b..f7ad11093ff 100644 --- a/test/function/samples/modify-this-via-getter/unknown-prop-unknown-access/_config.js +++ b/test/function/samples/modify-this-via-getter/unknown-prop-unknown-access/_config.js @@ -1,7 +1,7 @@ module.exports = { description: 'handles unknown getters that modify "this" for unknown property access', context: { - require(id) { + require() { return { unknown: 'prop' }; } }, diff --git a/test/function/samples/modify-this-via-getter/unknown-property-access/_config.js b/test/function/samples/modify-this-via-getter/unknown-property-access/_config.js index 98690a2ad8d..5b8bf4cebb8 100644 --- a/test/function/samples/modify-this-via-getter/unknown-property-access/_config.js +++ b/test/function/samples/modify-this-via-getter/unknown-property-access/_config.js @@ -1,7 +1,7 @@ module.exports = { description: 'handles getters that modify "this" for unknown property access', context: { - require(id) { + require() { return { unknown: 'prop' }; } }, diff --git a/test/function/samples/modify-this-via-getter/unknown-super-prop/_config.js b/test/function/samples/modify-this-via-getter/unknown-super-prop/_config.js index 362170a081b..aadb521b9c2 100644 --- a/test/function/samples/modify-this-via-getter/unknown-super-prop/_config.js +++ b/test/function/samples/modify-this-via-getter/unknown-super-prop/_config.js @@ -1,7 +1,7 @@ module.exports = { description: 'handles getters that modify "this" on prototypes for unknown properties', context: { - require(id) { + require() { return { unknown: 'prop' }; } }, diff --git a/test/function/samples/modify-this-via-setter/deoptimized-props-with-setter/_config.js b/test/function/samples/modify-this-via-setter/deoptimized-props-with-setter/_config.js index 4b7c9b3ebb3..d5d93d31690 100644 --- a/test/function/samples/modify-this-via-setter/deoptimized-props-with-setter/_config.js +++ b/test/function/samples/modify-this-via-setter/deoptimized-props-with-setter/_config.js @@ -1,7 +1,7 @@ module.exports = { description: 'handles fully deoptimized objects', context: { - require(id) { + require() { return { unknown: 'prop' }; } }, diff --git a/test/function/samples/modify-this-via-setter/unknown-prop-setter/_config.js b/test/function/samples/modify-this-via-setter/unknown-prop-setter/_config.js index d6305f6c204..ada935cacc5 100644 --- a/test/function/samples/modify-this-via-setter/unknown-prop-setter/_config.js +++ b/test/function/samples/modify-this-via-setter/unknown-prop-setter/_config.js @@ -1,7 +1,7 @@ module.exports = { description: 'handles unknown setters that modify "this"', context: { - require(id) { + require() { return { unknown: 'prop' }; } }, diff --git a/test/function/samples/modify-this-via-setter/unknown-prop-unknown-access/_config.js b/test/function/samples/modify-this-via-setter/unknown-prop-unknown-access/_config.js index 5b67fd6ea0e..e3522b87aa3 100644 --- a/test/function/samples/modify-this-via-setter/unknown-prop-unknown-access/_config.js +++ b/test/function/samples/modify-this-via-setter/unknown-prop-unknown-access/_config.js @@ -1,7 +1,7 @@ module.exports = { description: 'handles unknown setters that modify "this" for unknown property access', context: { - require(id) { + require() { return { unknown: 'prop' }; } }, diff --git a/test/function/samples/modify-this-via-setter/unknown-super-prop/_config.js b/test/function/samples/modify-this-via-setter/unknown-super-prop/_config.js index 5bd99dc35bf..cabfbba9c53 100644 --- a/test/function/samples/modify-this-via-setter/unknown-super-prop/_config.js +++ b/test/function/samples/modify-this-via-setter/unknown-super-prop/_config.js @@ -1,7 +1,7 @@ module.exports = { description: 'handles setters that modify "this" on prototypes for unknown properties', context: { - require(id) { + require() { return { unknown: 'prop' }; } }, diff --git a/test/function/samples/module-side-effects/writable/_config.js b/test/function/samples/module-side-effects/writable/_config.js index bfb846e46c6..1a21c1ee4a4 100644 --- a/test/function/samples/module-side-effects/writable/_config.js +++ b/test/function/samples/module-side-effects/writable/_config.js @@ -1,6 +1,3 @@ -const assert = require('node:assert'); -const path = require('node:assert'); - // We prefix the polyfill with \0 to tell other plugins not to try to load or // transform it const POLYFILL_ID = '\0polyfill'; diff --git a/test/function/samples/output-options-hook/_config.js b/test/function/samples/output-options-hook/_config.js index ed8e82de12c..8c661e955d7 100644 --- a/test/function/samples/output-options-hook/_config.js +++ b/test/function/samples/output-options-hook/_config.js @@ -27,6 +27,7 @@ module.exports = { dynamicImportInCjs: true, entryFileNames: '[name].js', esModule: 'if-default-prop', + experimentalMinChunkSize: 0, exports: 'auto', extend: false, externalImportAssertions: true, diff --git a/test/function/samples/preload-loading-module/_config.js b/test/function/samples/preload-loading-module/_config.js index ca1e93c1184..8891fd910aa 100644 --- a/test/function/samples/preload-loading-module/_config.js +++ b/test/function/samples/preload-loading-module/_config.js @@ -11,7 +11,7 @@ module.exports = { load(id) { this.load({ id }).then(({ code }) => (preloadedCode = code)); }, - buildEnd(error) { + buildEnd() { assert.strictEqual(preloadedCode, 'assert.ok(true);\n'); } } diff --git a/test/function/samples/transformer-multiple/_config.js b/test/function/samples/transformer-multiple/_config.js index 0c918b03121..3e5d98ed043 100644 --- a/test/function/samples/transformer-multiple/_config.js +++ b/test/function/samples/transformer-multiple/_config.js @@ -12,9 +12,7 @@ module.exports = { { transform(code) { - return code.replace(/\d+/g, match => { - return 2 * +match; - }); + return code.replace(/\d+/g, match => 2 * +match); } } ] diff --git a/test/hooks/index.js b/test/hooks/index.js index 66cf29b0f24..a5d52d0cdb5 100644 --- a/test/hooks/index.js +++ b/test/hooks/index.js @@ -56,7 +56,7 @@ describe('hooks', () => { } ] }) - .then(bundle => { + .then(() => { assert.strictEqual(buildStartCnt, 1); assert.strictEqual(buildEndCnt, 1); @@ -222,8 +222,8 @@ describe('hooks', () => { }); }); - it('does not overwrite files in other outputs when emitting assets during generate', () => { - return rollup + it('does not overwrite files in other outputs when emitting assets during generate', () => + rollup .rollup({ input: 'input', plugins: [ @@ -248,8 +248,7 @@ describe('hooks', () => { assert.strictEqual(output2.length, 2, 'output2'); assert.strictEqual(output2[1].fileName, 'asset'); assert.strictEqual(output2[1].source, 'cjs'); - }); - }); + })); it('caches asset emission in transform hook', () => { let cache; @@ -889,7 +888,7 @@ describe('hooks', () => { d: `export default {};` }), { - renderChunk(code, chunk, options) { + renderChunk(code, chunk) { chunks.push({ fileName: chunk.fileName, imports: chunk.imports, @@ -957,7 +956,7 @@ describe('hooks', () => { entryFileNames: '[name]-[hash].js' }) ) - .then(output => { + .then(() => { assert.strictEqual(augmentChunkHashCalls, 1); }); }); @@ -1028,8 +1027,8 @@ describe('hooks', () => { }); }); - it('supports disabling sanitization for in-memory / in-browser / non-fs builds', () => { - return rollup + it('supports disabling sanitization for in-memory / in-browser / non-fs builds', () => + rollup .rollup({ input: 'input.js', plugins: [ @@ -1039,17 +1038,16 @@ describe('hooks', () => { } ] }) - .then(bundle => { - return bundle.generate({ + .then(bundle => + bundle.generate({ format: 'es', sanitizeFileName: false, entryFileNames: 'test:[name]' - }); - }) + }) + ) .then(({ output }) => { assert.strictEqual(output[0].fileName, 'test:input'); - }); - }); + })); it('allows to enforce plugin hook order in watch mode', async () => { const hooks = ['closeBundle', 'closeWatcher', 'renderError', 'watchChange', 'writeBundle']; diff --git a/test/incremental/index.js b/test/incremental/index.js index a78ab91fedf..0811864ff34 100644 --- a/test/incremental/index.js +++ b/test/incremental/index.js @@ -14,9 +14,7 @@ describe('incremental', () => { return id === 'external' ? false : id; }, - load: id => { - return modules[id]; - }, + load: id => modules[id], transform: code => { transformCalls++; @@ -74,7 +72,7 @@ describe('incremental', () => { cache: bundle }); }) - .then(bundle => { + .then(() => { assert.strictEqual(resolveIdCalls, 3); // +1 for entry point which is resolved every time assert.strictEqual(transformCalls, 2); }); @@ -98,13 +96,13 @@ describe('incremental', () => { cache = bundle.cache; }); }) - .then(() => { - return rollup.rollup({ + .then(() => + rollup.rollup({ input: 'entry', plugins: [plugin], cache - }); - }) + }) + ) .then(bundle => { assert.strictEqual(transformCalls, 3); @@ -133,13 +131,13 @@ describe('incremental', () => { cache = bundle.cache; }); }) - .then(() => { - return rollup.rollup({ + .then(() => + rollup.rollup({ input: 'entry', plugins: [plugin], cache - }); - }) + }) + ) .then(bundle => { assert.strictEqual(resolveIdCalls, 4); @@ -170,13 +168,13 @@ describe('incremental', () => { cache = bundle.cache; }); }) - .then(() => { - return rollup.rollup({ + .then(() => + rollup.rollup({ input: 'entry', plugins: [plugin], cache - }); - }) + }) + ) .then(bundle => { assert.strictEqual(resolveIdCalls, 4); @@ -187,8 +185,8 @@ describe('incremental', () => { }); }); - it('keeps ASTs between runs', () => { - return rollup + it('keeps ASTs between runs', () => + rollup .rollup({ input: 'entry', plugins: [plugin] @@ -207,8 +205,7 @@ describe('incremental', () => { asts.foo, acorn.parse(modules.foo, { sourceType: 'module', ecmaVersion: 2020 }) ); - }); - }); + })); it('recovers from errors', () => { modules.entry = `import foo from 'foo'; import bar from 'bar'; export default foo + bar;`; @@ -227,9 +224,7 @@ describe('incremental', () => { plugins: [plugin], cache }) - .catch(error => { - return cache; - }); + .catch(() => cache); }) .then(cache => { modules.foo = `export default 42;`; @@ -240,9 +235,7 @@ describe('incremental', () => { plugins: [plugin], cache }) - .then(bundle => { - return executeBundle(bundle); - }) + .then(bundle => executeBundle(bundle)) .then(result => { assert.strictEqual(result, 63); }); @@ -399,9 +392,7 @@ describe('incremental', () => { } } }, - transform: (code, id) => { - return { meta: { transform: { calls: transformCalls, id } } }; - } + transform: (code, id) => ({ meta: { transform: { calls: transformCalls, id } } }) }; const cache = await rollup.rollup({ input: 'entry', diff --git a/test/misc/bundle-information.js b/test/misc/bundle-information.js index 75f5cbca2ce..1b9ae79ff4a 100644 --- a/test/misc/bundle-information.js +++ b/test/misc/bundle-information.js @@ -3,8 +3,8 @@ const rollup = require('../../dist/rollup'); const { loader } = require('../utils.js'); describe('The bundle object', () => { - it('contains information about the generated chunks', () => { - return rollup + it('contains information about the generated chunks', () => + rollup .rollup({ input: ['input1', 'input2'], plugins: [ @@ -117,11 +117,10 @@ describe('The bundle object', () => { ], 'modules' ); - }); - }); + })); - it('contains information about external imports and reexports', () => { - return rollup + it('contains information about external imports and reexports', () => + rollup .rollup({ input: ['input'], external: ['external1', 'external2', 'external3'], @@ -207,11 +206,10 @@ describe('The bundle object', () => { ], 'modules' ); - }); - }); + })); - it('handles entry facades as entry points but not the facaded chunk', () => { - return rollup + it('handles entry facades as entry points but not the facaded chunk', () => + rollup .rollup({ input: ['input1', 'input2'], plugins: [ @@ -251,11 +249,10 @@ describe('The bundle object', () => { ['input1', 'input2', null], 'facadeModuleId' ); - }); - }); + })); - it('prioritizes the proper facade name over the proper facaded chunk name', () => { - return rollup + it('prioritizes the proper facade name over the proper facaded chunk name', () => + rollup .rollup({ input: ['input1', 'input2'], plugins: [ @@ -286,11 +283,10 @@ describe('The bundle object', () => { ['input1', 'input2', null], 'facadeModuleId' ); - }); - }); + })); - it('marks dynamic entry points but only marks them as normal entry points if they actually are', () => { - return rollup + it('marks dynamic entry points but only marks them as normal entry points if they actually are', () => + rollup .rollup({ input: ['input', 'dynamic1'], plugins: [ @@ -344,11 +340,10 @@ describe('The bundle object', () => { [['dynamic1.js', 'generated-dynamic2.js'], [], []], 'dynamicImports' ); - }); - }); + })); - it('handles tainted dynamic entries', () => { - return rollup + it('handles tainted dynamic entries', () => + rollup .rollup({ input: ['input1', 'input2'], plugins: [ @@ -394,11 +389,10 @@ describe('The bundle object', () => { [['generated-dynamic.js'], [], []], 'dynamicImports' ); - }); - }); + })); - it('removes tree-shaken dynamic imports', () => { - return rollup + it('removes tree-shaken dynamic imports', () => + rollup .rollup({ input: ['input'], plugins: [ @@ -452,11 +446,10 @@ describe('The bundle object', () => { ], 'modules' ); - }); - }); + })); - it('adds correct flags to files when preserving modules', () => { - return rollup + it('adds correct flags to files when preserving modules', () => + rollup .rollup({ input: ['input', 'dynamic1'], plugins: [ @@ -582,11 +575,10 @@ console.log(other);Promise.all([import('./dynamic1.js'), import('./dynamic2.js') ['input', 'dynamic1', 'dynamic2', 'other'], 'facadeModuleId' ); - }); - }); + })); - it('contains correct information about rendered/removedExports when directly exporting items', () => { - return rollup + it('contains correct information about rendered/removedExports when directly exporting items', () => + rollup .rollup({ input: ['input'], plugins: [ @@ -636,11 +628,10 @@ console.log(other);Promise.all([import('./dynamic1.js'), import('./dynamic2.js') }, 'modules' ); - }); - }); + })); - it('contains correct information about rendered/removedExports when using export declaration', () => { - return rollup + it('contains correct information about rendered/removedExports when using export declaration', () => + rollup .rollup({ input: ['input'], plugins: [ @@ -690,6 +681,5 @@ console.log(other);Promise.all([import('./dynamic1.js'), import('./dynamic2.js') }, 'modules' ); - }); - }); + })); }); diff --git a/test/misc/deprecations.js b/test/misc/deprecations.js index 2882fb8e97d..05235ffe141 100644 --- a/test/misc/deprecations.js +++ b/test/misc/deprecations.js @@ -3,12 +3,11 @@ const rollup = require('../../dist/rollup'); const { loader } = require('../utils.js'); describe('deprecations', () => { - it('supports es format alias', () => { - return rollup + it('supports es format alias', () => + rollup .rollup({ input: 'x', plugins: [loader({ x: 'export const x = function () {}' })] }) .then(bundle => bundle.generate({ format: 'es' })) .then(({ output: [{ code }] }) => { assert.equal(code, 'const x = function () {};\n\nexport { x };\n'); - }); - }); + })); }); diff --git a/test/misc/misc.js b/test/misc/misc.js index 037d9ff0616..7597346481b 100644 --- a/test/misc/misc.js +++ b/test/misc/misc.js @@ -1,6 +1,6 @@ const assert = require('node:assert'); const rollup = require('../../dist/rollup'); -const { assertIncludes, loader } = require('../utils.js'); +const { loader } = require('../utils.js'); describe('misc', () => { it('avoids modification of options or their properties', () => { @@ -122,8 +122,8 @@ describe('misc', () => { plugins: [loader({ x: `console.log( 42 );` }), null, false, undefined] })); - it('handles different import paths for different outputs', () => { - return rollup + it('handles different import paths for different outputs', () => + rollup .rollup({ input: 'x', external: ['the-answer'], @@ -151,8 +151,7 @@ describe('misc', () => { assert.equal(generated.output[0].code, "import 'the-answer';\n", 'no render path 2') ) ]) - ); - }); + )); it('allows passing the same object to `rollup` and `generate`', () => { const options = { @@ -286,7 +285,7 @@ console.log(x); }) ] }); - const first = await bundle.generate({ format: 'iife', inlineDynamicImports: true }); - const second = await bundle.generate({ format: 'es', exports: 'auto' }); + await bundle.generate({ format: 'iife', inlineDynamicImports: true }); + await bundle.generate({ format: 'es', exports: 'auto' }); }); }); diff --git a/test/misc/optionList.js b/test/misc/optionList.js index 9cf18ae43ca..eadb77c7133 100644 --- a/test/misc/optionList.js +++ b/test/misc/optionList.js @@ -1,6 +1,6 @@ exports.input = 'acorn, acornInjectPlugins, cache, context, experimentalCacheExpiry, external, inlineDynamicImports, input, makeAbsoluteExternalsRelative, manualChunks, maxParallelFileOps, maxParallelFileReads, moduleContext, onwarn, perf, plugins, preserveEntrySignatures, preserveModules, preserveSymlinks, shimMissingExports, strictDeprecations, treeshake, watch'; exports.flags = - 'acorn, acornInjectPlugins, amd, assetFileNames, banner, bundleConfigAsCjs, c, cache, chunkFileNames, compact, config, configPlugin, context, d, dir, dynamicImportFunction, dynamicImportInCjs, e, entryFileNames, environment, esModule, experimentalCacheExpiry, exports, extend, external, externalImportAssertions, externalLiveBindings, f, failAfterWarnings, file, footer, format, freeze, g, generatedCode, globals, h, hoistTransitiveImports, i, indent, inlineDynamicImports, input, interop, intro, m, makeAbsoluteExternalsRelative, manualChunks, maxParallelFileOps, maxParallelFileReads, minifyInternalExports, moduleContext, n, name, namespaceToStringTag, noConflict, o, onwarn, outro, p, paths, perf, plugin, plugins, preferConst, preserveEntrySignatures, preserveModules, preserveModulesRoot, preserveSymlinks, sanitizeFileName, shimMissingExports, silent, sourcemap, sourcemapBaseUrl, sourcemapExcludeSources, sourcemapFile, stdin, strict, strictDeprecations, systemNullSetters, treeshake, v, validate, w, waitForBundleInput, watch'; + 'acorn, acornInjectPlugins, amd, assetFileNames, banner, bundleConfigAsCjs, c, cache, chunkFileNames, compact, config, configPlugin, context, d, dir, dynamicImportFunction, dynamicImportInCjs, e, entryFileNames, environment, esModule, experimentalCacheExpiry, experimentalMinChunkSize, exports, extend, external, externalImportAssertions, externalLiveBindings, f, failAfterWarnings, file, footer, format, freeze, g, generatedCode, globals, h, hoistTransitiveImports, i, indent, inlineDynamicImports, input, interop, intro, m, makeAbsoluteExternalsRelative, manualChunks, maxParallelFileOps, maxParallelFileReads, minifyInternalExports, moduleContext, n, name, namespaceToStringTag, noConflict, o, onwarn, outro, p, paths, perf, plugin, plugins, preferConst, preserveEntrySignatures, preserveModules, preserveModulesRoot, preserveSymlinks, sanitizeFileName, shimMissingExports, silent, sourcemap, sourcemapBaseUrl, sourcemapExcludeSources, sourcemapFile, stdin, strict, strictDeprecations, systemNullSetters, treeshake, v, validate, w, waitForBundleInput, watch'; exports.output = - 'amd, assetFileNames, banner, chunkFileNames, compact, dir, dynamicImportFunction, dynamicImportInCjs, entryFileNames, esModule, exports, extend, externalImportAssertions, externalLiveBindings, file, footer, format, freeze, generatedCode, globals, hoistTransitiveImports, indent, inlineDynamicImports, interop, intro, manualChunks, minifyInternalExports, name, namespaceToStringTag, noConflict, outro, paths, plugins, preferConst, preserveModules, preserveModulesRoot, sanitizeFileName, sourcemap, sourcemapBaseUrl, sourcemapExcludeSources, sourcemapFile, sourcemapPathTransform, strict, systemNullSetters, validate'; + 'amd, assetFileNames, banner, chunkFileNames, compact, dir, dynamicImportFunction, dynamicImportInCjs, entryFileNames, esModule, experimentalMinChunkSize, exports, extend, externalImportAssertions, externalLiveBindings, file, footer, format, freeze, generatedCode, globals, hoistTransitiveImports, indent, inlineDynamicImports, interop, intro, manualChunks, minifyInternalExports, name, namespaceToStringTag, noConflict, outro, paths, plugins, preferConst, preserveModules, preserveModulesRoot, sanitizeFileName, sourcemap, sourcemapBaseUrl, sourcemapExcludeSources, sourcemapFile, sourcemapPathTransform, strict, systemNullSetters, validate'; diff --git a/test/misc/umd.js b/test/misc/umd.js index fb5e157cc65..37d0e0aaed4 100644 --- a/test/misc/umd.js +++ b/test/misc/umd.js @@ -33,7 +33,7 @@ function runNodeTest(code) { return module.exports; } -function runAmdTest(code, outputOptions) { +function runAmdTest(code) { let defineArguments; function define(...parameters) { defineArguments = parameters; diff --git a/test/typescript/index.ts b/test/typescript/index.ts index 2c34dbdc597..92f4c5cf8b6 100644 --- a/test/typescript/index.ts +++ b/test/typescript/index.ts @@ -7,13 +7,13 @@ interface Options { } const plugin: rollup.PluginImpl = (options = {}) => { - const extensions = options.extensions || ['.js']; + const _extensions = options.extensions || ['.js']; return { name: 'my-plugin', resolveId: { - handler(source, importer, options) { + handler(source, _importer, _options) { // @ts-expect-error source is typed as string - const s: number = source; + const _s: number = source; } } }; @@ -22,29 +22,29 @@ const plugin: rollup.PluginImpl = (options = {}) => { plugin(); plugin({ extensions: ['.js', 'json'] }); -const pluginHooks: rollup.Plugin = { +const _pluginHooks: rollup.Plugin = { buildStart: { handler() {}, sequential: true }, async load(id) { // @ts-expect-error id is typed as string - const index: number = id; + const _index: number = id; await this.resolve('rollup'); }, name: 'test', resolveId: { - async handler(source, importer, options) { + async handler(source, _importer, _options) { await this.resolve('rollup'); // @ts-expect-error source is typed as string - const s: number = source; + const _s: number = source; }, // @ts-expect-error sequential is only supported for parallel hooks sequential: true } }; -const amdOutputOptions: rollup.OutputOptions['amd'][] = [ +const _amdOutputOptions: rollup.OutputOptions['amd'][] = [ {}, { id: 'a' diff --git a/tsconfig.json b/tsconfig.json index 131d042624f..8f8ee12e84a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,7 +6,6 @@ "module": "ESNext", "moduleResolution": "Node", "noEmitOnError": true, - "noUnusedLocals": true, "noUnusedParameters": true, "pretty": true, "resolveJsonModule": true,