@rollup/wasm-node 4.0.0-19 → 4.0.0-20
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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.0.0-
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.0.0-20
|
|
4
|
+
Sun, 24 Sep 2023 06:09:55 GMT - commit 9d6dc574c6dca3d85e9eda512b09797a6d15462f
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -16,7 +16,7 @@ import native from '../../native.js';
|
|
|
16
16
|
import { lstat, realpath, readdir, readFile, mkdir, writeFile } from 'node:fs/promises';
|
|
17
17
|
import * as tty from 'tty';
|
|
18
18
|
|
|
19
|
-
var version = "4.0.0-
|
|
19
|
+
var version = "4.0.0-20";
|
|
20
20
|
|
|
21
21
|
const comma = ','.charCodeAt(0);
|
|
22
22
|
const semicolon = ';'.charCodeAt(0);
|
|
@@ -1754,9 +1754,9 @@ class ExternalChunk {
|
|
|
1754
1754
|
(this.renormalizeRenderPath ? normalize(relative$1(this.inputBase, this.id)) : this.id));
|
|
1755
1755
|
}
|
|
1756
1756
|
getImportAttributes(snippets) {
|
|
1757
|
-
return (this.importAttributes
|
|
1757
|
+
return (this.importAttributes ||= formatAttributes$1(this.options.format === 'es' &&
|
|
1758
1758
|
this.options.externalImportAttributes &&
|
|
1759
|
-
this.moduleInfo.attributes, snippets))
|
|
1759
|
+
this.moduleInfo.attributes, snippets));
|
|
1760
1760
|
}
|
|
1761
1761
|
getImportPath(importer) {
|
|
1762
1762
|
return escapeId(this.renormalizeRenderPath
|
|
@@ -1950,7 +1950,7 @@ class Variable extends ExpressionEntity {
|
|
|
1950
1950
|
* collisions
|
|
1951
1951
|
*/
|
|
1952
1952
|
forbidName(name) {
|
|
1953
|
-
(this.forbiddenNames
|
|
1953
|
+
(this.forbiddenNames ||= new Set()).add(name);
|
|
1954
1954
|
}
|
|
1955
1955
|
getBaseVariableName() {
|
|
1956
1956
|
return this.renderBaseName || this.renderName || this.name;
|
|
@@ -2254,35 +2254,25 @@ const URL_NAME_IS_NOT_EXPORTED = 'troubleshooting/#error-name-is-not-exported-by
|
|
|
2254
2254
|
const URL_THIS_IS_UNDEFINED = 'troubleshooting/#error-this-is-undefined';
|
|
2255
2255
|
const URL_TREATING_MODULE_AS_EXTERNAL_DEPENDENCY = 'troubleshooting/#warning-treating-module-as-external-dependency';
|
|
2256
2256
|
const URL_SOURCEMAP_IS_LIKELY_TO_BE_INCORRECT = 'troubleshooting/#warning-sourcemap-is-likely-to-be-incorrect';
|
|
2257
|
-
// configuration-options
|
|
2258
|
-
const URL_MAXPARALLELFILEOPS = 'configuration-options/#maxparallelfileops';
|
|
2259
2257
|
const URL_OUTPUT_AMD_ID = 'configuration-options/#output-amd-id';
|
|
2260
2258
|
const URL_OUTPUT_AMD_BASEPATH = 'configuration-options/#output-amd-basepath';
|
|
2261
2259
|
const URL_OUTPUT_DIR = 'configuration-options/#output-dir';
|
|
2262
|
-
const URL_OUTPUT_DYNAMICIMPORTFUNCTION = 'configuration-options/#output-dynamicimportfunction';
|
|
2263
2260
|
const URL_OUTPUT_EXPORTS = 'configuration-options/#output-exports';
|
|
2264
2261
|
const URL_OUTPUT_EXTEND = 'configuration-options/#output-extend';
|
|
2265
2262
|
const URL_OUTPUT_EXTERNALIMPORTATTRIBUTES = 'configuration-options/#output-externalimportattributes';
|
|
2266
2263
|
const URL_OUTPUT_FORMAT = 'configuration-options/#output-format';
|
|
2267
2264
|
const URL_OUTPUT_GENERATEDCODE = 'configuration-options/#output-generatedcode';
|
|
2268
|
-
const URL_OUTPUT_EXPERIMENTALDEEPCHUNKOPTIMIZATION = 'configuration-options/#output-experimentaldeepdynamicchunkoptimization';
|
|
2269
|
-
const URL_OUTPUT_GENERATEDCODE_CONSTBINDINGS = 'configuration-options/#output-generatedcode-constbindings';
|
|
2270
|
-
const URL_OUTPUT_GENERATEDCODE_SYMBOLS = 'configuration-options/#output-generatedcode-symbols';
|
|
2271
2265
|
const URL_OUTPUT_GLOBALS = 'configuration-options/#output-globals';
|
|
2272
2266
|
const URL_OUTPUT_INLINEDYNAMICIMPORTS = 'configuration-options/#output-inlinedynamicimports';
|
|
2273
2267
|
const URL_OUTPUT_INTEROP = 'configuration-options/#output-interop';
|
|
2274
2268
|
const URL_OUTPUT_MANUALCHUNKS = 'configuration-options/#output-manualchunks';
|
|
2275
2269
|
const URL_OUTPUT_NAME = 'configuration-options/#output-name';
|
|
2276
|
-
const URL_OUTPUT_PRESERVEMODULES = 'configuration-options/#output-preservemodules';
|
|
2277
2270
|
const URL_OUTPUT_SOURCEMAPBASEURL = 'configuration-options/#output-sourcemapbaseurl';
|
|
2278
2271
|
const URL_OUTPUT_SOURCEMAPFILE = 'configuration-options/#output-sourcemapfile';
|
|
2279
2272
|
const URL_PRESERVEENTRYSIGNATURES = 'configuration-options/#preserveentrysignatures';
|
|
2280
2273
|
const URL_TREESHAKE = 'configuration-options/#treeshake';
|
|
2281
2274
|
const URL_TREESHAKE_MODULESIDEEFFECTS = 'configuration-options/#treeshake-modulesideeffects';
|
|
2282
2275
|
const URL_WATCH = 'configuration-options/#watch';
|
|
2283
|
-
const URL_RENDERDYNAMICIMPORT = 'plugin-development/#renderdynamicimport';
|
|
2284
|
-
const URL_THIS_GETMODULEIDS = 'plugin-development/#this-getmoduleids';
|
|
2285
|
-
const URL_THIS_GETMODULEINFO = 'plugin-development/#this-getmoduleinfo';
|
|
2286
2276
|
|
|
2287
2277
|
function error(base) {
|
|
2288
2278
|
if (!(base instanceof Error)) {
|
|
@@ -2901,7 +2891,7 @@ class ExternalModule {
|
|
|
2901
2891
|
this.nameSuggestions = new Map();
|
|
2902
2892
|
this.suggestedVariableName = makeLegal(id.split(/[/\\]/).pop());
|
|
2903
2893
|
const { importers, dynamicImporters } = this;
|
|
2904
|
-
|
|
2894
|
+
this.info = {
|
|
2905
2895
|
ast: null,
|
|
2906
2896
|
attributes,
|
|
2907
2897
|
code: null,
|
|
@@ -2913,10 +2903,6 @@ class ExternalModule {
|
|
|
2913
2903
|
exportedBindings: null,
|
|
2914
2904
|
exports: null,
|
|
2915
2905
|
hasDefaultExport: null,
|
|
2916
|
-
get hasModuleSideEffects() {
|
|
2917
|
-
warnDeprecation('Accessing ModuleInfo.hasModuleSideEffects from plugins is deprecated. Please use ModuleInfo.moduleSideEffects instead.', URL_THIS_GETMODULEINFO, true, options);
|
|
2918
|
-
return info.moduleSideEffects;
|
|
2919
|
-
},
|
|
2920
2906
|
id,
|
|
2921
2907
|
implicitlyLoadedAfterOneOf: EMPTY_ARRAY,
|
|
2922
2908
|
implicitlyLoadedBefore: EMPTY_ARRAY,
|
|
@@ -2931,11 +2917,7 @@ class ExternalModule {
|
|
|
2931
2917
|
meta,
|
|
2932
2918
|
moduleSideEffects,
|
|
2933
2919
|
syntheticNamedExports: false
|
|
2934
|
-
}
|
|
2935
|
-
// Hide the deprecated key so that it only warns when accessed explicitly
|
|
2936
|
-
Object.defineProperty(this.info, 'hasModuleSideEffects', {
|
|
2937
|
-
enumerable: false
|
|
2938
|
-
});
|
|
2920
|
+
};
|
|
2939
2921
|
}
|
|
2940
2922
|
getVariableForExportName(name) {
|
|
2941
2923
|
const declaration = this.declarations.get(name);
|
|
@@ -5511,7 +5493,7 @@ const nodeConverters = [
|
|
|
5511
5493
|
const parameters = convertNodeList(buffer[position++], buffer, readString);
|
|
5512
5494
|
const body = convertNode(buffer[position++], buffer, readString);
|
|
5513
5495
|
const annotations = convertAnnotationList(position, buffer);
|
|
5514
|
-
return {
|
|
5496
|
+
return addAnnotationProperty({
|
|
5515
5497
|
type: 'ArrowFunctionExpression',
|
|
5516
5498
|
start,
|
|
5517
5499
|
end,
|
|
@@ -5520,9 +5502,8 @@ const nodeConverters = [
|
|
|
5520
5502
|
expression,
|
|
5521
5503
|
generator,
|
|
5522
5504
|
id: null,
|
|
5523
|
-
params: parameters
|
|
5524
|
-
|
|
5525
|
-
};
|
|
5505
|
+
params: parameters
|
|
5506
|
+
}, annotations, ANNOTATION_KEY);
|
|
5526
5507
|
},
|
|
5527
5508
|
// index:3; AssignmentExpression
|
|
5528
5509
|
(position, buffer, readString) => {
|
|
@@ -5614,15 +5595,14 @@ const nodeConverters = [
|
|
|
5614
5595
|
const callee = convertNode(buffer[position++], buffer, readString);
|
|
5615
5596
|
const argumentsList = convertNodeList(buffer[position++], buffer, readString);
|
|
5616
5597
|
const annotations = convertAnnotationList(position, buffer);
|
|
5617
|
-
return {
|
|
5598
|
+
return addAnnotationProperty({
|
|
5618
5599
|
type: 'CallExpression',
|
|
5619
5600
|
start,
|
|
5620
5601
|
end,
|
|
5621
5602
|
arguments: argumentsList,
|
|
5622
5603
|
callee,
|
|
5623
|
-
optional
|
|
5624
|
-
|
|
5625
|
-
};
|
|
5604
|
+
optional
|
|
5605
|
+
}, annotations, ANNOTATION_KEY);
|
|
5626
5606
|
},
|
|
5627
5607
|
// index:10; CatchClause
|
|
5628
5608
|
(position, buffer, readString) => {
|
|
@@ -5897,7 +5877,7 @@ const nodeConverters = [
|
|
|
5897
5877
|
const parameters = convertNodeList(buffer[position++], buffer, readString);
|
|
5898
5878
|
const body = convertNode(buffer[position++], buffer, readString);
|
|
5899
5879
|
const annotations = convertAnnotationList(position, buffer);
|
|
5900
|
-
return {
|
|
5880
|
+
return addAnnotationProperty({
|
|
5901
5881
|
type: 'FunctionDeclaration',
|
|
5902
5882
|
start,
|
|
5903
5883
|
end,
|
|
@@ -5906,9 +5886,8 @@ const nodeConverters = [
|
|
|
5906
5886
|
expression: false,
|
|
5907
5887
|
generator,
|
|
5908
5888
|
id: idPosition ? convertNode(idPosition, buffer, readString) : null,
|
|
5909
|
-
params: parameters
|
|
5910
|
-
|
|
5911
|
-
};
|
|
5889
|
+
params: parameters
|
|
5890
|
+
}, annotations, ANNOTATION_KEY);
|
|
5912
5891
|
},
|
|
5913
5892
|
// index:29; FunctionExpression
|
|
5914
5893
|
(position, buffer, readString) => {
|
|
@@ -5920,7 +5899,7 @@ const nodeConverters = [
|
|
|
5920
5899
|
const parameters = convertNodeList(buffer[position++], buffer, readString);
|
|
5921
5900
|
const body = convertNode(buffer[position++], buffer, readString);
|
|
5922
5901
|
const annotations = convertAnnotationList(position, buffer);
|
|
5923
|
-
return {
|
|
5902
|
+
return addAnnotationProperty({
|
|
5924
5903
|
type: 'FunctionExpression',
|
|
5925
5904
|
start,
|
|
5926
5905
|
end,
|
|
@@ -5929,9 +5908,8 @@ const nodeConverters = [
|
|
|
5929
5908
|
expression: false,
|
|
5930
5909
|
generator,
|
|
5931
5910
|
id: idPosition ? convertNode(idPosition, buffer, readString) : null,
|
|
5932
|
-
params: parameters
|
|
5933
|
-
|
|
5934
|
-
};
|
|
5911
|
+
params: parameters
|
|
5912
|
+
}, annotations, ANNOTATION_KEY);
|
|
5935
5913
|
},
|
|
5936
5914
|
// index:30; Identifier
|
|
5937
5915
|
(position, buffer, readString) => {
|
|
@@ -6221,14 +6199,13 @@ const nodeConverters = [
|
|
|
6221
6199
|
const callee = convertNode(buffer[position++], buffer, readString);
|
|
6222
6200
|
const argumentsPosition = buffer[position++];
|
|
6223
6201
|
const annotations = convertAnnotationList(position, buffer);
|
|
6224
|
-
return {
|
|
6202
|
+
return addAnnotationProperty({
|
|
6225
6203
|
type: 'NewExpression',
|
|
6226
6204
|
start,
|
|
6227
6205
|
end,
|
|
6228
6206
|
arguments: argumentsPosition ? convertNodeList(argumentsPosition, buffer, readString) : [],
|
|
6229
|
-
callee
|
|
6230
|
-
|
|
6231
|
-
};
|
|
6207
|
+
callee
|
|
6208
|
+
}, annotations, ANNOTATION_KEY);
|
|
6232
6209
|
},
|
|
6233
6210
|
// index:50; ObjectExpression
|
|
6234
6211
|
(position, buffer, readString) => {
|
|
@@ -6272,14 +6249,13 @@ const nodeConverters = [
|
|
|
6272
6249
|
const end = buffer[position++];
|
|
6273
6250
|
const annotations = convertAnnotationList(buffer[position++], buffer);
|
|
6274
6251
|
const body = convertNodeList(position, buffer, readString);
|
|
6275
|
-
return {
|
|
6252
|
+
return addAnnotationProperty({
|
|
6276
6253
|
type: 'Program',
|
|
6277
6254
|
start,
|
|
6278
6255
|
end,
|
|
6279
6256
|
body,
|
|
6280
|
-
sourceType: 'module'
|
|
6281
|
-
|
|
6282
|
-
};
|
|
6257
|
+
sourceType: 'module'
|
|
6258
|
+
}, annotations, INVALID_ANNOTATION_KEY);
|
|
6283
6259
|
},
|
|
6284
6260
|
// index:54; Property
|
|
6285
6261
|
(position, buffer, readString) => {
|
|
@@ -6623,6 +6599,15 @@ const convertAnnotation = (position, buffer) => {
|
|
|
6623
6599
|
const type = FIXED_STRINGS[buffer[position]];
|
|
6624
6600
|
return { end, start, type };
|
|
6625
6601
|
};
|
|
6602
|
+
const addAnnotationProperty = (node, annotations, key) => {
|
|
6603
|
+
if (annotations.length > 0) {
|
|
6604
|
+
return {
|
|
6605
|
+
...node,
|
|
6606
|
+
[key]: annotations
|
|
6607
|
+
};
|
|
6608
|
+
}
|
|
6609
|
+
return node;
|
|
6610
|
+
};
|
|
6626
6611
|
const convertString = (position, buffer, readString) => {
|
|
6627
6612
|
const length = buffer[position++];
|
|
6628
6613
|
const bytePosition = position << 2;
|
|
@@ -7773,7 +7758,7 @@ class ParameterVariable extends LocalVariable {
|
|
|
7773
7758
|
for (const entity of this.entitiesToBeDeoptimized) {
|
|
7774
7759
|
// We do not need a recursion tracker here as we already track whether
|
|
7775
7760
|
// this field is deoptimized
|
|
7776
|
-
entity.deoptimizePath(
|
|
7761
|
+
entity.deoptimizePath([key]);
|
|
7777
7762
|
}
|
|
7778
7763
|
if (key === UnknownKey) {
|
|
7779
7764
|
// save some memory
|
|
@@ -8083,7 +8068,7 @@ const getPureFunctions = ({ treeshake }) => {
|
|
|
8083
8068
|
for (const functionName of treeshake ? treeshake.manualPureFunctions : []) {
|
|
8084
8069
|
let currentFunctions = pureFunctions;
|
|
8085
8070
|
for (const pathSegment of functionName.split('.')) {
|
|
8086
|
-
currentFunctions = currentFunctions[pathSegment]
|
|
8071
|
+
currentFunctions = currentFunctions[pathSegment] ||= Object.create(null);
|
|
8087
8072
|
}
|
|
8088
8073
|
currentFunctions[PureFunctionKey] = true;
|
|
8089
8074
|
}
|
|
@@ -11830,7 +11815,7 @@ const namespaceInteropHelpersByInteropType = {
|
|
|
11830
11815
|
esModule: null
|
|
11831
11816
|
};
|
|
11832
11817
|
const canDefaultBeTakenFromNamespace = (interopType, externalLiveBindings) => interopType !== 'esModule' && isDefaultAProperty(interopType, externalLiveBindings);
|
|
11833
|
-
const getHelpersBlock = (additionalHelpers, accessedGlobals, indent, snippets, liveBindings, freeze,
|
|
11818
|
+
const getHelpersBlock = (additionalHelpers, accessedGlobals, indent, snippets, liveBindings, freeze, symbols) => {
|
|
11834
11819
|
const usedHelpers = new Set(additionalHelpers);
|
|
11835
11820
|
for (const variable of HELPER_NAMES) {
|
|
11836
11821
|
if (accessedGlobals.has(variable)) {
|
|
@@ -11838,7 +11823,7 @@ const getHelpersBlock = (additionalHelpers, accessedGlobals, indent, snippets, l
|
|
|
11838
11823
|
}
|
|
11839
11824
|
}
|
|
11840
11825
|
return HELPER_NAMES.map(variable => usedHelpers.has(variable)
|
|
11841
|
-
? HELPER_GENERATORS[variable](indent, snippets, liveBindings, freeze,
|
|
11826
|
+
? HELPER_GENERATORS[variable](indent, snippets, liveBindings, freeze, symbols, usedHelpers)
|
|
11842
11827
|
: '').join('');
|
|
11843
11828
|
};
|
|
11844
11829
|
const HELPER_GENERATORS = {
|
|
@@ -11865,7 +11850,7 @@ const HELPER_GENERATORS = {
|
|
|
11865
11850
|
return (`${left}e${_}&&${_}e.__esModule${_}?${_}` +
|
|
11866
11851
|
`${liveBindings ? getDefaultLiveBinding(snippets) : getDefaultStatic(snippets)}${right}${n}${n}`);
|
|
11867
11852
|
},
|
|
11868
|
-
[INTEROP_NAMESPACE_COMPAT_VARIABLE](t, snippets, liveBindings, freeze,
|
|
11853
|
+
[INTEROP_NAMESPACE_COMPAT_VARIABLE](t, snippets, liveBindings, freeze, symbols, usedHelpers) {
|
|
11869
11854
|
const { _, getDirectReturnFunction, n } = snippets;
|
|
11870
11855
|
if (usedHelpers.has(INTEROP_NAMESPACE_DEFAULT_VARIABLE)) {
|
|
11871
11856
|
const [left, right] = getDirectReturnFunction(['e'], {
|
|
@@ -11877,28 +11862,28 @@ const HELPER_GENERATORS = {
|
|
|
11877
11862
|
}
|
|
11878
11863
|
return (`function ${INTEROP_NAMESPACE_COMPAT_VARIABLE}(e)${_}{${n}` +
|
|
11879
11864
|
`${t}if${_}(${getIsCompatNamespace(snippets)})${_}return e;${n}` +
|
|
11880
|
-
createNamespaceObject(t, t, snippets, liveBindings, freeze,
|
|
11865
|
+
createNamespaceObject(t, t, snippets, liveBindings, freeze, symbols) +
|
|
11881
11866
|
`}${n}${n}`);
|
|
11882
11867
|
},
|
|
11883
|
-
[INTEROP_NAMESPACE_DEFAULT_ONLY_VARIABLE](_t, snippets, _liveBindings, freeze,
|
|
11868
|
+
[INTEROP_NAMESPACE_DEFAULT_ONLY_VARIABLE](_t, snippets, _liveBindings, freeze, symbols) {
|
|
11884
11869
|
const { getDirectReturnFunction, getObject, n } = snippets;
|
|
11885
11870
|
const [left, right] = getDirectReturnFunction(['e'], {
|
|
11886
11871
|
functionReturn: true,
|
|
11887
11872
|
lineBreakIndent: null,
|
|
11888
11873
|
name: INTEROP_NAMESPACE_DEFAULT_ONLY_VARIABLE
|
|
11889
11874
|
});
|
|
11890
|
-
return `${left}${getFrozen(freeze, getWithToStringTag(
|
|
11875
|
+
return `${left}${getFrozen(freeze, getWithToStringTag(symbols, getObject([
|
|
11891
11876
|
['__proto__', 'null'],
|
|
11892
11877
|
['default', 'e']
|
|
11893
11878
|
], { lineBreakIndent: null }), snippets))}${right}${n}${n}`;
|
|
11894
11879
|
},
|
|
11895
|
-
[INTEROP_NAMESPACE_DEFAULT_VARIABLE](t, snippets, liveBindings, freeze,
|
|
11880
|
+
[INTEROP_NAMESPACE_DEFAULT_VARIABLE](t, snippets, liveBindings, freeze, symbols) {
|
|
11896
11881
|
const { _, n } = snippets;
|
|
11897
11882
|
return (`function ${INTEROP_NAMESPACE_DEFAULT_VARIABLE}(e)${_}{${n}` +
|
|
11898
|
-
createNamespaceObject(t, t, snippets, liveBindings, freeze,
|
|
11883
|
+
createNamespaceObject(t, t, snippets, liveBindings, freeze, symbols) +
|
|
11899
11884
|
`}${n}${n}`);
|
|
11900
11885
|
},
|
|
11901
|
-
[INTEROP_NAMESPACE_VARIABLE](t, snippets, liveBindings, freeze,
|
|
11886
|
+
[INTEROP_NAMESPACE_VARIABLE](t, snippets, liveBindings, freeze, symbols, usedHelpers) {
|
|
11902
11887
|
const { _, getDirectReturnFunction, n } = snippets;
|
|
11903
11888
|
if (usedHelpers.has(INTEROP_NAMESPACE_DEFAULT_VARIABLE)) {
|
|
11904
11889
|
const [left, right] = getDirectReturnFunction(['e'], {
|
|
@@ -11910,10 +11895,10 @@ const HELPER_GENERATORS = {
|
|
|
11910
11895
|
}
|
|
11911
11896
|
return (`function ${INTEROP_NAMESPACE_VARIABLE}(e)${_}{${n}` +
|
|
11912
11897
|
`${t}if${_}(e${_}&&${_}e.__esModule)${_}return e;${n}` +
|
|
11913
|
-
createNamespaceObject(t, t, snippets, liveBindings, freeze,
|
|
11898
|
+
createNamespaceObject(t, t, snippets, liveBindings, freeze, symbols) +
|
|
11914
11899
|
`}${n}${n}`);
|
|
11915
11900
|
},
|
|
11916
|
-
[MERGE_NAMESPACES_VARIABLE](t, snippets, liveBindings, freeze,
|
|
11901
|
+
[MERGE_NAMESPACES_VARIABLE](t, snippets, liveBindings, freeze, symbols) {
|
|
11917
11902
|
const { _, cnst, n } = snippets;
|
|
11918
11903
|
const useForEach = cnst === 'var' && liveBindings;
|
|
11919
11904
|
return (`function ${MERGE_NAMESPACES_VARIABLE}(n, m)${_}{${n}` +
|
|
@@ -11926,21 +11911,19 @@ const HELPER_GENERATORS = {
|
|
|
11926
11911
|
: copyPropertyStatic)(t, t + t + t + t, snippets) +
|
|
11927
11912
|
`${t}${t}${t}}${n}` +
|
|
11928
11913
|
`${t}${t}}`, useForEach, t, snippets)}${n}` +
|
|
11929
|
-
`${t}return ${getFrozen(freeze, getWithToStringTag(
|
|
11914
|
+
`${t}return ${getFrozen(freeze, getWithToStringTag(symbols, 'n', snippets))};${n}` +
|
|
11930
11915
|
`}${n}${n}`);
|
|
11931
11916
|
}
|
|
11932
11917
|
};
|
|
11933
11918
|
const getDefaultLiveBinding = ({ _, getObject }) => `e${_}:${_}${getObject([['default', 'e']], { lineBreakIndent: null })}`;
|
|
11934
11919
|
const getDefaultStatic = ({ _, getPropertyAccess }) => `e${getPropertyAccess('default')}${_}:${_}e`;
|
|
11935
11920
|
const getIsCompatNamespace = ({ _ }) => `e${_}&&${_}typeof e${_}===${_}'object'${_}&&${_}'default'${_}in e`;
|
|
11936
|
-
const createNamespaceObject = (t, index, snippets, liveBindings, freeze,
|
|
11921
|
+
const createNamespaceObject = (t, index, snippets, liveBindings, freeze, symbols) => {
|
|
11937
11922
|
const { _, cnst, getObject, getPropertyAccess, n, s } = snippets;
|
|
11938
11923
|
const copyProperty = `{${n}` +
|
|
11939
11924
|
(liveBindings ? copyNonDefaultOwnPropertyLiveBinding : copyPropertyStatic)(t, index + t + t, snippets) +
|
|
11940
11925
|
`${index}${t}}`;
|
|
11941
|
-
return (`${index}${cnst} n${_}=${_}Object.create(null${
|
|
11942
|
-
? `,${_}{${_}[Symbol.toStringTag]:${_}${getToStringTagValue(getObject)}${_}}`
|
|
11943
|
-
: ''});${n}` +
|
|
11926
|
+
return (`${index}${cnst} n${_}=${_}Object.create(null${symbols ? `,${_}{${_}[Symbol.toStringTag]:${_}${getToStringTagValue(getObject)}${_}}` : ''});${n}` +
|
|
11944
11927
|
`${index}if${_}(e)${_}{${n}` +
|
|
11945
11928
|
`${index}${t}${loopOverKeys(copyProperty, !liveBindings, snippets)}${n}` +
|
|
11946
11929
|
`${index}}${n}` +
|
|
@@ -12004,7 +11987,7 @@ const copyPropertyLiveBinding = (t, index, { _, cnst, getDirectReturnFunction, n
|
|
|
12004
11987
|
};
|
|
12005
11988
|
const copyPropertyStatic = (_t, index, { _, n }) => `${index}n[k]${_}=${_}e[k];${n}`;
|
|
12006
11989
|
const getFrozen = (freeze, fragment) => freeze ? `Object.freeze(${fragment})` : fragment;
|
|
12007
|
-
const getWithToStringTag = (
|
|
11990
|
+
const getWithToStringTag = (symbols, fragment, { _, getObject }) => symbols
|
|
12008
11991
|
? `Object.defineProperty(${fragment},${_}Symbol.toStringTag,${_}${getToStringTagValue(getObject)})`
|
|
12009
11992
|
: fragment;
|
|
12010
11993
|
const HELPER_NAMES = Object.keys(HELPER_GENERATORS);
|
|
@@ -12251,7 +12234,7 @@ class ImportExpression extends NodeBase {
|
|
|
12251
12234
|
this.inlineNamespace = inlineNamespace;
|
|
12252
12235
|
}
|
|
12253
12236
|
applyDeoptimizations() { }
|
|
12254
|
-
getDynamicImportMechanismAndHelper(resolution, exportMode, { compact,
|
|
12237
|
+
getDynamicImportMechanismAndHelper(resolution, exportMode, { compact, dynamicImportInCjs, format, generatedCode: { arrowFunctions }, interop }, { _, getDirectReturnFunction, getDirectReturnIifeLeft }, pluginDriver) {
|
|
12255
12238
|
const mechanism = pluginDriver.hookFirstSync('renderDynamicImport', [
|
|
12256
12239
|
{
|
|
12257
12240
|
customResolution: typeof this.resolution === 'string' ? this.resolution : null,
|
|
@@ -12336,17 +12319,6 @@ class ImportExpression extends NodeBase {
|
|
|
12336
12319
|
}
|
|
12337
12320
|
};
|
|
12338
12321
|
}
|
|
12339
|
-
case 'es': {
|
|
12340
|
-
if (dynamicImportFunction) {
|
|
12341
|
-
return {
|
|
12342
|
-
helper: null,
|
|
12343
|
-
mechanism: {
|
|
12344
|
-
left: `${dynamicImportFunction}(`,
|
|
12345
|
-
right: ')'
|
|
12346
|
-
}
|
|
12347
|
-
};
|
|
12348
|
-
}
|
|
12349
|
-
}
|
|
12350
12322
|
}
|
|
12351
12323
|
return { helper: null, mechanism: null };
|
|
12352
12324
|
}
|
|
@@ -12614,7 +12586,8 @@ class MetaProperty extends NodeBase {
|
|
|
12614
12586
|
]);
|
|
12615
12587
|
if (!replacement) {
|
|
12616
12588
|
replacement = importMetaMechanisms[format]?.(metaProperty, { chunkId, snippets });
|
|
12617
|
-
renderOptions.accessedDocumentCurrentScript
|
|
12589
|
+
renderOptions.accessedDocumentCurrentScript ||=
|
|
12590
|
+
formatsMaybeAccessDocumentCurrentScript.includes(format) && replacement !== 'undefined';
|
|
12618
12591
|
}
|
|
12619
12592
|
if (typeof replacement === 'string') {
|
|
12620
12593
|
if (parent instanceof MemberExpression) {
|
|
@@ -13121,7 +13094,7 @@ class SwitchStatement extends NodeBase {
|
|
|
13121
13094
|
if (switchCase.hasEffects(context))
|
|
13122
13095
|
return true;
|
|
13123
13096
|
// eslint-disable-next-line unicorn/consistent-destructuring
|
|
13124
|
-
onlyHasBrokenFlow
|
|
13097
|
+
onlyHasBrokenFlow &&= context.brokenFlow && !context.hasBreak;
|
|
13125
13098
|
context.hasBreak = false;
|
|
13126
13099
|
context.brokenFlow = brokenFlow;
|
|
13127
13100
|
}
|
|
@@ -13153,7 +13126,7 @@ class SwitchStatement extends NodeBase {
|
|
|
13153
13126
|
if (isCaseIncluded) {
|
|
13154
13127
|
switchCase.include(context, includeChildrenRecursively);
|
|
13155
13128
|
// eslint-disable-next-line unicorn/consistent-destructuring
|
|
13156
|
-
onlyHasBrokenFlow
|
|
13129
|
+
onlyHasBrokenFlow &&= context.brokenFlow && !context.hasBreak;
|
|
13157
13130
|
context.hasBreak = false;
|
|
13158
13131
|
context.brokenFlow = brokenFlow;
|
|
13159
13132
|
}
|
|
@@ -13984,7 +13957,7 @@ class NamespaceVariable extends Variable {
|
|
|
13984
13957
|
}
|
|
13985
13958
|
}
|
|
13986
13959
|
renderBlock(options) {
|
|
13987
|
-
const { exportNamesByVariable, format, freeze, indent: t,
|
|
13960
|
+
const { exportNamesByVariable, format, freeze, indent: t, symbols, snippets: { _, cnst, getObject, getPropertyAccess, n, s } } = options;
|
|
13988
13961
|
const memberVariables = this.getMemberVariables();
|
|
13989
13962
|
const members = Object.entries(memberVariables)
|
|
13990
13963
|
.filter(([_, variable]) => variable.included)
|
|
@@ -14005,7 +13978,7 @@ class NamespaceVariable extends Variable {
|
|
|
14005
13978
|
}
|
|
14006
13979
|
else {
|
|
14007
13980
|
// The helper to merge namespaces will also take care of freezing and toStringTag
|
|
14008
|
-
if (
|
|
13981
|
+
if (symbols) {
|
|
14009
13982
|
output = `/*#__PURE__*/Object.defineProperty(${output},${_}Symbol.toStringTag,${_}${getToStringTagValue(getObject)})`;
|
|
14010
13983
|
}
|
|
14011
13984
|
if (freeze) {
|
|
@@ -14478,10 +14451,10 @@ class Module {
|
|
|
14478
14451
|
get exportedBindings() {
|
|
14479
14452
|
const exportBindings = { '.': [...exports.keys()] };
|
|
14480
14453
|
for (const [name, { source }] of reexportDescriptions) {
|
|
14481
|
-
(exportBindings[source]
|
|
14454
|
+
(exportBindings[source] ??= []).push(name);
|
|
14482
14455
|
}
|
|
14483
14456
|
for (const source of exportAllSources) {
|
|
14484
|
-
(exportBindings[source]
|
|
14457
|
+
(exportBindings[source] ??= []).push('*');
|
|
14485
14458
|
}
|
|
14486
14459
|
return exportBindings;
|
|
14487
14460
|
},
|
|
@@ -14499,10 +14472,6 @@ class Module {
|
|
|
14499
14472
|
}
|
|
14500
14473
|
return module.exports.has('default') || reexportDescriptions.has('default');
|
|
14501
14474
|
},
|
|
14502
|
-
get hasModuleSideEffects() {
|
|
14503
|
-
warnDeprecation('Accessing ModuleInfo.hasModuleSideEffects from plugins is deprecated. Please use ModuleInfo.moduleSideEffects instead.', URL_THIS_GETMODULEINFO, true, options);
|
|
14504
|
-
return this.moduleSideEffects;
|
|
14505
|
-
},
|
|
14506
14475
|
id,
|
|
14507
14476
|
get implicitlyLoadedAfterOneOf() {
|
|
14508
14477
|
// eslint-disable-next-line unicorn/prefer-spread
|
|
@@ -14537,11 +14506,6 @@ class Module {
|
|
|
14537
14506
|
moduleSideEffects,
|
|
14538
14507
|
syntheticNamedExports
|
|
14539
14508
|
};
|
|
14540
|
-
// Hide the deprecated key so that it only warns when accessed explicitly
|
|
14541
|
-
// eslint-disable-next-line unicorn/consistent-destructuring
|
|
14542
|
-
Object.defineProperty(this.info, 'hasModuleSideEffects', {
|
|
14543
|
-
enumerable: false
|
|
14544
|
-
});
|
|
14545
14509
|
}
|
|
14546
14510
|
basename() {
|
|
14547
14511
|
const base = basename(this.id);
|
|
@@ -15452,7 +15416,7 @@ const getDefineProperty = (name, needsLiveBinding, t, { _, getDirectReturnFuncti
|
|
|
15452
15416
|
return `exports[k]${_}=${_}${name}[k]`;
|
|
15453
15417
|
};
|
|
15454
15418
|
|
|
15455
|
-
function getInteropBlock(dependencies, interop, externalLiveBindings, freeze,
|
|
15419
|
+
function getInteropBlock(dependencies, interop, externalLiveBindings, freeze, symbols, accessedGlobals, indent, snippets) {
|
|
15456
15420
|
const { _, cnst, n } = snippets;
|
|
15457
15421
|
const neededInteropHelpers = new Set();
|
|
15458
15422
|
const interopStatements = [];
|
|
@@ -15504,7 +15468,7 @@ function getInteropBlock(dependencies, interop, externalLiveBindings, freeze, na
|
|
|
15504
15468
|
}
|
|
15505
15469
|
}
|
|
15506
15470
|
}
|
|
15507
|
-
return `${getHelpersBlock(neededInteropHelpers, accessedGlobals, indent, snippets, externalLiveBindings, freeze,
|
|
15471
|
+
return `${getHelpersBlock(neededInteropHelpers, accessedGlobals, indent, snippets, externalLiveBindings, freeze, symbols)}${interopStatements.length > 0 ? `${interopStatements.join(n)}${n}${n}` : ''}`;
|
|
15508
15472
|
}
|
|
15509
15473
|
|
|
15510
15474
|
function addJsExtension(name) {
|
|
@@ -15594,7 +15558,7 @@ function warnOnBuiltins(log, dependencies) {
|
|
|
15594
15558
|
log(LOGLEVEL_WARN, logMissingNodeBuiltins(externalBuiltins));
|
|
15595
15559
|
}
|
|
15596
15560
|
|
|
15597
|
-
function amd(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, id, indent: t, intro, isEntryFacade, isModuleFacade, namedExportsMode, log, outro, snippets }, { amd, esModule, externalLiveBindings, freeze,
|
|
15561
|
+
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 }) {
|
|
15598
15562
|
warnOnBuiltins(log, dependencies);
|
|
15599
15563
|
const deps = dependencies.map(m => `'${updateExtensionForRelativeAmdId(m.importPath, amd.forceJsExtensionForImports)}'`);
|
|
15600
15564
|
const parameters = dependencies.map(m => m.name);
|
|
@@ -15615,9 +15579,9 @@ function amd(magicString, { accessedGlobals, dependencies, exports, hasDefaultEx
|
|
|
15615
15579
|
const defineParameters = (completeAmdId ? `'${completeAmdId}',${_}` : ``) +
|
|
15616
15580
|
(deps.length > 0 ? `[${deps.join(`,${_}`)}],${_}` : ``);
|
|
15617
15581
|
const useStrict = strict ? `${_}'use strict';` : '';
|
|
15618
|
-
magicString.prepend(`${intro}${getInteropBlock(dependencies, interop, externalLiveBindings, freeze,
|
|
15582
|
+
magicString.prepend(`${intro}${getInteropBlock(dependencies, interop, externalLiveBindings, freeze, symbols, accessedGlobals, t, snippets)}`);
|
|
15619
15583
|
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings);
|
|
15620
|
-
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, isEntryFacade && (esModule === true || (esModule === 'if-default-prop' && hasDefaultExport)), isModuleFacade &&
|
|
15584
|
+
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, isEntryFacade && (esModule === true || (esModule === 'if-default-prop' && hasDefaultExport)), isModuleFacade && symbols, snippets);
|
|
15621
15585
|
if (namespaceMarkers) {
|
|
15622
15586
|
namespaceMarkers = n + n + namespaceMarkers;
|
|
15623
15587
|
}
|
|
@@ -15633,15 +15597,15 @@ function amd(magicString, { accessedGlobals, dependencies, exports, hasDefaultEx
|
|
|
15633
15597
|
.append(`${n}${n}}));`);
|
|
15634
15598
|
}
|
|
15635
15599
|
|
|
15636
|
-
function cjs(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, indent: t, intro, isEntryFacade, isModuleFacade, namedExportsMode, outro, snippets }, { compact, esModule, externalLiveBindings, freeze, interop,
|
|
15600
|
+
function cjs(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, indent: t, intro, isEntryFacade, isModuleFacade, namedExportsMode, outro, snippets }, { compact, esModule, externalLiveBindings, freeze, interop, generatedCode: { symbols }, strict }) {
|
|
15637
15601
|
const { _, n } = snippets;
|
|
15638
15602
|
const useStrict = strict ? `'use strict';${n}${n}` : '';
|
|
15639
|
-
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, isEntryFacade && (esModule === true || (esModule === 'if-default-prop' && hasDefaultExport)), isModuleFacade &&
|
|
15603
|
+
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, isEntryFacade && (esModule === true || (esModule === 'if-default-prop' && hasDefaultExport)), isModuleFacade && symbols, snippets);
|
|
15640
15604
|
if (namespaceMarkers) {
|
|
15641
15605
|
namespaceMarkers += n + n;
|
|
15642
15606
|
}
|
|
15643
15607
|
const importBlock = getImportBlock$1(dependencies, snippets, compact);
|
|
15644
|
-
const interopBlock = getInteropBlock(dependencies, interop, externalLiveBindings, freeze,
|
|
15608
|
+
const interopBlock = getInteropBlock(dependencies, interop, externalLiveBindings, freeze, symbols, accessedGlobals, t, snippets);
|
|
15645
15609
|
magicString.prepend(`${useStrict}${intro}${namespaceMarkers}${importBlock}${interopBlock}`);
|
|
15646
15610
|
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings, `module.exports${_}=${_}`);
|
|
15647
15611
|
magicString.append(`${exportBlock}${outro}`);
|
|
@@ -15669,12 +15633,12 @@ function getImportBlock$1(dependencies, { _, cnst, n }, compact) {
|
|
|
15669
15633
|
return '';
|
|
15670
15634
|
}
|
|
15671
15635
|
|
|
15672
|
-
function es(magicString, { accessedGlobals, indent: t, intro, outro, dependencies, exports, snippets }, { externalLiveBindings, freeze,
|
|
15636
|
+
function es(magicString, { accessedGlobals, indent: t, intro, outro, dependencies, exports, snippets }, { externalLiveBindings, freeze, generatedCode: { symbols } }) {
|
|
15673
15637
|
const { n } = snippets;
|
|
15674
15638
|
const importBlock = getImportBlock(dependencies, snippets);
|
|
15675
15639
|
if (importBlock.length > 0)
|
|
15676
15640
|
intro += importBlock.join(n) + n + n;
|
|
15677
|
-
intro += getHelpersBlock(null, accessedGlobals, t, snippets, externalLiveBindings, freeze,
|
|
15641
|
+
intro += getHelpersBlock(null, accessedGlobals, t, snippets, externalLiveBindings, freeze, symbols);
|
|
15678
15642
|
if (intro)
|
|
15679
15643
|
magicString.prepend(intro);
|
|
15680
15644
|
const exportBlock = getExportBlock(exports, snippets);
|
|
@@ -15820,7 +15784,7 @@ function trimEmptyImports(dependencies) {
|
|
|
15820
15784
|
return [];
|
|
15821
15785
|
}
|
|
15822
15786
|
|
|
15823
|
-
function iife(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, indent: t, intro, namedExportsMode, log, outro, snippets }, { compact, esModule, extend, freeze, externalLiveBindings, globals, interop, name,
|
|
15787
|
+
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 }) {
|
|
15824
15788
|
const { _, getNonArrowFunctionIntro, getPropertyAccess, n } = snippets;
|
|
15825
15789
|
const isNamespaced = name && name.includes('.');
|
|
15826
15790
|
const useVariableAssignment = !extend && !isNamespaced;
|
|
@@ -15845,7 +15809,7 @@ function iife(magicString, { accessedGlobals, dependencies, exports, hasDefaultE
|
|
|
15845
15809
|
}
|
|
15846
15810
|
}
|
|
15847
15811
|
const useStrict = strict ? `${t}'use strict';${n}` : '';
|
|
15848
|
-
const interopBlock = getInteropBlock(dependencies, interop, externalLiveBindings, freeze,
|
|
15812
|
+
const interopBlock = getInteropBlock(dependencies, interop, externalLiveBindings, freeze, symbols, accessedGlobals, t, snippets);
|
|
15849
15813
|
magicString.prepend(`${intro}${interopBlock}`);
|
|
15850
15814
|
let wrapperIntro = `(${getNonArrowFunctionIntro(parameters, {
|
|
15851
15815
|
isAsync: false,
|
|
@@ -15866,7 +15830,7 @@ function iife(magicString, { accessedGlobals, dependencies, exports, hasDefaultE
|
|
|
15866
15830
|
wrapperOutro = `${n}${n}${t}return exports;${wrapperOutro}`;
|
|
15867
15831
|
}
|
|
15868
15832
|
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings);
|
|
15869
|
-
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule === true || (esModule === 'if-default-prop' && hasDefaultExport),
|
|
15833
|
+
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule === true || (esModule === 'if-default-prop' && hasDefaultExport), symbols, snippets);
|
|
15870
15834
|
if (namespaceMarkers) {
|
|
15871
15835
|
namespaceMarkers = n + n + namespaceMarkers;
|
|
15872
15836
|
}
|
|
@@ -15877,7 +15841,7 @@ function iife(magicString, { accessedGlobals, dependencies, exports, hasDefaultE
|
|
|
15877
15841
|
.append(wrapperOutro);
|
|
15878
15842
|
}
|
|
15879
15843
|
|
|
15880
|
-
function system(magicString, { accessedGlobals, dependencies, exports, hasExports, indent: t, intro, snippets, outro, usesTopLevelAwait }, { externalLiveBindings, freeze, name,
|
|
15844
|
+
function system(magicString, { accessedGlobals, dependencies, exports, hasExports, indent: t, intro, snippets, outro, usesTopLevelAwait }, { externalLiveBindings, freeze, name, generatedCode: { symbols }, strict, systemNullSetters }) {
|
|
15881
15845
|
const { _, getFunctionIntro, getNonArrowFunctionIntro, n, s } = snippets;
|
|
15882
15846
|
const { importBindings, setters, starExcludes } = analyzeDependencies(dependencies, exports, t, snippets);
|
|
15883
15847
|
const registeredName = name ? `'${name}',${_}` : '';
|
|
@@ -15915,7 +15879,7 @@ function system(magicString, { accessedGlobals, dependencies, exports, hasExport
|
|
|
15915
15879
|
const wrapperEnd = `${t}${t}})${n}${t}}${s}${n}}));`;
|
|
15916
15880
|
magicString
|
|
15917
15881
|
.prepend(intro +
|
|
15918
|
-
getHelpersBlock(null, accessedGlobals, t, snippets, externalLiveBindings, freeze,
|
|
15882
|
+
getHelpersBlock(null, accessedGlobals, t, snippets, externalLiveBindings, freeze, symbols) +
|
|
15919
15883
|
getHoistedExportsBlock(exports, t, snippets))
|
|
15920
15884
|
.append(`${outro}${n}${n}` +
|
|
15921
15885
|
getSyntheticExportsBlock(exports, t, snippets) +
|
|
@@ -16024,7 +15988,7 @@ function safeAccess(name, globalVariable, { _, getPropertyAccess }) {
|
|
|
16024
15988
|
.map(part => (propertyPath += getPropertyAccess(part)))
|
|
16025
15989
|
.join(`${_}&&${_}`);
|
|
16026
15990
|
}
|
|
16027
|
-
function umd(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, id, indent: t, intro, namedExportsMode, log, outro, snippets }, { amd, compact, esModule, extend, externalLiveBindings, freeze, interop, name,
|
|
15991
|
+
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 }) {
|
|
16028
15992
|
const { _, cnst, getFunctionIntro, getNonArrowFunctionIntro, getPropertyAccess, n, s } = snippets;
|
|
16029
15993
|
const factoryVariable = compact ? 'f' : 'factory';
|
|
16030
15994
|
const globalVariable = compact ? 'g' : 'global';
|
|
@@ -16104,9 +16068,9 @@ function umd(magicString, { accessedGlobals, dependencies, exports, hasDefaultEx
|
|
|
16104
16068
|
name: null
|
|
16105
16069
|
})}{${useStrict}${n}`;
|
|
16106
16070
|
const wrapperOutro = n + n + '}));';
|
|
16107
|
-
magicString.prepend(`${intro}${getInteropBlock(dependencies, interop, externalLiveBindings, freeze,
|
|
16071
|
+
magicString.prepend(`${intro}${getInteropBlock(dependencies, interop, externalLiveBindings, freeze, symbols, accessedGlobals, t, snippets)}`);
|
|
16108
16072
|
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings);
|
|
16109
|
-
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule === true || (esModule === 'if-default-prop' && hasDefaultExport),
|
|
16073
|
+
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule === true || (esModule === 'if-default-prop' && hasDefaultExport), symbols, snippets);
|
|
16110
16074
|
if (namespaceMarkers) {
|
|
16111
16075
|
namespaceMarkers = n + n + namespaceMarkers;
|
|
16112
16076
|
}
|
|
@@ -16748,10 +16712,10 @@ class Chunk {
|
|
|
16748
16712
|
return facades;
|
|
16749
16713
|
}
|
|
16750
16714
|
getChunkName() {
|
|
16751
|
-
return (this.name
|
|
16715
|
+
return (this.name ??= this.outputOptions.sanitizeFileName(this.getFallbackChunkName()));
|
|
16752
16716
|
}
|
|
16753
16717
|
getExportNames() {
|
|
16754
|
-
return (this.sortedExportNames
|
|
16718
|
+
return (this.sortedExportNames ??= [...this.exportsByName.keys()].sort());
|
|
16755
16719
|
}
|
|
16756
16720
|
getFileName() {
|
|
16757
16721
|
return this.fileName || this.getPreliminaryFileName().fileName;
|
|
@@ -17324,7 +17288,7 @@ class Chunk {
|
|
|
17324
17288
|
// This method changes properties on the AST before rendering and must not be async
|
|
17325
17289
|
renderModules(fileName) {
|
|
17326
17290
|
const { accessedGlobalsByScope, dependencies, exportNamesByVariable, includedNamespaces, inputOptions: { onLog }, isEmpty, orderedModules, outputOptions, pluginDriver, renderedModules, snippets } = this;
|
|
17327
|
-
const { compact,
|
|
17291
|
+
const { compact, format, freeze, generatedCode: { symbols } } = outputOptions;
|
|
17328
17292
|
const { _, cnst, n } = snippets;
|
|
17329
17293
|
this.setDynamicImportResolutions(fileName);
|
|
17330
17294
|
this.setImportMetaResolutions(fileName);
|
|
@@ -17337,14 +17301,13 @@ class Chunk {
|
|
|
17337
17301
|
const renderedModuleSources = new Map();
|
|
17338
17302
|
const renderOptions = {
|
|
17339
17303
|
accessedDocumentCurrentScript: false,
|
|
17340
|
-
dynamicImportFunction,
|
|
17341
17304
|
exportNamesByVariable,
|
|
17342
17305
|
format,
|
|
17343
17306
|
freeze,
|
|
17344
17307
|
indent,
|
|
17345
|
-
namespaceToStringTag,
|
|
17346
17308
|
pluginDriver,
|
|
17347
17309
|
snippets,
|
|
17310
|
+
symbols,
|
|
17348
17311
|
useOriginalName: null
|
|
17349
17312
|
};
|
|
17350
17313
|
let usesTopLevelAwait = false;
|
|
@@ -17360,7 +17323,7 @@ class Chunk {
|
|
|
17360
17323
|
}
|
|
17361
17324
|
renderOptions.accessedDocumentCurrentScript = false;
|
|
17362
17325
|
({ source } = rendered);
|
|
17363
|
-
usesTopLevelAwait
|
|
17326
|
+
usesTopLevelAwait ||= rendered.usesTopLevelAwait;
|
|
17364
17327
|
renderedLength = source.length();
|
|
17365
17328
|
if (renderedLength) {
|
|
17366
17329
|
if (compact && source.lastLine().includes('//'))
|
|
@@ -17427,7 +17390,7 @@ class Chunk {
|
|
|
17427
17390
|
}
|
|
17428
17391
|
}
|
|
17429
17392
|
setIdentifierRenderResolutions() {
|
|
17430
|
-
const { format,
|
|
17393
|
+
const { format, generatedCode: { symbols }, interop, preserveModules, externalLiveBindings } = this.outputOptions;
|
|
17431
17394
|
const syntheticExports = new Set();
|
|
17432
17395
|
for (const exportName of this.getExportNames()) {
|
|
17433
17396
|
const exportVariable = this.exportsByName.get(exportName);
|
|
@@ -17454,7 +17417,7 @@ class Chunk {
|
|
|
17454
17417
|
if (this.needsExportsShim) {
|
|
17455
17418
|
usedNames.add(MISSING_EXPORT_SHIM_VARIABLE);
|
|
17456
17419
|
}
|
|
17457
|
-
if (
|
|
17420
|
+
if (symbols) {
|
|
17458
17421
|
usedNames.add('Symbol');
|
|
17459
17422
|
}
|
|
17460
17423
|
switch (format) {
|
|
@@ -17713,7 +17676,7 @@ function getChunkDefinitionsFromManualChunks(manualChunkAliasByEntry) {
|
|
|
17713
17676
|
const modulesInManualChunks = new Set(manualChunkAliasByEntry.keys());
|
|
17714
17677
|
const manualChunkModulesByAlias = Object.create(null);
|
|
17715
17678
|
for (const [entry, alias] of manualChunkAliasByEntry) {
|
|
17716
|
-
addStaticDependenciesToManualChunk(entry, (manualChunkModulesByAlias[alias]
|
|
17679
|
+
addStaticDependenciesToManualChunk(entry, (manualChunkModulesByAlias[alias] ||= []), modulesInManualChunks);
|
|
17717
17680
|
}
|
|
17718
17681
|
for (const [alias, modules] of Object.entries(manualChunkModulesByAlias)) {
|
|
17719
17682
|
chunkDefinitions.push({ alias, modules });
|
|
@@ -17812,17 +17775,16 @@ function getDynamicallyDependentEntriesByDynamicEntry(dependentEntriesByModule,
|
|
|
17812
17775
|
return dynamicallyDependentEntriesByDynamicEntry;
|
|
17813
17776
|
}
|
|
17814
17777
|
function getChunksFromDependentEntries(modulesWithDependentEntries) {
|
|
17815
|
-
var _a;
|
|
17816
17778
|
const chunkModules = Object.create(null);
|
|
17817
17779
|
for (const { dependentEntries, modules } of modulesWithDependentEntries) {
|
|
17818
17780
|
let chunkSignature = 0n;
|
|
17819
17781
|
for (const entryIndex of dependentEntries) {
|
|
17820
17782
|
chunkSignature |= 1n << BigInt(entryIndex);
|
|
17821
17783
|
}
|
|
17822
|
-
(chunkModules[
|
|
17784
|
+
(chunkModules[String(chunkSignature)] ||= {
|
|
17823
17785
|
dependentEntries: new Set(dependentEntries),
|
|
17824
17786
|
modules: []
|
|
17825
|
-
})
|
|
17787
|
+
}).modules.push(...modules);
|
|
17826
17788
|
}
|
|
17827
17789
|
return Object.values(chunkModules);
|
|
17828
17790
|
}
|
|
@@ -17998,7 +17960,7 @@ function getPartitionedChunks(initialChunks, numberOfEntries, minChunkSize) {
|
|
|
17998
17960
|
// Unfortunately, we cannot take tree-shaking into account here because
|
|
17999
17961
|
// rendering did not happen yet, but we can detect empty modules
|
|
18000
17962
|
if (module.isIncluded()) {
|
|
18001
|
-
pure
|
|
17963
|
+
pure &&= !module.hasEffects();
|
|
18002
17964
|
// we use a trivial size for the default minChunkSize to improve
|
|
18003
17965
|
// performance
|
|
18004
17966
|
size += minChunkSize > 1 ? module.estimateSize() : 1;
|
|
@@ -18037,7 +17999,7 @@ function mergeChunks(chunkPartition, minChunkSize) {
|
|
|
18037
17999
|
getChunksInPartition(bestTargetChunk, minChunkSize, chunkPartition).delete(bestTargetChunk);
|
|
18038
18000
|
bestTargetChunk.modules.push(...modules);
|
|
18039
18001
|
bestTargetChunk.size += size;
|
|
18040
|
-
bestTargetChunk.pure
|
|
18002
|
+
bestTargetChunk.pure &&= pure;
|
|
18041
18003
|
const { dependencies, dependentChunks, dependentEntries } = bestTargetChunk;
|
|
18042
18004
|
bestTargetChunk.correlatedAtoms &= correlatedAtoms;
|
|
18043
18005
|
bestTargetChunk.containedAtoms |= containedAtoms;
|
|
@@ -18935,7 +18897,10 @@ function resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolve
|
|
|
18935
18897
|
}
|
|
18936
18898
|
replaceContext = (pluginContext, plugin) => ({
|
|
18937
18899
|
...pluginContext,
|
|
18938
|
-
resolve: (source, importer, { attributes, custom, isEntry, skipSelf } = BLANK) =>
|
|
18900
|
+
resolve: (source, importer, { attributes, custom, isEntry, skipSelf } = BLANK) => {
|
|
18901
|
+
skipSelf ??= true;
|
|
18902
|
+
return moduleLoaderResolveId(source, importer, custom, isEntry, attributes || EMPTY_OBJECT, skipSelf ? [...skip, { importer, plugin, source }] : skip);
|
|
18903
|
+
}
|
|
18939
18904
|
});
|
|
18940
18905
|
}
|
|
18941
18906
|
return pluginDriver.hookFirstAndGetPlugin('resolveId', [source, importer, { attributes, custom: customOptions, isEntry }], replaceContext, skipped);
|
|
@@ -19436,7 +19401,13 @@ class ModuleLoader {
|
|
|
19436
19401
|
async addModuleSource(id, importer, module) {
|
|
19437
19402
|
let source;
|
|
19438
19403
|
try {
|
|
19439
|
-
source = await this.graph.fileOperationQueue.run(async () =>
|
|
19404
|
+
source = await this.graph.fileOperationQueue.run(async () => {
|
|
19405
|
+
const content = await this.pluginDriver.hookFirst('load', [id]);
|
|
19406
|
+
if (content !== null)
|
|
19407
|
+
return content;
|
|
19408
|
+
this.graph.watchFiles[id] = true;
|
|
19409
|
+
return await readFile(id, 'utf8');
|
|
19410
|
+
});
|
|
19440
19411
|
}
|
|
19441
19412
|
catch (error_) {
|
|
19442
19413
|
let message = `Could not load ${id}`;
|
|
@@ -19530,7 +19501,6 @@ class ModuleLoader {
|
|
|
19530
19501
|
}
|
|
19531
19502
|
const module = new Module(this.graph, id, this.options, isEntry, moduleSideEffects, syntheticNamedExports, meta, attributes);
|
|
19532
19503
|
this.modulesById.set(id, module);
|
|
19533
|
-
this.graph.watchFiles[id] = true;
|
|
19534
19504
|
const loadPromise = this.addModuleSource(id, importer, module).then(() => [
|
|
19535
19505
|
this.getResolveStaticDependencyPromises(module),
|
|
19536
19506
|
this.getResolveDynamicImportPromises(module),
|
|
@@ -20081,7 +20051,7 @@ class FileEmitter {
|
|
|
20081
20051
|
this.filesByReferenceId.set(referenceId, assetWithFileName);
|
|
20082
20052
|
const existingAsset = bundle[fileName];
|
|
20083
20053
|
if (existingAsset?.type === 'asset') {
|
|
20084
|
-
existingAsset.needsCodeReference
|
|
20054
|
+
existingAsset.needsCodeReference &&= needsCodeReference;
|
|
20085
20055
|
}
|
|
20086
20056
|
else {
|
|
20087
20057
|
bundle[fileName] = {
|
|
@@ -20098,7 +20068,7 @@ class FileEmitter {
|
|
|
20098
20068
|
let usedConsumedFile;
|
|
20099
20069
|
let needsCodeReference = true;
|
|
20100
20070
|
for (const consumedFile of consumedFiles) {
|
|
20101
|
-
needsCodeReference
|
|
20071
|
+
needsCodeReference &&= consumedFile.needsCodeReference;
|
|
20102
20072
|
const assetFileName = generateAssetFileName(consumedFile.name, consumedFile.source, sourceHash, outputOptions, bundle);
|
|
20103
20073
|
if (!fileName ||
|
|
20104
20074
|
assetFileName.length < fileName.length ||
|
|
@@ -20190,17 +20160,9 @@ function getPluginContext(plugin, pluginCache, graph, options, fileEmitter, exis
|
|
|
20190
20160
|
rollupVersion: version,
|
|
20191
20161
|
watchMode: graph.watchMode
|
|
20192
20162
|
},
|
|
20193
|
-
get moduleIds() {
|
|
20194
|
-
function* wrappedModuleIds() {
|
|
20195
|
-
// We are wrapping this in a generator to only show the message once we are actually iterating
|
|
20196
|
-
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);
|
|
20197
|
-
yield* moduleIds;
|
|
20198
|
-
}
|
|
20199
|
-
const moduleIds = graph.modulesById.keys();
|
|
20200
|
-
return wrappedModuleIds();
|
|
20201
|
-
},
|
|
20202
20163
|
parse: graph.contextParse.bind(graph),
|
|
20203
20164
|
resolve(source, importer, { attributes, custom, isEntry, skipSelf } = BLANK) {
|
|
20165
|
+
skipSelf ??= true;
|
|
20204
20166
|
return graph.moduleLoader.resolveId(source, importer, custom, isEntry, attributes || EMPTY_OBJECT, skipSelf ? [{ importer, plugin, source }] : null);
|
|
20205
20167
|
},
|
|
20206
20168
|
setAssetSource: fileEmitter.setAssetSource,
|
|
@@ -20798,33 +20760,28 @@ async function normalizeInputOptions(config, watchMode) {
|
|
|
20798
20760
|
const logLevel = config.logLevel || LOGLEVEL_INFO;
|
|
20799
20761
|
const onLog = getLogger(plugins, getOnLog(config, logLevel), watchMode, logLevel);
|
|
20800
20762
|
const strictDeprecations = config.strictDeprecations || false;
|
|
20801
|
-
const maxParallelFileOps = getMaxParallelFileOps(config
|
|
20763
|
+
const maxParallelFileOps = getMaxParallelFileOps(config);
|
|
20802
20764
|
const options = {
|
|
20803
20765
|
cache: getCache(config),
|
|
20804
20766
|
context,
|
|
20805
20767
|
experimentalCacheExpiry: config.experimentalCacheExpiry ?? 10,
|
|
20806
20768
|
experimentalLogSideEffects: config.experimentalLogSideEffects || false,
|
|
20807
20769
|
external: getIdMatcher(config.external),
|
|
20808
|
-
inlineDynamicImports: getInlineDynamicImports$1(config, onLog, strictDeprecations),
|
|
20809
20770
|
input: getInput(config),
|
|
20810
20771
|
logLevel,
|
|
20811
20772
|
makeAbsoluteExternalsRelative: config.makeAbsoluteExternalsRelative ?? 'ifRelativeSource',
|
|
20812
|
-
manualChunks: getManualChunks$1(config, onLog, strictDeprecations),
|
|
20813
20773
|
maxParallelFileOps,
|
|
20814
|
-
maxParallelFileReads: maxParallelFileOps,
|
|
20815
20774
|
moduleContext: getModuleContext(config, context),
|
|
20816
20775
|
onLog,
|
|
20817
|
-
onwarn: warning => onLog(LOGLEVEL_WARN, warning),
|
|
20818
20776
|
perf: config.perf || false,
|
|
20819
20777
|
plugins,
|
|
20820
20778
|
preserveEntrySignatures: config.preserveEntrySignatures ?? 'exports-only',
|
|
20821
|
-
preserveModules: getPreserveModules$1(config, onLog, strictDeprecations),
|
|
20822
20779
|
preserveSymlinks: config.preserveSymlinks || false,
|
|
20823
20780
|
shimMissingExports: config.shimMissingExports || false,
|
|
20824
20781
|
strictDeprecations,
|
|
20825
20782
|
treeshake: getTreeshake(config)
|
|
20826
20783
|
};
|
|
20827
|
-
warnUnknownOptions(config, [...Object.keys(options), 'watch'], 'input options', onLog, /^(output)$/);
|
|
20784
|
+
warnUnknownOptions(config, [...Object.keys(options), 'onwarn', 'watch'], 'input options', onLog, /^(output)$/);
|
|
20828
20785
|
return { options, unsetOptions };
|
|
20829
20786
|
}
|
|
20830
20787
|
const getCache = (config) => config.cache === true // `true` is the default
|
|
@@ -20852,30 +20809,12 @@ const getIdMatcher = (option) => {
|
|
|
20852
20809
|
}
|
|
20853
20810
|
return () => false;
|
|
20854
20811
|
};
|
|
20855
|
-
const getInlineDynamicImports$1 = (config, log, strictDeprecations) => {
|
|
20856
|
-
const configInlineDynamicImports = config.inlineDynamicImports;
|
|
20857
|
-
if (configInlineDynamicImports) {
|
|
20858
|
-
warnDeprecationWithOptions('The "inlineDynamicImports" option is deprecated. Use the "output.inlineDynamicImports" option instead.', URL_OUTPUT_INLINEDYNAMICIMPORTS, true, log, strictDeprecations);
|
|
20859
|
-
}
|
|
20860
|
-
return configInlineDynamicImports;
|
|
20861
|
-
};
|
|
20862
20812
|
const getInput = (config) => {
|
|
20863
20813
|
const configInput = config.input;
|
|
20864
20814
|
return configInput == null ? [] : typeof configInput === 'string' ? [configInput] : configInput;
|
|
20865
20815
|
};
|
|
20866
|
-
const
|
|
20867
|
-
const
|
|
20868
|
-
if (configManualChunks) {
|
|
20869
|
-
warnDeprecationWithOptions('The "manualChunks" option is deprecated. Use the "output.manualChunks" option instead.', URL_OUTPUT_MANUALCHUNKS, true, log, strictDeprecations);
|
|
20870
|
-
}
|
|
20871
|
-
return configManualChunks;
|
|
20872
|
-
};
|
|
20873
|
-
const getMaxParallelFileOps = (config, log, strictDeprecations) => {
|
|
20874
|
-
const maxParallelFileReads = config.maxParallelFileReads;
|
|
20875
|
-
if (typeof maxParallelFileReads === 'number') {
|
|
20876
|
-
warnDeprecationWithOptions('The "maxParallelFileReads" option is deprecated. Use the "maxParallelFileOps" option instead.', URL_MAXPARALLELFILEOPS, true, log, strictDeprecations);
|
|
20877
|
-
}
|
|
20878
|
-
const maxParallelFileOps = config.maxParallelFileOps ?? maxParallelFileReads;
|
|
20816
|
+
const getMaxParallelFileOps = (config) => {
|
|
20817
|
+
const maxParallelFileOps = config.maxParallelFileOps;
|
|
20879
20818
|
if (typeof maxParallelFileOps === 'number') {
|
|
20880
20819
|
if (maxParallelFileOps <= 0)
|
|
20881
20820
|
return Infinity;
|
|
@@ -20897,13 +20836,6 @@ const getModuleContext = (config, context) => {
|
|
|
20897
20836
|
}
|
|
20898
20837
|
return () => context;
|
|
20899
20838
|
};
|
|
20900
|
-
const getPreserveModules$1 = (config, log, strictDeprecations) => {
|
|
20901
|
-
const configPreserveModules = config.preserveModules;
|
|
20902
|
-
if (configPreserveModules) {
|
|
20903
|
-
warnDeprecationWithOptions('The "preserveModules" option is deprecated. Use the "output.preserveModules" option instead.', URL_OUTPUT_PRESERVEMODULES, true, log, strictDeprecations);
|
|
20904
|
-
}
|
|
20905
|
-
return configPreserveModules;
|
|
20906
|
-
};
|
|
20907
20839
|
const getTreeshake = (config) => {
|
|
20908
20840
|
const configTreeshake = config.treeshake;
|
|
20909
20841
|
if (configTreeshake === false) {
|
|
@@ -20963,8 +20895,7 @@ async function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
20963
20895
|
const inlineDynamicImports = getInlineDynamicImports(config, inputOptions);
|
|
20964
20896
|
const preserveModules = getPreserveModules(config, inlineDynamicImports, inputOptions);
|
|
20965
20897
|
const file = getFile(config, preserveModules, inputOptions);
|
|
20966
|
-
const
|
|
20967
|
-
const generatedCode = getGeneratedCode(config, preferConst);
|
|
20898
|
+
const generatedCode = getGeneratedCode(config);
|
|
20968
20899
|
const externalImportAttributes = getExternalImportAttributes(config, inputOptions);
|
|
20969
20900
|
const outputOptions = {
|
|
20970
20901
|
amd: getAmd(config),
|
|
@@ -20973,11 +20904,9 @@ async function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
20973
20904
|
chunkFileNames: config.chunkFileNames ?? '[name]-[hash].js',
|
|
20974
20905
|
compact,
|
|
20975
20906
|
dir: getDir(config, file),
|
|
20976
|
-
dynamicImportFunction: getDynamicImportFunction(config, inputOptions, format),
|
|
20977
20907
|
dynamicImportInCjs: config.dynamicImportInCjs ?? true,
|
|
20978
20908
|
entryFileNames: getEntryFileNames(config, unsetOptions),
|
|
20979
20909
|
esModule: config.esModule ?? 'if-default-prop',
|
|
20980
|
-
experimentalDeepDynamicChunkOptimization: getExperimentalDeepDynamicChunkOptimization(config, inputOptions),
|
|
20981
20910
|
experimentalMinChunkSize: config.experimentalMinChunkSize ?? 1,
|
|
20982
20911
|
exports: getExports(config, unsetOptions),
|
|
20983
20912
|
extend: config.extend || false,
|
|
@@ -20995,15 +20924,13 @@ async function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
20995
20924
|
inlineDynamicImports,
|
|
20996
20925
|
interop: getInterop(config),
|
|
20997
20926
|
intro: getAddon(config, 'intro'),
|
|
20998
|
-
manualChunks: getManualChunks(config, inlineDynamicImports, preserveModules
|
|
20927
|
+
manualChunks: getManualChunks(config, inlineDynamicImports, preserveModules),
|
|
20999
20928
|
minifyInternalExports: getMinifyInternalExports(config, format, compact),
|
|
21000
20929
|
name: config.name,
|
|
21001
|
-
namespaceToStringTag: getNamespaceToStringTag(config, generatedCode, inputOptions),
|
|
21002
20930
|
noConflict: config.noConflict || false,
|
|
21003
20931
|
outro: getAddon(config, 'outro'),
|
|
21004
20932
|
paths: config.paths || {},
|
|
21005
20933
|
plugins: await normalizePluginOption(config.plugins),
|
|
21006
|
-
preferConst,
|
|
21007
20934
|
preserveModules,
|
|
21008
20935
|
preserveModulesRoot: getPreserveModulesRoot(config),
|
|
21009
20936
|
sanitizeFileName: typeof config.sanitizeFileName === 'function'
|
|
@@ -21068,7 +20995,7 @@ const getFormat = (config) => {
|
|
|
21068
20995
|
}
|
|
21069
20996
|
};
|
|
21070
20997
|
const getInlineDynamicImports = (config, inputOptions) => {
|
|
21071
|
-
const inlineDynamicImports =
|
|
20998
|
+
const inlineDynamicImports = config.inlineDynamicImports || false;
|
|
21072
20999
|
const { input } = inputOptions;
|
|
21073
21000
|
if (inlineDynamicImports && (Array.isArray(input) ? input : Object.keys(input)).length > 1) {
|
|
21074
21001
|
return error(logInvalidOption('output.inlineDynamicImports', URL_OUTPUT_INLINEDYNAMICIMPORTS, 'multiple inputs are not supported when "output.inlineDynamicImports" is true'));
|
|
@@ -21076,7 +21003,7 @@ const getInlineDynamicImports = (config, inputOptions) => {
|
|
|
21076
21003
|
return inlineDynamicImports;
|
|
21077
21004
|
};
|
|
21078
21005
|
const getPreserveModules = (config, inlineDynamicImports, inputOptions) => {
|
|
21079
|
-
const preserveModules =
|
|
21006
|
+
const preserveModules = config.preserveModules || false;
|
|
21080
21007
|
if (preserveModules) {
|
|
21081
21008
|
if (inlineDynamicImports) {
|
|
21082
21009
|
return error(logInvalidOption('output.inlineDynamicImports', URL_OUTPUT_INLINEDYNAMICIMPORTS, `this option is not supported for "output.preserveModules"`));
|
|
@@ -21087,13 +21014,6 @@ const getPreserveModules = (config, inlineDynamicImports, inputOptions) => {
|
|
|
21087
21014
|
}
|
|
21088
21015
|
return preserveModules;
|
|
21089
21016
|
};
|
|
21090
|
-
const getPreferConst = (config, inputOptions) => {
|
|
21091
|
-
const configPreferConst = config.preferConst;
|
|
21092
|
-
if (configPreferConst != null) {
|
|
21093
|
-
warnDeprecation(`The "output.preferConst" option is deprecated. Use the "output.generatedCode.constBindings" option instead.`, URL_OUTPUT_GENERATEDCODE_CONSTBINDINGS, true, inputOptions);
|
|
21094
|
-
}
|
|
21095
|
-
return !!configPreferConst;
|
|
21096
|
-
};
|
|
21097
21017
|
const getPreserveModulesRoot = (config) => {
|
|
21098
21018
|
const { preserveModulesRoot } = config;
|
|
21099
21019
|
if (preserveModulesRoot === null || preserveModulesRoot === undefined) {
|
|
@@ -21144,16 +21064,6 @@ const getDir = (config, file) => {
|
|
|
21144
21064
|
}
|
|
21145
21065
|
return dir;
|
|
21146
21066
|
};
|
|
21147
|
-
const getDynamicImportFunction = (config, inputOptions, format) => {
|
|
21148
|
-
const configDynamicImportFunction = config.dynamicImportFunction;
|
|
21149
|
-
if (configDynamicImportFunction) {
|
|
21150
|
-
warnDeprecation(`The "output.dynamicImportFunction" option is deprecated. Use the "renderDynamicImport" plugin hook instead.`, URL_RENDERDYNAMICIMPORT, true, inputOptions);
|
|
21151
|
-
if (format !== 'es') {
|
|
21152
|
-
inputOptions.onLog(LOGLEVEL_WARN, logInvalidOption('output.dynamicImportFunction', URL_OUTPUT_DYNAMICIMPORTFUNCTION, 'this option is ignored for formats other than "es"'));
|
|
21153
|
-
}
|
|
21154
|
-
}
|
|
21155
|
-
return configDynamicImportFunction;
|
|
21156
|
-
};
|
|
21157
21067
|
const getEntryFileNames = (config, unsetOptions) => {
|
|
21158
21068
|
const configEntryFileNames = config.entryFileNames;
|
|
21159
21069
|
if (configEntryFileNames == null) {
|
|
@@ -21161,13 +21071,6 @@ const getEntryFileNames = (config, unsetOptions) => {
|
|
|
21161
21071
|
}
|
|
21162
21072
|
return configEntryFileNames ?? '[name].js';
|
|
21163
21073
|
};
|
|
21164
|
-
function getExperimentalDeepDynamicChunkOptimization(config, inputOptions) {
|
|
21165
|
-
const configExperimentalDeepDynamicChunkOptimization = config.experimentalDeepDynamicChunkOptimization;
|
|
21166
|
-
if (configExperimentalDeepDynamicChunkOptimization != null) {
|
|
21167
|
-
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);
|
|
21168
|
-
}
|
|
21169
|
-
return configExperimentalDeepDynamicChunkOptimization || false;
|
|
21170
|
-
}
|
|
21171
21074
|
function getExports(config, unsetOptions) {
|
|
21172
21075
|
const configExports = config.exports;
|
|
21173
21076
|
if (configExports == null) {
|
|
@@ -21184,11 +21087,11 @@ const getExternalImportAttributes = (config, inputOptions) => {
|
|
|
21184
21087
|
}
|
|
21185
21088
|
return config.externalImportAttributes ?? config.externalImportAssertions ?? true;
|
|
21186
21089
|
};
|
|
21187
|
-
const getGeneratedCode = (config
|
|
21090
|
+
const getGeneratedCode = (config) => {
|
|
21188
21091
|
const configWithPreset = getOptionWithPreset(config.generatedCode, generatedCodePresets, 'output.generatedCode', URL_OUTPUT_GENERATEDCODE, '');
|
|
21189
21092
|
return {
|
|
21190
21093
|
arrowFunctions: configWithPreset.arrowFunctions === true,
|
|
21191
|
-
constBindings: configWithPreset.constBindings === true
|
|
21094
|
+
constBindings: configWithPreset.constBindings === true,
|
|
21192
21095
|
objectShorthand: configWithPreset.objectShorthand === true,
|
|
21193
21096
|
reservedNamesAsProps: configWithPreset.reservedNamesAsProps !== false,
|
|
21194
21097
|
symbols: configWithPreset.symbols === true
|
|
@@ -21229,8 +21132,8 @@ const validateInterop = (interop) => {
|
|
|
21229
21132
|
}
|
|
21230
21133
|
return interop;
|
|
21231
21134
|
};
|
|
21232
|
-
const getManualChunks = (config, inlineDynamicImports, preserveModules
|
|
21233
|
-
const configManualChunks = config.manualChunks
|
|
21135
|
+
const getManualChunks = (config, inlineDynamicImports, preserveModules) => {
|
|
21136
|
+
const configManualChunks = config.manualChunks;
|
|
21234
21137
|
if (configManualChunks) {
|
|
21235
21138
|
if (inlineDynamicImports) {
|
|
21236
21139
|
return error(logInvalidOption('output.manualChunks', URL_OUTPUT_MANUALCHUNKS, 'this option is not supported for "output.inlineDynamicImports"'));
|
|
@@ -21242,14 +21145,6 @@ const getManualChunks = (config, inlineDynamicImports, preserveModules, inputOpt
|
|
|
21242
21145
|
return configManualChunks || {};
|
|
21243
21146
|
};
|
|
21244
21147
|
const getMinifyInternalExports = (config, format, compact) => config.minifyInternalExports ?? (compact || format === 'es' || format === 'system');
|
|
21245
|
-
const getNamespaceToStringTag = (config, generatedCode, inputOptions) => {
|
|
21246
|
-
const configNamespaceToStringTag = config.namespaceToStringTag;
|
|
21247
|
-
if (configNamespaceToStringTag != null) {
|
|
21248
|
-
warnDeprecation(`The "output.namespaceToStringTag" option is deprecated. Use the "output.generatedCode.symbols" option instead.`, URL_OUTPUT_GENERATEDCODE_SYMBOLS, true, inputOptions);
|
|
21249
|
-
return configNamespaceToStringTag;
|
|
21250
|
-
}
|
|
21251
|
-
return generatedCode.symbols || false;
|
|
21252
|
-
};
|
|
21253
21148
|
const getSourcemapFileNames = (config, unsetOptions) => {
|
|
21254
21149
|
const configSourcemapFileNames = config.sourcemapFileNames;
|
|
21255
21150
|
if (configSourcemapFileNames == null) {
|
|
@@ -21601,7 +21496,7 @@ async function mergeOptions(config, watchMode, rawCommandOptions = EMPTY_COMMAND
|
|
|
21601
21496
|
const logLevel = config.logLevel || LOGLEVEL_INFO;
|
|
21602
21497
|
const onLog = getOnLog(config, logLevel, printLog);
|
|
21603
21498
|
const log = getLogger(plugins, onLog, watchMode, logLevel);
|
|
21604
|
-
const inputOptions =
|
|
21499
|
+
const inputOptions = mergeInputOptions(config, command, plugins, log, onLog);
|
|
21605
21500
|
if (command.output) {
|
|
21606
21501
|
Object.assign(command, command.output);
|
|
21607
21502
|
}
|
|
@@ -21615,14 +21510,14 @@ async function mergeOptions(config, watchMode, rawCommandOptions = EMPTY_COMMAND
|
|
|
21615
21510
|
...Object.keys(commandAliases),
|
|
21616
21511
|
'bundleConfigAsCjs',
|
|
21617
21512
|
'config',
|
|
21513
|
+
'configPlugin',
|
|
21618
21514
|
'environment',
|
|
21515
|
+
'failAfterWarnings',
|
|
21619
21516
|
'filterLogs',
|
|
21620
21517
|
'plugin',
|
|
21621
21518
|
'silent',
|
|
21622
|
-
'failAfterWarnings',
|
|
21623
21519
|
'stdin',
|
|
21624
|
-
'waitForBundleInput'
|
|
21625
|
-
'configPlugin'
|
|
21520
|
+
'waitForBundleInput'
|
|
21626
21521
|
], 'CLI flags', log, /^_$|output$|config/);
|
|
21627
21522
|
inputOptions.output = outputOptions;
|
|
21628
21523
|
return inputOptions;
|
|
@@ -21654,20 +21549,16 @@ function mergeInputOptions(config, overrides, plugins, log, onLog) {
|
|
|
21654
21549
|
experimentalCacheExpiry: getOption('experimentalCacheExpiry'),
|
|
21655
21550
|
experimentalLogSideEffects: getOption('experimentalLogSideEffects'),
|
|
21656
21551
|
external: getExternal(config, overrides),
|
|
21657
|
-
inlineDynamicImports: getOption('inlineDynamicImports'),
|
|
21658
21552
|
input: getOption('input') || [],
|
|
21659
21553
|
logLevel: getOption('logLevel'),
|
|
21660
21554
|
makeAbsoluteExternalsRelative: getOption('makeAbsoluteExternalsRelative'),
|
|
21661
|
-
manualChunks: getOption('manualChunks'),
|
|
21662
21555
|
maxParallelFileOps: getOption('maxParallelFileOps'),
|
|
21663
|
-
maxParallelFileReads: getOption('maxParallelFileReads'),
|
|
21664
21556
|
moduleContext: getOption('moduleContext'),
|
|
21665
21557
|
onLog,
|
|
21666
21558
|
onwarn: undefined,
|
|
21667
21559
|
perf: getOption('perf'),
|
|
21668
21560
|
plugins,
|
|
21669
21561
|
preserveEntrySignatures: getOption('preserveEntrySignatures'),
|
|
21670
|
-
preserveModules: getOption('preserveModules'),
|
|
21671
21562
|
preserveSymlinks: getOption('preserveSymlinks'),
|
|
21672
21563
|
shimMissingExports: getOption('shimMissingExports'),
|
|
21673
21564
|
strictDeprecations: getOption('strictDeprecations'),
|
|
@@ -21710,11 +21601,9 @@ async function mergeOutputOptions(config, overrides, log) {
|
|
|
21710
21601
|
chunkFileNames: getOption('chunkFileNames'),
|
|
21711
21602
|
compact: getOption('compact'),
|
|
21712
21603
|
dir: getOption('dir'),
|
|
21713
|
-
dynamicImportFunction: getOption('dynamicImportFunction'),
|
|
21714
21604
|
dynamicImportInCjs: getOption('dynamicImportInCjs'),
|
|
21715
21605
|
entryFileNames: getOption('entryFileNames'),
|
|
21716
21606
|
esModule: getOption('esModule'),
|
|
21717
|
-
experimentalDeepDynamicChunkOptimization: getOption('experimentalDeepDynamicChunkOptimization'),
|
|
21718
21607
|
experimentalMinChunkSize: getOption('experimentalMinChunkSize'),
|
|
21719
21608
|
exports: getOption('exports'),
|
|
21720
21609
|
extend: getOption('extend'),
|
|
@@ -21735,12 +21624,10 @@ async function mergeOutputOptions(config, overrides, log) {
|
|
|
21735
21624
|
manualChunks: getOption('manualChunks'),
|
|
21736
21625
|
minifyInternalExports: getOption('minifyInternalExports'),
|
|
21737
21626
|
name: getOption('name'),
|
|
21738
|
-
namespaceToStringTag: getOption('namespaceToStringTag'),
|
|
21739
21627
|
noConflict: getOption('noConflict'),
|
|
21740
21628
|
outro: getOption('outro'),
|
|
21741
21629
|
paths: getOption('paths'),
|
|
21742
21630
|
plugins: await normalizePluginOption(config.plugins),
|
|
21743
|
-
preferConst: getOption('preferConst'),
|
|
21744
21631
|
preserveModules: getOption('preserveModules'),
|
|
21745
21632
|
preserveModulesRoot: getOption('preserveModulesRoot'),
|
|
21746
21633
|
sanitizeFileName: getOption('sanitizeFileName'),
|