rollup 4.60.0 → 4.60.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/rollup +3 -3
- package/dist/es/getLogFilter.js +2 -2
- package/dist/es/parseAst.js +2 -2
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/node-entry.js +358 -17
- package/dist/es/shared/parseAst.js +2 -2
- package/dist/es/shared/watch.js +614 -2
- package/dist/getLogFilter.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/parseAst.js +2 -2
- package/dist/rollup.js +2 -2
- package/dist/shared/fsevents-importer.js +2 -2
- package/dist/shared/index.js +614 -2
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/parseAst.js +2 -2
- package/dist/shared/rollup.js +358 -17
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/package.json +32 -32
package/dist/bin/rollup
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/*
|
|
3
3
|
@license
|
|
4
|
-
Rollup.js v4.60.
|
|
5
|
-
|
|
4
|
+
Rollup.js v4.60.1
|
|
5
|
+
Mon, 30 Mar 2026 04:32:12 GMT - commit ae871d762f6bbeb4320d28fe179211168f27a434
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
8
8
|
|
|
@@ -27,7 +27,7 @@ require('node:perf_hooks');
|
|
|
27
27
|
require('node:url');
|
|
28
28
|
require('../getLogFilter.js');
|
|
29
29
|
|
|
30
|
-
const help = "rollup version 4.60.
|
|
30
|
+
const help = "rollup version 4.60.1\n=====================================\n\nUsage: rollup [options] <entry file>\n\nOptions:\n\n-c, --config <filename> Use this config file (if argument is used but value\n is unspecified, Rollup will try to load configuration files in\n the following order:\n rollup.config.mjs -> rollup.config.cjs -> rollup.config.js)\n-d, --dir <dirname> Directory for chunks (if absent, prints to stdout)\n-e, --external <ids> Comma-separate list of module IDs to exclude\n-f, --format <format> Type of output (amd, cjs, es, iife, umd, system)\n-g, --globals <pairs> Comma-separate list of `moduleID:Global` pairs\n-h, --help Show this help message\n-i, --input <filename> Input (alternative to <entry file>)\n-m, --sourcemap Generate sourcemap (`-m inline` for inline map)\n-n, --name <name> Name for UMD export\n-o, --file <output> Single output file (if absent, prints to stdout)\n-p, --plugin <plugin> Use the plugin specified (may be repeated)\n-v, --version Show version number\n-w, --watch Watch files in bundle and rebuild on changes\n--amd.autoId Generate the AMD ID based off the chunk name\n--amd.basePath <prefix> Path to prepend to auto generated AMD ID\n--amd.define <name> Function to use in place of `define`\n--amd.forceJsExtensionForImports Use `.js` extension in AMD imports\n--amd.id <id> ID for AMD module (default is anonymous)\n--assetFileNames <pattern> Name pattern for emitted assets\n--banner <text> Code to insert at top of bundle (outside wrapper)\n--chunkFileNames <pattern> Name pattern for emitted secondary chunks\n--compact Minify wrapper code\n--context <variable> Specify top-level `this` value\n--no-dynamicImportInCjs Write external dynamic CommonJS imports as require\n--entryFileNames <pattern> Name pattern for emitted entry chunks\n--environment <values> Settings passed to config file (see example)\n--no-esModule Do not add __esModule property\n--exports <mode> Specify export mode (auto, default, named, none)\n--extend Extend global variable defined by --name\n--no-externalImportAttributes Omit import attributes in \"es\" output\n--no-externalLiveBindings Do not generate code to support live bindings\n--failAfterWarnings Exit with an error if the build produced warnings\n--filterLogs <filter> Filter log messages\n--footer <text> Code to insert at end of bundle (outside wrapper)\n--forceExit Force exit the process when done\n--no-freeze Do not freeze namespace objects\n--generatedCode <preset> Which code features to use (es5/es2015)\n--generatedCode.arrowFunctions Use arrow functions in generated code\n--generatedCode.constBindings Use \"const\" in generated code\n--generatedCode.objectShorthand Use shorthand properties in generated code\n--no-generatedCode.reservedNamesAsProps Always quote reserved names as props\n--generatedCode.symbols Use symbols in generated code\n--hashCharacters <name> Use the specified character set for file hashes\n--no-hoistTransitiveImports Do not hoist transitive imports into entry chunks\n--importAttributesKey <name> Use the specified keyword for import attributes\n--no-indent Don't indent result\n--inlineDynamicImports Create single bundle when using dynamic imports\n--no-interop Do not include interop block\n--intro <text> Code to insert at top of bundle (inside wrapper)\n--logLevel <level> Which kind of logs to display\n--no-makeAbsoluteExternalsRelative Prevent normalization of external imports\n--maxParallelFileOps <value> How many files to read in parallel\n--minifyInternalExports Force or disable minification of internal exports\n--noConflict Generate a noConflict method for UMD globals\n--outro <text> Code to insert at end of bundle (inside wrapper)\n--perf Display performance timings\n--no-preserveEntrySignatures Avoid facade chunks for entry points\n--preserveModules Preserve module structure\n--preserveModulesRoot Put preserved modules under this path at root level\n--preserveSymlinks Do not follow symlinks when resolving files\n--no-reexportProtoFromExternal Ignore `__proto__` in star re-exports\n--no-sanitizeFileName Do not replace invalid characters in file names\n--shimMissingExports Create shim variables for missing exports\n--silent Don't print warnings\n--sourcemapBaseUrl <url> Emit absolute sourcemap URLs with given base\n--sourcemapDebugIds Emit unique debug ids in source and sourcemaps\n--sourcemapExcludeSources Do not include source code in source maps\n--sourcemapFile <file> Specify bundle position for source maps\n--sourcemapFileNames <pattern> Name pattern for emitted sourcemaps\n--stdin=ext Specify file extension used for stdin input\n--no-stdin Do not read \"-\" from stdin\n--no-strict Don't emit `\"use strict\";` in the generated modules\n--strictDeprecations Throw errors for deprecated features\n--no-systemNullSetters Do not replace empty SystemJS setters with `null`\n--no-treeshake Disable tree-shaking optimisations\n--no-treeshake.annotations Ignore pure call annotations\n--treeshake.correctVarValueBeforeDeclaration Deoptimize variables until declared\n--treeshake.manualPureFunctions <names> Manually declare functions as pure\n--no-treeshake.moduleSideEffects Assume modules have no side effects\n--no-treeshake.propertyReadSideEffects Ignore property access side effects\n--no-treeshake.tryCatchDeoptimization Do not turn off try-catch-tree-shaking\n--no-treeshake.unknownGlobalSideEffects Assume unknown globals do not throw\n--validate Validate output\n--waitForBundleInput Wait for bundle input files\n--watch.allowInputInsideOutputPath Whether the input path is allowed to be a\n subpath of the output path\n--watch.buildDelay <number> Throttle watch rebuilds\n--no-watch.clearScreen Do not clear the screen when rebuilding\n--watch.exclude <files> Exclude files from being watched\n--watch.include <files> Limit watching to specified files\n--watch.onBundleEnd <cmd> Shell command to run on `\"BUNDLE_END\"` event\n--watch.onBundleStart <cmd> Shell command to run on `\"BUNDLE_START\"` event\n--watch.onEnd <cmd> Shell command to run on `\"END\"` event\n--watch.onError <cmd> Shell command to run on `\"ERROR\"` event\n--watch.onStart <cmd> Shell command to run on `\"START\"` event\n--watch.skipWrite Do not write files to disk when watching\n\nExamples:\n\n# use settings in config file\nrollup -c\n\n# in config file, process.env.INCLUDE_DEPS === 'true'\n# and process.env.BUILD === 'production'\nrollup -c --environment INCLUDE_DEPS,BUILD:production\n\n# create CommonJS bundle.js from src/main.js\nrollup --format=cjs --file=bundle.js -- src/main.js\n\n# create self-executing IIFE using `window.jQuery`\n# and `window._` as external globals\nrollup -f iife --globals jquery:jQuery,lodash:_ \\\n -i src/app.js -o build/app.js -m build/app.js.map\n\nNotes:\n\n* When piping to stdout, only inline sourcemaps are permitted\n\nFor more information visit https://rollupjs.org\n";
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* @license
|
package/dist/es/getLogFilter.js
CHANGED
package/dist/es/parseAst.js
CHANGED
package/dist/es/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.60.
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.60.1
|
|
4
|
+
Mon, 30 Mar 2026 04:32:12 GMT - commit ae871d762f6bbeb4320d28fe179211168f27a434
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -27,7 +27,7 @@ function _mergeNamespaces(n, m) {
|
|
|
27
27
|
return Object.defineProperty(n, Symbol.toStringTag, { value: 'Module' });
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
var version = "4.60.
|
|
30
|
+
var version = "4.60.1";
|
|
31
31
|
|
|
32
32
|
// src/vlq.ts
|
|
33
33
|
var comma = ",".charCodeAt(0);
|
|
@@ -9200,6 +9200,8 @@ function requireConstants () {
|
|
|
9200
9200
|
const WIN_SLASH = '\\\\/';
|
|
9201
9201
|
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
9202
9202
|
|
|
9203
|
+
const DEFAULT_MAX_EXTGLOB_RECURSION = 0;
|
|
9204
|
+
|
|
9203
9205
|
/**
|
|
9204
9206
|
* Posix glob regex
|
|
9205
9207
|
*/
|
|
@@ -9266,6 +9268,7 @@ function requireConstants () {
|
|
|
9266
9268
|
*/
|
|
9267
9269
|
|
|
9268
9270
|
const POSIX_REGEX_SOURCE = {
|
|
9271
|
+
__proto__: null,
|
|
9269
9272
|
alnum: 'a-zA-Z0-9',
|
|
9270
9273
|
alpha: 'a-zA-Z',
|
|
9271
9274
|
ascii: '\\x00-\\x7F',
|
|
@@ -9283,6 +9286,7 @@ function requireConstants () {
|
|
|
9283
9286
|
};
|
|
9284
9287
|
|
|
9285
9288
|
constants = {
|
|
9289
|
+
DEFAULT_MAX_EXTGLOB_RECURSION,
|
|
9286
9290
|
MAX_LENGTH: 1024 * 64,
|
|
9287
9291
|
POSIX_REGEX_SOURCE,
|
|
9288
9292
|
|
|
@@ -9904,6 +9908,277 @@ function requireParse () {
|
|
|
9904
9908
|
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
|
|
9905
9909
|
};
|
|
9906
9910
|
|
|
9911
|
+
const splitTopLevel = input => {
|
|
9912
|
+
const parts = [];
|
|
9913
|
+
let bracket = 0;
|
|
9914
|
+
let paren = 0;
|
|
9915
|
+
let quote = 0;
|
|
9916
|
+
let value = '';
|
|
9917
|
+
let escaped = false;
|
|
9918
|
+
|
|
9919
|
+
for (const ch of input) {
|
|
9920
|
+
if (escaped === true) {
|
|
9921
|
+
value += ch;
|
|
9922
|
+
escaped = false;
|
|
9923
|
+
continue;
|
|
9924
|
+
}
|
|
9925
|
+
|
|
9926
|
+
if (ch === '\\') {
|
|
9927
|
+
value += ch;
|
|
9928
|
+
escaped = true;
|
|
9929
|
+
continue;
|
|
9930
|
+
}
|
|
9931
|
+
|
|
9932
|
+
if (ch === '"') {
|
|
9933
|
+
quote = quote === 1 ? 0 : 1;
|
|
9934
|
+
value += ch;
|
|
9935
|
+
continue;
|
|
9936
|
+
}
|
|
9937
|
+
|
|
9938
|
+
if (quote === 0) {
|
|
9939
|
+
if (ch === '[') {
|
|
9940
|
+
bracket++;
|
|
9941
|
+
} else if (ch === ']' && bracket > 0) {
|
|
9942
|
+
bracket--;
|
|
9943
|
+
} else if (bracket === 0) {
|
|
9944
|
+
if (ch === '(') {
|
|
9945
|
+
paren++;
|
|
9946
|
+
} else if (ch === ')' && paren > 0) {
|
|
9947
|
+
paren--;
|
|
9948
|
+
} else if (ch === '|' && paren === 0) {
|
|
9949
|
+
parts.push(value);
|
|
9950
|
+
value = '';
|
|
9951
|
+
continue;
|
|
9952
|
+
}
|
|
9953
|
+
}
|
|
9954
|
+
}
|
|
9955
|
+
|
|
9956
|
+
value += ch;
|
|
9957
|
+
}
|
|
9958
|
+
|
|
9959
|
+
parts.push(value);
|
|
9960
|
+
return parts;
|
|
9961
|
+
};
|
|
9962
|
+
|
|
9963
|
+
const isPlainBranch = branch => {
|
|
9964
|
+
let escaped = false;
|
|
9965
|
+
|
|
9966
|
+
for (const ch of branch) {
|
|
9967
|
+
if (escaped === true) {
|
|
9968
|
+
escaped = false;
|
|
9969
|
+
continue;
|
|
9970
|
+
}
|
|
9971
|
+
|
|
9972
|
+
if (ch === '\\') {
|
|
9973
|
+
escaped = true;
|
|
9974
|
+
continue;
|
|
9975
|
+
}
|
|
9976
|
+
|
|
9977
|
+
if (/[?*+@!()[\]{}]/.test(ch)) {
|
|
9978
|
+
return false;
|
|
9979
|
+
}
|
|
9980
|
+
}
|
|
9981
|
+
|
|
9982
|
+
return true;
|
|
9983
|
+
};
|
|
9984
|
+
|
|
9985
|
+
const normalizeSimpleBranch = branch => {
|
|
9986
|
+
let value = branch.trim();
|
|
9987
|
+
let changed = true;
|
|
9988
|
+
|
|
9989
|
+
while (changed === true) {
|
|
9990
|
+
changed = false;
|
|
9991
|
+
|
|
9992
|
+
if (/^@\([^\\()[\]{}|]+\)$/.test(value)) {
|
|
9993
|
+
value = value.slice(2, -1);
|
|
9994
|
+
changed = true;
|
|
9995
|
+
}
|
|
9996
|
+
}
|
|
9997
|
+
|
|
9998
|
+
if (!isPlainBranch(value)) {
|
|
9999
|
+
return;
|
|
10000
|
+
}
|
|
10001
|
+
|
|
10002
|
+
return value.replace(/\\(.)/g, '$1');
|
|
10003
|
+
};
|
|
10004
|
+
|
|
10005
|
+
const hasRepeatedCharPrefixOverlap = branches => {
|
|
10006
|
+
const values = branches.map(normalizeSimpleBranch).filter(Boolean);
|
|
10007
|
+
|
|
10008
|
+
for (let i = 0; i < values.length; i++) {
|
|
10009
|
+
for (let j = i + 1; j < values.length; j++) {
|
|
10010
|
+
const a = values[i];
|
|
10011
|
+
const b = values[j];
|
|
10012
|
+
const char = a[0];
|
|
10013
|
+
|
|
10014
|
+
if (!char || a !== char.repeat(a.length) || b !== char.repeat(b.length)) {
|
|
10015
|
+
continue;
|
|
10016
|
+
}
|
|
10017
|
+
|
|
10018
|
+
if (a === b || a.startsWith(b) || b.startsWith(a)) {
|
|
10019
|
+
return true;
|
|
10020
|
+
}
|
|
10021
|
+
}
|
|
10022
|
+
}
|
|
10023
|
+
|
|
10024
|
+
return false;
|
|
10025
|
+
};
|
|
10026
|
+
|
|
10027
|
+
const parseRepeatedExtglob = (pattern, requireEnd = true) => {
|
|
10028
|
+
if ((pattern[0] !== '+' && pattern[0] !== '*') || pattern[1] !== '(') {
|
|
10029
|
+
return;
|
|
10030
|
+
}
|
|
10031
|
+
|
|
10032
|
+
let bracket = 0;
|
|
10033
|
+
let paren = 0;
|
|
10034
|
+
let quote = 0;
|
|
10035
|
+
let escaped = false;
|
|
10036
|
+
|
|
10037
|
+
for (let i = 1; i < pattern.length; i++) {
|
|
10038
|
+
const ch = pattern[i];
|
|
10039
|
+
|
|
10040
|
+
if (escaped === true) {
|
|
10041
|
+
escaped = false;
|
|
10042
|
+
continue;
|
|
10043
|
+
}
|
|
10044
|
+
|
|
10045
|
+
if (ch === '\\') {
|
|
10046
|
+
escaped = true;
|
|
10047
|
+
continue;
|
|
10048
|
+
}
|
|
10049
|
+
|
|
10050
|
+
if (ch === '"') {
|
|
10051
|
+
quote = quote === 1 ? 0 : 1;
|
|
10052
|
+
continue;
|
|
10053
|
+
}
|
|
10054
|
+
|
|
10055
|
+
if (quote === 1) {
|
|
10056
|
+
continue;
|
|
10057
|
+
}
|
|
10058
|
+
|
|
10059
|
+
if (ch === '[') {
|
|
10060
|
+
bracket++;
|
|
10061
|
+
continue;
|
|
10062
|
+
}
|
|
10063
|
+
|
|
10064
|
+
if (ch === ']' && bracket > 0) {
|
|
10065
|
+
bracket--;
|
|
10066
|
+
continue;
|
|
10067
|
+
}
|
|
10068
|
+
|
|
10069
|
+
if (bracket > 0) {
|
|
10070
|
+
continue;
|
|
10071
|
+
}
|
|
10072
|
+
|
|
10073
|
+
if (ch === '(') {
|
|
10074
|
+
paren++;
|
|
10075
|
+
continue;
|
|
10076
|
+
}
|
|
10077
|
+
|
|
10078
|
+
if (ch === ')') {
|
|
10079
|
+
paren--;
|
|
10080
|
+
|
|
10081
|
+
if (paren === 0) {
|
|
10082
|
+
if (requireEnd === true && i !== pattern.length - 1) {
|
|
10083
|
+
return;
|
|
10084
|
+
}
|
|
10085
|
+
|
|
10086
|
+
return {
|
|
10087
|
+
type: pattern[0],
|
|
10088
|
+
body: pattern.slice(2, i),
|
|
10089
|
+
end: i
|
|
10090
|
+
};
|
|
10091
|
+
}
|
|
10092
|
+
}
|
|
10093
|
+
}
|
|
10094
|
+
};
|
|
10095
|
+
|
|
10096
|
+
const getStarExtglobSequenceOutput = pattern => {
|
|
10097
|
+
let index = 0;
|
|
10098
|
+
const chars = [];
|
|
10099
|
+
|
|
10100
|
+
while (index < pattern.length) {
|
|
10101
|
+
const match = parseRepeatedExtglob(pattern.slice(index), false);
|
|
10102
|
+
|
|
10103
|
+
if (!match || match.type !== '*') {
|
|
10104
|
+
return;
|
|
10105
|
+
}
|
|
10106
|
+
|
|
10107
|
+
const branches = splitTopLevel(match.body).map(branch => branch.trim());
|
|
10108
|
+
if (branches.length !== 1) {
|
|
10109
|
+
return;
|
|
10110
|
+
}
|
|
10111
|
+
|
|
10112
|
+
const branch = normalizeSimpleBranch(branches[0]);
|
|
10113
|
+
if (!branch || branch.length !== 1) {
|
|
10114
|
+
return;
|
|
10115
|
+
}
|
|
10116
|
+
|
|
10117
|
+
chars.push(branch);
|
|
10118
|
+
index += match.end + 1;
|
|
10119
|
+
}
|
|
10120
|
+
|
|
10121
|
+
if (chars.length < 1) {
|
|
10122
|
+
return;
|
|
10123
|
+
}
|
|
10124
|
+
|
|
10125
|
+
const source = chars.length === 1
|
|
10126
|
+
? utils.escapeRegex(chars[0])
|
|
10127
|
+
: `[${chars.map(ch => utils.escapeRegex(ch)).join('')}]`;
|
|
10128
|
+
|
|
10129
|
+
return `${source}*`;
|
|
10130
|
+
};
|
|
10131
|
+
|
|
10132
|
+
const repeatedExtglobRecursion = pattern => {
|
|
10133
|
+
let depth = 0;
|
|
10134
|
+
let value = pattern.trim();
|
|
10135
|
+
let match = parseRepeatedExtglob(value);
|
|
10136
|
+
|
|
10137
|
+
while (match) {
|
|
10138
|
+
depth++;
|
|
10139
|
+
value = match.body.trim();
|
|
10140
|
+
match = parseRepeatedExtglob(value);
|
|
10141
|
+
}
|
|
10142
|
+
|
|
10143
|
+
return depth;
|
|
10144
|
+
};
|
|
10145
|
+
|
|
10146
|
+
const analyzeRepeatedExtglob = (body, options) => {
|
|
10147
|
+
if (options.maxExtglobRecursion === false) {
|
|
10148
|
+
return { risky: false };
|
|
10149
|
+
}
|
|
10150
|
+
|
|
10151
|
+
const max =
|
|
10152
|
+
typeof options.maxExtglobRecursion === 'number'
|
|
10153
|
+
? options.maxExtglobRecursion
|
|
10154
|
+
: constants.DEFAULT_MAX_EXTGLOB_RECURSION;
|
|
10155
|
+
|
|
10156
|
+
const branches = splitTopLevel(body).map(branch => branch.trim());
|
|
10157
|
+
|
|
10158
|
+
if (branches.length > 1) {
|
|
10159
|
+
if (
|
|
10160
|
+
branches.some(branch => branch === '') ||
|
|
10161
|
+
branches.some(branch => /^[*?]+$/.test(branch)) ||
|
|
10162
|
+
hasRepeatedCharPrefixOverlap(branches)
|
|
10163
|
+
) {
|
|
10164
|
+
return { risky: true };
|
|
10165
|
+
}
|
|
10166
|
+
}
|
|
10167
|
+
|
|
10168
|
+
for (const branch of branches) {
|
|
10169
|
+
const safeOutput = getStarExtglobSequenceOutput(branch);
|
|
10170
|
+
if (safeOutput) {
|
|
10171
|
+
return { risky: true, safeOutput };
|
|
10172
|
+
}
|
|
10173
|
+
|
|
10174
|
+
if (repeatedExtglobRecursion(branch) > max) {
|
|
10175
|
+
return { risky: true };
|
|
10176
|
+
}
|
|
10177
|
+
}
|
|
10178
|
+
|
|
10179
|
+
return { risky: false };
|
|
10180
|
+
};
|
|
10181
|
+
|
|
9907
10182
|
/**
|
|
9908
10183
|
* Parse the given input string.
|
|
9909
10184
|
* @param {String} input
|
|
@@ -10084,6 +10359,8 @@ function requireParse () {
|
|
|
10084
10359
|
token.prev = prev;
|
|
10085
10360
|
token.parens = state.parens;
|
|
10086
10361
|
token.output = state.output;
|
|
10362
|
+
token.startIndex = state.index;
|
|
10363
|
+
token.tokensIndex = tokens.length;
|
|
10087
10364
|
const output = (opts.capture ? '(' : '') + token.open;
|
|
10088
10365
|
|
|
10089
10366
|
increment('parens');
|
|
@@ -10093,6 +10370,34 @@ function requireParse () {
|
|
|
10093
10370
|
};
|
|
10094
10371
|
|
|
10095
10372
|
const extglobClose = token => {
|
|
10373
|
+
const literal = input.slice(token.startIndex, state.index + 1);
|
|
10374
|
+
const body = input.slice(token.startIndex + 2, state.index);
|
|
10375
|
+
const analysis = analyzeRepeatedExtglob(body, opts);
|
|
10376
|
+
|
|
10377
|
+
if ((token.type === 'plus' || token.type === 'star') && analysis.risky) {
|
|
10378
|
+
const safeOutput = analysis.safeOutput
|
|
10379
|
+
? (token.output ? '' : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput)
|
|
10380
|
+
: undefined;
|
|
10381
|
+
const open = tokens[token.tokensIndex];
|
|
10382
|
+
|
|
10383
|
+
open.type = 'text';
|
|
10384
|
+
open.value = literal;
|
|
10385
|
+
open.output = safeOutput || utils.escapeRegex(literal);
|
|
10386
|
+
|
|
10387
|
+
for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
|
|
10388
|
+
tokens[i].value = '';
|
|
10389
|
+
tokens[i].output = '';
|
|
10390
|
+
delete tokens[i].suffix;
|
|
10391
|
+
}
|
|
10392
|
+
|
|
10393
|
+
state.output = token.output + open.output;
|
|
10394
|
+
state.backtrack = true;
|
|
10395
|
+
|
|
10396
|
+
push({ type: 'paren', extglob: true, value, output: '' });
|
|
10397
|
+
decrement('parens');
|
|
10398
|
+
return;
|
|
10399
|
+
}
|
|
10400
|
+
|
|
10096
10401
|
let output = token.close + (opts.capture ? ')' : '');
|
|
10097
10402
|
let rest;
|
|
10098
10403
|
|
|
@@ -11185,6 +11490,14 @@ function requirePicomatch$1 () {
|
|
|
11185
11490
|
* Compile a regular expression from the `state` object returned by the
|
|
11186
11491
|
* [parse()](#parse) method.
|
|
11187
11492
|
*
|
|
11493
|
+
* ```js
|
|
11494
|
+
* const picomatch = require('picomatch');
|
|
11495
|
+
* const state = picomatch.parse('*.js');
|
|
11496
|
+
* // picomatch.compileRe(state[, options]);
|
|
11497
|
+
*
|
|
11498
|
+
* console.log(picomatch.compileRe(state));
|
|
11499
|
+
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
11500
|
+
* ```
|
|
11188
11501
|
* @param {Object} `state`
|
|
11189
11502
|
* @param {Object} `options`
|
|
11190
11503
|
* @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
|
|
@@ -11220,10 +11533,10 @@ function requirePicomatch$1 () {
|
|
|
11220
11533
|
*
|
|
11221
11534
|
* ```js
|
|
11222
11535
|
* const picomatch = require('picomatch');
|
|
11223
|
-
*
|
|
11224
|
-
* // picomatch.compileRe(state[, options]);
|
|
11536
|
+
* // picomatch.makeRe(state[, options]);
|
|
11225
11537
|
*
|
|
11226
|
-
*
|
|
11538
|
+
* const result = picomatch.makeRe('*.js');
|
|
11539
|
+
* console.log(result);
|
|
11227
11540
|
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
11228
11541
|
* ```
|
|
11229
11542
|
* @param {String} `state` The object returned from the `.parse` method.
|
|
@@ -16868,7 +17181,7 @@ const MISSING_EXPORT_SHIM_DESCRIPTION = {
|
|
|
16868
17181
|
identifier: null,
|
|
16869
17182
|
localName: MISSING_EXPORT_SHIM_VARIABLE
|
|
16870
17183
|
};
|
|
16871
|
-
function getVariableForExportNameRecursive(target, name, importerForSideEffects, isExportAllSearch, searchedNamesAndModules = new Map(), importChain) {
|
|
17184
|
+
function getVariableForExportNameRecursive(target, name, importerForSideEffects, isExportAllSearch, searchedNamesAndModules = new Map(), importChain, sideEffectModules, exportOrReexportModules) {
|
|
16872
17185
|
const searchedModules = searchedNamesAndModules.get(name);
|
|
16873
17186
|
if (searchedModules) {
|
|
16874
17187
|
if (searchedModules.has(target)) {
|
|
@@ -16880,10 +17193,12 @@ function getVariableForExportNameRecursive(target, name, importerForSideEffects,
|
|
|
16880
17193
|
searchedNamesAndModules.set(name, new Set([target]));
|
|
16881
17194
|
}
|
|
16882
17195
|
return target.getVariableForExportName(name, {
|
|
17196
|
+
exportOrReexportModules,
|
|
16883
17197
|
importChain,
|
|
16884
17198
|
importerForSideEffects,
|
|
16885
17199
|
isExportAllSearch,
|
|
16886
|
-
searchedNamesAndModules
|
|
17200
|
+
searchedNamesAndModules,
|
|
17201
|
+
sideEffectModules
|
|
16887
17202
|
});
|
|
16888
17203
|
}
|
|
16889
17204
|
function getAndExtendSideEffectModules(variable, module) {
|
|
@@ -17204,7 +17519,7 @@ class Module {
|
|
|
17204
17519
|
}
|
|
17205
17520
|
return this.syntheticNamespace;
|
|
17206
17521
|
}
|
|
17207
|
-
getVariableForExportName(name, { importerForSideEffects, importChain = [], isExportAllSearch, onlyExplicit, searchedNamesAndModules } = EMPTY_OBJECT) {
|
|
17522
|
+
getVariableForExportName(name, { importerForSideEffects, importChain = [], isExportAllSearch, onlyExplicit, searchedNamesAndModules, sideEffectModules, exportOrReexportModules } = EMPTY_OBJECT) {
|
|
17208
17523
|
if (name[0] === '*') {
|
|
17209
17524
|
if (name.length === 1) {
|
|
17210
17525
|
// export * from './other'
|
|
@@ -17219,7 +17534,7 @@ class Module {
|
|
|
17219
17534
|
// export { foo } from './other'
|
|
17220
17535
|
const reexportDeclaration = this.reexportDescriptions.get(name);
|
|
17221
17536
|
if (reexportDeclaration) {
|
|
17222
|
-
const [variable, options] = getVariableForExportNameRecursive(reexportDeclaration.module, reexportDeclaration.localName, importerForSideEffects, false, searchedNamesAndModules, [...importChain, this.id]);
|
|
17537
|
+
const [variable, options] = getVariableForExportNameRecursive(reexportDeclaration.module, reexportDeclaration.localName, importerForSideEffects, false, searchedNamesAndModules, [...importChain, this.id], sideEffectModules, exportOrReexportModules);
|
|
17223
17538
|
if (!variable) {
|
|
17224
17539
|
return this.error(logMissingExport(reexportDeclaration.localName, this.id, reexportDeclaration.module.id, !!options?.missingButExportExists), reexportDeclaration.start);
|
|
17225
17540
|
}
|
|
@@ -17229,6 +17544,10 @@ class Module {
|
|
|
17229
17544
|
getOrCreate(importerForSideEffects.sideEffectDependenciesByVariable, variable, (getNewSet)).add(this);
|
|
17230
17545
|
}
|
|
17231
17546
|
}
|
|
17547
|
+
if (this.info.moduleSideEffects) {
|
|
17548
|
+
sideEffectModules?.add(this);
|
|
17549
|
+
}
|
|
17550
|
+
exportOrReexportModules?.add(this);
|
|
17232
17551
|
return [variable];
|
|
17233
17552
|
}
|
|
17234
17553
|
const exportDeclaration = this.exportDescriptions.get(name);
|
|
@@ -17238,8 +17557,10 @@ class Module {
|
|
|
17238
17557
|
}
|
|
17239
17558
|
const name = exportDeclaration.localName;
|
|
17240
17559
|
const variable = this.traceVariable(name, {
|
|
17560
|
+
exportOrReexportModules,
|
|
17241
17561
|
importerForSideEffects,
|
|
17242
|
-
searchedNamesAndModules
|
|
17562
|
+
searchedNamesAndModules,
|
|
17563
|
+
sideEffectModules
|
|
17243
17564
|
});
|
|
17244
17565
|
if (!variable) {
|
|
17245
17566
|
return [null, { missingButExportExists: true }];
|
|
@@ -17248,6 +17569,8 @@ class Module {
|
|
|
17248
17569
|
setAlternativeExporterIfCyclic(variable, importerForSideEffects, this);
|
|
17249
17570
|
getOrCreate(importerForSideEffects.sideEffectDependenciesByVariable, variable, (getNewSet)).add(this);
|
|
17250
17571
|
}
|
|
17572
|
+
sideEffectModules?.add(this);
|
|
17573
|
+
exportOrReexportModules?.add(this);
|
|
17251
17574
|
return [variable];
|
|
17252
17575
|
}
|
|
17253
17576
|
if (onlyExplicit) {
|
|
@@ -17258,6 +17581,19 @@ class Module {
|
|
|
17258
17581
|
this.getVariableFromNamespaceReexports(name, importerForSideEffects, searchedNamesAndModules, [...importChain, this.id]);
|
|
17259
17582
|
this.namespaceReexportsByName.set(name, foundNamespaceReexport);
|
|
17260
17583
|
if (foundNamespaceReexport[0]) {
|
|
17584
|
+
const [namespaceReexportVariable, namespaceReexportOptions] = foundNamespaceReexport;
|
|
17585
|
+
if (importerForSideEffects) {
|
|
17586
|
+
const { exportOrReexportModules, sideEffectModules } = namespaceReexportOptions;
|
|
17587
|
+
for (const module of exportOrReexportModules) {
|
|
17588
|
+
if (importerForSideEffects.alternativeReexportModules.has(namespaceReexportVariable)) {
|
|
17589
|
+
continue;
|
|
17590
|
+
}
|
|
17591
|
+
setAlternativeExporterIfCyclic(namespaceReexportVariable, importerForSideEffects, module);
|
|
17592
|
+
}
|
|
17593
|
+
for (const module of sideEffectModules) {
|
|
17594
|
+
getOrCreate(importerForSideEffects.sideEffectDependenciesByVariable, namespaceReexportVariable, (getNewSet)).add(module);
|
|
17595
|
+
}
|
|
17596
|
+
}
|
|
17261
17597
|
return foundNamespaceReexport;
|
|
17262
17598
|
}
|
|
17263
17599
|
}
|
|
@@ -17461,7 +17797,7 @@ class Module {
|
|
|
17461
17797
|
transformFiles: this.transformFiles
|
|
17462
17798
|
};
|
|
17463
17799
|
}
|
|
17464
|
-
traceVariable(name, { importerForSideEffects, isExportAllSearch, searchedNamesAndModules } = EMPTY_OBJECT) {
|
|
17800
|
+
traceVariable(name, { importerForSideEffects, isExportAllSearch, searchedNamesAndModules, sideEffectModules, exportOrReexportModules } = EMPTY_OBJECT) {
|
|
17465
17801
|
const localVariable = this.scope.variables.get(name);
|
|
17466
17802
|
if (localVariable) {
|
|
17467
17803
|
return localVariable;
|
|
@@ -17472,7 +17808,7 @@ class Module {
|
|
|
17472
17808
|
if (otherModule instanceof Module && importDescription.name === '*') {
|
|
17473
17809
|
return otherModule.namespace;
|
|
17474
17810
|
}
|
|
17475
|
-
const [declaration, options] = getVariableForExportNameRecursive(otherModule, importDescription.name, importerForSideEffects || this, isExportAllSearch, searchedNamesAndModules, [this.id]);
|
|
17811
|
+
const [declaration, options] = getVariableForExportNameRecursive(otherModule, importDescription.name, importerForSideEffects || this, isExportAllSearch, searchedNamesAndModules, [this.id], sideEffectModules, exportOrReexportModules);
|
|
17476
17812
|
if (!declaration) {
|
|
17477
17813
|
return this.error(logMissingExport(importDescription.name, this.id, otherModule.id, !!options?.missingButExportExists), importDescription.start);
|
|
17478
17814
|
}
|
|
@@ -17693,6 +18029,8 @@ class Module {
|
|
|
17693
18029
|
let foundSyntheticDeclaration = null;
|
|
17694
18030
|
const foundInternalDeclarations = new Map();
|
|
17695
18031
|
const foundExternalDeclarations = new Set();
|
|
18032
|
+
const sideEffectModules = new Set();
|
|
18033
|
+
const exportOrReexportModules = new Set();
|
|
17696
18034
|
for (const module of this.exportAllModules) {
|
|
17697
18035
|
// Synthetic namespaces should not hide "regular" exports of the same name
|
|
17698
18036
|
if (module.info.syntheticNamedExports === name) {
|
|
@@ -17701,7 +18039,7 @@ class Module {
|
|
|
17701
18039
|
const [variable, options] = getVariableForExportNameRecursive(module, name, importerForSideEffects, true,
|
|
17702
18040
|
// We are creating a copy to handle the case where the same binding is
|
|
17703
18041
|
// imported through different namespace reexports gracefully
|
|
17704
|
-
copyNameToModulesMap(searchedNamesAndModules), importChain);
|
|
18042
|
+
copyNameToModulesMap(searchedNamesAndModules), importChain, sideEffectModules, exportOrReexportModules);
|
|
17705
18043
|
if (module instanceof ExternalModule || options?.indirectExternal) {
|
|
17706
18044
|
foundExternalDeclarations.add(variable);
|
|
17707
18045
|
}
|
|
@@ -17718,7 +18056,7 @@ class Module {
|
|
|
17718
18056
|
const foundDeclarationList = [...foundInternalDeclarations];
|
|
17719
18057
|
const usedDeclaration = foundDeclarationList[0][0];
|
|
17720
18058
|
if (foundDeclarationList.length === 1) {
|
|
17721
|
-
return [usedDeclaration];
|
|
18059
|
+
return [usedDeclaration, { exportOrReexportModules, sideEffectModules }];
|
|
17722
18060
|
}
|
|
17723
18061
|
this.options.onLog(LOGLEVEL_WARN, logNamespaceConflict(name, this.id, foundDeclarationList.map(([, module]) => module.id)));
|
|
17724
18062
|
// TODO we are pretending it was not found while it should behave like "undefined"
|
|
@@ -17730,10 +18068,13 @@ class Module {
|
|
|
17730
18068
|
if (foundDeclarationList.length > 1) {
|
|
17731
18069
|
this.options.onLog(LOGLEVEL_WARN, logAmbiguousExternalNamespaces(name, this.id, usedDeclaration.module.id, foundDeclarationList.map(declaration => declaration.module.id)));
|
|
17732
18070
|
}
|
|
17733
|
-
return [
|
|
18071
|
+
return [
|
|
18072
|
+
usedDeclaration,
|
|
18073
|
+
{ exportOrReexportModules, indirectExternal: true, sideEffectModules }
|
|
18074
|
+
];
|
|
17734
18075
|
}
|
|
17735
18076
|
if (foundSyntheticDeclaration) {
|
|
17736
|
-
return [foundSyntheticDeclaration];
|
|
18077
|
+
return [foundSyntheticDeclaration, { exportOrReexportModules, sideEffectModules }];
|
|
17737
18078
|
}
|
|
17738
18079
|
return [null];
|
|
17739
18080
|
}
|