@rollup/wasm-node 4.18.0 → 4.19.0
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 +1 -1
- 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 +431 -397
- package/dist/es/shared/parseAst.js +491 -790
- package/dist/es/shared/watch.js +65 -52
- package/dist/getLogFilter.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/parseAst.js +2 -2
- package/dist/rollup.d.ts +19 -3
- package/dist/rollup.js +2 -2
- package/dist/shared/fsevents-importer.js +2 -2
- package/dist/shared/index.js +65 -52
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/parseAst.js +492 -791
- package/dist/shared/rollup.js +430 -396
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/dist/wasm-node/bindings_wasm.js +5 -5
- package/dist/wasm-node/bindings_wasm_bg.wasm +0 -0
- package/package.json +38 -33
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.19.0
|
|
4
|
+
Sat, 20 Jul 2024 05:45:44 GMT - commit 28546b5821efcb72c2eb05f422d986524647a0e3
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
8
8
|
Released under the MIT License.
|
|
9
9
|
*/
|
|
10
|
-
import { normalize, getImportPath, ExportDefaultDeclaration as ExportDefaultDeclaration$1, CallExpression as CallExpression$1, EMPTY_ARRAY, LOGLEVEL_WARN, logUnusedExternalImports, ANNOTATION_KEY, INVALID_ANNOTATION_KEY, Program as Program$1, BLANK, logIllegalImportReassignment, logRedeclarationError, CatchClause as CatchClause$1, logDuplicateArgumentNameError, logModuleLevelDirective, ReturnStatement as ReturnStatement$1, VariableDeclarator as VariableDeclarator$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,
|
|
10
|
+
import { normalize, getImportPath, ExportDefaultDeclaration as ExportDefaultDeclaration$1, CallExpression as CallExpression$1, EMPTY_ARRAY, LOGLEVEL_WARN, logUnusedExternalImports, ANNOTATION_KEY, INVALID_ANNOTATION_KEY, Program as Program$1, BLANK, logIllegalImportReassignment, logRedeclarationError, CatchClause as CatchClause$1, logDuplicateArgumentNameError, logModuleLevelDirective, ReturnStatement as ReturnStatement$1, VariableDeclarator as VariableDeclarator$1, Property as Property$1, logConstVariableReassignError, ExpressionStatement as ExpressionStatement$1, ArrowFunctionExpression as ArrowFunctionExpression$1, logMissingExport, EMPTY_SET, logCannotCallNamespace, logEval, StaticBlock as StaticBlock$1, BlockStatement as BlockStatement$1, getRollupError, logParseError, logModuleParseError, error, LOGLEVEL_INFO, logFirstSideEffect, locate, logInvalidAnnotation, Identifier as Identifier$1, logThisIsUndefined, getAstBuffer, 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, { 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.
|
|
19
|
+
var version = "4.19.0";
|
|
20
20
|
|
|
21
21
|
const comma = ','.charCodeAt(0);
|
|
22
22
|
const semicolon = ';'.charCodeAt(0);
|
|
@@ -28,6 +28,42 @@ for (let i = 0; i < chars$1.length; i++) {
|
|
|
28
28
|
intToChar[i] = c;
|
|
29
29
|
charToInt[c] = i;
|
|
30
30
|
}
|
|
31
|
+
function decodeInteger(reader, relative) {
|
|
32
|
+
let value = 0;
|
|
33
|
+
let shift = 0;
|
|
34
|
+
let integer = 0;
|
|
35
|
+
do {
|
|
36
|
+
const c = reader.next();
|
|
37
|
+
integer = charToInt[c];
|
|
38
|
+
value |= (integer & 31) << shift;
|
|
39
|
+
shift += 5;
|
|
40
|
+
} while (integer & 32);
|
|
41
|
+
const shouldNegate = value & 1;
|
|
42
|
+
value >>>= 1;
|
|
43
|
+
if (shouldNegate) {
|
|
44
|
+
value = -0x80000000 | -value;
|
|
45
|
+
}
|
|
46
|
+
return relative + value;
|
|
47
|
+
}
|
|
48
|
+
function encodeInteger(builder, num, relative) {
|
|
49
|
+
let delta = num - relative;
|
|
50
|
+
delta = delta < 0 ? (-delta << 1) | 1 : delta << 1;
|
|
51
|
+
do {
|
|
52
|
+
let clamped = delta & 0b011111;
|
|
53
|
+
delta >>>= 5;
|
|
54
|
+
if (delta > 0)
|
|
55
|
+
clamped |= 0b100000;
|
|
56
|
+
builder.write(intToChar[clamped]);
|
|
57
|
+
} while (delta > 0);
|
|
58
|
+
return num;
|
|
59
|
+
}
|
|
60
|
+
function hasMoreVlq(reader, max) {
|
|
61
|
+
if (reader.pos >= max)
|
|
62
|
+
return false;
|
|
63
|
+
return reader.peek() !== comma;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const bufLength = 1024 * 16;
|
|
31
67
|
// Provide a fallback for older environments.
|
|
32
68
|
const td = typeof TextDecoder !== 'undefined'
|
|
33
69
|
? /* #__PURE__ */ new TextDecoder()
|
|
@@ -47,74 +83,89 @@ const td = typeof TextDecoder !== 'undefined'
|
|
|
47
83
|
return out;
|
|
48
84
|
},
|
|
49
85
|
};
|
|
86
|
+
class StringWriter {
|
|
87
|
+
constructor() {
|
|
88
|
+
this.pos = 0;
|
|
89
|
+
this.out = '';
|
|
90
|
+
this.buffer = new Uint8Array(bufLength);
|
|
91
|
+
}
|
|
92
|
+
write(v) {
|
|
93
|
+
const { buffer } = this;
|
|
94
|
+
buffer[this.pos++] = v;
|
|
95
|
+
if (this.pos === bufLength) {
|
|
96
|
+
this.out += td.decode(buffer);
|
|
97
|
+
this.pos = 0;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
flush() {
|
|
101
|
+
const { buffer, out, pos } = this;
|
|
102
|
+
return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
class StringReader {
|
|
106
|
+
constructor(buffer) {
|
|
107
|
+
this.pos = 0;
|
|
108
|
+
this.buffer = buffer;
|
|
109
|
+
}
|
|
110
|
+
next() {
|
|
111
|
+
return this.buffer.charCodeAt(this.pos++);
|
|
112
|
+
}
|
|
113
|
+
peek() {
|
|
114
|
+
return this.buffer.charCodeAt(this.pos);
|
|
115
|
+
}
|
|
116
|
+
indexOf(char) {
|
|
117
|
+
const { buffer, pos } = this;
|
|
118
|
+
const idx = buffer.indexOf(char, pos);
|
|
119
|
+
return idx === -1 ? buffer.length : idx;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
50
123
|
function decode(mappings) {
|
|
51
|
-
const
|
|
124
|
+
const { length } = mappings;
|
|
125
|
+
const reader = new StringReader(mappings);
|
|
52
126
|
const decoded = [];
|
|
53
|
-
let
|
|
127
|
+
let genColumn = 0;
|
|
128
|
+
let sourcesIndex = 0;
|
|
129
|
+
let sourceLine = 0;
|
|
130
|
+
let sourceColumn = 0;
|
|
131
|
+
let namesIndex = 0;
|
|
54
132
|
do {
|
|
55
|
-
const semi = indexOf(
|
|
133
|
+
const semi = reader.indexOf(';');
|
|
56
134
|
const line = [];
|
|
57
135
|
let sorted = true;
|
|
58
136
|
let lastCol = 0;
|
|
59
|
-
|
|
60
|
-
|
|
137
|
+
genColumn = 0;
|
|
138
|
+
while (reader.pos < semi) {
|
|
61
139
|
let seg;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (col < lastCol)
|
|
140
|
+
genColumn = decodeInteger(reader, genColumn);
|
|
141
|
+
if (genColumn < lastCol)
|
|
65
142
|
sorted = false;
|
|
66
|
-
lastCol =
|
|
67
|
-
if (hasMoreVlq(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (hasMoreVlq(
|
|
72
|
-
|
|
73
|
-
seg = [
|
|
143
|
+
lastCol = genColumn;
|
|
144
|
+
if (hasMoreVlq(reader, semi)) {
|
|
145
|
+
sourcesIndex = decodeInteger(reader, sourcesIndex);
|
|
146
|
+
sourceLine = decodeInteger(reader, sourceLine);
|
|
147
|
+
sourceColumn = decodeInteger(reader, sourceColumn);
|
|
148
|
+
if (hasMoreVlq(reader, semi)) {
|
|
149
|
+
namesIndex = decodeInteger(reader, namesIndex);
|
|
150
|
+
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
|
|
74
151
|
}
|
|
75
152
|
else {
|
|
76
|
-
seg = [
|
|
153
|
+
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
|
|
77
154
|
}
|
|
78
155
|
}
|
|
79
156
|
else {
|
|
80
|
-
seg = [
|
|
157
|
+
seg = [genColumn];
|
|
81
158
|
}
|
|
82
159
|
line.push(seg);
|
|
160
|
+
reader.pos++;
|
|
83
161
|
}
|
|
84
162
|
if (!sorted)
|
|
85
163
|
sort(line);
|
|
86
164
|
decoded.push(line);
|
|
87
|
-
|
|
88
|
-
} while (
|
|
165
|
+
reader.pos = semi + 1;
|
|
166
|
+
} while (reader.pos <= length);
|
|
89
167
|
return decoded;
|
|
90
168
|
}
|
|
91
|
-
function indexOf(mappings, index) {
|
|
92
|
-
const idx = mappings.indexOf(';', index);
|
|
93
|
-
return idx === -1 ? mappings.length : idx;
|
|
94
|
-
}
|
|
95
|
-
function decodeInteger(mappings, pos, state, j) {
|
|
96
|
-
let value = 0;
|
|
97
|
-
let shift = 0;
|
|
98
|
-
let integer = 0;
|
|
99
|
-
do {
|
|
100
|
-
const c = mappings.charCodeAt(pos++);
|
|
101
|
-
integer = charToInt[c];
|
|
102
|
-
value |= (integer & 31) << shift;
|
|
103
|
-
shift += 5;
|
|
104
|
-
} while (integer & 32);
|
|
105
|
-
const shouldNegate = value & 1;
|
|
106
|
-
value >>>= 1;
|
|
107
|
-
if (shouldNegate) {
|
|
108
|
-
value = -0x80000000 | -value;
|
|
109
|
-
}
|
|
110
|
-
state[j] += value;
|
|
111
|
-
return pos;
|
|
112
|
-
}
|
|
113
|
-
function hasMoreVlq(mappings, i, length) {
|
|
114
|
-
if (i >= length)
|
|
115
|
-
return false;
|
|
116
|
-
return mappings.charCodeAt(i) !== comma;
|
|
117
|
-
}
|
|
118
169
|
function sort(line) {
|
|
119
170
|
line.sort(sortComparator);
|
|
120
171
|
}
|
|
@@ -122,62 +173,34 @@ function sortComparator(a, b) {
|
|
|
122
173
|
return a[0] - b[0];
|
|
123
174
|
}
|
|
124
175
|
function encode(decoded) {
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
let pos = 0;
|
|
131
|
-
let out = '';
|
|
176
|
+
const writer = new StringWriter();
|
|
177
|
+
let sourcesIndex = 0;
|
|
178
|
+
let sourceLine = 0;
|
|
179
|
+
let sourceColumn = 0;
|
|
180
|
+
let namesIndex = 0;
|
|
132
181
|
for (let i = 0; i < decoded.length; i++) {
|
|
133
182
|
const line = decoded[i];
|
|
134
|
-
if (i > 0)
|
|
135
|
-
|
|
136
|
-
out += td.decode(buf);
|
|
137
|
-
pos = 0;
|
|
138
|
-
}
|
|
139
|
-
buf[pos++] = semicolon;
|
|
140
|
-
}
|
|
183
|
+
if (i > 0)
|
|
184
|
+
writer.write(semicolon);
|
|
141
185
|
if (line.length === 0)
|
|
142
186
|
continue;
|
|
143
|
-
|
|
187
|
+
let genColumn = 0;
|
|
144
188
|
for (let j = 0; j < line.length; j++) {
|
|
145
189
|
const segment = line[j];
|
|
146
|
-
// We can push up to 5 ints, each int can take at most 7 chars, and we
|
|
147
|
-
// may push a comma.
|
|
148
|
-
if (pos > subLength) {
|
|
149
|
-
out += td.decode(sub);
|
|
150
|
-
buf.copyWithin(0, subLength, pos);
|
|
151
|
-
pos -= subLength;
|
|
152
|
-
}
|
|
153
190
|
if (j > 0)
|
|
154
|
-
|
|
155
|
-
|
|
191
|
+
writer.write(comma);
|
|
192
|
+
genColumn = encodeInteger(writer, segment[0], genColumn);
|
|
156
193
|
if (segment.length === 1)
|
|
157
194
|
continue;
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
195
|
+
sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
|
|
196
|
+
sourceLine = encodeInteger(writer, segment[2], sourceLine);
|
|
197
|
+
sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
|
|
161
198
|
if (segment.length === 4)
|
|
162
199
|
continue;
|
|
163
|
-
|
|
200
|
+
namesIndex = encodeInteger(writer, segment[4], namesIndex);
|
|
164
201
|
}
|
|
165
202
|
}
|
|
166
|
-
return
|
|
167
|
-
}
|
|
168
|
-
function encodeInteger(buf, pos, state, segment, j) {
|
|
169
|
-
const next = segment[j];
|
|
170
|
-
let num = next - state[j];
|
|
171
|
-
state[j] = next;
|
|
172
|
-
num = num < 0 ? (-num << 1) | 1 : num << 1;
|
|
173
|
-
do {
|
|
174
|
-
let clamped = num & 0b011111;
|
|
175
|
-
num >>>= 5;
|
|
176
|
-
if (num > 0)
|
|
177
|
-
clamped |= 0b100000;
|
|
178
|
-
buf[pos++] = intToChar[clamped];
|
|
179
|
-
} while (num > 0);
|
|
180
|
-
return pos;
|
|
203
|
+
return writer.flush();
|
|
181
204
|
}
|
|
182
205
|
|
|
183
206
|
class BitSet {
|
|
@@ -4676,11 +4699,12 @@ const childNodeKeys = {
|
|
|
4676
4699
|
CatchClause: ['param', 'body'],
|
|
4677
4700
|
ChainExpression: ['expression'],
|
|
4678
4701
|
ClassBody: ['body'],
|
|
4679
|
-
ClassDeclaration: ['id', 'superClass', 'body'],
|
|
4680
|
-
ClassExpression: ['id', 'superClass', 'body'],
|
|
4702
|
+
ClassDeclaration: ['decorators', 'id', 'superClass', 'body'],
|
|
4703
|
+
ClassExpression: ['decorators', 'id', 'superClass', 'body'],
|
|
4681
4704
|
ConditionalExpression: ['test', 'consequent', 'alternate'],
|
|
4682
4705
|
ContinueStatement: ['label'],
|
|
4683
4706
|
DebuggerStatement: [],
|
|
4707
|
+
Decorator: ['expression'],
|
|
4684
4708
|
DoWhileStatement: ['body', 'test'],
|
|
4685
4709
|
EmptyStatement: [],
|
|
4686
4710
|
ExportAllDeclaration: ['exported', 'source', 'attributes'],
|
|
@@ -4706,7 +4730,7 @@ const childNodeKeys = {
|
|
|
4706
4730
|
LogicalExpression: ['left', 'right'],
|
|
4707
4731
|
MemberExpression: ['object', 'property'],
|
|
4708
4732
|
MetaProperty: ['meta', 'property'],
|
|
4709
|
-
MethodDefinition: ['key', 'value'],
|
|
4733
|
+
MethodDefinition: ['decorators', 'key', 'value'],
|
|
4710
4734
|
NewExpression: ['callee', 'arguments'],
|
|
4711
4735
|
ObjectExpression: ['properties'],
|
|
4712
4736
|
ObjectPattern: ['properties'],
|
|
@@ -4715,7 +4739,7 @@ const childNodeKeys = {
|
|
|
4715
4739
|
PrivateIdentifier: [],
|
|
4716
4740
|
Program: ['body'],
|
|
4717
4741
|
Property: ['key', 'value'],
|
|
4718
|
-
PropertyDefinition: ['key', 'value'],
|
|
4742
|
+
PropertyDefinition: ['decorators', 'key', 'value'],
|
|
4719
4743
|
RestElement: ['argument'],
|
|
4720
4744
|
ReturnStatement: ['argument'],
|
|
4721
4745
|
SequenceExpression: ['expressions'],
|
|
@@ -5200,10 +5224,10 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
5200
5224
|
}
|
|
5201
5225
|
const key = path[0];
|
|
5202
5226
|
if (path.length === 1) {
|
|
5203
|
-
if (
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5227
|
+
if (key === UnknownInteger) {
|
|
5228
|
+
return this.deoptimizeIntegerProperties();
|
|
5229
|
+
}
|
|
5230
|
+
else if (typeof key !== 'string') {
|
|
5207
5231
|
return this.deoptimizeAllProperties(key === UnknownNonAccessorKey);
|
|
5208
5232
|
}
|
|
5209
5233
|
if (!this.deoptimizedPaths[key]) {
|
|
@@ -9285,6 +9309,15 @@ class ClassBody extends NodeBase {
|
|
|
9285
9309
|
applyDeoptimizations() { }
|
|
9286
9310
|
}
|
|
9287
9311
|
|
|
9312
|
+
function checkEffectForNodes(nodes, context) {
|
|
9313
|
+
for (const node of nodes) {
|
|
9314
|
+
if (node.hasEffects(context)) {
|
|
9315
|
+
return true;
|
|
9316
|
+
}
|
|
9317
|
+
}
|
|
9318
|
+
return false;
|
|
9319
|
+
}
|
|
9320
|
+
|
|
9288
9321
|
class MethodBase extends NodeBase {
|
|
9289
9322
|
constructor() {
|
|
9290
9323
|
super(...arguments);
|
|
@@ -9362,9 +9395,44 @@ class MethodBase extends NodeBase {
|
|
|
9362
9395
|
}
|
|
9363
9396
|
|
|
9364
9397
|
class MethodDefinition extends MethodBase {
|
|
9398
|
+
hasEffects(context) {
|
|
9399
|
+
return super.hasEffects(context) || checkEffectForNodes(this.decorators, context);
|
|
9400
|
+
}
|
|
9365
9401
|
applyDeoptimizations() { }
|
|
9366
9402
|
}
|
|
9367
9403
|
|
|
9404
|
+
class StaticBlock extends NodeBase {
|
|
9405
|
+
createScope(parentScope) {
|
|
9406
|
+
this.scope = new BlockScope(parentScope);
|
|
9407
|
+
}
|
|
9408
|
+
hasEffects(context) {
|
|
9409
|
+
for (const node of this.body) {
|
|
9410
|
+
if (node.hasEffects(context))
|
|
9411
|
+
return true;
|
|
9412
|
+
}
|
|
9413
|
+
return false;
|
|
9414
|
+
}
|
|
9415
|
+
include(context, includeChildrenRecursively) {
|
|
9416
|
+
this.included = true;
|
|
9417
|
+
for (const node of this.body) {
|
|
9418
|
+
if (includeChildrenRecursively || node.shouldBeIncluded(context))
|
|
9419
|
+
node.include(context, includeChildrenRecursively);
|
|
9420
|
+
}
|
|
9421
|
+
}
|
|
9422
|
+
render(code, options) {
|
|
9423
|
+
if (this.body.length > 0) {
|
|
9424
|
+
const bodyStartPos = findFirstOccurrenceOutsideComment(code.original.slice(this.start, this.end), '{') + 1;
|
|
9425
|
+
renderStatementList(this.body, code, this.start + bodyStartPos, this.end - 1, options);
|
|
9426
|
+
}
|
|
9427
|
+
else {
|
|
9428
|
+
super.render(code, options);
|
|
9429
|
+
}
|
|
9430
|
+
}
|
|
9431
|
+
}
|
|
9432
|
+
function isStaticBlock(statement) {
|
|
9433
|
+
return statement.type === StaticBlock$1;
|
|
9434
|
+
}
|
|
9435
|
+
|
|
9368
9436
|
class ObjectMember extends ExpressionEntity {
|
|
9369
9437
|
constructor(object, key) {
|
|
9370
9438
|
super();
|
|
@@ -9416,7 +9484,7 @@ class ClassNode extends NodeBase {
|
|
|
9416
9484
|
this.applyDeoptimizations();
|
|
9417
9485
|
const initEffect = this.superClass?.hasEffects(context) || this.body.hasEffects(context);
|
|
9418
9486
|
this.id?.markDeclarationReached();
|
|
9419
|
-
return initEffect || super.hasEffects(context);
|
|
9487
|
+
return initEffect || super.hasEffects(context) || checkEffectForNodes(this.decorators, context);
|
|
9420
9488
|
}
|
|
9421
9489
|
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
9422
9490
|
return interaction.type === INTERACTION_CALLED && path.length === 0
|
|
@@ -9433,6 +9501,8 @@ class ClassNode extends NodeBase {
|
|
|
9433
9501
|
this.included = true;
|
|
9434
9502
|
this.superClass?.include(context, includeChildrenRecursively);
|
|
9435
9503
|
this.body.include(context, includeChildrenRecursively);
|
|
9504
|
+
for (const decorator of this.decorators)
|
|
9505
|
+
decorator.include(context, includeChildrenRecursively);
|
|
9436
9506
|
if (this.id) {
|
|
9437
9507
|
this.id.markDeclarationReached();
|
|
9438
9508
|
this.id.include();
|
|
@@ -9452,8 +9522,9 @@ class ClassNode extends NodeBase {
|
|
|
9452
9522
|
applyDeoptimizations() {
|
|
9453
9523
|
this.deoptimized = true;
|
|
9454
9524
|
for (const definition of this.body.body) {
|
|
9455
|
-
if (!(definition
|
|
9456
|
-
(definition
|
|
9525
|
+
if (!isStaticBlock(definition) &&
|
|
9526
|
+
!(definition.static ||
|
|
9527
|
+
(definition instanceof MethodDefinition && definition.kind === 'constructor'))) {
|
|
9457
9528
|
// Calls to methods are not tracked, ensure that the return value is deoptimized
|
|
9458
9529
|
definition.deoptimizePath(UNKNOWN_PATH);
|
|
9459
9530
|
}
|
|
@@ -9467,6 +9538,8 @@ class ClassNode extends NodeBase {
|
|
|
9467
9538
|
const staticProperties = [];
|
|
9468
9539
|
const dynamicMethods = [];
|
|
9469
9540
|
for (const definition of this.body.body) {
|
|
9541
|
+
if (isStaticBlock(definition))
|
|
9542
|
+
continue;
|
|
9470
9543
|
const properties = definition.static ? staticProperties : dynamicMethods;
|
|
9471
9544
|
const definitionKind = definition.kind;
|
|
9472
9545
|
// Note that class fields do not end up on the prototype
|
|
@@ -9523,6 +9596,7 @@ class ClassDeclaration extends ClassNode {
|
|
|
9523
9596
|
}
|
|
9524
9597
|
const renderedVariable = variable.getName(getPropertyAccess);
|
|
9525
9598
|
if (renderedVariable !== name) {
|
|
9599
|
+
this.decorators.map(decorator => decorator.render(code, options));
|
|
9526
9600
|
this.superClass?.render(code, options);
|
|
9527
9601
|
this.body.render(code, {
|
|
9528
9602
|
...options,
|
|
@@ -9758,6 +9832,13 @@ class DebuggerStatement extends NodeBase {
|
|
|
9758
9832
|
}
|
|
9759
9833
|
}
|
|
9760
9834
|
|
|
9835
|
+
class Decorator extends NodeBase {
|
|
9836
|
+
hasEffects(context) {
|
|
9837
|
+
return (this.expression.hasEffects(context) ||
|
|
9838
|
+
this.expression.hasEffectsOnInteractionAtPath(EMPTY_PATH, NODE_INTERACTION_UNKNOWN_CALL, context));
|
|
9839
|
+
}
|
|
9840
|
+
}
|
|
9841
|
+
|
|
9761
9842
|
function hasLoopBodyEffects(context, body) {
|
|
9762
9843
|
const { brokenFlow, hasBreak, hasContinue, ignore } = context;
|
|
9763
9844
|
const { breaks, continues } = ignore;
|
|
@@ -11010,8 +11091,8 @@ class LogicalExpression extends NodeBase {
|
|
|
11010
11091
|
}
|
|
11011
11092
|
render(code, options, { isCalleeOfRenderedParent, preventASI, renderedParentType, renderedSurroundingElement } = BLANK) {
|
|
11012
11093
|
if (!this.left.included || !this.right.included) {
|
|
11013
|
-
const operatorPos = findFirstOccurrenceOutsideComment(code.original, this.operator, this.left.end);
|
|
11014
11094
|
if (this.right.included) {
|
|
11095
|
+
const operatorPos = findFirstOccurrenceOutsideComment(code.original, this.operator, this.left.end);
|
|
11015
11096
|
const removePos = findNonWhiteSpace(code.original, operatorPos + 2);
|
|
11016
11097
|
code.remove(this.start, removePos);
|
|
11017
11098
|
if (preventASI) {
|
|
@@ -11020,7 +11101,7 @@ class LogicalExpression extends NodeBase {
|
|
|
11020
11101
|
this.left.removeAnnotations(code);
|
|
11021
11102
|
}
|
|
11022
11103
|
else {
|
|
11023
|
-
code.remove(
|
|
11104
|
+
code.remove(this.left.end, this.end);
|
|
11024
11105
|
}
|
|
11025
11106
|
this.getUsedBranch().render(code, options, {
|
|
11026
11107
|
isCalleeOfRenderedParent,
|
|
@@ -11480,7 +11561,9 @@ class PropertyDefinition extends NodeBase {
|
|
|
11480
11561
|
: UNKNOWN_RETURN_EXPRESSION;
|
|
11481
11562
|
}
|
|
11482
11563
|
hasEffects(context) {
|
|
11483
|
-
return this.key.hasEffects(context) ||
|
|
11564
|
+
return (this.key.hasEffects(context) ||
|
|
11565
|
+
(this.static && !!this.value?.hasEffects(context)) ||
|
|
11566
|
+
checkEffectForNodes(this.decorators, context));
|
|
11484
11567
|
}
|
|
11485
11568
|
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
11486
11569
|
return !this.value || this.value.hasEffectsOnInteractionAtPath(path, interaction, context);
|
|
@@ -11579,35 +11662,6 @@ class SequenceExpression extends NodeBase {
|
|
|
11579
11662
|
}
|
|
11580
11663
|
}
|
|
11581
11664
|
|
|
11582
|
-
class StaticBlock extends NodeBase {
|
|
11583
|
-
createScope(parentScope) {
|
|
11584
|
-
this.scope = new BlockScope(parentScope);
|
|
11585
|
-
}
|
|
11586
|
-
hasEffects(context) {
|
|
11587
|
-
for (const node of this.body) {
|
|
11588
|
-
if (node.hasEffects(context))
|
|
11589
|
-
return true;
|
|
11590
|
-
}
|
|
11591
|
-
return false;
|
|
11592
|
-
}
|
|
11593
|
-
include(context, includeChildrenRecursively) {
|
|
11594
|
-
this.included = true;
|
|
11595
|
-
for (const node of this.body) {
|
|
11596
|
-
if (includeChildrenRecursively || node.shouldBeIncluded(context))
|
|
11597
|
-
node.include(context, includeChildrenRecursively);
|
|
11598
|
-
}
|
|
11599
|
-
}
|
|
11600
|
-
render(code, options) {
|
|
11601
|
-
if (this.body.length > 0) {
|
|
11602
|
-
const bodyStartPos = findFirstOccurrenceOutsideComment(code.original.slice(this.start, this.end), '{') + 1;
|
|
11603
|
-
renderStatementList(this.body, code, this.start + bodyStartPos, this.end - 1, options);
|
|
11604
|
-
}
|
|
11605
|
-
else {
|
|
11606
|
-
super.render(code, options);
|
|
11607
|
-
}
|
|
11608
|
-
}
|
|
11609
|
-
}
|
|
11610
|
-
|
|
11611
11665
|
class Super extends NodeBase {
|
|
11612
11666
|
bind() {
|
|
11613
11667
|
this.variable = this.scope.findVariable('this');
|
|
@@ -12396,7 +12450,7 @@ class YieldExpression extends NodeBase {
|
|
|
12396
12450
|
// This file is generated by scripts/generate-buffer-parsers.js.
|
|
12397
12451
|
// Do not edit this file directly.
|
|
12398
12452
|
function convertProgram(buffer, parent, parentScope) {
|
|
12399
|
-
return convertNode(parent, parentScope, 0,
|
|
12453
|
+
return convertNode(parent, parentScope, 0, getAstBuffer(buffer));
|
|
12400
12454
|
}
|
|
12401
12455
|
const nodeTypeStrings = [
|
|
12402
12456
|
'PanicError',
|
|
@@ -12419,6 +12473,7 @@ const nodeTypeStrings = [
|
|
|
12419
12473
|
'ConditionalExpression',
|
|
12420
12474
|
'ContinueStatement',
|
|
12421
12475
|
'DebuggerStatement',
|
|
12476
|
+
'Decorator',
|
|
12422
12477
|
'ExpressionStatement',
|
|
12423
12478
|
'DoWhileStatement',
|
|
12424
12479
|
'EmptyStatement',
|
|
@@ -12500,6 +12555,7 @@ const nodeConstructors$1 = [
|
|
|
12500
12555
|
ConditionalExpression,
|
|
12501
12556
|
ContinueStatement,
|
|
12502
12557
|
DebuggerStatement,
|
|
12558
|
+
Decorator,
|
|
12503
12559
|
ExpressionStatement,
|
|
12504
12560
|
DoWhileStatement,
|
|
12505
12561
|
EmptyStatement,
|
|
@@ -12561,21 +12617,21 @@ const nodeConstructors$1 = [
|
|
|
12561
12617
|
YieldExpression
|
|
12562
12618
|
];
|
|
12563
12619
|
const bufferParsers = [
|
|
12564
|
-
function panicError(node, position, buffer
|
|
12565
|
-
node.message = convertString(buffer[position]
|
|
12620
|
+
function panicError(node, position, buffer) {
|
|
12621
|
+
node.message = buffer.convertString(buffer[position]);
|
|
12566
12622
|
},
|
|
12567
|
-
function parseError(node, position, buffer
|
|
12568
|
-
node.message = convertString(buffer[position]
|
|
12623
|
+
function parseError(node, position, buffer) {
|
|
12624
|
+
node.message = buffer.convertString(buffer[position]);
|
|
12569
12625
|
},
|
|
12570
|
-
function arrayExpression(node, position, buffer
|
|
12626
|
+
function arrayExpression(node, position, buffer) {
|
|
12571
12627
|
const { scope } = node;
|
|
12572
|
-
node.elements = convertNodeList(node, scope, buffer[position], buffer
|
|
12628
|
+
node.elements = convertNodeList(node, scope, buffer[position], buffer);
|
|
12573
12629
|
},
|
|
12574
|
-
function arrayPattern(node, position, buffer
|
|
12630
|
+
function arrayPattern(node, position, buffer) {
|
|
12575
12631
|
const { scope } = node;
|
|
12576
|
-
node.elements = convertNodeList(node, scope, buffer[position], buffer
|
|
12632
|
+
node.elements = convertNodeList(node, scope, buffer[position], buffer);
|
|
12577
12633
|
},
|
|
12578
|
-
function arrowFunctionExpression(node, position, buffer
|
|
12634
|
+
function arrowFunctionExpression(node, position, buffer) {
|
|
12579
12635
|
const { scope } = node;
|
|
12580
12636
|
const flags = buffer[position];
|
|
12581
12637
|
node.async = (flags & 1) === 1;
|
|
@@ -12583,64 +12639,61 @@ const bufferParsers = [
|
|
|
12583
12639
|
node.generator = (flags & 4) === 4;
|
|
12584
12640
|
const annotations = (node.annotations = convertAnnotations(buffer[position + 1], buffer));
|
|
12585
12641
|
node.annotationNoSideEffects = annotations.some(comment => comment.type === 'noSideEffects');
|
|
12586
|
-
const parameters = (node.params = convertNodeList(node, scope, buffer[position + 2], buffer
|
|
12642
|
+
const parameters = (node.params = convertNodeList(node, scope, buffer[position + 2], buffer));
|
|
12587
12643
|
scope.addParameterVariables(parameters.map(parameter => parameter.declare('parameter', UNKNOWN_EXPRESSION)), parameters[parameters.length - 1] instanceof RestElement);
|
|
12588
|
-
node.body = convertNode(node, scope.bodyScope, buffer[position + 3], buffer
|
|
12644
|
+
node.body = convertNode(node, scope.bodyScope, buffer[position + 3], buffer);
|
|
12589
12645
|
},
|
|
12590
|
-
function assignmentExpression(node, position, buffer
|
|
12646
|
+
function assignmentExpression(node, position, buffer) {
|
|
12591
12647
|
const { scope } = node;
|
|
12592
12648
|
node.operator = FIXED_STRINGS[buffer[position]];
|
|
12593
|
-
node.left = convertNode(node, scope, buffer[position + 1], buffer
|
|
12594
|
-
node.right = convertNode(node, scope, buffer[position + 2], buffer
|
|
12649
|
+
node.left = convertNode(node, scope, buffer[position + 1], buffer);
|
|
12650
|
+
node.right = convertNode(node, scope, buffer[position + 2], buffer);
|
|
12595
12651
|
},
|
|
12596
|
-
function assignmentPattern(node, position, buffer
|
|
12652
|
+
function assignmentPattern(node, position, buffer) {
|
|
12597
12653
|
const { scope } = node;
|
|
12598
|
-
node.left = convertNode(node, scope, buffer[position], buffer
|
|
12599
|
-
node.right = convertNode(node, scope, buffer[position + 1], buffer
|
|
12654
|
+
node.left = convertNode(node, scope, buffer[position], buffer);
|
|
12655
|
+
node.right = convertNode(node, scope, buffer[position + 1], buffer);
|
|
12600
12656
|
},
|
|
12601
|
-
function awaitExpression(node, position, buffer
|
|
12657
|
+
function awaitExpression(node, position, buffer) {
|
|
12602
12658
|
const { scope } = node;
|
|
12603
|
-
node.argument = convertNode(node, scope, buffer[position], buffer
|
|
12659
|
+
node.argument = convertNode(node, scope, buffer[position], buffer);
|
|
12604
12660
|
},
|
|
12605
|
-
function binaryExpression(node, position, buffer
|
|
12661
|
+
function binaryExpression(node, position, buffer) {
|
|
12606
12662
|
const { scope } = node;
|
|
12607
12663
|
node.operator = FIXED_STRINGS[buffer[position]];
|
|
12608
|
-
node.left = convertNode(node, scope, buffer[position + 1], buffer
|
|
12609
|
-
node.right = convertNode(node, scope, buffer[position + 2], buffer
|
|
12664
|
+
node.left = convertNode(node, scope, buffer[position + 1], buffer);
|
|
12665
|
+
node.right = convertNode(node, scope, buffer[position + 2], buffer);
|
|
12610
12666
|
},
|
|
12611
|
-
function blockStatement(node, position, buffer
|
|
12667
|
+
function blockStatement(node, position, buffer) {
|
|
12612
12668
|
const { scope } = node;
|
|
12613
|
-
node.body = convertNodeList(node, scope, buffer[position], buffer
|
|
12669
|
+
node.body = convertNodeList(node, scope, buffer[position], buffer);
|
|
12614
12670
|
},
|
|
12615
|
-
function breakStatement(node, position, buffer
|
|
12671
|
+
function breakStatement(node, position, buffer) {
|
|
12616
12672
|
const { scope } = node;
|
|
12617
12673
|
const labelPosition = buffer[position];
|
|
12618
|
-
node.label =
|
|
12619
|
-
labelPosition === 0 ? null : convertNode(node, scope, labelPosition, buffer, readString);
|
|
12674
|
+
node.label = labelPosition === 0 ? null : convertNode(node, scope, labelPosition, buffer);
|
|
12620
12675
|
},
|
|
12621
|
-
function callExpression(node, position, buffer
|
|
12676
|
+
function callExpression(node, position, buffer) {
|
|
12622
12677
|
const { scope } = node;
|
|
12623
12678
|
const flags = buffer[position];
|
|
12624
12679
|
node.optional = (flags & 1) === 1;
|
|
12625
12680
|
node.annotations = convertAnnotations(buffer[position + 1], buffer);
|
|
12626
|
-
node.callee = convertNode(node, scope, buffer[position + 2], buffer
|
|
12627
|
-
node.arguments = convertNodeList(node, scope, buffer[position + 3], buffer
|
|
12681
|
+
node.callee = convertNode(node, scope, buffer[position + 2], buffer);
|
|
12682
|
+
node.arguments = convertNodeList(node, scope, buffer[position + 3], buffer);
|
|
12628
12683
|
},
|
|
12629
|
-
function catchClause(node, position, buffer
|
|
12684
|
+
function catchClause(node, position, buffer) {
|
|
12630
12685
|
const { scope } = node;
|
|
12631
12686
|
const parameterPosition = buffer[position];
|
|
12632
12687
|
const parameter = (node.param =
|
|
12633
|
-
parameterPosition === 0
|
|
12634
|
-
? null
|
|
12635
|
-
: convertNode(node, scope, parameterPosition, buffer, readString));
|
|
12688
|
+
parameterPosition === 0 ? null : convertNode(node, scope, parameterPosition, buffer));
|
|
12636
12689
|
parameter?.declare('parameter', UNKNOWN_EXPRESSION);
|
|
12637
|
-
node.body = convertNode(node, scope.bodyScope, buffer[position + 1], buffer
|
|
12690
|
+
node.body = convertNode(node, scope.bodyScope, buffer[position + 1], buffer);
|
|
12638
12691
|
},
|
|
12639
|
-
function chainExpression(node, position, buffer
|
|
12692
|
+
function chainExpression(node, position, buffer) {
|
|
12640
12693
|
const { scope } = node;
|
|
12641
|
-
node.expression = convertNode(node, scope, buffer[position], buffer
|
|
12694
|
+
node.expression = convertNode(node, scope, buffer[position], buffer);
|
|
12642
12695
|
},
|
|
12643
|
-
function classBody(node, position, buffer
|
|
12696
|
+
function classBody(node, position, buffer) {
|
|
12644
12697
|
const { scope } = node;
|
|
12645
12698
|
const bodyPosition = buffer[position];
|
|
12646
12699
|
const body = (node.body = []);
|
|
@@ -12648,127 +12701,116 @@ const bufferParsers = [
|
|
|
12648
12701
|
const length = buffer[bodyPosition];
|
|
12649
12702
|
for (let index = 0; index < length; index++) {
|
|
12650
12703
|
const nodePosition = buffer[bodyPosition + 1 + index];
|
|
12651
|
-
body.push(convertNode(node, (buffer[nodePosition + 3] & 1) === 0 ? scope.instanceScope : scope, nodePosition, buffer
|
|
12704
|
+
body.push(convertNode(node, (buffer[nodePosition + 3] & 1) === 0 ? scope.instanceScope : scope, nodePosition, buffer));
|
|
12652
12705
|
}
|
|
12653
12706
|
}
|
|
12654
12707
|
},
|
|
12655
|
-
function classDeclaration(node, position, buffer
|
|
12708
|
+
function classDeclaration(node, position, buffer) {
|
|
12656
12709
|
const { scope } = node;
|
|
12657
|
-
|
|
12710
|
+
node.decorators = convertNodeList(node, scope, buffer[position], buffer);
|
|
12711
|
+
const idPosition = buffer[position + 1];
|
|
12658
12712
|
node.id =
|
|
12659
|
-
idPosition === 0
|
|
12660
|
-
|
|
12661
|
-
: convertNode(node, scope.parent, idPosition, buffer, readString);
|
|
12662
|
-
const superClassPosition = buffer[position + 1];
|
|
12713
|
+
idPosition === 0 ? null : convertNode(node, scope.parent, idPosition, buffer);
|
|
12714
|
+
const superClassPosition = buffer[position + 2];
|
|
12663
12715
|
node.superClass =
|
|
12664
|
-
superClassPosition === 0
|
|
12665
|
-
|
|
12666
|
-
: convertNode(node, scope, superClassPosition, buffer, readString);
|
|
12667
|
-
node.body = convertNode(node, scope, buffer[position + 2], buffer, readString);
|
|
12716
|
+
superClassPosition === 0 ? null : convertNode(node, scope, superClassPosition, buffer);
|
|
12717
|
+
node.body = convertNode(node, scope, buffer[position + 3], buffer);
|
|
12668
12718
|
},
|
|
12669
|
-
function classExpression(node, position, buffer
|
|
12719
|
+
function classExpression(node, position, buffer) {
|
|
12670
12720
|
const { scope } = node;
|
|
12671
|
-
|
|
12672
|
-
|
|
12673
|
-
|
|
12721
|
+
node.decorators = convertNodeList(node, scope, buffer[position], buffer);
|
|
12722
|
+
const idPosition = buffer[position + 1];
|
|
12723
|
+
node.id = idPosition === 0 ? null : convertNode(node, scope, idPosition, buffer);
|
|
12724
|
+
const superClassPosition = buffer[position + 2];
|
|
12674
12725
|
node.superClass =
|
|
12675
|
-
superClassPosition === 0
|
|
12676
|
-
|
|
12677
|
-
: convertNode(node, scope, superClassPosition, buffer, readString);
|
|
12678
|
-
node.body = convertNode(node, scope, buffer[position + 2], buffer, readString);
|
|
12726
|
+
superClassPosition === 0 ? null : convertNode(node, scope, superClassPosition, buffer);
|
|
12727
|
+
node.body = convertNode(node, scope, buffer[position + 3], buffer);
|
|
12679
12728
|
},
|
|
12680
|
-
function conditionalExpression(node, position, buffer
|
|
12729
|
+
function conditionalExpression(node, position, buffer) {
|
|
12681
12730
|
const { scope } = node;
|
|
12682
|
-
node.test = convertNode(node, scope, buffer[position], buffer
|
|
12683
|
-
node.consequent = convertNode(node, scope, buffer[position + 1], buffer
|
|
12684
|
-
node.alternate = convertNode(node, scope, buffer[position + 2], buffer
|
|
12731
|
+
node.test = convertNode(node, scope, buffer[position], buffer);
|
|
12732
|
+
node.consequent = convertNode(node, scope, buffer[position + 1], buffer);
|
|
12733
|
+
node.alternate = convertNode(node, scope, buffer[position + 2], buffer);
|
|
12685
12734
|
},
|
|
12686
|
-
function continueStatement(node, position, buffer
|
|
12735
|
+
function continueStatement(node, position, buffer) {
|
|
12687
12736
|
const { scope } = node;
|
|
12688
12737
|
const labelPosition = buffer[position];
|
|
12689
|
-
node.label =
|
|
12690
|
-
labelPosition === 0 ? null : convertNode(node, scope, labelPosition, buffer, readString);
|
|
12738
|
+
node.label = labelPosition === 0 ? null : convertNode(node, scope, labelPosition, buffer);
|
|
12691
12739
|
},
|
|
12692
12740
|
function debuggerStatement() { },
|
|
12693
|
-
function
|
|
12741
|
+
function decorator(node, position, buffer) {
|
|
12742
|
+
const { scope } = node;
|
|
12743
|
+
node.expression = convertNode(node, scope, buffer[position], buffer);
|
|
12744
|
+
},
|
|
12745
|
+
function directive(node, position, buffer) {
|
|
12694
12746
|
const { scope } = node;
|
|
12695
|
-
node.directive = convertString(buffer[position]
|
|
12696
|
-
node.expression = convertNode(node, scope, buffer[position + 1], buffer
|
|
12747
|
+
node.directive = buffer.convertString(buffer[position]);
|
|
12748
|
+
node.expression = convertNode(node, scope, buffer[position + 1], buffer);
|
|
12697
12749
|
},
|
|
12698
|
-
function doWhileStatement(node, position, buffer
|
|
12750
|
+
function doWhileStatement(node, position, buffer) {
|
|
12699
12751
|
const { scope } = node;
|
|
12700
|
-
node.body = convertNode(node, scope, buffer[position], buffer
|
|
12701
|
-
node.test = convertNode(node, scope, buffer[position + 1], buffer
|
|
12752
|
+
node.body = convertNode(node, scope, buffer[position], buffer);
|
|
12753
|
+
node.test = convertNode(node, scope, buffer[position + 1], buffer);
|
|
12702
12754
|
},
|
|
12703
12755
|
function emptyStatement() { },
|
|
12704
|
-
function exportAllDeclaration(node, position, buffer
|
|
12756
|
+
function exportAllDeclaration(node, position, buffer) {
|
|
12705
12757
|
const { scope } = node;
|
|
12706
12758
|
const exportedPosition = buffer[position];
|
|
12707
12759
|
node.exported =
|
|
12708
|
-
exportedPosition === 0
|
|
12709
|
-
|
|
12710
|
-
|
|
12711
|
-
node.source = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
12712
|
-
node.attributes = convertNodeList(node, scope, buffer[position + 2], buffer, readString);
|
|
12760
|
+
exportedPosition === 0 ? null : convertNode(node, scope, exportedPosition, buffer);
|
|
12761
|
+
node.source = convertNode(node, scope, buffer[position + 1], buffer);
|
|
12762
|
+
node.attributes = convertNodeList(node, scope, buffer[position + 2], buffer);
|
|
12713
12763
|
},
|
|
12714
|
-
function exportDefaultDeclaration(node, position, buffer
|
|
12764
|
+
function exportDefaultDeclaration(node, position, buffer) {
|
|
12715
12765
|
const { scope } = node;
|
|
12716
|
-
node.declaration = convertNode(node, scope, buffer[position], buffer
|
|
12766
|
+
node.declaration = convertNode(node, scope, buffer[position], buffer);
|
|
12717
12767
|
},
|
|
12718
|
-
function exportNamedDeclaration(node, position, buffer
|
|
12768
|
+
function exportNamedDeclaration(node, position, buffer) {
|
|
12719
12769
|
const { scope } = node;
|
|
12720
|
-
node.specifiers = convertNodeList(node, scope, buffer[position], buffer
|
|
12770
|
+
node.specifiers = convertNodeList(node, scope, buffer[position], buffer);
|
|
12721
12771
|
const sourcePosition = buffer[position + 1];
|
|
12722
|
-
node.source =
|
|
12723
|
-
|
|
12724
|
-
node.attributes = convertNodeList(node, scope, buffer[position + 2], buffer, readString);
|
|
12772
|
+
node.source = sourcePosition === 0 ? null : convertNode(node, scope, sourcePosition, buffer);
|
|
12773
|
+
node.attributes = convertNodeList(node, scope, buffer[position + 2], buffer);
|
|
12725
12774
|
const declarationPosition = buffer[position + 3];
|
|
12726
12775
|
node.declaration =
|
|
12727
|
-
declarationPosition === 0
|
|
12728
|
-
? null
|
|
12729
|
-
: convertNode(node, scope, declarationPosition, buffer, readString);
|
|
12776
|
+
declarationPosition === 0 ? null : convertNode(node, scope, declarationPosition, buffer);
|
|
12730
12777
|
},
|
|
12731
|
-
function exportSpecifier(node, position, buffer
|
|
12778
|
+
function exportSpecifier(node, position, buffer) {
|
|
12732
12779
|
const { scope } = node;
|
|
12733
|
-
node.local = convertNode(node, scope, buffer[position], buffer
|
|
12780
|
+
node.local = convertNode(node, scope, buffer[position], buffer);
|
|
12734
12781
|
const exportedPosition = buffer[position + 1];
|
|
12735
12782
|
node.exported =
|
|
12736
|
-
exportedPosition === 0
|
|
12737
|
-
? node.local
|
|
12738
|
-
: convertNode(node, scope, exportedPosition, buffer, readString);
|
|
12783
|
+
exportedPosition === 0 ? node.local : convertNode(node, scope, exportedPosition, buffer);
|
|
12739
12784
|
},
|
|
12740
|
-
function expressionStatement(node, position, buffer
|
|
12785
|
+
function expressionStatement(node, position, buffer) {
|
|
12741
12786
|
const { scope } = node;
|
|
12742
|
-
node.expression = convertNode(node, scope, buffer[position], buffer
|
|
12787
|
+
node.expression = convertNode(node, scope, buffer[position], buffer);
|
|
12743
12788
|
},
|
|
12744
|
-
function forInStatement(node, position, buffer
|
|
12789
|
+
function forInStatement(node, position, buffer) {
|
|
12745
12790
|
const { scope } = node;
|
|
12746
|
-
node.left = convertNode(node, scope, buffer[position], buffer
|
|
12747
|
-
node.right = convertNode(node, scope, buffer[position + 1], buffer
|
|
12748
|
-
node.body = convertNode(node, scope, buffer[position + 2], buffer
|
|
12791
|
+
node.left = convertNode(node, scope, buffer[position], buffer);
|
|
12792
|
+
node.right = convertNode(node, scope, buffer[position + 1], buffer);
|
|
12793
|
+
node.body = convertNode(node, scope, buffer[position + 2], buffer);
|
|
12749
12794
|
},
|
|
12750
|
-
function forOfStatement(node, position, buffer
|
|
12795
|
+
function forOfStatement(node, position, buffer) {
|
|
12751
12796
|
const { scope } = node;
|
|
12752
12797
|
const flags = buffer[position];
|
|
12753
12798
|
node.await = (flags & 1) === 1;
|
|
12754
|
-
node.left = convertNode(node, scope, buffer[position + 1], buffer
|
|
12755
|
-
node.right = convertNode(node, scope, buffer[position + 2], buffer
|
|
12756
|
-
node.body = convertNode(node, scope, buffer[position + 3], buffer
|
|
12799
|
+
node.left = convertNode(node, scope, buffer[position + 1], buffer);
|
|
12800
|
+
node.right = convertNode(node, scope, buffer[position + 2], buffer);
|
|
12801
|
+
node.body = convertNode(node, scope, buffer[position + 3], buffer);
|
|
12757
12802
|
},
|
|
12758
|
-
function forStatement(node, position, buffer
|
|
12803
|
+
function forStatement(node, position, buffer) {
|
|
12759
12804
|
const { scope } = node;
|
|
12760
12805
|
const initPosition = buffer[position];
|
|
12761
|
-
node.init =
|
|
12762
|
-
initPosition === 0 ? null : convertNode(node, scope, initPosition, buffer, readString);
|
|
12806
|
+
node.init = initPosition === 0 ? null : convertNode(node, scope, initPosition, buffer);
|
|
12763
12807
|
const testPosition = buffer[position + 1];
|
|
12764
|
-
node.test =
|
|
12765
|
-
testPosition === 0 ? null : convertNode(node, scope, testPosition, buffer, readString);
|
|
12808
|
+
node.test = testPosition === 0 ? null : convertNode(node, scope, testPosition, buffer);
|
|
12766
12809
|
const updatePosition = buffer[position + 2];
|
|
12767
|
-
node.update =
|
|
12768
|
-
|
|
12769
|
-
node.body = convertNode(node, scope, buffer[position + 3], buffer, readString);
|
|
12810
|
+
node.update = updatePosition === 0 ? null : convertNode(node, scope, updatePosition, buffer);
|
|
12811
|
+
node.body = convertNode(node, scope, buffer[position + 3], buffer);
|
|
12770
12812
|
},
|
|
12771
|
-
function functionDeclaration(node, position, buffer
|
|
12813
|
+
function functionDeclaration(node, position, buffer) {
|
|
12772
12814
|
const { scope } = node;
|
|
12773
12815
|
const flags = buffer[position];
|
|
12774
12816
|
node.async = (flags & 1) === 1;
|
|
@@ -12777,14 +12819,12 @@ const bufferParsers = [
|
|
|
12777
12819
|
node.annotationNoSideEffects = annotations.some(comment => comment.type === 'noSideEffects');
|
|
12778
12820
|
const idPosition = buffer[position + 2];
|
|
12779
12821
|
node.id =
|
|
12780
|
-
idPosition === 0
|
|
12781
|
-
|
|
12782
|
-
: convertNode(node, scope.parent, idPosition, buffer, readString);
|
|
12783
|
-
const parameters = (node.params = convertNodeList(node, scope, buffer[position + 3], buffer, readString));
|
|
12822
|
+
idPosition === 0 ? null : convertNode(node, scope.parent, idPosition, buffer);
|
|
12823
|
+
const parameters = (node.params = convertNodeList(node, scope, buffer[position + 3], buffer));
|
|
12784
12824
|
scope.addParameterVariables(parameters.map(parameter => parameter.declare('parameter', UNKNOWN_EXPRESSION)), parameters[parameters.length - 1] instanceof RestElement);
|
|
12785
|
-
node.body = convertNode(node, scope.bodyScope, buffer[position + 4], buffer
|
|
12825
|
+
node.body = convertNode(node, scope.bodyScope, buffer[position + 4], buffer);
|
|
12786
12826
|
},
|
|
12787
|
-
function functionExpression(node, position, buffer
|
|
12827
|
+
function functionExpression(node, position, buffer) {
|
|
12788
12828
|
const { scope } = node;
|
|
12789
12829
|
const flags = buffer[position];
|
|
12790
12830
|
node.async = (flags & 1) === 1;
|
|
@@ -12792,69 +12832,65 @@ const bufferParsers = [
|
|
|
12792
12832
|
const annotations = (node.annotations = convertAnnotations(buffer[position + 1], buffer));
|
|
12793
12833
|
node.annotationNoSideEffects = annotations.some(comment => comment.type === 'noSideEffects');
|
|
12794
12834
|
const idPosition = buffer[position + 2];
|
|
12795
|
-
node.id =
|
|
12796
|
-
|
|
12797
|
-
const parameters = (node.params = convertNodeList(node, scope, buffer[position + 3], buffer, readString));
|
|
12835
|
+
node.id = idPosition === 0 ? null : convertNode(node, node.idScope, idPosition, buffer);
|
|
12836
|
+
const parameters = (node.params = convertNodeList(node, scope, buffer[position + 3], buffer));
|
|
12798
12837
|
scope.addParameterVariables(parameters.map(parameter => parameter.declare('parameter', UNKNOWN_EXPRESSION)), parameters[parameters.length - 1] instanceof RestElement);
|
|
12799
|
-
node.body = convertNode(node, scope.bodyScope, buffer[position + 4], buffer
|
|
12838
|
+
node.body = convertNode(node, scope.bodyScope, buffer[position + 4], buffer);
|
|
12800
12839
|
},
|
|
12801
|
-
function identifier(node, position, buffer
|
|
12802
|
-
node.name = convertString(buffer[position]
|
|
12840
|
+
function identifier(node, position, buffer) {
|
|
12841
|
+
node.name = buffer.convertString(buffer[position]);
|
|
12803
12842
|
},
|
|
12804
|
-
function ifStatement(node, position, buffer
|
|
12843
|
+
function ifStatement(node, position, buffer) {
|
|
12805
12844
|
const { scope } = node;
|
|
12806
|
-
node.test = convertNode(node, scope, buffer[position], buffer
|
|
12807
|
-
node.consequent = convertNode(node, (node.consequentScope = new TrackingScope(scope)), buffer[position + 1], buffer
|
|
12845
|
+
node.test = convertNode(node, scope, buffer[position], buffer);
|
|
12846
|
+
node.consequent = convertNode(node, (node.consequentScope = new TrackingScope(scope)), buffer[position + 1], buffer);
|
|
12808
12847
|
const alternatePosition = buffer[position + 2];
|
|
12809
12848
|
node.alternate =
|
|
12810
12849
|
alternatePosition === 0
|
|
12811
12850
|
? null
|
|
12812
|
-
: convertNode(node, (node.alternateScope = new TrackingScope(scope)), alternatePosition, buffer
|
|
12851
|
+
: convertNode(node, (node.alternateScope = new TrackingScope(scope)), alternatePosition, buffer);
|
|
12813
12852
|
},
|
|
12814
|
-
function importAttribute(node, position, buffer
|
|
12853
|
+
function importAttribute(node, position, buffer) {
|
|
12815
12854
|
const { scope } = node;
|
|
12816
|
-
node.key = convertNode(node, scope, buffer[position], buffer
|
|
12817
|
-
node.value = convertNode(node, scope, buffer[position + 1], buffer
|
|
12855
|
+
node.key = convertNode(node, scope, buffer[position], buffer);
|
|
12856
|
+
node.value = convertNode(node, scope, buffer[position + 1], buffer);
|
|
12818
12857
|
},
|
|
12819
|
-
function importDeclaration(node, position, buffer
|
|
12858
|
+
function importDeclaration(node, position, buffer) {
|
|
12820
12859
|
const { scope } = node;
|
|
12821
|
-
node.specifiers = convertNodeList(node, scope, buffer[position], buffer
|
|
12822
|
-
node.source = convertNode(node, scope, buffer[position + 1], buffer
|
|
12823
|
-
node.attributes = convertNodeList(node, scope, buffer[position + 2], buffer
|
|
12860
|
+
node.specifiers = convertNodeList(node, scope, buffer[position], buffer);
|
|
12861
|
+
node.source = convertNode(node, scope, buffer[position + 1], buffer);
|
|
12862
|
+
node.attributes = convertNodeList(node, scope, buffer[position + 2], buffer);
|
|
12824
12863
|
},
|
|
12825
|
-
function importDefaultSpecifier(node, position, buffer
|
|
12864
|
+
function importDefaultSpecifier(node, position, buffer) {
|
|
12826
12865
|
const { scope } = node;
|
|
12827
|
-
node.local = convertNode(node, scope, buffer[position], buffer
|
|
12866
|
+
node.local = convertNode(node, scope, buffer[position], buffer);
|
|
12828
12867
|
},
|
|
12829
|
-
function importExpression(node, position, buffer
|
|
12868
|
+
function importExpression(node, position, buffer) {
|
|
12830
12869
|
const { scope } = node;
|
|
12831
|
-
node.source = convertNode(node, scope, buffer[position], buffer
|
|
12832
|
-
node.sourceAstNode = convertNode$1(buffer[position], buffer
|
|
12870
|
+
node.source = convertNode(node, scope, buffer[position], buffer);
|
|
12871
|
+
node.sourceAstNode = convertNode$1(buffer[position], buffer);
|
|
12833
12872
|
const optionsPosition = buffer[position + 1];
|
|
12834
|
-
node.options =
|
|
12835
|
-
optionsPosition === 0 ? null : convertNode(node, scope, optionsPosition, buffer, readString);
|
|
12873
|
+
node.options = optionsPosition === 0 ? null : convertNode(node, scope, optionsPosition, buffer);
|
|
12836
12874
|
},
|
|
12837
|
-
function importNamespaceSpecifier(node, position, buffer
|
|
12875
|
+
function importNamespaceSpecifier(node, position, buffer) {
|
|
12838
12876
|
const { scope } = node;
|
|
12839
|
-
node.local = convertNode(node, scope, buffer[position], buffer
|
|
12877
|
+
node.local = convertNode(node, scope, buffer[position], buffer);
|
|
12840
12878
|
},
|
|
12841
|
-
function importSpecifier(node, position, buffer
|
|
12879
|
+
function importSpecifier(node, position, buffer) {
|
|
12842
12880
|
const { scope } = node;
|
|
12843
12881
|
const importedPosition = buffer[position];
|
|
12844
|
-
node.local = convertNode(node, scope, buffer[position + 1], buffer
|
|
12882
|
+
node.local = convertNode(node, scope, buffer[position + 1], buffer);
|
|
12845
12883
|
node.imported =
|
|
12846
|
-
importedPosition === 0
|
|
12847
|
-
? node.local
|
|
12848
|
-
: convertNode(node, scope, importedPosition, buffer, readString);
|
|
12884
|
+
importedPosition === 0 ? node.local : convertNode(node, scope, importedPosition, buffer);
|
|
12849
12885
|
},
|
|
12850
|
-
function labeledStatement(node, position, buffer
|
|
12886
|
+
function labeledStatement(node, position, buffer) {
|
|
12851
12887
|
const { scope } = node;
|
|
12852
|
-
node.label = convertNode(node, scope, buffer[position], buffer
|
|
12853
|
-
node.body = convertNode(node, scope, buffer[position + 1], buffer
|
|
12888
|
+
node.label = convertNode(node, scope, buffer[position], buffer);
|
|
12889
|
+
node.body = convertNode(node, scope, buffer[position + 1], buffer);
|
|
12854
12890
|
},
|
|
12855
|
-
function literalBigInt(node, position, buffer
|
|
12856
|
-
const bigint = (node.bigint = convertString(buffer[position]
|
|
12857
|
-
node.raw = convertString(buffer[position + 1]
|
|
12891
|
+
function literalBigInt(node, position, buffer) {
|
|
12892
|
+
const bigint = (node.bigint = buffer.convertString(buffer[position]));
|
|
12893
|
+
node.raw = buffer.convertString(buffer[position + 1]);
|
|
12858
12894
|
node.value = BigInt(bigint);
|
|
12859
12895
|
},
|
|
12860
12896
|
function literalBoolean(node, position, buffer) {
|
|
@@ -12865,208 +12901,199 @@ const bufferParsers = [
|
|
|
12865
12901
|
function literalNull(node) {
|
|
12866
12902
|
node.value = null;
|
|
12867
12903
|
},
|
|
12868
|
-
function literalNumber(node, position, buffer
|
|
12904
|
+
function literalNumber(node, position, buffer) {
|
|
12869
12905
|
const rawPosition = buffer[position];
|
|
12870
|
-
node.raw = rawPosition === 0 ? undefined : convertString(rawPosition
|
|
12906
|
+
node.raw = rawPosition === 0 ? undefined : buffer.convertString(rawPosition);
|
|
12871
12907
|
node.value = new DataView(buffer.buffer).getFloat64((position + 1) << 2, true);
|
|
12872
12908
|
},
|
|
12873
|
-
function literalRegExp(node, position, buffer
|
|
12874
|
-
const flags = convertString(buffer[position]
|
|
12875
|
-
const pattern = convertString(buffer[position + 1]
|
|
12909
|
+
function literalRegExp(node, position, buffer) {
|
|
12910
|
+
const flags = buffer.convertString(buffer[position]);
|
|
12911
|
+
const pattern = buffer.convertString(buffer[position + 1]);
|
|
12876
12912
|
node.raw = `/${pattern}/${flags}`;
|
|
12877
12913
|
node.regex = { flags, pattern };
|
|
12878
12914
|
node.value = new RegExp(pattern, flags);
|
|
12879
12915
|
},
|
|
12880
|
-
function literalString(node, position, buffer
|
|
12881
|
-
node.value = convertString(buffer[position]
|
|
12916
|
+
function literalString(node, position, buffer) {
|
|
12917
|
+
node.value = buffer.convertString(buffer[position]);
|
|
12882
12918
|
const rawPosition = buffer[position + 1];
|
|
12883
|
-
node.raw = rawPosition === 0 ? undefined : convertString(rawPosition
|
|
12919
|
+
node.raw = rawPosition === 0 ? undefined : buffer.convertString(rawPosition);
|
|
12884
12920
|
},
|
|
12885
|
-
function logicalExpression(node, position, buffer
|
|
12921
|
+
function logicalExpression(node, position, buffer) {
|
|
12886
12922
|
const { scope } = node;
|
|
12887
12923
|
node.operator = FIXED_STRINGS[buffer[position]];
|
|
12888
|
-
node.left = convertNode(node, scope, buffer[position + 1], buffer
|
|
12889
|
-
node.right = convertNode(node, scope, buffer[position + 2], buffer
|
|
12924
|
+
node.left = convertNode(node, scope, buffer[position + 1], buffer);
|
|
12925
|
+
node.right = convertNode(node, scope, buffer[position + 2], buffer);
|
|
12890
12926
|
},
|
|
12891
|
-
function memberExpression(node, position, buffer
|
|
12927
|
+
function memberExpression(node, position, buffer) {
|
|
12892
12928
|
const { scope } = node;
|
|
12893
12929
|
const flags = buffer[position];
|
|
12894
12930
|
node.computed = (flags & 1) === 1;
|
|
12895
12931
|
node.optional = (flags & 2) === 2;
|
|
12896
|
-
node.object = convertNode(node, scope, buffer[position + 1], buffer
|
|
12897
|
-
node.property = convertNode(node, scope, buffer[position + 2], buffer
|
|
12932
|
+
node.object = convertNode(node, scope, buffer[position + 1], buffer);
|
|
12933
|
+
node.property = convertNode(node, scope, buffer[position + 2], buffer);
|
|
12898
12934
|
},
|
|
12899
|
-
function metaProperty(node, position, buffer
|
|
12935
|
+
function metaProperty(node, position, buffer) {
|
|
12900
12936
|
const { scope } = node;
|
|
12901
|
-
node.meta = convertNode(node, scope, buffer[position], buffer
|
|
12902
|
-
node.property = convertNode(node, scope, buffer[position + 1], buffer
|
|
12937
|
+
node.meta = convertNode(node, scope, buffer[position], buffer);
|
|
12938
|
+
node.property = convertNode(node, scope, buffer[position + 1], buffer);
|
|
12903
12939
|
},
|
|
12904
|
-
function methodDefinition(node, position, buffer
|
|
12940
|
+
function methodDefinition(node, position, buffer) {
|
|
12905
12941
|
const { scope } = node;
|
|
12906
12942
|
const flags = buffer[position];
|
|
12907
12943
|
node.static = (flags & 1) === 1;
|
|
12908
12944
|
node.computed = (flags & 2) === 2;
|
|
12909
|
-
node.
|
|
12910
|
-
node.
|
|
12911
|
-
node.
|
|
12945
|
+
node.decorators = convertNodeList(node, scope, buffer[position + 1], buffer);
|
|
12946
|
+
node.key = convertNode(node, scope, buffer[position + 2], buffer);
|
|
12947
|
+
node.value = convertNode(node, scope, buffer[position + 3], buffer);
|
|
12948
|
+
node.kind = FIXED_STRINGS[buffer[position + 4]];
|
|
12912
12949
|
},
|
|
12913
|
-
function newExpression(node, position, buffer
|
|
12950
|
+
function newExpression(node, position, buffer) {
|
|
12914
12951
|
const { scope } = node;
|
|
12915
12952
|
node.annotations = convertAnnotations(buffer[position], buffer);
|
|
12916
|
-
node.callee = convertNode(node, scope, buffer[position + 1], buffer
|
|
12917
|
-
node.arguments = convertNodeList(node, scope, buffer[position + 2], buffer
|
|
12953
|
+
node.callee = convertNode(node, scope, buffer[position + 1], buffer);
|
|
12954
|
+
node.arguments = convertNodeList(node, scope, buffer[position + 2], buffer);
|
|
12918
12955
|
},
|
|
12919
|
-
function objectExpression(node, position, buffer
|
|
12956
|
+
function objectExpression(node, position, buffer) {
|
|
12920
12957
|
const { scope } = node;
|
|
12921
|
-
node.properties = convertNodeList(node, scope, buffer[position], buffer
|
|
12958
|
+
node.properties = convertNodeList(node, scope, buffer[position], buffer);
|
|
12922
12959
|
},
|
|
12923
|
-
function objectPattern(node, position, buffer
|
|
12960
|
+
function objectPattern(node, position, buffer) {
|
|
12924
12961
|
const { scope } = node;
|
|
12925
|
-
node.properties = convertNodeList(node, scope, buffer[position], buffer
|
|
12962
|
+
node.properties = convertNodeList(node, scope, buffer[position], buffer);
|
|
12926
12963
|
},
|
|
12927
|
-
function privateIdentifier(node, position, buffer
|
|
12928
|
-
node.name = convertString(buffer[position]
|
|
12964
|
+
function privateIdentifier(node, position, buffer) {
|
|
12965
|
+
node.name = buffer.convertString(buffer[position]);
|
|
12929
12966
|
},
|
|
12930
|
-
function program(node, position, buffer
|
|
12967
|
+
function program(node, position, buffer) {
|
|
12931
12968
|
const { scope } = node;
|
|
12932
|
-
node.body = convertNodeList(node, scope, buffer[position], buffer
|
|
12969
|
+
node.body = convertNodeList(node, scope, buffer[position], buffer);
|
|
12933
12970
|
node.invalidAnnotations = convertAnnotations(buffer[position + 1], buffer);
|
|
12934
12971
|
},
|
|
12935
|
-
function property(node, position, buffer
|
|
12972
|
+
function property(node, position, buffer) {
|
|
12936
12973
|
const { scope } = node;
|
|
12937
12974
|
const flags = buffer[position];
|
|
12938
12975
|
node.method = (flags & 1) === 1;
|
|
12939
12976
|
node.shorthand = (flags & 2) === 2;
|
|
12940
12977
|
node.computed = (flags & 4) === 4;
|
|
12941
12978
|
const keyPosition = buffer[position + 1];
|
|
12942
|
-
node.value = convertNode(node, scope, buffer[position + 2], buffer
|
|
12979
|
+
node.value = convertNode(node, scope, buffer[position + 2], buffer);
|
|
12943
12980
|
node.kind = FIXED_STRINGS[buffer[position + 3]];
|
|
12944
|
-
node.key =
|
|
12945
|
-
keyPosition === 0 ? node.value : convertNode(node, scope, keyPosition, buffer, readString);
|
|
12981
|
+
node.key = keyPosition === 0 ? node.value : convertNode(node, scope, keyPosition, buffer);
|
|
12946
12982
|
},
|
|
12947
|
-
function propertyDefinition(node, position, buffer
|
|
12983
|
+
function propertyDefinition(node, position, buffer) {
|
|
12948
12984
|
const { scope } = node;
|
|
12949
12985
|
const flags = buffer[position];
|
|
12950
12986
|
node.static = (flags & 1) === 1;
|
|
12951
12987
|
node.computed = (flags & 2) === 2;
|
|
12952
|
-
node.
|
|
12953
|
-
|
|
12954
|
-
|
|
12955
|
-
|
|
12988
|
+
node.decorators = convertNodeList(node, scope, buffer[position + 1], buffer);
|
|
12989
|
+
node.key = convertNode(node, scope, buffer[position + 2], buffer);
|
|
12990
|
+
const valuePosition = buffer[position + 3];
|
|
12991
|
+
node.value = valuePosition === 0 ? null : convertNode(node, scope, valuePosition, buffer);
|
|
12956
12992
|
},
|
|
12957
|
-
function restElement(node, position, buffer
|
|
12993
|
+
function restElement(node, position, buffer) {
|
|
12958
12994
|
const { scope } = node;
|
|
12959
|
-
node.argument = convertNode(node, scope, buffer[position], buffer
|
|
12995
|
+
node.argument = convertNode(node, scope, buffer[position], buffer);
|
|
12960
12996
|
},
|
|
12961
|
-
function returnStatement(node, position, buffer
|
|
12997
|
+
function returnStatement(node, position, buffer) {
|
|
12962
12998
|
const { scope } = node;
|
|
12963
12999
|
const argumentPosition = buffer[position];
|
|
12964
13000
|
node.argument =
|
|
12965
|
-
argumentPosition === 0
|
|
12966
|
-
? null
|
|
12967
|
-
: convertNode(node, scope, argumentPosition, buffer, readString);
|
|
13001
|
+
argumentPosition === 0 ? null : convertNode(node, scope, argumentPosition, buffer);
|
|
12968
13002
|
},
|
|
12969
|
-
function sequenceExpression(node, position, buffer
|
|
13003
|
+
function sequenceExpression(node, position, buffer) {
|
|
12970
13004
|
const { scope } = node;
|
|
12971
|
-
node.expressions = convertNodeList(node, scope, buffer[position], buffer
|
|
13005
|
+
node.expressions = convertNodeList(node, scope, buffer[position], buffer);
|
|
12972
13006
|
},
|
|
12973
|
-
function spreadElement(node, position, buffer
|
|
13007
|
+
function spreadElement(node, position, buffer) {
|
|
12974
13008
|
const { scope } = node;
|
|
12975
|
-
node.argument = convertNode(node, scope, buffer[position], buffer
|
|
13009
|
+
node.argument = convertNode(node, scope, buffer[position], buffer);
|
|
12976
13010
|
},
|
|
12977
|
-
function staticBlock(node, position, buffer
|
|
13011
|
+
function staticBlock(node, position, buffer) {
|
|
12978
13012
|
const { scope } = node;
|
|
12979
|
-
node.body = convertNodeList(node, scope, buffer[position], buffer
|
|
13013
|
+
node.body = convertNodeList(node, scope, buffer[position], buffer);
|
|
12980
13014
|
},
|
|
12981
13015
|
function superElement() { },
|
|
12982
|
-
function switchCase(node, position, buffer
|
|
13016
|
+
function switchCase(node, position, buffer) {
|
|
12983
13017
|
const { scope } = node;
|
|
12984
13018
|
const testPosition = buffer[position];
|
|
12985
|
-
node.test =
|
|
12986
|
-
|
|
12987
|
-
node.consequent = convertNodeList(node, scope, buffer[position + 1], buffer, readString);
|
|
13019
|
+
node.test = testPosition === 0 ? null : convertNode(node, scope, testPosition, buffer);
|
|
13020
|
+
node.consequent = convertNodeList(node, scope, buffer[position + 1], buffer);
|
|
12988
13021
|
},
|
|
12989
|
-
function switchStatement(node, position, buffer
|
|
13022
|
+
function switchStatement(node, position, buffer) {
|
|
12990
13023
|
const { scope } = node;
|
|
12991
|
-
node.discriminant = convertNode(node, node.parentScope, buffer[position], buffer
|
|
12992
|
-
node.cases = convertNodeList(node, scope, buffer[position + 1], buffer
|
|
13024
|
+
node.discriminant = convertNode(node, node.parentScope, buffer[position], buffer);
|
|
13025
|
+
node.cases = convertNodeList(node, scope, buffer[position + 1], buffer);
|
|
12993
13026
|
},
|
|
12994
|
-
function taggedTemplateExpression(node, position, buffer
|
|
13027
|
+
function taggedTemplateExpression(node, position, buffer) {
|
|
12995
13028
|
const { scope } = node;
|
|
12996
|
-
node.tag = convertNode(node, scope, buffer[position], buffer
|
|
12997
|
-
node.quasi = convertNode(node, scope, buffer[position + 1], buffer
|
|
13029
|
+
node.tag = convertNode(node, scope, buffer[position], buffer);
|
|
13030
|
+
node.quasi = convertNode(node, scope, buffer[position + 1], buffer);
|
|
12998
13031
|
},
|
|
12999
|
-
function templateElement(node, position, buffer
|
|
13032
|
+
function templateElement(node, position, buffer) {
|
|
13000
13033
|
const flags = buffer[position];
|
|
13001
13034
|
node.tail = (flags & 1) === 1;
|
|
13002
13035
|
const cookedPosition = buffer[position + 1];
|
|
13003
|
-
const cooked = cookedPosition === 0 ? undefined : convertString(cookedPosition
|
|
13004
|
-
const raw = convertString(buffer[position + 2]
|
|
13036
|
+
const cooked = cookedPosition === 0 ? undefined : buffer.convertString(cookedPosition);
|
|
13037
|
+
const raw = buffer.convertString(buffer[position + 2]);
|
|
13005
13038
|
node.value = { cooked, raw };
|
|
13006
13039
|
},
|
|
13007
|
-
function templateLiteral(node, position, buffer
|
|
13040
|
+
function templateLiteral(node, position, buffer) {
|
|
13008
13041
|
const { scope } = node;
|
|
13009
|
-
node.quasis = convertNodeList(node, scope, buffer[position], buffer
|
|
13010
|
-
node.expressions = convertNodeList(node, scope, buffer[position + 1], buffer
|
|
13042
|
+
node.quasis = convertNodeList(node, scope, buffer[position], buffer);
|
|
13043
|
+
node.expressions = convertNodeList(node, scope, buffer[position + 1], buffer);
|
|
13011
13044
|
},
|
|
13012
13045
|
function thisExpression() { },
|
|
13013
|
-
function throwStatement(node, position, buffer
|
|
13046
|
+
function throwStatement(node, position, buffer) {
|
|
13014
13047
|
const { scope } = node;
|
|
13015
|
-
node.argument = convertNode(node, scope, buffer[position], buffer
|
|
13048
|
+
node.argument = convertNode(node, scope, buffer[position], buffer);
|
|
13016
13049
|
},
|
|
13017
|
-
function tryStatement(node, position, buffer
|
|
13050
|
+
function tryStatement(node, position, buffer) {
|
|
13018
13051
|
const { scope } = node;
|
|
13019
|
-
node.block = convertNode(node, scope, buffer[position], buffer
|
|
13052
|
+
node.block = convertNode(node, scope, buffer[position], buffer);
|
|
13020
13053
|
const handlerPosition = buffer[position + 1];
|
|
13021
|
-
node.handler =
|
|
13022
|
-
handlerPosition === 0 ? null : convertNode(node, scope, handlerPosition, buffer, readString);
|
|
13054
|
+
node.handler = handlerPosition === 0 ? null : convertNode(node, scope, handlerPosition, buffer);
|
|
13023
13055
|
const finalizerPosition = buffer[position + 2];
|
|
13024
13056
|
node.finalizer =
|
|
13025
|
-
finalizerPosition === 0
|
|
13026
|
-
? null
|
|
13027
|
-
: convertNode(node, scope, finalizerPosition, buffer, readString);
|
|
13057
|
+
finalizerPosition === 0 ? null : convertNode(node, scope, finalizerPosition, buffer);
|
|
13028
13058
|
},
|
|
13029
|
-
function unaryExpression(node, position, buffer
|
|
13059
|
+
function unaryExpression(node, position, buffer) {
|
|
13030
13060
|
const { scope } = node;
|
|
13031
13061
|
node.operator = FIXED_STRINGS[buffer[position]];
|
|
13032
|
-
node.argument = convertNode(node, scope, buffer[position + 1], buffer
|
|
13062
|
+
node.argument = convertNode(node, scope, buffer[position + 1], buffer);
|
|
13033
13063
|
},
|
|
13034
|
-
function updateExpression(node, position, buffer
|
|
13064
|
+
function updateExpression(node, position, buffer) {
|
|
13035
13065
|
const { scope } = node;
|
|
13036
13066
|
const flags = buffer[position];
|
|
13037
13067
|
node.prefix = (flags & 1) === 1;
|
|
13038
13068
|
node.operator = FIXED_STRINGS[buffer[position + 1]];
|
|
13039
|
-
node.argument = convertNode(node, scope, buffer[position + 2], buffer
|
|
13069
|
+
node.argument = convertNode(node, scope, buffer[position + 2], buffer);
|
|
13040
13070
|
},
|
|
13041
|
-
function variableDeclaration(node, position, buffer
|
|
13071
|
+
function variableDeclaration(node, position, buffer) {
|
|
13042
13072
|
const { scope } = node;
|
|
13043
13073
|
node.kind = FIXED_STRINGS[buffer[position]];
|
|
13044
|
-
node.declarations = convertNodeList(node, scope, buffer[position + 1], buffer
|
|
13074
|
+
node.declarations = convertNodeList(node, scope, buffer[position + 1], buffer);
|
|
13045
13075
|
},
|
|
13046
|
-
function variableDeclarator(node, position, buffer
|
|
13076
|
+
function variableDeclarator(node, position, buffer) {
|
|
13047
13077
|
const { scope } = node;
|
|
13048
|
-
node.id = convertNode(node, scope, buffer[position], buffer
|
|
13078
|
+
node.id = convertNode(node, scope, buffer[position], buffer);
|
|
13049
13079
|
const initPosition = buffer[position + 1];
|
|
13050
|
-
node.init =
|
|
13051
|
-
initPosition === 0 ? null : convertNode(node, scope, initPosition, buffer, readString);
|
|
13080
|
+
node.init = initPosition === 0 ? null : convertNode(node, scope, initPosition, buffer);
|
|
13052
13081
|
},
|
|
13053
|
-
function whileStatement(node, position, buffer
|
|
13082
|
+
function whileStatement(node, position, buffer) {
|
|
13054
13083
|
const { scope } = node;
|
|
13055
|
-
node.test = convertNode(node, scope, buffer[position], buffer
|
|
13056
|
-
node.body = convertNode(node, scope, buffer[position + 1], buffer
|
|
13084
|
+
node.test = convertNode(node, scope, buffer[position], buffer);
|
|
13085
|
+
node.body = convertNode(node, scope, buffer[position + 1], buffer);
|
|
13057
13086
|
},
|
|
13058
|
-
function yieldExpression(node, position, buffer
|
|
13087
|
+
function yieldExpression(node, position, buffer) {
|
|
13059
13088
|
const { scope } = node;
|
|
13060
13089
|
const flags = buffer[position];
|
|
13061
13090
|
node.delegate = (flags & 1) === 1;
|
|
13062
13091
|
const argumentPosition = buffer[position + 1];
|
|
13063
13092
|
node.argument =
|
|
13064
|
-
argumentPosition === 0
|
|
13065
|
-
? null
|
|
13066
|
-
: convertNode(node, scope, argumentPosition, buffer, readString);
|
|
13093
|
+
argumentPosition === 0 ? null : convertNode(node, scope, argumentPosition, buffer);
|
|
13067
13094
|
}
|
|
13068
13095
|
];
|
|
13069
|
-
function convertNode(parent, parentScope, position, buffer
|
|
13096
|
+
function convertNode(parent, parentScope, position, buffer) {
|
|
13070
13097
|
const nodeType = buffer[position];
|
|
13071
13098
|
const NodeConstructor = nodeConstructors$1[nodeType];
|
|
13072
13099
|
/* istanbul ignore if: This should never be executed but is a safeguard against faulty buffers */
|
|
@@ -13078,18 +13105,18 @@ function convertNode(parent, parentScope, position, buffer, readString) {
|
|
|
13078
13105
|
node.type = nodeTypeStrings[nodeType];
|
|
13079
13106
|
node.start = buffer[position + 1];
|
|
13080
13107
|
node.end = buffer[position + 2];
|
|
13081
|
-
bufferParsers[nodeType](node, position + 3, buffer
|
|
13108
|
+
bufferParsers[nodeType](node, position + 3, buffer);
|
|
13082
13109
|
node.initialise();
|
|
13083
13110
|
return node;
|
|
13084
13111
|
}
|
|
13085
|
-
function convertNodeList(parent, parentScope, position, buffer
|
|
13112
|
+
function convertNodeList(parent, parentScope, position, buffer) {
|
|
13086
13113
|
if (position === 0)
|
|
13087
13114
|
return EMPTY_ARRAY;
|
|
13088
13115
|
const length = buffer[position++];
|
|
13089
13116
|
const list = [];
|
|
13090
13117
|
for (let index = 0; index < length; index++) {
|
|
13091
13118
|
const nodePosition = buffer[position++];
|
|
13092
|
-
list.push(nodePosition ? convertNode(parent, parentScope, nodePosition, buffer
|
|
13119
|
+
list.push(nodePosition ? convertNode(parent, parentScope, nodePosition, buffer) : null);
|
|
13093
13120
|
}
|
|
13094
13121
|
return list;
|
|
13095
13122
|
}
|
|
@@ -13124,6 +13151,7 @@ const nodeConstructors = {
|
|
|
13124
13151
|
ConditionalExpression,
|
|
13125
13152
|
ContinueStatement,
|
|
13126
13153
|
DebuggerStatement,
|
|
13154
|
+
Decorator,
|
|
13127
13155
|
DoWhileStatement,
|
|
13128
13156
|
EmptyStatement,
|
|
13129
13157
|
ExportAllDeclaration,
|
|
@@ -14663,8 +14691,11 @@ function getExportBlock$1(exports, dependencies, namedExportsMode, interop, snip
|
|
|
14663
14691
|
return `${n}${n}${mechanism}${getSingleDefaultExport(exports, dependencies, interop, externalLiveBindings, getPropertyAccess)};`;
|
|
14664
14692
|
}
|
|
14665
14693
|
let exportBlock = '';
|
|
14666
|
-
|
|
14667
|
-
|
|
14694
|
+
if (namedExportsMode) {
|
|
14695
|
+
for (const { defaultVariableName, importPath, isChunk, name, namedExportsMode: depNamedExportsMode, namespaceVariableName, reexports } of dependencies) {
|
|
14696
|
+
if (!reexports) {
|
|
14697
|
+
continue;
|
|
14698
|
+
}
|
|
14668
14699
|
for (const specifier of reexports) {
|
|
14669
14700
|
if (specifier.reexported !== '*') {
|
|
14670
14701
|
const importName = getReexportedImportName(name, specifier.imported, depNamedExportsMode, isChunk, defaultVariableName, namespaceVariableName, interop, importPath, externalLiveBindings, getPropertyAccess);
|
|
@@ -14708,8 +14739,11 @@ function getExportBlock$1(exports, dependencies, namedExportsMode, interop, snip
|
|
|
14708
14739
|
: `${lhs}${_}=${_}${rhs};`;
|
|
14709
14740
|
}
|
|
14710
14741
|
}
|
|
14711
|
-
|
|
14712
|
-
|
|
14742
|
+
if (namedExportsMode) {
|
|
14743
|
+
for (const { name, reexports } of dependencies) {
|
|
14744
|
+
if (!reexports) {
|
|
14745
|
+
continue;
|
|
14746
|
+
}
|
|
14713
14747
|
for (const specifier of reexports) {
|
|
14714
14748
|
if (specifier.reexported === '*') {
|
|
14715
14749
|
if (exportBlock)
|
|
@@ -18288,7 +18322,7 @@ function addModuleToManualChunk(alias, module, manualChunkAliasByEntry) {
|
|
|
18288
18322
|
|
|
18289
18323
|
function flru (max) {
|
|
18290
18324
|
var num, curr, prev;
|
|
18291
|
-
var limit = max
|
|
18325
|
+
var limit = max;
|
|
18292
18326
|
|
|
18293
18327
|
function keep(key, value) {
|
|
18294
18328
|
if (++num > limit) {
|
|
@@ -20299,7 +20333,7 @@ const getHasModuleSideEffects = (moduleSideEffectsOption) => {
|
|
|
20299
20333
|
|
|
20300
20334
|
// https://datatracker.ietf.org/doc/html/rfc2396
|
|
20301
20335
|
// eslint-disable-next-line no-control-regex
|
|
20302
|
-
const INVALID_CHAR_REGEX = /[\u0000-\u001F"
|
|
20336
|
+
const INVALID_CHAR_REGEX = /[\u0000-\u001F"#$%&*+,:;<=>?[\]^`{|}\u007F]/g;
|
|
20303
20337
|
const DRIVE_LETTER_REGEX = /^[a-z]:/i;
|
|
20304
20338
|
function sanitizeFileName(name) {
|
|
20305
20339
|
const match = DRIVE_LETTER_REGEX.exec(name);
|
|
@@ -20528,7 +20562,7 @@ const getIndent = (config, compact) => {
|
|
|
20528
20562
|
return '';
|
|
20529
20563
|
}
|
|
20530
20564
|
const configIndent = config.indent;
|
|
20531
|
-
return configIndent === false ? '' : configIndent ?? true;
|
|
20565
|
+
return configIndent === false ? '' : (configIndent ?? true);
|
|
20532
20566
|
};
|
|
20533
20567
|
const ALLOWED_INTEROP_TYPES = new Set([
|
|
20534
20568
|
'compat',
|