From f6d670f83182cb464a75ef399df8a7316e9ef166 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Fri, 15 Jul 2022 14:19:05 +0200 Subject: [PATCH] [v3.0] Rework file name patterns when preserving modules (#4565) * Put preserveModules path into Chunk name * Use regular entryFileNames logic * Clarify documentation for `preserveModules` * Improve coverage * Improve wording in docs --- docs/999-big-list-of-options.md | 37 +++++-- rollup.config.ts | 1 - src/Bundle.ts | 1 - src/Chunk.ts | 103 ++++++++---------- .../_config.js | 2 +- .../_expected/amd/entry-main-amd-ts.ts.js | 12 -- ...y-foo-amd-ts.ts.js => foo-amd-0f9dc16c.js} | 0 .../_expected/amd/main-amd-2ef83a76.js | 12 ++ ...y-bar-amd-ts.ts.js => bar-amd-f038b10c.js} | 0 ...y-baz-amd-ts.ts.js => baz-amd-d3de4cc0.js} | 0 ...-no-ext-amd-.js => no-ext-amd-9d2c6ef6.js} | 0 .../_expected/cjs/entry-main-cjs-ts.ts.js | 15 --- ...y-foo-cjs-ts.ts.js => foo-cjs-0d5774b5.js} | 0 .../_expected/cjs/main-cjs-82d6d41f.js | 15 +++ ...y-bar-cjs-ts.ts.js => bar-cjs-abedc91d.js} | 0 ...y-baz-cjs-ts.ts.js => baz-cjs-4a9c02fc.js} | 0 ...-no-ext-cjs-.js => no-ext-cjs-500f8f81.js} | 0 .../_expected/es/entry-main-es-ts.ts.js | 4 - ...try-foo-es-ts.ts.js => foo-es-3585f3eb.js} | 0 .../_expected/es/main-es-2d953d94.js | 4 + ...try-bar-es-ts.ts.js => bar-es-bd5e2ae1.js} | 0 ...try-baz-es-ts.ts.js => baz-es-a913ab4d.js} | 0 ...ry-no-ext-es-.js => no-ext-es-1f34b6e8.js} | 0 ...system-ts.ts.js => foo-system-0e2d8e48.js} | 0 ...ystem-ts.ts.js => main-system-918bfec4.js} | 2 +- ...system-ts.ts.js => bar-system-a72f6c95.js} | 0 ...system-ts.ts.js => baz-system-71d114fd.js} | 0 ...t-system-.js => no-ext-system-0cf938a8.js} | 0 .../_config.js | 21 +++- .../_expected/amd/b.str-amd-f73e15b9.js | 7 ++ ...try-foo-amd-ts.ts.js => c-amd-c1bed163.js} | 4 +- ...try-bar-amd-ts.ts.js => d-amd-f5c92c04.js} | 4 +- ...try-baz-amd-ts.ts.js => e-amd-f393b98d.js} | 4 +- .../amd/entry-lorem-amd-str.str.str.js | 7 -- .../_expected/amd/entry-main-amd-ts.ts.js | 13 --- .../_expected/amd/f-amd-df81ac71.js | 7 ++ .../_expected/amd/g-amd-1f750b5c.js | 7 ++ .../_expected/amd/h-amd-a60c0f22.js | 7 ++ .../_expected/amd/main-amd-51321eb1.js | 17 +++ .../_expected/amd/nested/a-amd-5dc7856c.js | 7 ++ ...-no-ext-amd-.js => no-ext-amd-9d2c6ef6.js} | 0 .../_expected/cjs/b.str-cjs-6703f3b2.js | 5 + .../_expected/cjs/c-cjs-71ac0098.js | 5 + .../_expected/cjs/d-cjs-9b009b8f.js | 5 + .../_expected/cjs/e-cjs-831dad1f.js | 5 + .../_expected/cjs/entry-foo-cjs-ts.ts.js | 5 - .../cjs/entry-lorem-cjs-str.str.str.js | 5 - .../_expected/cjs/entry-main-cjs-ts.ts.js | 17 --- .../_expected/cjs/f-cjs-39905a99.js | 5 + .../_expected/cjs/g-cjs-3328e22b.js | 5 + .../_expected/cjs/h-cjs-d8541d4b.js | 5 + .../_expected/cjs/main-cjs-92cd000c.js | 25 +++++ .../_expected/cjs/nested/a-cjs-80f9b8c3.js | 5 + .../cjs/nested/entry-bar-cjs-ts.ts.js | 5 - .../cjs/nested/entry-baz-cjs-ts.ts.js | 5 - ...-no-ext-cjs-.js => no-ext-cjs-500f8f81.js} | 0 .../_expected/es/b.str-es-3ce883b1.js | 3 + .../_expected/es/c-es-7b7256f9.js | 3 + .../_expected/es/d-es-1616849c.js | 3 + .../_expected/es/e-es-e18089fa.js | 3 + .../_expected/es/entry-foo-es-ts.ts.js | 3 - .../es/entry-lorem-es-str.str.str.js | 3 - .../_expected/es/entry-main-es-ts.ts.js | 5 - .../_expected/es/f-es-c1646e12.js | 3 + .../_expected/es/g-es-968f87d2.js | 3 + .../_expected/es/h-es-05491bfa.js | 3 + .../_expected/es/main-es-a7c9a9b3.js | 9 ++ .../_expected/es/nested/a-es-125ea65c.js | 3 + .../_expected/es/nested/entry-bar-es-ts.ts.js | 3 - .../_expected/es/nested/entry-baz-es-ts.ts.js | 3 - ...ry-no-ext-es-.js => no-ext-es-1f34b6e8.js} | 0 .../_expected/system/b.str-system-2fa3160e.js | 10 ++ ...o-system-ts.ts.js => c-system-9442eacd.js} | 2 +- ...r-system-ts.ts.js => d-system-1a05eeda.js} | 2 +- ...z-system-ts.ts.js => e-system-f73caf6a.js} | 2 +- .../system/entry-lorem-system-str.str.str.js | 10 -- .../system/entry-main-system-ts.ts.js | 21 ---- .../_expected/system/f-system-b3b06e3f.js | 10 ++ .../_expected/system/g-system-9b3ad652.js | 10 ++ .../_expected/system/h-system-6c6b48ca.js | 10 ++ .../_expected/system/main-system-7593b73c.js | 29 +++++ .../system/nested/a-system-db94ffc0.js | 10 ++ ...t-system-.js => no-ext-system-0cf938a8.js} | 0 .../src/{lorem.str => b.str} | 0 .../src/{foo.ts => c.mjs} | 0 .../src/d.cjs | 1 + .../src/e.jsx | 1 + .../src/f.mts | 1 + .../src/g.cts | 1 + .../src/h.tsx | 1 + .../src/main.js | 9 ++ .../src/main.ts | 10 -- .../src/nested/{bar.ts => a.ts} | 0 .../src/nested/baz.ts | 1 - .../_config.js | 18 +++ .../_expected/amd/a.js | 5 + .../_expected/amd/emitted.js | 5 + .../_expected/amd/main-entry.js | 5 + .../_expected/cjs/a.js | 3 + .../_expected/cjs/emitted.js | 3 + .../_expected/cjs/main-entry.js | 5 + .../_expected/es/a.js | 1 + .../_expected/es/emitted.js | 1 + .../_expected/es/main-entry.js | 3 + .../_expected/system/a.js | 10 ++ .../_expected/system/emitted.js | 10 ++ .../_expected/system/main-entry.js | 11 ++ .../preserve-modules-special-chunk-names/a.js | 1 + .../preserve-modules-special-chunk-names/b.js | 1 + .../main.js | 2 + .../_config.js | 2 +- ...d-.mjs => _virtualModule-amd-4e388e40.mjs} | 0 ..._virtualWithAssetExt.str-amd-4deed186.mjs} | 0 ...s.mjs => _virtualWithExt-amd-41e5e75e.mjs} | 0 .../_expected/amd/entry-main-amd-js.js.mjs | 7 -- .../_expected/amd/main-amd-eb6187f3.mjs | 7 ++ ...s-.mjs => _virtualModule-cjs-650c7f9a.mjs} | 0 ..._virtualWithAssetExt.str-cjs-63fd96f4.mjs} | 0 ...s.mjs => _virtualWithExt-cjs-c612470d.mjs} | 0 .../_expected/cjs/entry-main-cjs-js.js.mjs | 9 -- .../_expected/cjs/main-cjs-d0c7e6cf.mjs | 9 ++ ...es-.mjs => _virtualModule-es-22303f19.mjs} | 0 ... _virtualWithAssetExt.str-es-07beb78c.mjs} | 0 ...js.mjs => _virtualWithExt-es-6330be37.mjs} | 0 .../_expected/es/entry-main-es-js.js.mjs | 7 -- .../_expected/es/main-es-fd922f49.mjs | 7 ++ ...mjs => _virtualModule-system-26bc5070.mjs} | 0 ...rtualWithAssetExt.str-system-98927794.mjs} | 0 ...js => _virtualWithExt-system-11e583df.mjs} | 0 ...tem-js.js.mjs => main-system-a8e7f87b.mjs} | 2 +- test/misc/bundle-information.js | 6 +- 131 files changed, 489 insertions(+), 257 deletions(-) delete mode 100644 test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/amd/entry-main-amd-ts.ts.js rename test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/amd/{entry-foo-amd-ts.ts.js => foo-amd-0f9dc16c.js} (100%) create mode 100644 test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/amd/main-amd-2ef83a76.js rename test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/amd/nested/{entry-bar-amd-ts.ts.js => bar-amd-f038b10c.js} (100%) rename test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/amd/nested/{entry-baz-amd-ts.ts.js => baz-amd-d3de4cc0.js} (100%) rename test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/amd/{entry-no-ext-amd-.js => no-ext-amd-9d2c6ef6.js} (100%) delete mode 100644 test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/cjs/entry-main-cjs-ts.ts.js rename test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/cjs/{entry-foo-cjs-ts.ts.js => foo-cjs-0d5774b5.js} (100%) create mode 100644 test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/cjs/main-cjs-82d6d41f.js rename test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/cjs/nested/{entry-bar-cjs-ts.ts.js => bar-cjs-abedc91d.js} (100%) rename test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/cjs/nested/{entry-baz-cjs-ts.ts.js => baz-cjs-4a9c02fc.js} (100%) rename test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/cjs/{entry-no-ext-cjs-.js => no-ext-cjs-500f8f81.js} (100%) delete mode 100644 test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/es/entry-main-es-ts.ts.js rename test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/es/{entry-foo-es-ts.ts.js => foo-es-3585f3eb.js} (100%) create mode 100644 test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/es/main-es-2d953d94.js rename test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/es/nested/{entry-bar-es-ts.ts.js => bar-es-bd5e2ae1.js} (100%) rename test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/es/nested/{entry-baz-es-ts.ts.js => baz-es-a913ab4d.js} (100%) rename test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/es/{entry-no-ext-es-.js => no-ext-es-1f34b6e8.js} (100%) rename test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/system/{entry-foo-system-ts.ts.js => foo-system-0e2d8e48.js} (100%) rename test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/system/{entry-main-system-ts.ts.js => main-system-918bfec4.js} (65%) rename test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/system/nested/{entry-bar-system-ts.ts.js => bar-system-a72f6c95.js} (100%) rename test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/system/nested/{entry-baz-system-ts.ts.js => baz-system-71d114fd.js} (100%) rename test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/system/{entry-no-ext-system-.js => no-ext-system-0cf938a8.js} (100%) create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/b.str-amd-f73e15b9.js rename test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/{entry-foo-amd-ts.ts.js => c-amd-c1bed163.js} (61%) rename test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/{nested/entry-bar-amd-ts.ts.js => d-amd-f5c92c04.js} (56%) rename test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/{nested/entry-baz-amd-ts.ts.js => e-amd-f393b98d.js} (55%) delete mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/entry-lorem-amd-str.str.str.js delete mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/entry-main-amd-ts.ts.js create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/f-amd-df81ac71.js create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/g-amd-1f750b5c.js create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/h-amd-a60c0f22.js create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/main-amd-51321eb1.js create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/nested/a-amd-5dc7856c.js rename test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/{entry-no-ext-amd-.js => no-ext-amd-9d2c6ef6.js} (100%) create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/b.str-cjs-6703f3b2.js create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/c-cjs-71ac0098.js create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/d-cjs-9b009b8f.js create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/e-cjs-831dad1f.js delete mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/entry-foo-cjs-ts.ts.js delete mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/entry-lorem-cjs-str.str.str.js delete mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/entry-main-cjs-ts.ts.js create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/f-cjs-39905a99.js create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/g-cjs-3328e22b.js create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/h-cjs-d8541d4b.js create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/main-cjs-92cd000c.js create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/nested/a-cjs-80f9b8c3.js delete mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/nested/entry-bar-cjs-ts.ts.js delete mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/nested/entry-baz-cjs-ts.ts.js rename test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/{entry-no-ext-cjs-.js => no-ext-cjs-500f8f81.js} (100%) create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/b.str-es-3ce883b1.js create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/c-es-7b7256f9.js create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/d-es-1616849c.js create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/e-es-e18089fa.js delete mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/entry-foo-es-ts.ts.js delete mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/entry-lorem-es-str.str.str.js delete mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/entry-main-es-ts.ts.js create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/f-es-c1646e12.js create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/g-es-968f87d2.js create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/h-es-05491bfa.js create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/main-es-a7c9a9b3.js create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/nested/a-es-125ea65c.js delete mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/nested/entry-bar-es-ts.ts.js delete mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/nested/entry-baz-es-ts.ts.js rename test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/{entry-no-ext-es-.js => no-ext-es-1f34b6e8.js} (100%) create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/b.str-system-2fa3160e.js rename test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/{entry-foo-system-ts.ts.js => c-system-9442eacd.js} (74%) rename test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/{nested/entry-bar-system-ts.ts.js => d-system-1a05eeda.js} (71%) rename test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/{nested/entry-baz-system-ts.ts.js => e-system-f73caf6a.js} (70%) delete mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/entry-lorem-system-str.str.str.js delete mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/entry-main-system-ts.ts.js create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/f-system-b3b06e3f.js create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/g-system-9b3ad652.js create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/h-system-6c6b48ca.js create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/main-system-7593b73c.js create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/nested/a-system-db94ffc0.js rename test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/{entry-no-ext-system-.js => no-ext-system-0cf938a8.js} (100%) rename test/chunking-form/samples/preserve-modules-filename-pattern/src/{lorem.str => b.str} (100%) rename test/chunking-form/samples/preserve-modules-filename-pattern/src/{foo.ts => c.mjs} (100%) create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/src/d.cjs create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/src/e.jsx create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/src/f.mts create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/src/g.cts create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/src/h.tsx create mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/src/main.js delete mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/src/main.ts rename test/chunking-form/samples/preserve-modules-filename-pattern/src/nested/{bar.ts => a.ts} (100%) delete mode 100644 test/chunking-form/samples/preserve-modules-filename-pattern/src/nested/baz.ts create mode 100644 test/chunking-form/samples/preserve-modules-special-chunk-names/_config.js create mode 100644 test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/amd/a.js create mode 100644 test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/amd/emitted.js create mode 100644 test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/amd/main-entry.js create mode 100644 test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/cjs/a.js create mode 100644 test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/cjs/emitted.js create mode 100644 test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/cjs/main-entry.js create mode 100644 test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/es/a.js create mode 100644 test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/es/emitted.js create mode 100644 test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/es/main-entry.js create mode 100644 test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/system/a.js create mode 100644 test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/system/emitted.js create mode 100644 test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/system/main-entry.js create mode 100644 test/chunking-form/samples/preserve-modules-special-chunk-names/a.js create mode 100644 test/chunking-form/samples/preserve-modules-special-chunk-names/b.js create mode 100644 test/chunking-form/samples/preserve-modules-special-chunk-names/main.js rename test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/amd/_virtual/{entry-_virtualModule-amd-.mjs => _virtualModule-amd-4e388e40.mjs} (100%) rename test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/amd/_virtual/{entry-_virtualWithAssetExt-amd-str.str.str.mjs => _virtualWithAssetExt.str-amd-4deed186.mjs} (100%) rename test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/amd/_virtual/{entry-_virtualWithExt-amd-js.js.mjs => _virtualWithExt-amd-41e5e75e.mjs} (100%) delete mode 100644 test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/amd/entry-main-amd-js.js.mjs create mode 100644 test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/amd/main-amd-eb6187f3.mjs rename test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/cjs/_virtual/{entry-_virtualModule-cjs-.mjs => _virtualModule-cjs-650c7f9a.mjs} (100%) rename test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/cjs/_virtual/{entry-_virtualWithAssetExt-cjs-str.str.str.mjs => _virtualWithAssetExt.str-cjs-63fd96f4.mjs} (100%) rename test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/cjs/_virtual/{entry-_virtualWithExt-cjs-js.js.mjs => _virtualWithExt-cjs-c612470d.mjs} (100%) delete mode 100644 test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/cjs/entry-main-cjs-js.js.mjs create mode 100644 test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/cjs/main-cjs-d0c7e6cf.mjs rename test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/es/_virtual/{entry-_virtualModule-es-.mjs => _virtualModule-es-22303f19.mjs} (100%) rename test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/es/_virtual/{entry-_virtualWithAssetExt-es-str.str.str.mjs => _virtualWithAssetExt.str-es-07beb78c.mjs} (100%) rename test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/es/_virtual/{entry-_virtualWithExt-es-js.js.mjs => _virtualWithExt-es-6330be37.mjs} (100%) delete mode 100644 test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/es/entry-main-es-js.js.mjs create mode 100644 test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/es/main-es-fd922f49.mjs rename test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/system/_virtual/{entry-_virtualModule-system-.mjs => _virtualModule-system-26bc5070.mjs} (100%) rename test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/system/_virtual/{entry-_virtualWithAssetExt-system-str.str.str.mjs => _virtualWithAssetExt.str-system-98927794.mjs} (100%) rename test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/system/_virtual/{entry-_virtualWithExt-system-js.js.mjs => _virtualWithExt-system-11e583df.mjs} (100%) rename test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/system/{entry-main-system-js.js.mjs => main-system-a8e7f87b.mjs} (66%) diff --git a/docs/999-big-list-of-options.md b/docs/999-big-list-of-options.md index 84f89f0320a..fc17e1e5f3f 100755 --- a/docs/999-big-list-of-options.md +++ b/docs/999-big-list-of-options.md @@ -91,6 +91,31 @@ export default { }; ``` +If you want to convert a set of file to another format while maintaining the file structure and export signatures, the recommended way—instead of using [`output.preserveModules`](guide/en/#outputpreservemodules) that may tree-shake exports as well as emit virtual files created by plugins—is to turn every file into an entry point. You can do so dynamically e.g. via the `glob` package: + +```js +import glob from 'glob'; +import path from 'path'; +import { fileURLToPath } from 'url'; + +export default { + input: Object.fromEntries( + glob.sync('src/**/*.js').map(file => [ + // This remove `src/` as well as the file extension from each file, so e.g. + // src/nested/foo.js becomes nested/foo + path.relative('src', file.slice(0, file.length - path.extname(file).length)), + // This expands the relative paths to absolute paths, so e.g. + // src/nested/foo becomes /project/src/nested/foo.js + fileURLToPath(new URL(file, import.meta.url)) + ]) + ), + output: { + format: 'es', + dir: 'dist' + } +}; +``` + The option can be omitted if some plugin emits at least one chunk (using [`this.emitFile`](guide/en/#thisemitfile)) by the end of the [`buildStart`](guide/en/#buildstart) hook. When using the command line interface, multiple inputs can be provided by using the option multiple times. When provided as the first options, it is equivalent to not prefix them with `--input`: @@ -451,13 +476,7 @@ The pattern to use for chunks created from entry points, or a function that is c Forward slashes `/` can be used to place files in sub-directories. When using a function, `chunkInfo` is a reduced version of the one in [`generateBundle`](guide/en/#generatebundle) without properties that depend on file names and no information about the rendered modules as rendering only happens after file names have been generated. You can however access a list of included `moduleIds`. See also [`output.assetFileNames`](guide/en/#outputassetfilenames), [`output.chunkFileNames`](guide/en/#outputchunkfilenames). -This pattern will also be used when setting the [`output.preserveModules`](guide/en/#outputpreservemodules) option. Here a different set of placeholders is available, though: - -- `[format]`: The rendering format defined in the output options. -- `[name]`: The file name (without extension) of the file. -- `[ext]`: The extension of the file. -- `[extname]`: The extension of the file, prefixed by `.` if it is not empty. -- `[assetExtname]`: The extension of the file, prefixed by `.` if it is not empty and it is not one of `js`, `jsx`, `ts` or `tsx`. +This pattern will also be used for every file when setting the [`output.preserveModules`](guide/en/#outputpreservemodules) option. Note that in this case, `[name]` will include the relative path from the output root and possibly the original file extension if it was not one of `.js`, `.jsx`, `.mjs`, `.cjs`, `.ts`, `.tsx`, `.mts`, or `.cts`. #### output.extend @@ -1007,7 +1026,9 @@ define(['https://d3js.org/d3.v4.min'], function (d3) { Type: `boolean`
CLI: `--preserveModules`/`--no-preserveModules`
Default: `false` -Instead of creating as few chunks as possible, this mode will create separate chunks for all modules using the original module names as file names. Requires the [`output.dir`](guide/en/#outputdir) option. Tree-shaking will still be applied, suppressing files that are not used by the provided entry points or do not have side effects when executed. This mode can be used to transform a file structure to a different module format. +Instead of creating as few chunks as possible, this mode will create separate chunks for all modules using the original module names as file names. Requires the [`output.dir`](guide/en/#outputdir) option. Tree-shaking will still be applied, suppressing files that are not used by the provided entry points or do not have side effects when executed and removing unused exports of files that are not entry points. On the other hand, if plugins (like `@rollup/plugin-commonjs`) emit additional "virtual" files to achieve certain results, those files will be emitted as actual files using a pattern `_virtual/fileName.js`. + +It is therefore not recommended to blindly use this option to transform an entire file structure to another format if you directly want to import from those files as expected exports may be missing. In that case, you should rather designate all files explicitly as entry points by adding them to the [`input` option object](guide/en/#input), see the example there for how to do that. Note that when transforming to `cjs` or `amd` format, each file will by default be treated as an entry point with [`output.exports`](guide/en/#outputexports) set to `auto`. This means that e.g. for `cjs`, a file that only contains a default export will be rendered as diff --git a/rollup.config.ts b/rollup.config.ts index 77c5cac5bec..0136660c52f 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -97,7 +97,6 @@ export default async function ( chunkFileNames: 'shared/[name].js', dir: 'dist', entryFileNames: '[name]', - // TODO Only loadConfigFile is using default exports mode; this should be changed in Rollup@3 exports: 'auto', externalLiveBindings: false, format: 'cjs', diff --git a/src/Bundle.ts b/src/Bundle.ts index 26f579bbe81..358d52c1fcc 100644 --- a/src/Bundle.ts +++ b/src/Bundle.ts @@ -45,7 +45,6 @@ export default class Bundle { const outputBundle = getOutputBundle(outputBundleBase); this.pluginDriver.setOutputBundle(outputBundle, this.outputOptions); - // TODO Lukas rethink time measuring points try { await this.pluginDriver.hookParallel('renderStart', [this.outputOptions, this.inputOptions]); diff --git a/src/Chunk.ts b/src/Chunk.ts index 9b0f0762f7c..750bbd19704 100644 --- a/src/Chunk.ts +++ b/src/Chunk.ts @@ -1,5 +1,8 @@ import MagicString, { Bundle as MagicStringBundle, type SourceMap } from 'magic-string'; import { relative } from '../browser/path'; +import ExternalChunk from './ExternalChunk'; +import ExternalModule from './ExternalModule'; +import Module from './Module'; import ExportDefaultDeclaration from './ast/nodes/ExportDefaultDeclaration'; import FunctionDeclaration from './ast/nodes/FunctionDeclaration'; import ImportExpression from './ast/nodes/ImportExpression'; @@ -9,10 +12,7 @@ import LocalVariable from './ast/variables/LocalVariable'; import NamespaceVariable from './ast/variables/NamespaceVariable'; import SyntheticNamedExportVariable from './ast/variables/SyntheticNamedExportVariable'; import type Variable from './ast/variables/Variable'; -import ExternalChunk from './ExternalChunk'; -import ExternalModule from './ExternalModule'; import finalisers from './finalisers/index'; -import Module from './Module'; import type { GetInterop, GlobalsOption, @@ -25,6 +25,7 @@ import type { RenderedModule, WarningHandler } from './rollup/types'; +import type { PluginDriver } from './utils/PluginDriver'; import { createAddons } from './utils/addons'; import { deconflictChunk, type DependenciesToBeDeconflicted } from './utils/deconflictChunk'; import { @@ -49,8 +50,7 @@ import { namespaceInteropHelpersByInteropType } from './utils/interopHelpers'; import { FILE_PLACEHOLDER, OutputBundleWithPlaceholders } from './utils/outputBundle'; -import { basename, dirname, extname, isAbsolute, normalize, resolve } from './utils/path'; -import type { PluginDriver } from './utils/PluginDriver'; +import { basename, extname, isAbsolute, resolve } from './utils/path'; import relativeId, { getAliasName, getImportPath } from './utils/relativeId'; import type { RenderOptions } from './utils/renderHelpers'; import { makeUnique, renderNamePattern } from './utils/renderNamePattern'; @@ -124,7 +124,7 @@ interface FacadeName { type RenderedDependencies = Map; -const NON_ASSET_EXTENSIONS = ['.js', '.jsx', '.ts', '.tsx']; +const NON_ASSET_EXTENSIONS = ['.js', '.jsx', '.ts', '.tsx', '.mjs', '.mts', '.cjs', '.cts']; function getGlobalName( chunk: ExternalChunk, @@ -401,7 +401,11 @@ export default class Chunk { if (module.preserveSignature) { this.strictFacade = needsStrictFacade; } - this.assignFacadeName(requiredFacades.shift()!, module); + this.assignFacadeName( + requiredFacades.shift()!, + module, + this.outputOptions.preserveModules + ); } } @@ -508,13 +512,11 @@ export default class Chunk { const { chunkFileNames, entryFileNames, file, format, preserveModules } = this.outputOptions; if (file) { fileName = basename(file); - } else if (preserveModules) { - fileName = this.generateIdPreserveModules(); } else if (this.fileName !== null) { fileName = this.fileName; } else { const [pattern, patternName] = - this.facadeModule && this.facadeModule.isUserDefinedEntryPoint + preserveModules || this.facadeModule?.isUserDefinedEntryPoint ? [entryFileNames, 'output.entryFileNames'] : [chunkFileNames, 'output.chunkFileNames']; fileName = renderNamePattern( @@ -609,8 +611,6 @@ export default class Chunk { renderedExports.length !== 0 || renderedDependencies.some(dep => (dep.reexports && dep.reexports.length !== 0)!); - // TODO Lukas Note: Mention in docs, that users/plugins are responsible to do their own caching - // TODO Lukas adapt plugin hook graphs and order in docs const { intro, outro, banner, footer } = await createAddons( outputOptions, pluginDriver, @@ -668,12 +668,19 @@ export default class Chunk { } } - private assignFacadeName({ fileName, name }: FacadeName, facadedModule: Module): void { + private assignFacadeName( + { fileName, name }: FacadeName, + facadedModule: Module, + preservePath?: boolean + ): void { if (fileName) { this.fileName = fileName; } else { this.name = this.outputOptions.sanitizeFileName( - name || getChunkNameFromModule(facadedModule) + name || + (preservePath + ? this.getPreserveModulesChunkNameFromModule(facadedModule) + : getChunkNameFromModule(facadedModule)) ); } } @@ -731,48 +738,6 @@ export default class Chunk { } } - private generateIdPreserveModules(): string { - const [{ id }] = this.orderedModules; - const { entryFileNames, format, preserveModulesRoot, sanitizeFileName } = this.outputOptions; - const sanitizedId = sanitizeFileName(id.split(QUERY_HASH_REGEX, 1)[0]); - let path: string; - - const patternOpt = this.unsetOptions.has('entryFileNames') - ? '[name][assetExtname].js' - : entryFileNames; - const pattern = - typeof patternOpt === 'function' ? patternOpt(this.getPreRenderedChunkInfo()) : patternOpt; - - if (isAbsolute(sanitizedId)) { - const currentDir = dirname(sanitizedId); - const extension = extname(sanitizedId); - const fileName = renderNamePattern(pattern, 'output.entryFileNames', { - assetExtname: () => (NON_ASSET_EXTENSIONS.includes(extension) ? '' : extension), - ext: () => extension.substring(1), - extname: () => extension, - format: () => format as string, - name: () => this.getChunkName() - }); - const currentPath = `${currentDir}/${fileName}`; - if (preserveModulesRoot && resolve(currentPath).startsWith(preserveModulesRoot)) { - path = currentPath.slice(preserveModulesRoot.length).replace(/^[\\/]/, ''); - } else { - path = relative(this.inputBase, currentPath); - } - } else { - const extension = extname(sanitizedId); - const fileName = renderNamePattern(pattern, 'output.entryFileNames', { - assetExtname: () => (NON_ASSET_EXTENSIONS.includes(extension) ? '' : extension), - ext: () => extension.substring(1), - extname: () => extension, - format: () => format as string, - name: () => getAliasName(sanitizedId) - }); - path = `_virtual/${fileName}`; - } - return makeUnique(normalize(path), this.bundle); - } - private generateVariableName(): string { if (this.manualChunkAlias) { return this.manualChunkAlias; @@ -982,6 +947,24 @@ export default class Chunk { }); } + private getPreserveModulesChunkNameFromModule(module: Module): string { + const predefinedChunkName = getPredefinedChunkNameFromModule(module); + if (predefinedChunkName) return predefinedChunkName; + const { preserveModulesRoot, sanitizeFileName } = this.outputOptions; + const sanitizedId = sanitizeFileName(module.id.split(QUERY_HASH_REGEX, 1)[0]); + const extName = extname(sanitizedId); + const idWithoutExtension = NON_ASSET_EXTENSIONS.includes(extName) + ? sanitizedId.slice(0, -extName.length) + : sanitizedId; + if (isAbsolute(idWithoutExtension)) { + return preserveModulesRoot && resolve(idWithoutExtension).startsWith(preserveModulesRoot) + ? idWithoutExtension.slice(preserveModulesRoot.length).replace(/^[\\/]/, '') + : relative(this.inputBase, idWithoutExtension); + } else { + return `_virtual/${basename(idWithoutExtension)}`; + } + } + private getReexportSpecifiers(): Map { const { externalLiveBindings, interop } = this.outputOptions; const reexportSpecifiers = new Map(); @@ -1367,10 +1350,12 @@ export default class Chunk { } function getChunkNameFromModule(module: Module): string { + return getPredefinedChunkNameFromModule(module) ?? getAliasName(module.id); +} + +function getPredefinedChunkNameFromModule(module: Module): string { return ( - module.chunkNames.find(({ isUserDefined }) => isUserDefined)?.name ?? - module.chunkNames[0]?.name ?? - getAliasName(module.id) + module.chunkNames.find(({ isUserDefined }) => isUserDefined)?.name ?? module.chunkNames[0]?.name ); } diff --git a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_config.js b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_config.js index d4f28578cf8..45c40e15b67 100644 --- a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_config.js +++ b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_config.js @@ -4,7 +4,7 @@ module.exports = { strictDeprecations: false, input: 'src/main.ts', output: { - entryFileNames: 'entry-[name]-[format]-[ext][extname].js' + entryFileNames: '[name]-[format]-[hash].js' }, preserveModules: true }, diff --git a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/amd/entry-main-amd-ts.ts.js b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/amd/entry-main-amd-ts.ts.js deleted file mode 100644 index f460ae667f8..00000000000 --- a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/amd/entry-main-amd-ts.ts.js +++ /dev/null @@ -1,12 +0,0 @@ -define(['exports', './entry-foo-amd-ts.ts', './nested/entry-bar-amd-ts.ts', './nested/entry-baz-amd-ts.ts', './entry-no-ext-amd-'], (function (exports, foo, bar, baz, noExt) { 'use strict'; - - - - exports.foo = foo; - exports.bar = bar; - exports.baz = baz; - exports.noExt = noExt; - - Object.defineProperty(exports, '__esModule', { value: true }); - -})); diff --git a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/amd/entry-foo-amd-ts.ts.js b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/amd/foo-amd-0f9dc16c.js similarity index 100% rename from test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/amd/entry-foo-amd-ts.ts.js rename to test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/amd/foo-amd-0f9dc16c.js diff --git a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/amd/main-amd-2ef83a76.js b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/amd/main-amd-2ef83a76.js new file mode 100644 index 00000000000..ea7055ed7f0 --- /dev/null +++ b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/amd/main-amd-2ef83a76.js @@ -0,0 +1,12 @@ +define(['exports', './foo-amd-0f9dc16c', './nested/bar-amd-f038b10c', './nested/baz-amd-d3de4cc0', './no-ext-amd-9d2c6ef6'], (function (exports, foo, bar, baz, noExt) { 'use strict'; + + + + exports.foo = foo; + exports.bar = bar; + exports.baz = baz; + exports.noExt = noExt; + + Object.defineProperty(exports, '__esModule', { value: true }); + +})); diff --git a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/amd/nested/entry-bar-amd-ts.ts.js b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/amd/nested/bar-amd-f038b10c.js similarity index 100% rename from test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/amd/nested/entry-bar-amd-ts.ts.js rename to test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/amd/nested/bar-amd-f038b10c.js diff --git a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/amd/nested/entry-baz-amd-ts.ts.js b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/amd/nested/baz-amd-d3de4cc0.js similarity index 100% rename from test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/amd/nested/entry-baz-amd-ts.ts.js rename to test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/amd/nested/baz-amd-d3de4cc0.js diff --git a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/amd/entry-no-ext-amd-.js b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/amd/no-ext-amd-9d2c6ef6.js similarity index 100% rename from test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/amd/entry-no-ext-amd-.js rename to test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/amd/no-ext-amd-9d2c6ef6.js diff --git a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/cjs/entry-main-cjs-ts.ts.js b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/cjs/entry-main-cjs-ts.ts.js deleted file mode 100644 index aff83e1b5d2..00000000000 --- a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/cjs/entry-main-cjs-ts.ts.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var foo = require('./entry-foo-cjs-ts.ts.js'); -var bar = require('./nested/entry-bar-cjs-ts.ts.js'); -var baz = require('./nested/entry-baz-cjs-ts.ts.js'); -var noExt = require('./entry-no-ext-cjs-.js'); - - - -exports.foo = foo; -exports.bar = bar; -exports.baz = baz; -exports.noExt = noExt; diff --git a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/cjs/entry-foo-cjs-ts.ts.js b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/cjs/foo-cjs-0d5774b5.js similarity index 100% rename from test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/cjs/entry-foo-cjs-ts.ts.js rename to test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/cjs/foo-cjs-0d5774b5.js diff --git a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/cjs/main-cjs-82d6d41f.js b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/cjs/main-cjs-82d6d41f.js new file mode 100644 index 00000000000..b2e54b9afe2 --- /dev/null +++ b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/cjs/main-cjs-82d6d41f.js @@ -0,0 +1,15 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var foo = require('./foo-cjs-0d5774b5.js'); +var bar = require('./nested/bar-cjs-abedc91d.js'); +var baz = require('./nested/baz-cjs-4a9c02fc.js'); +var noExt = require('./no-ext-cjs-500f8f81.js'); + + + +exports.foo = foo; +exports.bar = bar; +exports.baz = baz; +exports.noExt = noExt; diff --git a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/cjs/nested/entry-bar-cjs-ts.ts.js b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/cjs/nested/bar-cjs-abedc91d.js similarity index 100% rename from test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/cjs/nested/entry-bar-cjs-ts.ts.js rename to test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/cjs/nested/bar-cjs-abedc91d.js diff --git a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/cjs/nested/entry-baz-cjs-ts.ts.js b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/cjs/nested/baz-cjs-4a9c02fc.js similarity index 100% rename from test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/cjs/nested/entry-baz-cjs-ts.ts.js rename to test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/cjs/nested/baz-cjs-4a9c02fc.js diff --git a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/cjs/entry-no-ext-cjs-.js b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/cjs/no-ext-cjs-500f8f81.js similarity index 100% rename from test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/cjs/entry-no-ext-cjs-.js rename to test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/cjs/no-ext-cjs-500f8f81.js diff --git a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/es/entry-main-es-ts.ts.js b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/es/entry-main-es-ts.ts.js deleted file mode 100644 index 341e9d48d9b..00000000000 --- a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/es/entry-main-es-ts.ts.js +++ /dev/null @@ -1,4 +0,0 @@ -export { default as foo } from './entry-foo-es-ts.ts.js'; -export { default as bar } from './nested/entry-bar-es-ts.ts.js'; -export { default as baz } from './nested/entry-baz-es-ts.ts.js'; -export { default as noExt } from './entry-no-ext-es-.js'; diff --git a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/es/entry-foo-es-ts.ts.js b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/es/foo-es-3585f3eb.js similarity index 100% rename from test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/es/entry-foo-es-ts.ts.js rename to test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/es/foo-es-3585f3eb.js diff --git a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/es/main-es-2d953d94.js b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/es/main-es-2d953d94.js new file mode 100644 index 00000000000..dcc851a2a25 --- /dev/null +++ b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/es/main-es-2d953d94.js @@ -0,0 +1,4 @@ +export { default as foo } from './foo-es-3585f3eb.js'; +export { default as bar } from './nested/bar-es-bd5e2ae1.js'; +export { default as baz } from './nested/baz-es-a913ab4d.js'; +export { default as noExt } from './no-ext-es-1f34b6e8.js'; diff --git a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/es/nested/entry-bar-es-ts.ts.js b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/es/nested/bar-es-bd5e2ae1.js similarity index 100% rename from test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/es/nested/entry-bar-es-ts.ts.js rename to test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/es/nested/bar-es-bd5e2ae1.js diff --git a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/es/nested/entry-baz-es-ts.ts.js b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/es/nested/baz-es-a913ab4d.js similarity index 100% rename from test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/es/nested/entry-baz-es-ts.ts.js rename to test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/es/nested/baz-es-a913ab4d.js diff --git a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/es/entry-no-ext-es-.js b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/es/no-ext-es-1f34b6e8.js similarity index 100% rename from test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/es/entry-no-ext-es-.js rename to test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/es/no-ext-es-1f34b6e8.js diff --git a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/system/entry-foo-system-ts.ts.js b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/system/foo-system-0e2d8e48.js similarity index 100% rename from test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/system/entry-foo-system-ts.ts.js rename to test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/system/foo-system-0e2d8e48.js diff --git a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/system/entry-main-system-ts.ts.js b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/system/main-system-918bfec4.js similarity index 65% rename from test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/system/entry-main-system-ts.ts.js rename to test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/system/main-system-918bfec4.js index cc19e2eedd3..1c99e504a4c 100644 --- a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/system/entry-main-system-ts.ts.js +++ b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/system/main-system-918bfec4.js @@ -1,4 +1,4 @@ -System.register(['./entry-foo-system-ts.ts.js', './nested/entry-bar-system-ts.ts.js', './nested/entry-baz-system-ts.ts.js', './entry-no-ext-system-.js'], (function (exports) { +System.register(['./foo-system-0e2d8e48.js', './nested/bar-system-a72f6c95.js', './nested/baz-system-71d114fd.js', './no-ext-system-0cf938a8.js'], (function (exports) { 'use strict'; return { setters: [function (module) { diff --git a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/system/nested/entry-bar-system-ts.ts.js b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/system/nested/bar-system-a72f6c95.js similarity index 100% rename from test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/system/nested/entry-bar-system-ts.ts.js rename to test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/system/nested/bar-system-a72f6c95.js diff --git a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/system/nested/entry-baz-system-ts.ts.js b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/system/nested/baz-system-71d114fd.js similarity index 100% rename from test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/system/nested/entry-baz-system-ts.ts.js rename to test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/system/nested/baz-system-71d114fd.js diff --git a/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/system/entry-no-ext-system-.js b/test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/system/no-ext-system-0cf938a8.js similarity index 100% rename from test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/system/entry-no-ext-system-.js rename to test/chunking-form/samples/deprecated/preserve-modules-filename-pattern/_expected/system/no-ext-system-0cf938a8.js diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_config.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_config.js index e74a2e8730f..5de2e9f675e 100644 --- a/test/chunking-form/samples/preserve-modules-filename-pattern/_config.js +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_config.js @@ -1,11 +1,28 @@ +const assert = require('assert'); const path = require('path'); +const expectedNames = new Set([ + 'nested/a', + 'b.str', + 'c', + 'd', + 'e', + 'f', + 'g', + 'h', + 'main', + 'no-ext' +]); + module.exports = { description: 'entryFileNames pattern supported in combination with preserveModules', options: { - input: 'src/main.ts', + input: 'src/main.js', output: { - entryFileNames: 'entry-[name]-[format]-[ext][extname][assetExtname].js', + entryFileNames({ name }) { + assert.ok(expectedNames.has(name), `Unexpected name ${name}.`); + return '[name]-[format]-[hash].js'; + }, preserveModules: true }, plugins: [ diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/b.str-amd-f73e15b9.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/b.str-amd-f73e15b9.js new file mode 100644 index 00000000000..a2cb4560512 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/b.str-amd-f73e15b9.js @@ -0,0 +1,7 @@ +define((function () { 'use strict'; + + var b = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; + + return b; + +})); diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/entry-foo-amd-ts.ts.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/c-amd-c1bed163.js similarity index 61% rename from test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/entry-foo-amd-ts.ts.js rename to test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/c-amd-c1bed163.js index 69228f8fb6e..ecde41797bb 100644 --- a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/entry-foo-amd-ts.ts.js +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/c-amd-c1bed163.js @@ -1,7 +1,7 @@ define((function () { 'use strict'; - var foo = 42; + var c = 42; - return foo; + return c; })); diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/nested/entry-bar-amd-ts.ts.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/d-amd-f5c92c04.js similarity index 56% rename from test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/nested/entry-bar-amd-ts.ts.js rename to test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/d-amd-f5c92c04.js index 55e47d04b6d..31034cc71fa 100644 --- a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/nested/entry-bar-amd-ts.ts.js +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/d-amd-f5c92c04.js @@ -1,7 +1,7 @@ define((function () { 'use strict'; - var bar = 'banana'; + var d = 42; - return bar; + return d; })); diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/nested/entry-baz-amd-ts.ts.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/e-amd-f393b98d.js similarity index 55% rename from test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/nested/entry-baz-amd-ts.ts.js rename to test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/e-amd-f393b98d.js index 518b69f5506..48384a4d534 100644 --- a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/nested/entry-baz-amd-ts.ts.js +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/e-amd-f393b98d.js @@ -1,7 +1,7 @@ define((function () { 'use strict'; - var baz = 'whatever'; + var e = 42; - return baz; + return e; })); diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/entry-lorem-amd-str.str.str.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/entry-lorem-amd-str.str.str.js deleted file mode 100644 index 82deb072ec3..00000000000 --- a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/entry-lorem-amd-str.str.str.js +++ /dev/null @@ -1,7 +0,0 @@ -define((function () { 'use strict'; - - var lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; - - return lorem; - -})); diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/entry-main-amd-ts.ts.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/entry-main-amd-ts.ts.js deleted file mode 100644 index 60fd91d3766..00000000000 --- a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/entry-main-amd-ts.ts.js +++ /dev/null @@ -1,13 +0,0 @@ -define(['exports', './entry-foo-amd-ts.ts', './nested/entry-bar-amd-ts.ts', './nested/entry-baz-amd-ts.ts', './entry-lorem-amd-str.str.str', './entry-no-ext-amd-'], (function (exports, foo, bar, baz, lorem, noExt) { 'use strict'; - - - - exports.foo = foo; - exports.bar = bar; - exports.baz = baz; - exports.lorem = lorem; - exports.noExt = noExt; - - Object.defineProperty(exports, '__esModule', { value: true }); - -})); diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/f-amd-df81ac71.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/f-amd-df81ac71.js new file mode 100644 index 00000000000..40a885c45dd --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/f-amd-df81ac71.js @@ -0,0 +1,7 @@ +define((function () { 'use strict'; + + var f = 42; + + return f; + +})); diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/g-amd-1f750b5c.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/g-amd-1f750b5c.js new file mode 100644 index 00000000000..0b90b0dd1e2 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/g-amd-1f750b5c.js @@ -0,0 +1,7 @@ +define((function () { 'use strict'; + + var g = 42; + + return g; + +})); diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/h-amd-a60c0f22.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/h-amd-a60c0f22.js new file mode 100644 index 00000000000..6c3c1958ff7 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/h-amd-a60c0f22.js @@ -0,0 +1,7 @@ +define((function () { 'use strict'; + + var h = 42; + + return h; + +})); diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/main-amd-51321eb1.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/main-amd-51321eb1.js new file mode 100644 index 00000000000..c9c83013097 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/main-amd-51321eb1.js @@ -0,0 +1,17 @@ +define(['exports', './nested/a-amd-5dc7856c', './b.str-amd-f73e15b9', './c-amd-c1bed163', './d-amd-f5c92c04', './e-amd-f393b98d', './f-amd-df81ac71', './g-amd-1f750b5c', './h-amd-a60c0f22', './no-ext-amd-9d2c6ef6'], (function (exports, a, b, c, d, e, f, g, h, noExt) { 'use strict'; + + + + exports.a = a; + exports.b = b; + exports.c = c; + exports.d = d; + exports.e = e; + exports.f = f; + exports.g = g; + exports.h = h; + exports.x = noExt; + + Object.defineProperty(exports, '__esModule', { value: true }); + +})); diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/nested/a-amd-5dc7856c.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/nested/a-amd-5dc7856c.js new file mode 100644 index 00000000000..b71fcc65956 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/nested/a-amd-5dc7856c.js @@ -0,0 +1,7 @@ +define((function () { 'use strict'; + + var a = 'banana'; + + return a; + +})); diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/entry-no-ext-amd-.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/no-ext-amd-9d2c6ef6.js similarity index 100% rename from test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/entry-no-ext-amd-.js rename to test/chunking-form/samples/preserve-modules-filename-pattern/_expected/amd/no-ext-amd-9d2c6ef6.js diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/b.str-cjs-6703f3b2.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/b.str-cjs-6703f3b2.js new file mode 100644 index 00000000000..d10c6f206a8 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/b.str-cjs-6703f3b2.js @@ -0,0 +1,5 @@ +'use strict'; + +var b = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; + +module.exports = b; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/c-cjs-71ac0098.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/c-cjs-71ac0098.js new file mode 100644 index 00000000000..e420a593611 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/c-cjs-71ac0098.js @@ -0,0 +1,5 @@ +'use strict'; + +var c = 42; + +module.exports = c; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/d-cjs-9b009b8f.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/d-cjs-9b009b8f.js new file mode 100644 index 00000000000..ed89c1ca8fd --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/d-cjs-9b009b8f.js @@ -0,0 +1,5 @@ +'use strict'; + +var d = 42; + +module.exports = d; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/e-cjs-831dad1f.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/e-cjs-831dad1f.js new file mode 100644 index 00000000000..3f277409ebd --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/e-cjs-831dad1f.js @@ -0,0 +1,5 @@ +'use strict'; + +var e = 42; + +module.exports = e; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/entry-foo-cjs-ts.ts.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/entry-foo-cjs-ts.ts.js deleted file mode 100644 index 476c8ac92d3..00000000000 --- a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/entry-foo-cjs-ts.ts.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -var foo = 42; - -module.exports = foo; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/entry-lorem-cjs-str.str.str.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/entry-lorem-cjs-str.str.str.js deleted file mode 100644 index aa3ea036c2f..00000000000 --- a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/entry-lorem-cjs-str.str.str.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -var lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; - -module.exports = lorem; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/entry-main-cjs-ts.ts.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/entry-main-cjs-ts.ts.js deleted file mode 100644 index 6dfba9b24b8..00000000000 --- a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/entry-main-cjs-ts.ts.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var foo = require('./entry-foo-cjs-ts.ts.js'); -var bar = require('./nested/entry-bar-cjs-ts.ts.js'); -var baz = require('./nested/entry-baz-cjs-ts.ts.js'); -var lorem = require('./entry-lorem-cjs-str.str.str.js'); -var noExt = require('./entry-no-ext-cjs-.js'); - - - -exports.foo = foo; -exports.bar = bar; -exports.baz = baz; -exports.lorem = lorem; -exports.noExt = noExt; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/f-cjs-39905a99.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/f-cjs-39905a99.js new file mode 100644 index 00000000000..ea9880943de --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/f-cjs-39905a99.js @@ -0,0 +1,5 @@ +'use strict'; + +var f = 42; + +module.exports = f; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/g-cjs-3328e22b.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/g-cjs-3328e22b.js new file mode 100644 index 00000000000..c4db5bc9fb5 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/g-cjs-3328e22b.js @@ -0,0 +1,5 @@ +'use strict'; + +var g = 42; + +module.exports = g; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/h-cjs-d8541d4b.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/h-cjs-d8541d4b.js new file mode 100644 index 00000000000..3b130d05726 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/h-cjs-d8541d4b.js @@ -0,0 +1,5 @@ +'use strict'; + +var h = 42; + +module.exports = h; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/main-cjs-92cd000c.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/main-cjs-92cd000c.js new file mode 100644 index 00000000000..b1dea40f98f --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/main-cjs-92cd000c.js @@ -0,0 +1,25 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var a = require('./nested/a-cjs-80f9b8c3.js'); +var b = require('./b.str-cjs-6703f3b2.js'); +var c = require('./c-cjs-71ac0098.js'); +var d = require('./d-cjs-9b009b8f.js'); +var e = require('./e-cjs-831dad1f.js'); +var f = require('./f-cjs-39905a99.js'); +var g = require('./g-cjs-3328e22b.js'); +var h = require('./h-cjs-d8541d4b.js'); +var noExt = require('./no-ext-cjs-500f8f81.js'); + + + +exports.a = a; +exports.b = b; +exports.c = c; +exports.d = d; +exports.e = e; +exports.f = f; +exports.g = g; +exports.h = h; +exports.x = noExt; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/nested/a-cjs-80f9b8c3.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/nested/a-cjs-80f9b8c3.js new file mode 100644 index 00000000000..30baa93901a --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/nested/a-cjs-80f9b8c3.js @@ -0,0 +1,5 @@ +'use strict'; + +var a = 'banana'; + +module.exports = a; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/nested/entry-bar-cjs-ts.ts.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/nested/entry-bar-cjs-ts.ts.js deleted file mode 100644 index f8f56e6fc51..00000000000 --- a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/nested/entry-bar-cjs-ts.ts.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -var bar = 'banana'; - -module.exports = bar; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/nested/entry-baz-cjs-ts.ts.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/nested/entry-baz-cjs-ts.ts.js deleted file mode 100644 index 0ba506ad3eb..00000000000 --- a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/nested/entry-baz-cjs-ts.ts.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -var baz = 'whatever'; - -module.exports = baz; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/entry-no-ext-cjs-.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/no-ext-cjs-500f8f81.js similarity index 100% rename from test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/entry-no-ext-cjs-.js rename to test/chunking-form/samples/preserve-modules-filename-pattern/_expected/cjs/no-ext-cjs-500f8f81.js diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/b.str-es-3ce883b1.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/b.str-es-3ce883b1.js new file mode 100644 index 00000000000..1242cee6cd0 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/b.str-es-3ce883b1.js @@ -0,0 +1,3 @@ +var b = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; + +export { b as default }; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/c-es-7b7256f9.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/c-es-7b7256f9.js new file mode 100644 index 00000000000..e863eed1725 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/c-es-7b7256f9.js @@ -0,0 +1,3 @@ +var c = 42; + +export { c as default }; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/d-es-1616849c.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/d-es-1616849c.js new file mode 100644 index 00000000000..7195f9fc80f --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/d-es-1616849c.js @@ -0,0 +1,3 @@ +var d = 42; + +export { d as default }; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/e-es-e18089fa.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/e-es-e18089fa.js new file mode 100644 index 00000000000..b1d1efc9f45 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/e-es-e18089fa.js @@ -0,0 +1,3 @@ +var e = 42; + +export { e as default }; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/entry-foo-es-ts.ts.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/entry-foo-es-ts.ts.js deleted file mode 100644 index 2685886fe7a..00000000000 --- a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/entry-foo-es-ts.ts.js +++ /dev/null @@ -1,3 +0,0 @@ -var foo = 42; - -export { foo as default }; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/entry-lorem-es-str.str.str.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/entry-lorem-es-str.str.str.js deleted file mode 100644 index 20a4e34f1ea..00000000000 --- a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/entry-lorem-es-str.str.str.js +++ /dev/null @@ -1,3 +0,0 @@ -var lorem = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; - -export { lorem as default }; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/entry-main-es-ts.ts.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/entry-main-es-ts.ts.js deleted file mode 100644 index 0112c707f28..00000000000 --- a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/entry-main-es-ts.ts.js +++ /dev/null @@ -1,5 +0,0 @@ -export { default as foo } from './entry-foo-es-ts.ts.js'; -export { default as bar } from './nested/entry-bar-es-ts.ts.js'; -export { default as baz } from './nested/entry-baz-es-ts.ts.js'; -export { default as lorem } from './entry-lorem-es-str.str.str.js'; -export { default as noExt } from './entry-no-ext-es-.js'; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/f-es-c1646e12.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/f-es-c1646e12.js new file mode 100644 index 00000000000..82ad55c5fd6 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/f-es-c1646e12.js @@ -0,0 +1,3 @@ +var f = 42; + +export { f as default }; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/g-es-968f87d2.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/g-es-968f87d2.js new file mode 100644 index 00000000000..78334adafcd --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/g-es-968f87d2.js @@ -0,0 +1,3 @@ +var g = 42; + +export { g as default }; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/h-es-05491bfa.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/h-es-05491bfa.js new file mode 100644 index 00000000000..8bbc4352412 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/h-es-05491bfa.js @@ -0,0 +1,3 @@ +var h = 42; + +export { h as default }; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/main-es-a7c9a9b3.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/main-es-a7c9a9b3.js new file mode 100644 index 00000000000..bea0b84c6a0 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/main-es-a7c9a9b3.js @@ -0,0 +1,9 @@ +export { default as a } from './nested/a-es-125ea65c.js'; +export { default as b } from './b.str-es-3ce883b1.js'; +export { default as c } from './c-es-7b7256f9.js'; +export { default as d } from './d-es-1616849c.js'; +export { default as e } from './e-es-e18089fa.js'; +export { default as f } from './f-es-c1646e12.js'; +export { default as g } from './g-es-968f87d2.js'; +export { default as h } from './h-es-05491bfa.js'; +export { default as x } from './no-ext-es-1f34b6e8.js'; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/nested/a-es-125ea65c.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/nested/a-es-125ea65c.js new file mode 100644 index 00000000000..9767dacb2ec --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/nested/a-es-125ea65c.js @@ -0,0 +1,3 @@ +var a = 'banana'; + +export { a as default }; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/nested/entry-bar-es-ts.ts.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/nested/entry-bar-es-ts.ts.js deleted file mode 100644 index f383a373551..00000000000 --- a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/nested/entry-bar-es-ts.ts.js +++ /dev/null @@ -1,3 +0,0 @@ -var bar = 'banana'; - -export { bar as default }; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/nested/entry-baz-es-ts.ts.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/nested/entry-baz-es-ts.ts.js deleted file mode 100644 index 11a48a575ed..00000000000 --- a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/nested/entry-baz-es-ts.ts.js +++ /dev/null @@ -1,3 +0,0 @@ -var baz = 'whatever'; - -export { baz as default }; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/entry-no-ext-es-.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/no-ext-es-1f34b6e8.js similarity index 100% rename from test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/entry-no-ext-es-.js rename to test/chunking-form/samples/preserve-modules-filename-pattern/_expected/es/no-ext-es-1f34b6e8.js diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/b.str-system-2fa3160e.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/b.str-system-2fa3160e.js new file mode 100644 index 00000000000..615d1df3511 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/b.str-system-2fa3160e.js @@ -0,0 +1,10 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + var b = exports('default', "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."); + + }) + }; +})); diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/entry-foo-system-ts.ts.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/c-system-9442eacd.js similarity index 74% rename from test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/entry-foo-system-ts.ts.js rename to test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/c-system-9442eacd.js index 98793de8971..dfdf34cdbb8 100644 --- a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/entry-foo-system-ts.ts.js +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/c-system-9442eacd.js @@ -3,7 +3,7 @@ System.register([], (function (exports) { return { execute: (function () { - var foo = exports('default', 42); + var c = exports('default', 42); }) }; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/nested/entry-bar-system-ts.ts.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/d-system-1a05eeda.js similarity index 71% rename from test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/nested/entry-bar-system-ts.ts.js rename to test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/d-system-1a05eeda.js index 21575fdff4d..da761a34c60 100644 --- a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/nested/entry-bar-system-ts.ts.js +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/d-system-1a05eeda.js @@ -3,7 +3,7 @@ System.register([], (function (exports) { return { execute: (function () { - var bar = exports('default', 'banana'); + var d = exports('default', 42); }) }; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/nested/entry-baz-system-ts.ts.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/e-system-f73caf6a.js similarity index 70% rename from test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/nested/entry-baz-system-ts.ts.js rename to test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/e-system-f73caf6a.js index 54bd1e94e5a..7b306d41425 100644 --- a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/nested/entry-baz-system-ts.ts.js +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/e-system-f73caf6a.js @@ -3,7 +3,7 @@ System.register([], (function (exports) { return { execute: (function () { - var baz = exports('default', 'whatever'); + var e = exports('default', 42); }) }; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/entry-lorem-system-str.str.str.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/entry-lorem-system-str.str.str.js deleted file mode 100644 index 4138e51e240..00000000000 --- a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/entry-lorem-system-str.str.str.js +++ /dev/null @@ -1,10 +0,0 @@ -System.register([], (function (exports) { - 'use strict'; - return { - execute: (function () { - - var lorem = exports('default', "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."); - - }) - }; -})); diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/entry-main-system-ts.ts.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/entry-main-system-ts.ts.js deleted file mode 100644 index da12f8cc61b..00000000000 --- a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/entry-main-system-ts.ts.js +++ /dev/null @@ -1,21 +0,0 @@ -System.register(['./entry-foo-system-ts.ts.js', './nested/entry-bar-system-ts.ts.js', './nested/entry-baz-system-ts.ts.js', './entry-lorem-system-str.str.str.js', './entry-no-ext-system-.js'], (function (exports) { - 'use strict'; - return { - setters: [function (module) { - exports('foo', module["default"]); - }, function (module) { - exports('bar', module["default"]); - }, function (module) { - exports('baz', module["default"]); - }, function (module) { - exports('lorem', module["default"]); - }, function (module) { - exports('noExt', module["default"]); - }], - execute: (function () { - - - - }) - }; -})); diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/f-system-b3b06e3f.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/f-system-b3b06e3f.js new file mode 100644 index 00000000000..5a7d4ab14f3 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/f-system-b3b06e3f.js @@ -0,0 +1,10 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + var f = exports('default', 42); + + }) + }; +})); diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/g-system-9b3ad652.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/g-system-9b3ad652.js new file mode 100644 index 00000000000..9ec3a247f55 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/g-system-9b3ad652.js @@ -0,0 +1,10 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + var g = exports('default', 42); + + }) + }; +})); diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/h-system-6c6b48ca.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/h-system-6c6b48ca.js new file mode 100644 index 00000000000..af2349ee90d --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/h-system-6c6b48ca.js @@ -0,0 +1,10 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + var h = exports('default', 42); + + }) + }; +})); diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/main-system-7593b73c.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/main-system-7593b73c.js new file mode 100644 index 00000000000..b6796911382 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/main-system-7593b73c.js @@ -0,0 +1,29 @@ +System.register(['./nested/a-system-db94ffc0.js', './b.str-system-2fa3160e.js', './c-system-9442eacd.js', './d-system-1a05eeda.js', './e-system-f73caf6a.js', './f-system-b3b06e3f.js', './g-system-9b3ad652.js', './h-system-6c6b48ca.js', './no-ext-system-0cf938a8.js'], (function (exports) { + 'use strict'; + return { + setters: [function (module) { + exports('a', module["default"]); + }, function (module) { + exports('b', module["default"]); + }, function (module) { + exports('c', module["default"]); + }, function (module) { + exports('d', module["default"]); + }, function (module) { + exports('e', module["default"]); + }, function (module) { + exports('f', module["default"]); + }, function (module) { + exports('g', module["default"]); + }, function (module) { + exports('h', module["default"]); + }, function (module) { + exports('x', module["default"]); + }], + execute: (function () { + + + + }) + }; +})); diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/nested/a-system-db94ffc0.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/nested/a-system-db94ffc0.js new file mode 100644 index 00000000000..2ddc122e9bc --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/nested/a-system-db94ffc0.js @@ -0,0 +1,10 @@ +System.register([], (function (exports) { + 'use strict'; + return { + execute: (function () { + + var a = exports('default', 'banana'); + + }) + }; +})); diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/entry-no-ext-system-.js b/test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/no-ext-system-0cf938a8.js similarity index 100% rename from test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/entry-no-ext-system-.js rename to test/chunking-form/samples/preserve-modules-filename-pattern/_expected/system/no-ext-system-0cf938a8.js diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/src/lorem.str b/test/chunking-form/samples/preserve-modules-filename-pattern/src/b.str similarity index 100% rename from test/chunking-form/samples/preserve-modules-filename-pattern/src/lorem.str rename to test/chunking-form/samples/preserve-modules-filename-pattern/src/b.str diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/src/foo.ts b/test/chunking-form/samples/preserve-modules-filename-pattern/src/c.mjs similarity index 100% rename from test/chunking-form/samples/preserve-modules-filename-pattern/src/foo.ts rename to test/chunking-form/samples/preserve-modules-filename-pattern/src/c.mjs diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/src/d.cjs b/test/chunking-form/samples/preserve-modules-filename-pattern/src/d.cjs new file mode 100644 index 00000000000..7a4e8a723a4 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/src/d.cjs @@ -0,0 +1 @@ +export default 42; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/src/e.jsx b/test/chunking-form/samples/preserve-modules-filename-pattern/src/e.jsx new file mode 100644 index 00000000000..7a4e8a723a4 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/src/e.jsx @@ -0,0 +1 @@ +export default 42; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/src/f.mts b/test/chunking-form/samples/preserve-modules-filename-pattern/src/f.mts new file mode 100644 index 00000000000..7a4e8a723a4 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/src/f.mts @@ -0,0 +1 @@ +export default 42; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/src/g.cts b/test/chunking-form/samples/preserve-modules-filename-pattern/src/g.cts new file mode 100644 index 00000000000..7a4e8a723a4 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/src/g.cts @@ -0,0 +1 @@ +export default 42; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/src/h.tsx b/test/chunking-form/samples/preserve-modules-filename-pattern/src/h.tsx new file mode 100644 index 00000000000..7a4e8a723a4 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/src/h.tsx @@ -0,0 +1 @@ +export default 42; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/src/main.js b/test/chunking-form/samples/preserve-modules-filename-pattern/src/main.js new file mode 100644 index 00000000000..6b8f2a64281 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-filename-pattern/src/main.js @@ -0,0 +1,9 @@ +export { default as a } from './nested/a.ts'; +export { default as b } from './b.str'; +export { default as c } from './c.mjs'; +export { default as d } from './d.cjs'; +export { default as e } from './e.jsx'; +export { default as f } from './f.mts'; +export { default as g } from './g.cts'; +export { default as h } from './h.tsx'; +export { default as x } from './no-ext'; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/src/main.ts b/test/chunking-form/samples/preserve-modules-filename-pattern/src/main.ts deleted file mode 100644 index 8822adfa953..00000000000 --- a/test/chunking-form/samples/preserve-modules-filename-pattern/src/main.ts +++ /dev/null @@ -1,10 +0,0 @@ -// @ts-ignore -export { default as foo } from './foo.ts'; -// @ts-ignore -export { default as bar } from './nested/bar.ts'; -// @ts-ignore -export { default as baz } from './nested/baz.ts'; -// @ts-ignore -export { default as lorem } from './lorem.str'; -// @ts-ignore -export { default as noExt } from './no-ext'; diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/src/nested/bar.ts b/test/chunking-form/samples/preserve-modules-filename-pattern/src/nested/a.ts similarity index 100% rename from test/chunking-form/samples/preserve-modules-filename-pattern/src/nested/bar.ts rename to test/chunking-form/samples/preserve-modules-filename-pattern/src/nested/a.ts diff --git a/test/chunking-form/samples/preserve-modules-filename-pattern/src/nested/baz.ts b/test/chunking-form/samples/preserve-modules-filename-pattern/src/nested/baz.ts deleted file mode 100644 index 6d70feca8ec..00000000000 --- a/test/chunking-form/samples/preserve-modules-filename-pattern/src/nested/baz.ts +++ /dev/null @@ -1 +0,0 @@ -export default 'whatever'; diff --git a/test/chunking-form/samples/preserve-modules-special-chunk-names/_config.js b/test/chunking-form/samples/preserve-modules-special-chunk-names/_config.js new file mode 100644 index 00000000000..9d8de66ce06 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-special-chunk-names/_config.js @@ -0,0 +1,18 @@ +const path = require('path'); + +module.exports = { + description: 'Supports chunk names from config when preserving modules', + options: { + input: { 'main-entry': 'main.js' }, + output: { + preserveModules: true + }, + plugins: [ + { + buildStart() { + this.emitFile({ type: 'chunk', id: path.join(__dirname, 'b.js'), name: 'emitted' }); + } + } + ] + } +}; diff --git a/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/amd/a.js b/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/amd/a.js new file mode 100644 index 00000000000..6d0638c63e4 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/amd/a.js @@ -0,0 +1,5 @@ +define((function () { 'use strict'; + + console.log('a'); + +})); diff --git a/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/amd/emitted.js b/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/amd/emitted.js new file mode 100644 index 00000000000..b8ffc59b2da --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/amd/emitted.js @@ -0,0 +1,5 @@ +define((function () { 'use strict'; + + console.log('b'); + +})); diff --git a/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/amd/main-entry.js b/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/amd/main-entry.js new file mode 100644 index 00000000000..1ca395ac358 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/amd/main-entry.js @@ -0,0 +1,5 @@ +define(['./a'], (function (a) { 'use strict'; + + console.log('main'); + +})); diff --git a/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/cjs/a.js b/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/cjs/a.js new file mode 100644 index 00000000000..4151e09bdbf --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/cjs/a.js @@ -0,0 +1,3 @@ +'use strict'; + +console.log('a'); diff --git a/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/cjs/emitted.js b/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/cjs/emitted.js new file mode 100644 index 00000000000..099afa3ff4c --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/cjs/emitted.js @@ -0,0 +1,3 @@ +'use strict'; + +console.log('b'); diff --git a/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/cjs/main-entry.js b/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/cjs/main-entry.js new file mode 100644 index 00000000000..51fbee028ad --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/cjs/main-entry.js @@ -0,0 +1,5 @@ +'use strict'; + +require('./a.js'); + +console.log('main'); diff --git a/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/es/a.js b/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/es/a.js new file mode 100644 index 00000000000..8609d075540 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/es/a.js @@ -0,0 +1 @@ +console.log('a'); diff --git a/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/es/emitted.js b/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/es/emitted.js new file mode 100644 index 00000000000..eeb313a0347 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/es/emitted.js @@ -0,0 +1 @@ +console.log('b'); diff --git a/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/es/main-entry.js b/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/es/main-entry.js new file mode 100644 index 00000000000..8874885af3b --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/es/main-entry.js @@ -0,0 +1,3 @@ +import './a.js'; + +console.log('main'); diff --git a/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/system/a.js b/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/system/a.js new file mode 100644 index 00000000000..2859a1e855c --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/system/a.js @@ -0,0 +1,10 @@ +System.register([], (function () { + 'use strict'; + return { + execute: (function () { + + console.log('a'); + + }) + }; +})); diff --git a/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/system/emitted.js b/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/system/emitted.js new file mode 100644 index 00000000000..17b43387a91 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/system/emitted.js @@ -0,0 +1,10 @@ +System.register([], (function () { + 'use strict'; + return { + execute: (function () { + + console.log('b'); + + }) + }; +})); diff --git a/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/system/main-entry.js b/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/system/main-entry.js new file mode 100644 index 00000000000..03c140fd25e --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-special-chunk-names/_expected/system/main-entry.js @@ -0,0 +1,11 @@ +System.register(['./a.js'], (function () { + 'use strict'; + return { + setters: [function () {}], + execute: (function () { + + console.log('main'); + + }) + }; +})); diff --git a/test/chunking-form/samples/preserve-modules-special-chunk-names/a.js b/test/chunking-form/samples/preserve-modules-special-chunk-names/a.js new file mode 100644 index 00000000000..8609d075540 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-special-chunk-names/a.js @@ -0,0 +1 @@ +console.log('a'); diff --git a/test/chunking-form/samples/preserve-modules-special-chunk-names/b.js b/test/chunking-form/samples/preserve-modules-special-chunk-names/b.js new file mode 100644 index 00000000000..eeb313a0347 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-special-chunk-names/b.js @@ -0,0 +1 @@ +console.log('b'); diff --git a/test/chunking-form/samples/preserve-modules-special-chunk-names/main.js b/test/chunking-form/samples/preserve-modules-special-chunk-names/main.js new file mode 100644 index 00000000000..0cf5c3a5a53 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-special-chunk-names/main.js @@ -0,0 +1,2 @@ +import './a.js'; +console.log('main'); diff --git a/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_config.js b/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_config.js index 7fb5e301d03..304bdc11300 100644 --- a/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_config.js +++ b/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_config.js @@ -5,7 +5,7 @@ module.exports = { input: 'main.js', output: { preserveModules: true, - entryFileNames: 'entry-[name]-[format]-[ext][extname][assetExtname].mjs' + entryFileNames: '[name]-[format]-[hash].mjs' }, plugins: [ { diff --git a/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/amd/_virtual/entry-_virtualModule-amd-.mjs b/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/amd/_virtual/_virtualModule-amd-4e388e40.mjs similarity index 100% rename from test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/amd/_virtual/entry-_virtualModule-amd-.mjs rename to test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/amd/_virtual/_virtualModule-amd-4e388e40.mjs diff --git a/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/amd/_virtual/entry-_virtualWithAssetExt-amd-str.str.str.mjs b/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/amd/_virtual/_virtualWithAssetExt.str-amd-4deed186.mjs similarity index 100% rename from test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/amd/_virtual/entry-_virtualWithAssetExt-amd-str.str.str.mjs rename to test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/amd/_virtual/_virtualWithAssetExt.str-amd-4deed186.mjs diff --git a/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/amd/_virtual/entry-_virtualWithExt-amd-js.js.mjs b/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/amd/_virtual/_virtualWithExt-amd-41e5e75e.mjs similarity index 100% rename from test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/amd/_virtual/entry-_virtualWithExt-amd-js.js.mjs rename to test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/amd/_virtual/_virtualWithExt-amd-41e5e75e.mjs diff --git a/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/amd/entry-main-amd-js.js.mjs b/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/amd/entry-main-amd-js.js.mjs deleted file mode 100644 index 27fc4a86228..00000000000 --- a/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/amd/entry-main-amd-js.js.mjs +++ /dev/null @@ -1,7 +0,0 @@ -define(['./_virtual/entry-_virtualModule-amd-.mjs', './_virtual/entry-_virtualWithExt-amd-js.js.mjs', './_virtual/entry-_virtualWithAssetExt-amd-str.str.str.mjs'], (function (_virtualModule, _virtualWithExt, _virtualWithAssetExt) { 'use strict'; - - assert.equal(_virtualModule.virtual, 'Virtual!'); - assert.equal(_virtualWithExt.virtual2, 'Virtual2!'); - assert.equal(_virtualWithAssetExt.virtual3, 'Virtual3!'); - -})); diff --git a/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/amd/main-amd-eb6187f3.mjs b/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/amd/main-amd-eb6187f3.mjs new file mode 100644 index 00000000000..8b67d09757f --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/amd/main-amd-eb6187f3.mjs @@ -0,0 +1,7 @@ +define(['./_virtual/_virtualModule-amd-4e388e40.mjs', './_virtual/_virtualWithExt-amd-41e5e75e.mjs', './_virtual/_virtualWithAssetExt.str-amd-4deed186.mjs'], (function (_virtualModule, _virtualWithExt, _virtualWithAssetExt) { 'use strict'; + + assert.equal(_virtualModule.virtual, 'Virtual!'); + assert.equal(_virtualWithExt.virtual2, 'Virtual2!'); + assert.equal(_virtualWithAssetExt.virtual3, 'Virtual3!'); + +})); diff --git a/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/cjs/_virtual/entry-_virtualModule-cjs-.mjs b/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/cjs/_virtual/_virtualModule-cjs-650c7f9a.mjs similarity index 100% rename from test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/cjs/_virtual/entry-_virtualModule-cjs-.mjs rename to test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/cjs/_virtual/_virtualModule-cjs-650c7f9a.mjs diff --git a/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/cjs/_virtual/entry-_virtualWithAssetExt-cjs-str.str.str.mjs b/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/cjs/_virtual/_virtualWithAssetExt.str-cjs-63fd96f4.mjs similarity index 100% rename from test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/cjs/_virtual/entry-_virtualWithAssetExt-cjs-str.str.str.mjs rename to test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/cjs/_virtual/_virtualWithAssetExt.str-cjs-63fd96f4.mjs diff --git a/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/cjs/_virtual/entry-_virtualWithExt-cjs-js.js.mjs b/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/cjs/_virtual/_virtualWithExt-cjs-c612470d.mjs similarity index 100% rename from test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/cjs/_virtual/entry-_virtualWithExt-cjs-js.js.mjs rename to test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/cjs/_virtual/_virtualWithExt-cjs-c612470d.mjs diff --git a/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/cjs/entry-main-cjs-js.js.mjs b/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/cjs/entry-main-cjs-js.js.mjs deleted file mode 100644 index fc2cfa868da..00000000000 --- a/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/cjs/entry-main-cjs-js.js.mjs +++ /dev/null @@ -1,9 +0,0 @@ -'use strict'; - -var _virtualModule = require('./_virtual/entry-_virtualModule-cjs-.mjs'); -var _virtualWithExt = require('./_virtual/entry-_virtualWithExt-cjs-js.js.mjs'); -var _virtualWithAssetExt = require('./_virtual/entry-_virtualWithAssetExt-cjs-str.str.str.mjs'); - -assert.equal(_virtualModule.virtual, 'Virtual!'); -assert.equal(_virtualWithExt.virtual2, 'Virtual2!'); -assert.equal(_virtualWithAssetExt.virtual3, 'Virtual3!'); diff --git a/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/cjs/main-cjs-d0c7e6cf.mjs b/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/cjs/main-cjs-d0c7e6cf.mjs new file mode 100644 index 00000000000..17c1d84ef96 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/cjs/main-cjs-d0c7e6cf.mjs @@ -0,0 +1,9 @@ +'use strict'; + +var _virtualModule = require('./_virtual/_virtualModule-cjs-650c7f9a.mjs'); +var _virtualWithExt = require('./_virtual/_virtualWithExt-cjs-c612470d.mjs'); +var _virtualWithAssetExt = require('./_virtual/_virtualWithAssetExt.str-cjs-63fd96f4.mjs'); + +assert.equal(_virtualModule.virtual, 'Virtual!'); +assert.equal(_virtualWithExt.virtual2, 'Virtual2!'); +assert.equal(_virtualWithAssetExt.virtual3, 'Virtual3!'); diff --git a/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/es/_virtual/entry-_virtualModule-es-.mjs b/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/es/_virtual/_virtualModule-es-22303f19.mjs similarity index 100% rename from test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/es/_virtual/entry-_virtualModule-es-.mjs rename to test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/es/_virtual/_virtualModule-es-22303f19.mjs diff --git a/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/es/_virtual/entry-_virtualWithAssetExt-es-str.str.str.mjs b/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/es/_virtual/_virtualWithAssetExt.str-es-07beb78c.mjs similarity index 100% rename from test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/es/_virtual/entry-_virtualWithAssetExt-es-str.str.str.mjs rename to test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/es/_virtual/_virtualWithAssetExt.str-es-07beb78c.mjs diff --git a/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/es/_virtual/entry-_virtualWithExt-es-js.js.mjs b/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/es/_virtual/_virtualWithExt-es-6330be37.mjs similarity index 100% rename from test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/es/_virtual/entry-_virtualWithExt-es-js.js.mjs rename to test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/es/_virtual/_virtualWithExt-es-6330be37.mjs diff --git a/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/es/entry-main-es-js.js.mjs b/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/es/entry-main-es-js.js.mjs deleted file mode 100644 index 4f449ad7730..00000000000 --- a/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/es/entry-main-es-js.js.mjs +++ /dev/null @@ -1,7 +0,0 @@ -import { virtual } from './_virtual/entry-_virtualModule-es-.mjs'; -import { virtual2 } from './_virtual/entry-_virtualWithExt-es-js.js.mjs'; -import { virtual3 } from './_virtual/entry-_virtualWithAssetExt-es-str.str.str.mjs'; - -assert.equal(virtual, 'Virtual!'); -assert.equal(virtual2, 'Virtual2!'); -assert.equal(virtual3, 'Virtual3!'); diff --git a/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/es/main-es-fd922f49.mjs b/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/es/main-es-fd922f49.mjs new file mode 100644 index 00000000000..b76ad5331d4 --- /dev/null +++ b/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/es/main-es-fd922f49.mjs @@ -0,0 +1,7 @@ +import { virtual } from './_virtual/_virtualModule-es-22303f19.mjs'; +import { virtual2 } from './_virtual/_virtualWithExt-es-6330be37.mjs'; +import { virtual3 } from './_virtual/_virtualWithAssetExt.str-es-07beb78c.mjs'; + +assert.equal(virtual, 'Virtual!'); +assert.equal(virtual2, 'Virtual2!'); +assert.equal(virtual3, 'Virtual3!'); diff --git a/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/system/_virtual/entry-_virtualModule-system-.mjs b/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/system/_virtual/_virtualModule-system-26bc5070.mjs similarity index 100% rename from test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/system/_virtual/entry-_virtualModule-system-.mjs rename to test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/system/_virtual/_virtualModule-system-26bc5070.mjs diff --git a/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/system/_virtual/entry-_virtualWithAssetExt-system-str.str.str.mjs b/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/system/_virtual/_virtualWithAssetExt.str-system-98927794.mjs similarity index 100% rename from test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/system/_virtual/entry-_virtualWithAssetExt-system-str.str.str.mjs rename to test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/system/_virtual/_virtualWithAssetExt.str-system-98927794.mjs diff --git a/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/system/_virtual/entry-_virtualWithExt-system-js.js.mjs b/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/system/_virtual/_virtualWithExt-system-11e583df.mjs similarity index 100% rename from test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/system/_virtual/entry-_virtualWithExt-system-js.js.mjs rename to test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/system/_virtual/_virtualWithExt-system-11e583df.mjs diff --git a/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/system/entry-main-system-js.js.mjs b/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/system/main-system-a8e7f87b.mjs similarity index 66% rename from test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/system/entry-main-system-js.js.mjs rename to test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/system/main-system-a8e7f87b.mjs index f9381cf4e12..0471f396998 100644 --- a/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/system/entry-main-system-js.js.mjs +++ b/test/chunking-form/samples/preserve-modules-virtual-modules-filename-pattern/_expected/system/main-system-a8e7f87b.mjs @@ -1,4 +1,4 @@ -System.register(['./_virtual/entry-_virtualModule-system-.mjs', './_virtual/entry-_virtualWithExt-system-js.js.mjs', './_virtual/entry-_virtualWithAssetExt-system-str.str.str.mjs'], (function () { +System.register(['./_virtual/_virtualModule-system-26bc5070.mjs', './_virtual/_virtualWithExt-system-11e583df.mjs', './_virtual/_virtualWithAssetExt.str-system-98927794.mjs'], (function () { 'use strict'; var virtual, virtual2, virtual3; return { diff --git a/test/misc/bundle-information.js b/test/misc/bundle-information.js index d003f5491ca..d950b235ac4 100644 --- a/test/misc/bundle-information.js +++ b/test/misc/bundle-information.js @@ -459,7 +459,6 @@ describe('The bundle object', () => { return rollup .rollup({ input: ['input', 'dynamic1'], - preserveModules: true, plugins: [ loader({ input: `import {other} from "other";console.log(other);Promise.all([import('dynamic1'), import('dynamic2')]).then(([{dynamic1}, {dynamic2}]) => console.log(dynamic1, dynamic2));`, @@ -474,7 +473,8 @@ describe('The bundle object', () => { format: 'es', dir: 'dist', entryFileNames: '[name].js', - chunkFileNames: 'generated-[name].js' + chunkFileNames: 'generated-[name].js', + preserveModules: true }) ) .then(({ output }) => { @@ -507,7 +507,7 @@ console.log(other);Promise.all([import('./dynamic1.js'), import('./dynamic2.js') ); assert.deepEqual( output.map(chunk => chunk.name), - ['input', 'dynamic1', 'dynamic2', 'other'], + ['_virtual/input', '_virtual/dynamic1', '_virtual/dynamic2', '_virtual/other'], 'name' ); assert.deepEqual(