rollup 4.24.2 → 4.24.4
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/parseAst.js +2 -2
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/node-entry.js +278 -235
- package/dist/es/shared/parseAst.js +8 -7
- package/dist/es/shared/watch.js +2 -2
- package/dist/getLogFilter.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/parseAst.js +2 -2
- package/dist/rollup.d.ts +1 -1
- 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/parseAst.js +8 -6
- package/dist/shared/rollup.js +277 -234
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/package.json +36 -36
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.24.
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.24.4
|
|
4
|
+
Mon, 04 Nov 2024 08:46:36 GMT - commit cdf34ab5411aac6ac3f6cd21b10d2e58427e88ec
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
8
8
|
Released under the MIT License.
|
|
9
9
|
*/
|
|
10
|
-
import { ExportDefaultDeclaration as ExportDefaultDeclaration$1, CallExpression as CallExpression$1, EMPTY_ARRAY, LOGLEVEL_WARN, logUnusedExternalImports, ANNOTATION_KEY, INVALID_ANNOTATION_KEY, Program as Program$1, logIllegalImportReassignment, BLANK, logRedeclarationError, StaticBlock as StaticBlock$1, CatchClause as CatchClause$1, logDuplicateArgumentNameError, logModuleLevelDirective, ReturnStatement as ReturnStatement$1, VariableDeclarator as VariableDeclarator$1, ExpressionStatement as ExpressionStatement$1, logMissingExport, normalize, getImportPath, logMissingNodeBuiltins, logReservedNamespace, error, logIllegalIdentifierAsName, logMissingNameOptionForIifeExport, logMissingNameOptionForUmdExport,
|
|
10
|
+
import { ExportDefaultDeclaration as ExportDefaultDeclaration$1, CallExpression as CallExpression$1, EMPTY_ARRAY, LOGLEVEL_WARN, logUnusedExternalImports, ANNOTATION_KEY, INVALID_ANNOTATION_KEY, ObjectExpression as ObjectExpression$1, Property as Property$1, Program as Program$1, logIllegalImportReassignment, BLANK, logRedeclarationError, StaticBlock as StaticBlock$1, CatchClause as CatchClause$1, logDuplicateArgumentNameError, logModuleLevelDirective, ReturnStatement as ReturnStatement$1, VariableDeclarator as VariableDeclarator$1, ExpressionStatement as ExpressionStatement$1, logMissingExport, normalize, getImportPath, logMissingNodeBuiltins, logReservedNamespace, error, logIllegalIdentifierAsName, logMissingNameOptionForIifeExport, logMissingNameOptionForUmdExport, logConstVariableReassignError, ArrowFunctionExpression as ArrowFunctionExpression$1, EMPTY_SET, logCannotCallNamespace, logEval, BlockStatement as BlockStatement$1, getRollupError, logParseError, logModuleParseError, LOGLEVEL_INFO, logFirstSideEffect, locate, logInvalidAnnotation, Identifier as Identifier$1, logThisIsUndefined, getAstBuffer, convertAnnotations, FIXED_STRINGS, convertNode as convertNode$1, EMPTY_OBJECT, logImportAttributeIsInvalid, logImportOptionsAreInvalid, logSyntheticNamedExportsNeedNamespaceExport, logMissingEntryExport, logDuplicateExportError, logInvalidSourcemapForError, augmentCodeLocation, logInconsistentImportAttributes, logMissingJsxExport, logNamespaceConflict, logAmbiguousExternalNamespaces, logShimmedExport, parseAst, logCircularReexport, logInvalidFormatForTopLevelAwait, TemplateLiteral as TemplateLiteral$1, Literal as Literal$1, logAddonNotGenerated, logIncompatibleExportOptionValue, logMixedExport, logFailedValidation, isPathFragment, logCyclicCrossChunkReexport, getAliasName, logUnexpectedNamedImport, isAbsolute as isAbsolute$1, relative as relative$1, logUnexpectedNamespaceReexport, logEmptyChunk, logMissingGlobalName, logOptimizeChunkStatus, logSourcemapBroken, logConflictingSourcemapSources, logChunkInvalid, logInvalidOption, URL_OUTPUT_FORMAT, URL_OUTPUT_DIR, URL_OUTPUT_SOURCEMAPFILE, URL_OUTPUT_AMD_ID, logCannotAssignModuleToChunk, logAnonymousPluginCache, logDuplicatePluginName, logUnknownOption, printQuotedStringList, LOGLEVEL_ERROR, logLevelPriority, LOGLEVEL_DEBUG, logInvalidSetAssetSourceCall, logPluginError, logNoTransformMapOrAstWithoutCode, relativeId, logBadLoader, logExternalModulesCannotBeTransformedToModules, logInternalIdCannotBeExternal, isRelative, logUnresolvedImport, logUnresolvedImportTreatedAsExternal, logExternalSyntheticExports, logUnresolvedEntry, logUnresolvedImplicitDependant, logExternalModulesCannotBeIncludedInManualChunks, logEntryCannotBeExternal, logImplicitDependantCannotBeExternal, logNoAssetSourceSet, logFileReferenceIdNotFoundForFilename, logAssetReferenceIdNotFoundForSetSource, logAssetSourceAlreadySet, logInvalidRollupPhaseForChunkEmission, warnDeprecation, URL_GENERATEBUNDLE, logFileNameConflict, logAssetNotFinalisedForFileName, logChunkNotGeneratedForFileName, logInvalidLogPosition, logInputHookInOutputPlugin, logInvalidFunctionPluginHook, logInvalidAddonPluginHook, logImplicitDependantIsNotIncluded, logCircularDependency, augmentLogMessage, URL_JSX, URL_TREESHAKE, URL_TREESHAKE_MODULESIDEEFFECTS, logInvalidExportOptionValue, URL_OUTPUT_INTEROP, isValidUrl, addTrailingSlashIfMissed, URL_OUTPUT_SOURCEMAPBASEURL, URL_OUTPUT_INLINEDYNAMICIMPORTS, URL_PRESERVEENTRYSIGNATURES, URL_OUTPUT_AMD_BASEPATH, URL_OUTPUT_GENERATEDCODE, URL_OUTPUT_MANUALCHUNKS, URL_OUTPUT_EXTERNALIMPORTATTRIBUTES, logAlreadyClosed, logMissingFileOrDirOption, logCannotEmitFromOptionsHook, URL_WATCH } from './parseAst.js';
|
|
11
11
|
import { relative, dirname, basename, extname, resolve as resolve$1 } from 'node:path';
|
|
12
12
|
import { posix, win32, isAbsolute, resolve } from 'path';
|
|
13
13
|
import { parseAsync, xxhashBase64Url, xxhashBase36, xxhashBase16 } from '../../native.js';
|
|
@@ -16,7 +16,7 @@ import { performance } from 'node:perf_hooks';
|
|
|
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.24.
|
|
19
|
+
var version = "4.24.4";
|
|
20
20
|
|
|
21
21
|
const comma = ','.charCodeAt(0);
|
|
22
22
|
const semicolon = ';'.charCodeAt(0);
|
|
@@ -2491,208 +2491,6 @@ function markModuleAndImpureDependenciesAsExecuted(baseModule) {
|
|
|
2491
2491
|
|
|
2492
2492
|
const doNothing = () => { };
|
|
2493
2493
|
|
|
2494
|
-
function assembleMemberDescriptions(memberDescriptions, inheritedDescriptions = null) {
|
|
2495
|
-
return Object.create(inheritedDescriptions, memberDescriptions);
|
|
2496
|
-
}
|
|
2497
|
-
const UNDEFINED_EXPRESSION = new (class UndefinedExpression extends ExpressionEntity {
|
|
2498
|
-
getLiteralValueAtPath() {
|
|
2499
|
-
return undefined;
|
|
2500
|
-
}
|
|
2501
|
-
})();
|
|
2502
|
-
const returnsUnknown = {
|
|
2503
|
-
value: {
|
|
2504
|
-
hasEffectsWhenCalled: null,
|
|
2505
|
-
returns: UNKNOWN_EXPRESSION
|
|
2506
|
-
}
|
|
2507
|
-
};
|
|
2508
|
-
const UNKNOWN_LITERAL_BOOLEAN = new (class UnknownBoolean extends ExpressionEntity {
|
|
2509
|
-
getReturnExpressionWhenCalledAtPath(path) {
|
|
2510
|
-
if (path.length === 1) {
|
|
2511
|
-
return getMemberReturnExpressionWhenCalled(literalBooleanMembers, path[0]);
|
|
2512
|
-
}
|
|
2513
|
-
return UNKNOWN_RETURN_EXPRESSION;
|
|
2514
|
-
}
|
|
2515
|
-
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
2516
|
-
if (interaction.type === INTERACTION_ACCESSED) {
|
|
2517
|
-
return path.length > 1;
|
|
2518
|
-
}
|
|
2519
|
-
if (interaction.type === INTERACTION_CALLED && path.length === 1) {
|
|
2520
|
-
return hasMemberEffectWhenCalled(literalBooleanMembers, path[0], interaction, context);
|
|
2521
|
-
}
|
|
2522
|
-
return true;
|
|
2523
|
-
}
|
|
2524
|
-
})();
|
|
2525
|
-
const returnsBoolean = {
|
|
2526
|
-
value: {
|
|
2527
|
-
hasEffectsWhenCalled: null,
|
|
2528
|
-
returns: UNKNOWN_LITERAL_BOOLEAN
|
|
2529
|
-
}
|
|
2530
|
-
};
|
|
2531
|
-
const UNKNOWN_LITERAL_NUMBER = new (class UnknownNumber extends ExpressionEntity {
|
|
2532
|
-
getReturnExpressionWhenCalledAtPath(path) {
|
|
2533
|
-
if (path.length === 1) {
|
|
2534
|
-
return getMemberReturnExpressionWhenCalled(literalNumberMembers, path[0]);
|
|
2535
|
-
}
|
|
2536
|
-
return UNKNOWN_RETURN_EXPRESSION;
|
|
2537
|
-
}
|
|
2538
|
-
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
2539
|
-
if (interaction.type === INTERACTION_ACCESSED) {
|
|
2540
|
-
return path.length > 1;
|
|
2541
|
-
}
|
|
2542
|
-
if (interaction.type === INTERACTION_CALLED && path.length === 1) {
|
|
2543
|
-
return hasMemberEffectWhenCalled(literalNumberMembers, path[0], interaction, context);
|
|
2544
|
-
}
|
|
2545
|
-
return true;
|
|
2546
|
-
}
|
|
2547
|
-
})();
|
|
2548
|
-
const returnsNumber = {
|
|
2549
|
-
value: {
|
|
2550
|
-
hasEffectsWhenCalled: null,
|
|
2551
|
-
returns: UNKNOWN_LITERAL_NUMBER
|
|
2552
|
-
}
|
|
2553
|
-
};
|
|
2554
|
-
const UNKNOWN_LITERAL_STRING = new (class UnknownString extends ExpressionEntity {
|
|
2555
|
-
getReturnExpressionWhenCalledAtPath(path) {
|
|
2556
|
-
if (path.length === 1) {
|
|
2557
|
-
return getMemberReturnExpressionWhenCalled(literalStringMembers, path[0]);
|
|
2558
|
-
}
|
|
2559
|
-
return UNKNOWN_RETURN_EXPRESSION;
|
|
2560
|
-
}
|
|
2561
|
-
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
2562
|
-
if (interaction.type === INTERACTION_ACCESSED) {
|
|
2563
|
-
return path.length > 1;
|
|
2564
|
-
}
|
|
2565
|
-
if (interaction.type === INTERACTION_CALLED && path.length === 1) {
|
|
2566
|
-
return hasMemberEffectWhenCalled(literalStringMembers, path[0], interaction, context);
|
|
2567
|
-
}
|
|
2568
|
-
return true;
|
|
2569
|
-
}
|
|
2570
|
-
})();
|
|
2571
|
-
const returnsString = {
|
|
2572
|
-
value: {
|
|
2573
|
-
hasEffectsWhenCalled: null,
|
|
2574
|
-
returns: UNKNOWN_LITERAL_STRING
|
|
2575
|
-
}
|
|
2576
|
-
};
|
|
2577
|
-
const stringReplace = {
|
|
2578
|
-
value: {
|
|
2579
|
-
hasEffectsWhenCalled({ args }, context) {
|
|
2580
|
-
const argument1 = args[2];
|
|
2581
|
-
return (args.length < 3 ||
|
|
2582
|
-
(typeof argument1.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, {
|
|
2583
|
-
deoptimizeCache() { }
|
|
2584
|
-
}) === 'symbol' &&
|
|
2585
|
-
argument1.hasEffectsOnInteractionAtPath(EMPTY_PATH, NODE_INTERACTION_UNKNOWN_CALL, context)));
|
|
2586
|
-
},
|
|
2587
|
-
returns: UNKNOWN_LITERAL_STRING
|
|
2588
|
-
}
|
|
2589
|
-
};
|
|
2590
|
-
const objectMembers = assembleMemberDescriptions({
|
|
2591
|
-
hasOwnProperty: returnsBoolean,
|
|
2592
|
-
isPrototypeOf: returnsBoolean,
|
|
2593
|
-
propertyIsEnumerable: returnsBoolean,
|
|
2594
|
-
toLocaleString: returnsString,
|
|
2595
|
-
toString: returnsString,
|
|
2596
|
-
valueOf: returnsUnknown
|
|
2597
|
-
});
|
|
2598
|
-
const literalBooleanMembers = assembleMemberDescriptions({
|
|
2599
|
-
valueOf: returnsBoolean
|
|
2600
|
-
}, objectMembers);
|
|
2601
|
-
const literalNumberMembers = assembleMemberDescriptions({
|
|
2602
|
-
toExponential: returnsString,
|
|
2603
|
-
toFixed: returnsString,
|
|
2604
|
-
toLocaleString: returnsString,
|
|
2605
|
-
toPrecision: returnsString,
|
|
2606
|
-
valueOf: returnsNumber
|
|
2607
|
-
}, objectMembers);
|
|
2608
|
-
/**
|
|
2609
|
-
* RegExp are stateful when they have the global or sticky flags set.
|
|
2610
|
-
* But if we actually don't use them, the side effect does not matter.
|
|
2611
|
-
* the check logic in `hasEffectsOnInteractionAtPath`.
|
|
2612
|
-
*/
|
|
2613
|
-
const literalRegExpMembers = assembleMemberDescriptions({
|
|
2614
|
-
exec: returnsUnknown,
|
|
2615
|
-
test: returnsBoolean
|
|
2616
|
-
}, objectMembers);
|
|
2617
|
-
const literalStringMembers = assembleMemberDescriptions({
|
|
2618
|
-
anchor: returnsString,
|
|
2619
|
-
at: returnsUnknown,
|
|
2620
|
-
big: returnsString,
|
|
2621
|
-
blink: returnsString,
|
|
2622
|
-
bold: returnsString,
|
|
2623
|
-
charAt: returnsString,
|
|
2624
|
-
charCodeAt: returnsNumber,
|
|
2625
|
-
codePointAt: returnsUnknown,
|
|
2626
|
-
concat: returnsString,
|
|
2627
|
-
endsWith: returnsBoolean,
|
|
2628
|
-
fixed: returnsString,
|
|
2629
|
-
fontcolor: returnsString,
|
|
2630
|
-
fontsize: returnsString,
|
|
2631
|
-
includes: returnsBoolean,
|
|
2632
|
-
indexOf: returnsNumber,
|
|
2633
|
-
italics: returnsString,
|
|
2634
|
-
lastIndexOf: returnsNumber,
|
|
2635
|
-
link: returnsString,
|
|
2636
|
-
localeCompare: returnsNumber,
|
|
2637
|
-
match: returnsUnknown,
|
|
2638
|
-
matchAll: returnsUnknown,
|
|
2639
|
-
normalize: returnsString,
|
|
2640
|
-
padEnd: returnsString,
|
|
2641
|
-
padStart: returnsString,
|
|
2642
|
-
repeat: returnsString,
|
|
2643
|
-
replace: stringReplace,
|
|
2644
|
-
replaceAll: stringReplace,
|
|
2645
|
-
search: returnsNumber,
|
|
2646
|
-
slice: returnsString,
|
|
2647
|
-
small: returnsString,
|
|
2648
|
-
split: returnsUnknown,
|
|
2649
|
-
startsWith: returnsBoolean,
|
|
2650
|
-
strike: returnsString,
|
|
2651
|
-
sub: returnsString,
|
|
2652
|
-
substr: returnsString,
|
|
2653
|
-
substring: returnsString,
|
|
2654
|
-
sup: returnsString,
|
|
2655
|
-
toLocaleLowerCase: returnsString,
|
|
2656
|
-
toLocaleUpperCase: returnsString,
|
|
2657
|
-
toLowerCase: returnsString,
|
|
2658
|
-
toString: returnsString, // overrides the toString() method of the Object object; it does not inherit Object.prototype.toString()
|
|
2659
|
-
toUpperCase: returnsString,
|
|
2660
|
-
trim: returnsString,
|
|
2661
|
-
trimEnd: returnsString,
|
|
2662
|
-
trimLeft: returnsString,
|
|
2663
|
-
trimRight: returnsString,
|
|
2664
|
-
trimStart: returnsString,
|
|
2665
|
-
valueOf: returnsString
|
|
2666
|
-
}, objectMembers);
|
|
2667
|
-
function getLiteralMembersForValue(value) {
|
|
2668
|
-
if (value instanceof RegExp) {
|
|
2669
|
-
return literalRegExpMembers;
|
|
2670
|
-
}
|
|
2671
|
-
switch (typeof value) {
|
|
2672
|
-
case 'boolean': {
|
|
2673
|
-
return literalBooleanMembers;
|
|
2674
|
-
}
|
|
2675
|
-
case 'number': {
|
|
2676
|
-
return literalNumberMembers;
|
|
2677
|
-
}
|
|
2678
|
-
case 'string': {
|
|
2679
|
-
return literalStringMembers;
|
|
2680
|
-
}
|
|
2681
|
-
}
|
|
2682
|
-
return Object.create(null);
|
|
2683
|
-
}
|
|
2684
|
-
function hasMemberEffectWhenCalled(members, memberName, interaction, context) {
|
|
2685
|
-
if (typeof memberName !== 'string' || !members[memberName]) {
|
|
2686
|
-
return true;
|
|
2687
|
-
}
|
|
2688
|
-
return members[memberName].hasEffectsWhenCalled?.(interaction, context) || false;
|
|
2689
|
-
}
|
|
2690
|
-
function getMemberReturnExpressionWhenCalled(members, memberName) {
|
|
2691
|
-
if (typeof memberName !== 'string' || !members[memberName])
|
|
2692
|
-
return UNKNOWN_RETURN_EXPRESSION;
|
|
2693
|
-
return [members[memberName].returns, false];
|
|
2694
|
-
}
|
|
2695
|
-
|
|
2696
2494
|
// This file is generated by scripts/generate-child-node-keys.js.
|
|
2697
2495
|
// Do not edit this file directly.
|
|
2698
2496
|
const childNodeKeys = {
|
|
@@ -2934,11 +2732,13 @@ class NodeBase extends ExpressionEntity {
|
|
|
2934
2732
|
this[key] = value;
|
|
2935
2733
|
}
|
|
2936
2734
|
else if (Array.isArray(value)) {
|
|
2937
|
-
this[key] =
|
|
2735
|
+
this[key] = new Array(value.length);
|
|
2736
|
+
let index = 0;
|
|
2938
2737
|
for (const child of value) {
|
|
2939
|
-
this[key]
|
|
2940
|
-
|
|
2941
|
-
|
|
2738
|
+
this[key][index++] =
|
|
2739
|
+
child === null
|
|
2740
|
+
? null
|
|
2741
|
+
: new (this.scope.context.getNodeConstructor(child.type))(this, this.scope).parseNode(child);
|
|
2942
2742
|
}
|
|
2943
2743
|
}
|
|
2944
2744
|
else {
|
|
@@ -3005,6 +2805,215 @@ function createChildNodeKeysForNode(esTreeNode) {
|
|
|
3005
2805
|
return Object.keys(esTreeNode).filter(key => typeof esTreeNode[key] === 'object' && key.charCodeAt(0) !== 95 /* _ */);
|
|
3006
2806
|
}
|
|
3007
2807
|
|
|
2808
|
+
function isObjectExpressionNode(node) {
|
|
2809
|
+
return node instanceof NodeBase && node.type === ObjectExpression$1;
|
|
2810
|
+
}
|
|
2811
|
+
function isPropertyNode(node) {
|
|
2812
|
+
return node.type === Property$1;
|
|
2813
|
+
}
|
|
2814
|
+
|
|
2815
|
+
function assembleMemberDescriptions(memberDescriptions, inheritedDescriptions = null) {
|
|
2816
|
+
return Object.create(inheritedDescriptions, memberDescriptions);
|
|
2817
|
+
}
|
|
2818
|
+
const UNDEFINED_EXPRESSION = new (class UndefinedExpression extends ExpressionEntity {
|
|
2819
|
+
getLiteralValueAtPath() {
|
|
2820
|
+
return undefined;
|
|
2821
|
+
}
|
|
2822
|
+
})();
|
|
2823
|
+
const returnsUnknown = {
|
|
2824
|
+
value: {
|
|
2825
|
+
hasEffectsWhenCalled: null,
|
|
2826
|
+
returns: UNKNOWN_EXPRESSION
|
|
2827
|
+
}
|
|
2828
|
+
};
|
|
2829
|
+
const UNKNOWN_LITERAL_BOOLEAN = new (class UnknownBoolean extends ExpressionEntity {
|
|
2830
|
+
getReturnExpressionWhenCalledAtPath(path) {
|
|
2831
|
+
if (path.length === 1) {
|
|
2832
|
+
return getMemberReturnExpressionWhenCalled(literalBooleanMembers, path[0]);
|
|
2833
|
+
}
|
|
2834
|
+
return UNKNOWN_RETURN_EXPRESSION;
|
|
2835
|
+
}
|
|
2836
|
+
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
2837
|
+
if (interaction.type === INTERACTION_ACCESSED) {
|
|
2838
|
+
return path.length > 1;
|
|
2839
|
+
}
|
|
2840
|
+
if (interaction.type === INTERACTION_CALLED && path.length === 1) {
|
|
2841
|
+
return hasMemberEffectWhenCalled(literalBooleanMembers, path[0], interaction, context);
|
|
2842
|
+
}
|
|
2843
|
+
return true;
|
|
2844
|
+
}
|
|
2845
|
+
})();
|
|
2846
|
+
const returnsBoolean = {
|
|
2847
|
+
value: {
|
|
2848
|
+
hasEffectsWhenCalled: null,
|
|
2849
|
+
returns: UNKNOWN_LITERAL_BOOLEAN
|
|
2850
|
+
}
|
|
2851
|
+
};
|
|
2852
|
+
const UNKNOWN_LITERAL_NUMBER = new (class UnknownNumber extends ExpressionEntity {
|
|
2853
|
+
getReturnExpressionWhenCalledAtPath(path) {
|
|
2854
|
+
if (path.length === 1) {
|
|
2855
|
+
return getMemberReturnExpressionWhenCalled(literalNumberMembers, path[0]);
|
|
2856
|
+
}
|
|
2857
|
+
return UNKNOWN_RETURN_EXPRESSION;
|
|
2858
|
+
}
|
|
2859
|
+
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
2860
|
+
if (interaction.type === INTERACTION_ACCESSED) {
|
|
2861
|
+
return path.length > 1;
|
|
2862
|
+
}
|
|
2863
|
+
if (interaction.type === INTERACTION_CALLED && path.length === 1) {
|
|
2864
|
+
return hasMemberEffectWhenCalled(literalNumberMembers, path[0], interaction, context);
|
|
2865
|
+
}
|
|
2866
|
+
return true;
|
|
2867
|
+
}
|
|
2868
|
+
})();
|
|
2869
|
+
const returnsNumber = {
|
|
2870
|
+
value: {
|
|
2871
|
+
hasEffectsWhenCalled: null,
|
|
2872
|
+
returns: UNKNOWN_LITERAL_NUMBER
|
|
2873
|
+
}
|
|
2874
|
+
};
|
|
2875
|
+
const UNKNOWN_LITERAL_STRING = new (class UnknownString extends ExpressionEntity {
|
|
2876
|
+
getReturnExpressionWhenCalledAtPath(path) {
|
|
2877
|
+
if (path.length === 1) {
|
|
2878
|
+
return getMemberReturnExpressionWhenCalled(literalStringMembers, path[0]);
|
|
2879
|
+
}
|
|
2880
|
+
return UNKNOWN_RETURN_EXPRESSION;
|
|
2881
|
+
}
|
|
2882
|
+
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
2883
|
+
if (interaction.type === INTERACTION_ACCESSED) {
|
|
2884
|
+
return path.length > 1;
|
|
2885
|
+
}
|
|
2886
|
+
if (interaction.type === INTERACTION_CALLED && path.length === 1) {
|
|
2887
|
+
return hasMemberEffectWhenCalled(literalStringMembers, path[0], interaction, context);
|
|
2888
|
+
}
|
|
2889
|
+
return true;
|
|
2890
|
+
}
|
|
2891
|
+
})();
|
|
2892
|
+
const returnsString = {
|
|
2893
|
+
value: {
|
|
2894
|
+
hasEffectsWhenCalled: null,
|
|
2895
|
+
returns: UNKNOWN_LITERAL_STRING
|
|
2896
|
+
}
|
|
2897
|
+
};
|
|
2898
|
+
const stringReplace = {
|
|
2899
|
+
value: {
|
|
2900
|
+
hasEffectsWhenCalled({ args }, context) {
|
|
2901
|
+
const argument1 = args[2];
|
|
2902
|
+
return (args.length < 3 ||
|
|
2903
|
+
(typeof argument1.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, {
|
|
2904
|
+
deoptimizeCache() { }
|
|
2905
|
+
}) === 'symbol' &&
|
|
2906
|
+
argument1.hasEffectsOnInteractionAtPath(EMPTY_PATH, NODE_INTERACTION_UNKNOWN_CALL, context)));
|
|
2907
|
+
},
|
|
2908
|
+
returns: UNKNOWN_LITERAL_STRING
|
|
2909
|
+
}
|
|
2910
|
+
};
|
|
2911
|
+
const objectMembers = assembleMemberDescriptions({
|
|
2912
|
+
hasOwnProperty: returnsBoolean,
|
|
2913
|
+
isPrototypeOf: returnsBoolean,
|
|
2914
|
+
propertyIsEnumerable: returnsBoolean,
|
|
2915
|
+
toLocaleString: returnsString,
|
|
2916
|
+
toString: returnsString,
|
|
2917
|
+
valueOf: returnsUnknown
|
|
2918
|
+
});
|
|
2919
|
+
const literalBooleanMembers = assembleMemberDescriptions({
|
|
2920
|
+
valueOf: returnsBoolean
|
|
2921
|
+
}, objectMembers);
|
|
2922
|
+
const literalNumberMembers = assembleMemberDescriptions({
|
|
2923
|
+
toExponential: returnsString,
|
|
2924
|
+
toFixed: returnsString,
|
|
2925
|
+
toLocaleString: returnsString,
|
|
2926
|
+
toPrecision: returnsString,
|
|
2927
|
+
valueOf: returnsNumber
|
|
2928
|
+
}, objectMembers);
|
|
2929
|
+
/**
|
|
2930
|
+
* RegExp are stateful when they have the global or sticky flags set.
|
|
2931
|
+
* But if we actually don't use them, the side effect does not matter.
|
|
2932
|
+
* the check logic in `hasEffectsOnInteractionAtPath`.
|
|
2933
|
+
*/
|
|
2934
|
+
const literalRegExpMembers = assembleMemberDescriptions({
|
|
2935
|
+
exec: returnsUnknown,
|
|
2936
|
+
test: returnsBoolean
|
|
2937
|
+
}, objectMembers);
|
|
2938
|
+
const literalStringMembers = assembleMemberDescriptions({
|
|
2939
|
+
anchor: returnsString,
|
|
2940
|
+
at: returnsUnknown,
|
|
2941
|
+
big: returnsString,
|
|
2942
|
+
blink: returnsString,
|
|
2943
|
+
bold: returnsString,
|
|
2944
|
+
charAt: returnsString,
|
|
2945
|
+
charCodeAt: returnsNumber,
|
|
2946
|
+
codePointAt: returnsUnknown,
|
|
2947
|
+
concat: returnsString,
|
|
2948
|
+
endsWith: returnsBoolean,
|
|
2949
|
+
fixed: returnsString,
|
|
2950
|
+
fontcolor: returnsString,
|
|
2951
|
+
fontsize: returnsString,
|
|
2952
|
+
includes: returnsBoolean,
|
|
2953
|
+
indexOf: returnsNumber,
|
|
2954
|
+
italics: returnsString,
|
|
2955
|
+
lastIndexOf: returnsNumber,
|
|
2956
|
+
link: returnsString,
|
|
2957
|
+
localeCompare: returnsNumber,
|
|
2958
|
+
match: returnsUnknown,
|
|
2959
|
+
matchAll: returnsUnknown,
|
|
2960
|
+
normalize: returnsString,
|
|
2961
|
+
padEnd: returnsString,
|
|
2962
|
+
padStart: returnsString,
|
|
2963
|
+
repeat: returnsString,
|
|
2964
|
+
replace: stringReplace,
|
|
2965
|
+
replaceAll: stringReplace,
|
|
2966
|
+
search: returnsNumber,
|
|
2967
|
+
slice: returnsString,
|
|
2968
|
+
small: returnsString,
|
|
2969
|
+
split: returnsUnknown,
|
|
2970
|
+
startsWith: returnsBoolean,
|
|
2971
|
+
strike: returnsString,
|
|
2972
|
+
sub: returnsString,
|
|
2973
|
+
substr: returnsString,
|
|
2974
|
+
substring: returnsString,
|
|
2975
|
+
sup: returnsString,
|
|
2976
|
+
toLocaleLowerCase: returnsString,
|
|
2977
|
+
toLocaleUpperCase: returnsString,
|
|
2978
|
+
toLowerCase: returnsString,
|
|
2979
|
+
toString: returnsString, // overrides the toString() method of the Object object; it does not inherit Object.prototype.toString()
|
|
2980
|
+
toUpperCase: returnsString,
|
|
2981
|
+
trim: returnsString,
|
|
2982
|
+
trimEnd: returnsString,
|
|
2983
|
+
trimLeft: returnsString,
|
|
2984
|
+
trimRight: returnsString,
|
|
2985
|
+
trimStart: returnsString,
|
|
2986
|
+
valueOf: returnsString
|
|
2987
|
+
}, objectMembers);
|
|
2988
|
+
function getLiteralMembersForValue(value) {
|
|
2989
|
+
if (value instanceof RegExp) {
|
|
2990
|
+
return literalRegExpMembers;
|
|
2991
|
+
}
|
|
2992
|
+
switch (typeof value) {
|
|
2993
|
+
case 'boolean': {
|
|
2994
|
+
return literalBooleanMembers;
|
|
2995
|
+
}
|
|
2996
|
+
case 'number': {
|
|
2997
|
+
return literalNumberMembers;
|
|
2998
|
+
}
|
|
2999
|
+
case 'string': {
|
|
3000
|
+
return literalStringMembers;
|
|
3001
|
+
}
|
|
3002
|
+
}
|
|
3003
|
+
return Object.create(null);
|
|
3004
|
+
}
|
|
3005
|
+
function hasMemberEffectWhenCalled(members, memberName, interaction, context) {
|
|
3006
|
+
if (typeof memberName !== 'string' || !members[memberName]) {
|
|
3007
|
+
return true;
|
|
3008
|
+
}
|
|
3009
|
+
return members[memberName].hasEffectsWhenCalled?.(interaction, context) || false;
|
|
3010
|
+
}
|
|
3011
|
+
function getMemberReturnExpressionWhenCalled(members, memberName) {
|
|
3012
|
+
if (typeof memberName !== 'string' || !members[memberName])
|
|
3013
|
+
return UNKNOWN_RETURN_EXPRESSION;
|
|
3014
|
+
return [members[memberName].returns, false];
|
|
3015
|
+
}
|
|
3016
|
+
|
|
3008
3017
|
class SpreadElement extends NodeBase {
|
|
3009
3018
|
deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
|
|
3010
3019
|
if (path.length > 0) {
|
|
@@ -3962,7 +3971,29 @@ const knownGlobals = {
|
|
|
3962
3971
|
resolve: O
|
|
3963
3972
|
},
|
|
3964
3973
|
propertyIsEnumerable: O,
|
|
3965
|
-
Proxy:
|
|
3974
|
+
Proxy: {
|
|
3975
|
+
__proto__: null,
|
|
3976
|
+
[ValueProperties]: {
|
|
3977
|
+
deoptimizeArgumentsOnCall: ({ args: [, target, parameter] }) => {
|
|
3978
|
+
if (isObjectExpressionNode(parameter)) {
|
|
3979
|
+
const hasSpreadElement = parameter.properties.some(property => !isPropertyNode(property));
|
|
3980
|
+
if (!hasSpreadElement) {
|
|
3981
|
+
for (const property of parameter.properties) {
|
|
3982
|
+
property.deoptimizeArgumentsOnInteractionAtPath({
|
|
3983
|
+
args: [null, target],
|
|
3984
|
+
type: INTERACTION_CALLED,
|
|
3985
|
+
withNew: false
|
|
3986
|
+
}, EMPTY_PATH, SHARED_RECURSION_TRACKER);
|
|
3987
|
+
}
|
|
3988
|
+
return;
|
|
3989
|
+
}
|
|
3990
|
+
}
|
|
3991
|
+
target.deoptimizePath(UNKNOWN_PATH);
|
|
3992
|
+
},
|
|
3993
|
+
getLiteralValue: getTruthyLiteralValue,
|
|
3994
|
+
hasEffectsWhenCalled: returnTrue
|
|
3995
|
+
}
|
|
3996
|
+
},
|
|
3966
3997
|
RangeError: PC,
|
|
3967
3998
|
ReferenceError: PC,
|
|
3968
3999
|
Reflect: O,
|
|
@@ -8081,14 +8112,16 @@ function getImportBlock(dependencies, importAttributesKey, { _ }) {
|
|
|
8081
8112
|
}
|
|
8082
8113
|
function getExportBlock(exports, { _, cnst }) {
|
|
8083
8114
|
const exportBlock = [];
|
|
8084
|
-
const exportDeclaration =
|
|
8115
|
+
const exportDeclaration = new Array(exports.length);
|
|
8116
|
+
let index = 0;
|
|
8085
8117
|
for (const specifier of exports) {
|
|
8086
8118
|
if (specifier.expression) {
|
|
8087
8119
|
exportBlock.push(`${cnst} ${specifier.local}${_}=${_}${specifier.expression};`);
|
|
8088
8120
|
}
|
|
8089
|
-
exportDeclaration
|
|
8090
|
-
|
|
8091
|
-
|
|
8121
|
+
exportDeclaration[index++] =
|
|
8122
|
+
specifier.exported === specifier.local
|
|
8123
|
+
? specifier.local
|
|
8124
|
+
: `${specifier.local} as ${stringifyIdentifierIfNeeded(specifier.exported)}`;
|
|
8092
8125
|
}
|
|
8093
8126
|
if (exportDeclaration.length > 0) {
|
|
8094
8127
|
exportBlock.push(`export${_}{${_}${exportDeclaration.join(`,${_}`)}${_}};`);
|
|
@@ -11409,9 +11442,10 @@ class ClassBody extends NodeBase {
|
|
|
11409
11442
|
}
|
|
11410
11443
|
}
|
|
11411
11444
|
parseNode(esTreeNode) {
|
|
11412
|
-
const body = (this.body =
|
|
11445
|
+
const body = (this.body = new Array(esTreeNode.body.length));
|
|
11446
|
+
let index = 0;
|
|
11413
11447
|
for (const definition of esTreeNode.body) {
|
|
11414
|
-
body
|
|
11448
|
+
body[index++] = new (this.scope.context.getNodeConstructor(definition.type))(this, definition.static ? this.scope : this.scope.instanceScope).parseNode(definition);
|
|
11415
11449
|
}
|
|
11416
11450
|
return super.parseNode(esTreeNode);
|
|
11417
11451
|
}
|
|
@@ -14474,14 +14508,17 @@ const bufferParsers = [
|
|
|
14474
14508
|
function classBody(node, position, buffer) {
|
|
14475
14509
|
const { scope } = node;
|
|
14476
14510
|
const bodyPosition = buffer[position];
|
|
14477
|
-
const body = (node.body = []);
|
|
14478
14511
|
if (bodyPosition) {
|
|
14479
14512
|
const length = buffer[bodyPosition];
|
|
14513
|
+
const body = (node.body = new Array(length));
|
|
14480
14514
|
for (let index = 0; index < length; index++) {
|
|
14481
14515
|
const nodePosition = buffer[bodyPosition + 1 + index];
|
|
14482
|
-
body
|
|
14516
|
+
body[index] = convertNode(node, (buffer[nodePosition + 3] & 1) === 0 ? scope.instanceScope : scope, nodePosition, buffer);
|
|
14483
14517
|
}
|
|
14484
14518
|
}
|
|
14519
|
+
else {
|
|
14520
|
+
node.body = [];
|
|
14521
|
+
}
|
|
14485
14522
|
},
|
|
14486
14523
|
function classDeclaration(node, position, buffer) {
|
|
14487
14524
|
const { scope } = node;
|
|
@@ -14959,10 +14996,10 @@ function convertNodeList(parent, parentScope, position, buffer) {
|
|
|
14959
14996
|
if (position === 0)
|
|
14960
14997
|
return EMPTY_ARRAY;
|
|
14961
14998
|
const length = buffer[position++];
|
|
14962
|
-
const list =
|
|
14999
|
+
const list = new Array(length);
|
|
14963
15000
|
for (let index = 0; index < length; index++) {
|
|
14964
15001
|
const nodePosition = buffer[position++];
|
|
14965
|
-
list
|
|
15002
|
+
list[index] = nodePosition ? convertNode(parent, parentScope, nodePosition, buffer) : null;
|
|
14966
15003
|
}
|
|
14967
15004
|
return list;
|
|
14968
15005
|
}
|
|
@@ -17955,14 +17992,16 @@ function getChunkAssignments(entries, manualChunkAliasByEntry, minChunkSize, log
|
|
|
17955
17992
|
return chunkDefinitions;
|
|
17956
17993
|
}
|
|
17957
17994
|
function getChunkDefinitionsFromManualChunks(manualChunkAliasByEntry) {
|
|
17958
|
-
const chunkDefinitions = [];
|
|
17959
17995
|
const modulesInManualChunks = new Set(manualChunkAliasByEntry.keys());
|
|
17960
17996
|
const manualChunkModulesByAlias = Object.create(null);
|
|
17961
17997
|
for (const [entry, alias] of manualChunkAliasByEntry) {
|
|
17962
17998
|
addStaticDependenciesToManualChunk(entry, (manualChunkModulesByAlias[alias] ||= []), modulesInManualChunks);
|
|
17963
17999
|
}
|
|
17964
|
-
|
|
17965
|
-
|
|
18000
|
+
const manualChunks = Object.entries(manualChunkModulesByAlias);
|
|
18001
|
+
const chunkDefinitions = new Array(manualChunks.length);
|
|
18002
|
+
let index = 0;
|
|
18003
|
+
for (const [alias, modules] of manualChunks) {
|
|
18004
|
+
chunkDefinitions[index++] = { alias, modules };
|
|
17966
18005
|
}
|
|
17967
18006
|
return { chunkDefinitions, modulesInManualChunks };
|
|
17968
18007
|
}
|
|
@@ -17981,12 +18020,12 @@ function addStaticDependenciesToManualChunk(entry, manualChunkModules, modulesIn
|
|
|
17981
18020
|
function analyzeModuleGraph(entries) {
|
|
17982
18021
|
const dynamicEntryModules = new Set();
|
|
17983
18022
|
const dependentEntriesByModule = new Map();
|
|
17984
|
-
const dynamicImportModulesByEntry = [];
|
|
17985
18023
|
const allEntriesSet = new Set(entries);
|
|
18024
|
+
const dynamicImportModulesByEntry = new Array(allEntriesSet.size);
|
|
17986
18025
|
let entryIndex = 0;
|
|
17987
18026
|
for (const currentEntry of allEntriesSet) {
|
|
17988
18027
|
const dynamicImportsForCurrentEntry = new Set();
|
|
17989
|
-
dynamicImportModulesByEntry
|
|
18028
|
+
dynamicImportModulesByEntry[entryIndex] = dynamicImportsForCurrentEntry;
|
|
17990
18029
|
const modulesToHandle = new Set([currentEntry]);
|
|
17991
18030
|
for (const module of modulesToHandle) {
|
|
17992
18031
|
getOrCreate(dependentEntriesByModule, module, (getNewSet)).add(entryIndex);
|
|
@@ -18031,13 +18070,14 @@ function getDynamicEntries(allEntries, dynamicEntryModules, dynamicImportModules
|
|
|
18031
18070
|
dynamicEntries.add(entryIndex);
|
|
18032
18071
|
}
|
|
18033
18072
|
}
|
|
18034
|
-
const dynamicImportsByEntry =
|
|
18073
|
+
const dynamicImportsByEntry = new Array(dynamicImportModulesByEntry.length);
|
|
18074
|
+
let index = 0;
|
|
18035
18075
|
for (const dynamicImportModules of dynamicImportModulesByEntry) {
|
|
18036
18076
|
const dynamicImports = new Set();
|
|
18037
18077
|
for (const dynamicEntry of dynamicImportModules) {
|
|
18038
18078
|
dynamicImports.add(entryIndexByModule.get(dynamicEntry));
|
|
18039
18079
|
}
|
|
18040
|
-
dynamicImportsByEntry
|
|
18080
|
+
dynamicImportsByEntry[index++] = dynamicImports;
|
|
18041
18081
|
}
|
|
18042
18082
|
return { dynamicEntries, dynamicImportsByEntry };
|
|
18043
18083
|
}
|
|
@@ -18142,9 +18182,10 @@ function removeUnnecessaryDependentEntries(chunkAtoms, alreadyLoadedAtomsByEntry
|
|
|
18142
18182
|
function getChunksWithSameDependentEntriesAndCorrelatedAtoms(chunkAtoms, staticDependencyAtomsByEntry, alreadyLoadedAtomsByEntry, minChunkSize) {
|
|
18143
18183
|
const chunksBySignature = Object.create(null);
|
|
18144
18184
|
const chunkByModule = new Map();
|
|
18145
|
-
const sizeByAtom =
|
|
18185
|
+
const sizeByAtom = new Array(chunkAtoms.length);
|
|
18146
18186
|
let sideEffectAtoms = 0n;
|
|
18147
18187
|
let atomMask = 1n;
|
|
18188
|
+
let index = 0;
|
|
18148
18189
|
for (const { dependentEntries, modules } of chunkAtoms) {
|
|
18149
18190
|
let chunkSignature = 0n;
|
|
18150
18191
|
let correlatedAtoms = -1n;
|
|
@@ -18182,7 +18223,7 @@ function getChunksWithSameDependentEntriesAndCorrelatedAtoms(chunkAtoms, staticD
|
|
|
18182
18223
|
if (!pure) {
|
|
18183
18224
|
sideEffectAtoms |= atomMask;
|
|
18184
18225
|
}
|
|
18185
|
-
sizeByAtom
|
|
18226
|
+
sizeByAtom[index++] = atomSize;
|
|
18186
18227
|
chunk.containedAtoms |= atomMask;
|
|
18187
18228
|
chunk.modules.push(...modules);
|
|
18188
18229
|
chunk.pure &&= pure;
|
|
@@ -19098,16 +19139,18 @@ class Bundle {
|
|
|
19098
19139
|
const includedModules = getIncludedModules(this.graph.modulesById);
|
|
19099
19140
|
const inputBase = commondir(getAbsoluteEntryModulePaths(includedModules, preserveModules));
|
|
19100
19141
|
const externalChunkByModule = getExternalChunkByModule(this.graph.modulesById, this.outputOptions, inputBase);
|
|
19101
|
-
const
|
|
19102
|
-
const chunkByModule = new Map();
|
|
19103
|
-
for (const { alias, modules } of inlineDynamicImports
|
|
19142
|
+
const executableModule = inlineDynamicImports
|
|
19104
19143
|
? [{ alias: null, modules: includedModules }]
|
|
19105
19144
|
: preserveModules
|
|
19106
19145
|
? includedModules.map(module => ({ alias: null, modules: [module] }))
|
|
19107
|
-
: getChunkAssignments(this.graph.entryModules, manualChunkAliasByEntry, experimentalMinChunkSize, this.inputOptions.onLog)
|
|
19146
|
+
: getChunkAssignments(this.graph.entryModules, manualChunkAliasByEntry, experimentalMinChunkSize, this.inputOptions.onLog);
|
|
19147
|
+
const chunks = new Array(executableModule.length);
|
|
19148
|
+
const chunkByModule = new Map();
|
|
19149
|
+
let index = 0;
|
|
19150
|
+
for (const { alias, modules } of executableModule) {
|
|
19108
19151
|
sortByExecutionOrder(modules);
|
|
19109
19152
|
const chunk = new Chunk(modules, this.inputOptions, this.outputOptions, this.unsetOptions, this.pluginDriver, this.graph.modulesById, chunkByModule, externalChunkByModule, this.facadeChunkByModule, this.includedNamespaces, alias, getHashPlaceholder, bundle, inputBase, snippets);
|
|
19110
|
-
chunks
|
|
19153
|
+
chunks[index++] = chunk;
|
|
19111
19154
|
}
|
|
19112
19155
|
for (const chunk of chunks) {
|
|
19113
19156
|
chunk.link();
|