From c6aa5752fca04b59add4bccf8055ddac5b511522 Mon Sep 17 00:00:00 2001 From: Mattias Ekstrand Date: Wed, 6 Sep 2023 07:26:58 +0200 Subject: [PATCH 01/10] =?UTF-8?q?Added=20option=20to=20name=20sourcemap=20?= =?UTF-8?q?files,=20i.e.=20a=20output.sourcemapFileName=E2=80=A6=20(#5105)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Added option to name sourcemap files, i.e. a output.sourcemapFileNames property * Added chunkhash placeholder to sourcemap names * Improve coverage --------- Co-authored-by: Lukas Taegert-Atkinson Co-authored-by: Lukas Taegert-Atkinson --- cli/help.md | 1 + docs/command-line-interface/index.md | 2 + docs/configuration-options/index.md | 16 +++++ docs/javascript-api/index.md | 1 + docs/repl/stores/options.ts | 22 ++++--- src/Chunk.ts | 38 ++++++++++- src/rollup/types.d.ts | 4 ++ src/utils/FileEmitter.ts | 1 + src/utils/options/mergeOptions.ts | 1 + src/utils/options/normalizeOutputOptions.ts | 12 ++++ src/utils/renderChunks.ts | 66 +++++++++++++++---- .../samples/render-chunk-transform/_config.js | 6 +- .../sourcemap-file-names-function/_config.js | 27 ++++++++ .../_expected/amd/dynamic-a0f7e361.js | 6 ++ .../amd/dynamic-eea0ce30202b-5ec8d44f.js.map | 1 + .../_expected/amd/dynamic-hashed-5ec8d44f.js | 6 ++ .../_expected/amd/dynamic.js.map | 1 + .../_expected/amd/main.js | 7 ++ .../_expected/amd/main.js.map | 1 + .../_expected/cjs/dynamic-03a87e17.js | 4 ++ .../cjs/dynamic-44faaace9dbc-e21b9079.js.map | 1 + .../_expected/cjs/dynamic-hashed-e21b9079.js | 4 ++ .../_expected/cjs/dynamic.js.map | 1 + .../_expected/cjs/main.js | 5 ++ .../_expected/cjs/main.js.map | 1 + .../es/dynamic-769057acb768-4b06902b.js.map | 1 + .../_expected/es/dynamic-c7ad594d.js | 2 + .../_expected/es/dynamic-hashed-4b06902b.js | 2 + .../_expected/es/dynamic.js.map | 1 + .../_expected/es/main.js | 3 + .../_expected/es/main.js.map | 1 + .../dynamic-883b8003cd49-c0b30ec8.js.map | 1 + .../_expected/system/dynamic-ef271780.js | 11 ++++ .../system/dynamic-hashed-c0b30ec8.js | 11 ++++ .../_expected/system/dynamic.js.map | 1 + .../_expected/system/main.js | 12 ++++ .../_expected/system/main.js.map | 1 + .../dynamic-hashed.js | 1 + .../sourcemap-file-names-function/dynamic.js | 1 + .../sourcemap-file-names-function/main.js | 2 + .../samples/sourcemap-file-names/_config.js | 22 +++++++ .../amd/main-543232e9-amd-af8f17da.js.map | 1 + .../_expected/amd/main-543232e9-amd.js | 6 ++ .../cjs/main-3fddaf82-cjs-c64b742b.js.map | 1 + .../_expected/cjs/main-3fddaf82-cjs.js | 4 ++ .../es/main-824894f4-es-dbab040a.js.map | 1 + .../_expected/es/main-824894f4-es.js | 2 + .../main-6186746c-system-bce3d2ab.js.map | 1 + .../_expected/system/main-6186746c-system.js | 11 ++++ .../samples/sourcemap-file-names/main.js | 1 + .../emit-file/prebuilt-chunk/_config.js | 2 + test/misc/optionList.js | 4 +- test/sourcemaps/index.js | 5 +- 53 files changed, 321 insertions(+), 26 deletions(-) create mode 100644 test/chunking-form/samples/sourcemap-file-names-function/_config.js create mode 100644 test/chunking-form/samples/sourcemap-file-names-function/_expected/amd/dynamic-a0f7e361.js create mode 100644 test/chunking-form/samples/sourcemap-file-names-function/_expected/amd/dynamic-eea0ce30202b-5ec8d44f.js.map create mode 100644 test/chunking-form/samples/sourcemap-file-names-function/_expected/amd/dynamic-hashed-5ec8d44f.js create mode 100644 test/chunking-form/samples/sourcemap-file-names-function/_expected/amd/dynamic.js.map create mode 100644 test/chunking-form/samples/sourcemap-file-names-function/_expected/amd/main.js create mode 100644 test/chunking-form/samples/sourcemap-file-names-function/_expected/amd/main.js.map create mode 100644 test/chunking-form/samples/sourcemap-file-names-function/_expected/cjs/dynamic-03a87e17.js create mode 100644 test/chunking-form/samples/sourcemap-file-names-function/_expected/cjs/dynamic-44faaace9dbc-e21b9079.js.map create mode 100644 test/chunking-form/samples/sourcemap-file-names-function/_expected/cjs/dynamic-hashed-e21b9079.js create mode 100644 test/chunking-form/samples/sourcemap-file-names-function/_expected/cjs/dynamic.js.map create mode 100644 test/chunking-form/samples/sourcemap-file-names-function/_expected/cjs/main.js create mode 100644 test/chunking-form/samples/sourcemap-file-names-function/_expected/cjs/main.js.map create mode 100644 test/chunking-form/samples/sourcemap-file-names-function/_expected/es/dynamic-769057acb768-4b06902b.js.map create mode 100644 test/chunking-form/samples/sourcemap-file-names-function/_expected/es/dynamic-c7ad594d.js create mode 100644 test/chunking-form/samples/sourcemap-file-names-function/_expected/es/dynamic-hashed-4b06902b.js create mode 100644 test/chunking-form/samples/sourcemap-file-names-function/_expected/es/dynamic.js.map create mode 100644 test/chunking-form/samples/sourcemap-file-names-function/_expected/es/main.js create mode 100644 test/chunking-form/samples/sourcemap-file-names-function/_expected/es/main.js.map create mode 100644 test/chunking-form/samples/sourcemap-file-names-function/_expected/system/dynamic-883b8003cd49-c0b30ec8.js.map create mode 100644 test/chunking-form/samples/sourcemap-file-names-function/_expected/system/dynamic-ef271780.js create mode 100644 test/chunking-form/samples/sourcemap-file-names-function/_expected/system/dynamic-hashed-c0b30ec8.js create mode 100644 test/chunking-form/samples/sourcemap-file-names-function/_expected/system/dynamic.js.map create mode 100644 test/chunking-form/samples/sourcemap-file-names-function/_expected/system/main.js create mode 100644 test/chunking-form/samples/sourcemap-file-names-function/_expected/system/main.js.map create mode 100644 test/chunking-form/samples/sourcemap-file-names-function/dynamic-hashed.js create mode 100644 test/chunking-form/samples/sourcemap-file-names-function/dynamic.js create mode 100644 test/chunking-form/samples/sourcemap-file-names-function/main.js create mode 100644 test/chunking-form/samples/sourcemap-file-names/_config.js create mode 100644 test/chunking-form/samples/sourcemap-file-names/_expected/amd/main-543232e9-amd-af8f17da.js.map create mode 100644 test/chunking-form/samples/sourcemap-file-names/_expected/amd/main-543232e9-amd.js create mode 100644 test/chunking-form/samples/sourcemap-file-names/_expected/cjs/main-3fddaf82-cjs-c64b742b.js.map create mode 100644 test/chunking-form/samples/sourcemap-file-names/_expected/cjs/main-3fddaf82-cjs.js create mode 100644 test/chunking-form/samples/sourcemap-file-names/_expected/es/main-824894f4-es-dbab040a.js.map create mode 100644 test/chunking-form/samples/sourcemap-file-names/_expected/es/main-824894f4-es.js create mode 100644 test/chunking-form/samples/sourcemap-file-names/_expected/system/main-6186746c-system-bce3d2ab.js.map create mode 100644 test/chunking-form/samples/sourcemap-file-names/_expected/system/main-6186746c-system.js create mode 100644 test/chunking-form/samples/sourcemap-file-names/main.js diff --git a/cli/help.md b/cli/help.md index d943588d4..74afadf40 100644 --- a/cli/help.md +++ b/cli/help.md @@ -69,6 +69,7 @@ Basic options: --sourcemapBaseUrl Emit absolute sourcemap URLs with given base --sourcemapExcludeSources Do not include source code in source maps --sourcemapFile Specify bundle position for source maps +--sourcemapFileNames Name pattern for emitted sourcemaps --stdin=ext Specify file extension used for stdin input --no-stdin Do not read "-" from stdin --no-strict Don't emit `"use strict";` in the generated modules diff --git a/docs/command-line-interface/index.md b/docs/command-line-interface/index.md index 54d223b64..b223f7caa 100755 --- a/docs/command-line-interface/index.md +++ b/docs/command-line-interface/index.md @@ -106,6 +106,7 @@ export default { sourcemapBaseUrl, sourcemapExcludeSources, sourcemapFile, + sourcemapFileNames, sourcemapIgnoreList, sourcemapPathTransform, validate, @@ -420,6 +421,7 @@ Many options have command line equivalents. In those cases, any arguments passed --sourcemapBaseUrl Emit absolute sourcemap URLs with given base --sourcemapExcludeSources Do not include source code in source maps --sourcemapFile Specify bundle position for source maps +--sourcemapFileNames Name pattern for emitted sourcemaps --stdin=ext Specify file extension used for stdin input --no-stdin Do not read "-" from stdin --no-strict Don't emit `"use strict";` in the generated modules diff --git a/docs/configuration-options/index.md b/docs/configuration-options/index.md index aefccc40a..08485f511 100755 --- a/docs/configuration-options/index.md +++ b/docs/configuration-options/index.md @@ -1470,6 +1470,22 @@ The location of the generated bundle. If this is an absolute path, all the `sour `sourcemapFile` is not required if `output` is specified, in which case an output filename will be inferred by adding ".map" to the output filename for the bundle. +### output.sourcemapFileNames + +| | | +| ----: | :--------------------------------------------- | +| Type: | `string \| ((chunkInfo: ChunkInfo) => string)` | +| CLI: | `--sourcemapFileNames ` | + +The pattern to use for sourcemaps, or a function that is called per sourcemap to return such a pattern. Patterns support the following placeholders: + +- `[format]`: The rendering format defined in the output options, e.g. `es` or `cjs`. +- `[hash]`: A hash based only on the content of the final generated sourcemap. You can also set a specific hash length via e.g. `[hash:10]`. +- `[chunkhash]`: The same hash as the one used for the corresponding generated chunk (if any). +- `[name]`: The file name (without extension) of the entry point, unless the object form of input was used to define a different name. + +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`](../plugin-development/index.md#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`](#output-assetfilenames), [`output.chunkFileNames`](#output-chunkfilenames). + ### output.sourcemapIgnoreList | | | diff --git a/docs/javascript-api/index.md b/docs/javascript-api/index.md index 568373109..e23428449 100755 --- a/docs/javascript-api/index.md +++ b/docs/javascript-api/index.md @@ -181,6 +181,7 @@ const outputOptions = { sourcemapBaseUrl, sourcemapExcludeSources, sourcemapFile, + sourcemapFileNames, sourcemapIgnoreList, sourcemapPathTransform, validate, diff --git a/docs/repl/stores/options.ts b/docs/repl/stores/options.ts index 9d7693584..33cafd18e 100644 --- a/docs/repl/stores/options.ts +++ b/docs/repl/stores/options.ts @@ -311,14 +311,14 @@ export const useOptions = defineStore('options2', () => { available: optionOutputPreserveModules.value, name: 'output.preserveModulesRoot' }); - const optionOutputSourcemap = getBoolean({ - name: 'output.sourcemap' - }); const optionOutputSanitizeFileName = getBoolean({ available: alwaysTrue, defaultValue: true, name: 'output.sanitizeFileName' }); + const optionOutputSourcemap = getBoolean({ + name: 'output.sourcemap' + }); const optionOutputSourcemapBaseUrl = getString({ available: optionOutputSourcemap.value, name: 'output.sourcemapBaseUrl' @@ -327,12 +327,22 @@ export const useOptions = defineStore('options2', () => { available: optionOutputSourcemap.value, name: 'output.sourcemapExcludeSources' }); + const optionOutputSourcemapFileNames = getString({ + available: alwaysTrue, + defaultValue: undefined, + name: 'output.sourcemapFileNames' + }); const optionOutputStrict = getBoolean({ available: () => optionOutputFormat.value.value !== undefined && optionOutputFormat.value.value !== 'es', defaultValue: true, name: 'output.strict' }); + const optionOutputSystemNullSetters = getBoolean({ + available: () => optionOutputFormat.value.value === 'system', + defaultValue: true, + name: 'output.systemNullSetters' + }); const optionOutputValidate = getBoolean({ name: 'output.validate' }); @@ -342,11 +352,6 @@ export const useOptions = defineStore('options2', () => { name: 'preserveEntrySignatures', options: () => ['strict', 'allow-extension', 'exports-only', false] }); - const optionOutputSystemNullSetters = getBoolean({ - available: () => optionOutputFormat.value.value === 'system', - defaultValue: true, - name: 'output.systemNullSetters' - }); const optionShimMissingExports = getBoolean({ defaultValue: false, name: 'shimMissingExports' @@ -436,6 +441,7 @@ export const useOptions = defineStore('options2', () => { optionOutputPreserveModules, optionOutputPreserveModulesRoot, optionOutputSourcemap, + optionOutputSourcemapFileNames, optionOutputSanitizeFileName, optionOutputSourcemapBaseUrl, optionOutputSourcemapExcludeSources, diff --git a/src/Chunk.ts b/src/Chunk.ts index 2b1a65910..377210e98 100644 --- a/src/Chunk.ts +++ b/src/Chunk.ts @@ -72,6 +72,7 @@ export interface ChunkRenderResult { chunk: Chunk; magicString: MagicStringBundle; preliminaryFileName: PreliminaryFileName; + preliminarySourcemapFileName: PreliminaryFileName | null; usedModules: Module[]; } @@ -187,6 +188,7 @@ export default class Chunk { private needsExportsShim = false; private preRenderedChunkInfo: PreRenderedChunk | null = null; private preliminaryFileName: PreliminaryFileName | null = null; + private preliminarySourcemapFileName: PreliminaryFileName | null = null; private renderedChunkInfo: RenderedChunk | null = null; private renderedDependencies: Map | null = null; private readonly renderedModules: { @@ -328,6 +330,7 @@ export default class Chunk { finalizeChunk( code: string, map: SourceMap | null, + sourcemapFileName: string | null, hashesByPlaceholder: Map ): OutputChunk { const renderedChunkInfo = this.getRenderedChunkInfo(); @@ -349,7 +352,8 @@ export default class Chunk { imports: renderedChunkInfo.imports.map(finalize), map, preliminaryFileName, - referencedFiles: renderedChunkInfo.referencedFiles.map(finalize) + referencedFiles: renderedChunkInfo.referencedFiles.map(finalize), + sourcemapFileName }; } @@ -544,6 +548,36 @@ export default class Chunk { return (this.preliminaryFileName = { fileName, hashPlaceholder }); } + getPreliminarySourcemapFileName(): PreliminaryFileName | null { + if (this.preliminarySourcemapFileName) { + return this.preliminarySourcemapFileName; + } + let sourcemapFileName: string | null = null; + let hashPlaceholder: string | null = null; + const { sourcemapFileNames, format } = this.outputOptions; + if (sourcemapFileNames) { + const [pattern, patternName] = [sourcemapFileNames, 'output.sourcemapFileNames']; + sourcemapFileName = renderNamePattern( + typeof pattern === 'function' ? pattern(this.getPreRenderedChunkInfo()) : pattern, + patternName, + { + chunkhash: () => this.getPreliminaryFileName().hashPlaceholder || '', + format: () => format, + hash: size => + hashPlaceholder || (hashPlaceholder = this.getPlaceholder(patternName, size)), + name: () => this.getChunkName() + } + ); + if (!hashPlaceholder) { + sourcemapFileName = makeUnique(sourcemapFileName, this.bundle); + } + } else { + return null; + } + + return (this.preliminarySourcemapFileName = { fileName: sourcemapFileName, hashPlaceholder }); + } + public getRenderedChunkInfo(): RenderedChunk { if (this.renderedChunkInfo) { return this.renderedChunkInfo; @@ -606,6 +640,7 @@ export default class Chunk { } const preliminaryFileName = this.getPreliminaryFileName(); + const preliminarySourcemapFileName = this.getPreliminarySourcemapFileName(); const { accessedGlobals, indent, magicString, renderedSource, usedModules, usesTopLevelAwait } = this.renderModules(preliminaryFileName.fileName); @@ -670,6 +705,7 @@ export default class Chunk { chunk: this, magicString, preliminaryFileName, + preliminarySourcemapFileName, usedModules }; } diff --git a/src/rollup/types.d.ts b/src/rollup/types.d.ts index 07f6f4032..d12c4116b 100644 --- a/src/rollup/types.d.ts +++ b/src/rollup/types.d.ts @@ -164,6 +164,7 @@ export interface EmittedPrebuiltChunk { exports?: string[]; fileName: string; map?: SourceMap; + sourcemapFileName?: string; type: 'prebuilt-chunk'; } @@ -744,6 +745,7 @@ export interface OutputOptions { sourcemapBaseUrl?: string; sourcemapExcludeSources?: boolean; sourcemapFile?: string; + sourcemapFileNames?: string | ((chunkInfo: PreRenderedChunk) => string); sourcemapIgnoreList?: boolean | SourcemapIgnoreListOption; sourcemapPathTransform?: SourcemapPathTransformOption; strict?: boolean; @@ -799,6 +801,7 @@ export interface NormalizedOutputOptions { sourcemapBaseUrl: string | undefined; sourcemapExcludeSources: boolean; sourcemapFile: string | undefined; + sourcemapFileNames: string | ((chunkInfo: PreRenderedChunk) => string) | undefined; sourcemapIgnoreList: SourcemapIgnoreListOption; sourcemapPathTransform: SourcemapPathTransformOption | undefined; strict: boolean; @@ -862,6 +865,7 @@ export interface RenderedChunk extends PreRenderedChunk { export interface OutputChunk extends RenderedChunk { code: string; map: SourceMap | null; + sourcemapFileName: string | null; preliminaryFileName: string; } diff --git a/src/utils/FileEmitter.ts b/src/utils/FileEmitter.ts index d10729578..c5405eb4d 100644 --- a/src/utils/FileEmitter.ts +++ b/src/utils/FileEmitter.ts @@ -326,6 +326,7 @@ export class FileEmitter { name: prebuiltChunk.fileName, preliminaryFileName: prebuiltChunk.fileName, referencedFiles: [], + sourcemapFileName: prebuiltChunk.sourcemapFileName || null, type: 'chunk' }; } diff --git a/src/utils/options/mergeOptions.ts b/src/utils/options/mergeOptions.ts index f384e50c1..4d7217a2a 100644 --- a/src/utils/options/mergeOptions.ts +++ b/src/utils/options/mergeOptions.ts @@ -282,6 +282,7 @@ async function mergeOutputOptions( sourcemapBaseUrl: getOption('sourcemapBaseUrl'), sourcemapExcludeSources: getOption('sourcemapExcludeSources'), sourcemapFile: getOption('sourcemapFile'), + sourcemapFileNames: getOption('sourcemapFileNames'), sourcemapIgnoreList: getOption('sourcemapIgnoreList'), sourcemapPathTransform: getOption('sourcemapPathTransform'), strict: getOption('strict'), diff --git a/src/utils/options/normalizeOutputOptions.ts b/src/utils/options/normalizeOutputOptions.ts index 48863043e..5827e4115 100644 --- a/src/utils/options/normalizeOutputOptions.ts +++ b/src/utils/options/normalizeOutputOptions.ts @@ -104,6 +104,7 @@ export async function normalizeOutputOptions( sourcemapBaseUrl: getSourcemapBaseUrl(config), sourcemapExcludeSources: config.sourcemapExcludeSources || false, sourcemapFile: config.sourcemapFile, + sourcemapFileNames: getSourcemapFileNames(config, unsetOptions), sourcemapIgnoreList: typeof config.sourcemapIgnoreList === 'function' ? config.sourcemapIgnoreList @@ -528,6 +529,17 @@ const getNamespaceToStringTag = ( return generatedCode.symbols || false; }; +const getSourcemapFileNames = ( + config: OutputOptions, + unsetOptions: Set +): NormalizedOutputOptions['sourcemapFileNames'] => { + const configSourcemapFileNames = config.sourcemapFileNames; + if (configSourcemapFileNames == null) { + unsetOptions.add('sourcemapFileNames'); + } + return configSourcemapFileNames; +}; + const getSourcemapBaseUrl = ( config: OutputOptions ): NormalizedOutputOptions['sourcemapBaseUrl'] => { diff --git a/src/utils/renderChunks.ts b/src/utils/renderChunks.ts index cd1f92cc2..e154cc62d 100644 --- a/src/utils/renderChunks.ts +++ b/src/utils/renderChunks.ts @@ -32,6 +32,7 @@ interface RenderedChunkWithPlaceholders { chunk: Chunk; code: string; fileName: string; + sourcemapFileName: string | null; map: SourceMap | null; } @@ -52,6 +53,7 @@ export async function renderChunks( const chunkGraph = getChunkGraph(chunks); const { + initialHashesByPlaceholder, nonHashedChunksWithPlaceholders, renderedChunksByPlaceholder, hashDependenciesByPlaceholder @@ -65,6 +67,7 @@ export async function renderChunks( const hashesByPlaceholder = generateFinalHashes( renderedChunksByPlaceholder, hashDependenciesByPlaceholder, + initialHashesByPlaceholder, bundle ); addChunksToBundle( @@ -200,6 +203,7 @@ async function transformChunksAndGenerateContentHashes( const nonHashedChunksWithPlaceholders: RenderedChunkWithPlaceholders[] = []; const renderedChunksByPlaceholder = new Map(); const hashDependenciesByPlaceholder = new Map(); + const initialHashesByPlaceholder = new Map(); const placeholders = new Set(); for (const { preliminaryFileName: { hashPlaceholder } @@ -211,12 +215,14 @@ async function transformChunksAndGenerateContentHashes( async ({ chunk, preliminaryFileName: { fileName, hashPlaceholder }, + preliminarySourcemapFileName, magicString, usedModules }) => { - const transformedChunk = { + const transformedChunk: RenderedChunkWithPlaceholders = { chunk, fileName, + sourcemapFileName: preliminarySourcemapFileName?.fileName ?? null, ...(await transformChunk( magicString, fileName, @@ -227,7 +233,8 @@ async function transformChunksAndGenerateContentHashes( log )) }; - const { code } = transformedChunk; + const { code, map } = transformedChunk; + if (hashPlaceholder) { // To create a reproducible content-only hash, all placeholders are // replaced with the same value before hashing @@ -256,11 +263,23 @@ async function transformChunksAndGenerateContentHashes( } else { nonHashedChunksWithPlaceholders.push(transformedChunk); } + + const sourcemapHashPlaceholder = preliminarySourcemapFileName?.hashPlaceholder; + if (map && sourcemapHashPlaceholder) { + initialHashesByPlaceholder.set( + preliminarySourcemapFileName.hashPlaceholder, + createHash() + .update(map.toString()) + .digest('hex') + .slice(0, preliminarySourcemapFileName.hashPlaceholder.length) + ); + } } ) ); return { hashDependenciesByPlaceholder, + initialHashesByPlaceholder, nonHashedChunksWithPlaceholders, renderedChunksByPlaceholder }; @@ -269,9 +288,10 @@ async function transformChunksAndGenerateContentHashes( function generateFinalHashes( renderedChunksByPlaceholder: Map, hashDependenciesByPlaceholder: Map, + initialHashesByPlaceholder: Map, bundle: OutputBundleWithPlaceholders ) { - const hashesByPlaceholder = new Map(); + const hashesByPlaceholder = new Map(initialHashesByPlaceholder); for (const [placeholder, { fileName }] of renderedChunksByPlaceholder) { let hash = createHash(); const hashDependencyPlaceholders = new Set([placeholder]); @@ -308,22 +328,46 @@ function addChunksToBundle( pluginDriver: PluginDriver, options: NormalizedOutputOptions ) { - for (const { chunk, code, fileName, map } of renderedChunksByPlaceholder.values()) { + for (const { + chunk, + code, + fileName, + sourcemapFileName, + map + } of renderedChunksByPlaceholder.values()) { let updatedCode = replacePlaceholders(code, hashesByPlaceholder); const finalFileName = replacePlaceholders(fileName, hashesByPlaceholder); + let finalSourcemapFileName = null; if (map) { + finalSourcemapFileName = sourcemapFileName + ? replacePlaceholders(sourcemapFileName, hashesByPlaceholder) + : `${finalFileName}.map`; map.file = replacePlaceholders(map.file, hashesByPlaceholder); - updatedCode += emitSourceMapAndGetComment(finalFileName, map, pluginDriver, options); + updatedCode += emitSourceMapAndGetComment(finalSourcemapFileName, map, pluginDriver, options); } - bundle[finalFileName] = chunk.finalizeChunk(updatedCode, map, hashesByPlaceholder); + bundle[finalFileName] = chunk.finalizeChunk( + updatedCode, + map, + finalSourcemapFileName, + hashesByPlaceholder + ); } - for (const { chunk, code, fileName, map } of nonHashedChunksWithPlaceholders) { + for (const { chunk, code, fileName, sourcemapFileName, map } of nonHashedChunksWithPlaceholders) { let updatedCode = hashesByPlaceholder.size > 0 ? replacePlaceholders(code, hashesByPlaceholder) : code; + let finalSourcemapFileName = null; if (map) { - updatedCode += emitSourceMapAndGetComment(fileName, map, pluginDriver, options); + finalSourcemapFileName = sourcemapFileName + ? replacePlaceholders(sourcemapFileName, hashesByPlaceholder) + : `${fileName}.map`; + updatedCode += emitSourceMapAndGetComment(finalSourcemapFileName, map, pluginDriver, options); } - bundle[fileName] = chunk.finalizeChunk(updatedCode, map, hashesByPlaceholder); + bundle[fileName] = chunk.finalizeChunk( + updatedCode, + map, + finalSourcemapFileName, + hashesByPlaceholder + ); } } @@ -337,11 +381,11 @@ function emitSourceMapAndGetComment( if (sourcemap === 'inline') { url = map.toUrl(); } else { - const sourcemapFileName = `${basename(fileName)}.map`; + const sourcemapFileName = basename(fileName); url = sourcemapBaseUrl ? new URL(sourcemapFileName, sourcemapBaseUrl).toString() : sourcemapFileName; - pluginDriver.emitFile({ fileName: `${fileName}.map`, source: map.toString(), type: 'asset' }); + pluginDriver.emitFile({ fileName, source: map.toString(), type: 'asset' }); } return sourcemap === 'hidden' ? '' : `//# ${SOURCEMAPPING_URL}=${url}\n`; } diff --git a/test/chunking-form/samples/render-chunk-transform/_config.js b/test/chunking-form/samples/render-chunk-transform/_config.js index 5c1131ec0..d45b42c72 100644 --- a/test/chunking-form/samples/render-chunk-transform/_config.js +++ b/test/chunking-form/samples/render-chunk-transform/_config.js @@ -47,7 +47,8 @@ module.exports = defineTest({ imports: [], preliminaryFileName: 'entry-main1-!~{001}~.js', referencedFiles: [], - map: null + map: null, + sourcemapFileName: null }, 'entry-main2.js': { exports: [], @@ -65,7 +66,8 @@ module.exports = defineTest({ imports: ['entry-main1.js'], preliminaryFileName: 'entry-main2-!~{002}~.js', referencedFiles: [], - map: null + map: null, + sourcemapFileName: null } }); } diff --git a/test/chunking-form/samples/sourcemap-file-names-function/_config.js b/test/chunking-form/samples/sourcemap-file-names-function/_config.js new file mode 100644 index 000000000..aaee53297 --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names-function/_config.js @@ -0,0 +1,27 @@ +module.exports = defineTest({ + description: 'observes sourcemapFileNames property when using a function', + options: { + output: { + sourcemap: true, + entryFileNames: '[name].js', + chunkFileNames: '[name]-[hash].js', + sourcemapFileNames: ({ name }) => { + switch (name) { + case 'main': { + // chunkhash should be empty string + return 'main[chunkhash].js.map'; + } + case 'dynamic': { + return 'dynamic.js.map'; + } + case 'dynamic-hashed': { + return 'dynamic-[hash:12]-[chunkhash].js.map'; + } + default: { + throw new Error(`Unexpected name ${name}`); + } + } + } + } + } +}); diff --git a/test/chunking-form/samples/sourcemap-file-names-function/_expected/amd/dynamic-a0f7e361.js b/test/chunking-form/samples/sourcemap-file-names-function/_expected/amd/dynamic-a0f7e361.js new file mode 100644 index 000000000..6e68bc23d --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names-function/_expected/amd/dynamic-a0f7e361.js @@ -0,0 +1,6 @@ +define((function () { 'use strict'; + + console.log('dynamic'); + +})); +//# sourceMappingURL=dynamic.js.map diff --git a/test/chunking-form/samples/sourcemap-file-names-function/_expected/amd/dynamic-eea0ce30202b-5ec8d44f.js.map b/test/chunking-form/samples/sourcemap-file-names-function/_expected/amd/dynamic-eea0ce30202b-5ec8d44f.js.map new file mode 100644 index 000000000..c8102366e --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names-function/_expected/amd/dynamic-eea0ce30202b-5ec8d44f.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamic-hashed-5ec8d44f.js","sources":["../../dynamic-hashed.js"],"sourcesContent":["console.log('dynamic-hashed');\n"],"names":[],"mappings":";;CAAA,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;;;;;;"} \ No newline at end of file diff --git a/test/chunking-form/samples/sourcemap-file-names-function/_expected/amd/dynamic-hashed-5ec8d44f.js b/test/chunking-form/samples/sourcemap-file-names-function/_expected/amd/dynamic-hashed-5ec8d44f.js new file mode 100644 index 000000000..775befa5f --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names-function/_expected/amd/dynamic-hashed-5ec8d44f.js @@ -0,0 +1,6 @@ +define((function () { 'use strict'; + + console.log('dynamic-hashed'); + +})); +//# sourceMappingURL=dynamic-eea0ce30202b-5ec8d44f.js.map diff --git a/test/chunking-form/samples/sourcemap-file-names-function/_expected/amd/dynamic.js.map b/test/chunking-form/samples/sourcemap-file-names-function/_expected/amd/dynamic.js.map new file mode 100644 index 000000000..3af06b91a --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names-function/_expected/amd/dynamic.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamic-a0f7e361.js","sources":["../../dynamic.js"],"sourcesContent":["console.log('dynamic');\n"],"names":[],"mappings":";;CAAA,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;;;;;;"} \ No newline at end of file diff --git a/test/chunking-form/samples/sourcemap-file-names-function/_expected/amd/main.js b/test/chunking-form/samples/sourcemap-file-names-function/_expected/amd/main.js new file mode 100644 index 000000000..2c4333834 --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names-function/_expected/amd/main.js @@ -0,0 +1,7 @@ +define(['require'], (function (require) { 'use strict'; + + new Promise(function (resolve, reject) { require(['./dynamic-a0f7e361'], resolve, reject); }); + new Promise(function (resolve, reject) { require(['./dynamic-hashed-5ec8d44f'], resolve, reject); }); + +})); +//# sourceMappingURL=main.js.map diff --git a/test/chunking-form/samples/sourcemap-file-names-function/_expected/amd/main.js.map b/test/chunking-form/samples/sourcemap-file-names-function/_expected/amd/main.js.map new file mode 100644 index 000000000..77d397ccc --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names-function/_expected/amd/main.js.map @@ -0,0 +1 @@ +{"version":3,"file":"main.js","sources":["../../main.js"],"sourcesContent":["import('./dynamic.js');\nimport('./dynamic-hashed.js');\n"],"names":[],"mappings":";;AAAA,mDAAO,oBAAc,uBAAC,CAAC;AACvB,mDAAO,2BAAqB,uBAAC;;;;;;"} \ No newline at end of file diff --git a/test/chunking-form/samples/sourcemap-file-names-function/_expected/cjs/dynamic-03a87e17.js b/test/chunking-form/samples/sourcemap-file-names-function/_expected/cjs/dynamic-03a87e17.js new file mode 100644 index 000000000..7de73b8dd --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names-function/_expected/cjs/dynamic-03a87e17.js @@ -0,0 +1,4 @@ +'use strict'; + +console.log('dynamic'); +//# sourceMappingURL=dynamic.js.map diff --git a/test/chunking-form/samples/sourcemap-file-names-function/_expected/cjs/dynamic-44faaace9dbc-e21b9079.js.map b/test/chunking-form/samples/sourcemap-file-names-function/_expected/cjs/dynamic-44faaace9dbc-e21b9079.js.map new file mode 100644 index 000000000..b1be3c6ea --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names-function/_expected/cjs/dynamic-44faaace9dbc-e21b9079.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamic-hashed-e21b9079.js","sources":["../../dynamic-hashed.js"],"sourcesContent":["console.log('dynamic-hashed');\n"],"names":[],"mappings":";;AAAA,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;;"} \ No newline at end of file diff --git a/test/chunking-form/samples/sourcemap-file-names-function/_expected/cjs/dynamic-hashed-e21b9079.js b/test/chunking-form/samples/sourcemap-file-names-function/_expected/cjs/dynamic-hashed-e21b9079.js new file mode 100644 index 000000000..4f1a4393c --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names-function/_expected/cjs/dynamic-hashed-e21b9079.js @@ -0,0 +1,4 @@ +'use strict'; + +console.log('dynamic-hashed'); +//# sourceMappingURL=dynamic-44faaace9dbc-e21b9079.js.map diff --git a/test/chunking-form/samples/sourcemap-file-names-function/_expected/cjs/dynamic.js.map b/test/chunking-form/samples/sourcemap-file-names-function/_expected/cjs/dynamic.js.map new file mode 100644 index 000000000..8535c836d --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names-function/_expected/cjs/dynamic.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamic-03a87e17.js","sources":["../../dynamic.js"],"sourcesContent":["console.log('dynamic');\n"],"names":[],"mappings":";;AAAA,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;;"} \ No newline at end of file diff --git a/test/chunking-form/samples/sourcemap-file-names-function/_expected/cjs/main.js b/test/chunking-form/samples/sourcemap-file-names-function/_expected/cjs/main.js new file mode 100644 index 000000000..ecf6f5b43 --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names-function/_expected/cjs/main.js @@ -0,0 +1,5 @@ +'use strict'; + +Promise.resolve().then(function () { return require('./dynamic-03a87e17.js'); }); +Promise.resolve().then(function () { return require('./dynamic-hashed-e21b9079.js'); }); +//# sourceMappingURL=main.js.map diff --git a/test/chunking-form/samples/sourcemap-file-names-function/_expected/cjs/main.js.map b/test/chunking-form/samples/sourcemap-file-names-function/_expected/cjs/main.js.map new file mode 100644 index 000000000..7d54836ff --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names-function/_expected/cjs/main.js.map @@ -0,0 +1 @@ +{"version":3,"file":"main.js","sources":["../../main.js"],"sourcesContent":["import('./dynamic.js');\nimport('./dynamic-hashed.js');\n"],"names":[],"mappings":";;AAAA,oDAAO,uBAAc,KAAC,CAAC;AACvB,oDAAO,8BAAqB,KAAC;;"} \ No newline at end of file diff --git a/test/chunking-form/samples/sourcemap-file-names-function/_expected/es/dynamic-769057acb768-4b06902b.js.map b/test/chunking-form/samples/sourcemap-file-names-function/_expected/es/dynamic-769057acb768-4b06902b.js.map new file mode 100644 index 000000000..35d31d3d6 --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names-function/_expected/es/dynamic-769057acb768-4b06902b.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamic-hashed-4b06902b.js","sources":["../../dynamic-hashed.js"],"sourcesContent":["console.log('dynamic-hashed');\n"],"names":[],"mappings":"AAAA,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC"} \ No newline at end of file diff --git a/test/chunking-form/samples/sourcemap-file-names-function/_expected/es/dynamic-c7ad594d.js b/test/chunking-form/samples/sourcemap-file-names-function/_expected/es/dynamic-c7ad594d.js new file mode 100644 index 000000000..e3094ebbb --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names-function/_expected/es/dynamic-c7ad594d.js @@ -0,0 +1,2 @@ +console.log('dynamic'); +//# sourceMappingURL=dynamic.js.map diff --git a/test/chunking-form/samples/sourcemap-file-names-function/_expected/es/dynamic-hashed-4b06902b.js b/test/chunking-form/samples/sourcemap-file-names-function/_expected/es/dynamic-hashed-4b06902b.js new file mode 100644 index 000000000..ca9acfeed --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names-function/_expected/es/dynamic-hashed-4b06902b.js @@ -0,0 +1,2 @@ +console.log('dynamic-hashed'); +//# sourceMappingURL=dynamic-769057acb768-4b06902b.js.map diff --git a/test/chunking-form/samples/sourcemap-file-names-function/_expected/es/dynamic.js.map b/test/chunking-form/samples/sourcemap-file-names-function/_expected/es/dynamic.js.map new file mode 100644 index 000000000..45e7b978c --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names-function/_expected/es/dynamic.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamic-c7ad594d.js","sources":["../../dynamic.js"],"sourcesContent":["console.log('dynamic');\n"],"names":[],"mappings":"AAAA,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC"} \ No newline at end of file diff --git a/test/chunking-form/samples/sourcemap-file-names-function/_expected/es/main.js b/test/chunking-form/samples/sourcemap-file-names-function/_expected/es/main.js new file mode 100644 index 000000000..ae85ca097 --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names-function/_expected/es/main.js @@ -0,0 +1,3 @@ +import('./dynamic-c7ad594d.js'); +import('./dynamic-hashed-4b06902b.js'); +//# sourceMappingURL=main.js.map diff --git a/test/chunking-form/samples/sourcemap-file-names-function/_expected/es/main.js.map b/test/chunking-form/samples/sourcemap-file-names-function/_expected/es/main.js.map new file mode 100644 index 000000000..e433cc70d --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names-function/_expected/es/main.js.map @@ -0,0 +1 @@ +{"version":3,"file":"main.js","sources":["../../main.js"],"sourcesContent":["import('./dynamic.js');\nimport('./dynamic-hashed.js');\n"],"names":[],"mappings":"AAAA,OAAO,uBAAc,CAAC,CAAC;AACvB,OAAO,8BAAqB,CAAC"} \ No newline at end of file diff --git a/test/chunking-form/samples/sourcemap-file-names-function/_expected/system/dynamic-883b8003cd49-c0b30ec8.js.map b/test/chunking-form/samples/sourcemap-file-names-function/_expected/system/dynamic-883b8003cd49-c0b30ec8.js.map new file mode 100644 index 000000000..4efbf1079 --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names-function/_expected/system/dynamic-883b8003cd49-c0b30ec8.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamic-hashed-c0b30ec8.js","sources":["../../dynamic-hashed.js"],"sourcesContent":["console.log('dynamic-hashed');\n"],"names":[],"mappings":";;;;;GAAA,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;;;;;;;;"} \ No newline at end of file diff --git a/test/chunking-form/samples/sourcemap-file-names-function/_expected/system/dynamic-ef271780.js b/test/chunking-form/samples/sourcemap-file-names-function/_expected/system/dynamic-ef271780.js new file mode 100644 index 000000000..6b9651b1e --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names-function/_expected/system/dynamic-ef271780.js @@ -0,0 +1,11 @@ +System.register([], (function () { + 'use strict'; + return { + execute: (function () { + + console.log('dynamic'); + + }) + }; +})); +//# sourceMappingURL=dynamic.js.map diff --git a/test/chunking-form/samples/sourcemap-file-names-function/_expected/system/dynamic-hashed-c0b30ec8.js b/test/chunking-form/samples/sourcemap-file-names-function/_expected/system/dynamic-hashed-c0b30ec8.js new file mode 100644 index 000000000..d23349da9 --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names-function/_expected/system/dynamic-hashed-c0b30ec8.js @@ -0,0 +1,11 @@ +System.register([], (function () { + 'use strict'; + return { + execute: (function () { + + console.log('dynamic-hashed'); + + }) + }; +})); +//# sourceMappingURL=dynamic-883b8003cd49-c0b30ec8.js.map diff --git a/test/chunking-form/samples/sourcemap-file-names-function/_expected/system/dynamic.js.map b/test/chunking-form/samples/sourcemap-file-names-function/_expected/system/dynamic.js.map new file mode 100644 index 000000000..49fa5e4dd --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names-function/_expected/system/dynamic.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamic-ef271780.js","sources":["../../dynamic.js"],"sourcesContent":["console.log('dynamic');\n"],"names":[],"mappings":";;;;;GAAA,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;;;;;;;;"} \ No newline at end of file diff --git a/test/chunking-form/samples/sourcemap-file-names-function/_expected/system/main.js b/test/chunking-form/samples/sourcemap-file-names-function/_expected/system/main.js new file mode 100644 index 000000000..a366b8a53 --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names-function/_expected/system/main.js @@ -0,0 +1,12 @@ +System.register([], (function (exports, module) { + 'use strict'; + return { + execute: (function () { + + module.import('./dynamic-ef271780.js'); + module.import('./dynamic-hashed-c0b30ec8.js'); + + }) + }; +})); +//# sourceMappingURL=main.js.map diff --git a/test/chunking-form/samples/sourcemap-file-names-function/_expected/system/main.js.map b/test/chunking-form/samples/sourcemap-file-names-function/_expected/system/main.js.map new file mode 100644 index 000000000..c61b09415 --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names-function/_expected/system/main.js.map @@ -0,0 +1 @@ +{"version":3,"file":"main.js","sources":["../../main.js"],"sourcesContent":["import('./dynamic.js');\nimport('./dynamic-hashed.js');\n"],"names":[],"mappings":";;;;;AAAA,iBAAO,uBAAc,CAAC,CAAC;AACvB,iBAAO,8BAAqB,CAAC;;;;;;;;"} \ No newline at end of file diff --git a/test/chunking-form/samples/sourcemap-file-names-function/dynamic-hashed.js b/test/chunking-form/samples/sourcemap-file-names-function/dynamic-hashed.js new file mode 100644 index 000000000..477aa42f8 --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names-function/dynamic-hashed.js @@ -0,0 +1 @@ +console.log('dynamic-hashed'); diff --git a/test/chunking-form/samples/sourcemap-file-names-function/dynamic.js b/test/chunking-form/samples/sourcemap-file-names-function/dynamic.js new file mode 100644 index 000000000..955cedef8 --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names-function/dynamic.js @@ -0,0 +1 @@ +console.log('dynamic'); diff --git a/test/chunking-form/samples/sourcemap-file-names-function/main.js b/test/chunking-form/samples/sourcemap-file-names-function/main.js new file mode 100644 index 000000000..29507b175 --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names-function/main.js @@ -0,0 +1,2 @@ +import('./dynamic.js'); +import('./dynamic-hashed.js'); diff --git a/test/chunking-form/samples/sourcemap-file-names/_config.js b/test/chunking-form/samples/sourcemap-file-names/_config.js new file mode 100644 index 000000000..2ea7138dc --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names/_config.js @@ -0,0 +1,22 @@ +const assert = require('node:assert'); + +module.exports = defineTest({ + description: + 'populates sourcemapFileName property of OutputChunk with final name when using sourcemapFileNames option', + options: { + output: { + sourcemap: true, + entryFileNames: '[name]-[hash]-[format].js', + sourcemapFileNames: '[name]-[chunkhash]-[format]-[hash].js.map' + }, + plugins: [ + { + name: 'test-bundle', + generateBundle(options, bundle) { + const [sourcemapFileName, fileName] = Object.keys(bundle).sort(); + assert.strictEqual(bundle[fileName].sourcemapFileName, sourcemapFileName); + } + } + ] + } +}); diff --git a/test/chunking-form/samples/sourcemap-file-names/_expected/amd/main-543232e9-amd-af8f17da.js.map b/test/chunking-form/samples/sourcemap-file-names/_expected/amd/main-543232e9-amd-af8f17da.js.map new file mode 100644 index 000000000..242d8eda3 --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names/_expected/amd/main-543232e9-amd-af8f17da.js.map @@ -0,0 +1 @@ +{"version":3,"file":"main-543232e9-amd.js","sources":["../../main.js"],"sourcesContent":["console.log( 42 );\n"],"names":[],"mappings":";;CAAA,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE;;;;;;"} \ No newline at end of file diff --git a/test/chunking-form/samples/sourcemap-file-names/_expected/amd/main-543232e9-amd.js b/test/chunking-form/samples/sourcemap-file-names/_expected/amd/main-543232e9-amd.js new file mode 100644 index 000000000..3970ebf7c --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names/_expected/amd/main-543232e9-amd.js @@ -0,0 +1,6 @@ +define((function () { 'use strict'; + + console.log( 42 ); + +})); +//# sourceMappingURL=main-543232e9-amd-af8f17da.js.map diff --git a/test/chunking-form/samples/sourcemap-file-names/_expected/cjs/main-3fddaf82-cjs-c64b742b.js.map b/test/chunking-form/samples/sourcemap-file-names/_expected/cjs/main-3fddaf82-cjs-c64b742b.js.map new file mode 100644 index 000000000..be5e8ad1c --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names/_expected/cjs/main-3fddaf82-cjs-c64b742b.js.map @@ -0,0 +1 @@ +{"version":3,"file":"main-3fddaf82-cjs.js","sources":["../../main.js"],"sourcesContent":["console.log( 42 );\n"],"names":[],"mappings":";;AAAA,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE;;"} \ No newline at end of file diff --git a/test/chunking-form/samples/sourcemap-file-names/_expected/cjs/main-3fddaf82-cjs.js b/test/chunking-form/samples/sourcemap-file-names/_expected/cjs/main-3fddaf82-cjs.js new file mode 100644 index 000000000..98bd52e71 --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names/_expected/cjs/main-3fddaf82-cjs.js @@ -0,0 +1,4 @@ +'use strict'; + +console.log( 42 ); +//# sourceMappingURL=main-3fddaf82-cjs-c64b742b.js.map diff --git a/test/chunking-form/samples/sourcemap-file-names/_expected/es/main-824894f4-es-dbab040a.js.map b/test/chunking-form/samples/sourcemap-file-names/_expected/es/main-824894f4-es-dbab040a.js.map new file mode 100644 index 000000000..83eea7bfe --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names/_expected/es/main-824894f4-es-dbab040a.js.map @@ -0,0 +1 @@ +{"version":3,"file":"main-824894f4-es.js","sources":["../../main.js"],"sourcesContent":["console.log( 42 );\n"],"names":[],"mappings":"AAAA,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE"} \ No newline at end of file diff --git a/test/chunking-form/samples/sourcemap-file-names/_expected/es/main-824894f4-es.js b/test/chunking-form/samples/sourcemap-file-names/_expected/es/main-824894f4-es.js new file mode 100644 index 000000000..556fd1f82 --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names/_expected/es/main-824894f4-es.js @@ -0,0 +1,2 @@ +console.log( 42 ); +//# sourceMappingURL=main-824894f4-es-dbab040a.js.map diff --git a/test/chunking-form/samples/sourcemap-file-names/_expected/system/main-6186746c-system-bce3d2ab.js.map b/test/chunking-form/samples/sourcemap-file-names/_expected/system/main-6186746c-system-bce3d2ab.js.map new file mode 100644 index 000000000..2d95a47c5 --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names/_expected/system/main-6186746c-system-bce3d2ab.js.map @@ -0,0 +1 @@ +{"version":3,"file":"main-6186746c-system.js","sources":["../../main.js"],"sourcesContent":["console.log( 42 );\n"],"names":[],"mappings":";;;;;GAAA,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE;;;;;;;;"} \ No newline at end of file diff --git a/test/chunking-form/samples/sourcemap-file-names/_expected/system/main-6186746c-system.js b/test/chunking-form/samples/sourcemap-file-names/_expected/system/main-6186746c-system.js new file mode 100644 index 000000000..6d33eca3a --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names/_expected/system/main-6186746c-system.js @@ -0,0 +1,11 @@ +System.register([], (function () { + 'use strict'; + return { + execute: (function () { + + console.log( 42 ); + + }) + }; +})); +//# sourceMappingURL=main-6186746c-system-bce3d2ab.js.map diff --git a/test/chunking-form/samples/sourcemap-file-names/main.js b/test/chunking-form/samples/sourcemap-file-names/main.js new file mode 100644 index 000000000..5c72ff351 --- /dev/null +++ b/test/chunking-form/samples/sourcemap-file-names/main.js @@ -0,0 +1 @@ +console.log( 42 ); diff --git a/test/function/samples/emit-file/prebuilt-chunk/_config.js b/test/function/samples/emit-file/prebuilt-chunk/_config.js index 82164251a..496b924c5 100644 --- a/test/function/samples/emit-file/prebuilt-chunk/_config.js +++ b/test/function/samples/emit-file/prebuilt-chunk/_config.js @@ -60,6 +60,7 @@ module.exports = defineTest({ ...prebuiltChunk1ConsumedProperties, name: fileName, map: null, + sourcemapFileName: null, preliminaryFileName: 'my-chunk.js' }); this.emitFile({ @@ -73,6 +74,7 @@ module.exports = defineTest({ name: fileName2, exports: [], map: null, + sourcemapFileName: null, preliminaryFileName: 'my-chunk2.js' }); } diff --git a/test/misc/optionList.js b/test/misc/optionList.js index cce929c1f..e34a54586 100644 --- a/test/misc/optionList.js +++ b/test/misc/optionList.js @@ -1,6 +1,6 @@ exports.input = 'acorn, acornInjectPlugins, cache, context, experimentalCacheExpiry, experimentalLogSideEffects, external, inlineDynamicImports, input, logLevel, makeAbsoluteExternalsRelative, manualChunks, maxParallelFileOps, maxParallelFileReads, moduleContext, onLog, onwarn, perf, plugins, preserveEntrySignatures, preserveModules, preserveSymlinks, shimMissingExports, strictDeprecations, treeshake, watch'; exports.flags = - 'acorn, acornInjectPlugins, amd, assetFileNames, banner, bundleConfigAsCjs, c, cache, chunkFileNames, compact, config, configPlugin, context, d, dir, dynamicImportFunction, dynamicImportInCjs, e, entryFileNames, environment, esModule, experimentalCacheExpiry, experimentalDeepDynamicChunkOptimization, experimentalLogSideEffects, experimentalMinChunkSize, exports, extend, external, externalImportAssertions, externalLiveBindings, f, failAfterWarnings, file, filterLogs, footer, format, freeze, g, generatedCode, globals, h, hoistTransitiveImports, i, indent, inlineDynamicImports, input, interop, intro, logLevel, m, makeAbsoluteExternalsRelative, manualChunks, maxParallelFileOps, maxParallelFileReads, minifyInternalExports, moduleContext, n, name, namespaceToStringTag, noConflict, o, onLog, onwarn, outro, p, paths, perf, plugin, plugins, preferConst, preserveEntrySignatures, preserveModules, preserveModulesRoot, preserveSymlinks, sanitizeFileName, shimMissingExports, silent, sourcemap, sourcemapBaseUrl, sourcemapExcludeSources, sourcemapFile, stdin, strict, strictDeprecations, systemNullSetters, treeshake, v, validate, w, waitForBundleInput, watch'; + 'acorn, acornInjectPlugins, amd, assetFileNames, banner, bundleConfigAsCjs, c, cache, chunkFileNames, compact, config, configPlugin, context, d, dir, dynamicImportFunction, dynamicImportInCjs, e, entryFileNames, environment, esModule, experimentalCacheExpiry, experimentalDeepDynamicChunkOptimization, experimentalLogSideEffects, experimentalMinChunkSize, exports, extend, external, externalImportAssertions, externalLiveBindings, f, failAfterWarnings, file, filterLogs, footer, format, freeze, g, generatedCode, globals, h, hoistTransitiveImports, i, indent, inlineDynamicImports, input, interop, intro, logLevel, m, makeAbsoluteExternalsRelative, manualChunks, maxParallelFileOps, maxParallelFileReads, minifyInternalExports, moduleContext, n, name, namespaceToStringTag, noConflict, o, onLog, onwarn, outro, p, paths, perf, plugin, plugins, preferConst, preserveEntrySignatures, preserveModules, preserveModulesRoot, preserveSymlinks, sanitizeFileName, shimMissingExports, silent, sourcemap, sourcemapBaseUrl, sourcemapExcludeSources, sourcemapFile, sourcemapFileNames, stdin, strict, strictDeprecations, systemNullSetters, treeshake, v, validate, w, waitForBundleInput, watch'; exports.output = - 'amd, assetFileNames, banner, chunkFileNames, compact, dir, dynamicImportFunction, dynamicImportInCjs, entryFileNames, esModule, experimentalDeepDynamicChunkOptimization, experimentalMinChunkSize, exports, extend, externalImportAssertions, externalLiveBindings, file, footer, format, freeze, generatedCode, globals, hoistTransitiveImports, indent, inlineDynamicImports, interop, intro, manualChunks, minifyInternalExports, name, namespaceToStringTag, noConflict, outro, paths, plugins, preferConst, preserveModules, preserveModulesRoot, sanitizeFileName, sourcemap, sourcemapBaseUrl, sourcemapExcludeSources, sourcemapFile, sourcemapIgnoreList, sourcemapPathTransform, strict, systemNullSetters, validate'; + 'amd, assetFileNames, banner, chunkFileNames, compact, dir, dynamicImportFunction, dynamicImportInCjs, entryFileNames, esModule, experimentalDeepDynamicChunkOptimization, experimentalMinChunkSize, exports, extend, externalImportAssertions, externalLiveBindings, file, footer, format, freeze, generatedCode, globals, hoistTransitiveImports, indent, inlineDynamicImports, interop, intro, manualChunks, minifyInternalExports, name, namespaceToStringTag, noConflict, outro, paths, plugins, preferConst, preserveModules, preserveModulesRoot, sanitizeFileName, sourcemap, sourcemapBaseUrl, sourcemapExcludeSources, sourcemapFile, sourcemapFileNames, sourcemapIgnoreList, sourcemapPathTransform, strict, systemNullSetters, validate'; diff --git a/test/sourcemaps/index.js b/test/sourcemaps/index.js index 47d48021d..d3119aece 100644 --- a/test/sourcemaps/index.js +++ b/test/sourcemaps/index.js @@ -59,8 +59,9 @@ async function generateAndTestBundle(bundle, outputOptions, config, format, warn } else if (warnings.length > 0) { throw new Error(`Unexpected warnings`); } + const { - output: [{ code, map, fileName }] + output: [{ code, map, fileName, sourcemapFileName }] } = await bundle.write(outputOptions); - await config.test(code, map, { fileName, format }); + await config.test(code, map, { fileName, sourcemapFileName, format }); } From 884e6781ed67b1c94232fdf80cfe6b1d8fafb9d5 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Wed, 6 Sep 2023 07:27:37 +0200 Subject: [PATCH 02/10] Deoptimize custom event detail (#5123) --- src/ast/nodes/shared/knownGlobals.ts | 12 +++++++++++- test/form/samples/custom-event-detail/_config.js | 3 +++ test/form/samples/custom-event-detail/_expected.js | 5 +++++ test/form/samples/custom-event-detail/main.js | 5 +++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 test/form/samples/custom-event-detail/_config.js create mode 100644 test/form/samples/custom-event-detail/_expected.js create mode 100644 test/form/samples/custom-event-detail/main.js diff --git a/src/ast/nodes/shared/knownGlobals.ts b/src/ast/nodes/shared/knownGlobals.ts index 13e8294a6..0059b64c5 100644 --- a/src/ast/nodes/shared/knownGlobals.ts +++ b/src/ast/nodes/shared/knownGlobals.ts @@ -478,7 +478,17 @@ const knownGlobals: GlobalDescription = { CSSSupportsRule: C, CustomElementRegistry: C, customElements: O, - CustomEvent: C, + CustomEvent: { + __proto__: null, + [ValueProperties]: { + deoptimizeArgumentsOnCall({ args }: NodeInteractionCalled) { + args[2]?.deoptimizePath(['detail']); + }, + getLiteralValue: getTruthyLiteralValue, + hasEffectsWhenCalled: returnFalse + }, + prototype: O + }, DataTransfer: C, DataTransferItem: C, DataTransferItemList: C, diff --git a/test/form/samples/custom-event-detail/_config.js b/test/form/samples/custom-event-detail/_config.js new file mode 100644 index 000000000..e9a52e0fd --- /dev/null +++ b/test/form/samples/custom-event-detail/_config.js @@ -0,0 +1,3 @@ +module.exports = defineTest({ + description: 'observes side effects for custom event payloads' +}); diff --git a/test/form/samples/custom-event-detail/_expected.js b/test/form/samples/custom-event-detail/_expected.js new file mode 100644 index 000000000..098316cf8 --- /dev/null +++ b/test/form/samples/custom-event-detail/_expected.js @@ -0,0 +1,5 @@ +const detail = { value: null }; +const event = new CustomEvent('test', { detail }); +event.detail.value = true; +if (detail.value) console.log('ok'); +else console.log('failed'); diff --git a/test/form/samples/custom-event-detail/main.js b/test/form/samples/custom-event-detail/main.js new file mode 100644 index 000000000..098316cf8 --- /dev/null +++ b/test/form/samples/custom-event-detail/main.js @@ -0,0 +1,5 @@ +const detail = { value: null }; +const event = new CustomEvent('test', { detail }); +event.detail.value = true; +if (detail.value) console.log('ok'); +else console.log('failed'); From 642e56626a6b610465617eb1007f352f79eb4b86 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Wed, 6 Sep 2023 07:48:51 +0200 Subject: [PATCH 03/10] 3.29.0 --- CHANGELOG.md | 22 ++++++++++++++++++++++ browser/package.json | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cbce95e0a..b93b9b67b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,27 @@ # rollup changelog +## 3.29.0 + +_2023-09-06_ + +### Features + +- Add output.sourcemapFileNames option (#5105) +- Add generic type parameter for `api` to Plugin type (#5112) + +### Bug Fixes + +- Ensure mutations of CustomEvent details are tracked (#5123) + +### Pull Requests + +- [#5105](https://github.com/rollup/rollup/pull/5105): Added option to name sourcemap files, i.e. a output.sourcemapFileName… (@atti187) +- [#5108](https://github.com/rollup/rollup/pull/5108): chore(deps): lock file maintenance minor/patch updates (@renovate[bot]) +- [#5109](https://github.com/rollup/rollup/pull/5109): Docs: load full path of rollup.browser.js for Rollup V4 (@TrickyPi) +- [#5112](https://github.com/rollup/rollup/pull/5112): feat(types): add generic type for plugin api (@sxzz) +- [#5115](https://github.com/rollup/rollup/pull/5115): chore(deps): lock file maintenance minor/patch updates (@renovate[bot]) +- [#5123](https://github.com/rollup/rollup/pull/5123): Deoptimize custom event detail (@lukastaegert) + ## 3.28.1 _2023-08-22_ diff --git a/browser/package.json b/browser/package.json index 5840865d6..18937dff1 100644 --- a/browser/package.json +++ b/browser/package.json @@ -1,6 +1,6 @@ { "name": "@rollup/browser", - "version": "3.28.1", + "version": "3.29.0", "description": "Next-generation ES module bundler browser build", "main": "dist/rollup.browser.js", "module": "dist/es/rollup.browser.js", diff --git a/package-lock.json b/package-lock.json index 1dc507ecf..236000795 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rollup", - "version": "3.28.1", + "version": "3.29.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rollup", - "version": "3.28.1", + "version": "3.29.0", "license": "MIT", "bin": { "rollup": "dist/bin/rollup" diff --git a/package.json b/package.json index 5ededb2bd..7998e2dbd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rollup", - "version": "3.28.1", + "version": "3.29.0", "description": "Next-generation ES module bundler", "main": "dist/rollup.js", "module": "dist/es/rollup.js", From e871ad822c0a4fa8eaf8a66199b46738750d9b62 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 8 Sep 2023 09:11:07 +0200 Subject: [PATCH 04/10] chore(deps): update actions/checkout action to v4 (#5125) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/clean-cache.yml | 2 +- .github/workflows/repl-artefacts.yml | 2 +- .github/workflows/tests.yml | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/clean-cache.yml b/.github/workflows/clean-cache.yml index 7a085d8c7..17e217152 100644 --- a/.github/workflows/clean-cache.yml +++ b/.github/workflows/clean-cache.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Cleanup run: | gh extension install actions/gh-actions-cache diff --git a/.github/workflows/repl-artefacts.yml b/.github/workflows/repl-artefacts.yml index 43034ba93..cacbe359b 100644 --- a/.github/workflows/repl-artefacts.yml +++ b/.github/workflows/repl-artefacts.yml @@ -21,7 +21,7 @@ jobs: name: Upload steps: - name: Checkout Commit - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: refs/pull/${{ github.event.number }}/merge - name: Setup Node diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 330ddfb64..8d4a2cb45 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,7 +18,7 @@ jobs: name: Node 18 + Coverage (Linux) steps: - name: Checkout Commit - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha }} - name: Setup Node @@ -50,7 +50,7 @@ jobs: name: Node 16 + Extra Tests (Linux) steps: - name: Checkout Commit - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node uses: actions/setup-node@v3 with: @@ -82,7 +82,7 @@ jobs: name: Node ${{ matrix.node }} (Linux) steps: - name: Checkout Commit - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node uses: actions/setup-node@v3 with: @@ -110,7 +110,7 @@ jobs: name: Node ${{ matrix.node }} (macOS) steps: - name: Checkout Commit - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node uses: actions/setup-node@v3 with: @@ -141,7 +141,7 @@ jobs: name: Node ${{ matrix.node }} (Windows) steps: - name: Checkout Commit - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Node uses: actions/setup-node@v3 with: From 6cb637d07e552c159bcf124dbdf1078a51ef8107 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 8 Sep 2023 11:34:08 +0200 Subject: [PATCH 05/10] chore(deps): lock file maintenance minor/patch updates (#5126) * chore(deps): lock file maintenance minor/patch updates * Fix test --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Lukas Taegert-Atkinson --- package-lock.json | 549 +++++++++--------- package.json | 16 +- .../samples/supports-core-js/_expected.js | 52 +- 3 files changed, 321 insertions(+), 296 deletions(-) diff --git a/package-lock.json b/package-lock.json index 236000795..1d52ac033 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,9 +17,9 @@ "@codemirror/language": "^6.9.0", "@codemirror/search": "^6.5.2", "@codemirror/state": "^6.2.1", - "@codemirror/view": "^6.17.0", + "@codemirror/view": "^6.17.1", "@jridgewell/sourcemap-codec": "^1.4.15", - "@mermaid-js/mermaid-cli": "^10.3.1", + "@mermaid-js/mermaid-cli": "^10.4.0", "@rollup/plugin-alias": "^5.0.0", "@rollup/plugin-buble": "^1.0.2", "@rollup/plugin-commonjs": "^25.0.4", @@ -31,10 +31,10 @@ "@rollup/pluginutils": "^5.0.4", "@types/estree": "1.0.1", "@types/mocha": "^10.0.1", - "@types/node": "~14.18.56", + "@types/node": "~14.18.58", "@types/yargs-parser": "^21.0.0", - "@typescript-eslint/eslint-plugin": "^6.5.0", - "@typescript-eslint/parser": "^6.5.0", + "@typescript-eslint/eslint-plugin": "^6.6.0", + "@typescript-eslint/parser": "^6.6.0", "@vue/eslint-config-prettier": "^8.0.0", "@vue/eslint-config-typescript": "^11.0.3", "acorn": "^8.10.0", @@ -70,12 +70,12 @@ "mocha": "^10.2.0", "nyc": "^15.1.0", "pinia": "^2.1.6", - "prettier": "^3.0.2", + "prettier": "^3.0.3", "pretty-bytes": "^6.1.1", "pretty-ms": "^8.0.0", "requirejs": "^2.3.6", "rollup": "^3.28.1", - "rollup-plugin-license": "^3.0.1", + "rollup-plugin-license": "^3.1.0", "rollup-plugin-string": "^3.0.0", "rollup-plugin-thatworks": "^1.0.4", "semver": "^7.5.4", @@ -84,7 +84,7 @@ "source-map": "^0.7.4", "source-map-support": "^0.5.21", "systemjs": "^6.14.2", - "terser": "^5.19.2", + "terser": "^5.19.4", "tslib": "^2.6.2", "typescript": "^5.2.2", "vite": "^4.4.9", @@ -298,12 +298,12 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.10.tgz", - "integrity": "sha512-/KKIMG4UEL35WmI9OlvMhurwtytjvXoFcGNrOvyG9zIzA8YmPjVtIZUf7b05+TPO7G7/GEmLHDaoCgACHl9hhA==", + "version": "7.22.13", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz", + "integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==", "dev": true, "dependencies": { - "@babel/highlight": "^7.22.10", + "@babel/highlight": "^7.22.13", "chalk": "^2.4.2" }, "engines": { @@ -376,21 +376,21 @@ } }, "node_modules/@babel/core": { - "version": "7.22.11", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.22.11.tgz", - "integrity": "sha512-lh7RJrtPdhibbxndr6/xx0w8+CVlY5FJZiaSz908Fpy+G0xkBFTvwLcKJFF4PJxVfGhVWNebikpWGnOoC71juQ==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.22.15.tgz", + "integrity": "sha512-PtZqMmgRrvj8ruoEOIwVA3yoF91O+Hgw9o7DAUTNBA6Mo2jpu31clx9a7Nz/9JznqetTR6zwfC4L3LAjKQXUwA==", "dev": true, "dependencies": { "@ampproject/remapping": "^2.2.0", - "@babel/code-frame": "^7.22.10", - "@babel/generator": "^7.22.10", - "@babel/helper-compilation-targets": "^7.22.10", - "@babel/helper-module-transforms": "^7.22.9", - "@babel/helpers": "^7.22.11", - "@babel/parser": "^7.22.11", - "@babel/template": "^7.22.5", - "@babel/traverse": "^7.22.11", - "@babel/types": "^7.22.11", + "@babel/code-frame": "^7.22.13", + "@babel/generator": "^7.22.15", + "@babel/helper-compilation-targets": "^7.22.15", + "@babel/helper-module-transforms": "^7.22.15", + "@babel/helpers": "^7.22.15", + "@babel/parser": "^7.22.15", + "@babel/template": "^7.22.15", + "@babel/traverse": "^7.22.15", + "@babel/types": "^7.22.15", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -406,12 +406,12 @@ } }, "node_modules/@babel/generator": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.22.10.tgz", - "integrity": "sha512-79KIf7YiWjjdZ81JnLujDRApWtl7BxTqWD88+FFdQEIOG8LJ0etDOM7CXuIgGJa55sGOwZVwuEsaLEm0PJ5/+A==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.22.15.tgz", + "integrity": "sha512-Zu9oWARBqeVOW0dZOjXc3JObrzuqothQ3y/n1kUtrjCoCPLkXUwMvOo/F/TCfoHMbWIFlWwpZtkZVb9ga4U2pA==", "dev": true, "dependencies": { - "@babel/types": "^7.22.10", + "@babel/types": "^7.22.15", "@jridgewell/gen-mapping": "^0.3.2", "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" @@ -433,13 +433,13 @@ } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.10.tgz", - "integrity": "sha512-JMSwHD4J7SLod0idLq5PKgI+6g/hLD/iuWBq08ZX49xE14VpVEojJ5rHWptpirV2j020MvypRLAXAO50igCJ5Q==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.22.15.tgz", + "integrity": "sha512-y6EEzULok0Qvz8yyLkCvVX+02ic+By2UdOhylwUOvOn9dvYc9mKICJuuU1n1XBI02YWsNsnrY1kc6DVbjcXbtw==", "dev": true, "dependencies": { "@babel/compat-data": "^7.22.9", - "@babel/helper-validator-option": "^7.22.5", + "@babel/helper-validator-option": "^7.22.15", "browserslist": "^4.21.9", "lru-cache": "^5.1.1", "semver": "^6.3.1" @@ -483,28 +483,28 @@ } }, "node_modules/@babel/helper-module-imports": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.22.5.tgz", - "integrity": "sha512-8Dl6+HD/cKifutF5qGd/8ZJi84QeAKh+CEe1sBzz8UayBBGg1dAIJrdHOcOM5b2MpzWL2yuotJTtGjETq0qjXg==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz", + "integrity": "sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==", "dev": true, "dependencies": { - "@babel/types": "^7.22.5" + "@babel/types": "^7.22.15" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.22.9", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.22.9.tgz", - "integrity": "sha512-t+WA2Xn5K+rTeGtC8jCsdAH52bjggG5TKRuRrAGNM/mjIbO4GxvlLMFOEz9wXY5I2XQ60PMFsAG2WIcG82dQMQ==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.22.15.tgz", + "integrity": "sha512-l1UiX4UyHSFsYt17iQ3Se5pQQZZHa22zyIXURmvkmLCD4t/aU+dvNWHatKac/D9Vm9UES7nvIqHs4jZqKviUmQ==", "dev": true, "dependencies": { "@babel/helper-environment-visitor": "^7.22.5", - "@babel/helper-module-imports": "^7.22.5", + "@babel/helper-module-imports": "^7.22.15", "@babel/helper-simple-access": "^7.22.5", "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/helper-validator-identifier": "^7.22.5" + "@babel/helper-validator-identifier": "^7.22.15" }, "engines": { "node": ">=6.9.0" @@ -547,41 +547,41 @@ } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.5.tgz", - "integrity": "sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.15.tgz", + "integrity": "sha512-4E/F9IIEi8WR94324mbDUMo074YTheJmd7eZF5vITTeYchqAi6sYXRLHUVsmkdmY4QjfKTcB2jB7dVP3NaBElQ==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-option": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.22.5.tgz", - "integrity": "sha512-R3oB6xlIVKUnxNUxbmgq7pKjxpru24zlimpE8WK47fACIlM0II/Hm1RS8IaOI7NgCr6LNS+jl5l75m20npAziw==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.22.15.tgz", + "integrity": "sha512-bMn7RmyFjY/mdECUbgn9eoSY4vqvacUnS9i9vGAGttgFWesO6B4CYWA7XlpbWgBt71iv/hfbPlynohStqnu5hA==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helpers": { - "version": "7.22.11", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.22.11.tgz", - "integrity": "sha512-vyOXC8PBWaGc5h7GMsNx68OH33cypkEDJCHvYVVgVbbxJDROYVtexSk0gK5iCF1xNjRIN2s8ai7hwkWDq5szWg==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.22.15.tgz", + "integrity": "sha512-7pAjK0aSdxOwR+CcYAqgWOGy5dcfvzsTIfFTb2odQqW47MDfv14UaJDY6eng8ylM2EaeKXdxaSWESbkmaQHTmw==", "dev": true, "dependencies": { - "@babel/template": "^7.22.5", - "@babel/traverse": "^7.22.11", - "@babel/types": "^7.22.11" + "@babel/template": "^7.22.15", + "@babel/traverse": "^7.22.15", + "@babel/types": "^7.22.15" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/highlight": { - "version": "7.22.10", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.10.tgz", - "integrity": "sha512-78aUtVcT7MUscr0K5mIEnkwxPE0MaxkR5RxRwuHaQ+JuU5AmTPhY+do2mdzVTnIJJpyBglql2pehuBIWHug+WQ==", + "version": "7.22.13", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.13.tgz", + "integrity": "sha512-C/BaXcnnvBCmHTpz/VGZ8jgtE2aYlW4hxDhseJAWZb7gqGM/qtCK6iZUb0TyKFf7BOUsBH7Q7fkRsDRhg1XklQ==", "dev": true, "dependencies": { "@babel/helper-validator-identifier": "^7.22.5", @@ -649,9 +649,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.22.11", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.11.tgz", - "integrity": "sha512-R5zb8eJIBPJriQtbH/htEQy4k7E2dHWlD2Y2VT07JCzwYZHBxV5ZYtM0UhXSNMT74LyxuM+b1jdL7pSesXbC/g==", + "version": "7.22.16", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.16.tgz", + "integrity": "sha512-+gPfKv8UWeKKeJTUxe59+OobVcrYHETCsORl61EmSkmgymguYk/X5bp7GuUIXaFsc6y++v8ZxPsLSSuujqDphA==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -661,9 +661,9 @@ } }, "node_modules/@babel/runtime": { - "version": "7.22.11", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.22.11.tgz", - "integrity": "sha512-ee7jVNlWN09+KftVOu9n7S8gQzD/Z6hN/I8VBRXW4P1+Xe7kJGXMwu8vds4aGIMHZnNbdpSWCfZZtinytpcAvA==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.22.15.tgz", + "integrity": "sha512-T0O+aa+4w0u06iNmapipJXMV4HoUir03hpx3/YqXXhu9xim3w+dVphjFWl1OH8NbZHw5Lbm9k45drDkgq2VNNA==", "dev": true, "dependencies": { "regenerator-runtime": "^0.14.0" @@ -673,33 +673,33 @@ } }, "node_modules/@babel/template": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.5.tgz", - "integrity": "sha512-X7yV7eiwAxdj9k94NEylvbVHLiVG1nvzCV2EAowhxLTwODV1jl9UzZ48leOC0sH7OnuHrIkllaBgneUykIcZaw==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", + "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.22.5", - "@babel/parser": "^7.22.5", - "@babel/types": "^7.22.5" + "@babel/code-frame": "^7.22.13", + "@babel/parser": "^7.22.15", + "@babel/types": "^7.22.15" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.22.11", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.22.11.tgz", - "integrity": "sha512-mzAenteTfomcB7mfPtyi+4oe5BZ6MXxWcn4CX+h4IRJ+OOGXBrWU6jDQavkQI9Vuc5P+donFabBfFCcmWka9lQ==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.22.15.tgz", + "integrity": "sha512-DdHPwvJY0sEeN4xJU5uRLmZjgMMDIvMPniLuYzUVXj/GGzysPl0/fwt44JBkyUIzGJPV8QgHMcQdQ34XFuKTYQ==", "dev": true, "dependencies": { - "@babel/code-frame": "^7.22.10", - "@babel/generator": "^7.22.10", + "@babel/code-frame": "^7.22.13", + "@babel/generator": "^7.22.15", "@babel/helper-environment-visitor": "^7.22.5", "@babel/helper-function-name": "^7.22.5", "@babel/helper-hoist-variables": "^7.22.5", "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/parser": "^7.22.11", - "@babel/types": "^7.22.11", + "@babel/parser": "^7.22.15", + "@babel/types": "^7.22.15", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -717,13 +717,13 @@ } }, "node_modules/@babel/types": { - "version": "7.22.11", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.22.11.tgz", - "integrity": "sha512-siazHiGuZRz9aB9NpHy9GOs9xiQPKnMzgdr493iI1M67vRXpnEq8ZOOKzezC5q7zwuQ6sDhdSp4SD9ixKSqKZg==", + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.22.15.tgz", + "integrity": "sha512-X+NLXr0N8XXmN5ZsaQdm9U2SSC3UbIYq/doL++sueHOTisgZHoKaQtZxGuV2cUPQHMfjKEfg/g6oy7Hm6SKFtA==", "dev": true, "dependencies": { "@babel/helper-string-parser": "^7.22.5", - "@babel/helper-validator-identifier": "^7.22.5", + "@babel/helper-validator-identifier": "^7.22.15", "to-fast-properties": "^2.0.0" }, "engines": { @@ -790,9 +790,9 @@ } }, "node_modules/@codemirror/lint": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/@codemirror/lint/-/lint-6.4.0.tgz", - "integrity": "sha512-6VZ44Ysh/Zn07xrGkdtNfmHCbGSHZzFBdzWi0pbd7chAQ/iUcpLGX99NYRZTa7Ugqg4kEHCqiHhcZnH0gLIgSg==", + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/@codemirror/lint/-/lint-6.4.1.tgz", + "integrity": "sha512-2Hx945qKX7FBan5/gUdTM8fsMYrNG9clIgEcPXestbLVFAUyQYFAuju/5BMNf/PwgpVaX5pvRm4+ovjbp9D9gQ==", "dev": true, "dependencies": { "@codemirror/state": "^6.0.0", @@ -818,9 +818,9 @@ "dev": true }, "node_modules/@codemirror/view": { - "version": "6.17.1", - "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.17.1.tgz", - "integrity": "sha512-I5KVxsLbm1f56n9SUajLW0/AzMXYEZVvkiYahMw/yGl5gUjT2WquuKO39xUtiT4z/hNhGD7YuAEVPI8u0mncaQ==", + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.18.0.tgz", + "integrity": "sha512-T6q1yYAoU+gSWfJFR4ryvDQcyOqS+Mw5RCvh26y0KiNksOOLYhNvdB3BTyLz8vy4fKaYlzbAOyBU7OQPUGHzjQ==", "dev": true, "dependencies": { "@codemirror/state": "^6.1.4", @@ -1244,9 +1244,9 @@ } }, "node_modules/@eslint-community/regexpp": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.7.0.tgz", - "integrity": "sha512-+HencqxU7CFJnQb7IKtuNBqS6Yx3Tz4kOL8BJXo+JyeiBm5MEX6pO8onXDkjrkCRlfYXS1Axro15ZjVFe9YgsA==", + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.8.0.tgz", + "integrity": "sha512-JylOEEzDiOryeUnFbQz+oViCXS0KsvR1mvHkoMiu5+UiBvy+RYX7tzlIIIEstF/gVa2tj9AQXk3dgnxv6KxhFg==", "dev": true, "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" @@ -1285,9 +1285,9 @@ } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz", - "integrity": "sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==", + "version": "0.11.11", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz", + "integrity": "sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA==", "dev": true, "dependencies": { "@humanwhocodes/object-schema": "^1.2.1", @@ -1527,9 +1527,9 @@ } }, "node_modules/@mermaid-js/mermaid-cli": { - "version": "10.3.1", - "resolved": "https://registry.npmjs.org/@mermaid-js/mermaid-cli/-/mermaid-cli-10.3.1.tgz", - "integrity": "sha512-38MNsaqsie5v6urP0Sc8+nSEUDEbYONqHwqeE8vn9O8Sjvdj60G1GBN3UJPo2f+O2eReqzzq8LGRveKzJjdykQ==", + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/@mermaid-js/mermaid-cli/-/mermaid-cli-10.4.0.tgz", + "integrity": "sha512-sXohfGD6xgR8VEKvLdvSCndFaFNVTlyXjgZlJ3x8U3/J0V2VTfLIZO94Gt8KUPUccFWci8dRYDGG0fQerB+aIA==", "dev": true, "dependencies": { "chalk": "^5.0.1", @@ -1956,9 +1956,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "14.18.56", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.56.tgz", - "integrity": "sha512-+k+57NVS9opgrEn5l9c0gvD1r6C+PtyhVE4BTnMMRwiEA8ZO8uFcs6Yy2sXIy0eC95ZurBtRSvhZiHXBysbl6w==", + "version": "14.18.58", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.58.tgz", + "integrity": "sha512-Y8ETZc8afYf6lQ/mVp096phIVsgD/GmDxtm3YaPcc+71jmi/J6zdwbwaUU4JvS56mq6aSfbpkcKhQ5WugrWFPw==", "dev": true }, "node_modules/@types/normalize-package-data": { @@ -1984,9 +1984,9 @@ } }, "node_modules/@types/semver": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.0.tgz", - "integrity": "sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==", + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.1.tgz", + "integrity": "sha512-cJRQXpObxfNKkFAZbJl2yjWtJCqELQIdShsogr1d2MilP8dKD9TE/nEKHkJgUNHdGKCQaf9HbIynuV2csLGVLg==", "dev": true }, "node_modules/@types/web-bluetooth": { @@ -2012,16 +2012,16 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.5.0.tgz", - "integrity": "sha512-2pktILyjvMaScU6iK3925uvGU87E+N9rh372uGZgiMYwafaw9SXq86U04XPq3UH6tzRvNgBsub6x2DacHc33lw==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.6.0.tgz", + "integrity": "sha512-CW9YDGTQnNYMIo5lMeuiIG08p4E0cXrXTbcZ2saT/ETE7dWUrNxlijsQeU04qAAKkILiLzdQz+cGFxCJjaZUmA==", "dev": true, "dependencies": { "@eslint-community/regexpp": "^4.5.1", - "@typescript-eslint/scope-manager": "6.5.0", - "@typescript-eslint/type-utils": "6.5.0", - "@typescript-eslint/utils": "6.5.0", - "@typescript-eslint/visitor-keys": "6.5.0", + "@typescript-eslint/scope-manager": "6.6.0", + "@typescript-eslint/type-utils": "6.6.0", + "@typescript-eslint/utils": "6.6.0", + "@typescript-eslint/visitor-keys": "6.6.0", "debug": "^4.3.4", "graphemer": "^1.4.0", "ignore": "^5.2.4", @@ -2047,15 +2047,15 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.5.0.tgz", - "integrity": "sha512-LMAVtR5GN8nY0G0BadkG0XIe4AcNMeyEy3DyhKGAh9k4pLSMBO7rF29JvDBpZGCmp5Pgz5RLHP6eCpSYZJQDuQ==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.6.0.tgz", + "integrity": "sha512-setq5aJgUwtzGrhW177/i+DMLqBaJbdwGj2CPIVFFLE0NCliy5ujIdLHd2D1ysmlmsjdL2GWW+hR85neEfc12w==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "6.5.0", - "@typescript-eslint/types": "6.5.0", - "@typescript-eslint/typescript-estree": "6.5.0", - "@typescript-eslint/visitor-keys": "6.5.0", + "@typescript-eslint/scope-manager": "6.6.0", + "@typescript-eslint/types": "6.6.0", + "@typescript-eslint/typescript-estree": "6.6.0", + "@typescript-eslint/visitor-keys": "6.6.0", "debug": "^4.3.4" }, "engines": { @@ -2075,13 +2075,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.5.0.tgz", - "integrity": "sha512-A8hZ7OlxURricpycp5kdPTH3XnjG85UpJS6Fn4VzeoH4T388gQJ/PGP4ole5NfKt4WDVhmLaQ/dBLNDC4Xl/Kw==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.6.0.tgz", + "integrity": "sha512-pT08u5W/GT4KjPUmEtc2kSYvrH8x89cVzkA0Sy2aaOUIw6YxOIjA8ilwLr/1fLjOedX1QAuBpG9XggWqIIfERw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.5.0", - "@typescript-eslint/visitor-keys": "6.5.0" + "@typescript-eslint/types": "6.6.0", + "@typescript-eslint/visitor-keys": "6.6.0" }, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -2092,13 +2092,13 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.5.0.tgz", - "integrity": "sha512-f7OcZOkRivtujIBQ4yrJNIuwyCQO1OjocVqntl9dgSIZAdKqicj3xFDqDOzHDlGCZX990LqhLQXWRnQvsapq8A==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.6.0.tgz", + "integrity": "sha512-8m16fwAcEnQc69IpeDyokNO+D5spo0w1jepWWY2Q6y5ZKNuj5EhVQXjtVAeDDqvW6Yg7dhclbsz6rTtOvcwpHg==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "6.5.0", - "@typescript-eslint/utils": "6.5.0", + "@typescript-eslint/typescript-estree": "6.6.0", + "@typescript-eslint/utils": "6.6.0", "debug": "^4.3.4", "ts-api-utils": "^1.0.1" }, @@ -2119,9 +2119,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.5.0.tgz", - "integrity": "sha512-eqLLOEF5/lU8jW3Bw+8auf4lZSbbljHR2saKnYqON12G/WsJrGeeDHWuQePoEf9ro22+JkbPfWQwKEC5WwLQ3w==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.6.0.tgz", + "integrity": "sha512-CB6QpJQ6BAHlJXdwUmiaXDBmTqIE2bzGTDLADgvqtHWuhfNP3rAOK7kAgRMAET5rDRr9Utt+qAzRBdu3AhR3sg==", "dev": true, "engines": { "node": "^16.0.0 || >=18.0.0" @@ -2132,13 +2132,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.5.0.tgz", - "integrity": "sha512-q0rGwSe9e5Kk/XzliB9h2LBc9tmXX25G0833r7kffbl5437FPWb2tbpIV9wAATebC/018pGa9fwPDuvGN+LxWQ==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.6.0.tgz", + "integrity": "sha512-hMcTQ6Al8MP2E6JKBAaSxSVw5bDhdmbCEhGW/V8QXkb9oNsFkA4SBuOMYVPxD3jbtQ4R/vSODBsr76R6fP3tbA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.5.0", - "@typescript-eslint/visitor-keys": "6.5.0", + "@typescript-eslint/types": "6.6.0", + "@typescript-eslint/visitor-keys": "6.6.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -2159,17 +2159,17 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.5.0.tgz", - "integrity": "sha512-9nqtjkNykFzeVtt9Pj6lyR9WEdd8npPhhIPM992FWVkZuS6tmxHfGVnlUcjpUP2hv8r4w35nT33mlxd+Be1ACQ==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.6.0.tgz", + "integrity": "sha512-mPHFoNa2bPIWWglWYdR0QfY9GN0CfvvXX1Sv6DlSTive3jlMTUy+an67//Gysc+0Me9pjitrq0LJp0nGtLgftw==", "dev": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@types/json-schema": "^7.0.12", "@types/semver": "^7.5.0", - "@typescript-eslint/scope-manager": "6.5.0", - "@typescript-eslint/types": "6.5.0", - "@typescript-eslint/typescript-estree": "6.5.0", + "@typescript-eslint/scope-manager": "6.6.0", + "@typescript-eslint/types": "6.6.0", + "@typescript-eslint/typescript-estree": "6.6.0", "semver": "^7.5.4" }, "engines": { @@ -2184,12 +2184,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.5.0.tgz", - "integrity": "sha512-yCB/2wkbv3hPsh02ZS8dFQnij9VVQXJMN/gbQsaaY+zxALkZnxa/wagvLEFsAWMPv7d7lxQmNsIzGU1w/T/WyA==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.6.0.tgz", + "integrity": "sha512-L61uJT26cMOfFQ+lMZKoJNbAEckLe539VhTxiGHrWl5XSKQgA0RTBZJW2HFPy5T0ZvPVSD93QsrTKDkfNwJGyQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "6.5.0", + "@typescript-eslint/types": "6.6.0", "eslint-visitor-keys": "^3.4.1" }, "engines": { @@ -2983,15 +2983,15 @@ } }, "node_modules/array-includes": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.6.tgz", - "integrity": "sha512-sgTbLvL6cNnw24FnbaDyjmvddQ2ML8arZsgaJhoABMoplz/4QRhtrYS+alr1BUM1Bwp6dhx8vVCBSLG+StwOFw==", + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.7.tgz", + "integrity": "sha512-dlcsNBIiWhPkHdOEEKnehA+RNUWDc4UqFtnIXU4uuYDPtA4LDkr7qip2p0VvFAEXNDr0yWZ9PJyIRiGjRLQzwQ==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.20.4", - "get-intrinsic": "^1.1.3", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "get-intrinsic": "^1.2.1", "is-string": "^1.0.7" }, "engines": { @@ -3011,16 +3011,16 @@ } }, "node_modules/array.prototype.findlastindex": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.2.tgz", - "integrity": "sha512-tb5thFFlUcp7NdNF6/MpDk/1r/4awWG1FIz3YqDf+/zJSTezBb+/5WViH41obXULHVpDzoiCLpJ/ZO9YbJMsdw==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.3.tgz", + "integrity": "sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.20.4", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", "es-shim-unscopables": "^1.0.0", - "get-intrinsic": "^1.1.3" + "get-intrinsic": "^1.2.1" }, "engines": { "node": ">= 0.4" @@ -3030,14 +3030,14 @@ } }, "node_modules/array.prototype.flat": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.1.tgz", - "integrity": "sha512-roTU0KWIOmJ4DRLmwKd19Otg0/mT3qPNt0Qb3GWW8iObuZXxrjB/pzn0R3hqpRSWg4HCwqx+0vwOnWnvlOyeIA==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz", + "integrity": "sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.20.4", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", "es-shim-unscopables": "^1.0.0" }, "engines": { @@ -3048,14 +3048,14 @@ } }, "node_modules/array.prototype.flatmap": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.1.tgz", - "integrity": "sha512-8UGn9O1FDVvMNB0UlLv4voxRMze7+FpHyF5mSMRjWHUMlpoDViniy05870VlxhfgTnLbpuwTzvD76MTtWxB/mQ==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz", + "integrity": "sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.20.4", + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", "es-shim-unscopables": "^1.0.0" }, "engines": { @@ -3066,14 +3066,15 @@ } }, "node_modules/arraybuffer.prototype.slice": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.1.tgz", - "integrity": "sha512-09x0ZWFEjj4WD8PDbykUwo3t9arLn8NIzmmYEJFpYekOAQjpkGSyrQhNoRTcwwcFRu+ycWF78QZ63oWTqSjBcw==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.2.tgz", + "integrity": "sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw==", "dev": true, "dependencies": { "array-buffer-byte-length": "^1.0.0", "call-bind": "^1.0.2", "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", "get-intrinsic": "^1.2.1", "is-array-buffer": "^3.0.2", "is-shared-array-buffer": "^1.0.2" @@ -3457,9 +3458,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001522", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001522.tgz", - "integrity": "sha512-TKiyTVZxJGhsTszLuzb+6vUZSjVOAhClszBr2Ta2k9IwtNBT/4dzmL6aywt0HCgEZlmwJzXJd8yNiob6HgwTRg==", + "version": "1.0.30001529", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001529.tgz", + "integrity": "sha512-n2pUQYGAkrLG4QYj2desAh+NqsJpHbNmVZz87imptDdxLAtjxary7Df/psdfyDGmskJK/9Dt9cPnx5RZ3CU4Og==", "dev": true, "funding": [ { @@ -3899,9 +3900,9 @@ "dev": true }, "node_modules/core-js": { - "version": "3.32.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.32.1.tgz", - "integrity": "sha512-lqufgNn9NLnESg5mQeYsxQP5w7wrViSj0jr/kv6ECQiByzQkrn1MKvV0L3acttpDqfQrHLwr2KCMgX5b8X+lyQ==", + "version": "3.32.2", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.32.2.tgz", + "integrity": "sha512-pxXSw1mYZPDGvTQqEc5vgIb83jGQKFGYWY76z4a7weZXUolw3G+OvpZqSRcfYOoOVUQJYEPsWeQK8pKEnUtWxQ==", "dev": true, "hasInstallScript": true, "funding": { @@ -4181,9 +4182,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.4.502", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.502.tgz", - "integrity": "sha512-xqeGw3Gr6o3uyHy/yKjdnDQHY2RQvXcGC2cfHjccK1IGkH6cX1WQBN8EeC/YpwPhGkBaikDTecJ8+ssxSVRQlw==", + "version": "1.4.512", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.512.tgz", + "integrity": "sha512-1W8wRbYlQE4ph7eoj3TJ+uqwO6+xvAE/L+KGU7WTQQvX3tnSIGZAb90MTsMoJqzntamiwJhBAj4WZmygXhsOUg==", "dev": true }, "node_modules/emoji-regex": { @@ -5081,16 +5082,17 @@ } }, "node_modules/flat-cache": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", - "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.1.0.tgz", + "integrity": "sha512-OHx4Qwrrt0E4jEIcI5/Xb+f+QmJYNj2rrK8wiIdQOIrB9WrrJL8cjZvXdXuBTkkEwEqLycb5BeZDV1o2i9bTew==", "dev": true, "dependencies": { - "flatted": "^3.1.0", + "flatted": "^3.2.7", + "keyv": "^4.5.3", "rimraf": "^3.0.2" }, "engines": { - "node": "^10.12.0 || >=12.0.0" + "node": ">=12.0.0" } }, "node_modules/flatted": { @@ -5231,15 +5233,15 @@ "dev": true }, "node_modules/function.prototype.name": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz", - "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==", + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.6.tgz", + "integrity": "sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "es-abstract": "^1.19.0", - "functions-have-names": "^1.2.2" + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1", + "functions-have-names": "^1.2.3" }, "engines": { "node": ">= 0.4" @@ -6417,6 +6419,12 @@ "node": ">=6" } }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", @@ -6465,6 +6473,15 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/keyv": { + "version": "4.5.3", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.3.tgz", + "integrity": "sha512-QCiSav9WaX1PgETJ+SpNnx2PRRapJ/oRSXM4VO5OGYGSjrxbKPVFVhB3l2OCbLCk329N8qyAtsJjSjvVBWzEug==", + "dev": true, + "dependencies": { + "json-buffer": "3.0.1" + } + }, "node_modules/levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -7067,15 +7084,18 @@ "dev": true }, "node_modules/mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.1.tgz", + "integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==", "dev": true, "bin": { - "mkdirp": "bin/cmd.js" + "mkdirp": "dist/cjs/src/bin.js" }, "engines": { "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/mkdirp-classic": { @@ -7355,9 +7375,9 @@ } }, "node_modules/node-gyp-build": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.0.tgz", - "integrity": "sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==", + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.6.1.tgz", + "integrity": "sha512-24vnklJmyRS8ViBNI8KbtK/r/DmXQMRiOMXTNz2nrTnAYUwjmEEbnnpB/+kt+yWRv73bPsSPRFddrcIbAxSiMQ==", "dev": true, "bin": { "node-gyp-build": "bin.js", @@ -7660,14 +7680,14 @@ } }, "node_modules/object.fromentries": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.6.tgz", - "integrity": "sha512-VciD13dswC4j1Xt5394WR4MzmAQmlgN72phd/riNp9vtD7tp4QQWJ0R4wvclXcafgcYK8veHRed2W6XeGBvcfg==", + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.7.tgz", + "integrity": "sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.20.4" + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" }, "engines": { "node": ">= 0.4" @@ -7677,26 +7697,26 @@ } }, "node_modules/object.groupby": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.0.tgz", - "integrity": "sha512-70MWG6NfRH9GnbZOikuhPPYzpUpof9iW2J9E4dW7FXTqPNb6rllE6u39SKwwiNh8lCwX3DDb5OgcKGiEBrTTyw==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.1.tgz", + "integrity": "sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ==", "dev": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.2.0", - "es-abstract": "^1.21.2", + "es-abstract": "^1.22.1", "get-intrinsic": "^1.2.1" } }, "node_modules/object.values": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.6.tgz", - "integrity": "sha512-FVVTkD1vENCsAcwNs9k6jea2uHC/X0+JcjG8YA60FN5CMaJmG95wT9jek/xX9nornqGRrBkKtzuAu2wuHpKqvw==", + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.7.tgz", + "integrity": "sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.20.4" + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" }, "engines": { "node": ">= 0.4" @@ -8094,9 +8114,9 @@ } }, "node_modules/pinia/node_modules/vue-demi": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.5.tgz", - "integrity": "sha512-o9NUVpl/YlsGJ7t+xuqJKx8EBGf1quRhCiT6D/J0pfwmk9zUwYkC7yrF4SZCe6fETvSM3UNL2edcbYrSyc4QHA==", + "version": "0.14.6", + "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.6.tgz", + "integrity": "sha512-8QA7wrYSHKaYgUxDA5ZC24w+eHm3sYCbp0EzcDwKqN3p6HqtTCGR/GVsPyZW92unff4UlcSh++lmqDWN3ZIq4w==", "dev": true, "hasInstallScript": true, "bin": { @@ -8193,9 +8213,9 @@ } }, "node_modules/postcss": { - "version": "8.4.28", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.28.tgz", - "integrity": "sha512-Z7V5j0cq8oEKyejIKfpD8b4eBy9cwW2JWPk0+fB1HOAMsfHbnAXLLS+PfVWlzMSLQaWttKDt607I0XHmpE67Vw==", + "version": "8.4.29", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.29.tgz", + "integrity": "sha512-cbI+jaqIeu/VGqXEarWkRCCffhjgXc0qjBtXpqJhTBohMUjUQnbBr0xqX3vEKudc4iviTewcJo5ajcec5+wdJw==", "dev": true, "funding": [ { @@ -8271,9 +8291,9 @@ } }, "node_modules/prettier": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.2.tgz", - "integrity": "sha512-o2YR9qtniXvwEZlOKbveKfDQVyqxbEIWn48Z8m3ZJjBjcCmUy3xZGIv+7AkaeuaTr6yPXJjwv07ZWlsWbEy1rQ==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.3.tgz", + "integrity": "sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==", "dev": true, "bin": { "prettier": "bin/prettier.cjs" @@ -8860,9 +8880,9 @@ } }, "node_modules/rollup": { - "version": "3.28.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.28.1.tgz", - "integrity": "sha512-R9OMQmIHJm9znrU3m3cpE8uhN0fGdXiawME7aZIpQqvpS/85+Vt1Hq1/yVIcYfOmaQiHjvXkQAoJukvLpau6Yw==", + "version": "3.29.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.29.0.tgz", + "integrity": "sha512-nszM8DINnx1vSS+TpbWKMkxem0CDWk3cSit/WWCBVs9/JZ1I/XLwOsiUglYuYReaeWWSsW9kge5zE5NZtf/a4w==", "dev": true, "bin": { "rollup": "dist/bin/rollup" @@ -8876,16 +8896,16 @@ } }, "node_modules/rollup-plugin-license": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/rollup-plugin-license/-/rollup-plugin-license-3.0.1.tgz", - "integrity": "sha512-/lec6Y94Y3wMfTDeYTO/jSXII0GQ/XkDZCiqkMKxyU5D5nGPaxr/2JNYvAgYsoCYuOLGOanKDPjCCQiTT96p7A==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-license/-/rollup-plugin-license-3.1.0.tgz", + "integrity": "sha512-Cny2H2hJ7K+VdcJkH1pNcYRVhqIhZNu/fPusedW53fNZQOIwpXiznJ220EFvDkJbFUEkLqIDsDB5bEr/N9qfqw==", "dev": true, "dependencies": { "commenting": "~1.1.0", "glob": "~7.2.0", "lodash": "~4.17.21", - "magic-string": "~0.26.2", - "mkdirp": "~1.0.4", + "magic-string": "~0.30.0", + "mkdirp": "~3.0.0", "moment": "~2.29.3", "package-name-regex": "~2.0.6", "spdx-expression-validate": "~2.0.0", @@ -8918,18 +8938,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/rollup-plugin-license/node_modules/magic-string": { - "version": "0.26.7", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.26.7.tgz", - "integrity": "sha512-hX9XH3ziStPoPhJxLq1syWuZMxbDvGNbVchfrdCtanC7D13888bMFow61x8axrx+GfHLtVeAx2kxL7tTGRl+Ow==", - "dev": true, - "dependencies": { - "sourcemap-codec": "^1.4.8" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/rollup-plugin-string": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/rollup-plugin-string/-/rollup-plugin-string-3.0.0.tgz", @@ -9115,13 +9123,13 @@ } }, "node_modules/safe-array-concat": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.0.0.tgz", - "integrity": "sha512-9dVEFruWIsnie89yym+xWTAYASdpw3CJV7Li/6zBewGf9z2i1j31rP6jnY0pHEO4QZh6N0K11bFjWmdR8UGdPQ==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.0.1.tgz", + "integrity": "sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "get-intrinsic": "^1.2.0", + "get-intrinsic": "^1.2.1", "has-symbols": "^1.0.3", "isarray": "^2.0.5" }, @@ -9173,14 +9181,11 @@ "dev": true }, "node_modules/search-insights": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/search-insights/-/search-insights-2.7.0.tgz", - "integrity": "sha512-GLbVaGgzYEKMvuJbHRhLi1qoBFnjXZGZ6l4LxOYPCp4lI2jDRB3jPU9/XNhMwv6kvnA9slTreq6pvK+b3o3aqg==", + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/search-insights/-/search-insights-2.8.2.tgz", + "integrity": "sha512-PxA9M5Q2bpBelVvJ3oDZR8nuY00Z6qwOxL53wNpgzV28M/D6u9WUbImDckjLSILBF8F1hn/mgyuUaOPtjow4Qw==", "dev": true, - "peer": true, - "engines": { - "node": ">=8.16.0" - } + "peer": true }, "node_modules/semver": { "version": "7.5.4", @@ -9308,9 +9313,9 @@ } }, "node_modules/shiki": { - "version": "0.14.3", - "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.14.3.tgz", - "integrity": "sha512-U3S/a+b0KS+UkTyMjoNojvTgrBHjgp7L6ovhFVZsXmBGnVdQ4K4U9oK0z63w538S91ATngv1vXigHCSWOwnr+g==", + "version": "0.14.4", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.14.4.tgz", + "integrity": "sha512-IXCRip2IQzKwxArNNq1S+On4KPML3Yyn8Zzs/xRgcgOWIr8ntIK3IKzjFPfjy/7kt9ZMjc+FItfqHRBg8b6tNQ==", "dev": true, "dependencies": { "ansi-sequence-parser": "^1.1.0", @@ -9585,14 +9590,14 @@ } }, "node_modules/string.prototype.trim": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.7.tgz", - "integrity": "sha512-p6TmeT1T3411M8Cgg9wBTMRtY2q9+PNy9EV1i2lIXUN/btt763oIfxwN3RR8VU6wHX8j/1CFy0L+YuThm6bgOg==", + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz", + "integrity": "sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.20.4" + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" }, "engines": { "node": ">= 0.4" @@ -9602,28 +9607,28 @@ } }, "node_modules/string.prototype.trimend": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.6.tgz", - "integrity": "sha512-JySq+4mrPf9EsDBEDYMOb/lM7XQLulwg5R/m1r0PXEFqrV0qHvl58sdTilSXtKOflCsK2E8jxf+GKC0T07RWwQ==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.7.tgz", + "integrity": "sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.20.4" + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" }, "funding": { "url": "https://github.com/sponsors/ljharb" } }, "node_modules/string.prototype.trimstart": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.6.tgz", - "integrity": "sha512-omqjMDaY92pbn5HOX7f9IccLA+U1tA9GvtU4JrodiXFfYB7jPzzHpRzpglLAjtUV6bB557zwClJezTqnAiYnQA==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.7.tgz", + "integrity": "sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.4", - "es-abstract": "^1.20.4" + "define-properties": "^1.2.0", + "es-abstract": "^1.22.1" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -9776,9 +9781,9 @@ } }, "node_modules/terser": { - "version": "5.19.2", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.19.2.tgz", - "integrity": "sha512-qC5+dmecKJA4cpYxRa5aVkKehYsQKc+AHeKl0Oe62aYjBL8ZA33tTljktDHJSaxxMnbI5ZYw+o/S2DxxLu8OfA==", + "version": "5.19.4", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.19.4.tgz", + "integrity": "sha512-6p1DjHeuluwxDXcuT9VR8p64klWJKo1ILiy19s6C9+0Bh2+NWTX6nD9EPppiER4ICkHDVB1RkVpin/YW2nQn/g==", "dev": true, "dependencies": { "@jridgewell/source-map": "^0.3.3", @@ -9918,9 +9923,9 @@ } }, "node_modules/ts-api-utils": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.2.tgz", - "integrity": "sha512-Cbu4nIqnEdd+THNEsBdkolnOXhg0I8XteoHaEKgvsxpsbWda4IsUut2c187HxywQCvveojow0Dgw/amxtSKVkQ==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.3.tgz", + "integrity": "sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==", "dev": true, "engines": { "node": ">=16.13.0" diff --git a/package.json b/package.json index 7998e2dbd..cef3efd60 100644 --- a/package.json +++ b/package.json @@ -71,9 +71,9 @@ "@codemirror/language": "^6.9.0", "@codemirror/search": "^6.5.2", "@codemirror/state": "^6.2.1", - "@codemirror/view": "^6.17.0", + "@codemirror/view": "^6.17.1", "@jridgewell/sourcemap-codec": "^1.4.15", - "@mermaid-js/mermaid-cli": "^10.3.1", + "@mermaid-js/mermaid-cli": "^10.4.0", "@rollup/plugin-alias": "^5.0.0", "@rollup/plugin-buble": "^1.0.2", "@rollup/plugin-commonjs": "^25.0.4", @@ -85,10 +85,10 @@ "@rollup/pluginutils": "^5.0.4", "@types/estree": "1.0.1", "@types/mocha": "^10.0.1", - "@types/node": "~14.18.56", + "@types/node": "~14.18.58", "@types/yargs-parser": "^21.0.0", - "@typescript-eslint/eslint-plugin": "^6.5.0", - "@typescript-eslint/parser": "^6.5.0", + "@typescript-eslint/eslint-plugin": "^6.6.0", + "@typescript-eslint/parser": "^6.6.0", "@vue/eslint-config-prettier": "^8.0.0", "@vue/eslint-config-typescript": "^11.0.3", "acorn": "^8.10.0", @@ -124,12 +124,12 @@ "mocha": "^10.2.0", "nyc": "^15.1.0", "pinia": "^2.1.6", - "prettier": "^3.0.2", + "prettier": "^3.0.3", "pretty-bytes": "^6.1.1", "pretty-ms": "^8.0.0", "requirejs": "^2.3.6", "rollup": "^3.28.1", - "rollup-plugin-license": "^3.0.1", + "rollup-plugin-license": "^3.1.0", "rollup-plugin-string": "^3.0.0", "rollup-plugin-thatworks": "^1.0.4", "semver": "^7.5.4", @@ -138,7 +138,7 @@ "source-map": "^0.7.4", "source-map-support": "^0.5.21", "systemjs": "^6.14.2", - "terser": "^5.19.2", + "terser": "^5.19.4", "tslib": "^2.6.2", "typescript": "^5.2.2", "vite": "^4.4.9", diff --git a/test/form/samples/supports-core-js/_expected.js b/test/form/samples/supports-core-js/_expected.js index b22049e5a..3935a61b9 100644 --- a/test/form/samples/supports-core-js/_expected.js +++ b/test/form/samples/supports-core-js/_expected.js @@ -333,10 +333,10 @@ var store$4 = sharedStore; (shared$b.exports = function (key, value) { return store$4[key] || (store$4[key] = value !== undefined ? value : {}); })('versions', []).push({ - version: '3.32.1', + version: '3.32.2', mode: 'global', copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)', - license: 'https://github.com/zloirock/core-js/blob/v3.32.1/LICENSE', + license: 'https://github.com/zloirock/core-js/blob/v3.32.2/LICENSE', source: 'https://github.com/zloirock/core-js' }); @@ -3139,7 +3139,9 @@ try { } catch (error) { /* empty */ } var checkCorrectnessOfIteration$4 = function (exec, SKIP_CLOSING) { - if (!SKIP_CLOSING && !SAFE_CLOSING) return false; + try { + if (!SKIP_CLOSING && !SAFE_CLOSING) return false; + } catch (error) { return false; } // workaround of old WebKit + `eval` bug var ITERATION_SUPPORT = false; try { var object = {}; @@ -3316,12 +3318,15 @@ var iteratorDefine = function (Iterable, NAME, IteratorConstructor, next, DEFAUL var getIterationMethod = function (KIND) { if (KIND === DEFAULT && defaultIterator) return defaultIterator; - if (!BUGGY_SAFARI_ITERATORS && KIND in IterablePrototype) return IterablePrototype[KIND]; + if (!BUGGY_SAFARI_ITERATORS && KIND && KIND in IterablePrototype) return IterablePrototype[KIND]; + switch (KIND) { case KEYS: return function keys() { return new IteratorConstructor(this, KIND); }; case VALUES: return function values() { return new IteratorConstructor(this, KIND); }; case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); }; - } return function () { return new IteratorConstructor(this); }; + } + + return function () { return new IteratorConstructor(this); }; }; var TO_STRING_TAG = NAME + ' Iterator'; @@ -4347,7 +4352,7 @@ var pack = function (number, mantissaLength, bytes) { exponent = eMax; } else if (exponent + eBias >= 1) { mantissa = roundToEven((number * c - 1) * pow$5(2, mantissaLength)); - exponent = exponent + eBias; + exponent += eBias; } else { mantissa = roundToEven(number * pow$5(2, eBias - 1) * pow$5(2, mantissaLength)); exponent = 0; @@ -4396,8 +4401,8 @@ var unpack = function (buffer, mantissaLength) { } else if (exponent === eMax) { return mantissa ? NaN : s ? -Infinity : Infinity; } else { - mantissa = mantissa + pow$5(2, mantissaLength); - exponent = exponent - eBias; + mantissa += pow$5(2, mantissaLength); + exponent -= eBias; } return (s ? -1 : 1) * mantissa * pow$5(2, exponent - mantissaLength); }; @@ -5920,6 +5925,7 @@ var exp$2 = Math.exp; // https://tc39.es/ecma262/#sec-math.expm1 var mathExpm1 = (!$expm1 // Old FF bug + // eslint-disable-next-line no-loss-of-precision -- required for old engines || $expm1(10) > 22025.465794806719 || $expm1(10) < 22025.4657948067165168 // Tor Browser bug || $expm1(-2e-17) !== -2e-17 @@ -6240,9 +6246,20 @@ var toNumber = function (argument) { if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix } else if (first === 48) { switch (charCodeAt$6(it, 1)) { - case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i - case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i - default: return +it; + // fast equal of /^0b[01]+$/i + case 66: + case 98: + radix = 2; + maxCode = 49; + break; + // fast equal of /^0o[0-7]+$/i + case 79: + case 111: + radix = 8; + maxCode = 55; + break; + default: + return +it; } digits = stringSlice$h(it, 2); length = digits.length; @@ -8674,7 +8691,7 @@ var handleNCG = function (string) { for (; index <= length; index++) { chr = charAt$h(string, index); if (chr === '\\') { - chr = chr + charAt$h(string, ++index); + chr += charAt$h(string, ++index); } else if (chr === ']') { brackets = false; } else if (!brackets) switch (true) { @@ -9366,7 +9383,10 @@ var fixRegexpWellKnownSymbolLogic = function (KEY, exec, FORCED, SHAM) { re[SYMBOL] = /./[SYMBOL]; } - re.exec = function () { execCalled = true; return null; }; + re.exec = function () { + execCalled = true; + return null; + }; re[SYMBOL](''); return !execCalled; @@ -14653,7 +14673,7 @@ var push$c = uncurryThis$q([].push); var IS_DIGIT = /^\d$/; var IS_NON_ZERO_DIGIT = /^[1-9]$/; -var IS_NUMBER_START = /^(-|\d)$/; +var IS_NUMBER_START = /^(?:-|\d)$/; var IS_WHITESPACE$1 = /^[\t\n\r ]$/; var PRIMITIVE = 0; @@ -18567,7 +18587,7 @@ var checkBasicSemantic = function (structuredCloneImplementation) { var set1 = new global$5.Set([7]); var set2 = structuredCloneImplementation(set1); var number = structuredCloneImplementation(Object$1(7)); - return set2 === set1 || !set2.has(7) || typeof number != 'object' || number !== 7; + return set2 === set1 || !set2.has(7) || typeof number != 'object' || +number !== 7; }) && structuredCloneImplementation; }; @@ -19354,7 +19374,7 @@ var encode = function (input) { var q = delta; var k = base; while (true) { - var t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias; if (q < t) break; var qMinusT = q - t; var baseMinusT = base - t; From e9fef3fccf87c644b63dee6537c71e39f5c13c13 Mon Sep 17 00:00:00 2001 From: XiaoPi <530257315@qq.com> Date: Sun, 10 Sep 2023 12:44:24 +0800 Subject: [PATCH 06/10] re-enbale repl-artefacts workflow for rollup-swc branch (#5129) --- .github/workflows/repl-artefacts.yml | 42 ++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/.github/workflows/repl-artefacts.yml b/.github/workflows/repl-artefacts.yml index cacbe359b..4fac89145 100644 --- a/.github/workflows/repl-artefacts.yml +++ b/.github/workflows/repl-artefacts.yml @@ -15,8 +15,7 @@ jobs: upload: permissions: pull-requests: write # for peter-evans/find-comment and peter-evans/create-or-update-comment - # TODO SWC re-enable for rollup-swc once it is working - if: ${{ (github.event.pull_request.head.repo.full_name == 'rollup/rollup' || contains( toJson(github.event.pull_request.labels), 'x⁸ ⚙️ build repl artefacts' )) && github.head_ref != 'rollup-swc' }} + if: ${{ github.event.pull_request.head.repo.full_name == 'rollup/rollup' || contains( toJson(github.event.pull_request.labels), 'x⁸ ⚙️ build repl artefacts' ) }} runs-on: ubuntu-latest name: Upload steps: @@ -24,6 +23,26 @@ jobs: uses: actions/checkout@v4 with: ref: refs/pull/${{ github.event.number }}/merge + - name: Install Toolchain + uses: dtolnay/rust-toolchain@stable + #TODO: remove after or before merging rollup-swc + if: ${{github.head_ref == 'rollup-swc'}} + with: + toolchain: nightly + targets: x86_64-unknown-linux-gnu + - name: Cache cargo + uses: actions/cache@v3 + #TODO: remove after or before merging rollup-swc + if: ${{github.head_ref == 'rollup-swc'}} + with: + path: | + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + .cargo-cache + rust/target/ + key: cargo-cache-${{ hashFiles('rust/Cargo.lock') }} + restore-keys: cargo-cache - name: Setup Node uses: actions/setup-node@v3 with: @@ -38,6 +57,12 @@ jobs: if: steps.cache-node-modules.outputs.cache-hit != 'true' run: npm ci --ignore-scripts - name: Build artefacts + #TODO: remove after or before merging rollup-swc + if: ${{ github.head_ref == 'rollup-swc' }} + run: npm exec -- concurrently -c green,blue,yellow 'npm:build:napi -- --release' 'npm run build:wasm' 'npm:build:cjs' && npm run build:copy-native && npm run build:bootstrap + #TODO: remove after or before merging rollup-swc + - name: Build artefacts + if: ${{ github.head_ref != 'rollup-swc' }} run: npm run build:cjs && npm run build:bootstrap - name: Upload "${{ github.event.number }}/rollup.browser.js" to bucket uses: zdurham/s3-upload-github-action@master @@ -61,6 +86,19 @@ jobs: S3_KEY: ${{ github.event.number }}/rollup.browser.js.map AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + - name: Upload "${{ github.event.number }}/bindings_wasm_bg.wasm" to bucket + uses: zdurham/s3-upload-github-action@master + #TODO: remove after or before merging rollup-swc + if: ${{github.head_ref == 'rollup-swc'}} + with: + args: --cache-control max-age=300,public + env: + FILE: browser/dist/bindings_wasm_bg.wasm + AWS_REGION: ${{ secrets.AWS_REGION }} + S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} + S3_KEY: ${{ github.event.number }}/bindings_wasm_bg.wasm + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - name: Find Comment uses: peter-evans/find-comment@v2 id: findComment From 1d0c6be0a0987a74d33a8e2f0b6b32b793d74b99 Mon Sep 17 00:00:00 2001 From: ZhengLiu2825 <84685101+ZhengLiu2825@users.noreply.github.com> Date: Sun, 10 Sep 2023 13:16:32 +0800 Subject: [PATCH 07/10] fix(perf): avoid superfluous timer wrappings in watch mode (#5114) * fix(perf): avoid superfluous timer wrappings in watch mode * Track timer instrumentation on plugins --------- Co-authored-by: Lukas Taegert-Atkinson Co-authored-by: Lukas Taegert-Atkinson --- src/utils/timers.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/utils/timers.ts b/src/utils/timers.ts index 913be55dd..7af55476f 100644 --- a/src/utils/timers.ts +++ b/src/utils/timers.ts @@ -104,6 +104,8 @@ const TIMED_PLUGIN_HOOKS: readonly (keyof PluginHooks)[] = [ ]; function getPluginWithTimers(plugin: any, index: number): Plugin { + if (plugin._hasTimer) return plugin; + plugin._hasTimer = true; for (const hook of TIMED_PLUGIN_HOOKS) { if (hook in plugin) { let timerLabel = `plugin ${index}`; From bec9e072a924a8dfa6a18a6e1dad049ee3db7159 Mon Sep 17 00:00:00 2001 From: XiaoPi <530257315@qq.com> Date: Sun, 10 Sep 2023 13:25:51 +0800 Subject: [PATCH 08/10] fix: access document.currentScript at the top level (#5118) * fix: access document.currentScript at the top level * add test * update snapshots * add the option accessedDocumentCurrentScript to RenderOptions --- src/Chunk.ts | 11 ++++++ src/ast/nodes/MetaProperty.ts | 34 ++++++++++++------- src/utils/interopHelpers.ts | 4 +++ src/utils/renderHelpers.ts | 1 + .../_expected/cjs/0/1/nested.js | 3 +- .../import-meta-url/_expected/cjs/main.js | 3 +- .../_expected/cjs/nested/chunk.js | 3 +- .../_expected/cjs.js | 5 +-- .../_expected/iife.js | 5 +-- .../_expected/umd.js | 5 +-- .../samples/import-meta-url/_expected/cjs.js | 3 +- .../samples/import-meta-url/_expected/iife.js | 3 +- .../samples/import-meta-url/_expected/umd.js | 3 +- .../form/samples/import-meta/_expected/cjs.js | 3 +- .../samples/import-meta/_expected/iife.js | 3 +- .../form/samples/import-meta/_expected/umd.js | 3 +- .../resolve-import-meta-url/_expected/cjs.js | 5 +-- .../resolve-import-meta-url/_expected/iife.js | 5 +-- .../resolve-import-meta-url/_expected/umd.js | 5 +-- .../samples/import-meta-url-b/_config.js | 17 ++++++++++ .../samples/import-meta-url-b/main.js | 6 ++++ 21 files changed, 96 insertions(+), 34 deletions(-) create mode 100644 test/function/samples/import-meta-url-b/_config.js create mode 100644 test/function/samples/import-meta-url-b/main.js diff --git a/src/Chunk.ts b/src/Chunk.ts index 377210e98..df3c26a09 100644 --- a/src/Chunk.ts +++ b/src/Chunk.ts @@ -6,6 +6,7 @@ import Module from './Module'; import ExportDefaultDeclaration from './ast/nodes/ExportDefaultDeclaration'; import FunctionDeclaration from './ast/nodes/FunctionDeclaration'; import type ImportExpression from './ast/nodes/ImportExpression'; +import { formatsMaybeAccessDocumentCurrentScript } from './ast/nodes/MetaProperty'; import type ChildScope from './ast/scopes/ChildScope'; import ExportDefaultVariable from './ast/variables/ExportDefaultVariable'; import LocalVariable from './ast/variables/LocalVariable'; @@ -40,6 +41,7 @@ import { replacePlaceholders } from './utils/hashPlaceholders'; import { makeLegal } from './utils/identifierHelpers'; import { defaultInteropHelpersByInteropType, + DOCUMENT_CURRENT_SCRIPT, HELPER_NAMES, isDefaultAProperty, namespaceInteropHelpersByInteropType @@ -1201,6 +1203,7 @@ export default class Chunk { const renderedModuleSources = new Map(); const renderOptions: RenderOptions = { + accessedDocumentCurrentScript: false, dynamicImportFunction, exportNamesByVariable, format, @@ -1218,6 +1221,14 @@ export default class Chunk { let source: MagicString | undefined; if (module.isIncluded() || includedNamespaces.has(module)) { const rendered = module.render(renderOptions); + if ( + !renderOptions.accessedDocumentCurrentScript && + formatsMaybeAccessDocumentCurrentScript.includes(format) + ) { + // eslint-disable-next-line unicorn/consistent-destructuring + this.accessedGlobalsByScope.get(module.scope)?.delete(DOCUMENT_CURRENT_SCRIPT); + } + renderOptions.accessedDocumentCurrentScript = false; ({ source } = rendered); usesTopLevelAwait ||= rendered.usesTopLevelAwait; renderedLength = source.length(); diff --git a/src/ast/nodes/MetaProperty.ts b/src/ast/nodes/MetaProperty.ts index 4d885caec..e58de55d6 100644 --- a/src/ast/nodes/MetaProperty.ts +++ b/src/ast/nodes/MetaProperty.ts @@ -3,6 +3,7 @@ import type { InternalModuleFormat } from '../../rollup/types'; import type { PluginDriver } from '../../utils/PluginDriver'; import { escapeId } from '../../utils/escapeId'; import type { GenerateCodeSnippets } from '../../utils/generateCodeSnippets'; +import { DOCUMENT_CURRENT_SCRIPT } from '../../utils/interopHelpers'; import { dirname, normalize, relative } from '../../utils/path'; import type { RenderOptions } from '../../utils/renderHelpers'; import type { NodeInteraction } from '../NodeInteractions'; @@ -62,11 +63,10 @@ export default class MetaProperty extends NodeBase { } } - render(code: MagicString, { format, pluginDriver, snippets }: RenderOptions): void { + render(code: MagicString, renderOptions: RenderOptions): void { + const { format, pluginDriver, snippets } = renderOptions; const { - context: { - module: { id: moduleId } - }, + context: { module }, meta: { name }, metaProperty, parent, @@ -75,6 +75,8 @@ export default class MetaProperty extends NodeBase { start, end } = this; + const { id: moduleId } = module; + if (name !== IMPORT) return; const chunkId = preliminaryChunkId!; @@ -95,11 +97,15 @@ export default class MetaProperty extends NodeBase { return; } - const replacement = - pluginDriver.hookFirstSync('resolveImportMeta', [ - metaProperty, - { chunkId, format, moduleId } - ]) || importMetaMechanisms[format]?.(metaProperty, { chunkId, snippets }); + let replacement = pluginDriver.hookFirstSync('resolveImportMeta', [ + metaProperty, + { chunkId, format, moduleId } + ]); + if (!replacement) { + replacement = importMetaMechanisms[format]?.(metaProperty, { chunkId, snippets }); + renderOptions.accessedDocumentCurrentScript ||= + formatsMaybeAccessDocumentCurrentScript.includes(format) && replacement !== 'undefined'; + } if (typeof replacement === 'string') { if (parent instanceof MemberExpression) { code.overwrite(parent.start, parent.end, replacement, { contentOnly: true }); @@ -124,13 +130,15 @@ export default class MetaProperty extends NodeBase { } } +export const formatsMaybeAccessDocumentCurrentScript = ['cjs', 'iife', 'umd']; + const accessedMetaUrlGlobals = { amd: ['document', 'module', 'URL'], - cjs: ['document', 'require', 'URL'], + cjs: ['document', 'require', 'URL', DOCUMENT_CURRENT_SCRIPT], es: [], - iife: ['document', 'URL'], + iife: ['document', 'URL', DOCUMENT_CURRENT_SCRIPT], system: ['module'], - umd: ['document', 'require', 'URL'] + umd: ['document', 'require', 'URL', DOCUMENT_CURRENT_SCRIPT] }; const accessedFileUrlGlobals = { @@ -170,7 +178,7 @@ const getFileUrlFromRelativePath = (path: string) => const getUrlFromDocument = (chunkId: string, umd = false) => `${ umd ? `typeof document === 'undefined' ? location.href : ` : '' - }(document.currentScript && document.currentScript.src || new URL('${escapeId( + }(${DOCUMENT_CURRENT_SCRIPT} && ${DOCUMENT_CURRENT_SCRIPT}.src || new URL('${escapeId( chunkId )}', document.baseURI).href)`; diff --git a/src/utils/interopHelpers.ts b/src/utils/interopHelpers.ts index 40b89262b..5d28acd92 100644 --- a/src/utils/interopHelpers.ts +++ b/src/utils/interopHelpers.ts @@ -8,6 +8,7 @@ const INTEROP_NAMESPACE_COMPAT_VARIABLE = '_interopNamespaceCompat'; const INTEROP_NAMESPACE_DEFAULT_VARIABLE = '_interopNamespaceDefault'; export const INTEROP_NAMESPACE_DEFAULT_ONLY_VARIABLE = '_interopNamespaceDefaultOnly'; export const MERGE_NAMESPACES_VARIABLE = '_mergeNamespaces'; +export const DOCUMENT_CURRENT_SCRIPT = '_documentCurrentScript'; export const defaultInteropHelpersByInteropType: { [T in InteropType]: string | null } = { auto: INTEROP_DEFAULT_VARIABLE, @@ -76,6 +77,9 @@ const HELPER_GENERATORS: { usedHelpers: ReadonlySet ) => string; } = { + [DOCUMENT_CURRENT_SCRIPT](_t, { _, n }) { + return `var${_}${DOCUMENT_CURRENT_SCRIPT}${_}=${_}typeof${_}document${_}!==${_}'undefined'${_}?${_}document.currentScript${_}:${_}null;${n}`; + }, [INTEROP_DEFAULT_COMPAT_VARIABLE](_t, snippets, liveBindings) { const { _, getDirectReturnFunction, n } = snippets; const [left, right] = getDirectReturnFunction(['e'], { diff --git a/src/utils/renderHelpers.ts b/src/utils/renderHelpers.ts index 89b486ee7..b9a6510c2 100644 --- a/src/utils/renderHelpers.ts +++ b/src/utils/renderHelpers.ts @@ -7,6 +7,7 @@ import type { GenerateCodeSnippets } from './generateCodeSnippets'; import { treeshakeNode } from './treeshakeNode'; export interface RenderOptions { + accessedDocumentCurrentScript: boolean; dynamicImportFunction: string | undefined; exportNamesByVariable: Map; format: InternalModuleFormat; diff --git a/test/chunking-form/samples/import-meta-numeric-paths/_expected/cjs/0/1/nested.js b/test/chunking-form/samples/import-meta-numeric-paths/_expected/cjs/0/1/nested.js index 6361dde56..5ed431786 100644 --- a/test/chunking-form/samples/import-meta-numeric-paths/_expected/cjs/0/1/nested.js +++ b/test/chunking-form/samples/import-meta-numeric-paths/_expected/cjs/0/1/nested.js @@ -1,5 +1,6 @@ 'use strict'; -const url = (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('0/1/nested.js', document.baseURI).href)); +var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null; +const url = (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('0/1/nested.js', document.baseURI).href)); exports.url = url; diff --git a/test/chunking-form/samples/import-meta-url/_expected/cjs/main.js b/test/chunking-form/samples/import-meta-url/_expected/cjs/main.js index 4ce5ac288..1bb5d4ede 100644 --- a/test/chunking-form/samples/import-meta-url/_expected/cjs/main.js +++ b/test/chunking-form/samples/import-meta-url/_expected/cjs/main.js @@ -1,5 +1,6 @@ 'use strict'; +var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null; function log(url) { if (typeof document === 'undefined') { console.log(url); @@ -8,7 +9,7 @@ function log(url) { } } -log('main: ' + (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href))); +log('main: ' + (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('main.js', document.baseURI).href))); Promise.resolve().then(function () { return require('./nested/chunk.js'); }); exports.log = log; diff --git a/test/chunking-form/samples/import-meta-url/_expected/cjs/nested/chunk.js b/test/chunking-form/samples/import-meta-url/_expected/cjs/nested/chunk.js index d6f85b2c5..0c68a5802 100644 --- a/test/chunking-form/samples/import-meta-url/_expected/cjs/nested/chunk.js +++ b/test/chunking-form/samples/import-meta-url/_expected/cjs/nested/chunk.js @@ -2,4 +2,5 @@ var main = require('../main.js'); -main.log('nested: ' + (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('nested/chunk.js', document.baseURI).href))); +var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null; +main.log('nested: ' + (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('nested/chunk.js', document.baseURI).href))); diff --git a/test/form/samples/deconflict-format-specific-globals/_expected/cjs.js b/test/form/samples/deconflict-format-specific-globals/_expected/cjs.js index 450f1624d..2f6ca4ed8 100644 --- a/test/form/samples/deconflict-format-specific-globals/_expected/cjs.js +++ b/test/form/samples/deconflict-format-specific-globals/_expected/cjs.js @@ -2,6 +2,7 @@ var external = require('external'); +var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null; function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; } function _interopNamespace(e) { @@ -37,7 +38,7 @@ console.log(_interopDefault$1, _interopNamespace$1, module$1, require$1, exports Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('external')); }).then(console.log); exports.default = 0; -console.log((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('cjs.js', document.baseURI).href))); +console.log((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('cjs.js', document.baseURI).href))); function nested1() { const _interopDefault = 1; @@ -51,7 +52,7 @@ function nested1() { Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('external')); }).then(console.log); exports.default = 1; - console.log((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('cjs.js', document.baseURI).href))); + console.log((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('cjs.js', document.baseURI).href))); } nested1(); diff --git a/test/form/samples/deconflict-format-specific-globals/_expected/iife.js b/test/form/samples/deconflict-format-specific-globals/_expected/iife.js index 5b4060e86..566d6e75a 100644 --- a/test/form/samples/deconflict-format-specific-globals/_expected/iife.js +++ b/test/form/samples/deconflict-format-specific-globals/_expected/iife.js @@ -1,6 +1,7 @@ var bundle = (function (external) { 'use strict'; + var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null; function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; } var external__default = /*#__PURE__*/_interopDefault(external); @@ -18,7 +19,7 @@ var bundle = (function (external) { import('external').then(console.log); exports.default = 0; - console.log((document.currentScript && document.currentScript.src || new URL('iife.js', document.baseURI).href)); + console.log((_documentCurrentScript && _documentCurrentScript.src || new URL('iife.js', document.baseURI).href)); function nested1() { const _interopDefault = 1; @@ -32,7 +33,7 @@ var bundle = (function (external) { import('external').then(console.log); exports.default = 1; - console.log((document.currentScript && document.currentScript.src || new URL('iife.js', document.baseURI).href)); + console.log((_documentCurrentScript && _documentCurrentScript.src || new URL('iife.js', document.baseURI).href)); } nested1(); diff --git a/test/form/samples/deconflict-format-specific-globals/_expected/umd.js b/test/form/samples/deconflict-format-specific-globals/_expected/umd.js index e587afab1..36c7525c0 100644 --- a/test/form/samples/deconflict-format-specific-globals/_expected/umd.js +++ b/test/form/samples/deconflict-format-specific-globals/_expected/umd.js @@ -4,6 +4,7 @@ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.bundle = factory(global.external)); })(this, (function (external) { 'use strict'; + var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null; function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; } var external__default = /*#__PURE__*/_interopDefault(external); @@ -21,7 +22,7 @@ import('external').then(console.log); exports.default = 0; - console.log((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('umd.js', document.baseURI).href))); + console.log((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.src || new URL('umd.js', document.baseURI).href))); function nested1() { const _interopDefault = 1; @@ -35,7 +36,7 @@ import('external').then(console.log); exports.default = 1; - console.log((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('umd.js', document.baseURI).href))); + console.log((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.src || new URL('umd.js', document.baseURI).href))); } nested1(); diff --git a/test/form/samples/import-meta-url/_expected/cjs.js b/test/form/samples/import-meta-url/_expected/cjs.js index b071a4073..f9f929114 100644 --- a/test/form/samples/import-meta-url/_expected/cjs.js +++ b/test/form/samples/import-meta-url/_expected/cjs.js @@ -1,5 +1,6 @@ 'use strict'; +var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null; function log(url) { if (typeof document === 'undefined') { console.log(url); @@ -8,4 +9,4 @@ function log(url) { } } -log((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('cjs.js', document.baseURI).href))); +log((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('cjs.js', document.baseURI).href))); diff --git a/test/form/samples/import-meta-url/_expected/iife.js b/test/form/samples/import-meta-url/_expected/iife.js index f2d282153..b7f8f67f6 100644 --- a/test/form/samples/import-meta-url/_expected/iife.js +++ b/test/form/samples/import-meta-url/_expected/iife.js @@ -1,6 +1,7 @@ (function () { 'use strict'; + var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null; function log(url) { if (typeof document === 'undefined') { console.log(url); @@ -9,6 +10,6 @@ } } - log((document.currentScript && document.currentScript.src || new URL('iife.js', document.baseURI).href)); + log((_documentCurrentScript && _documentCurrentScript.src || new URL('iife.js', document.baseURI).href)); })(); diff --git a/test/form/samples/import-meta-url/_expected/umd.js b/test/form/samples/import-meta-url/_expected/umd.js index ea7850061..aeda35c2e 100644 --- a/test/form/samples/import-meta-url/_expected/umd.js +++ b/test/form/samples/import-meta-url/_expected/umd.js @@ -3,6 +3,7 @@ factory(); })((function () { 'use strict'; + var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null; function log(url) { if (typeof document === 'undefined') { console.log(url); @@ -11,6 +12,6 @@ } } - log((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('umd.js', document.baseURI).href))); + log((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.src || new URL('umd.js', document.baseURI).href))); })); diff --git a/test/form/samples/import-meta/_expected/cjs.js b/test/form/samples/import-meta/_expected/cjs.js index 03af3deb5..84e82090a 100644 --- a/test/form/samples/import-meta/_expected/cjs.js +++ b/test/form/samples/import-meta/_expected/cjs.js @@ -1,3 +1,4 @@ 'use strict'; -console.log(({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('cjs.js', document.baseURI).href)) })); +var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null; +console.log(({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('cjs.js', document.baseURI).href)) })); diff --git a/test/form/samples/import-meta/_expected/iife.js b/test/form/samples/import-meta/_expected/iife.js index c3928b871..f57105d9e 100644 --- a/test/form/samples/import-meta/_expected/iife.js +++ b/test/form/samples/import-meta/_expected/iife.js @@ -1,6 +1,7 @@ (function () { 'use strict'; - console.log(({ url: (document.currentScript && document.currentScript.src || new URL('iife.js', document.baseURI).href) })); + var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null; + console.log(({ url: (_documentCurrentScript && _documentCurrentScript.src || new URL('iife.js', document.baseURI).href) })); })(); diff --git a/test/form/samples/import-meta/_expected/umd.js b/test/form/samples/import-meta/_expected/umd.js index 0d82b932f..b05aaf484 100644 --- a/test/form/samples/import-meta/_expected/umd.js +++ b/test/form/samples/import-meta/_expected/umd.js @@ -3,6 +3,7 @@ factory(); })((function () { 'use strict'; - console.log(({ url: (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('umd.js', document.baseURI).href)) })); + var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null; + console.log(({ url: (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.src || new URL('umd.js', document.baseURI).href)) })); })); diff --git a/test/form/samples/resolve-import-meta-url/_expected/cjs.js b/test/form/samples/resolve-import-meta-url/_expected/cjs.js index 2180a8789..0aae2d599 100644 --- a/test/form/samples/resolve-import-meta-url/_expected/cjs.js +++ b/test/form/samples/resolve-import-meta-url/_expected/cjs.js @@ -1,12 +1,13 @@ 'use strict'; +var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null; console.log('resolved'); console.log('resolved'); console.log('resolved'); -console.log((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('cjs.js', document.baseURI).href))); +console.log((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('cjs.js', document.baseURI).href))); console.log(undefined); -console.log(({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('cjs.js', document.baseURI).href)) })); +console.log(({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('cjs.js', document.baseURI).href)) })); console.log('url=cjs.js:resolve-import-meta-url/main.js'); console.log('privateProp=cjs.js:resolve-import-meta-url/main.js'); diff --git a/test/form/samples/resolve-import-meta-url/_expected/iife.js b/test/form/samples/resolve-import-meta-url/_expected/iife.js index bb7de5c76..bca634eb5 100644 --- a/test/form/samples/resolve-import-meta-url/_expected/iife.js +++ b/test/form/samples/resolve-import-meta-url/_expected/iife.js @@ -1,13 +1,14 @@ (function () { 'use strict'; + var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null; console.log('resolved'); console.log('resolved'); console.log('resolved'); - console.log((document.currentScript && document.currentScript.src || new URL('iife.js', document.baseURI).href)); + console.log((_documentCurrentScript && _documentCurrentScript.src || new URL('iife.js', document.baseURI).href)); console.log(undefined); - console.log(({ url: (document.currentScript && document.currentScript.src || new URL('iife.js', document.baseURI).href) })); + console.log(({ url: (_documentCurrentScript && _documentCurrentScript.src || new URL('iife.js', document.baseURI).href) })); console.log('url=iife.js:resolve-import-meta-url/main.js'); console.log('privateProp=iife.js:resolve-import-meta-url/main.js'); diff --git a/test/form/samples/resolve-import-meta-url/_expected/umd.js b/test/form/samples/resolve-import-meta-url/_expected/umd.js index 966aff9b0..e46045d76 100644 --- a/test/form/samples/resolve-import-meta-url/_expected/umd.js +++ b/test/form/samples/resolve-import-meta-url/_expected/umd.js @@ -3,13 +3,14 @@ factory(); })((function () { 'use strict'; + var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null; console.log('resolved'); console.log('resolved'); console.log('resolved'); - console.log((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('umd.js', document.baseURI).href))); + console.log((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.src || new URL('umd.js', document.baseURI).href))); console.log(undefined); - console.log(({ url: (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('umd.js', document.baseURI).href)) })); + console.log(({ url: (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.src || new URL('umd.js', document.baseURI).href)) })); console.log('url=umd.js:resolve-import-meta-url/main.js'); console.log('privateProp=umd.js:resolve-import-meta-url/main.js'); diff --git a/test/function/samples/import-meta-url-b/_config.js b/test/function/samples/import-meta-url-b/_config.js new file mode 100644 index 000000000..2023e2d51 --- /dev/null +++ b/test/function/samples/import-meta-url-b/_config.js @@ -0,0 +1,17 @@ +const assert = require('node:assert'); + +const source = 'example.com/main.js'; + +module.exports = defineTest({ + description: 'Access document.currentScript at the top level', + context: { + document: { + currentScript: { + src: source + } + } + }, + exports(exports) { + assert.strictEqual(exports(), source); + } +}); diff --git a/test/function/samples/import-meta-url-b/main.js b/test/function/samples/import-meta-url-b/main.js new file mode 100644 index 000000000..98e4e438c --- /dev/null +++ b/test/function/samples/import-meta-url-b/main.js @@ -0,0 +1,6 @@ +export default function getUrl() { + document.currentScript = { src: '' }; + const url = import.meta.url; + assert.ok(import.meta.abc || true); + return url; +} From 40da6f85525c2ce48d9fd8d5c3579c41d8ef47a8 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Sun, 10 Sep 2023 07:53:52 +0200 Subject: [PATCH 09/10] Ignore wasm files when linting --- .eslintrc.js | 1 + 1 file changed, 1 insertion(+) diff --git a/.eslintrc.js b/.eslintrc.js index 533142160..c69d2b749 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -21,6 +21,7 @@ module.exports = { 'coverage', '_tmp', 'cache', + 'wasm', '/test/*/samples/**/*.*', '!/test/*/samples/**/_config.js', '!/test/*/samples/**/rollup.config.js', From a5c88b7af0a50320c76c3bad478af2d4d118a178 Mon Sep 17 00:00:00 2001 From: Lukas Taegert-Atkinson Date: Sun, 10 Sep 2023 08:00:18 +0200 Subject: [PATCH 10/10] 3.29.1 --- CHANGELOG.md | 17 +++++++++++++++++ browser/package.json | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b93b9b67b..ae8400abb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # rollup changelog +## 3.29.1 + +_2023-09-10_ + +### Bug Fixes + +- Fix time measurement of plugin hooks in watch mode (#5114) +- Ensure accessing document.currentScript in import.meta.url returns correct results (#5118) + +### Pull Requests + +- [#5114](https://github.com/rollup/rollup/pull/5114): fix(perf): avoid superfluous timer wrappings in watch mode (@ZhengLiu2825) +- [#5118](https://github.com/rollup/rollup/pull/5118): fix: access document.currentScript at the top level (@TrickyPi) +- [#5125](https://github.com/rollup/rollup/pull/5125): chore(deps): update actions/checkout action to v4 (@renovate[bot]) +- [#5126](https://github.com/rollup/rollup/pull/5126): chore(deps): lock file maintenance minor/patch updates (@renovate[bot]) +- [#5129](https://github.com/rollup/rollup/pull/5129): re-enbale repl-artefacts workflow for rollup-swc branch (@TrickyPi) + ## 3.29.0 _2023-09-06_ diff --git a/browser/package.json b/browser/package.json index 18937dff1..a9e2c5c99 100644 --- a/browser/package.json +++ b/browser/package.json @@ -1,6 +1,6 @@ { "name": "@rollup/browser", - "version": "3.29.0", + "version": "3.29.1", "description": "Next-generation ES module bundler browser build", "main": "dist/rollup.browser.js", "module": "dist/es/rollup.browser.js", diff --git a/package-lock.json b/package-lock.json index 1d52ac033..098e9ad18 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rollup", - "version": "3.29.0", + "version": "3.29.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rollup", - "version": "3.29.0", + "version": "3.29.1", "license": "MIT", "bin": { "rollup": "dist/bin/rollup" diff --git a/package.json b/package.json index cef3efd60..4e951700e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rollup", - "version": "3.29.0", + "version": "3.29.1", "description": "Next-generation ES module bundler", "main": "dist/rollup.js", "module": "dist/es/rollup.js",