@rollup/wasm-node 4.0.0-19 → 4.0.0-21
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 +2 -2
- package/dist/es/getLogFilter.js +2 -2
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/node-entry.js +121 -234
- package/dist/es/shared/watch.js +2 -2
- package/dist/getLogFilter.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/rollup.d.ts +0 -41
- package/dist/rollup.js +2 -2
- package/dist/shared/fsevents-importer.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/rollup.js +121 -234
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch-proxy.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/dist/wasm-node/bindings_wasm.js +48 -48
- package/dist/wasm-node/bindings_wasm_bg.wasm +0 -0
- package/package.json +10 -10
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.0.0-
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.0.0-21
|
|
4
|
+
Sun, 24 Sep 2023 17:21:35 GMT - commit fa868ad975b9ae6007ddc64b1a9e82766de6fa9e
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -31,7 +31,7 @@ function _interopNamespaceDefault(e) {
|
|
|
31
31
|
|
|
32
32
|
const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
|
|
33
33
|
|
|
34
|
-
var version = "4.0.0-
|
|
34
|
+
var version = "4.0.0-21";
|
|
35
35
|
|
|
36
36
|
function ensureArray$1(items) {
|
|
37
37
|
if (Array.isArray(items)) {
|
|
@@ -317,26 +317,19 @@ const URL_NAME_IS_NOT_EXPORTED = 'troubleshooting/#error-name-is-not-exported-by
|
|
|
317
317
|
const URL_THIS_IS_UNDEFINED = 'troubleshooting/#error-this-is-undefined';
|
|
318
318
|
const URL_TREATING_MODULE_AS_EXTERNAL_DEPENDENCY = 'troubleshooting/#warning-treating-module-as-external-dependency';
|
|
319
319
|
const URL_SOURCEMAP_IS_LIKELY_TO_BE_INCORRECT = 'troubleshooting/#warning-sourcemap-is-likely-to-be-incorrect';
|
|
320
|
-
// configuration-options
|
|
321
|
-
const URL_MAXPARALLELFILEOPS = 'configuration-options/#maxparallelfileops';
|
|
322
320
|
const URL_OUTPUT_AMD_ID = 'configuration-options/#output-amd-id';
|
|
323
321
|
const URL_OUTPUT_AMD_BASEPATH = 'configuration-options/#output-amd-basepath';
|
|
324
322
|
const URL_OUTPUT_DIR = 'configuration-options/#output-dir';
|
|
325
|
-
const URL_OUTPUT_DYNAMICIMPORTFUNCTION = 'configuration-options/#output-dynamicimportfunction';
|
|
326
323
|
const URL_OUTPUT_EXPORTS = 'configuration-options/#output-exports';
|
|
327
324
|
const URL_OUTPUT_EXTEND = 'configuration-options/#output-extend';
|
|
328
325
|
const URL_OUTPUT_EXTERNALIMPORTATTRIBUTES = 'configuration-options/#output-externalimportattributes';
|
|
329
326
|
const URL_OUTPUT_FORMAT = 'configuration-options/#output-format';
|
|
330
327
|
const URL_OUTPUT_GENERATEDCODE = 'configuration-options/#output-generatedcode';
|
|
331
|
-
const URL_OUTPUT_EXPERIMENTALDEEPCHUNKOPTIMIZATION = 'configuration-options/#output-experimentaldeepdynamicchunkoptimization';
|
|
332
|
-
const URL_OUTPUT_GENERATEDCODE_CONSTBINDINGS = 'configuration-options/#output-generatedcode-constbindings';
|
|
333
|
-
const URL_OUTPUT_GENERATEDCODE_SYMBOLS = 'configuration-options/#output-generatedcode-symbols';
|
|
334
328
|
const URL_OUTPUT_GLOBALS = 'configuration-options/#output-globals';
|
|
335
329
|
const URL_OUTPUT_INLINEDYNAMICIMPORTS = 'configuration-options/#output-inlinedynamicimports';
|
|
336
330
|
const URL_OUTPUT_INTEROP = 'configuration-options/#output-interop';
|
|
337
331
|
const URL_OUTPUT_MANUALCHUNKS = 'configuration-options/#output-manualchunks';
|
|
338
332
|
const URL_OUTPUT_NAME = 'configuration-options/#output-name';
|
|
339
|
-
const URL_OUTPUT_PRESERVEMODULES = 'configuration-options/#output-preservemodules';
|
|
340
333
|
const URL_OUTPUT_SOURCEMAPBASEURL = 'configuration-options/#output-sourcemapbaseurl';
|
|
341
334
|
const URL_OUTPUT_SOURCEMAPFILE = 'configuration-options/#output-sourcemapfile';
|
|
342
335
|
const URL_PRESERVEENTRYSIGNATURES = 'configuration-options/#preserveentrysignatures';
|
|
@@ -346,9 +339,6 @@ const URL_WATCH = 'configuration-options/#watch';
|
|
|
346
339
|
// command-line-interface
|
|
347
340
|
const URL_BUNDLE_CONFIG_AS_CJS = 'command-line-interface/#bundleconfigascjs';
|
|
348
341
|
const URL_CONFIGURATION_FILES = 'command-line-interface/#configuration-files';
|
|
349
|
-
const URL_RENDERDYNAMICIMPORT = 'plugin-development/#renderdynamicimport';
|
|
350
|
-
const URL_THIS_GETMODULEIDS = 'plugin-development/#this-getmoduleids';
|
|
351
|
-
const URL_THIS_GETMODULEINFO = 'plugin-development/#this-getmoduleinfo';
|
|
352
342
|
|
|
353
343
|
function error(base) {
|
|
354
344
|
if (!(base instanceof Error)) {
|
|
@@ -1400,7 +1390,7 @@ class FileEmitter {
|
|
|
1400
1390
|
this.filesByReferenceId.set(referenceId, assetWithFileName);
|
|
1401
1391
|
const existingAsset = bundle[fileName];
|
|
1402
1392
|
if (existingAsset?.type === 'asset') {
|
|
1403
|
-
existingAsset.needsCodeReference
|
|
1393
|
+
existingAsset.needsCodeReference &&= needsCodeReference;
|
|
1404
1394
|
}
|
|
1405
1395
|
else {
|
|
1406
1396
|
bundle[fileName] = {
|
|
@@ -1417,7 +1407,7 @@ class FileEmitter {
|
|
|
1417
1407
|
let usedConsumedFile;
|
|
1418
1408
|
let needsCodeReference = true;
|
|
1419
1409
|
for (const consumedFile of consumedFiles) {
|
|
1420
|
-
needsCodeReference
|
|
1410
|
+
needsCodeReference &&= consumedFile.needsCodeReference;
|
|
1421
1411
|
const assetFileName = generateAssetFileName(consumedFile.name, consumedFile.source, sourceHash, outputOptions, bundle);
|
|
1422
1412
|
if (!fileName ||
|
|
1423
1413
|
assetFileName.length < fileName.length ||
|
|
@@ -1750,17 +1740,9 @@ function getPluginContext(plugin, pluginCache, graph, options, fileEmitter, exis
|
|
|
1750
1740
|
rollupVersion: version,
|
|
1751
1741
|
watchMode: graph.watchMode
|
|
1752
1742
|
},
|
|
1753
|
-
get moduleIds() {
|
|
1754
|
-
function* wrappedModuleIds() {
|
|
1755
|
-
// We are wrapping this in a generator to only show the message once we are actually iterating
|
|
1756
|
-
warnDeprecation(`Accessing "this.moduleIds" on the plugin context by plugin ${plugin.name} is deprecated. The "this.getModuleIds" plugin context function should be used instead.`, URL_THIS_GETMODULEIDS, true, options, plugin.name);
|
|
1757
|
-
yield* moduleIds;
|
|
1758
|
-
}
|
|
1759
|
-
const moduleIds = graph.modulesById.keys();
|
|
1760
|
-
return wrappedModuleIds();
|
|
1761
|
-
},
|
|
1762
1743
|
parse: graph.contextParse.bind(graph),
|
|
1763
1744
|
resolve(source, importer, { attributes, custom, isEntry, skipSelf } = BLANK) {
|
|
1745
|
+
skipSelf ??= true;
|
|
1764
1746
|
return graph.moduleLoader.resolveId(source, importer, custom, isEntry, attributes || EMPTY_OBJECT, skipSelf ? [{ importer, plugin, source }] : null);
|
|
1765
1747
|
},
|
|
1766
1748
|
setAssetSource: fileEmitter.setAssetSource,
|
|
@@ -2075,7 +2057,7 @@ async function mergeOptions(config, watchMode, rawCommandOptions = EMPTY_COMMAND
|
|
|
2075
2057
|
const logLevel = config.logLevel || LOGLEVEL_INFO;
|
|
2076
2058
|
const onLog = getOnLog(config, logLevel, printLog);
|
|
2077
2059
|
const log = getLogger(plugins, onLog, watchMode, logLevel);
|
|
2078
|
-
const inputOptions =
|
|
2060
|
+
const inputOptions = mergeInputOptions(config, command, plugins, log, onLog);
|
|
2079
2061
|
if (command.output) {
|
|
2080
2062
|
Object.assign(command, command.output);
|
|
2081
2063
|
}
|
|
@@ -2089,14 +2071,14 @@ async function mergeOptions(config, watchMode, rawCommandOptions = EMPTY_COMMAND
|
|
|
2089
2071
|
...Object.keys(commandAliases),
|
|
2090
2072
|
'bundleConfigAsCjs',
|
|
2091
2073
|
'config',
|
|
2074
|
+
'configPlugin',
|
|
2092
2075
|
'environment',
|
|
2076
|
+
'failAfterWarnings',
|
|
2093
2077
|
'filterLogs',
|
|
2094
2078
|
'plugin',
|
|
2095
2079
|
'silent',
|
|
2096
|
-
'failAfterWarnings',
|
|
2097
2080
|
'stdin',
|
|
2098
|
-
'waitForBundleInput'
|
|
2099
|
-
'configPlugin'
|
|
2081
|
+
'waitForBundleInput'
|
|
2100
2082
|
], 'CLI flags', log, /^_$|output$|config/);
|
|
2101
2083
|
inputOptions.output = outputOptions;
|
|
2102
2084
|
return inputOptions;
|
|
@@ -2128,20 +2110,16 @@ function mergeInputOptions(config, overrides, plugins, log, onLog) {
|
|
|
2128
2110
|
experimentalCacheExpiry: getOption('experimentalCacheExpiry'),
|
|
2129
2111
|
experimentalLogSideEffects: getOption('experimentalLogSideEffects'),
|
|
2130
2112
|
external: getExternal(config, overrides),
|
|
2131
|
-
inlineDynamicImports: getOption('inlineDynamicImports'),
|
|
2132
2113
|
input: getOption('input') || [],
|
|
2133
2114
|
logLevel: getOption('logLevel'),
|
|
2134
2115
|
makeAbsoluteExternalsRelative: getOption('makeAbsoluteExternalsRelative'),
|
|
2135
|
-
manualChunks: getOption('manualChunks'),
|
|
2136
2116
|
maxParallelFileOps: getOption('maxParallelFileOps'),
|
|
2137
|
-
maxParallelFileReads: getOption('maxParallelFileReads'),
|
|
2138
2117
|
moduleContext: getOption('moduleContext'),
|
|
2139
2118
|
onLog,
|
|
2140
2119
|
onwarn: undefined,
|
|
2141
2120
|
perf: getOption('perf'),
|
|
2142
2121
|
plugins,
|
|
2143
2122
|
preserveEntrySignatures: getOption('preserveEntrySignatures'),
|
|
2144
|
-
preserveModules: getOption('preserveModules'),
|
|
2145
2123
|
preserveSymlinks: getOption('preserveSymlinks'),
|
|
2146
2124
|
shimMissingExports: getOption('shimMissingExports'),
|
|
2147
2125
|
strictDeprecations: getOption('strictDeprecations'),
|
|
@@ -2190,11 +2168,9 @@ async function mergeOutputOptions(config, overrides, log) {
|
|
|
2190
2168
|
chunkFileNames: getOption('chunkFileNames'),
|
|
2191
2169
|
compact: getOption('compact'),
|
|
2192
2170
|
dir: getOption('dir'),
|
|
2193
|
-
dynamicImportFunction: getOption('dynamicImportFunction'),
|
|
2194
2171
|
dynamicImportInCjs: getOption('dynamicImportInCjs'),
|
|
2195
2172
|
entryFileNames: getOption('entryFileNames'),
|
|
2196
2173
|
esModule: getOption('esModule'),
|
|
2197
|
-
experimentalDeepDynamicChunkOptimization: getOption('experimentalDeepDynamicChunkOptimization'),
|
|
2198
2174
|
experimentalMinChunkSize: getOption('experimentalMinChunkSize'),
|
|
2199
2175
|
exports: getOption('exports'),
|
|
2200
2176
|
extend: getOption('extend'),
|
|
@@ -2215,12 +2191,10 @@ async function mergeOutputOptions(config, overrides, log) {
|
|
|
2215
2191
|
manualChunks: getOption('manualChunks'),
|
|
2216
2192
|
minifyInternalExports: getOption('minifyInternalExports'),
|
|
2217
2193
|
name: getOption('name'),
|
|
2218
|
-
namespaceToStringTag: getOption('namespaceToStringTag'),
|
|
2219
2194
|
noConflict: getOption('noConflict'),
|
|
2220
2195
|
outro: getOption('outro'),
|
|
2221
2196
|
paths: getOption('paths'),
|
|
2222
2197
|
plugins: await normalizePluginOption(config.plugins),
|
|
2223
|
-
preferConst: getOption('preferConst'),
|
|
2224
2198
|
preserveModules: getOption('preserveModules'),
|
|
2225
2199
|
preserveModulesRoot: getOption('preserveModulesRoot'),
|
|
2226
2200
|
sanitizeFileName: getOption('sanitizeFileName'),
|
|
@@ -4091,9 +4065,9 @@ class ExternalChunk {
|
|
|
4091
4065
|
(this.renormalizeRenderPath ? normalize(node_path.relative(this.inputBase, this.id)) : this.id));
|
|
4092
4066
|
}
|
|
4093
4067
|
getImportAttributes(snippets) {
|
|
4094
|
-
return (this.importAttributes
|
|
4068
|
+
return (this.importAttributes ||= formatAttributes(this.options.format === 'es' &&
|
|
4095
4069
|
this.options.externalImportAttributes &&
|
|
4096
|
-
this.moduleInfo.attributes, snippets))
|
|
4070
|
+
this.moduleInfo.attributes, snippets));
|
|
4097
4071
|
}
|
|
4098
4072
|
getImportPath(importer) {
|
|
4099
4073
|
return escapeId(this.renormalizeRenderPath
|
|
@@ -4271,7 +4245,7 @@ class Variable extends ExpressionEntity {
|
|
|
4271
4245
|
* collisions
|
|
4272
4246
|
*/
|
|
4273
4247
|
forbidName(name) {
|
|
4274
|
-
(this.forbiddenNames
|
|
4248
|
+
(this.forbiddenNames ||= new Set()).add(name);
|
|
4275
4249
|
}
|
|
4276
4250
|
getBaseVariableName() {
|
|
4277
4251
|
return this.renderBaseName || this.renderName || this.name;
|
|
@@ -4413,7 +4387,7 @@ class ExternalModule {
|
|
|
4413
4387
|
this.nameSuggestions = new Map();
|
|
4414
4388
|
this.suggestedVariableName = makeLegal(id.split(/[/\\]/).pop());
|
|
4415
4389
|
const { importers, dynamicImporters } = this;
|
|
4416
|
-
|
|
4390
|
+
this.info = {
|
|
4417
4391
|
ast: null,
|
|
4418
4392
|
attributes,
|
|
4419
4393
|
code: null,
|
|
@@ -4425,10 +4399,6 @@ class ExternalModule {
|
|
|
4425
4399
|
exportedBindings: null,
|
|
4426
4400
|
exports: null,
|
|
4427
4401
|
hasDefaultExport: null,
|
|
4428
|
-
get hasModuleSideEffects() {
|
|
4429
|
-
warnDeprecation('Accessing ModuleInfo.hasModuleSideEffects from plugins is deprecated. Please use ModuleInfo.moduleSideEffects instead.', URL_THIS_GETMODULEINFO, true, options);
|
|
4430
|
-
return info.moduleSideEffects;
|
|
4431
|
-
},
|
|
4432
4402
|
id,
|
|
4433
4403
|
implicitlyLoadedAfterOneOf: EMPTY_ARRAY,
|
|
4434
4404
|
implicitlyLoadedBefore: EMPTY_ARRAY,
|
|
@@ -4443,11 +4413,7 @@ class ExternalModule {
|
|
|
4443
4413
|
meta,
|
|
4444
4414
|
moduleSideEffects,
|
|
4445
4415
|
syntheticNamedExports: false
|
|
4446
|
-
}
|
|
4447
|
-
// Hide the deprecated key so that it only warns when accessed explicitly
|
|
4448
|
-
Object.defineProperty(this.info, 'hasModuleSideEffects', {
|
|
4449
|
-
enumerable: false
|
|
4450
|
-
});
|
|
4416
|
+
};
|
|
4451
4417
|
}
|
|
4452
4418
|
getVariableForExportName(name) {
|
|
4453
4419
|
const declaration = this.declarations.get(name);
|
|
@@ -7023,7 +6989,7 @@ const nodeConverters = [
|
|
|
7023
6989
|
const parameters = convertNodeList(buffer[position++], buffer, readString);
|
|
7024
6990
|
const body = convertNode(buffer[position++], buffer, readString);
|
|
7025
6991
|
const annotations = convertAnnotationList(position, buffer);
|
|
7026
|
-
return {
|
|
6992
|
+
return addAnnotationProperty({
|
|
7027
6993
|
type: 'ArrowFunctionExpression',
|
|
7028
6994
|
start,
|
|
7029
6995
|
end,
|
|
@@ -7032,9 +6998,8 @@ const nodeConverters = [
|
|
|
7032
6998
|
expression,
|
|
7033
6999
|
generator,
|
|
7034
7000
|
id: null,
|
|
7035
|
-
params: parameters
|
|
7036
|
-
|
|
7037
|
-
};
|
|
7001
|
+
params: parameters
|
|
7002
|
+
}, annotations, ANNOTATION_KEY);
|
|
7038
7003
|
},
|
|
7039
7004
|
// index:3; AssignmentExpression
|
|
7040
7005
|
(position, buffer, readString) => {
|
|
@@ -7126,15 +7091,14 @@ const nodeConverters = [
|
|
|
7126
7091
|
const callee = convertNode(buffer[position++], buffer, readString);
|
|
7127
7092
|
const argumentsList = convertNodeList(buffer[position++], buffer, readString);
|
|
7128
7093
|
const annotations = convertAnnotationList(position, buffer);
|
|
7129
|
-
return {
|
|
7094
|
+
return addAnnotationProperty({
|
|
7130
7095
|
type: 'CallExpression',
|
|
7131
7096
|
start,
|
|
7132
7097
|
end,
|
|
7133
7098
|
arguments: argumentsList,
|
|
7134
7099
|
callee,
|
|
7135
|
-
optional
|
|
7136
|
-
|
|
7137
|
-
};
|
|
7100
|
+
optional
|
|
7101
|
+
}, annotations, ANNOTATION_KEY);
|
|
7138
7102
|
},
|
|
7139
7103
|
// index:10; CatchClause
|
|
7140
7104
|
(position, buffer, readString) => {
|
|
@@ -7409,7 +7373,7 @@ const nodeConverters = [
|
|
|
7409
7373
|
const parameters = convertNodeList(buffer[position++], buffer, readString);
|
|
7410
7374
|
const body = convertNode(buffer[position++], buffer, readString);
|
|
7411
7375
|
const annotations = convertAnnotationList(position, buffer);
|
|
7412
|
-
return {
|
|
7376
|
+
return addAnnotationProperty({
|
|
7413
7377
|
type: 'FunctionDeclaration',
|
|
7414
7378
|
start,
|
|
7415
7379
|
end,
|
|
@@ -7418,9 +7382,8 @@ const nodeConverters = [
|
|
|
7418
7382
|
expression: false,
|
|
7419
7383
|
generator,
|
|
7420
7384
|
id: idPosition ? convertNode(idPosition, buffer, readString) : null,
|
|
7421
|
-
params: parameters
|
|
7422
|
-
|
|
7423
|
-
};
|
|
7385
|
+
params: parameters
|
|
7386
|
+
}, annotations, ANNOTATION_KEY);
|
|
7424
7387
|
},
|
|
7425
7388
|
// index:29; FunctionExpression
|
|
7426
7389
|
(position, buffer, readString) => {
|
|
@@ -7432,7 +7395,7 @@ const nodeConverters = [
|
|
|
7432
7395
|
const parameters = convertNodeList(buffer[position++], buffer, readString);
|
|
7433
7396
|
const body = convertNode(buffer[position++], buffer, readString);
|
|
7434
7397
|
const annotations = convertAnnotationList(position, buffer);
|
|
7435
|
-
return {
|
|
7398
|
+
return addAnnotationProperty({
|
|
7436
7399
|
type: 'FunctionExpression',
|
|
7437
7400
|
start,
|
|
7438
7401
|
end,
|
|
@@ -7441,9 +7404,8 @@ const nodeConverters = [
|
|
|
7441
7404
|
expression: false,
|
|
7442
7405
|
generator,
|
|
7443
7406
|
id: idPosition ? convertNode(idPosition, buffer, readString) : null,
|
|
7444
|
-
params: parameters
|
|
7445
|
-
|
|
7446
|
-
};
|
|
7407
|
+
params: parameters
|
|
7408
|
+
}, annotations, ANNOTATION_KEY);
|
|
7447
7409
|
},
|
|
7448
7410
|
// index:30; Identifier
|
|
7449
7411
|
(position, buffer, readString) => {
|
|
@@ -7733,14 +7695,13 @@ const nodeConverters = [
|
|
|
7733
7695
|
const callee = convertNode(buffer[position++], buffer, readString);
|
|
7734
7696
|
const argumentsPosition = buffer[position++];
|
|
7735
7697
|
const annotations = convertAnnotationList(position, buffer);
|
|
7736
|
-
return {
|
|
7698
|
+
return addAnnotationProperty({
|
|
7737
7699
|
type: 'NewExpression',
|
|
7738
7700
|
start,
|
|
7739
7701
|
end,
|
|
7740
7702
|
arguments: argumentsPosition ? convertNodeList(argumentsPosition, buffer, readString) : [],
|
|
7741
|
-
callee
|
|
7742
|
-
|
|
7743
|
-
};
|
|
7703
|
+
callee
|
|
7704
|
+
}, annotations, ANNOTATION_KEY);
|
|
7744
7705
|
},
|
|
7745
7706
|
// index:50; ObjectExpression
|
|
7746
7707
|
(position, buffer, readString) => {
|
|
@@ -7784,14 +7745,13 @@ const nodeConverters = [
|
|
|
7784
7745
|
const end = buffer[position++];
|
|
7785
7746
|
const annotations = convertAnnotationList(buffer[position++], buffer);
|
|
7786
7747
|
const body = convertNodeList(position, buffer, readString);
|
|
7787
|
-
return {
|
|
7748
|
+
return addAnnotationProperty({
|
|
7788
7749
|
type: 'Program',
|
|
7789
7750
|
start,
|
|
7790
7751
|
end,
|
|
7791
7752
|
body,
|
|
7792
|
-
sourceType: 'module'
|
|
7793
|
-
|
|
7794
|
-
};
|
|
7753
|
+
sourceType: 'module'
|
|
7754
|
+
}, annotations, INVALID_ANNOTATION_KEY);
|
|
7795
7755
|
},
|
|
7796
7756
|
// index:54; Property
|
|
7797
7757
|
(position, buffer, readString) => {
|
|
@@ -8135,6 +8095,15 @@ const convertAnnotation = (position, buffer) => {
|
|
|
8135
8095
|
const type = FIXED_STRINGS[buffer[position]];
|
|
8136
8096
|
return { end, start, type };
|
|
8137
8097
|
};
|
|
8098
|
+
const addAnnotationProperty = (node, annotations, key) => {
|
|
8099
|
+
if (annotations.length > 0) {
|
|
8100
|
+
return {
|
|
8101
|
+
...node,
|
|
8102
|
+
[key]: annotations
|
|
8103
|
+
};
|
|
8104
|
+
}
|
|
8105
|
+
return node;
|
|
8106
|
+
};
|
|
8138
8107
|
const convertString = (position, buffer, readString) => {
|
|
8139
8108
|
const length = buffer[position++];
|
|
8140
8109
|
const bytePosition = position << 2;
|
|
@@ -9285,7 +9254,7 @@ class ParameterVariable extends LocalVariable {
|
|
|
9285
9254
|
for (const entity of this.entitiesToBeDeoptimized) {
|
|
9286
9255
|
// We do not need a recursion tracker here as we already track whether
|
|
9287
9256
|
// this field is deoptimized
|
|
9288
|
-
entity.deoptimizePath(
|
|
9257
|
+
entity.deoptimizePath([key]);
|
|
9289
9258
|
}
|
|
9290
9259
|
if (key === UnknownKey) {
|
|
9291
9260
|
// save some memory
|
|
@@ -9583,7 +9552,7 @@ const getPureFunctions = ({ treeshake }) => {
|
|
|
9583
9552
|
for (const functionName of treeshake ? treeshake.manualPureFunctions : []) {
|
|
9584
9553
|
let currentFunctions = pureFunctions;
|
|
9585
9554
|
for (const pathSegment of functionName.split('.')) {
|
|
9586
|
-
currentFunctions = currentFunctions[pathSegment]
|
|
9555
|
+
currentFunctions = currentFunctions[pathSegment] ||= Object.create(null);
|
|
9587
9556
|
}
|
|
9588
9557
|
currentFunctions[PureFunctionKey] = true;
|
|
9589
9558
|
}
|
|
@@ -13328,7 +13297,7 @@ const namespaceInteropHelpersByInteropType = {
|
|
|
13328
13297
|
esModule: null
|
|
13329
13298
|
};
|
|
13330
13299
|
const canDefaultBeTakenFromNamespace = (interopType, externalLiveBindings) => interopType !== 'esModule' && isDefaultAProperty(interopType, externalLiveBindings);
|
|
13331
|
-
const getHelpersBlock = (additionalHelpers, accessedGlobals, indent, snippets, liveBindings, freeze,
|
|
13300
|
+
const getHelpersBlock = (additionalHelpers, accessedGlobals, indent, snippets, liveBindings, freeze, symbols) => {
|
|
13332
13301
|
const usedHelpers = new Set(additionalHelpers);
|
|
13333
13302
|
for (const variable of HELPER_NAMES) {
|
|
13334
13303
|
if (accessedGlobals.has(variable)) {
|
|
@@ -13336,7 +13305,7 @@ const getHelpersBlock = (additionalHelpers, accessedGlobals, indent, snippets, l
|
|
|
13336
13305
|
}
|
|
13337
13306
|
}
|
|
13338
13307
|
return HELPER_NAMES.map(variable => usedHelpers.has(variable)
|
|
13339
|
-
? HELPER_GENERATORS[variable](indent, snippets, liveBindings, freeze,
|
|
13308
|
+
? HELPER_GENERATORS[variable](indent, snippets, liveBindings, freeze, symbols, usedHelpers)
|
|
13340
13309
|
: '').join('');
|
|
13341
13310
|
};
|
|
13342
13311
|
const HELPER_GENERATORS = {
|
|
@@ -13363,7 +13332,7 @@ const HELPER_GENERATORS = {
|
|
|
13363
13332
|
return (`${left}e${_}&&${_}e.__esModule${_}?${_}` +
|
|
13364
13333
|
`${liveBindings ? getDefaultLiveBinding(snippets) : getDefaultStatic(snippets)}${right}${n}${n}`);
|
|
13365
13334
|
},
|
|
13366
|
-
[INTEROP_NAMESPACE_COMPAT_VARIABLE](t, snippets, liveBindings, freeze,
|
|
13335
|
+
[INTEROP_NAMESPACE_COMPAT_VARIABLE](t, snippets, liveBindings, freeze, symbols, usedHelpers) {
|
|
13367
13336
|
const { _, getDirectReturnFunction, n } = snippets;
|
|
13368
13337
|
if (usedHelpers.has(INTEROP_NAMESPACE_DEFAULT_VARIABLE)) {
|
|
13369
13338
|
const [left, right] = getDirectReturnFunction(['e'], {
|
|
@@ -13375,28 +13344,28 @@ const HELPER_GENERATORS = {
|
|
|
13375
13344
|
}
|
|
13376
13345
|
return (`function ${INTEROP_NAMESPACE_COMPAT_VARIABLE}(e)${_}{${n}` +
|
|
13377
13346
|
`${t}if${_}(${getIsCompatNamespace(snippets)})${_}return e;${n}` +
|
|
13378
|
-
createNamespaceObject(t, t, snippets, liveBindings, freeze,
|
|
13347
|
+
createNamespaceObject(t, t, snippets, liveBindings, freeze, symbols) +
|
|
13379
13348
|
`}${n}${n}`);
|
|
13380
13349
|
},
|
|
13381
|
-
[INTEROP_NAMESPACE_DEFAULT_ONLY_VARIABLE](_t, snippets, _liveBindings, freeze,
|
|
13350
|
+
[INTEROP_NAMESPACE_DEFAULT_ONLY_VARIABLE](_t, snippets, _liveBindings, freeze, symbols) {
|
|
13382
13351
|
const { getDirectReturnFunction, getObject, n } = snippets;
|
|
13383
13352
|
const [left, right] = getDirectReturnFunction(['e'], {
|
|
13384
13353
|
functionReturn: true,
|
|
13385
13354
|
lineBreakIndent: null,
|
|
13386
13355
|
name: INTEROP_NAMESPACE_DEFAULT_ONLY_VARIABLE
|
|
13387
13356
|
});
|
|
13388
|
-
return `${left}${getFrozen(freeze, getWithToStringTag(
|
|
13357
|
+
return `${left}${getFrozen(freeze, getWithToStringTag(symbols, getObject([
|
|
13389
13358
|
['__proto__', 'null'],
|
|
13390
13359
|
['default', 'e']
|
|
13391
13360
|
], { lineBreakIndent: null }), snippets))}${right}${n}${n}`;
|
|
13392
13361
|
},
|
|
13393
|
-
[INTEROP_NAMESPACE_DEFAULT_VARIABLE](t, snippets, liveBindings, freeze,
|
|
13362
|
+
[INTEROP_NAMESPACE_DEFAULT_VARIABLE](t, snippets, liveBindings, freeze, symbols) {
|
|
13394
13363
|
const { _, n } = snippets;
|
|
13395
13364
|
return (`function ${INTEROP_NAMESPACE_DEFAULT_VARIABLE}(e)${_}{${n}` +
|
|
13396
|
-
createNamespaceObject(t, t, snippets, liveBindings, freeze,
|
|
13365
|
+
createNamespaceObject(t, t, snippets, liveBindings, freeze, symbols) +
|
|
13397
13366
|
`}${n}${n}`);
|
|
13398
13367
|
},
|
|
13399
|
-
[INTEROP_NAMESPACE_VARIABLE](t, snippets, liveBindings, freeze,
|
|
13368
|
+
[INTEROP_NAMESPACE_VARIABLE](t, snippets, liveBindings, freeze, symbols, usedHelpers) {
|
|
13400
13369
|
const { _, getDirectReturnFunction, n } = snippets;
|
|
13401
13370
|
if (usedHelpers.has(INTEROP_NAMESPACE_DEFAULT_VARIABLE)) {
|
|
13402
13371
|
const [left, right] = getDirectReturnFunction(['e'], {
|
|
@@ -13408,10 +13377,10 @@ const HELPER_GENERATORS = {
|
|
|
13408
13377
|
}
|
|
13409
13378
|
return (`function ${INTEROP_NAMESPACE_VARIABLE}(e)${_}{${n}` +
|
|
13410
13379
|
`${t}if${_}(e${_}&&${_}e.__esModule)${_}return e;${n}` +
|
|
13411
|
-
createNamespaceObject(t, t, snippets, liveBindings, freeze,
|
|
13380
|
+
createNamespaceObject(t, t, snippets, liveBindings, freeze, symbols) +
|
|
13412
13381
|
`}${n}${n}`);
|
|
13413
13382
|
},
|
|
13414
|
-
[MERGE_NAMESPACES_VARIABLE](t, snippets, liveBindings, freeze,
|
|
13383
|
+
[MERGE_NAMESPACES_VARIABLE](t, snippets, liveBindings, freeze, symbols) {
|
|
13415
13384
|
const { _, cnst, n } = snippets;
|
|
13416
13385
|
const useForEach = cnst === 'var' && liveBindings;
|
|
13417
13386
|
return (`function ${MERGE_NAMESPACES_VARIABLE}(n, m)${_}{${n}` +
|
|
@@ -13424,21 +13393,19 @@ const HELPER_GENERATORS = {
|
|
|
13424
13393
|
: copyPropertyStatic)(t, t + t + t + t, snippets) +
|
|
13425
13394
|
`${t}${t}${t}}${n}` +
|
|
13426
13395
|
`${t}${t}}`, useForEach, t, snippets)}${n}` +
|
|
13427
|
-
`${t}return ${getFrozen(freeze, getWithToStringTag(
|
|
13396
|
+
`${t}return ${getFrozen(freeze, getWithToStringTag(symbols, 'n', snippets))};${n}` +
|
|
13428
13397
|
`}${n}${n}`);
|
|
13429
13398
|
}
|
|
13430
13399
|
};
|
|
13431
13400
|
const getDefaultLiveBinding = ({ _, getObject }) => `e${_}:${_}${getObject([['default', 'e']], { lineBreakIndent: null })}`;
|
|
13432
13401
|
const getDefaultStatic = ({ _, getPropertyAccess }) => `e${getPropertyAccess('default')}${_}:${_}e`;
|
|
13433
13402
|
const getIsCompatNamespace = ({ _ }) => `e${_}&&${_}typeof e${_}===${_}'object'${_}&&${_}'default'${_}in e`;
|
|
13434
|
-
const createNamespaceObject = (t, index, snippets, liveBindings, freeze,
|
|
13403
|
+
const createNamespaceObject = (t, index, snippets, liveBindings, freeze, symbols) => {
|
|
13435
13404
|
const { _, cnst, getObject, getPropertyAccess, n, s } = snippets;
|
|
13436
13405
|
const copyProperty = `{${n}` +
|
|
13437
13406
|
(liveBindings ? copyNonDefaultOwnPropertyLiveBinding : copyPropertyStatic)(t, index + t + t, snippets) +
|
|
13438
13407
|
`${index}${t}}`;
|
|
13439
|
-
return (`${index}${cnst} n${_}=${_}Object.create(null${
|
|
13440
|
-
? `,${_}{${_}[Symbol.toStringTag]:${_}${getToStringTagValue(getObject)}${_}}`
|
|
13441
|
-
: ''});${n}` +
|
|
13408
|
+
return (`${index}${cnst} n${_}=${_}Object.create(null${symbols ? `,${_}{${_}[Symbol.toStringTag]:${_}${getToStringTagValue(getObject)}${_}}` : ''});${n}` +
|
|
13442
13409
|
`${index}if${_}(e)${_}{${n}` +
|
|
13443
13410
|
`${index}${t}${loopOverKeys(copyProperty, !liveBindings, snippets)}${n}` +
|
|
13444
13411
|
`${index}}${n}` +
|
|
@@ -13502,7 +13469,7 @@ const copyPropertyLiveBinding = (t, index, { _, cnst, getDirectReturnFunction, n
|
|
|
13502
13469
|
};
|
|
13503
13470
|
const copyPropertyStatic = (_t, index, { _, n }) => `${index}n[k]${_}=${_}e[k];${n}`;
|
|
13504
13471
|
const getFrozen = (freeze, fragment) => freeze ? `Object.freeze(${fragment})` : fragment;
|
|
13505
|
-
const getWithToStringTag = (
|
|
13472
|
+
const getWithToStringTag = (symbols, fragment, { _, getObject }) => symbols
|
|
13506
13473
|
? `Object.defineProperty(${fragment},${_}Symbol.toStringTag,${_}${getToStringTagValue(getObject)})`
|
|
13507
13474
|
: fragment;
|
|
13508
13475
|
const HELPER_NAMES = Object.keys(HELPER_GENERATORS);
|
|
@@ -13749,7 +13716,7 @@ class ImportExpression extends NodeBase {
|
|
|
13749
13716
|
this.inlineNamespace = inlineNamespace;
|
|
13750
13717
|
}
|
|
13751
13718
|
applyDeoptimizations() { }
|
|
13752
|
-
getDynamicImportMechanismAndHelper(resolution, exportMode, { compact,
|
|
13719
|
+
getDynamicImportMechanismAndHelper(resolution, exportMode, { compact, dynamicImportInCjs, format, generatedCode: { arrowFunctions }, interop }, { _, getDirectReturnFunction, getDirectReturnIifeLeft }, pluginDriver) {
|
|
13753
13720
|
const mechanism = pluginDriver.hookFirstSync('renderDynamicImport', [
|
|
13754
13721
|
{
|
|
13755
13722
|
customResolution: typeof this.resolution === 'string' ? this.resolution : null,
|
|
@@ -13834,17 +13801,6 @@ class ImportExpression extends NodeBase {
|
|
|
13834
13801
|
}
|
|
13835
13802
|
};
|
|
13836
13803
|
}
|
|
13837
|
-
case 'es': {
|
|
13838
|
-
if (dynamicImportFunction) {
|
|
13839
|
-
return {
|
|
13840
|
-
helper: null,
|
|
13841
|
-
mechanism: {
|
|
13842
|
-
left: `${dynamicImportFunction}(`,
|
|
13843
|
-
right: ')'
|
|
13844
|
-
}
|
|
13845
|
-
};
|
|
13846
|
-
}
|
|
13847
|
-
}
|
|
13848
13804
|
}
|
|
13849
13805
|
return { helper: null, mechanism: null };
|
|
13850
13806
|
}
|
|
@@ -14112,7 +14068,8 @@ class MetaProperty extends NodeBase {
|
|
|
14112
14068
|
]);
|
|
14113
14069
|
if (!replacement) {
|
|
14114
14070
|
replacement = importMetaMechanisms[format]?.(metaProperty, { chunkId, snippets });
|
|
14115
|
-
renderOptions.accessedDocumentCurrentScript
|
|
14071
|
+
renderOptions.accessedDocumentCurrentScript ||=
|
|
14072
|
+
formatsMaybeAccessDocumentCurrentScript.includes(format) && replacement !== 'undefined';
|
|
14116
14073
|
}
|
|
14117
14074
|
if (typeof replacement === 'string') {
|
|
14118
14075
|
if (parent instanceof MemberExpression) {
|
|
@@ -14619,7 +14576,7 @@ class SwitchStatement extends NodeBase {
|
|
|
14619
14576
|
if (switchCase.hasEffects(context))
|
|
14620
14577
|
return true;
|
|
14621
14578
|
// eslint-disable-next-line unicorn/consistent-destructuring
|
|
14622
|
-
onlyHasBrokenFlow
|
|
14579
|
+
onlyHasBrokenFlow &&= context.brokenFlow && !context.hasBreak;
|
|
14623
14580
|
context.hasBreak = false;
|
|
14624
14581
|
context.brokenFlow = brokenFlow;
|
|
14625
14582
|
}
|
|
@@ -14651,7 +14608,7 @@ class SwitchStatement extends NodeBase {
|
|
|
14651
14608
|
if (isCaseIncluded) {
|
|
14652
14609
|
switchCase.include(context, includeChildrenRecursively);
|
|
14653
14610
|
// eslint-disable-next-line unicorn/consistent-destructuring
|
|
14654
|
-
onlyHasBrokenFlow
|
|
14611
|
+
onlyHasBrokenFlow &&= context.brokenFlow && !context.hasBreak;
|
|
14655
14612
|
context.hasBreak = false;
|
|
14656
14613
|
context.brokenFlow = brokenFlow;
|
|
14657
14614
|
}
|
|
@@ -15482,7 +15439,7 @@ class NamespaceVariable extends Variable {
|
|
|
15482
15439
|
}
|
|
15483
15440
|
}
|
|
15484
15441
|
renderBlock(options) {
|
|
15485
|
-
const { exportNamesByVariable, format, freeze, indent: t,
|
|
15442
|
+
const { exportNamesByVariable, format, freeze, indent: t, symbols, snippets: { _, cnst, getObject, getPropertyAccess, n, s } } = options;
|
|
15486
15443
|
const memberVariables = this.getMemberVariables();
|
|
15487
15444
|
const members = Object.entries(memberVariables)
|
|
15488
15445
|
.filter(([_, variable]) => variable.included)
|
|
@@ -15503,7 +15460,7 @@ class NamespaceVariable extends Variable {
|
|
|
15503
15460
|
}
|
|
15504
15461
|
else {
|
|
15505
15462
|
// The helper to merge namespaces will also take care of freezing and toStringTag
|
|
15506
|
-
if (
|
|
15463
|
+
if (symbols) {
|
|
15507
15464
|
output = `/*#__PURE__*/Object.defineProperty(${output},${_}Symbol.toStringTag,${_}${getToStringTagValue(getObject)})`;
|
|
15508
15465
|
}
|
|
15509
15466
|
if (freeze) {
|
|
@@ -15969,10 +15926,10 @@ class Module {
|
|
|
15969
15926
|
get exportedBindings() {
|
|
15970
15927
|
const exportBindings = { '.': [...exports.keys()] };
|
|
15971
15928
|
for (const [name, { source }] of reexportDescriptions) {
|
|
15972
|
-
(exportBindings[source]
|
|
15929
|
+
(exportBindings[source] ??= []).push(name);
|
|
15973
15930
|
}
|
|
15974
15931
|
for (const source of exportAllSources) {
|
|
15975
|
-
(exportBindings[source]
|
|
15932
|
+
(exportBindings[source] ??= []).push('*');
|
|
15976
15933
|
}
|
|
15977
15934
|
return exportBindings;
|
|
15978
15935
|
},
|
|
@@ -15990,10 +15947,6 @@ class Module {
|
|
|
15990
15947
|
}
|
|
15991
15948
|
return module.exports.has('default') || reexportDescriptions.has('default');
|
|
15992
15949
|
},
|
|
15993
|
-
get hasModuleSideEffects() {
|
|
15994
|
-
warnDeprecation('Accessing ModuleInfo.hasModuleSideEffects from plugins is deprecated. Please use ModuleInfo.moduleSideEffects instead.', URL_THIS_GETMODULEINFO, true, options);
|
|
15995
|
-
return this.moduleSideEffects;
|
|
15996
|
-
},
|
|
15997
15950
|
id,
|
|
15998
15951
|
get implicitlyLoadedAfterOneOf() {
|
|
15999
15952
|
// eslint-disable-next-line unicorn/prefer-spread
|
|
@@ -16028,11 +15981,6 @@ class Module {
|
|
|
16028
15981
|
moduleSideEffects,
|
|
16029
15982
|
syntheticNamedExports
|
|
16030
15983
|
};
|
|
16031
|
-
// Hide the deprecated key so that it only warns when accessed explicitly
|
|
16032
|
-
// eslint-disable-next-line unicorn/consistent-destructuring
|
|
16033
|
-
Object.defineProperty(this.info, 'hasModuleSideEffects', {
|
|
16034
|
-
enumerable: false
|
|
16035
|
-
});
|
|
16036
15984
|
}
|
|
16037
15985
|
basename() {
|
|
16038
15986
|
const base = node_path.basename(this.id);
|
|
@@ -16943,7 +16891,7 @@ const getDefineProperty = (name, needsLiveBinding, t, { _, getDirectReturnFuncti
|
|
|
16943
16891
|
return `exports[k]${_}=${_}${name}[k]`;
|
|
16944
16892
|
};
|
|
16945
16893
|
|
|
16946
|
-
function getInteropBlock(dependencies, interop, externalLiveBindings, freeze,
|
|
16894
|
+
function getInteropBlock(dependencies, interop, externalLiveBindings, freeze, symbols, accessedGlobals, indent, snippets) {
|
|
16947
16895
|
const { _, cnst, n } = snippets;
|
|
16948
16896
|
const neededInteropHelpers = new Set();
|
|
16949
16897
|
const interopStatements = [];
|
|
@@ -16995,7 +16943,7 @@ function getInteropBlock(dependencies, interop, externalLiveBindings, freeze, na
|
|
|
16995
16943
|
}
|
|
16996
16944
|
}
|
|
16997
16945
|
}
|
|
16998
|
-
return `${getHelpersBlock(neededInteropHelpers, accessedGlobals, indent, snippets, externalLiveBindings, freeze,
|
|
16946
|
+
return `${getHelpersBlock(neededInteropHelpers, accessedGlobals, indent, snippets, externalLiveBindings, freeze, symbols)}${interopStatements.length > 0 ? `${interopStatements.join(n)}${n}${n}` : ''}`;
|
|
16999
16947
|
}
|
|
17000
16948
|
|
|
17001
16949
|
function addJsExtension(name) {
|
|
@@ -17085,7 +17033,7 @@ function warnOnBuiltins(log, dependencies) {
|
|
|
17085
17033
|
log(LOGLEVEL_WARN, logMissingNodeBuiltins(externalBuiltins));
|
|
17086
17034
|
}
|
|
17087
17035
|
|
|
17088
|
-
function amd(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, id, indent: t, intro, isEntryFacade, isModuleFacade, namedExportsMode, log, outro, snippets }, { amd, esModule, externalLiveBindings, freeze,
|
|
17036
|
+
function amd(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, id, indent: t, intro, isEntryFacade, isModuleFacade, namedExportsMode, log, outro, snippets }, { amd, esModule, externalLiveBindings, freeze, generatedCode: { symbols }, interop, strict }) {
|
|
17089
17037
|
warnOnBuiltins(log, dependencies);
|
|
17090
17038
|
const deps = dependencies.map(m => `'${updateExtensionForRelativeAmdId(m.importPath, amd.forceJsExtensionForImports)}'`);
|
|
17091
17039
|
const parameters = dependencies.map(m => m.name);
|
|
@@ -17106,9 +17054,9 @@ function amd(magicString, { accessedGlobals, dependencies, exports, hasDefaultEx
|
|
|
17106
17054
|
const defineParameters = (completeAmdId ? `'${completeAmdId}',${_}` : ``) +
|
|
17107
17055
|
(deps.length > 0 ? `[${deps.join(`,${_}`)}],${_}` : ``);
|
|
17108
17056
|
const useStrict = strict ? `${_}'use strict';` : '';
|
|
17109
|
-
magicString.prepend(`${intro}${getInteropBlock(dependencies, interop, externalLiveBindings, freeze,
|
|
17057
|
+
magicString.prepend(`${intro}${getInteropBlock(dependencies, interop, externalLiveBindings, freeze, symbols, accessedGlobals, t, snippets)}`);
|
|
17110
17058
|
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings);
|
|
17111
|
-
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, isEntryFacade && (esModule === true || (esModule === 'if-default-prop' && hasDefaultExport)), isModuleFacade &&
|
|
17059
|
+
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, isEntryFacade && (esModule === true || (esModule === 'if-default-prop' && hasDefaultExport)), isModuleFacade && symbols, snippets);
|
|
17112
17060
|
if (namespaceMarkers) {
|
|
17113
17061
|
namespaceMarkers = n + n + namespaceMarkers;
|
|
17114
17062
|
}
|
|
@@ -17124,15 +17072,15 @@ function amd(magicString, { accessedGlobals, dependencies, exports, hasDefaultEx
|
|
|
17124
17072
|
.append(`${n}${n}}));`);
|
|
17125
17073
|
}
|
|
17126
17074
|
|
|
17127
|
-
function cjs(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, indent: t, intro, isEntryFacade, isModuleFacade, namedExportsMode, outro, snippets }, { compact, esModule, externalLiveBindings, freeze, interop,
|
|
17075
|
+
function cjs(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, indent: t, intro, isEntryFacade, isModuleFacade, namedExportsMode, outro, snippets }, { compact, esModule, externalLiveBindings, freeze, interop, generatedCode: { symbols }, strict }) {
|
|
17128
17076
|
const { _, n } = snippets;
|
|
17129
17077
|
const useStrict = strict ? `'use strict';${n}${n}` : '';
|
|
17130
|
-
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, isEntryFacade && (esModule === true || (esModule === 'if-default-prop' && hasDefaultExport)), isModuleFacade &&
|
|
17078
|
+
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, isEntryFacade && (esModule === true || (esModule === 'if-default-prop' && hasDefaultExport)), isModuleFacade && symbols, snippets);
|
|
17131
17079
|
if (namespaceMarkers) {
|
|
17132
17080
|
namespaceMarkers += n + n;
|
|
17133
17081
|
}
|
|
17134
17082
|
const importBlock = getImportBlock$1(dependencies, snippets, compact);
|
|
17135
|
-
const interopBlock = getInteropBlock(dependencies, interop, externalLiveBindings, freeze,
|
|
17083
|
+
const interopBlock = getInteropBlock(dependencies, interop, externalLiveBindings, freeze, symbols, accessedGlobals, t, snippets);
|
|
17136
17084
|
magicString.prepend(`${useStrict}${intro}${namespaceMarkers}${importBlock}${interopBlock}`);
|
|
17137
17085
|
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings, `module.exports${_}=${_}`);
|
|
17138
17086
|
magicString.append(`${exportBlock}${outro}`);
|
|
@@ -17160,12 +17108,12 @@ function getImportBlock$1(dependencies, { _, cnst, n }, compact) {
|
|
|
17160
17108
|
return '';
|
|
17161
17109
|
}
|
|
17162
17110
|
|
|
17163
|
-
function es(magicString, { accessedGlobals, indent: t, intro, outro, dependencies, exports, snippets }, { externalLiveBindings, freeze,
|
|
17111
|
+
function es(magicString, { accessedGlobals, indent: t, intro, outro, dependencies, exports, snippets }, { externalLiveBindings, freeze, generatedCode: { symbols } }) {
|
|
17164
17112
|
const { n } = snippets;
|
|
17165
17113
|
const importBlock = getImportBlock(dependencies, snippets);
|
|
17166
17114
|
if (importBlock.length > 0)
|
|
17167
17115
|
intro += importBlock.join(n) + n + n;
|
|
17168
|
-
intro += getHelpersBlock(null, accessedGlobals, t, snippets, externalLiveBindings, freeze,
|
|
17116
|
+
intro += getHelpersBlock(null, accessedGlobals, t, snippets, externalLiveBindings, freeze, symbols);
|
|
17169
17117
|
if (intro)
|
|
17170
17118
|
magicString.prepend(intro);
|
|
17171
17119
|
const exportBlock = getExportBlock(exports, snippets);
|
|
@@ -17311,7 +17259,7 @@ function trimEmptyImports(dependencies) {
|
|
|
17311
17259
|
return [];
|
|
17312
17260
|
}
|
|
17313
17261
|
|
|
17314
|
-
function iife(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, indent: t, intro, namedExportsMode, log, outro, snippets }, { compact, esModule, extend, freeze, externalLiveBindings, globals, interop, name,
|
|
17262
|
+
function iife(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, indent: t, intro, namedExportsMode, log, outro, snippets }, { compact, esModule, extend, freeze, externalLiveBindings, globals, interop, name, generatedCode: { symbols }, strict }) {
|
|
17315
17263
|
const { _, getNonArrowFunctionIntro, getPropertyAccess, n } = snippets;
|
|
17316
17264
|
const isNamespaced = name && name.includes('.');
|
|
17317
17265
|
const useVariableAssignment = !extend && !isNamespaced;
|
|
@@ -17336,7 +17284,7 @@ function iife(magicString, { accessedGlobals, dependencies, exports, hasDefaultE
|
|
|
17336
17284
|
}
|
|
17337
17285
|
}
|
|
17338
17286
|
const useStrict = strict ? `${t}'use strict';${n}` : '';
|
|
17339
|
-
const interopBlock = getInteropBlock(dependencies, interop, externalLiveBindings, freeze,
|
|
17287
|
+
const interopBlock = getInteropBlock(dependencies, interop, externalLiveBindings, freeze, symbols, accessedGlobals, t, snippets);
|
|
17340
17288
|
magicString.prepend(`${intro}${interopBlock}`);
|
|
17341
17289
|
let wrapperIntro = `(${getNonArrowFunctionIntro(parameters, {
|
|
17342
17290
|
isAsync: false,
|
|
@@ -17357,7 +17305,7 @@ function iife(magicString, { accessedGlobals, dependencies, exports, hasDefaultE
|
|
|
17357
17305
|
wrapperOutro = `${n}${n}${t}return exports;${wrapperOutro}`;
|
|
17358
17306
|
}
|
|
17359
17307
|
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings);
|
|
17360
|
-
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule === true || (esModule === 'if-default-prop' && hasDefaultExport),
|
|
17308
|
+
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule === true || (esModule === 'if-default-prop' && hasDefaultExport), symbols, snippets);
|
|
17361
17309
|
if (namespaceMarkers) {
|
|
17362
17310
|
namespaceMarkers = n + n + namespaceMarkers;
|
|
17363
17311
|
}
|
|
@@ -17368,7 +17316,7 @@ function iife(magicString, { accessedGlobals, dependencies, exports, hasDefaultE
|
|
|
17368
17316
|
.append(wrapperOutro);
|
|
17369
17317
|
}
|
|
17370
17318
|
|
|
17371
|
-
function system(magicString, { accessedGlobals, dependencies, exports, hasExports, indent: t, intro, snippets, outro, usesTopLevelAwait }, { externalLiveBindings, freeze, name,
|
|
17319
|
+
function system(magicString, { accessedGlobals, dependencies, exports, hasExports, indent: t, intro, snippets, outro, usesTopLevelAwait }, { externalLiveBindings, freeze, name, generatedCode: { symbols }, strict, systemNullSetters }) {
|
|
17372
17320
|
const { _, getFunctionIntro, getNonArrowFunctionIntro, n, s } = snippets;
|
|
17373
17321
|
const { importBindings, setters, starExcludes } = analyzeDependencies(dependencies, exports, t, snippets);
|
|
17374
17322
|
const registeredName = name ? `'${name}',${_}` : '';
|
|
@@ -17406,7 +17354,7 @@ function system(magicString, { accessedGlobals, dependencies, exports, hasExport
|
|
|
17406
17354
|
const wrapperEnd = `${t}${t}})${n}${t}}${s}${n}}));`;
|
|
17407
17355
|
magicString
|
|
17408
17356
|
.prepend(intro +
|
|
17409
|
-
getHelpersBlock(null, accessedGlobals, t, snippets, externalLiveBindings, freeze,
|
|
17357
|
+
getHelpersBlock(null, accessedGlobals, t, snippets, externalLiveBindings, freeze, symbols) +
|
|
17410
17358
|
getHoistedExportsBlock(exports, t, snippets))
|
|
17411
17359
|
.append(`${outro}${n}${n}` +
|
|
17412
17360
|
getSyntheticExportsBlock(exports, t, snippets) +
|
|
@@ -17515,7 +17463,7 @@ function safeAccess(name, globalVariable, { _, getPropertyAccess }) {
|
|
|
17515
17463
|
.map(part => (propertyPath += getPropertyAccess(part)))
|
|
17516
17464
|
.join(`${_}&&${_}`);
|
|
17517
17465
|
}
|
|
17518
|
-
function umd(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, id, indent: t, intro, namedExportsMode, log, outro, snippets }, { amd, compact, esModule, extend, externalLiveBindings, freeze, interop, name,
|
|
17466
|
+
function umd(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, id, indent: t, intro, namedExportsMode, log, outro, snippets }, { amd, compact, esModule, extend, externalLiveBindings, freeze, interop, name, generatedCode: { symbols }, globals, noConflict, strict }) {
|
|
17519
17467
|
const { _, cnst, getFunctionIntro, getNonArrowFunctionIntro, getPropertyAccess, n, s } = snippets;
|
|
17520
17468
|
const factoryVariable = compact ? 'f' : 'factory';
|
|
17521
17469
|
const globalVariable = compact ? 'g' : 'global';
|
|
@@ -17595,9 +17543,9 @@ function umd(magicString, { accessedGlobals, dependencies, exports, hasDefaultEx
|
|
|
17595
17543
|
name: null
|
|
17596
17544
|
})}{${useStrict}${n}`;
|
|
17597
17545
|
const wrapperOutro = n + n + '}));';
|
|
17598
|
-
magicString.prepend(`${intro}${getInteropBlock(dependencies, interop, externalLiveBindings, freeze,
|
|
17546
|
+
magicString.prepend(`${intro}${getInteropBlock(dependencies, interop, externalLiveBindings, freeze, symbols, accessedGlobals, t, snippets)}`);
|
|
17599
17547
|
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings);
|
|
17600
|
-
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule === true || (esModule === 'if-default-prop' && hasDefaultExport),
|
|
17548
|
+
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule === true || (esModule === 'if-default-prop' && hasDefaultExport), symbols, snippets);
|
|
17601
17549
|
if (namespaceMarkers) {
|
|
17602
17550
|
namespaceMarkers = n + n + namespaceMarkers;
|
|
17603
17551
|
}
|
|
@@ -18134,10 +18082,10 @@ class Chunk {
|
|
|
18134
18082
|
return facades;
|
|
18135
18083
|
}
|
|
18136
18084
|
getChunkName() {
|
|
18137
|
-
return (this.name
|
|
18085
|
+
return (this.name ??= this.outputOptions.sanitizeFileName(this.getFallbackChunkName()));
|
|
18138
18086
|
}
|
|
18139
18087
|
getExportNames() {
|
|
18140
|
-
return (this.sortedExportNames
|
|
18088
|
+
return (this.sortedExportNames ??= [...this.exportsByName.keys()].sort());
|
|
18141
18089
|
}
|
|
18142
18090
|
getFileName() {
|
|
18143
18091
|
return this.fileName || this.getPreliminaryFileName().fileName;
|
|
@@ -18710,7 +18658,7 @@ class Chunk {
|
|
|
18710
18658
|
// This method changes properties on the AST before rendering and must not be async
|
|
18711
18659
|
renderModules(fileName) {
|
|
18712
18660
|
const { accessedGlobalsByScope, dependencies, exportNamesByVariable, includedNamespaces, inputOptions: { onLog }, isEmpty, orderedModules, outputOptions, pluginDriver, renderedModules, snippets } = this;
|
|
18713
|
-
const { compact,
|
|
18661
|
+
const { compact, format, freeze, generatedCode: { symbols } } = outputOptions;
|
|
18714
18662
|
const { _, cnst, n } = snippets;
|
|
18715
18663
|
this.setDynamicImportResolutions(fileName);
|
|
18716
18664
|
this.setImportMetaResolutions(fileName);
|
|
@@ -18723,14 +18671,13 @@ class Chunk {
|
|
|
18723
18671
|
const renderedModuleSources = new Map();
|
|
18724
18672
|
const renderOptions = {
|
|
18725
18673
|
accessedDocumentCurrentScript: false,
|
|
18726
|
-
dynamicImportFunction,
|
|
18727
18674
|
exportNamesByVariable,
|
|
18728
18675
|
format,
|
|
18729
18676
|
freeze,
|
|
18730
18677
|
indent,
|
|
18731
|
-
namespaceToStringTag,
|
|
18732
18678
|
pluginDriver,
|
|
18733
18679
|
snippets,
|
|
18680
|
+
symbols,
|
|
18734
18681
|
useOriginalName: null
|
|
18735
18682
|
};
|
|
18736
18683
|
let usesTopLevelAwait = false;
|
|
@@ -18746,7 +18693,7 @@ class Chunk {
|
|
|
18746
18693
|
}
|
|
18747
18694
|
renderOptions.accessedDocumentCurrentScript = false;
|
|
18748
18695
|
({ source } = rendered);
|
|
18749
|
-
usesTopLevelAwait
|
|
18696
|
+
usesTopLevelAwait ||= rendered.usesTopLevelAwait;
|
|
18750
18697
|
renderedLength = source.length();
|
|
18751
18698
|
if (renderedLength) {
|
|
18752
18699
|
if (compact && source.lastLine().includes('//'))
|
|
@@ -18813,7 +18760,7 @@ class Chunk {
|
|
|
18813
18760
|
}
|
|
18814
18761
|
}
|
|
18815
18762
|
setIdentifierRenderResolutions() {
|
|
18816
|
-
const { format,
|
|
18763
|
+
const { format, generatedCode: { symbols }, interop, preserveModules, externalLiveBindings } = this.outputOptions;
|
|
18817
18764
|
const syntheticExports = new Set();
|
|
18818
18765
|
for (const exportName of this.getExportNames()) {
|
|
18819
18766
|
const exportVariable = this.exportsByName.get(exportName);
|
|
@@ -18840,7 +18787,7 @@ class Chunk {
|
|
|
18840
18787
|
if (this.needsExportsShim) {
|
|
18841
18788
|
usedNames.add(MISSING_EXPORT_SHIM_VARIABLE);
|
|
18842
18789
|
}
|
|
18843
|
-
if (
|
|
18790
|
+
if (symbols) {
|
|
18844
18791
|
usedNames.add('Symbol');
|
|
18845
18792
|
}
|
|
18846
18793
|
switch (format) {
|
|
@@ -19099,7 +19046,7 @@ function getChunkDefinitionsFromManualChunks(manualChunkAliasByEntry) {
|
|
|
19099
19046
|
const modulesInManualChunks = new Set(manualChunkAliasByEntry.keys());
|
|
19100
19047
|
const manualChunkModulesByAlias = Object.create(null);
|
|
19101
19048
|
for (const [entry, alias] of manualChunkAliasByEntry) {
|
|
19102
|
-
addStaticDependenciesToManualChunk(entry, (manualChunkModulesByAlias[alias]
|
|
19049
|
+
addStaticDependenciesToManualChunk(entry, (manualChunkModulesByAlias[alias] ||= []), modulesInManualChunks);
|
|
19103
19050
|
}
|
|
19104
19051
|
for (const [alias, modules] of Object.entries(manualChunkModulesByAlias)) {
|
|
19105
19052
|
chunkDefinitions.push({ alias, modules });
|
|
@@ -19198,17 +19145,16 @@ function getDynamicallyDependentEntriesByDynamicEntry(dependentEntriesByModule,
|
|
|
19198
19145
|
return dynamicallyDependentEntriesByDynamicEntry;
|
|
19199
19146
|
}
|
|
19200
19147
|
function getChunksFromDependentEntries(modulesWithDependentEntries) {
|
|
19201
|
-
var _a;
|
|
19202
19148
|
const chunkModules = Object.create(null);
|
|
19203
19149
|
for (const { dependentEntries, modules } of modulesWithDependentEntries) {
|
|
19204
19150
|
let chunkSignature = 0n;
|
|
19205
19151
|
for (const entryIndex of dependentEntries) {
|
|
19206
19152
|
chunkSignature |= 1n << BigInt(entryIndex);
|
|
19207
19153
|
}
|
|
19208
|
-
(chunkModules[
|
|
19154
|
+
(chunkModules[String(chunkSignature)] ||= {
|
|
19209
19155
|
dependentEntries: new Set(dependentEntries),
|
|
19210
19156
|
modules: []
|
|
19211
|
-
})
|
|
19157
|
+
}).modules.push(...modules);
|
|
19212
19158
|
}
|
|
19213
19159
|
return Object.values(chunkModules);
|
|
19214
19160
|
}
|
|
@@ -19384,7 +19330,7 @@ function getPartitionedChunks(initialChunks, numberOfEntries, minChunkSize) {
|
|
|
19384
19330
|
// Unfortunately, we cannot take tree-shaking into account here because
|
|
19385
19331
|
// rendering did not happen yet, but we can detect empty modules
|
|
19386
19332
|
if (module.isIncluded()) {
|
|
19387
|
-
pure
|
|
19333
|
+
pure &&= !module.hasEffects();
|
|
19388
19334
|
// we use a trivial size for the default minChunkSize to improve
|
|
19389
19335
|
// performance
|
|
19390
19336
|
size += minChunkSize > 1 ? module.estimateSize() : 1;
|
|
@@ -19423,7 +19369,7 @@ function mergeChunks(chunkPartition, minChunkSize) {
|
|
|
19423
19369
|
getChunksInPartition(bestTargetChunk, minChunkSize, chunkPartition).delete(bestTargetChunk);
|
|
19424
19370
|
bestTargetChunk.modules.push(...modules);
|
|
19425
19371
|
bestTargetChunk.size += size;
|
|
19426
|
-
bestTargetChunk.pure
|
|
19372
|
+
bestTargetChunk.pure &&= pure;
|
|
19427
19373
|
const { dependencies, dependentChunks, dependentEntries } = bestTargetChunk;
|
|
19428
19374
|
bestTargetChunk.correlatedAtoms &= correlatedAtoms;
|
|
19429
19375
|
bestTargetChunk.containedAtoms |= containedAtoms;
|
|
@@ -20319,7 +20265,10 @@ function resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolve
|
|
|
20319
20265
|
}
|
|
20320
20266
|
replaceContext = (pluginContext, plugin) => ({
|
|
20321
20267
|
...pluginContext,
|
|
20322
|
-
resolve: (source, importer, { attributes, custom, isEntry, skipSelf } = BLANK) =>
|
|
20268
|
+
resolve: (source, importer, { attributes, custom, isEntry, skipSelf } = BLANK) => {
|
|
20269
|
+
skipSelf ??= true;
|
|
20270
|
+
return moduleLoaderResolveId(source, importer, custom, isEntry, attributes || EMPTY_OBJECT, skipSelf ? [...skip, { importer, plugin, source }] : skip);
|
|
20271
|
+
}
|
|
20323
20272
|
});
|
|
20324
20273
|
}
|
|
20325
20274
|
return pluginDriver.hookFirstAndGetPlugin('resolveId', [source, importer, { attributes, custom: customOptions, isEntry }], replaceContext, skipped);
|
|
@@ -20590,7 +20539,13 @@ class ModuleLoader {
|
|
|
20590
20539
|
async addModuleSource(id, importer, module) {
|
|
20591
20540
|
let source;
|
|
20592
20541
|
try {
|
|
20593
|
-
source = await this.graph.fileOperationQueue.run(async () =>
|
|
20542
|
+
source = await this.graph.fileOperationQueue.run(async () => {
|
|
20543
|
+
const content = await this.pluginDriver.hookFirst('load', [id]);
|
|
20544
|
+
if (content !== null)
|
|
20545
|
+
return content;
|
|
20546
|
+
this.graph.watchFiles[id] = true;
|
|
20547
|
+
return await promises.readFile(id, 'utf8');
|
|
20548
|
+
});
|
|
20594
20549
|
}
|
|
20595
20550
|
catch (error_) {
|
|
20596
20551
|
let message = `Could not load ${id}`;
|
|
@@ -20684,7 +20639,6 @@ class ModuleLoader {
|
|
|
20684
20639
|
}
|
|
20685
20640
|
const module = new Module(this.graph, id, this.options, isEntry, moduleSideEffects, syntheticNamedExports, meta, attributes);
|
|
20686
20641
|
this.modulesById.set(id, module);
|
|
20687
|
-
this.graph.watchFiles[id] = true;
|
|
20688
20642
|
const loadPromise = this.addModuleSource(id, importer, module).then(() => [
|
|
20689
20643
|
this.getResolveStaticDependencyPromises(module),
|
|
20690
20644
|
this.getResolveDynamicImportPromises(module),
|
|
@@ -21244,33 +21198,28 @@ async function normalizeInputOptions(config, watchMode) {
|
|
|
21244
21198
|
const logLevel = config.logLevel || LOGLEVEL_INFO;
|
|
21245
21199
|
const onLog = getLogger(plugins, getOnLog(config, logLevel), watchMode, logLevel);
|
|
21246
21200
|
const strictDeprecations = config.strictDeprecations || false;
|
|
21247
|
-
const maxParallelFileOps = getMaxParallelFileOps(config
|
|
21201
|
+
const maxParallelFileOps = getMaxParallelFileOps(config);
|
|
21248
21202
|
const options = {
|
|
21249
21203
|
cache: getCache(config),
|
|
21250
21204
|
context,
|
|
21251
21205
|
experimentalCacheExpiry: config.experimentalCacheExpiry ?? 10,
|
|
21252
21206
|
experimentalLogSideEffects: config.experimentalLogSideEffects || false,
|
|
21253
21207
|
external: getIdMatcher(config.external),
|
|
21254
|
-
inlineDynamicImports: getInlineDynamicImports$1(config, onLog, strictDeprecations),
|
|
21255
21208
|
input: getInput(config),
|
|
21256
21209
|
logLevel,
|
|
21257
21210
|
makeAbsoluteExternalsRelative: config.makeAbsoluteExternalsRelative ?? 'ifRelativeSource',
|
|
21258
|
-
manualChunks: getManualChunks$1(config, onLog, strictDeprecations),
|
|
21259
21211
|
maxParallelFileOps,
|
|
21260
|
-
maxParallelFileReads: maxParallelFileOps,
|
|
21261
21212
|
moduleContext: getModuleContext(config, context),
|
|
21262
21213
|
onLog,
|
|
21263
|
-
onwarn: warning => onLog(LOGLEVEL_WARN, warning),
|
|
21264
21214
|
perf: config.perf || false,
|
|
21265
21215
|
plugins,
|
|
21266
21216
|
preserveEntrySignatures: config.preserveEntrySignatures ?? 'exports-only',
|
|
21267
|
-
preserveModules: getPreserveModules$1(config, onLog, strictDeprecations),
|
|
21268
21217
|
preserveSymlinks: config.preserveSymlinks || false,
|
|
21269
21218
|
shimMissingExports: config.shimMissingExports || false,
|
|
21270
21219
|
strictDeprecations,
|
|
21271
21220
|
treeshake: getTreeshake(config)
|
|
21272
21221
|
};
|
|
21273
|
-
warnUnknownOptions(config, [...Object.keys(options), 'watch'], 'input options', onLog, /^(output)$/);
|
|
21222
|
+
warnUnknownOptions(config, [...Object.keys(options), 'onwarn', 'watch'], 'input options', onLog, /^(output)$/);
|
|
21274
21223
|
return { options, unsetOptions };
|
|
21275
21224
|
}
|
|
21276
21225
|
const getCache = (config) => config.cache === true // `true` is the default
|
|
@@ -21298,30 +21247,12 @@ const getIdMatcher = (option) => {
|
|
|
21298
21247
|
}
|
|
21299
21248
|
return () => false;
|
|
21300
21249
|
};
|
|
21301
|
-
const getInlineDynamicImports$1 = (config, log, strictDeprecations) => {
|
|
21302
|
-
const configInlineDynamicImports = config.inlineDynamicImports;
|
|
21303
|
-
if (configInlineDynamicImports) {
|
|
21304
|
-
warnDeprecationWithOptions('The "inlineDynamicImports" option is deprecated. Use the "output.inlineDynamicImports" option instead.', URL_OUTPUT_INLINEDYNAMICIMPORTS, true, log, strictDeprecations);
|
|
21305
|
-
}
|
|
21306
|
-
return configInlineDynamicImports;
|
|
21307
|
-
};
|
|
21308
21250
|
const getInput = (config) => {
|
|
21309
21251
|
const configInput = config.input;
|
|
21310
21252
|
return configInput == null ? [] : typeof configInput === 'string' ? [configInput] : configInput;
|
|
21311
21253
|
};
|
|
21312
|
-
const
|
|
21313
|
-
const
|
|
21314
|
-
if (configManualChunks) {
|
|
21315
|
-
warnDeprecationWithOptions('The "manualChunks" option is deprecated. Use the "output.manualChunks" option instead.', URL_OUTPUT_MANUALCHUNKS, true, log, strictDeprecations);
|
|
21316
|
-
}
|
|
21317
|
-
return configManualChunks;
|
|
21318
|
-
};
|
|
21319
|
-
const getMaxParallelFileOps = (config, log, strictDeprecations) => {
|
|
21320
|
-
const maxParallelFileReads = config.maxParallelFileReads;
|
|
21321
|
-
if (typeof maxParallelFileReads === 'number') {
|
|
21322
|
-
warnDeprecationWithOptions('The "maxParallelFileReads" option is deprecated. Use the "maxParallelFileOps" option instead.', URL_MAXPARALLELFILEOPS, true, log, strictDeprecations);
|
|
21323
|
-
}
|
|
21324
|
-
const maxParallelFileOps = config.maxParallelFileOps ?? maxParallelFileReads;
|
|
21254
|
+
const getMaxParallelFileOps = (config) => {
|
|
21255
|
+
const maxParallelFileOps = config.maxParallelFileOps;
|
|
21325
21256
|
if (typeof maxParallelFileOps === 'number') {
|
|
21326
21257
|
if (maxParallelFileOps <= 0)
|
|
21327
21258
|
return Infinity;
|
|
@@ -21343,13 +21274,6 @@ const getModuleContext = (config, context) => {
|
|
|
21343
21274
|
}
|
|
21344
21275
|
return () => context;
|
|
21345
21276
|
};
|
|
21346
|
-
const getPreserveModules$1 = (config, log, strictDeprecations) => {
|
|
21347
|
-
const configPreserveModules = config.preserveModules;
|
|
21348
|
-
if (configPreserveModules) {
|
|
21349
|
-
warnDeprecationWithOptions('The "preserveModules" option is deprecated. Use the "output.preserveModules" option instead.', URL_OUTPUT_PRESERVEMODULES, true, log, strictDeprecations);
|
|
21350
|
-
}
|
|
21351
|
-
return configPreserveModules;
|
|
21352
|
-
};
|
|
21353
21277
|
const getTreeshake = (config) => {
|
|
21354
21278
|
const configTreeshake = config.treeshake;
|
|
21355
21279
|
if (configTreeshake === false) {
|
|
@@ -21409,8 +21333,7 @@ async function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
21409
21333
|
const inlineDynamicImports = getInlineDynamicImports(config, inputOptions);
|
|
21410
21334
|
const preserveModules = getPreserveModules(config, inlineDynamicImports, inputOptions);
|
|
21411
21335
|
const file = getFile(config, preserveModules, inputOptions);
|
|
21412
|
-
const
|
|
21413
|
-
const generatedCode = getGeneratedCode(config, preferConst);
|
|
21336
|
+
const generatedCode = getGeneratedCode(config);
|
|
21414
21337
|
const externalImportAttributes = getExternalImportAttributes(config, inputOptions);
|
|
21415
21338
|
const outputOptions = {
|
|
21416
21339
|
amd: getAmd(config),
|
|
@@ -21419,11 +21342,9 @@ async function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
21419
21342
|
chunkFileNames: config.chunkFileNames ?? '[name]-[hash].js',
|
|
21420
21343
|
compact,
|
|
21421
21344
|
dir: getDir(config, file),
|
|
21422
|
-
dynamicImportFunction: getDynamicImportFunction(config, inputOptions, format),
|
|
21423
21345
|
dynamicImportInCjs: config.dynamicImportInCjs ?? true,
|
|
21424
21346
|
entryFileNames: getEntryFileNames(config, unsetOptions),
|
|
21425
21347
|
esModule: config.esModule ?? 'if-default-prop',
|
|
21426
|
-
experimentalDeepDynamicChunkOptimization: getExperimentalDeepDynamicChunkOptimization(config, inputOptions),
|
|
21427
21348
|
experimentalMinChunkSize: config.experimentalMinChunkSize ?? 1,
|
|
21428
21349
|
exports: getExports(config, unsetOptions),
|
|
21429
21350
|
extend: config.extend || false,
|
|
@@ -21441,15 +21362,13 @@ async function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
21441
21362
|
inlineDynamicImports,
|
|
21442
21363
|
interop: getInterop(config),
|
|
21443
21364
|
intro: getAddon(config, 'intro'),
|
|
21444
|
-
manualChunks: getManualChunks(config, inlineDynamicImports, preserveModules
|
|
21365
|
+
manualChunks: getManualChunks(config, inlineDynamicImports, preserveModules),
|
|
21445
21366
|
minifyInternalExports: getMinifyInternalExports(config, format, compact),
|
|
21446
21367
|
name: config.name,
|
|
21447
|
-
namespaceToStringTag: getNamespaceToStringTag(config, generatedCode, inputOptions),
|
|
21448
21368
|
noConflict: config.noConflict || false,
|
|
21449
21369
|
outro: getAddon(config, 'outro'),
|
|
21450
21370
|
paths: config.paths || {},
|
|
21451
21371
|
plugins: await normalizePluginOption(config.plugins),
|
|
21452
|
-
preferConst,
|
|
21453
21372
|
preserveModules,
|
|
21454
21373
|
preserveModulesRoot: getPreserveModulesRoot(config),
|
|
21455
21374
|
sanitizeFileName: typeof config.sanitizeFileName === 'function'
|
|
@@ -21514,7 +21433,7 @@ const getFormat = (config) => {
|
|
|
21514
21433
|
}
|
|
21515
21434
|
};
|
|
21516
21435
|
const getInlineDynamicImports = (config, inputOptions) => {
|
|
21517
|
-
const inlineDynamicImports =
|
|
21436
|
+
const inlineDynamicImports = config.inlineDynamicImports || false;
|
|
21518
21437
|
const { input } = inputOptions;
|
|
21519
21438
|
if (inlineDynamicImports && (Array.isArray(input) ? input : Object.keys(input)).length > 1) {
|
|
21520
21439
|
return error(logInvalidOption('output.inlineDynamicImports', URL_OUTPUT_INLINEDYNAMICIMPORTS, 'multiple inputs are not supported when "output.inlineDynamicImports" is true'));
|
|
@@ -21522,7 +21441,7 @@ const getInlineDynamicImports = (config, inputOptions) => {
|
|
|
21522
21441
|
return inlineDynamicImports;
|
|
21523
21442
|
};
|
|
21524
21443
|
const getPreserveModules = (config, inlineDynamicImports, inputOptions) => {
|
|
21525
|
-
const preserveModules =
|
|
21444
|
+
const preserveModules = config.preserveModules || false;
|
|
21526
21445
|
if (preserveModules) {
|
|
21527
21446
|
if (inlineDynamicImports) {
|
|
21528
21447
|
return error(logInvalidOption('output.inlineDynamicImports', URL_OUTPUT_INLINEDYNAMICIMPORTS, `this option is not supported for "output.preserveModules"`));
|
|
@@ -21533,13 +21452,6 @@ const getPreserveModules = (config, inlineDynamicImports, inputOptions) => {
|
|
|
21533
21452
|
}
|
|
21534
21453
|
return preserveModules;
|
|
21535
21454
|
};
|
|
21536
|
-
const getPreferConst = (config, inputOptions) => {
|
|
21537
|
-
const configPreferConst = config.preferConst;
|
|
21538
|
-
if (configPreferConst != null) {
|
|
21539
|
-
warnDeprecation(`The "output.preferConst" option is deprecated. Use the "output.generatedCode.constBindings" option instead.`, URL_OUTPUT_GENERATEDCODE_CONSTBINDINGS, true, inputOptions);
|
|
21540
|
-
}
|
|
21541
|
-
return !!configPreferConst;
|
|
21542
|
-
};
|
|
21543
21455
|
const getPreserveModulesRoot = (config) => {
|
|
21544
21456
|
const { preserveModulesRoot } = config;
|
|
21545
21457
|
if (preserveModulesRoot === null || preserveModulesRoot === undefined) {
|
|
@@ -21590,16 +21502,6 @@ const getDir = (config, file) => {
|
|
|
21590
21502
|
}
|
|
21591
21503
|
return dir;
|
|
21592
21504
|
};
|
|
21593
|
-
const getDynamicImportFunction = (config, inputOptions, format) => {
|
|
21594
|
-
const configDynamicImportFunction = config.dynamicImportFunction;
|
|
21595
|
-
if (configDynamicImportFunction) {
|
|
21596
|
-
warnDeprecation(`The "output.dynamicImportFunction" option is deprecated. Use the "renderDynamicImport" plugin hook instead.`, URL_RENDERDYNAMICIMPORT, true, inputOptions);
|
|
21597
|
-
if (format !== 'es') {
|
|
21598
|
-
inputOptions.onLog(LOGLEVEL_WARN, logInvalidOption('output.dynamicImportFunction', URL_OUTPUT_DYNAMICIMPORTFUNCTION, 'this option is ignored for formats other than "es"'));
|
|
21599
|
-
}
|
|
21600
|
-
}
|
|
21601
|
-
return configDynamicImportFunction;
|
|
21602
|
-
};
|
|
21603
21505
|
const getEntryFileNames = (config, unsetOptions) => {
|
|
21604
21506
|
const configEntryFileNames = config.entryFileNames;
|
|
21605
21507
|
if (configEntryFileNames == null) {
|
|
@@ -21607,13 +21509,6 @@ const getEntryFileNames = (config, unsetOptions) => {
|
|
|
21607
21509
|
}
|
|
21608
21510
|
return configEntryFileNames ?? '[name].js';
|
|
21609
21511
|
};
|
|
21610
|
-
function getExperimentalDeepDynamicChunkOptimization(config, inputOptions) {
|
|
21611
|
-
const configExperimentalDeepDynamicChunkOptimization = config.experimentalDeepDynamicChunkOptimization;
|
|
21612
|
-
if (configExperimentalDeepDynamicChunkOptimization != null) {
|
|
21613
|
-
warnDeprecation(`The "output.experimentalDeepDynamicChunkOptimization" option is deprecated as Rollup always runs the full chunking algorithm now. The option should be removed.`, URL_OUTPUT_EXPERIMENTALDEEPCHUNKOPTIMIZATION, true, inputOptions);
|
|
21614
|
-
}
|
|
21615
|
-
return configExperimentalDeepDynamicChunkOptimization || false;
|
|
21616
|
-
}
|
|
21617
21512
|
function getExports(config, unsetOptions) {
|
|
21618
21513
|
const configExports = config.exports;
|
|
21619
21514
|
if (configExports == null) {
|
|
@@ -21630,11 +21525,11 @@ const getExternalImportAttributes = (config, inputOptions) => {
|
|
|
21630
21525
|
}
|
|
21631
21526
|
return config.externalImportAttributes ?? config.externalImportAssertions ?? true;
|
|
21632
21527
|
};
|
|
21633
|
-
const getGeneratedCode = (config
|
|
21528
|
+
const getGeneratedCode = (config) => {
|
|
21634
21529
|
const configWithPreset = getOptionWithPreset(config.generatedCode, generatedCodePresets, 'output.generatedCode', URL_OUTPUT_GENERATEDCODE, '');
|
|
21635
21530
|
return {
|
|
21636
21531
|
arrowFunctions: configWithPreset.arrowFunctions === true,
|
|
21637
|
-
constBindings: configWithPreset.constBindings === true
|
|
21532
|
+
constBindings: configWithPreset.constBindings === true,
|
|
21638
21533
|
objectShorthand: configWithPreset.objectShorthand === true,
|
|
21639
21534
|
reservedNamesAsProps: configWithPreset.reservedNamesAsProps !== false,
|
|
21640
21535
|
symbols: configWithPreset.symbols === true
|
|
@@ -21675,8 +21570,8 @@ const validateInterop = (interop) => {
|
|
|
21675
21570
|
}
|
|
21676
21571
|
return interop;
|
|
21677
21572
|
};
|
|
21678
|
-
const getManualChunks = (config, inlineDynamicImports, preserveModules
|
|
21679
|
-
const configManualChunks = config.manualChunks
|
|
21573
|
+
const getManualChunks = (config, inlineDynamicImports, preserveModules) => {
|
|
21574
|
+
const configManualChunks = config.manualChunks;
|
|
21680
21575
|
if (configManualChunks) {
|
|
21681
21576
|
if (inlineDynamicImports) {
|
|
21682
21577
|
return error(logInvalidOption('output.manualChunks', URL_OUTPUT_MANUALCHUNKS, 'this option is not supported for "output.inlineDynamicImports"'));
|
|
@@ -21688,14 +21583,6 @@ const getManualChunks = (config, inlineDynamicImports, preserveModules, inputOpt
|
|
|
21688
21583
|
return configManualChunks || {};
|
|
21689
21584
|
};
|
|
21690
21585
|
const getMinifyInternalExports = (config, format, compact) => config.minifyInternalExports ?? (compact || format === 'es' || format === 'system');
|
|
21691
|
-
const getNamespaceToStringTag = (config, generatedCode, inputOptions) => {
|
|
21692
|
-
const configNamespaceToStringTag = config.namespaceToStringTag;
|
|
21693
|
-
if (configNamespaceToStringTag != null) {
|
|
21694
|
-
warnDeprecation(`The "output.namespaceToStringTag" option is deprecated. Use the "output.generatedCode.symbols" option instead.`, URL_OUTPUT_GENERATEDCODE_SYMBOLS, true, inputOptions);
|
|
21695
|
-
return configNamespaceToStringTag;
|
|
21696
|
-
}
|
|
21697
|
-
return generatedCode.symbols || false;
|
|
21698
|
-
};
|
|
21699
21586
|
const getSourcemapFileNames = (config, unsetOptions) => {
|
|
21700
21587
|
const configSourcemapFileNames = config.sourcemapFileNames;
|
|
21701
21588
|
if (configSourcemapFileNames == null) {
|