rollup 4.14.0 → 4.14.2
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/README.md +2 -1
- package/dist/bin/rollup +5 -5
- 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 +184 -167
- package/dist/es/shared/parseAst.js +114 -99
- package/dist/es/shared/watch.js +4 -4
- package/dist/getLogFilter.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/native.js +32 -33
- package/dist/parseAst.js +2 -2
- package/dist/rollup.js +2 -2
- package/dist/shared/fsevents-importer.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +7 -7
- package/dist/shared/parseAst.js +125 -106
- package/dist/shared/rollup.js +269 -252
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +4 -4
- package/package.json +31 -31
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.14.
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.14.2
|
|
4
|
+
Fri, 12 Apr 2024 06:23:07 GMT - commit 7275328b41b29605142bfdf55d68cb54e895a20c
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
8
8
|
Released under the MIT License.
|
|
9
9
|
*/
|
|
10
|
-
import { normalize, getImportPath, LOGLEVEL_WARN, logUnusedExternalImports, ANNOTATION_KEY, INVALID_ANNOTATION_KEY, Program as Program$1, logRedeclarationError, CatchClause as CatchClause$1, logDuplicateArgumentNameError, CallExpression as CallExpression$1, logIllegalImportReassignment, logModuleLevelDirective, ReturnStatement as ReturnStatement$1, Property as Property$1, logConstVariableReassignError, ExpressionStatement as ExpressionStatement$1, ArrowFunctionExpression as ArrowFunctionExpression$1, logMissingExport, logCannotCallNamespace, logEval, BlockStatement as BlockStatement$1, getRollupError, logParseError, logModuleParseError, error, LOGLEVEL_INFO, logFirstSideEffect, locate, logInvalidAnnotation, Identifier as Identifier$1, logThisIsUndefined, getReadStringFunction, convertString, convertAnnotations, FIXED_STRINGS, convertNode as convertNode$1, logImportAttributeIsInvalid, logImportOptionsAreInvalid, logSyntheticNamedExportsNeedNamespaceExport, logMissingEntryExport, logInvalidFormatForTopLevelAwait, logDuplicateExportError, logInvalidSourcemapForError, augmentCodeLocation, logInconsistentImportAttributes, logNamespaceConflict, logAmbiguousExternalNamespaces, logShimmedExport, parseAst, logCircularReexport, TemplateLiteral as TemplateLiteral$1, Literal as Literal$1, logMissingNodeBuiltins, logIllegalIdentifierAsName, logMissingNameOptionForIifeExport, logMissingNameOptionForUmdExport, 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, LOGLEVEL_ERROR, logLevelPriority, LOGLEVEL_DEBUG, logUnknownOption, printQuotedStringList, logInvalidSetAssetSourceCall, logPluginError, logNoTransformMapOrAstWithoutCode, relativeId, logBadLoader, logExternalModulesCannotBeTransformedToModules, logInternalIdCannotBeExternal, isRelative, logUnresolvedImport, logUnresolvedImportTreatedAsExternal, logExternalSyntheticExports, logUnresolvedEntry, logUnresolvedImplicitDependant, logExternalModulesCannotBeIncludedInManualChunks, logEntryCannotBeExternal, logImplicitDependantCannotBeExternal, logNoAssetSourceSet, logFileReferenceIdNotFoundForFilename, logAssetReferenceIdNotFoundForSetSource, logAssetSourceAlreadySet, logInvalidRollupPhaseForChunkEmission, logFileNameConflict, logAssetNotFinalisedForFileName, logChunkNotGeneratedForFileName, logInvalidLogPosition, logInputHookInOutputPlugin, logInvalidFunctionPluginHook, logInvalidAddonPluginHook, logImplicitDependantIsNotIncluded, logCircularDependency, augmentLogMessage, URL_TREESHAKE_MODULESIDEEFFECTS, URL_TREESHAKE, URL_OUTPUT_INLINEDYNAMICIMPORTS, URL_PRESERVEENTRYSIGNATURES, URL_OUTPUT_AMD_BASEPATH, logInvalidExportOptionValue, warnDeprecation, URL_OUTPUT_INTEROP, URL_OUTPUT_MANUALCHUNKS, isValidUrl, addTrailingSlashIfMissed, URL_OUTPUT_SOURCEMAPBASEURL, URL_OUTPUT_GENERATEDCODE, URL_OUTPUT_EXTERNALIMPORTATTRIBUTES, logAlreadyClosed, logMissingFileOrDirOption, logCannotEmitFromOptionsHook, URL_WATCH } from './parseAst.js';
|
|
10
|
+
import { normalize, getImportPath, EMPTY_ARRAY, LOGLEVEL_WARN, logUnusedExternalImports, ANNOTATION_KEY, INVALID_ANNOTATION_KEY, Program as Program$1, logRedeclarationError, CatchClause as CatchClause$1, logDuplicateArgumentNameError, CallExpression as CallExpression$1, BLANK, logIllegalImportReassignment, logModuleLevelDirective, ReturnStatement as ReturnStatement$1, Property as Property$1, logConstVariableReassignError, ExpressionStatement as ExpressionStatement$1, ArrowFunctionExpression as ArrowFunctionExpression$1, logMissingExport, EMPTY_SET, logCannotCallNamespace, logEval, BlockStatement as BlockStatement$1, getRollupError, logParseError, logModuleParseError, error, LOGLEVEL_INFO, logFirstSideEffect, locate, logInvalidAnnotation, Identifier as Identifier$1, logThisIsUndefined, getReadStringFunction, convertString, convertAnnotations, FIXED_STRINGS, convertNode as convertNode$1, EMPTY_OBJECT, logImportAttributeIsInvalid, logImportOptionsAreInvalid, logSyntheticNamedExportsNeedNamespaceExport, logMissingEntryExport, logInvalidFormatForTopLevelAwait, logDuplicateExportError, logInvalidSourcemapForError, augmentCodeLocation, logInconsistentImportAttributes, logNamespaceConflict, logAmbiguousExternalNamespaces, logShimmedExport, parseAst, logCircularReexport, TemplateLiteral as TemplateLiteral$1, Literal as Literal$1, logMissingNodeBuiltins, logIllegalIdentifierAsName, logMissingNameOptionForIifeExport, logMissingNameOptionForUmdExport, 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, LOGLEVEL_ERROR, logLevelPriority, LOGLEVEL_DEBUG, logUnknownOption, printQuotedStringList, logInvalidSetAssetSourceCall, logPluginError, logNoTransformMapOrAstWithoutCode, relativeId, logBadLoader, logExternalModulesCannotBeTransformedToModules, logInternalIdCannotBeExternal, isRelative, logUnresolvedImport, logUnresolvedImportTreatedAsExternal, logExternalSyntheticExports, logUnresolvedEntry, logUnresolvedImplicitDependant, logExternalModulesCannotBeIncludedInManualChunks, logEntryCannotBeExternal, logImplicitDependantCannotBeExternal, logNoAssetSourceSet, logFileReferenceIdNotFoundForFilename, logAssetReferenceIdNotFoundForSetSource, logAssetSourceAlreadySet, logInvalidRollupPhaseForChunkEmission, logFileNameConflict, logAssetNotFinalisedForFileName, logChunkNotGeneratedForFileName, logInvalidLogPosition, logInputHookInOutputPlugin, logInvalidFunctionPluginHook, logInvalidAddonPluginHook, logImplicitDependantIsNotIncluded, logCircularDependency, augmentLogMessage, URL_TREESHAKE_MODULESIDEEFFECTS, URL_TREESHAKE, URL_OUTPUT_INLINEDYNAMICIMPORTS, URL_PRESERVEENTRYSIGNATURES, URL_OUTPUT_AMD_BASEPATH, logInvalidExportOptionValue, warnDeprecation, URL_OUTPUT_INTEROP, URL_OUTPUT_MANUALCHUNKS, isValidUrl, addTrailingSlashIfMissed, URL_OUTPUT_SOURCEMAPBASEURL, URL_OUTPUT_GENERATEDCODE, 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 require$$0$1, { win32, posix, 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.14.
|
|
19
|
+
var version = "4.14.2";
|
|
20
20
|
|
|
21
21
|
const comma = ','.charCodeAt(0);
|
|
22
22
|
const semicolon = ';'.charCodeAt(0);
|
|
@@ -1349,21 +1349,29 @@ class MagicString {
|
|
|
1349
1349
|
if (searchValue.global) {
|
|
1350
1350
|
const matches = matchAll(searchValue, this.original);
|
|
1351
1351
|
matches.forEach((match) => {
|
|
1352
|
-
if (match.index != null)
|
|
1352
|
+
if (match.index != null) {
|
|
1353
|
+
const replacement = getReplacement(match, this.original);
|
|
1354
|
+
if (replacement !== match[0]) {
|
|
1355
|
+
this.overwrite(
|
|
1356
|
+
match.index,
|
|
1357
|
+
match.index + match[0].length,
|
|
1358
|
+
replacement
|
|
1359
|
+
);
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
});
|
|
1363
|
+
} else {
|
|
1364
|
+
const match = this.original.match(searchValue);
|
|
1365
|
+
if (match && match.index != null) {
|
|
1366
|
+
const replacement = getReplacement(match, this.original);
|
|
1367
|
+
if (replacement !== match[0]) {
|
|
1353
1368
|
this.overwrite(
|
|
1354
1369
|
match.index,
|
|
1355
1370
|
match.index + match[0].length,
|
|
1356
|
-
|
|
1371
|
+
replacement
|
|
1357
1372
|
);
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
const match = this.original.match(searchValue);
|
|
1361
|
-
if (match && match.index != null)
|
|
1362
|
-
this.overwrite(
|
|
1363
|
-
match.index,
|
|
1364
|
-
match.index + match[0].length,
|
|
1365
|
-
getReplacement(match, this.original),
|
|
1366
|
-
);
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1367
1375
|
}
|
|
1368
1376
|
return this;
|
|
1369
1377
|
}
|
|
@@ -1395,7 +1403,9 @@ class MagicString {
|
|
|
1395
1403
|
index !== -1;
|
|
1396
1404
|
index = original.indexOf(string, index + stringLength)
|
|
1397
1405
|
) {
|
|
1398
|
-
|
|
1406
|
+
const previous = original.slice(index, index + stringLength);
|
|
1407
|
+
if (previous !== replacement)
|
|
1408
|
+
this.overwrite(index, index + stringLength, replacement);
|
|
1399
1409
|
}
|
|
1400
1410
|
|
|
1401
1411
|
return this;
|
|
@@ -2016,15 +2026,6 @@ class ExternalVariable extends Variable {
|
|
|
2016
2026
|
}
|
|
2017
2027
|
}
|
|
2018
2028
|
|
|
2019
|
-
const BLANK = Object.freeze(Object.create(null));
|
|
2020
|
-
const EMPTY_OBJECT = Object.freeze({});
|
|
2021
|
-
const EMPTY_ARRAY = Object.freeze([]);
|
|
2022
|
-
const EMPTY_SET = Object.freeze(new (class extends Set {
|
|
2023
|
-
add() {
|
|
2024
|
-
throw new Error('Cannot add to empty set');
|
|
2025
|
-
}
|
|
2026
|
-
})());
|
|
2027
|
-
|
|
2028
2029
|
function cacheObjectGetters(object, getterProperties) {
|
|
2029
2030
|
for (const property of getterProperties) {
|
|
2030
2031
|
const propertyGetter = Object.getOwnPropertyDescriptor(object, property).get;
|
|
@@ -4637,7 +4638,7 @@ function getMemberReturnExpressionWhenCalled(members, memberName) {
|
|
|
4637
4638
|
return [members[memberName].returns, false];
|
|
4638
4639
|
}
|
|
4639
4640
|
|
|
4640
|
-
// This file is generated by scripts/generate-
|
|
4641
|
+
// This file is generated by scripts/generate-child-node-keys.js.
|
|
4641
4642
|
// Do not edit this file directly.
|
|
4642
4643
|
const childNodeKeys = {
|
|
4643
4644
|
ArrayExpression: ['elements'],
|
|
@@ -7923,15 +7924,12 @@ class FunctionBase extends NodeBase {
|
|
|
7923
7924
|
}
|
|
7924
7925
|
parseNode(esTreeNode) {
|
|
7925
7926
|
const { body, params } = esTreeNode;
|
|
7926
|
-
const parameters = (this.params = []);
|
|
7927
7927
|
const { scope } = this;
|
|
7928
7928
|
const { bodyScope, context } = scope;
|
|
7929
7929
|
// We need to ensure that parameters are declared before the body is parsed
|
|
7930
7930
|
// so that the scope already knows all parameters and can detect conflicts
|
|
7931
7931
|
// when parsing the body.
|
|
7932
|
-
|
|
7933
|
-
parameters.push(new (context.getNodeConstructor(parameter.type))(this, scope).parseNode(parameter));
|
|
7934
|
-
}
|
|
7932
|
+
const parameters = (this.params = params.map((parameter) => new (context.getNodeConstructor(parameter.type))(this, scope).parseNode(parameter)));
|
|
7935
7933
|
scope.addParameterVariables(parameters.map(parameter => parameter.declare('parameter', UNKNOWN_EXPRESSION)), parameters[parameters.length - 1] instanceof RestElement);
|
|
7936
7934
|
this.body = new (context.getNodeConstructor(body.type))(this, bodyScope).parseNode(body);
|
|
7937
7935
|
return super.parseNode(esTreeNode);
|
|
@@ -12228,7 +12226,7 @@ class YieldExpression extends NodeBase {
|
|
|
12228
12226
|
}
|
|
12229
12227
|
}
|
|
12230
12228
|
|
|
12231
|
-
// This file is generated by scripts/generate-
|
|
12229
|
+
// This file is generated by scripts/generate-buffer-parsers.js.
|
|
12232
12230
|
// Do not edit this file directly.
|
|
12233
12231
|
function convertProgram(buffer, parent, parentScope) {
|
|
12234
12232
|
return convertNode(parent, parentScope, 0, new Uint32Array(buffer.buffer), getReadStringFunction(buffer));
|
|
@@ -12397,18 +12395,18 @@ const nodeConstructors$1 = [
|
|
|
12397
12395
|
];
|
|
12398
12396
|
const bufferParsers = [
|
|
12399
12397
|
function panicError(node, position, buffer, readString) {
|
|
12400
|
-
node.message = convertString(position, buffer, readString);
|
|
12398
|
+
node.message = convertString(buffer[position], buffer, readString);
|
|
12401
12399
|
},
|
|
12402
12400
|
function parseError(node, position, buffer, readString) {
|
|
12403
|
-
node.message = convertString(position, buffer, readString);
|
|
12401
|
+
node.message = convertString(buffer[position], buffer, readString);
|
|
12404
12402
|
},
|
|
12405
12403
|
function arrayExpression(node, position, buffer, readString) {
|
|
12406
12404
|
const { scope } = node;
|
|
12407
|
-
node.elements = convertNodeList(node, scope, position, buffer, readString);
|
|
12405
|
+
node.elements = convertNodeList(node, scope, buffer[position], buffer, readString);
|
|
12408
12406
|
},
|
|
12409
12407
|
function arrayPattern(node, position, buffer, readString) {
|
|
12410
12408
|
const { scope } = node;
|
|
12411
|
-
node.elements = convertNodeList(node, scope, position, buffer, readString);
|
|
12409
|
+
node.elements = convertNodeList(node, scope, buffer[position], buffer, readString);
|
|
12412
12410
|
},
|
|
12413
12411
|
function arrowFunctionExpression(node, position, buffer, readString) {
|
|
12414
12412
|
const { scope } = node;
|
|
@@ -12416,36 +12414,36 @@ const bufferParsers = [
|
|
|
12416
12414
|
node.async = (flags & 1) === 1;
|
|
12417
12415
|
node.expression = (flags & 2) === 2;
|
|
12418
12416
|
node.generator = (flags & 4) === 4;
|
|
12419
|
-
const
|
|
12420
|
-
scope.addParameterVariables(parameters.map(parameter => parameter.declare('parameter', UNKNOWN_EXPRESSION)), parameters[parameters.length - 1] instanceof RestElement);
|
|
12421
|
-
node.body = convertNode(node, scope.bodyScope, buffer[position + 2], buffer, readString);
|
|
12422
|
-
const annotations = (node.annotations = convertAnnotations(position + 3, buffer));
|
|
12417
|
+
const annotations = (node.annotations = convertAnnotations(buffer[position + 1], buffer));
|
|
12423
12418
|
node.annotationNoSideEffects = annotations.some(comment => comment.type === 'noSideEffects');
|
|
12419
|
+
const parameters = (node.params = convertNodeList(node, scope, buffer[position + 2], buffer, readString));
|
|
12420
|
+
scope.addParameterVariables(parameters.map(parameter => parameter.declare('parameter', UNKNOWN_EXPRESSION)), parameters[parameters.length - 1] instanceof RestElement);
|
|
12421
|
+
node.body = convertNode(node, scope.bodyScope, buffer[position + 3], buffer, readString);
|
|
12424
12422
|
},
|
|
12425
12423
|
function assignmentExpression(node, position, buffer, readString) {
|
|
12426
12424
|
const { scope } = node;
|
|
12427
12425
|
node.operator = FIXED_STRINGS[buffer[position]];
|
|
12428
|
-
node.
|
|
12429
|
-
node.
|
|
12426
|
+
node.left = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
12427
|
+
node.right = convertNode(node, scope, buffer[position + 2], buffer, readString);
|
|
12430
12428
|
},
|
|
12431
12429
|
function assignmentPattern(node, position, buffer, readString) {
|
|
12432
12430
|
const { scope } = node;
|
|
12433
|
-
node.
|
|
12434
|
-
node.
|
|
12431
|
+
node.left = convertNode(node, scope, buffer[position], buffer, readString);
|
|
12432
|
+
node.right = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
12435
12433
|
},
|
|
12436
12434
|
function awaitExpression(node, position, buffer, readString) {
|
|
12437
12435
|
const { scope } = node;
|
|
12438
|
-
node.argument = convertNode(node, scope, position, buffer, readString);
|
|
12436
|
+
node.argument = convertNode(node, scope, buffer[position], buffer, readString);
|
|
12439
12437
|
},
|
|
12440
12438
|
function binaryExpression(node, position, buffer, readString) {
|
|
12441
12439
|
const { scope } = node;
|
|
12442
12440
|
node.operator = FIXED_STRINGS[buffer[position]];
|
|
12443
|
-
node.
|
|
12444
|
-
node.
|
|
12441
|
+
node.left = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
12442
|
+
node.right = convertNode(node, scope, buffer[position + 2], buffer, readString);
|
|
12445
12443
|
},
|
|
12446
12444
|
function blockStatement(node, position, buffer, readString) {
|
|
12447
12445
|
const { scope } = node;
|
|
12448
|
-
node.body = convertNodeList(node, scope, position, buffer, readString);
|
|
12446
|
+
node.body = convertNodeList(node, scope, buffer[position], buffer, readString);
|
|
12449
12447
|
},
|
|
12450
12448
|
function breakStatement(node, position, buffer, readString) {
|
|
12451
12449
|
const { scope } = node;
|
|
@@ -12457,9 +12455,9 @@ const bufferParsers = [
|
|
|
12457
12455
|
const { scope } = node;
|
|
12458
12456
|
const flags = buffer[position];
|
|
12459
12457
|
node.optional = (flags & 1) === 1;
|
|
12460
|
-
node.
|
|
12461
|
-
node.
|
|
12462
|
-
node.
|
|
12458
|
+
node.annotations = convertAnnotations(buffer[position + 1], buffer);
|
|
12459
|
+
node.callee = convertNode(node, scope, buffer[position + 2], buffer, readString);
|
|
12460
|
+
node.arguments = convertNodeList(node, scope, buffer[position + 3], buffer, readString);
|
|
12463
12461
|
},
|
|
12464
12462
|
function catchClause(node, position, buffer, readString) {
|
|
12465
12463
|
const { scope } = node;
|
|
@@ -12473,15 +12471,18 @@ const bufferParsers = [
|
|
|
12473
12471
|
},
|
|
12474
12472
|
function chainExpression(node, position, buffer, readString) {
|
|
12475
12473
|
const { scope } = node;
|
|
12476
|
-
node.expression = convertNode(node, scope, position, buffer, readString);
|
|
12474
|
+
node.expression = convertNode(node, scope, buffer[position], buffer, readString);
|
|
12477
12475
|
},
|
|
12478
12476
|
function classBody(node, position, buffer, readString) {
|
|
12479
12477
|
const { scope } = node;
|
|
12480
|
-
const
|
|
12478
|
+
const bodyPosition = buffer[position];
|
|
12481
12479
|
const body = (node.body = []);
|
|
12482
|
-
|
|
12483
|
-
const
|
|
12484
|
-
|
|
12480
|
+
if (bodyPosition) {
|
|
12481
|
+
const length = buffer[bodyPosition];
|
|
12482
|
+
for (let index = 0; index < length; index++) {
|
|
12483
|
+
const nodePosition = buffer[bodyPosition + 1 + index];
|
|
12484
|
+
body.push(convertNode(node, (buffer[nodePosition + 3] & 1) === 0 ? scope.instanceScope : scope, nodePosition, buffer, readString));
|
|
12485
|
+
}
|
|
12485
12486
|
}
|
|
12486
12487
|
},
|
|
12487
12488
|
function classDeclaration(node, position, buffer, readString) {
|
|
@@ -12511,9 +12512,9 @@ const bufferParsers = [
|
|
|
12511
12512
|
},
|
|
12512
12513
|
function conditionalExpression(node, position, buffer, readString) {
|
|
12513
12514
|
const { scope } = node;
|
|
12514
|
-
node.
|
|
12515
|
-
node.
|
|
12516
|
-
node.
|
|
12515
|
+
node.test = convertNode(node, scope, buffer[position], buffer, readString);
|
|
12516
|
+
node.consequent = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
12517
|
+
node.alternate = convertNode(node, scope, buffer[position + 2], buffer, readString);
|
|
12517
12518
|
},
|
|
12518
12519
|
function continueStatement(node, position, buffer, readString) {
|
|
12519
12520
|
const { scope } = node;
|
|
@@ -12524,13 +12525,13 @@ const bufferParsers = [
|
|
|
12524
12525
|
function debuggerStatement() { },
|
|
12525
12526
|
function directive(node, position, buffer, readString) {
|
|
12526
12527
|
const { scope } = node;
|
|
12527
|
-
node.
|
|
12528
|
-
node.
|
|
12528
|
+
node.directive = convertString(buffer[position], buffer, readString);
|
|
12529
|
+
node.expression = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
12529
12530
|
},
|
|
12530
12531
|
function doWhileStatement(node, position, buffer, readString) {
|
|
12531
12532
|
const { scope } = node;
|
|
12532
|
-
node.
|
|
12533
|
-
node.
|
|
12533
|
+
node.body = convertNode(node, scope, buffer[position], buffer, readString);
|
|
12534
|
+
node.test = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
12534
12535
|
},
|
|
12535
12536
|
function emptyStatement() { },
|
|
12536
12537
|
function exportAllDeclaration(node, position, buffer, readString) {
|
|
@@ -12545,25 +12546,25 @@ const bufferParsers = [
|
|
|
12545
12546
|
},
|
|
12546
12547
|
function exportDefaultDeclaration(node, position, buffer, readString) {
|
|
12547
12548
|
const { scope } = node;
|
|
12548
|
-
node.declaration = convertNode(node, scope, position, buffer, readString);
|
|
12549
|
+
node.declaration = convertNode(node, scope, buffer[position], buffer, readString);
|
|
12549
12550
|
},
|
|
12550
12551
|
function exportNamedDeclaration(node, position, buffer, readString) {
|
|
12551
12552
|
const { scope } = node;
|
|
12552
|
-
|
|
12553
|
+
node.specifiers = convertNodeList(node, scope, buffer[position], buffer, readString);
|
|
12554
|
+
const sourcePosition = buffer[position + 1];
|
|
12553
12555
|
node.source =
|
|
12554
12556
|
sourcePosition === 0 ? null : convertNode(node, scope, sourcePosition, buffer, readString);
|
|
12555
|
-
node.attributes = convertNodeList(node, scope, buffer[position +
|
|
12556
|
-
const declarationPosition = buffer[position +
|
|
12557
|
+
node.attributes = convertNodeList(node, scope, buffer[position + 2], buffer, readString);
|
|
12558
|
+
const declarationPosition = buffer[position + 3];
|
|
12557
12559
|
node.declaration =
|
|
12558
12560
|
declarationPosition === 0
|
|
12559
12561
|
? null
|
|
12560
12562
|
: convertNode(node, scope, declarationPosition, buffer, readString);
|
|
12561
|
-
node.specifiers = convertNodeList(node, scope, position + 3, buffer, readString);
|
|
12562
12563
|
},
|
|
12563
12564
|
function exportSpecifier(node, position, buffer, readString) {
|
|
12564
12565
|
const { scope } = node;
|
|
12565
|
-
|
|
12566
|
-
|
|
12566
|
+
node.local = convertNode(node, scope, buffer[position], buffer, readString);
|
|
12567
|
+
const exportedPosition = buffer[position + 1];
|
|
12567
12568
|
node.exported =
|
|
12568
12569
|
exportedPosition === 0
|
|
12569
12570
|
? node.local
|
|
@@ -12571,21 +12572,21 @@ const bufferParsers = [
|
|
|
12571
12572
|
},
|
|
12572
12573
|
function expressionStatement(node, position, buffer, readString) {
|
|
12573
12574
|
const { scope } = node;
|
|
12574
|
-
node.expression = convertNode(node, scope, position, buffer, readString);
|
|
12575
|
+
node.expression = convertNode(node, scope, buffer[position], buffer, readString);
|
|
12575
12576
|
},
|
|
12576
12577
|
function forInStatement(node, position, buffer, readString) {
|
|
12577
12578
|
const { scope } = node;
|
|
12578
|
-
node.
|
|
12579
|
-
node.
|
|
12580
|
-
node.
|
|
12579
|
+
node.left = convertNode(node, scope, buffer[position], buffer, readString);
|
|
12580
|
+
node.right = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
12581
|
+
node.body = convertNode(node, scope, buffer[position + 2], buffer, readString);
|
|
12581
12582
|
},
|
|
12582
12583
|
function forOfStatement(node, position, buffer, readString) {
|
|
12583
12584
|
const { scope } = node;
|
|
12584
12585
|
const flags = buffer[position];
|
|
12585
12586
|
node.await = (flags & 1) === 1;
|
|
12586
|
-
node.
|
|
12587
|
-
node.
|
|
12588
|
-
node.
|
|
12587
|
+
node.left = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
12588
|
+
node.right = convertNode(node, scope, buffer[position + 2], buffer, readString);
|
|
12589
|
+
node.body = convertNode(node, scope, buffer[position + 3], buffer, readString);
|
|
12589
12590
|
},
|
|
12590
12591
|
function forStatement(node, position, buffer, readString) {
|
|
12591
12592
|
const { scope } = node;
|
|
@@ -12605,70 +12606,70 @@ const bufferParsers = [
|
|
|
12605
12606
|
const flags = buffer[position];
|
|
12606
12607
|
node.async = (flags & 1) === 1;
|
|
12607
12608
|
node.generator = (flags & 2) === 2;
|
|
12608
|
-
const
|
|
12609
|
+
const annotations = (node.annotations = convertAnnotations(buffer[position + 1], buffer));
|
|
12610
|
+
node.annotationNoSideEffects = annotations.some(comment => comment.type === 'noSideEffects');
|
|
12611
|
+
const idPosition = buffer[position + 2];
|
|
12609
12612
|
node.id =
|
|
12610
12613
|
idPosition === 0
|
|
12611
12614
|
? null
|
|
12612
12615
|
: convertNode(node, scope.parent, idPosition, buffer, readString);
|
|
12613
|
-
const parameters = (node.params = convertNodeList(node, scope, buffer[position +
|
|
12616
|
+
const parameters = (node.params = convertNodeList(node, scope, buffer[position + 3], buffer, readString));
|
|
12614
12617
|
scope.addParameterVariables(parameters.map(parameter => parameter.declare('parameter', UNKNOWN_EXPRESSION)), parameters[parameters.length - 1] instanceof RestElement);
|
|
12615
|
-
node.body = convertNode(node, scope.bodyScope, buffer[position +
|
|
12616
|
-
const annotations = (node.annotations = convertAnnotations(position + 4, buffer));
|
|
12617
|
-
node.annotationNoSideEffects = annotations.some(comment => comment.type === 'noSideEffects');
|
|
12618
|
+
node.body = convertNode(node, scope.bodyScope, buffer[position + 4], buffer, readString);
|
|
12618
12619
|
},
|
|
12619
12620
|
function functionExpression(node, position, buffer, readString) {
|
|
12620
12621
|
const { scope } = node;
|
|
12621
12622
|
const flags = buffer[position];
|
|
12622
12623
|
node.async = (flags & 1) === 1;
|
|
12623
12624
|
node.generator = (flags & 2) === 2;
|
|
12624
|
-
const
|
|
12625
|
+
const annotations = (node.annotations = convertAnnotations(buffer[position + 1], buffer));
|
|
12626
|
+
node.annotationNoSideEffects = annotations.some(comment => comment.type === 'noSideEffects');
|
|
12627
|
+
const idPosition = buffer[position + 2];
|
|
12625
12628
|
node.id =
|
|
12626
12629
|
idPosition === 0 ? null : convertNode(node, node.idScope, idPosition, buffer, readString);
|
|
12627
|
-
const parameters = (node.params = convertNodeList(node, scope, buffer[position +
|
|
12630
|
+
const parameters = (node.params = convertNodeList(node, scope, buffer[position + 3], buffer, readString));
|
|
12628
12631
|
scope.addParameterVariables(parameters.map(parameter => parameter.declare('parameter', UNKNOWN_EXPRESSION)), parameters[parameters.length - 1] instanceof RestElement);
|
|
12629
|
-
node.body = convertNode(node, scope.bodyScope, buffer[position +
|
|
12630
|
-
const annotations = (node.annotations = convertAnnotations(position + 4, buffer));
|
|
12631
|
-
node.annotationNoSideEffects = annotations.some(comment => comment.type === 'noSideEffects');
|
|
12632
|
+
node.body = convertNode(node, scope.bodyScope, buffer[position + 4], buffer, readString);
|
|
12632
12633
|
},
|
|
12633
12634
|
function identifier(node, position, buffer, readString) {
|
|
12634
|
-
node.name = convertString(position, buffer, readString);
|
|
12635
|
+
node.name = convertString(buffer[position], buffer, readString);
|
|
12635
12636
|
},
|
|
12636
12637
|
function ifStatement(node, position, buffer, readString) {
|
|
12637
12638
|
const { scope } = node;
|
|
12638
|
-
node.
|
|
12639
|
-
|
|
12639
|
+
node.test = convertNode(node, scope, buffer[position], buffer, readString);
|
|
12640
|
+
node.consequent = convertNode(node, (node.consequentScope = new TrackingScope(scope)), buffer[position + 1], buffer, readString);
|
|
12641
|
+
const alternatePosition = buffer[position + 2];
|
|
12640
12642
|
node.alternate =
|
|
12641
12643
|
alternatePosition === 0
|
|
12642
12644
|
? null
|
|
12643
12645
|
: convertNode(node, (node.alternateScope = new TrackingScope(scope)), alternatePosition, buffer, readString);
|
|
12644
|
-
node.test = convertNode(node, scope, position + 2, buffer, readString);
|
|
12645
12646
|
},
|
|
12646
12647
|
function importAttribute(node, position, buffer, readString) {
|
|
12647
12648
|
const { scope } = node;
|
|
12648
|
-
node.
|
|
12649
|
-
node.
|
|
12649
|
+
node.key = convertNode(node, scope, buffer[position], buffer, readString);
|
|
12650
|
+
node.value = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
12650
12651
|
},
|
|
12651
12652
|
function importDeclaration(node, position, buffer, readString) {
|
|
12652
12653
|
const { scope } = node;
|
|
12653
|
-
node.
|
|
12654
|
-
node.
|
|
12655
|
-
node.
|
|
12654
|
+
node.specifiers = convertNodeList(node, scope, buffer[position], buffer, readString);
|
|
12655
|
+
node.source = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
12656
|
+
node.attributes = convertNodeList(node, scope, buffer[position + 2], buffer, readString);
|
|
12656
12657
|
},
|
|
12657
12658
|
function importDefaultSpecifier(node, position, buffer, readString) {
|
|
12658
12659
|
const { scope } = node;
|
|
12659
|
-
node.local = convertNode(node, scope, position, buffer, readString);
|
|
12660
|
+
node.local = convertNode(node, scope, buffer[position], buffer, readString);
|
|
12660
12661
|
},
|
|
12661
12662
|
function importExpression(node, position, buffer, readString) {
|
|
12662
12663
|
const { scope } = node;
|
|
12663
|
-
|
|
12664
|
+
node.source = convertNode(node, scope, buffer[position], buffer, readString);
|
|
12665
|
+
node.sourceAstNode = convertNode$1(buffer[position], buffer, readString);
|
|
12666
|
+
const optionsPosition = buffer[position + 1];
|
|
12664
12667
|
node.options =
|
|
12665
12668
|
optionsPosition === 0 ? null : convertNode(node, scope, optionsPosition, buffer, readString);
|
|
12666
|
-
node.source = convertNode(node, scope, position + 1, buffer, readString);
|
|
12667
|
-
node.sourceAstNode = convertNode$1(position + 1, buffer, readString);
|
|
12668
12669
|
},
|
|
12669
12670
|
function importNamespaceSpecifier(node, position, buffer, readString) {
|
|
12670
12671
|
const { scope } = node;
|
|
12671
|
-
node.local = convertNode(node, scope, position, buffer, readString);
|
|
12672
|
+
node.local = convertNode(node, scope, buffer[position], buffer, readString);
|
|
12672
12673
|
},
|
|
12673
12674
|
function importSpecifier(node, position, buffer, readString) {
|
|
12674
12675
|
const { scope } = node;
|
|
@@ -12681,12 +12682,12 @@ const bufferParsers = [
|
|
|
12681
12682
|
},
|
|
12682
12683
|
function labeledStatement(node, position, buffer, readString) {
|
|
12683
12684
|
const { scope } = node;
|
|
12684
|
-
node.
|
|
12685
|
-
node.
|
|
12685
|
+
node.label = convertNode(node, scope, buffer[position], buffer, readString);
|
|
12686
|
+
node.body = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
12686
12687
|
},
|
|
12687
12688
|
function literalBigInt(node, position, buffer, readString) {
|
|
12688
|
-
node.
|
|
12689
|
-
|
|
12689
|
+
const bigint = (node.bigint = convertString(buffer[position], buffer, readString));
|
|
12690
|
+
node.raw = convertString(buffer[position + 1], buffer, readString);
|
|
12690
12691
|
node.value = BigInt(bigint);
|
|
12691
12692
|
},
|
|
12692
12693
|
function literalBoolean(node, position, buffer) {
|
|
@@ -12703,66 +12704,66 @@ const bufferParsers = [
|
|
|
12703
12704
|
node.value = new DataView(buffer.buffer).getFloat64((position + 1) << 2, true);
|
|
12704
12705
|
},
|
|
12705
12706
|
function literalRegExp(node, position, buffer, readString) {
|
|
12706
|
-
const
|
|
12707
|
-
const
|
|
12707
|
+
const flags = convertString(buffer[position], buffer, readString);
|
|
12708
|
+
const pattern = convertString(buffer[position + 1], buffer, readString);
|
|
12708
12709
|
node.raw = `/${pattern}/${flags}`;
|
|
12709
12710
|
node.regex = { flags, pattern };
|
|
12710
12711
|
node.value = new RegExp(pattern, flags);
|
|
12711
12712
|
},
|
|
12712
12713
|
function literalString(node, position, buffer, readString) {
|
|
12713
|
-
|
|
12714
|
+
node.value = convertString(buffer[position], buffer, readString);
|
|
12715
|
+
const rawPosition = buffer[position + 1];
|
|
12714
12716
|
node.raw = rawPosition === 0 ? undefined : convertString(rawPosition, buffer, readString);
|
|
12715
|
-
node.value = convertString(position + 1, buffer, readString);
|
|
12716
12717
|
},
|
|
12717
12718
|
function logicalExpression(node, position, buffer, readString) {
|
|
12718
12719
|
const { scope } = node;
|
|
12719
12720
|
node.operator = FIXED_STRINGS[buffer[position]];
|
|
12720
|
-
node.
|
|
12721
|
-
node.
|
|
12721
|
+
node.left = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
12722
|
+
node.right = convertNode(node, scope, buffer[position + 2], buffer, readString);
|
|
12722
12723
|
},
|
|
12723
12724
|
function memberExpression(node, position, buffer, readString) {
|
|
12724
12725
|
const { scope } = node;
|
|
12725
12726
|
const flags = buffer[position];
|
|
12726
12727
|
node.computed = (flags & 1) === 1;
|
|
12727
12728
|
node.optional = (flags & 2) === 2;
|
|
12728
|
-
node.
|
|
12729
|
-
node.
|
|
12729
|
+
node.object = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
12730
|
+
node.property = convertNode(node, scope, buffer[position + 2], buffer, readString);
|
|
12730
12731
|
},
|
|
12731
12732
|
function metaProperty(node, position, buffer, readString) {
|
|
12732
12733
|
const { scope } = node;
|
|
12733
|
-
node.
|
|
12734
|
-
node.
|
|
12734
|
+
node.meta = convertNode(node, scope, buffer[position], buffer, readString);
|
|
12735
|
+
node.property = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
12735
12736
|
},
|
|
12736
12737
|
function methodDefinition(node, position, buffer, readString) {
|
|
12737
12738
|
const { scope } = node;
|
|
12738
12739
|
const flags = buffer[position];
|
|
12739
12740
|
node.static = (flags & 1) === 1;
|
|
12740
12741
|
node.computed = (flags & 2) === 2;
|
|
12741
|
-
node.
|
|
12742
|
-
node.
|
|
12743
|
-
node.
|
|
12742
|
+
node.key = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
12743
|
+
node.value = convertNode(node, scope, buffer[position + 2], buffer, readString);
|
|
12744
|
+
node.kind = FIXED_STRINGS[buffer[position + 3]];
|
|
12744
12745
|
},
|
|
12745
12746
|
function newExpression(node, position, buffer, readString) {
|
|
12746
12747
|
const { scope } = node;
|
|
12747
|
-
node.
|
|
12748
|
-
node.
|
|
12749
|
-
node.
|
|
12748
|
+
node.annotations = convertAnnotations(buffer[position], buffer);
|
|
12749
|
+
node.callee = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
12750
|
+
node.arguments = convertNodeList(node, scope, buffer[position + 2], buffer, readString);
|
|
12750
12751
|
},
|
|
12751
12752
|
function objectExpression(node, position, buffer, readString) {
|
|
12752
12753
|
const { scope } = node;
|
|
12753
|
-
node.properties = convertNodeList(node, scope, position, buffer, readString);
|
|
12754
|
+
node.properties = convertNodeList(node, scope, buffer[position], buffer, readString);
|
|
12754
12755
|
},
|
|
12755
12756
|
function objectPattern(node, position, buffer, readString) {
|
|
12756
12757
|
const { scope } = node;
|
|
12757
|
-
node.properties = convertNodeList(node, scope, position, buffer, readString);
|
|
12758
|
+
node.properties = convertNodeList(node, scope, buffer[position], buffer, readString);
|
|
12758
12759
|
},
|
|
12759
12760
|
function privateIdentifier(node, position, buffer, readString) {
|
|
12760
|
-
node.name = convertString(position, buffer, readString);
|
|
12761
|
+
node.name = convertString(buffer[position], buffer, readString);
|
|
12761
12762
|
},
|
|
12762
12763
|
function program(node, position, buffer, readString) {
|
|
12763
12764
|
const { scope } = node;
|
|
12764
|
-
node.
|
|
12765
|
-
node.
|
|
12765
|
+
node.body = convertNodeList(node, scope, buffer[position], buffer, readString);
|
|
12766
|
+
node.invalidAnnotations = convertAnnotations(buffer[position + 1], buffer);
|
|
12766
12767
|
},
|
|
12767
12768
|
function property(node, position, buffer, readString) {
|
|
12768
12769
|
const { scope } = node;
|
|
@@ -12781,14 +12782,14 @@ const bufferParsers = [
|
|
|
12781
12782
|
const flags = buffer[position];
|
|
12782
12783
|
node.static = (flags & 1) === 1;
|
|
12783
12784
|
node.computed = (flags & 2) === 2;
|
|
12784
|
-
|
|
12785
|
+
node.key = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
12786
|
+
const valuePosition = buffer[position + 2];
|
|
12785
12787
|
node.value =
|
|
12786
12788
|
valuePosition === 0 ? null : convertNode(node, scope, valuePosition, buffer, readString);
|
|
12787
|
-
node.key = convertNode(node, scope, position + 2, buffer, readString);
|
|
12788
12789
|
},
|
|
12789
12790
|
function restElement(node, position, buffer, readString) {
|
|
12790
12791
|
const { scope } = node;
|
|
12791
|
-
node.argument = convertNode(node, scope, position, buffer, readString);
|
|
12792
|
+
node.argument = convertNode(node, scope, buffer[position], buffer, readString);
|
|
12792
12793
|
},
|
|
12793
12794
|
function returnStatement(node, position, buffer, readString) {
|
|
12794
12795
|
const { scope } = node;
|
|
@@ -12800,15 +12801,15 @@ const bufferParsers = [
|
|
|
12800
12801
|
},
|
|
12801
12802
|
function sequenceExpression(node, position, buffer, readString) {
|
|
12802
12803
|
const { scope } = node;
|
|
12803
|
-
node.expressions = convertNodeList(node, scope, position, buffer, readString);
|
|
12804
|
+
node.expressions = convertNodeList(node, scope, buffer[position], buffer, readString);
|
|
12804
12805
|
},
|
|
12805
12806
|
function spreadElement(node, position, buffer, readString) {
|
|
12806
12807
|
const { scope } = node;
|
|
12807
|
-
node.argument = convertNode(node, scope, position, buffer, readString);
|
|
12808
|
+
node.argument = convertNode(node, scope, buffer[position], buffer, readString);
|
|
12808
12809
|
},
|
|
12809
12810
|
function staticBlock(node, position, buffer, readString) {
|
|
12810
12811
|
const { scope } = node;
|
|
12811
|
-
node.body = convertNodeList(node, scope, position, buffer, readString);
|
|
12812
|
+
node.body = convertNodeList(node, scope, buffer[position], buffer, readString);
|
|
12812
12813
|
},
|
|
12813
12814
|
function superElement() { },
|
|
12814
12815
|
function switchCase(node, position, buffer, readString) {
|
|
@@ -12820,72 +12821,72 @@ const bufferParsers = [
|
|
|
12820
12821
|
},
|
|
12821
12822
|
function switchStatement(node, position, buffer, readString) {
|
|
12822
12823
|
const { scope } = node;
|
|
12823
|
-
node.
|
|
12824
|
-
node.
|
|
12824
|
+
node.discriminant = convertNode(node, node.parentScope, buffer[position], buffer, readString);
|
|
12825
|
+
node.cases = convertNodeList(node, scope, buffer[position + 1], buffer, readString);
|
|
12825
12826
|
},
|
|
12826
12827
|
function taggedTemplateExpression(node, position, buffer, readString) {
|
|
12827
12828
|
const { scope } = node;
|
|
12828
|
-
node.
|
|
12829
|
-
node.
|
|
12829
|
+
node.tag = convertNode(node, scope, buffer[position], buffer, readString);
|
|
12830
|
+
node.quasi = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
12830
12831
|
},
|
|
12831
12832
|
function templateElement(node, position, buffer, readString) {
|
|
12832
12833
|
const flags = buffer[position];
|
|
12833
12834
|
node.tail = (flags & 1) === 1;
|
|
12834
12835
|
const cookedPosition = buffer[position + 1];
|
|
12835
12836
|
const cooked = cookedPosition === 0 ? undefined : convertString(cookedPosition, buffer, readString);
|
|
12836
|
-
const raw = convertString(position + 2, buffer, readString);
|
|
12837
|
+
const raw = convertString(buffer[position + 2], buffer, readString);
|
|
12837
12838
|
node.value = { cooked, raw };
|
|
12838
12839
|
},
|
|
12839
12840
|
function templateLiteral(node, position, buffer, readString) {
|
|
12840
12841
|
const { scope } = node;
|
|
12841
|
-
node.
|
|
12842
|
-
node.
|
|
12842
|
+
node.quasis = convertNodeList(node, scope, buffer[position], buffer, readString);
|
|
12843
|
+
node.expressions = convertNodeList(node, scope, buffer[position + 1], buffer, readString);
|
|
12843
12844
|
},
|
|
12844
12845
|
function thisExpression() { },
|
|
12845
12846
|
function throwStatement(node, position, buffer, readString) {
|
|
12846
12847
|
const { scope } = node;
|
|
12847
|
-
node.argument = convertNode(node, scope, position, buffer, readString);
|
|
12848
|
+
node.argument = convertNode(node, scope, buffer[position], buffer, readString);
|
|
12848
12849
|
},
|
|
12849
12850
|
function tryStatement(node, position, buffer, readString) {
|
|
12850
12851
|
const { scope } = node;
|
|
12851
|
-
|
|
12852
|
+
node.block = convertNode(node, scope, buffer[position], buffer, readString);
|
|
12853
|
+
const handlerPosition = buffer[position + 1];
|
|
12852
12854
|
node.handler =
|
|
12853
12855
|
handlerPosition === 0 ? null : convertNode(node, scope, handlerPosition, buffer, readString);
|
|
12854
|
-
const finalizerPosition = buffer[position +
|
|
12856
|
+
const finalizerPosition = buffer[position + 2];
|
|
12855
12857
|
node.finalizer =
|
|
12856
12858
|
finalizerPosition === 0
|
|
12857
12859
|
? null
|
|
12858
12860
|
: convertNode(node, scope, finalizerPosition, buffer, readString);
|
|
12859
|
-
node.block = convertNode(node, scope, position + 2, buffer, readString);
|
|
12860
12861
|
},
|
|
12861
12862
|
function unaryExpression(node, position, buffer, readString) {
|
|
12862
12863
|
const { scope } = node;
|
|
12863
12864
|
node.operator = FIXED_STRINGS[buffer[position]];
|
|
12864
|
-
node.argument = convertNode(node, scope, position + 1, buffer, readString);
|
|
12865
|
+
node.argument = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
12865
12866
|
},
|
|
12866
12867
|
function updateExpression(node, position, buffer, readString) {
|
|
12867
12868
|
const { scope } = node;
|
|
12868
12869
|
const flags = buffer[position];
|
|
12869
12870
|
node.prefix = (flags & 1) === 1;
|
|
12870
12871
|
node.operator = FIXED_STRINGS[buffer[position + 1]];
|
|
12871
|
-
node.argument = convertNode(node, scope, position + 2, buffer, readString);
|
|
12872
|
+
node.argument = convertNode(node, scope, buffer[position + 2], buffer, readString);
|
|
12872
12873
|
},
|
|
12873
12874
|
function variableDeclaration(node, position, buffer, readString) {
|
|
12874
12875
|
const { scope } = node;
|
|
12875
12876
|
node.kind = FIXED_STRINGS[buffer[position]];
|
|
12876
|
-
node.declarations = convertNodeList(node, scope, position + 1, buffer, readString);
|
|
12877
|
+
node.declarations = convertNodeList(node, scope, buffer[position + 1], buffer, readString);
|
|
12877
12878
|
},
|
|
12878
12879
|
function variableDeclarator(node, position, buffer, readString) {
|
|
12879
12880
|
const { scope } = node;
|
|
12880
|
-
|
|
12881
|
+
node.id = convertNode(node, scope, buffer[position], buffer, readString);
|
|
12882
|
+
const initPosition = buffer[position + 1];
|
|
12881
12883
|
node.init =
|
|
12882
12884
|
initPosition === 0 ? null : convertNode(node, scope, initPosition, buffer, readString);
|
|
12883
|
-
node.id = convertNode(node, scope, position + 1, buffer, readString);
|
|
12884
12885
|
},
|
|
12885
12886
|
function whileStatement(node, position, buffer, readString) {
|
|
12886
12887
|
const { scope } = node;
|
|
12887
|
-
node.
|
|
12888
|
-
node.
|
|
12888
|
+
node.test = convertNode(node, scope, buffer[position], buffer, readString);
|
|
12889
|
+
node.body = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
12889
12890
|
},
|
|
12890
12891
|
function yieldExpression(node, position, buffer, readString) {
|
|
12891
12892
|
const { scope } = node;
|
|
@@ -12915,6 +12916,8 @@ function convertNode(parent, parentScope, position, buffer, readString) {
|
|
|
12915
12916
|
return node;
|
|
12916
12917
|
}
|
|
12917
12918
|
function convertNodeList(parent, parentScope, position, buffer, readString) {
|
|
12919
|
+
if (position === 0)
|
|
12920
|
+
return EMPTY_ARRAY;
|
|
12918
12921
|
const length = buffer[position++];
|
|
12919
12922
|
const list = [];
|
|
12920
12923
|
for (let index = 0; index < length; index++) {
|
|
@@ -16066,15 +16069,15 @@ class Chunk {
|
|
|
16066
16069
|
const renderedExports = exportMode === 'none' ? [] : this.getChunkExportDeclarations(format);
|
|
16067
16070
|
let hasExports = renderedExports.length > 0;
|
|
16068
16071
|
let hasDefaultExport = false;
|
|
16069
|
-
for (const
|
|
16070
|
-
const { reexports } =
|
|
16072
|
+
for (const renderedDependency of renderedDependencies) {
|
|
16073
|
+
const { reexports } = renderedDependency;
|
|
16071
16074
|
if (reexports?.length) {
|
|
16072
16075
|
hasExports = true;
|
|
16073
16076
|
if (!hasDefaultExport && reexports.some(reexport => reexport.reexported === 'default')) {
|
|
16074
16077
|
hasDefaultExport = true;
|
|
16075
16078
|
}
|
|
16076
16079
|
if (format === 'es') {
|
|
16077
|
-
|
|
16080
|
+
renderedDependency.reexports = reexports.filter(
|
|
16078
16081
|
// eslint-disable-next-line unicorn/prefer-array-some
|
|
16079
16082
|
({ reexported }) => !renderedExports.find(({ exported }) => exported === reexported));
|
|
16080
16083
|
}
|
|
@@ -16281,8 +16284,13 @@ class Chunk {
|
|
|
16281
16284
|
deconflictedDefault.add(chunk);
|
|
16282
16285
|
}
|
|
16283
16286
|
}
|
|
16284
|
-
else if (variable.
|
|
16285
|
-
namespaceInteropHelpersByInteropType[interop(module.id)]
|
|
16287
|
+
else if (variable.isNamespace &&
|
|
16288
|
+
namespaceInteropHelpersByInteropType[interop(module.id)] &&
|
|
16289
|
+
(this.imports.has(variable) ||
|
|
16290
|
+
!this.exportNamesByVariable.get(variable)?.every(name => name.startsWith('*')))) {
|
|
16291
|
+
// We only need to deconflict it if the namespace is actually
|
|
16292
|
+
// created as a variable, i.e. because it is used internally or
|
|
16293
|
+
// because it is reexported as an object
|
|
16286
16294
|
deconflictedNamespace.add(chunk);
|
|
16287
16295
|
}
|
|
16288
16296
|
}
|
|
@@ -16496,23 +16504,25 @@ class Chunk {
|
|
|
16496
16504
|
const reexportSpecifiers = this.getReexportSpecifiers();
|
|
16497
16505
|
const renderedDependencies = new Map();
|
|
16498
16506
|
const fileName = this.getFileName();
|
|
16499
|
-
for (const
|
|
16500
|
-
const imports = importSpecifiers.get(
|
|
16501
|
-
const reexports = reexportSpecifiers.get(
|
|
16502
|
-
const namedExportsMode =
|
|
16503
|
-
const importPath =
|
|
16504
|
-
renderedDependencies.set(
|
|
16505
|
-
attributes:
|
|
16506
|
-
|
|
16507
|
-
|
|
16507
|
+
for (const dependency of this.dependencies) {
|
|
16508
|
+
const imports = importSpecifiers.get(dependency) || null;
|
|
16509
|
+
const reexports = reexportSpecifiers.get(dependency) || null;
|
|
16510
|
+
const namedExportsMode = dependency instanceof ExternalChunk || dependency.exportMode !== 'default';
|
|
16511
|
+
const importPath = dependency.getImportPath(fileName);
|
|
16512
|
+
renderedDependencies.set(dependency, {
|
|
16513
|
+
attributes: dependency instanceof ExternalChunk
|
|
16514
|
+
? dependency.getImportAttributes(this.snippets)
|
|
16515
|
+
: null,
|
|
16516
|
+
defaultVariableName: dependency.defaultVariableName,
|
|
16517
|
+
globalName: dependency instanceof ExternalChunk &&
|
|
16508
16518
|
(this.outputOptions.format === 'umd' || this.outputOptions.format === 'iife') &&
|
|
16509
|
-
getGlobalName(
|
|
16519
|
+
getGlobalName(dependency, this.outputOptions.globals, (imports || reexports) !== null, this.inputOptions.onLog),
|
|
16510
16520
|
importPath,
|
|
16511
16521
|
imports,
|
|
16512
|
-
isChunk:
|
|
16513
|
-
name:
|
|
16522
|
+
isChunk: dependency instanceof Chunk,
|
|
16523
|
+
name: dependency.variableName,
|
|
16514
16524
|
namedExportsMode,
|
|
16515
|
-
namespaceVariableName:
|
|
16525
|
+
namespaceVariableName: dependency.namespaceVariableName,
|
|
16516
16526
|
reexports
|
|
16517
16527
|
});
|
|
16518
16528
|
}
|
|
@@ -17424,6 +17434,13 @@ const compareExecIndex = (unitA, unitB) => unitA.execIndex > unitB.execIndex ? 1
|
|
|
17424
17434
|
function sortByExecutionOrder(units) {
|
|
17425
17435
|
units.sort(compareExecIndex);
|
|
17426
17436
|
}
|
|
17437
|
+
// This process is currently faulty in so far as it only takes the first entry
|
|
17438
|
+
// module into account and assumes that dynamic imports are imported in a
|
|
17439
|
+
// certain order.
|
|
17440
|
+
// A better algorithm would follow every possible execution path and mark which
|
|
17441
|
+
// modules are executed before or after which other modules. THen the chunking
|
|
17442
|
+
// would need to take care that in each chunk, all modules are always executed
|
|
17443
|
+
// in the same sequence.
|
|
17427
17444
|
function analyseModuleExecution(entryModules) {
|
|
17428
17445
|
let nextExecIndex = 0;
|
|
17429
17446
|
const cyclePaths = [];
|