rollup 3.0.0-4 → 3.0.0-5
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/LICENSE.md +0 -29
- package/dist/bin/rollup +10 -8
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/rollup.js +238 -150
- package/dist/es/shared/watch.js +18 -14
- package/dist/loadConfigFile.js +6 -8
- package/dist/rollup.d.ts +32 -32
- package/dist/rollup.js +3 -3
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +56 -160
- package/dist/shared/mergeOptions.js +3 -3
- package/dist/shared/rollup.js +268 -157
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +17 -13
- package/package.json +18 -19
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v3.0.0-
|
|
4
|
-
|
|
3
|
+
Rollup.js v3.0.0-4
|
|
4
|
+
Wed, 31 Aug 2022 05:26:36 GMT - commit 392609619bcb75a0c7216f38e40d9573419a8e3f
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -28,7 +28,7 @@ function _interopNamespaceDefault(e) {
|
|
|
28
28
|
return n;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
var version$1 = "3.0.0-
|
|
31
|
+
var version$1 = "3.0.0-4";
|
|
32
32
|
|
|
33
33
|
function ensureArray$1(items) {
|
|
34
34
|
if (Array.isArray(items)) {
|
|
@@ -218,7 +218,7 @@ function augmentCodeLocation(props, pos, source, id) {
|
|
|
218
218
|
}
|
|
219
219
|
// Error codes should be sorted alphabetically while errors should be sorted by
|
|
220
220
|
// error code below
|
|
221
|
-
const ADDON_ERROR = 'ADDON_ERROR', ALREADY_CLOSED = 'ALREADY_CLOSED', AMBIGUOUS_EXTERNAL_NAMESPACES = 'AMBIGUOUS_EXTERNAL_NAMESPACES', ANONYMOUS_PLUGIN_CACHE = 'ANONYMOUS_PLUGIN_CACHE', ASSET_NOT_FINALISED = 'ASSET_NOT_FINALISED', ASSET_NOT_FOUND = 'ASSET_NOT_FOUND', ASSET_SOURCE_ALREADY_SET = 'ASSET_SOURCE_ALREADY_SET', ASSET_SOURCE_MISSING = 'ASSET_SOURCE_MISSING', BAD_LOADER = 'BAD_LOADER', CANNOT_CALL_NAMESPACE = 'CANNOT_CALL_NAMESPACE', CANNOT_EMIT_FROM_OPTIONS_HOOK = 'CANNOT_EMIT_FROM_OPTIONS_HOOK', CHUNK_NOT_GENERATED = 'CHUNK_NOT_GENERATED', CHUNK_INVALID = 'CHUNK_INVALID', CIRCULAR_DEPENDENCY = 'CIRCULAR_DEPENDENCY', CIRCULAR_REEXPORT = 'CIRCULAR_REEXPORT', CYCLIC_CROSS_CHUNK_REEXPORT = 'CYCLIC_CROSS_CHUNK_REEXPORT', DEPRECATED_FEATURE = 'DEPRECATED_FEATURE', DUPLICATE_IMPORT_OPTIONS = 'DUPLICATE_IMPORT_OPTIONS', DUPLICATE_PLUGIN_NAME = 'DUPLICATE_PLUGIN_NAME', EMPTY_BUNDLE = 'EMPTY_BUNDLE', EVAL = 'EVAL', EXTERNAL_SYNTHETIC_EXPORTS = 'EXTERNAL_SYNTHETIC_EXPORTS', FAIL_AFTER_WARNINGS = 'FAIL_AFTER_WARNINGS', FILE_NAME_CONFLICT = 'FILE_NAME_CONFLICT', FILE_NOT_FOUND = 'FILE_NOT_FOUND', ILLEGAL_IDENTIFIER_AS_NAME = 'ILLEGAL_IDENTIFIER_AS_NAME', ILLEGAL_REASSIGNMENT = 'ILLEGAL_REASSIGNMENT', INPUT_HOOK_IN_OUTPUT_PLUGIN = 'INPUT_HOOK_IN_OUTPUT_PLUGIN', INVALID_CHUNK = 'INVALID_CHUNK', INVALID_EXPORT_OPTION = 'INVALID_EXPORT_OPTION', INVALID_EXTERNAL_ID = 'INVALID_EXTERNAL_ID', INVALID_OPTION = 'INVALID_OPTION', INVALID_PLUGIN_HOOK = 'INVALID_PLUGIN_HOOK', INVALID_ROLLUP_PHASE = 'INVALID_ROLLUP_PHASE', INVALID_SETASSETSOURCE = 'INVALID_SETASSETSOURCE', INVALID_TLA_FORMAT = 'INVALID_TLA_FORMAT', MISSING_CONFIG = 'MISSING_CONFIG', MISSING_EXPORT = 'MISSING_EXPORT', MISSING_EXTERNAL_CONFIG = 'MISSING_EXTERNAL_CONFIG', MISSING_GLOBAL_NAME = 'MISSING_GLOBAL_NAME', MISSING_IMPLICIT_DEPENDANT = 'MISSING_IMPLICIT_DEPENDANT', MISSING_NAME_OPTION_FOR_IIFE_EXPORT = 'MISSING_NAME_OPTION_FOR_IIFE_EXPORT', MISSING_NODE_BUILTINS = 'MISSING_NODE_BUILTINS', MISSING_OPTION = 'MISSING_OPTION', MIXED_EXPORTS = 'MIXED_EXPORTS', MODULE_LEVEL_DIRECTIVE = 'MODULE_LEVEL_DIRECTIVE', NAMESPACE_CONFLICT = 'NAMESPACE_CONFLICT', NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE = 'NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE', ONLY_INLINE_SOURCEMAPS = 'ONLY_INLINE_SOURCEMAPS', PARSE_ERROR = 'PARSE_ERROR', PLUGIN_ERROR = 'PLUGIN_ERROR',
|
|
221
|
+
const ADDON_ERROR = 'ADDON_ERROR', ALREADY_CLOSED = 'ALREADY_CLOSED', AMBIGUOUS_EXTERNAL_NAMESPACES = 'AMBIGUOUS_EXTERNAL_NAMESPACES', ANONYMOUS_PLUGIN_CACHE = 'ANONYMOUS_PLUGIN_CACHE', ASSET_NOT_FINALISED = 'ASSET_NOT_FINALISED', ASSET_NOT_FOUND = 'ASSET_NOT_FOUND', ASSET_SOURCE_ALREADY_SET = 'ASSET_SOURCE_ALREADY_SET', ASSET_SOURCE_MISSING = 'ASSET_SOURCE_MISSING', BAD_LOADER = 'BAD_LOADER', CANNOT_CALL_NAMESPACE = 'CANNOT_CALL_NAMESPACE', CANNOT_EMIT_FROM_OPTIONS_HOOK = 'CANNOT_EMIT_FROM_OPTIONS_HOOK', CHUNK_NOT_GENERATED = 'CHUNK_NOT_GENERATED', CHUNK_INVALID = 'CHUNK_INVALID', CIRCULAR_DEPENDENCY = 'CIRCULAR_DEPENDENCY', CIRCULAR_REEXPORT = 'CIRCULAR_REEXPORT', CYCLIC_CROSS_CHUNK_REEXPORT = 'CYCLIC_CROSS_CHUNK_REEXPORT', DEPRECATED_FEATURE = 'DEPRECATED_FEATURE', DUPLICATE_IMPORT_OPTIONS = 'DUPLICATE_IMPORT_OPTIONS', DUPLICATE_PLUGIN_NAME = 'DUPLICATE_PLUGIN_NAME', EMPTY_BUNDLE = 'EMPTY_BUNDLE', EVAL = 'EVAL', EXTERNAL_SYNTHETIC_EXPORTS = 'EXTERNAL_SYNTHETIC_EXPORTS', FAIL_AFTER_WARNINGS = 'FAIL_AFTER_WARNINGS', FILE_NAME_CONFLICT = 'FILE_NAME_CONFLICT', FILE_NOT_FOUND = 'FILE_NOT_FOUND', ILLEGAL_IDENTIFIER_AS_NAME = 'ILLEGAL_IDENTIFIER_AS_NAME', ILLEGAL_REASSIGNMENT = 'ILLEGAL_REASSIGNMENT', INPUT_HOOK_IN_OUTPUT_PLUGIN = 'INPUT_HOOK_IN_OUTPUT_PLUGIN', INVALID_CHUNK = 'INVALID_CHUNK', INVALID_CONFIG_MODULE_FORMAT = 'INVALID_CONFIG_MODULE_FORMAT', INVALID_EXPORT_OPTION = 'INVALID_EXPORT_OPTION', INVALID_EXTERNAL_ID = 'INVALID_EXTERNAL_ID', INVALID_OPTION = 'INVALID_OPTION', INVALID_PLUGIN_HOOK = 'INVALID_PLUGIN_HOOK', INVALID_ROLLUP_PHASE = 'INVALID_ROLLUP_PHASE', INVALID_SETASSETSOURCE = 'INVALID_SETASSETSOURCE', INVALID_TLA_FORMAT = 'INVALID_TLA_FORMAT', MISSING_CONFIG = 'MISSING_CONFIG', MISSING_EXPORT = 'MISSING_EXPORT', MISSING_EXTERNAL_CONFIG = 'MISSING_EXTERNAL_CONFIG', MISSING_GLOBAL_NAME = 'MISSING_GLOBAL_NAME', MISSING_IMPLICIT_DEPENDANT = 'MISSING_IMPLICIT_DEPENDANT', MISSING_NAME_OPTION_FOR_IIFE_EXPORT = 'MISSING_NAME_OPTION_FOR_IIFE_EXPORT', MISSING_NODE_BUILTINS = 'MISSING_NODE_BUILTINS', MISSING_OPTION = 'MISSING_OPTION', MIXED_EXPORTS = 'MIXED_EXPORTS', MODULE_LEVEL_DIRECTIVE = 'MODULE_LEVEL_DIRECTIVE', NAMESPACE_CONFLICT = 'NAMESPACE_CONFLICT', NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE = 'NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE', ONLY_INLINE_SOURCEMAPS = 'ONLY_INLINE_SOURCEMAPS', PARSE_ERROR = 'PARSE_ERROR', PLUGIN_ERROR = 'PLUGIN_ERROR', SHIMMED_EXPORT = 'SHIMMED_EXPORT', SOURCEMAP_BROKEN = 'SOURCEMAP_BROKEN', SOURCEMAP_ERROR = 'SOURCEMAP_ERROR', SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT = 'SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT', THIS_IS_UNDEFINED = 'THIS_IS_UNDEFINED', UNEXPECTED_NAMED_IMPORT = 'UNEXPECTED_NAMED_IMPORT', UNKNOWN_OPTION = 'UNKNOWN_OPTION', UNRESOLVED_ENTRY = 'UNRESOLVED_ENTRY', UNRESOLVED_IMPORT = 'UNRESOLVED_IMPORT', UNUSED_EXTERNAL_IMPORT = 'UNUSED_EXTERNAL_IMPORT', VALIDATION_ERROR = 'VALIDATION_ERROR';
|
|
222
222
|
function errAddonNotGenerated(message, hook, plugin) {
|
|
223
223
|
return {
|
|
224
224
|
code: ADDON_ERROR,
|
|
@@ -409,6 +409,33 @@ function errCannotAssignModuleToChunk(moduleId, assignToAlias, currentAlias) {
|
|
|
409
409
|
message: `Cannot assign "${relativeId(moduleId)}" to the "${assignToAlias}" chunk as it is already in the "${currentAlias}" chunk.`
|
|
410
410
|
};
|
|
411
411
|
}
|
|
412
|
+
function errCannotBundleConfigAsEsm(originalError) {
|
|
413
|
+
return {
|
|
414
|
+
cause: originalError,
|
|
415
|
+
code: INVALID_CONFIG_MODULE_FORMAT,
|
|
416
|
+
message: `Rollup transpiled your configuration to an ES module even though it appears to contain CommonJS elements. To resolve this, you can pass the "--bundleConfigAsCjs" flag to Rollup or change your configuration to only contain valid ESM code.\n\nOriginal error: ${originalError.message}`,
|
|
417
|
+
stack: originalError.stack,
|
|
418
|
+
url: 'https://rollupjs.org/guide/en/#--bundleconfigascjs'
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
function errCannotLoadConfigAsCjs(originalError) {
|
|
422
|
+
return {
|
|
423
|
+
cause: originalError,
|
|
424
|
+
code: INVALID_CONFIG_MODULE_FORMAT,
|
|
425
|
+
message: `Node tried to load your configuration file as CommonJS even though it is likely an ES module. To resolve this, change the extension of your configuration to ".mjs", set "type": "module" in your package.json file or pass the "--bundleConfigAsCjs" flag.\n\nOriginal error: ${originalError.message}`,
|
|
426
|
+
stack: originalError.stack,
|
|
427
|
+
url: 'https://rollupjs.org/guide/en/#--bundleconfigascjs'
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
function errCannotLoadConfigAsEsm(originalError) {
|
|
431
|
+
return {
|
|
432
|
+
cause: originalError,
|
|
433
|
+
code: INVALID_CONFIG_MODULE_FORMAT,
|
|
434
|
+
message: `Node tried to load your configuration as an ES module even though it is likely CommonJS. To resolve this, change the extension of your configuration to ".cjs" or pass the "--bundleConfigAsCjs" flag.\n\nOriginal error: ${originalError.message}`,
|
|
435
|
+
stack: originalError.stack,
|
|
436
|
+
url: 'https://rollupjs.org/guide/en/#--bundleconfigascjs'
|
|
437
|
+
};
|
|
438
|
+
}
|
|
412
439
|
function errInvalidExportOptionValue(optionValue) {
|
|
413
440
|
return {
|
|
414
441
|
code: INVALID_EXPORT_OPTION,
|
|
@@ -624,15 +651,6 @@ function errPluginError(error, plugin, { hook, id } = {}) {
|
|
|
624
651
|
}
|
|
625
652
|
return error;
|
|
626
653
|
}
|
|
627
|
-
function errPreferNamedExports(facadeModuleId) {
|
|
628
|
-
const file = relativeId(facadeModuleId);
|
|
629
|
-
return {
|
|
630
|
-
code: PREFER_NAMED_EXPORTS,
|
|
631
|
-
id: facadeModuleId,
|
|
632
|
-
message: `Entry module "${file}" is implicitly using "default" export mode, which means for CommonJS output that its default export is assigned to "module.exports". For many tools, such CommonJS output will not be interchangeable with the original ES module. If this is intended, explicitly set "output.exports" to either "auto" or "default", otherwise you might want to consider changing the signature of "${file}" to use named exports only.`,
|
|
633
|
-
url: `https://rollupjs.org/guide/en/#outputexports`
|
|
634
|
-
};
|
|
635
|
-
}
|
|
636
654
|
function errShimmedExport(id, binding) {
|
|
637
655
|
return {
|
|
638
656
|
binding,
|
|
@@ -679,12 +697,6 @@ function errThisIsUndefined() {
|
|
|
679
697
|
url: `https://rollupjs.org/guide/en/#error-this-is-undefined`
|
|
680
698
|
};
|
|
681
699
|
}
|
|
682
|
-
function errTranspiledEsmConfig(fileName) {
|
|
683
|
-
return {
|
|
684
|
-
code: TRANSPILED_ESM_CONFIG,
|
|
685
|
-
message: `While loading the Rollup configuration from "${relativeId(fileName)}", Node tried to require an ES module from a CommonJS file, which is not supported. A common cause is if there is a package.json file with "type": "module" in the same folder. You can try to fix this by changing the extension of your configuration file to ".cjs" or ".mjs" depending on the content, which will prevent Rollup from trying to preprocess the file but rather hand it to Node directly.`
|
|
686
|
-
};
|
|
687
|
-
}
|
|
688
700
|
function errUnexpectedNamedImport(id, imported, isReexport) {
|
|
689
701
|
const importType = isReexport ? 'reexport' : 'import';
|
|
690
702
|
return {
|
|
@@ -1158,15 +1170,20 @@ class Chunk$1 {
|
|
|
1158
1170
|
}
|
|
1159
1171
|
}
|
|
1160
1172
|
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
if (typeof
|
|
1165
|
-
|
|
1166
|
-
} else
|
|
1167
|
-
|
|
1173
|
+
function getBtoa () {
|
|
1174
|
+
if (typeof window !== 'undefined' && typeof window.btoa === 'function') {
|
|
1175
|
+
return (str) => window.btoa(unescape(encodeURIComponent(str)));
|
|
1176
|
+
} else if (typeof Buffer === 'function') {
|
|
1177
|
+
return (str) => Buffer.from(str, 'utf-8').toString('base64');
|
|
1178
|
+
} else {
|
|
1179
|
+
return () => {
|
|
1180
|
+
throw new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.');
|
|
1181
|
+
};
|
|
1182
|
+
}
|
|
1168
1183
|
}
|
|
1169
1184
|
|
|
1185
|
+
const btoa = /*#__PURE__*/ getBtoa();
|
|
1186
|
+
|
|
1170
1187
|
class SourceMap {
|
|
1171
1188
|
constructor(properties) {
|
|
1172
1189
|
this.version = 3;
|
|
@@ -1358,7 +1375,7 @@ class MagicString {
|
|
|
1358
1375
|
indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
|
|
1359
1376
|
sourcemapLocations: { writable: true, value: new BitSet() },
|
|
1360
1377
|
storedNames: { writable: true, value: {} },
|
|
1361
|
-
indentStr: { writable: true, value:
|
|
1378
|
+
indentStr: { writable: true, value: undefined },
|
|
1362
1379
|
});
|
|
1363
1380
|
|
|
1364
1381
|
this.byStart[0] = chunk;
|
|
@@ -1488,7 +1505,19 @@ class MagicString {
|
|
|
1488
1505
|
return new SourceMap(this.generateDecodedMap(options));
|
|
1489
1506
|
}
|
|
1490
1507
|
|
|
1508
|
+
_ensureindentStr() {
|
|
1509
|
+
if (this.indentStr === undefined) {
|
|
1510
|
+
this.indentStr = guessIndent(this.original);
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
_getRawIndentString() {
|
|
1515
|
+
this._ensureindentStr();
|
|
1516
|
+
return this.indentStr;
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1491
1519
|
getIndentString() {
|
|
1520
|
+
this._ensureindentStr();
|
|
1492
1521
|
return this.indentStr === null ? '\t' : this.indentStr;
|
|
1493
1522
|
}
|
|
1494
1523
|
|
|
@@ -1500,7 +1529,10 @@ class MagicString {
|
|
|
1500
1529
|
indentStr = undefined;
|
|
1501
1530
|
}
|
|
1502
1531
|
|
|
1503
|
-
|
|
1532
|
+
if (indentStr === undefined) {
|
|
1533
|
+
this._ensureindentStr();
|
|
1534
|
+
indentStr = this.indentStr || '\t';
|
|
1535
|
+
}
|
|
1504
1536
|
|
|
1505
1537
|
if (indentStr === '') return this; // noop
|
|
1506
1538
|
|
|
@@ -2216,7 +2248,7 @@ class Bundle$1 {
|
|
|
2216
2248
|
const indentStringCounts = {};
|
|
2217
2249
|
|
|
2218
2250
|
this.sources.forEach((source) => {
|
|
2219
|
-
const indentStr = source.content.
|
|
2251
|
+
const indentStr = source.content._getRawIndentString();
|
|
2220
2252
|
|
|
2221
2253
|
if (indentStr === null) return;
|
|
2222
2254
|
|
|
@@ -2389,6 +2421,7 @@ function getOrCreate(map, key, init) {
|
|
|
2389
2421
|
const UnknownKey = Symbol('Unknown Key');
|
|
2390
2422
|
const UnknownNonAccessorKey = Symbol('Unknown Non-Accessor Key');
|
|
2391
2423
|
const UnknownInteger = Symbol('Unknown Integer');
|
|
2424
|
+
const SymbolToStringTag = Symbol('Symbol.toStringTag');
|
|
2392
2425
|
const EMPTY_PATH = [];
|
|
2393
2426
|
const UNKNOWN_PATH = [UnknownKey];
|
|
2394
2427
|
// For deoptimizations, this means we are modifying an unknown property but did
|
|
@@ -2466,7 +2499,7 @@ class ExpressionEntity {
|
|
|
2466
2499
|
/**
|
|
2467
2500
|
* If possible it returns a stringifyable literal value for this node that can be used
|
|
2468
2501
|
* for inlining or comparing values.
|
|
2469
|
-
* Otherwise it should return UnknownValue.
|
|
2502
|
+
* Otherwise, it should return UnknownValue.
|
|
2470
2503
|
*/
|
|
2471
2504
|
getLiteralValueAtPath(_path, _recursionTracker, _origin) {
|
|
2472
2505
|
return UnknownValue;
|
|
@@ -2642,15 +2675,16 @@ const RESERVED_NAMES$1 = RESERVED_NAMES;
|
|
|
2642
2675
|
|
|
2643
2676
|
const illegalCharacters = /[^$_a-zA-Z0-9]/g;
|
|
2644
2677
|
const startsWithDigit = (str) => /\d/.test(str[0]);
|
|
2678
|
+
const needsEscape = (str) => startsWithDigit(str) || RESERVED_NAMES$1.has(str) || str === 'arguments';
|
|
2645
2679
|
function isLegal(str) {
|
|
2646
|
-
if (
|
|
2680
|
+
if (needsEscape(str)) {
|
|
2647
2681
|
return false;
|
|
2648
2682
|
}
|
|
2649
2683
|
return !illegalCharacters.test(str);
|
|
2650
2684
|
}
|
|
2651
2685
|
function makeLegal(str) {
|
|
2652
2686
|
str = str.replace(/-(\w)/g, (_, letter) => letter.toUpperCase()).replace(illegalCharacters, '_');
|
|
2653
|
-
if (
|
|
2687
|
+
if (needsEscape(str))
|
|
2654
2688
|
str = `_${str}`;
|
|
2655
2689
|
return str || '_';
|
|
2656
2690
|
}
|
|
@@ -6884,15 +6918,16 @@ function is_reference (node, parent) {
|
|
|
6884
6918
|
|
|
6885
6919
|
/* eslint sort-keys: "off" */
|
|
6886
6920
|
const ValueProperties = Symbol('Value Properties');
|
|
6921
|
+
const getTruthyLiteralValue = () => UnknownTruthyValue;
|
|
6922
|
+
const returnFalse = () => false;
|
|
6923
|
+
const returnTrue = () => true;
|
|
6887
6924
|
const PURE = {
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
}
|
|
6925
|
+
getLiteralValue: getTruthyLiteralValue,
|
|
6926
|
+
hasEffectsWhenCalled: returnFalse
|
|
6891
6927
|
};
|
|
6892
6928
|
const IMPURE = {
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
}
|
|
6929
|
+
getLiteralValue: getTruthyLiteralValue,
|
|
6930
|
+
hasEffectsWhenCalled: returnTrue
|
|
6896
6931
|
};
|
|
6897
6932
|
// We use shortened variables to reduce file size here
|
|
6898
6933
|
/* OBJECT */
|
|
@@ -6909,6 +6944,7 @@ const PF = {
|
|
|
6909
6944
|
const MUTATES_ARG_WITHOUT_ACCESSOR = {
|
|
6910
6945
|
__proto__: null,
|
|
6911
6946
|
[ValueProperties]: {
|
|
6947
|
+
getLiteralValue: getTruthyLiteralValue,
|
|
6912
6948
|
hasEffectsWhenCalled({ args }, context) {
|
|
6913
6949
|
return (!args.length ||
|
|
6914
6950
|
args[0].hasEffectsOnInteractionAtPath(UNKNOWN_NON_ACCESSOR_PATH, NODE_INTERACTION_UNKNOWN_ASSIGNMENT, context));
|
|
@@ -7104,7 +7140,16 @@ const knownGlobals = {
|
|
|
7104
7140
|
[ValueProperties]: PURE,
|
|
7105
7141
|
for: PF,
|
|
7106
7142
|
keyFor: PF,
|
|
7107
|
-
prototype: O
|
|
7143
|
+
prototype: O,
|
|
7144
|
+
toStringTag: {
|
|
7145
|
+
__proto__: null,
|
|
7146
|
+
[ValueProperties]: {
|
|
7147
|
+
getLiteralValue() {
|
|
7148
|
+
return SymbolToStringTag;
|
|
7149
|
+
},
|
|
7150
|
+
hasEffectsWhenCalled: returnTrue
|
|
7151
|
+
}
|
|
7152
|
+
}
|
|
7108
7153
|
},
|
|
7109
7154
|
SyntaxError: PC,
|
|
7110
7155
|
toLocaleString: O,
|
|
@@ -7750,7 +7795,8 @@ class GlobalVariable extends Variable {
|
|
|
7750
7795
|
this.isReassigned = true;
|
|
7751
7796
|
}
|
|
7752
7797
|
getLiteralValueAtPath(path, _recursionTracker, _origin) {
|
|
7753
|
-
|
|
7798
|
+
const globalAtPath = getGlobalAtPath([this.name, ...path]);
|
|
7799
|
+
return globalAtPath ? globalAtPath.getLiteralValue() : UnknownValue;
|
|
7754
7800
|
}
|
|
7755
7801
|
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
7756
7802
|
switch (interaction.type) {
|
|
@@ -8941,7 +8987,7 @@ class MemberExpression extends NodeBase {
|
|
|
8941
8987
|
this.assignmentDeoptimized = false;
|
|
8942
8988
|
this.bound = false;
|
|
8943
8989
|
this.expressionsToBeDeoptimized = [];
|
|
8944
|
-
this.
|
|
8990
|
+
this.isUndefined = false;
|
|
8945
8991
|
}
|
|
8946
8992
|
bind() {
|
|
8947
8993
|
this.bound = true;
|
|
@@ -8952,8 +8998,8 @@ class MemberExpression extends NodeBase {
|
|
|
8952
8998
|
if (!resolvedVariable) {
|
|
8953
8999
|
super.bind();
|
|
8954
9000
|
}
|
|
8955
|
-
else if (
|
|
8956
|
-
this.
|
|
9001
|
+
else if (resolvedVariable === 'undefined') {
|
|
9002
|
+
this.isUndefined = true;
|
|
8957
9003
|
}
|
|
8958
9004
|
else {
|
|
8959
9005
|
this.variable = resolvedVariable;
|
|
@@ -8979,7 +9025,7 @@ class MemberExpression extends NodeBase {
|
|
|
8979
9025
|
if (this.variable) {
|
|
8980
9026
|
this.variable.deoptimizePath(path);
|
|
8981
9027
|
}
|
|
8982
|
-
else if (!this.
|
|
9028
|
+
else if (!this.isUndefined) {
|
|
8983
9029
|
if (path.length < MAX_PATH_DEPTH) {
|
|
8984
9030
|
const propertyKey = this.getPropertyKey();
|
|
8985
9031
|
this.object.deoptimizePath([
|
|
@@ -8993,7 +9039,7 @@ class MemberExpression extends NodeBase {
|
|
|
8993
9039
|
if (this.variable) {
|
|
8994
9040
|
this.variable.deoptimizeThisOnInteractionAtPath(interaction, path, recursionTracker);
|
|
8995
9041
|
}
|
|
8996
|
-
else if (!this.
|
|
9042
|
+
else if (!this.isUndefined) {
|
|
8997
9043
|
if (path.length < MAX_PATH_DEPTH) {
|
|
8998
9044
|
this.object.deoptimizeThisOnInteractionAtPath(interaction, [this.getPropertyKey(), ...path], recursionTracker);
|
|
8999
9045
|
}
|
|
@@ -9006,8 +9052,8 @@ class MemberExpression extends NodeBase {
|
|
|
9006
9052
|
if (this.variable) {
|
|
9007
9053
|
return this.variable.getLiteralValueAtPath(path, recursionTracker, origin);
|
|
9008
9054
|
}
|
|
9009
|
-
if (this.
|
|
9010
|
-
return
|
|
9055
|
+
if (this.isUndefined) {
|
|
9056
|
+
return undefined;
|
|
9011
9057
|
}
|
|
9012
9058
|
this.expressionsToBeDeoptimized.push(origin);
|
|
9013
9059
|
if (path.length < MAX_PATH_DEPTH) {
|
|
@@ -9019,8 +9065,8 @@ class MemberExpression extends NodeBase {
|
|
|
9019
9065
|
if (this.variable) {
|
|
9020
9066
|
return this.variable.getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin);
|
|
9021
9067
|
}
|
|
9022
|
-
if (this.
|
|
9023
|
-
return
|
|
9068
|
+
if (this.isUndefined) {
|
|
9069
|
+
return UNDEFINED_EXPRESSION;
|
|
9024
9070
|
}
|
|
9025
9071
|
this.expressionsToBeDeoptimized.push(origin);
|
|
9026
9072
|
if (path.length < MAX_PATH_DEPTH) {
|
|
@@ -9049,7 +9095,7 @@ class MemberExpression extends NodeBase {
|
|
|
9049
9095
|
if (this.variable) {
|
|
9050
9096
|
return this.variable.hasEffectsOnInteractionAtPath(path, interaction, context);
|
|
9051
9097
|
}
|
|
9052
|
-
if (this.
|
|
9098
|
+
if (this.isUndefined) {
|
|
9053
9099
|
return true;
|
|
9054
9100
|
}
|
|
9055
9101
|
if (path.length < MAX_PATH_DEPTH) {
|
|
@@ -9085,9 +9131,9 @@ class MemberExpression extends NodeBase {
|
|
|
9085
9131
|
this.accessInteraction = { thisArg: this.object, type: INTERACTION_ACCESSED };
|
|
9086
9132
|
}
|
|
9087
9133
|
render(code, options, { renderedParentType, isCalleeOfRenderedParent, renderedSurroundingElement } = BLANK) {
|
|
9088
|
-
if (this.variable || this.
|
|
9134
|
+
if (this.variable || this.isUndefined) {
|
|
9089
9135
|
const { snippets: { getPropertyAccess } } = options;
|
|
9090
|
-
let replacement = this.variable ? this.variable.getName(getPropertyAccess) :
|
|
9136
|
+
let replacement = this.variable ? this.variable.getName(getPropertyAccess) : 'undefined';
|
|
9091
9137
|
if (renderedParentType && isCalleeOfRenderedParent)
|
|
9092
9138
|
replacement = '0, ' + replacement;
|
|
9093
9139
|
code.overwrite(this.start, this.end, replacement, {
|
|
@@ -9118,7 +9164,7 @@ class MemberExpression extends NodeBase {
|
|
|
9118
9164
|
// Namespaces are not bound and should not be deoptimized
|
|
9119
9165
|
this.bound &&
|
|
9120
9166
|
propertyReadSideEffects &&
|
|
9121
|
-
!(this.variable || this.
|
|
9167
|
+
!(this.variable || this.isUndefined)) {
|
|
9122
9168
|
const propertyKey = this.getPropertyKey();
|
|
9123
9169
|
this.object.deoptimizeThisOnInteractionAtPath(this.accessInteraction, [propertyKey], SHARED_RECURSION_TRACKER);
|
|
9124
9170
|
this.context.requestTreeshakingPass();
|
|
@@ -9132,7 +9178,7 @@ class MemberExpression extends NodeBase {
|
|
|
9132
9178
|
// Namespaces are not bound and should not be deoptimized
|
|
9133
9179
|
this.bound &&
|
|
9134
9180
|
propertyReadSideEffects &&
|
|
9135
|
-
!(this.variable || this.
|
|
9181
|
+
!(this.variable || this.isUndefined)) {
|
|
9136
9182
|
this.object.deoptimizeThisOnInteractionAtPath(this.assignmentInteraction, [this.getPropertyKey()], SHARED_RECURSION_TRACKER);
|
|
9137
9183
|
this.context.requestTreeshakingPass();
|
|
9138
9184
|
}
|
|
@@ -9152,14 +9198,19 @@ class MemberExpression extends NodeBase {
|
|
|
9152
9198
|
if (this.propertyKey === null) {
|
|
9153
9199
|
this.propertyKey = UnknownKey;
|
|
9154
9200
|
const value = this.property.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this);
|
|
9155
|
-
return (this.propertyKey =
|
|
9201
|
+
return (this.propertyKey =
|
|
9202
|
+
value === SymbolToStringTag
|
|
9203
|
+
? value
|
|
9204
|
+
: typeof value === 'symbol'
|
|
9205
|
+
? UnknownKey
|
|
9206
|
+
: String(value));
|
|
9156
9207
|
}
|
|
9157
9208
|
return this.propertyKey;
|
|
9158
9209
|
}
|
|
9159
9210
|
hasAccessEffect(context) {
|
|
9160
9211
|
const { propertyReadSideEffects } = this.context.options
|
|
9161
9212
|
.treeshake;
|
|
9162
|
-
return (!(this.variable || this.
|
|
9213
|
+
return (!(this.variable || this.isUndefined) &&
|
|
9163
9214
|
propertyReadSideEffects &&
|
|
9164
9215
|
(propertyReadSideEffects === 'always' ||
|
|
9165
9216
|
this.object.hasEffectsOnInteractionAtPath([this.getPropertyKey()], this.accessInteraction, context)));
|
|
@@ -10366,31 +10417,29 @@ class ImportDefaultSpecifier extends NodeBase {
|
|
|
10366
10417
|
}
|
|
10367
10418
|
|
|
10368
10419
|
const INTEROP_DEFAULT_VARIABLE = '_interopDefault';
|
|
10369
|
-
const
|
|
10420
|
+
const INTEROP_DEFAULT_COMPAT_VARIABLE = '_interopDefaultCompat';
|
|
10370
10421
|
const INTEROP_NAMESPACE_VARIABLE = '_interopNamespace';
|
|
10422
|
+
const INTEROP_NAMESPACE_COMPAT_VARIABLE = '_interopNamespaceCompat';
|
|
10371
10423
|
const INTEROP_NAMESPACE_DEFAULT_VARIABLE = '_interopNamespaceDefault';
|
|
10372
10424
|
const INTEROP_NAMESPACE_DEFAULT_ONLY_VARIABLE = '_interopNamespaceDefaultOnly';
|
|
10373
10425
|
const MERGE_NAMESPACES_VARIABLE = '_mergeNamespaces';
|
|
10374
10426
|
const defaultInteropHelpersByInteropType = {
|
|
10375
10427
|
auto: INTEROP_DEFAULT_VARIABLE,
|
|
10428
|
+
compat: INTEROP_DEFAULT_COMPAT_VARIABLE,
|
|
10376
10429
|
default: null,
|
|
10377
10430
|
defaultOnly: null,
|
|
10378
|
-
esModule: null
|
|
10379
|
-
false: null,
|
|
10380
|
-
true: INTEROP_DEFAULT_LEGACY_VARIABLE
|
|
10431
|
+
esModule: null
|
|
10381
10432
|
};
|
|
10382
10433
|
const isDefaultAProperty = (interopType, externalLiveBindings) => interopType === 'esModule' ||
|
|
10383
|
-
(externalLiveBindings && (interopType === 'auto' || interopType === '
|
|
10434
|
+
(externalLiveBindings && (interopType === 'auto' || interopType === 'compat'));
|
|
10384
10435
|
const namespaceInteropHelpersByInteropType = {
|
|
10385
10436
|
auto: INTEROP_NAMESPACE_VARIABLE,
|
|
10437
|
+
compat: INTEROP_NAMESPACE_COMPAT_VARIABLE,
|
|
10386
10438
|
default: INTEROP_NAMESPACE_DEFAULT_VARIABLE,
|
|
10387
10439
|
defaultOnly: INTEROP_NAMESPACE_DEFAULT_ONLY_VARIABLE,
|
|
10388
|
-
esModule: null
|
|
10389
|
-
false: null,
|
|
10390
|
-
true: INTEROP_NAMESPACE_VARIABLE
|
|
10440
|
+
esModule: null
|
|
10391
10441
|
};
|
|
10392
|
-
const canDefaultBeTakenFromNamespace = (interopType, externalLiveBindings) => isDefaultAProperty(interopType, externalLiveBindings)
|
|
10393
|
-
defaultInteropHelpersByInteropType[interopType] === INTEROP_DEFAULT_VARIABLE;
|
|
10442
|
+
const canDefaultBeTakenFromNamespace = (interopType, externalLiveBindings) => interopType !== 'esModule' && isDefaultAProperty(interopType, externalLiveBindings);
|
|
10394
10443
|
const getHelpersBlock = (additionalHelpers, accessedGlobals, indent, snippets, liveBindings, freeze, namespaceToStringTag) => {
|
|
10395
10444
|
const usedHelpers = new Set(additionalHelpers);
|
|
10396
10445
|
for (const variable of HELPER_NAMES) {
|
|
@@ -10403,14 +10452,14 @@ const getHelpersBlock = (additionalHelpers, accessedGlobals, indent, snippets, l
|
|
|
10403
10452
|
: '').join('');
|
|
10404
10453
|
};
|
|
10405
10454
|
const HELPER_GENERATORS = {
|
|
10406
|
-
[
|
|
10455
|
+
[INTEROP_DEFAULT_COMPAT_VARIABLE](_t, snippets, liveBindings) {
|
|
10407
10456
|
const { _, getDirectReturnFunction, n } = snippets;
|
|
10408
10457
|
const [left, right] = getDirectReturnFunction(['e'], {
|
|
10409
10458
|
functionReturn: true,
|
|
10410
10459
|
lineBreakIndent: null,
|
|
10411
|
-
name:
|
|
10460
|
+
name: INTEROP_DEFAULT_COMPAT_VARIABLE
|
|
10412
10461
|
});
|
|
10413
|
-
return (`${left}
|
|
10462
|
+
return (`${left}${getIsCompatNamespace(snippets)}${_}?${_}` +
|
|
10414
10463
|
`${liveBindings ? getDefaultLiveBinding(snippets) : getDefaultStatic(snippets)}${right}${n}${n}`);
|
|
10415
10464
|
},
|
|
10416
10465
|
[INTEROP_DEFAULT_VARIABLE](_t, snippets, liveBindings) {
|
|
@@ -10423,6 +10472,21 @@ const HELPER_GENERATORS = {
|
|
|
10423
10472
|
return (`${left}e${_}&&${_}e.__esModule${_}?${_}` +
|
|
10424
10473
|
`${liveBindings ? getDefaultLiveBinding(snippets) : getDefaultStatic(snippets)}${right}${n}${n}`);
|
|
10425
10474
|
},
|
|
10475
|
+
[INTEROP_NAMESPACE_COMPAT_VARIABLE](t, snippets, liveBindings, freeze, namespaceToStringTag, usedHelpers) {
|
|
10476
|
+
const { _, getDirectReturnFunction, n } = snippets;
|
|
10477
|
+
if (usedHelpers.has(INTEROP_NAMESPACE_DEFAULT_VARIABLE)) {
|
|
10478
|
+
const [left, right] = getDirectReturnFunction(['e'], {
|
|
10479
|
+
functionReturn: true,
|
|
10480
|
+
lineBreakIndent: null,
|
|
10481
|
+
name: INTEROP_NAMESPACE_COMPAT_VARIABLE
|
|
10482
|
+
});
|
|
10483
|
+
return `${left}${getIsCompatNamespace(snippets)}${_}?${_}e${_}:${_}${INTEROP_NAMESPACE_DEFAULT_VARIABLE}(e)${right}${n}${n}`;
|
|
10484
|
+
}
|
|
10485
|
+
return (`function ${INTEROP_NAMESPACE_COMPAT_VARIABLE}(e)${_}{${n}` +
|
|
10486
|
+
`${t}if${_}(${getIsCompatNamespace(snippets)})${_}return e;${n}` +
|
|
10487
|
+
createNamespaceObject(t, t, snippets, liveBindings, freeze, namespaceToStringTag) +
|
|
10488
|
+
`}${n}${n}`);
|
|
10489
|
+
},
|
|
10426
10490
|
[INTEROP_NAMESPACE_DEFAULT_ONLY_VARIABLE](_t, snippets, _liveBindings, freeze, namespaceToStringTag) {
|
|
10427
10491
|
const { getDirectReturnFunction, getObject, n } = snippets;
|
|
10428
10492
|
const [left, right] = getDirectReturnFunction(['e'], {
|
|
@@ -10475,6 +10539,7 @@ const HELPER_GENERATORS = {
|
|
|
10475
10539
|
};
|
|
10476
10540
|
const getDefaultLiveBinding = ({ _, getObject }) => `e${_}:${_}${getObject([['default', 'e']], { lineBreakIndent: null })}`;
|
|
10477
10541
|
const getDefaultStatic = ({ _, getPropertyAccess }) => `e${getPropertyAccess('default')}${_}:${_}e`;
|
|
10542
|
+
const getIsCompatNamespace = ({ _ }) => `e${_}&&${_}typeof e${_}===${_}'object'${_}&&${_}'default'${_}in e`;
|
|
10478
10543
|
const createNamespaceObject = (t, i, snippets, liveBindings, freeze, namespaceToStringTag) => {
|
|
10479
10544
|
const { _, cnst, getObject, getPropertyAccess, n, s } = snippets;
|
|
10480
10545
|
const copyProperty = `{${n}` +
|
|
@@ -10725,7 +10790,7 @@ class ImportExpression extends NodeBase {
|
|
|
10725
10790
|
}
|
|
10726
10791
|
function getInteropHelper(resolution, exportMode, interop) {
|
|
10727
10792
|
return exportMode === 'external'
|
|
10728
|
-
? namespaceInteropHelpersByInteropType[
|
|
10793
|
+
? namespaceInteropHelpersByInteropType[interop(resolution instanceof ExternalModule ? resolution.id : null)]
|
|
10729
10794
|
: exportMode === 'default'
|
|
10730
10795
|
? INTEROP_NAMESPACE_DEFAULT_ONLY_VARIABLE
|
|
10731
10796
|
: null;
|
|
@@ -12296,6 +12361,10 @@ class NamespaceVariable extends Variable {
|
|
|
12296
12361
|
this.references.push(identifier);
|
|
12297
12362
|
this.name = identifier.name;
|
|
12298
12363
|
}
|
|
12364
|
+
getLiteralValueAtPath() {
|
|
12365
|
+
// This can only happen for Symbol.toStringTag right now
|
|
12366
|
+
return 'Module';
|
|
12367
|
+
}
|
|
12299
12368
|
getMemberVariables() {
|
|
12300
12369
|
if (this.memberVariables) {
|
|
12301
12370
|
return this.memberVariables;
|
|
@@ -12311,6 +12380,9 @@ class NamespaceVariable extends Variable {
|
|
|
12311
12380
|
}
|
|
12312
12381
|
return (this.memberVariables = memberVariables);
|
|
12313
12382
|
}
|
|
12383
|
+
hasEffectsOnInteractionAtPath() {
|
|
12384
|
+
return false;
|
|
12385
|
+
}
|
|
12314
12386
|
include() {
|
|
12315
12387
|
this.included = true;
|
|
12316
12388
|
this.context.includeAllExports();
|
|
@@ -13484,7 +13556,7 @@ function getSingleDefaultExport(exports, dependencies, interop, externalLiveBind
|
|
|
13484
13556
|
function getReexportedImportName(moduleVariableName, imported, depNamedExportsMode, isChunk, defaultVariableName, namespaceVariableName, interop, moduleId, externalLiveBindings, getPropertyAccess) {
|
|
13485
13557
|
if (imported === 'default') {
|
|
13486
13558
|
if (!isChunk) {
|
|
13487
|
-
const moduleInterop =
|
|
13559
|
+
const moduleInterop = interop(moduleId);
|
|
13488
13560
|
const variableName = defaultInteropHelpersByInteropType[moduleInterop]
|
|
13489
13561
|
? defaultVariableName
|
|
13490
13562
|
: moduleVariableName;
|
|
@@ -13497,9 +13569,7 @@ function getReexportedImportName(moduleVariableName, imported, depNamedExportsMo
|
|
|
13497
13569
|
: moduleVariableName;
|
|
13498
13570
|
}
|
|
13499
13571
|
if (imported === '*') {
|
|
13500
|
-
return (isChunk
|
|
13501
|
-
? !depNamedExportsMode
|
|
13502
|
-
: namespaceInteropHelpersByInteropType[String(interop(moduleId))])
|
|
13572
|
+
return (isChunk ? !depNamedExportsMode : namespaceInteropHelpersByInteropType[interop(moduleId)])
|
|
13503
13573
|
? namespaceVariableName
|
|
13504
13574
|
: moduleVariableName;
|
|
13505
13575
|
}
|
|
@@ -13566,7 +13636,7 @@ function getInteropBlock(dependencies, interop, externalLiveBindings, freeze, na
|
|
|
13566
13636
|
}
|
|
13567
13637
|
}
|
|
13568
13638
|
else {
|
|
13569
|
-
const moduleInterop =
|
|
13639
|
+
const moduleInterop = interop(importPath);
|
|
13570
13640
|
let hasDefault = false;
|
|
13571
13641
|
let hasNamespace = false;
|
|
13572
13642
|
for (const { imported, reexported } of [
|
|
@@ -13600,11 +13670,18 @@ function getInteropBlock(dependencies, interop, externalLiveBindings, freeze, na
|
|
|
13600
13670
|
return `${getHelpersBlock(neededInteropHelpers, accessedGlobals, indent, snippets, externalLiveBindings, freeze, namespaceToStringTag)}${interopStatements.length > 0 ? `${interopStatements.join(n)}${n}${n}` : ''}`;
|
|
13601
13671
|
}
|
|
13602
13672
|
|
|
13673
|
+
function addJsExtension(name) {
|
|
13674
|
+
return name.endsWith('.js') ? name : name + '.js';
|
|
13675
|
+
}
|
|
13676
|
+
|
|
13603
13677
|
// AMD resolution will only respect the AMD baseUrl if the .js extension is omitted.
|
|
13604
13678
|
// The assumption is that this makes sense for all relative ids:
|
|
13605
13679
|
// https://requirejs.org/docs/api.html#jsfiles
|
|
13606
|
-
function
|
|
13607
|
-
|
|
13680
|
+
function updateExtensionForRelativeAmdId(id, forceJsExtensionForImports) {
|
|
13681
|
+
if (id[0] !== '.') {
|
|
13682
|
+
return id;
|
|
13683
|
+
}
|
|
13684
|
+
return forceJsExtensionForImports ? addJsExtension(id) : removeJsExtension(id);
|
|
13608
13685
|
}
|
|
13609
13686
|
|
|
13610
13687
|
const builtins = {
|
|
@@ -13639,9 +13716,9 @@ function warnOnBuiltins(warn, dependencies) {
|
|
|
13639
13716
|
warn(errMissingNodeBuiltins(externalBuiltins));
|
|
13640
13717
|
}
|
|
13641
13718
|
|
|
13642
|
-
function amd(magicString, { accessedGlobals, dependencies, exports, hasExports, id, indent: t, intro, isEntryFacade, isModuleFacade, namedExportsMode, outro, snippets, onwarn }, { amd, esModule, externalLiveBindings, freeze, interop, namespaceToStringTag, strict }) {
|
|
13719
|
+
function amd(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, id, indent: t, intro, isEntryFacade, isModuleFacade, namedExportsMode, outro, snippets, onwarn }, { amd, esModule, externalLiveBindings, freeze, interop, namespaceToStringTag, strict }) {
|
|
13643
13720
|
warnOnBuiltins(onwarn, dependencies);
|
|
13644
|
-
const deps = dependencies.map(m => `'${
|
|
13721
|
+
const deps = dependencies.map(m => `'${updateExtensionForRelativeAmdId(m.importPath, amd.forceJsExtensionForImports)}'`);
|
|
13645
13722
|
const args = dependencies.map(m => m.name);
|
|
13646
13723
|
const { n, getNonArrowFunctionIntro, _ } = snippets;
|
|
13647
13724
|
if (namedExportsMode && hasExports) {
|
|
@@ -13662,7 +13739,7 @@ function amd(magicString, { accessedGlobals, dependencies, exports, hasExports,
|
|
|
13662
13739
|
const useStrict = strict ? `${_}'use strict';` : '';
|
|
13663
13740
|
magicString.prepend(`${intro}${getInteropBlock(dependencies, interop, externalLiveBindings, freeze, namespaceToStringTag, accessedGlobals, t, snippets)}`);
|
|
13664
13741
|
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings);
|
|
13665
|
-
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, isEntryFacade && esModule, isModuleFacade && namespaceToStringTag, snippets);
|
|
13742
|
+
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, isEntryFacade && (esModule === true || (esModule === 'if-default-prop' && hasDefaultExport)), isModuleFacade && namespaceToStringTag, snippets);
|
|
13666
13743
|
if (namespaceMarkers) {
|
|
13667
13744
|
namespaceMarkers = n + n + namespaceMarkers;
|
|
13668
13745
|
}
|
|
@@ -13678,10 +13755,10 @@ function amd(magicString, { accessedGlobals, dependencies, exports, hasExports,
|
|
|
13678
13755
|
.append(`${n}${n}}));`);
|
|
13679
13756
|
}
|
|
13680
13757
|
|
|
13681
|
-
function cjs(magicString, { accessedGlobals, dependencies, exports, hasExports, indent: t, intro, isEntryFacade, isModuleFacade, namedExportsMode, outro, snippets }, { compact, esModule, externalLiveBindings, freeze, interop, namespaceToStringTag, strict }) {
|
|
13758
|
+
function cjs(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, indent: t, intro, isEntryFacade, isModuleFacade, namedExportsMode, outro, snippets }, { compact, esModule, externalLiveBindings, freeze, interop, namespaceToStringTag, strict }) {
|
|
13682
13759
|
const { _, n } = snippets;
|
|
13683
13760
|
const useStrict = strict ? `'use strict';${n}${n}` : '';
|
|
13684
|
-
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, isEntryFacade && esModule, isModuleFacade && namespaceToStringTag, snippets);
|
|
13761
|
+
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, isEntryFacade && (esModule === true || (esModule === 'if-default-prop' && hasDefaultExport)), isModuleFacade && namespaceToStringTag, snippets);
|
|
13685
13762
|
if (namespaceMarkers) {
|
|
13686
13763
|
namespaceMarkers += n + n;
|
|
13687
13764
|
}
|
|
@@ -13873,7 +13950,7 @@ function trimEmptyImports(dependencies) {
|
|
|
13873
13950
|
return [];
|
|
13874
13951
|
}
|
|
13875
13952
|
|
|
13876
|
-
function iife(magicString, { accessedGlobals, dependencies, exports, hasExports, indent: t, intro, namedExportsMode, outro, snippets, onwarn }, { compact, esModule, extend, freeze, externalLiveBindings, globals, interop, name, namespaceToStringTag, strict }) {
|
|
13953
|
+
function iife(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, indent: t, intro, namedExportsMode, outro, snippets, onwarn }, { compact, esModule, extend, freeze, externalLiveBindings, globals, interop, name, namespaceToStringTag, strict }) {
|
|
13877
13954
|
const { _, getNonArrowFunctionIntro, getPropertyAccess, n } = snippets;
|
|
13878
13955
|
const isNamespaced = name && name.includes('.');
|
|
13879
13956
|
const useVariableAssignment = !extend && !isNamespaced;
|
|
@@ -13919,7 +13996,7 @@ function iife(magicString, { accessedGlobals, dependencies, exports, hasExports,
|
|
|
13919
13996
|
wrapperOutro = `${n}${n}${t}return exports;${wrapperOutro}`;
|
|
13920
13997
|
}
|
|
13921
13998
|
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings);
|
|
13922
|
-
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule, namespaceToStringTag, snippets);
|
|
13999
|
+
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule === true || (esModule === 'if-default-prop' && hasDefaultExport), namespaceToStringTag, snippets);
|
|
13923
14000
|
if (namespaceMarkers) {
|
|
13924
14001
|
namespaceMarkers = n + n + namespaceMarkers;
|
|
13925
14002
|
}
|
|
@@ -14074,7 +14151,7 @@ function safeAccess(name, globalVar, { _, getPropertyAccess }) {
|
|
|
14074
14151
|
.map(part => (propertyPath += getPropertyAccess(part)))
|
|
14075
14152
|
.join(`${_}&&${_}`);
|
|
14076
14153
|
}
|
|
14077
|
-
function umd(magicString, { accessedGlobals, dependencies, exports, hasExports, id, indent: t, intro, namedExportsMode, outro, snippets, onwarn }, { amd, compact, esModule, extend, externalLiveBindings, freeze, interop, name, namespaceToStringTag, globals, noConflict, strict }) {
|
|
14154
|
+
function umd(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, id, indent: t, intro, namedExportsMode, outro, snippets, onwarn }, { amd, compact, esModule, extend, externalLiveBindings, freeze, interop, name, namespaceToStringTag, globals, noConflict, strict }) {
|
|
14078
14155
|
const { _, cnst, getFunctionIntro, getNonArrowFunctionIntro, getPropertyAccess, n, s } = snippets;
|
|
14079
14156
|
const factoryVar = compact ? 'f' : 'factory';
|
|
14080
14157
|
const globalVar = compact ? 'g' : 'global';
|
|
@@ -14082,7 +14159,7 @@ function umd(magicString, { accessedGlobals, dependencies, exports, hasExports,
|
|
|
14082
14159
|
return error(errMissingNameOptionForUmdExport());
|
|
14083
14160
|
}
|
|
14084
14161
|
warnOnBuiltins(onwarn, dependencies);
|
|
14085
|
-
const amdDeps = dependencies.map(m => `'${
|
|
14162
|
+
const amdDeps = dependencies.map(m => `'${updateExtensionForRelativeAmdId(m.importPath, amd.forceJsExtensionForImports)}'`);
|
|
14086
14163
|
const cjsDeps = dependencies.map(m => `require('${m.importPath}')`);
|
|
14087
14164
|
const trimmedImports = trimEmptyImports(dependencies);
|
|
14088
14165
|
const globalDeps = trimmedImports.map(module => globalProp(module.globalName, globalVar, getPropertyAccess));
|
|
@@ -14156,7 +14233,7 @@ function umd(magicString, { accessedGlobals, dependencies, exports, hasExports,
|
|
|
14156
14233
|
const wrapperOutro = n + n + '}));';
|
|
14157
14234
|
magicString.prepend(`${intro}${getInteropBlock(dependencies, interop, externalLiveBindings, freeze, namespaceToStringTag, accessedGlobals, t, snippets)}`);
|
|
14158
14235
|
const exportBlock = getExportBlock$1(exports, dependencies, namedExportsMode, interop, snippets, t, externalLiveBindings);
|
|
14159
|
-
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule, namespaceToStringTag, snippets);
|
|
14236
|
+
let namespaceMarkers = getNamespaceMarkers(namedExportsMode && hasExports, esModule === true || (esModule === 'if-default-prop' && hasDefaultExport), namespaceToStringTag, snippets);
|
|
14160
14237
|
if (namespaceMarkers) {
|
|
14161
14238
|
namespaceMarkers = n + n + namespaceMarkers;
|
|
14162
14239
|
}
|
|
@@ -14539,7 +14616,7 @@ function deconflictImportsOther(usedNames, imports, { deconflictedDefault, decon
|
|
|
14539
14616
|
}
|
|
14540
14617
|
for (const externalModule of deconflictedDefault) {
|
|
14541
14618
|
if (deconflictedNamespace.has(externalModule) &&
|
|
14542
|
-
canDefaultBeTakenFromNamespace(
|
|
14619
|
+
canDefaultBeTakenFromNamespace(interop(externalModule.id), externalLiveBindings)) {
|
|
14543
14620
|
externalModule.defaultVariableName = externalModule.namespaceVariableName;
|
|
14544
14621
|
}
|
|
14545
14622
|
else {
|
|
@@ -14552,7 +14629,7 @@ function deconflictImportsOther(usedNames, imports, { deconflictedDefault, decon
|
|
|
14552
14629
|
const chunk = externalChunkByModule.get(module);
|
|
14553
14630
|
const name = variable.name;
|
|
14554
14631
|
if (name === 'default') {
|
|
14555
|
-
const moduleInterop =
|
|
14632
|
+
const moduleInterop = interop(module.id);
|
|
14556
14633
|
const variableName = defaultInteropHelpersByInteropType[moduleInterop]
|
|
14557
14634
|
? chunk.defaultVariableName
|
|
14558
14635
|
: chunk.variableName;
|
|
@@ -14564,7 +14641,7 @@ function deconflictImportsOther(usedNames, imports, { deconflictedDefault, decon
|
|
|
14564
14641
|
}
|
|
14565
14642
|
}
|
|
14566
14643
|
else if (name === '*') {
|
|
14567
|
-
variable.setRenderNames(null, namespaceInteropHelpersByInteropType[
|
|
14644
|
+
variable.setRenderNames(null, namespaceInteropHelpersByInteropType[interop(module.id)]
|
|
14568
14645
|
? chunk.namespaceVariableName
|
|
14569
14646
|
: chunk.variableName);
|
|
14570
14647
|
}
|
|
@@ -14634,7 +14711,7 @@ function assignExportsToNames(exports, exportsByName, exportNamesByVariable) {
|
|
|
14634
14711
|
}
|
|
14635
14712
|
}
|
|
14636
14713
|
|
|
14637
|
-
function getExportMode(chunk, { exports: exportMode, name, format },
|
|
14714
|
+
function getExportMode(chunk, { exports: exportMode, name, format }, facadeModuleId, warn) {
|
|
14638
14715
|
const exportKeys = chunk.getExportNames();
|
|
14639
14716
|
if (exportMode === 'default') {
|
|
14640
14717
|
if (exportKeys.length !== 1 || exportKeys[0] !== 'default') {
|
|
@@ -14649,9 +14726,6 @@ function getExportMode(chunk, { exports: exportMode, name, format }, unsetOption
|
|
|
14649
14726
|
exportMode = 'none';
|
|
14650
14727
|
}
|
|
14651
14728
|
else if (exportKeys.length === 1 && exportKeys[0] === 'default') {
|
|
14652
|
-
if (format === 'cjs' && unsetOptions.has('exports')) {
|
|
14653
|
-
warn(errPreferNamedExports(facadeModuleId));
|
|
14654
|
-
}
|
|
14655
14729
|
exportMode = 'default';
|
|
14656
14730
|
}
|
|
14657
14731
|
else {
|
|
@@ -14876,7 +14950,7 @@ class Chunk {
|
|
|
14876
14950
|
assignExportsToNames(remainingExports, this.exportsByName, this.exportNamesByVariable);
|
|
14877
14951
|
}
|
|
14878
14952
|
if (this.outputOptions.preserveModules || (this.facadeModule && this.facadeModule.info.isEntry))
|
|
14879
|
-
this.exportMode = getExportMode(this, this.outputOptions, this.
|
|
14953
|
+
this.exportMode = getExportMode(this, this.outputOptions, this.facadeModule.id, this.inputOptions.onwarn);
|
|
14880
14954
|
}
|
|
14881
14955
|
generateFacades() {
|
|
14882
14956
|
var _a;
|
|
@@ -14977,7 +15051,7 @@ class Chunk {
|
|
|
14977
15051
|
return ((_a = this.preliminaryFileName) === null || _a === void 0 ? void 0 : _a.fileName) || this.getPreliminaryFileName().fileName;
|
|
14978
15052
|
}
|
|
14979
15053
|
getImportPath(importer) {
|
|
14980
|
-
return escapeId(getImportPath(importer, this.getFileName(), this.outputOptions.format === 'amd', true));
|
|
15054
|
+
return escapeId(getImportPath(importer, this.getFileName(), this.outputOptions.format === 'amd' && !this.outputOptions.amd.forceJsExtensionForImports, true));
|
|
14981
15055
|
}
|
|
14982
15056
|
getPreliminaryFileName() {
|
|
14983
15057
|
var _a;
|
|
@@ -15056,13 +15130,31 @@ class Chunk {
|
|
|
15056
15130
|
const { accessedGlobals, indent, magicString, renderedSource, usedModules, usesTopLevelAwait } = this.renderModules(preliminaryFileName.fileName);
|
|
15057
15131
|
const renderedDependencies = [...this.getRenderedDependencies().values()];
|
|
15058
15132
|
const renderedExports = exportMode === 'none' ? [] : this.getChunkExportDeclarations(format);
|
|
15059
|
-
|
|
15060
|
-
|
|
15133
|
+
let hasExports = renderedExports.length !== 0;
|
|
15134
|
+
let hasDefaultExport = false;
|
|
15135
|
+
for (const { reexports } of renderedDependencies) {
|
|
15136
|
+
if (reexports === null || reexports === void 0 ? void 0 : reexports.length) {
|
|
15137
|
+
hasExports = true;
|
|
15138
|
+
if (reexports.some(reexport => reexport.reexported === 'default')) {
|
|
15139
|
+
hasDefaultExport = true;
|
|
15140
|
+
break;
|
|
15141
|
+
}
|
|
15142
|
+
}
|
|
15143
|
+
}
|
|
15144
|
+
if (!hasDefaultExport) {
|
|
15145
|
+
for (const { exported } of renderedExports) {
|
|
15146
|
+
if (exported === 'default') {
|
|
15147
|
+
hasDefaultExport = true;
|
|
15148
|
+
break;
|
|
15149
|
+
}
|
|
15150
|
+
}
|
|
15151
|
+
}
|
|
15061
15152
|
const { intro, outro, banner, footer } = await createAddons(outputOptions, pluginDriver, this.getRenderedChunkInfo());
|
|
15062
15153
|
finalisers[format](renderedSource, {
|
|
15063
15154
|
accessedGlobals,
|
|
15064
15155
|
dependencies: renderedDependencies,
|
|
15065
15156
|
exports: renderedExports,
|
|
15157
|
+
hasDefaultExport,
|
|
15066
15158
|
hasExports,
|
|
15067
15159
|
id: preliminaryFileName.fileName,
|
|
15068
15160
|
indent,
|
|
@@ -15223,12 +15315,12 @@ class Chunk {
|
|
|
15223
15315
|
dependencies.add(chunk);
|
|
15224
15316
|
if (addNonNamespacesAndInteropHelpers) {
|
|
15225
15317
|
if (variable.name === 'default') {
|
|
15226
|
-
if (defaultInteropHelpersByInteropType[
|
|
15318
|
+
if (defaultInteropHelpersByInteropType[interop(module.id)]) {
|
|
15227
15319
|
deconflictedDefault.add(chunk);
|
|
15228
15320
|
}
|
|
15229
15321
|
}
|
|
15230
15322
|
else if (variable.name === '*') {
|
|
15231
|
-
if (namespaceInteropHelpersByInteropType[
|
|
15323
|
+
if (namespaceInteropHelpersByInteropType[interop(module.id)]) {
|
|
15232
15324
|
deconflictedNamespace.add(chunk);
|
|
15233
15325
|
}
|
|
15234
15326
|
}
|
|
@@ -15402,7 +15494,7 @@ class Chunk {
|
|
|
15402
15494
|
}
|
|
15403
15495
|
needsLiveBinding =
|
|
15404
15496
|
externalLiveBindings &&
|
|
15405
|
-
(imported !== 'default' || isDefaultAProperty(
|
|
15497
|
+
(imported !== 'default' || isDefaultAProperty(interop(module.id), true));
|
|
15406
15498
|
}
|
|
15407
15499
|
}
|
|
15408
15500
|
getOrCreate(reexportSpecifiers, dependency, () => []).push({
|
|
@@ -16825,10 +16917,10 @@ function getLineInfo(input, offset) {
|
|
|
16825
16917
|
var defaultOptions = {
|
|
16826
16918
|
// `ecmaVersion` indicates the ECMAScript version to parse. Must be
|
|
16827
16919
|
// either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10
|
|
16828
|
-
// (2019), 11 (2020), 12 (2021), 13 (2022), or `"latest"`
|
|
16829
|
-
// latest version the library supports). This influences
|
|
16830
|
-
// for strict mode, the set of reserved words, and support
|
|
16831
|
-
// new syntax features.
|
|
16920
|
+
// (2019), 11 (2020), 12 (2021), 13 (2022), 14 (2023), or `"latest"`
|
|
16921
|
+
// (the latest version the library supports). This influences
|
|
16922
|
+
// support for strict mode, the set of reserved words, and support
|
|
16923
|
+
// for new syntax features.
|
|
16832
16924
|
ecmaVersion: null,
|
|
16833
16925
|
// `sourceType` indicates the mode the code should be parsed in.
|
|
16834
16926
|
// Can be either `"script"` or `"module"`. This influences global
|
|
@@ -16862,8 +16954,9 @@ var defaultOptions = {
|
|
|
16862
16954
|
// When enabled, super identifiers are not constrained to
|
|
16863
16955
|
// appearing in methods and do not raise an error when they appear elsewhere.
|
|
16864
16956
|
allowSuperOutsideMethod: null,
|
|
16865
|
-
// When enabled, hashbang directive in the beginning of file
|
|
16866
|
-
//
|
|
16957
|
+
// When enabled, hashbang directive in the beginning of file is
|
|
16958
|
+
// allowed and treated as a line comment. Enabled by default when
|
|
16959
|
+
// `ecmaVersion` >= 2023.
|
|
16867
16960
|
allowHashBang: false,
|
|
16868
16961
|
// When `locations` is on, `loc` properties holding objects with
|
|
16869
16962
|
// `start` and `end` properties in `{line, column}` form (with
|
|
@@ -16938,6 +17031,9 @@ function getOptions(opts) {
|
|
|
16938
17031
|
if (options.allowReserved == null)
|
|
16939
17032
|
{ options.allowReserved = options.ecmaVersion < 5; }
|
|
16940
17033
|
|
|
17034
|
+
if (opts.allowHashBang == null)
|
|
17035
|
+
{ options.allowHashBang = options.ecmaVersion >= 14; }
|
|
17036
|
+
|
|
16941
17037
|
if (isArray(options.onToken)) {
|
|
16942
17038
|
var tokens = options.onToken;
|
|
16943
17039
|
options.onToken = function (token) { return tokens.push(token); };
|
|
@@ -17268,7 +17364,7 @@ pp$9.checkPatternErrors = function(refDestructuringErrors, isAssign) {
|
|
|
17268
17364
|
if (refDestructuringErrors.trailingComma > -1)
|
|
17269
17365
|
{ this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element"); }
|
|
17270
17366
|
var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind;
|
|
17271
|
-
if (parens > -1) { this.raiseRecoverable(parens, "Parenthesized pattern"); }
|
|
17367
|
+
if (parens > -1) { this.raiseRecoverable(parens, isAssign ? "Assigning to rvalue" : "Parenthesized pattern"); }
|
|
17272
17368
|
};
|
|
17273
17369
|
|
|
17274
17370
|
pp$9.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
|
|
@@ -18364,6 +18460,7 @@ pp$8.adaptDirectivePrologue = function(statements) {
|
|
|
18364
18460
|
};
|
|
18365
18461
|
pp$8.isDirectiveCandidate = function(statement) {
|
|
18366
18462
|
return (
|
|
18463
|
+
this.options.ecmaVersion >= 5 &&
|
|
18367
18464
|
statement.type === "ExpressionStatement" &&
|
|
18368
18465
|
statement.expression.type === "Literal" &&
|
|
18369
18466
|
typeof statement.expression.value === "string" &&
|
|
@@ -18774,7 +18871,8 @@ pp$6.updateContext = function(prevType) {
|
|
|
18774
18871
|
{ this.exprAllowed = type.beforeExpr; }
|
|
18775
18872
|
};
|
|
18776
18873
|
|
|
18777
|
-
// Used to handle egde
|
|
18874
|
+
// Used to handle egde cases when token context could not be inferred correctly during tokenization phase
|
|
18875
|
+
|
|
18778
18876
|
pp$6.overrideContext = function(tokenCtx) {
|
|
18779
18877
|
if (this.curContext() !== tokenCtx) {
|
|
18780
18878
|
this.context[this.context.length - 1] = tokenCtx;
|
|
@@ -19590,15 +19688,6 @@ pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
19590
19688
|
}
|
|
19591
19689
|
return this.finishNode(prop, "RestElement")
|
|
19592
19690
|
}
|
|
19593
|
-
// To disallow parenthesized identifier via `this.toAssignable()`.
|
|
19594
|
-
if (this.type === types$1.parenL && refDestructuringErrors) {
|
|
19595
|
-
if (refDestructuringErrors.parenthesizedAssign < 0) {
|
|
19596
|
-
refDestructuringErrors.parenthesizedAssign = this.start;
|
|
19597
|
-
}
|
|
19598
|
-
if (refDestructuringErrors.parenthesizedBind < 0) {
|
|
19599
|
-
refDestructuringErrors.parenthesizedBind = this.start;
|
|
19600
|
-
}
|
|
19601
|
-
}
|
|
19602
19691
|
// Parse argument.
|
|
19603
19692
|
prop.argument = this.parseMaybeAssign(false, refDestructuringErrors);
|
|
19604
19693
|
// To disallow trailing comma via `this.toAssignable()`.
|
|
@@ -22028,7 +22117,7 @@ pp.readWord = function() {
|
|
|
22028
22117
|
|
|
22029
22118
|
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
|
|
22030
22119
|
|
|
22031
|
-
var version = "8.
|
|
22120
|
+
var version = "8.8.0";
|
|
22032
22121
|
|
|
22033
22122
|
Parser.acorn = {
|
|
22034
22123
|
Parser: Parser,
|
|
@@ -23159,8 +23248,8 @@ class Graph {
|
|
|
23159
23248
|
this.watchMode = true;
|
|
23160
23249
|
const handleChange = (...args) => this.pluginDriver.hookParallel('watchChange', args);
|
|
23161
23250
|
const handleClose = () => this.pluginDriver.hookParallel('closeWatcher', []);
|
|
23162
|
-
watcher.
|
|
23163
|
-
watcher.
|
|
23251
|
+
watcher.onCurrentRun('change', handleChange);
|
|
23252
|
+
watcher.onCurrentRun('close', handleClose);
|
|
23164
23253
|
}
|
|
23165
23254
|
this.pluginDriver = new PluginDriver(this, options, options.plugins, this.pluginCache);
|
|
23166
23255
|
this.acornParser = Parser.extend(...options.acornInjectPlugins);
|
|
@@ -23561,7 +23650,7 @@ function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
23561
23650
|
dir: getDir(config, file),
|
|
23562
23651
|
dynamicImportFunction: getDynamicImportFunction(config, inputOptions, format),
|
|
23563
23652
|
entryFileNames: getEntryFileNames(config, unsetOptions),
|
|
23564
|
-
esModule: (_c = config.esModule) !== null && _c !== void 0 ? _c :
|
|
23653
|
+
esModule: (_c = config.esModule) !== null && _c !== void 0 ? _c : 'if-default-prop',
|
|
23565
23654
|
exports: getExports(config, unsetOptions),
|
|
23566
23655
|
extend: config.extend || false,
|
|
23567
23656
|
externalLiveBindings: (_d = config.externalLiveBindings) !== null && _d !== void 0 ? _d : true,
|
|
@@ -23574,7 +23663,7 @@ function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
23574
23663
|
hoistTransitiveImports: (_f = config.hoistTransitiveImports) !== null && _f !== void 0 ? _f : true,
|
|
23575
23664
|
indent: getIndent(config, compact),
|
|
23576
23665
|
inlineDynamicImports,
|
|
23577
|
-
interop: getInterop(config
|
|
23666
|
+
interop: getInterop(config),
|
|
23578
23667
|
intro: getAddon(config, 'intro'),
|
|
23579
23668
|
manualChunks: getManualChunks(config, inlineDynamicImports, preserveModules, inputOptions),
|
|
23580
23669
|
minifyInternalExports: getMinifyInternalExports(config, format, compact),
|
|
@@ -23681,6 +23770,7 @@ const getAmd = (config) => {
|
|
|
23681
23770
|
autoId: false,
|
|
23682
23771
|
basePath: '',
|
|
23683
23772
|
define: 'define',
|
|
23773
|
+
forceJsExtensionForImports: false,
|
|
23684
23774
|
...config.amd
|
|
23685
23775
|
};
|
|
23686
23776
|
if ((mergedOption.autoId || mergedOption.basePath) && mergedOption.id) {
|
|
@@ -23694,13 +23784,15 @@ const getAmd = (config) => {
|
|
|
23694
23784
|
normalized = {
|
|
23695
23785
|
autoId: true,
|
|
23696
23786
|
basePath: mergedOption.basePath,
|
|
23697
|
-
define: mergedOption.define
|
|
23787
|
+
define: mergedOption.define,
|
|
23788
|
+
forceJsExtensionForImports: mergedOption.forceJsExtensionForImports
|
|
23698
23789
|
};
|
|
23699
23790
|
}
|
|
23700
23791
|
else {
|
|
23701
23792
|
normalized = {
|
|
23702
23793
|
autoId: false,
|
|
23703
23794
|
define: mergedOption.define,
|
|
23795
|
+
forceJsExtensionForImports: mergedOption.forceJsExtensionForImports,
|
|
23704
23796
|
id: mergedOption.id
|
|
23705
23797
|
};
|
|
23706
23798
|
}
|
|
@@ -23765,28 +23857,17 @@ const getIndent = (config, compact) => {
|
|
|
23765
23857
|
return configIndent === false ? '' : configIndent !== null && configIndent !== void 0 ? configIndent : true;
|
|
23766
23858
|
};
|
|
23767
23859
|
const ALLOWED_INTEROP_TYPES = new Set([
|
|
23860
|
+
'compat',
|
|
23768
23861
|
'auto',
|
|
23769
23862
|
'esModule',
|
|
23770
23863
|
'default',
|
|
23771
|
-
'defaultOnly'
|
|
23772
|
-
true,
|
|
23773
|
-
false
|
|
23864
|
+
'defaultOnly'
|
|
23774
23865
|
]);
|
|
23775
|
-
const getInterop = (config
|
|
23866
|
+
const getInterop = (config) => {
|
|
23776
23867
|
const configInterop = config.interop;
|
|
23777
|
-
const validatedInteropTypes = new Set();
|
|
23778
23868
|
const validateInterop = (interop) => {
|
|
23779
|
-
if (!
|
|
23780
|
-
|
|
23781
|
-
if (!ALLOWED_INTEROP_TYPES.has(interop)) {
|
|
23782
|
-
return error(errInvalidOption('output.interop', 'outputinterop', `use one of ${Array.from(ALLOWED_INTEROP_TYPES, value => JSON.stringify(value)).join(', ')}`, interop));
|
|
23783
|
-
}
|
|
23784
|
-
if (typeof interop === 'boolean') {
|
|
23785
|
-
warnDeprecation({
|
|
23786
|
-
message: `The boolean value "${interop}" for the "output.interop" option is deprecated. Use ${interop ? '"auto"' : '"esModule", "default" or "defaultOnly"'} instead.`,
|
|
23787
|
-
url: 'https://rollupjs.org/guide/en/#outputinterop'
|
|
23788
|
-
}, true, inputOptions);
|
|
23789
|
-
}
|
|
23869
|
+
if (!ALLOWED_INTEROP_TYPES.has(interop)) {
|
|
23870
|
+
return error(errInvalidOption('output.interop', 'outputinterop', `use one of ${Array.from(ALLOWED_INTEROP_TYPES, value => JSON.stringify(value)).join(', ')}`, interop));
|
|
23790
23871
|
}
|
|
23791
23872
|
return interop;
|
|
23792
23873
|
};
|
|
@@ -23799,7 +23880,7 @@ const getInterop = (config, inputOptions) => {
|
|
|
23799
23880
|
? interopPerId[id]
|
|
23800
23881
|
: validateInterop((interopPerId[id] = configInterop(id)));
|
|
23801
23882
|
}
|
|
23802
|
-
return configInterop === undefined ? () =>
|
|
23883
|
+
return configInterop === undefined ? () => 'default' : () => validateInterop(configInterop);
|
|
23803
23884
|
};
|
|
23804
23885
|
const getManualChunks = (config, inlineDynamicImports, preserveModules, inputOptions) => {
|
|
23805
23886
|
const configManualChunks = config.manualChunks || inputOptions.manualChunks;
|
|
@@ -23990,30 +24071,58 @@ function defineConfig(options) {
|
|
|
23990
24071
|
return options;
|
|
23991
24072
|
}
|
|
23992
24073
|
|
|
23993
|
-
class WatchEmitter
|
|
24074
|
+
class WatchEmitter {
|
|
23994
24075
|
constructor() {
|
|
23995
|
-
|
|
23996
|
-
this.
|
|
23997
|
-
// Allows more than 10 bundles to be watched without
|
|
23998
|
-
// showing the `MaxListenersExceededWarning` to the user.
|
|
23999
|
-
this.setMaxListeners(Infinity);
|
|
24076
|
+
this.currentHandlers = Object.create(null);
|
|
24077
|
+
this.persistentHandlers = Object.create(null);
|
|
24000
24078
|
}
|
|
24001
24079
|
// Will be overwritten by Rollup
|
|
24002
24080
|
async close() { }
|
|
24003
|
-
|
|
24004
|
-
this.
|
|
24005
|
-
|
|
24081
|
+
emit(event, ...args) {
|
|
24082
|
+
return Promise.all(this.getCurrentHandlers(event)
|
|
24083
|
+
.concat(this.getPersistentHandlers(event))
|
|
24084
|
+
.map(handler => handler(...args)));
|
|
24085
|
+
}
|
|
24086
|
+
off(event, listener) {
|
|
24087
|
+
const listeners = this.persistentHandlers[event];
|
|
24088
|
+
if (listeners) {
|
|
24089
|
+
// A hack stolen from "mitt": ">>> 0" does not change numbers >= 0, but -1
|
|
24090
|
+
// (which would remove the last array element if used unchanged) is turned
|
|
24091
|
+
// into max_int, which is outside the array and does not change anything.
|
|
24092
|
+
listeners.splice(listeners.indexOf(listener) >>> 0, 1);
|
|
24093
|
+
}
|
|
24094
|
+
return this;
|
|
24095
|
+
}
|
|
24096
|
+
on(event, listener) {
|
|
24097
|
+
this.getPersistentHandlers(event).push(listener);
|
|
24098
|
+
return this;
|
|
24099
|
+
}
|
|
24100
|
+
onCurrentRun(event, listener) {
|
|
24101
|
+
this.getCurrentHandlers(event).push(listener);
|
|
24102
|
+
return this;
|
|
24006
24103
|
}
|
|
24007
|
-
|
|
24008
|
-
|
|
24104
|
+
once(event, listener) {
|
|
24105
|
+
const selfRemovingListener = (...args) => {
|
|
24106
|
+
this.off(event, selfRemovingListener);
|
|
24107
|
+
return listener(...args);
|
|
24108
|
+
};
|
|
24109
|
+
this.on(event, selfRemovingListener);
|
|
24009
24110
|
return this;
|
|
24010
24111
|
}
|
|
24011
|
-
|
|
24012
|
-
this.
|
|
24112
|
+
removeAllListeners() {
|
|
24113
|
+
this.removeListenersForCurrentRun();
|
|
24114
|
+
this.persistentHandlers = Object.create(null);
|
|
24013
24115
|
return this;
|
|
24014
24116
|
}
|
|
24015
|
-
|
|
24016
|
-
|
|
24117
|
+
removeListenersForCurrentRun() {
|
|
24118
|
+
this.currentHandlers = Object.create(null);
|
|
24119
|
+
return this;
|
|
24120
|
+
}
|
|
24121
|
+
getCurrentHandlers(event) {
|
|
24122
|
+
return this.currentHandlers[event] || (this.currentHandlers[event] = []);
|
|
24123
|
+
}
|
|
24124
|
+
getPersistentHandlers(event) {
|
|
24125
|
+
return this.persistentHandlers[event] || (this.persistentHandlers[event] = []);
|
|
24017
24126
|
}
|
|
24018
24127
|
}
|
|
24019
24128
|
|
|
@@ -24035,12 +24144,14 @@ exports.createFilter = createFilter;
|
|
|
24035
24144
|
exports.defaultOnWarn = defaultOnWarn;
|
|
24036
24145
|
exports.defineConfig = defineConfig;
|
|
24037
24146
|
exports.ensureArray = ensureArray$1;
|
|
24147
|
+
exports.errCannotBundleConfigAsEsm = errCannotBundleConfigAsEsm;
|
|
24148
|
+
exports.errCannotLoadConfigAsCjs = errCannotLoadConfigAsCjs;
|
|
24149
|
+
exports.errCannotLoadConfigAsEsm = errCannotLoadConfigAsEsm;
|
|
24038
24150
|
exports.errDuplicateImportOptions = errDuplicateImportOptions;
|
|
24039
24151
|
exports.errFailAfterWarnings = errFailAfterWarnings;
|
|
24040
24152
|
exports.errMissingConfig = errMissingConfig;
|
|
24041
24153
|
exports.errMissingExternalConfig = errMissingExternalConfig;
|
|
24042
24154
|
exports.errOnlyInlineSourcemapsForStdout = errOnlyInlineSourcemapsForStdout;
|
|
24043
|
-
exports.errTranspiledEsmConfig = errTranspiledEsmConfig;
|
|
24044
24155
|
exports.error = error;
|
|
24045
24156
|
exports.fseventsImporter = fseventsImporter;
|
|
24046
24157
|
exports.generatedCodePresets = generatedCodePresets;
|