@rollup/wasm-node 4.64.9 → 5.0.0-1
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 +3 -304
- package/dist/ast-types.d.ts +896 -0
- package/dist/bin/rollup +21 -22
- package/dist/es/getLogFilter.js +2 -2
- package/dist/es/parseAst.js +3 -3
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/node-entry.js +1817 -1952
- package/dist/es/shared/parseAst.js +3567 -235
- package/dist/es/shared/watch.js +1765 -9600
- package/dist/getLogFilter.js +2 -2
- package/dist/loadConfigFile.js +3 -3
- package/dist/native.js +25 -7
- package/dist/parseAst.d.ts +13 -1
- package/dist/parseAst.js +8 -2
- package/dist/rollup.android-arm-eabi.node +0 -0
- package/dist/rollup.android-arm64.node +0 -0
- package/dist/rollup.d.ts +157 -105
- package/dist/rollup.darwin-arm64.node +0 -0
- package/dist/rollup.darwin-x64.node +0 -0
- package/dist/rollup.freebsd-arm64.node +0 -0
- package/dist/rollup.freebsd-x64.node +0 -0
- package/dist/rollup.js +2 -3
- package/dist/rollup.linux-arm-gnueabihf.node +0 -0
- package/dist/rollup.linux-arm-musleabihf.node +0 -0
- package/dist/rollup.linux-arm64-gnu.node +0 -0
- package/dist/rollup.linux-arm64-musl.node +0 -0
- package/dist/rollup.linux-loong64-gnu.node +0 -0
- package/dist/rollup.linux-loong64-musl.node +0 -0
- package/dist/rollup.linux-ppc64-gnu.node +0 -0
- package/dist/rollup.linux-ppc64-musl.node +0 -0
- package/dist/rollup.linux-riscv64-gnu.node +0 -0
- package/dist/rollup.linux-riscv64-musl.node +0 -0
- package/dist/rollup.linux-s390x-gnu.node +0 -0
- package/dist/rollup.linux-x64-gnu.node +0 -0
- package/dist/rollup.linux-x64-musl.node +0 -0
- package/dist/rollup.openbsd-x64.node +0 -0
- package/dist/rollup.openharmony-arm64.node +0 -0
- package/dist/rollup.win32-arm64-msvc.node +0 -0
- package/dist/rollup.win32-ia32-msvc.node +0 -0
- package/dist/rollup.win32-x64-gnu.node +0 -0
- package/dist/rollup.win32-x64-msvc.node +0 -0
- package/dist/shared/index.js +1775 -9597
- package/dist/shared/loadConfigFile.js +9 -9
- package/dist/shared/node-entry.js +2 -4
- package/dist/shared/parseAst.js +3595 -253
- package/dist/shared/rollup.js +1670 -1783
- package/dist/shared/watch-cli.js +10 -9
- package/dist/shared/watch.js +7 -11
- package/dist/wasm-node/bindings_wasm.js +31 -3
- package/dist/wasm-node/bindings_wasm_bg.wasm +0 -0
- package/package.json +19 -22
- package/dist/shared/fsevents-importer.js +0 -37
package/dist/shared/parseAst.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js
|
|
4
|
-
|
|
3
|
+
Rollup.js v5.0.0-1
|
|
4
|
+
Sun, 18 Oct 2026 06:06:25 GMT - commit ed75a6895d5bc62fdbff91b9d48e22e6e281e3bc
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
'use strict';
|
|
11
11
|
|
|
12
12
|
const native_js = require('../native.js');
|
|
13
|
-
const
|
|
13
|
+
const sp = require('node:path');
|
|
14
14
|
|
|
15
15
|
const BLANK = Object.freeze(Object.create(null));
|
|
16
16
|
const EMPTY_OBJECT = Object.freeze({});
|
|
@@ -221,13 +221,13 @@ function relative(from, to) {
|
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
function getAliasName(id) {
|
|
224
|
-
const base =
|
|
225
|
-
return base.slice(0, Math.max(0, base.length -
|
|
224
|
+
const base = sp.basename(id);
|
|
225
|
+
return base.slice(0, Math.max(0, base.length - sp.extname(id).length));
|
|
226
226
|
}
|
|
227
227
|
function relativeId(id) {
|
|
228
228
|
if (!isAbsolute$1(id))
|
|
229
229
|
return id;
|
|
230
|
-
return relative(
|
|
230
|
+
return relative(sp.resolve(), id);
|
|
231
231
|
}
|
|
232
232
|
function isPathFragment(name) {
|
|
233
233
|
// starting with "/", "./", "../", "C:/"
|
|
@@ -239,15 +239,15 @@ function getImportPath(importerId, targetPath, stripJsExtension, ensureFileName)
|
|
|
239
239
|
targetPath = targetPath.slice(3);
|
|
240
240
|
importerId = '_/' + importerId;
|
|
241
241
|
}
|
|
242
|
-
let relativePath = normalize(relative(
|
|
242
|
+
let relativePath = normalize(relative(sp.dirname(importerId), targetPath));
|
|
243
243
|
if (stripJsExtension && relativePath.endsWith('.js')) {
|
|
244
244
|
relativePath = relativePath.slice(0, -3);
|
|
245
245
|
}
|
|
246
246
|
if (ensureFileName) {
|
|
247
247
|
if (relativePath === '')
|
|
248
|
-
return '../' +
|
|
248
|
+
return '../' + sp.basename(targetPath);
|
|
249
249
|
if (UPPER_DIR_REGEX.test(relativePath)) {
|
|
250
|
-
return [...relativePath.split('/'), '..',
|
|
250
|
+
return [...relativePath.split('/'), '..', sp.basename(targetPath)].join('/');
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
return relativePath ? (relativePath.startsWith('..') ? relativePath : './' + relativePath) : '.';
|
|
@@ -289,6 +289,7 @@ const URL_OUTPUT_EXTERNALIMPORTATTRIBUTES = 'configuration-options/#output-exter
|
|
|
289
289
|
const URL_OUTPUT_FORMAT = 'configuration-options/#output-format';
|
|
290
290
|
const URL_OUTPUT_GENERATEDCODE = 'configuration-options/#output-generatedcode';
|
|
291
291
|
const URL_OUTPUT_GLOBALS = 'configuration-options/#output-globals';
|
|
292
|
+
const URL_OUTPUT_IMPORTATTRIBUTESKEY = 'configuration-options/#output-importattributeskey';
|
|
292
293
|
const URL_OUTPUT_INLINEDYNAMICIMPORTS = 'configuration-options/#output-inlinedynamicimports';
|
|
293
294
|
const URL_OUTPUT_INTEROP = 'configuration-options/#output-interop';
|
|
294
295
|
const URL_OUTPUT_MANUALCHUNKS = 'configuration-options/#output-manualchunks';
|
|
@@ -307,6 +308,7 @@ const URL_SOURCE_PHASE_IMPORTS = 'es-module-syntax/#source-phase-import';
|
|
|
307
308
|
const URL_BUNDLE_CONFIG_AS_CJS = 'command-line-interface/#bundleconfigascjs';
|
|
308
309
|
const URL_CONFIGURATION_FILES = 'command-line-interface/#configuration-files';
|
|
309
310
|
const URL_GENERATEBUNDLE = 'plugin-development/#generatebundle';
|
|
311
|
+
const URL_THIS_RESOLVE = 'plugin-development/#this-resolve';
|
|
310
312
|
const URL_LOAD = 'plugin-development/#load';
|
|
311
313
|
const URL_TRANSFORM = 'plugin-development/#transform';
|
|
312
314
|
|
|
@@ -363,7 +365,7 @@ function augmentLogMessage(log) {
|
|
|
363
365
|
}
|
|
364
366
|
// Error codes should be sorted alphabetically while errors should be sorted by
|
|
365
367
|
// error code below
|
|
366
|
-
const ADDON_ERROR = 'ADDON_ERROR', ALREADY_CLOSED = 'ALREADY_CLOSED', AMBIGUOUS_EXTERNAL_NAMESPACES = 'AMBIGUOUS_EXTERNAL_NAMESPACES', ANONYMOUS_PLUGIN_CACHE = 'ANONYMOUS_PLUGIN_CACHE', ASSET_NOT_FINALISED = 'ASSET_NOT_FINALISED', ASSET_NOT_FOUND = 'ASSET_NOT_FOUND', ASSET_SOURCE_ALREADY_SET = 'ASSET_SOURCE_ALREADY_SET', ASSET_SOURCE_MISSING = 'ASSET_SOURCE_MISSING', BAD_LOADER = 'BAD_LOADER', CANNOT_CALL_NAMESPACE = 'CANNOT_CALL_NAMESPACE', CANNOT_EMIT_FROM_OPTIONS_HOOK = 'CANNOT_EMIT_FROM_OPTIONS_HOOK', CHUNK_NOT_GENERATED = 'CHUNK_NOT_GENERATED', CHUNK_INVALID = 'CHUNK_INVALID', CIRCULAR_CHUNK = 'CIRCULAR_CHUNK', CIRCULAR_DEPENDENCY = 'CIRCULAR_DEPENDENCY', CIRCULAR_REEXPORT = 'CIRCULAR_REEXPORT', CONST_REASSIGN = 'CONST_REASSIGN', CYCLIC_CROSS_CHUNK_REEXPORT = 'CYCLIC_CROSS_CHUNK_REEXPORT', DEPRECATED_FEATURE = 'DEPRECATED_FEATURE', DUPLICATE_ARGUMENT_NAME = 'DUPLICATE_ARGUMENT_NAME', DUPLICATE_EXPORT = 'DUPLICATE_EXPORT', DUPLICATE_IMPORT_OPTIONS = 'DUPLICATE_IMPORT_OPTIONS', DUPLICATE_PLUGIN_NAME = 'DUPLICATE_PLUGIN_NAME', EMPTY_BUNDLE = 'EMPTY_BUNDLE', EVAL = 'EVAL', EXTERNAL_MODULES_CANNOT_BE_INCLUDED_IN_MANUAL_CHUNKS = 'EXTERNAL_MODULES_CANNOT_BE_INCLUDED_IN_MANUAL_CHUNKS', EXTERNAL_MODULES_CANNOT_BE_TRANSFORMED_TO_MODULES = 'EXTERNAL_MODULES_CANNOT_BE_TRANSFORMED_TO_MODULES', EXTERNAL_SYNTHETIC_EXPORTS = 'EXTERNAL_SYNTHETIC_EXPORTS', FAIL_AFTER_WARNINGS = 'FAIL_AFTER_WARNINGS', FILE_NAME_CONFLICT = 'FILE_NAME_CONFLICT', FILE_NAME_OUTSIDE_OUTPUT_DIRECTORY = 'FILE_NAME_OUTSIDE_OUTPUT_DIRECTORY', FILE_NOT_FOUND = 'FILE_NOT_FOUND', FIRST_SIDE_EFFECT = 'FIRST_SIDE_EFFECT', ILLEGAL_IDENTIFIER_AS_NAME = 'ILLEGAL_IDENTIFIER_AS_NAME', ILLEGAL_REASSIGNMENT = 'ILLEGAL_REASSIGNMENT',
|
|
368
|
+
const ADDON_ERROR = 'ADDON_ERROR', ALREADY_CLOSED = 'ALREADY_CLOSED', AMBIGUOUS_EXTERNAL_NAMESPACES = 'AMBIGUOUS_EXTERNAL_NAMESPACES', AMBIGUOUS_GLOBAL_NAME = 'AMBIGUOUS_GLOBAL_NAME', ANONYMOUS_PLUGIN_CACHE = 'ANONYMOUS_PLUGIN_CACHE', ASSET_NOT_FINALISED = 'ASSET_NOT_FINALISED', ASSET_NOT_FOUND = 'ASSET_NOT_FOUND', ASSET_SOURCE_ALREADY_SET = 'ASSET_SOURCE_ALREADY_SET', ASSET_SOURCE_MISSING = 'ASSET_SOURCE_MISSING', BAD_LOADER = 'BAD_LOADER', CANNOT_CALL_NAMESPACE = 'CANNOT_CALL_NAMESPACE', CANNOT_EMIT_FROM_OPTIONS_HOOK = 'CANNOT_EMIT_FROM_OPTIONS_HOOK', CANNOT_SERIALIZE_AST = 'CANNOT_SERIALIZE_AST', CHUNK_NOT_GENERATED = 'CHUNK_NOT_GENERATED', CHUNK_INVALID = 'CHUNK_INVALID', CIRCULAR_CHUNK = 'CIRCULAR_CHUNK', CIRCULAR_DEPENDENCY = 'CIRCULAR_DEPENDENCY', CIRCULAR_REEXPORT = 'CIRCULAR_REEXPORT', CONST_REASSIGN = 'CONST_REASSIGN', CYCLIC_CROSS_CHUNK_REEXPORT = 'CYCLIC_CROSS_CHUNK_REEXPORT', DEPRECATED_FEATURE = 'DEPRECATED_FEATURE', DUPLICATE_ARGUMENT_NAME = 'DUPLICATE_ARGUMENT_NAME', DUPLICATE_EXPORT = 'DUPLICATE_EXPORT', DUPLICATE_IMPORT_OPTIONS = 'DUPLICATE_IMPORT_OPTIONS', DUPLICATE_PLUGIN_NAME = 'DUPLICATE_PLUGIN_NAME', EMPTY_BUNDLE = 'EMPTY_BUNDLE', EMPTY_MANUAL_CHUNK = 'EMPTY_MANUAL_CHUNK', EVAL = 'EVAL', EXTERNAL_MODULES_CANNOT_BE_INCLUDED_IN_MANUAL_CHUNKS = 'EXTERNAL_MODULES_CANNOT_BE_INCLUDED_IN_MANUAL_CHUNKS', EXTERNAL_MODULES_CANNOT_BE_TRANSFORMED_TO_MODULES = 'EXTERNAL_MODULES_CANNOT_BE_TRANSFORMED_TO_MODULES', EXTERNAL_SYNTHETIC_EXPORTS = 'EXTERNAL_SYNTHETIC_EXPORTS', FAIL_AFTER_WARNINGS = 'FAIL_AFTER_WARNINGS', FILE_NAME_CONFLICT = 'FILE_NAME_CONFLICT', FILE_NAME_OUTSIDE_OUTPUT_DIRECTORY = 'FILE_NAME_OUTSIDE_OUTPUT_DIRECTORY', FILE_NOT_FOUND = 'FILE_NOT_FOUND', FIRST_SIDE_EFFECT = 'FIRST_SIDE_EFFECT', ILLEGAL_IDENTIFIER_AS_NAME = 'ILLEGAL_IDENTIFIER_AS_NAME', ILLEGAL_REASSIGNMENT = 'ILLEGAL_REASSIGNMENT', INVALID_ANNOTATION = 'INVALID_ANNOTATION', INPUT_HOOK_IN_OUTPUT_PLUGIN = 'INPUT_HOOK_IN_OUTPUT_PLUGIN', INVALID_CHUNK = 'INVALID_CHUNK', INVALID_CONFIG_MODULE_FORMAT = 'INVALID_CONFIG_MODULE_FORMAT', INVALID_EXPORT_OPTION = 'INVALID_EXPORT_OPTION', INVALID_EXTERNAL_ID = 'INVALID_EXTERNAL_ID', INVALID_IMPORT_ATTRIBUTE = 'INVALID_IMPORT_ATTRIBUTE', INVALID_LOG_POSITION = 'INVALID_LOG_POSITION', INVALID_OPTION = 'INVALID_OPTION', INVALID_PLUGIN_HOOK = 'INVALID_PLUGIN_HOOK', INVALID_ROLLUP_PHASE = 'INVALID_ROLLUP_PHASE', INVALID_SETASSETSOURCE = 'INVALID_SETASSETSOURCE', INVALID_TLA_FORMAT = 'INVALID_TLA_FORMAT', MISSING_CONFIG = 'MISSING_CONFIG', MISSING_EXPORT = 'MISSING_EXPORT', MISSING_EXTERNAL_CONFIG = 'MISSING_EXTERNAL_CONFIG', MISSING_GLOBAL_NAME = 'MISSING_GLOBAL_NAME', MISSING_IMPLICIT_DEPENDANT = 'MISSING_IMPLICIT_DEPENDANT', MISSING_JSX_EXPORT = 'MISSING_JSX_EXPORT', MISSING_NAME_OPTION_FOR_IIFE_EXPORT = 'MISSING_NAME_OPTION_FOR_IIFE_EXPORT', MISSING_NODE_BUILTINS = 'MISSING_NODE_BUILTINS', MISSING_OPTION = 'MISSING_OPTION', MIXED_EXPORTS = 'MIXED_EXPORTS', MODULE_LEVEL_DIRECTIVE = 'MODULE_LEVEL_DIRECTIVE', NAMESPACE_CONFLICT = 'NAMESPACE_CONFLICT', NON_EXTERNAL_SOURCE_PHASE_IMPORT = 'NON_EXTERNAL_SOURCE_PHASE_IMPORT', NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE = 'NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE', ONLY_INLINE_SOURCEMAPS = 'ONLY_INLINE_SOURCEMAPS', OPTIMIZE_CHUNK_STATUS = 'OPTIMIZE_CHUNK_STATUS', PARSE_ERROR = 'PARSE_ERROR', PLUGIN_ERROR = 'PLUGIN_ERROR', REDECLARATION_ERROR = 'REDECLARATION_ERROR', RESERVED_NAMESPACE = 'RESERVED_NAMESPACE', SHIMMED_EXPORT = 'SHIMMED_EXPORT', SOURCE_PHASE_FORMAT_UNSUPPORTED = 'SOURCE_PHASE_FORMAT_UNSUPPORTED', SOURCEMAP_BROKEN = 'SOURCEMAP_BROKEN', SOURCEMAP_ERROR = 'SOURCEMAP_ERROR', SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT = 'SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT', THIS_IS_UNDEFINED = 'THIS_IS_UNDEFINED', UNEXPECTED_NAMED_IMPORT = 'UNEXPECTED_NAMED_IMPORT', UNKNOWN_OPTION = 'UNKNOWN_OPTION', UNRESOLVED_ENTRY = 'UNRESOLVED_ENTRY', UNRESOLVED_IMPORT = 'UNRESOLVED_IMPORT', UNUSED_EXTERNAL_IMPORT = 'UNUSED_EXTERNAL_IMPORT', VALIDATION_ERROR = 'VALIDATION_ERROR';
|
|
367
369
|
function logAddonNotGenerated(message, hook, plugin) {
|
|
368
370
|
return {
|
|
369
371
|
code: ADDON_ERROR,
|
|
@@ -386,6 +388,14 @@ function logAmbiguousExternalNamespaces(binding, reexportingModule, usedModule,
|
|
|
386
388
|
reexporter: reexportingModule
|
|
387
389
|
};
|
|
388
390
|
}
|
|
391
|
+
function logAmbiguousGlobalName(rawId, globalName) {
|
|
392
|
+
return {
|
|
393
|
+
code: AMBIGUOUS_GLOBAL_NAME,
|
|
394
|
+
id: rawId,
|
|
395
|
+
message: `The object form of "output.globals" maps several import attribute variants of the external module "${rawId}" to the same global name "${globalName}". Use the function form of "output.globals" to give each variant its own global name.`,
|
|
396
|
+
url: getRollupUrl(URL_OUTPUT_GLOBALS)
|
|
397
|
+
};
|
|
398
|
+
}
|
|
389
399
|
function logAnonymousPluginCache() {
|
|
390
400
|
return {
|
|
391
401
|
code: ANONYMOUS_PLUGIN_CACHE,
|
|
@@ -434,6 +444,19 @@ function logCannotEmitFromOptionsHook() {
|
|
|
434
444
|
message: `Cannot emit files or set asset sources in the "outputOptions" hook, use the "renderStart" hook instead.`
|
|
435
445
|
};
|
|
436
446
|
}
|
|
447
|
+
function logUnknownNodeType(type, parentType, field) {
|
|
448
|
+
const location = parentType ? `in ${parentType}.${field}` : 'at the root';
|
|
449
|
+
return {
|
|
450
|
+
code: CANNOT_SERIALIZE_AST,
|
|
451
|
+
message: `Could not serialize AST: Found unknown node type "${type}" ${location}.`
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
function logExpectedNodeList(parentType, field, value) {
|
|
455
|
+
return {
|
|
456
|
+
code: CANNOT_SERIALIZE_AST,
|
|
457
|
+
message: `Could not serialize AST: Expected ${parentType}.${field} to be an array, but it was ${JSON.stringify(value)}.`
|
|
458
|
+
};
|
|
459
|
+
}
|
|
437
460
|
function logChunkNotGeneratedForFileName(name) {
|
|
438
461
|
return {
|
|
439
462
|
code: CHUNK_NOT_GENERATED,
|
|
@@ -455,13 +478,17 @@ function logCircularDependency(cyclePath) {
|
|
|
455
478
|
message: `Circular dependency: ${cyclePath.map(relativeId).join(' -> ')}`
|
|
456
479
|
};
|
|
457
480
|
}
|
|
458
|
-
function logCircularChunk(cyclePath,
|
|
481
|
+
function logCircularChunk(cyclePath, manualChunkNames, nonManualChunkName, onlyExplicitManualChunks) {
|
|
459
482
|
return {
|
|
460
483
|
code: CIRCULAR_CHUNK,
|
|
461
484
|
ids: cyclePath,
|
|
462
|
-
message:
|
|
463
|
-
? `
|
|
464
|
-
: `
|
|
485
|
+
message: manualChunkNames.length === 0
|
|
486
|
+
? `Circular chunk: ${cyclePath.join(' -> ')}.`
|
|
487
|
+
: `Circular chunk: ${cyclePath.join(' -> ')}. ${nonManualChunkName === undefined
|
|
488
|
+
? `Please adjust the manual chunk logic for these chunks.`
|
|
489
|
+
: onlyExplicitManualChunks
|
|
490
|
+
? `Please consider disabling the "output.onlyExplicitManualChunks" option, as enabling it causes modules located between the modules included in the manual chunk "${manualChunkNames[0]}" to be extracted into the separate chunk "${nonManualChunkName}".`
|
|
491
|
+
: `Please adjust the manual chunks or the module structure.`}`
|
|
465
492
|
};
|
|
466
493
|
}
|
|
467
494
|
function logCircularReexport(exportName, exporter) {
|
|
@@ -485,7 +512,7 @@ function logDeprecation(deprecation, urlSnippet, plugin) {
|
|
|
485
512
|
code: DEPRECATED_FEATURE,
|
|
486
513
|
message: deprecation,
|
|
487
514
|
url: getRollupUrl(urlSnippet),
|
|
488
|
-
...({})
|
|
515
|
+
...(plugin ? { plugin } : {})
|
|
489
516
|
};
|
|
490
517
|
}
|
|
491
518
|
function logConstVariableReassignError() {
|
|
@@ -522,6 +549,14 @@ function logEmptyChunk(chunkName) {
|
|
|
522
549
|
names: [chunkName]
|
|
523
550
|
};
|
|
524
551
|
}
|
|
552
|
+
function logEmptyManualChunk(alias) {
|
|
553
|
+
return {
|
|
554
|
+
code: EMPTY_MANUAL_CHUNK,
|
|
555
|
+
message: `Manual chunk "${alias}" was not generated as none of its modules are included in the bundle.`,
|
|
556
|
+
names: [alias],
|
|
557
|
+
url: getRollupUrl(URL_OUTPUT_MANUALCHUNKS)
|
|
558
|
+
};
|
|
559
|
+
}
|
|
525
560
|
function logEval(id) {
|
|
526
561
|
return {
|
|
527
562
|
code: EVAL,
|
|
@@ -580,18 +615,6 @@ function logIllegalImportReassignment(name, importingId) {
|
|
|
580
615
|
message: `Illegal reassignment of import "${name}" in "${relativeId(importingId)}".`
|
|
581
616
|
};
|
|
582
617
|
}
|
|
583
|
-
function logInconsistentImportAttributes(existingAttributes, newAttributes, source, importer) {
|
|
584
|
-
return {
|
|
585
|
-
code: INCONSISTENT_IMPORT_ATTRIBUTES,
|
|
586
|
-
message: `Module "${relativeId(importer)}" tried to import "${relativeId(source)}" with ${formatAttributes(newAttributes)} attributes, but it was already imported elsewhere with ${formatAttributes(existingAttributes)} attributes. Please ensure that import attributes for the same module are always consistent.`
|
|
587
|
-
};
|
|
588
|
-
}
|
|
589
|
-
const formatAttributes = (attributes) => {
|
|
590
|
-
const entries = Object.entries(attributes);
|
|
591
|
-
if (entries.length === 0)
|
|
592
|
-
return 'no';
|
|
593
|
-
return entries.map(([key, value]) => `"${key}": "${value}"`).join(', ');
|
|
594
|
-
};
|
|
595
618
|
function logInvalidAnnotation(comment, id, type) {
|
|
596
619
|
return {
|
|
597
620
|
code: INVALID_ANNOTATION,
|
|
@@ -756,7 +779,7 @@ function logMissingExport(binding, importingModule, exporter, missingButExportEx
|
|
|
756
779
|
message: `Exported variable "${binding}" is not defined in "${relativeId(exporter)}", but it is imported by "${relativeId(importingModule)}".`
|
|
757
780
|
};
|
|
758
781
|
}
|
|
759
|
-
const isJson =
|
|
782
|
+
const isJson = sp.extname(exporter) === '.json';
|
|
760
783
|
return {
|
|
761
784
|
...baseLog,
|
|
762
785
|
message: `"${binding}" is not exported by "${relativeId(exporter)}", imported by "${relativeId(importingModule)}".${isJson ? ' (Note that you need @rollup/plugin-json to import JSON files)' : ''}`
|
|
@@ -1078,11 +1101,11 @@ function logFailedValidation(message) {
|
|
|
1078
1101
|
};
|
|
1079
1102
|
}
|
|
1080
1103
|
function warnDeprecation(deprecation, urlSnippet, activeDeprecation, options, plugin) {
|
|
1081
|
-
warnDeprecationWithOptions(deprecation, urlSnippet, activeDeprecation, options.onLog, options.strictDeprecations);
|
|
1104
|
+
warnDeprecationWithOptions(deprecation, urlSnippet, activeDeprecation, options.onLog, options.strictDeprecations, plugin);
|
|
1082
1105
|
}
|
|
1083
1106
|
function warnDeprecationWithOptions(deprecation, urlSnippet, activeDeprecation, log, strictDeprecations, plugin) {
|
|
1084
1107
|
if (activeDeprecation || strictDeprecations) {
|
|
1085
|
-
const warning = logDeprecation(deprecation, urlSnippet);
|
|
1108
|
+
const warning = logDeprecation(deprecation, urlSnippet, plugin);
|
|
1086
1109
|
if (strictDeprecations) {
|
|
1087
1110
|
return error(warning);
|
|
1088
1111
|
}
|
|
@@ -1090,7 +1113,201 @@ function warnDeprecationWithOptions(deprecation, urlSnippet, activeDeprecation,
|
|
|
1090
1113
|
}
|
|
1091
1114
|
}
|
|
1092
1115
|
|
|
1093
|
-
// This file is generated by scripts/generate-node-
|
|
1116
|
+
// This file is generated by scripts/generate-node-ids.ts.
|
|
1117
|
+
// Do not edit this file directly.
|
|
1118
|
+
const nodeIds = {
|
|
1119
|
+
ArrayExpression: [2],
|
|
1120
|
+
ArrayPattern: [3],
|
|
1121
|
+
ArrowFunctionExpression: [4],
|
|
1122
|
+
AssignmentExpression: [5],
|
|
1123
|
+
AssignmentPattern: [6],
|
|
1124
|
+
AwaitExpression: [7],
|
|
1125
|
+
BinaryExpression: [8],
|
|
1126
|
+
BlockStatement: [9],
|
|
1127
|
+
BreakStatement: [10],
|
|
1128
|
+
CallExpression: [11],
|
|
1129
|
+
CatchClause: [12],
|
|
1130
|
+
ChainExpression: [13],
|
|
1131
|
+
ClassBody: [14],
|
|
1132
|
+
ClassDeclaration: [15],
|
|
1133
|
+
ClassExpression: [16],
|
|
1134
|
+
ConditionalExpression: [17],
|
|
1135
|
+
ContinueStatement: [18],
|
|
1136
|
+
DebuggerStatement: [19],
|
|
1137
|
+
Decorator: [20],
|
|
1138
|
+
DoWhileStatement: [22],
|
|
1139
|
+
EmptyStatement: [23],
|
|
1140
|
+
ExportAllDeclaration: [24],
|
|
1141
|
+
ExportDefaultDeclaration: [25],
|
|
1142
|
+
ExportNamedDeclaration: [26],
|
|
1143
|
+
ExportSpecifier: [27],
|
|
1144
|
+
ExpressionStatement: [21, 28],
|
|
1145
|
+
ForInStatement: [29],
|
|
1146
|
+
ForOfStatement: [30],
|
|
1147
|
+
ForStatement: [31],
|
|
1148
|
+
FunctionDeclaration: [32],
|
|
1149
|
+
FunctionExpression: [33],
|
|
1150
|
+
Identifier: [34],
|
|
1151
|
+
IfStatement: [35],
|
|
1152
|
+
ImportAttribute: [36],
|
|
1153
|
+
ImportDeclaration: [37],
|
|
1154
|
+
ImportDefaultSpecifier: [38],
|
|
1155
|
+
ImportExpression: [39],
|
|
1156
|
+
ImportNamespaceSpecifier: [40],
|
|
1157
|
+
ImportSpecifier: [41],
|
|
1158
|
+
JSXAttribute: [42],
|
|
1159
|
+
JSXClosingElement: [43],
|
|
1160
|
+
JSXClosingFragment: [44],
|
|
1161
|
+
JSXElement: [45],
|
|
1162
|
+
JSXEmptyExpression: [46],
|
|
1163
|
+
JSXExpressionContainer: [47],
|
|
1164
|
+
JSXFragment: [48],
|
|
1165
|
+
JSXIdentifier: [49],
|
|
1166
|
+
JSXMemberExpression: [50],
|
|
1167
|
+
JSXNamespacedName: [51],
|
|
1168
|
+
JSXOpeningElement: [52],
|
|
1169
|
+
JSXOpeningFragment: [53],
|
|
1170
|
+
JSXSpreadAttribute: [54],
|
|
1171
|
+
JSXSpreadChild: [55],
|
|
1172
|
+
JSXText: [56],
|
|
1173
|
+
LabeledStatement: [57],
|
|
1174
|
+
Literal: [58, 59, 60, 61, 62, 63],
|
|
1175
|
+
LogicalExpression: [64],
|
|
1176
|
+
MemberExpression: [65],
|
|
1177
|
+
MetaProperty: [66],
|
|
1178
|
+
MethodDefinition: [67],
|
|
1179
|
+
NewExpression: [68],
|
|
1180
|
+
ObjectExpression: [69],
|
|
1181
|
+
ObjectPattern: [70],
|
|
1182
|
+
PanicError: [0],
|
|
1183
|
+
ParseError: [1],
|
|
1184
|
+
PrivateIdentifier: [71],
|
|
1185
|
+
Program: [72],
|
|
1186
|
+
Property: [73],
|
|
1187
|
+
PropertyDefinition: [74],
|
|
1188
|
+
RestElement: [75],
|
|
1189
|
+
ReturnStatement: [76],
|
|
1190
|
+
SequenceExpression: [77],
|
|
1191
|
+
SpreadElement: [78],
|
|
1192
|
+
StaticBlock: [79],
|
|
1193
|
+
Super: [80],
|
|
1194
|
+
SwitchCase: [81],
|
|
1195
|
+
SwitchStatement: [82],
|
|
1196
|
+
TaggedTemplateExpression: [83],
|
|
1197
|
+
TemplateElement: [84],
|
|
1198
|
+
TemplateLiteral: [85],
|
|
1199
|
+
ThisExpression: [86],
|
|
1200
|
+
ThrowStatement: [87],
|
|
1201
|
+
TryStatement: [88],
|
|
1202
|
+
UnaryExpression: [89],
|
|
1203
|
+
UpdateExpression: [90],
|
|
1204
|
+
VariableDeclaration: [91],
|
|
1205
|
+
VariableDeclarator: [92],
|
|
1206
|
+
WhileStatement: [93],
|
|
1207
|
+
YieldExpression: [94]
|
|
1208
|
+
};
|
|
1209
|
+
|
|
1210
|
+
// This file is generated by scripts/generate-node-type-strings.ts.
|
|
1211
|
+
// Do not edit this file directly.
|
|
1212
|
+
const nodeTypeStrings = [
|
|
1213
|
+
'PanicError',
|
|
1214
|
+
'ParseError',
|
|
1215
|
+
'ArrayExpression',
|
|
1216
|
+
'ArrayPattern',
|
|
1217
|
+
'ArrowFunctionExpression',
|
|
1218
|
+
'AssignmentExpression',
|
|
1219
|
+
'AssignmentPattern',
|
|
1220
|
+
'AwaitExpression',
|
|
1221
|
+
'BinaryExpression',
|
|
1222
|
+
'BlockStatement',
|
|
1223
|
+
'BreakStatement',
|
|
1224
|
+
'CallExpression',
|
|
1225
|
+
'CatchClause',
|
|
1226
|
+
'ChainExpression',
|
|
1227
|
+
'ClassBody',
|
|
1228
|
+
'ClassDeclaration',
|
|
1229
|
+
'ClassExpression',
|
|
1230
|
+
'ConditionalExpression',
|
|
1231
|
+
'ContinueStatement',
|
|
1232
|
+
'DebuggerStatement',
|
|
1233
|
+
'Decorator',
|
|
1234
|
+
'ExpressionStatement',
|
|
1235
|
+
'DoWhileStatement',
|
|
1236
|
+
'EmptyStatement',
|
|
1237
|
+
'ExportAllDeclaration',
|
|
1238
|
+
'ExportDefaultDeclaration',
|
|
1239
|
+
'ExportNamedDeclaration',
|
|
1240
|
+
'ExportSpecifier',
|
|
1241
|
+
'ExpressionStatement',
|
|
1242
|
+
'ForInStatement',
|
|
1243
|
+
'ForOfStatement',
|
|
1244
|
+
'ForStatement',
|
|
1245
|
+
'FunctionDeclaration',
|
|
1246
|
+
'FunctionExpression',
|
|
1247
|
+
'Identifier',
|
|
1248
|
+
'IfStatement',
|
|
1249
|
+
'ImportAttribute',
|
|
1250
|
+
'ImportDeclaration',
|
|
1251
|
+
'ImportDefaultSpecifier',
|
|
1252
|
+
'ImportExpression',
|
|
1253
|
+
'ImportNamespaceSpecifier',
|
|
1254
|
+
'ImportSpecifier',
|
|
1255
|
+
'JSXAttribute',
|
|
1256
|
+
'JSXClosingElement',
|
|
1257
|
+
'JSXClosingFragment',
|
|
1258
|
+
'JSXElement',
|
|
1259
|
+
'JSXEmptyExpression',
|
|
1260
|
+
'JSXExpressionContainer',
|
|
1261
|
+
'JSXFragment',
|
|
1262
|
+
'JSXIdentifier',
|
|
1263
|
+
'JSXMemberExpression',
|
|
1264
|
+
'JSXNamespacedName',
|
|
1265
|
+
'JSXOpeningElement',
|
|
1266
|
+
'JSXOpeningFragment',
|
|
1267
|
+
'JSXSpreadAttribute',
|
|
1268
|
+
'JSXSpreadChild',
|
|
1269
|
+
'JSXText',
|
|
1270
|
+
'LabeledStatement',
|
|
1271
|
+
'Literal',
|
|
1272
|
+
'Literal',
|
|
1273
|
+
'Literal',
|
|
1274
|
+
'Literal',
|
|
1275
|
+
'Literal',
|
|
1276
|
+
'Literal',
|
|
1277
|
+
'LogicalExpression',
|
|
1278
|
+
'MemberExpression',
|
|
1279
|
+
'MetaProperty',
|
|
1280
|
+
'MethodDefinition',
|
|
1281
|
+
'NewExpression',
|
|
1282
|
+
'ObjectExpression',
|
|
1283
|
+
'ObjectPattern',
|
|
1284
|
+
'PrivateIdentifier',
|
|
1285
|
+
'Program',
|
|
1286
|
+
'Property',
|
|
1287
|
+
'PropertyDefinition',
|
|
1288
|
+
'RestElement',
|
|
1289
|
+
'ReturnStatement',
|
|
1290
|
+
'SequenceExpression',
|
|
1291
|
+
'SpreadElement',
|
|
1292
|
+
'StaticBlock',
|
|
1293
|
+
'Super',
|
|
1294
|
+
'SwitchCase',
|
|
1295
|
+
'SwitchStatement',
|
|
1296
|
+
'TaggedTemplateExpression',
|
|
1297
|
+
'TemplateElement',
|
|
1298
|
+
'TemplateLiteral',
|
|
1299
|
+
'ThisExpression',
|
|
1300
|
+
'ThrowStatement',
|
|
1301
|
+
'TryStatement',
|
|
1302
|
+
'UnaryExpression',
|
|
1303
|
+
'UpdateExpression',
|
|
1304
|
+
'VariableDeclaration',
|
|
1305
|
+
'VariableDeclarator',
|
|
1306
|
+
'WhileStatement',
|
|
1307
|
+
'YieldExpression'
|
|
1308
|
+
];
|
|
1309
|
+
|
|
1310
|
+
// This file is generated by scripts/generate-node-types.ts.
|
|
1094
1311
|
// Do not edit this file directly.
|
|
1095
1312
|
const ArrowFunctionExpression = 'ArrowFunctionExpression';
|
|
1096
1313
|
const AwaitExpression = 'AwaitExpression';
|
|
@@ -1099,8 +1316,10 @@ const CallExpression = 'CallExpression';
|
|
|
1099
1316
|
const CatchClause = 'CatchClause';
|
|
1100
1317
|
const ExportDefaultDeclaration = 'ExportDefaultDeclaration';
|
|
1101
1318
|
const ExpressionStatement = 'ExpressionStatement';
|
|
1319
|
+
const FunctionDeclaration = 'FunctionDeclaration';
|
|
1102
1320
|
const FunctionExpression = 'FunctionExpression';
|
|
1103
1321
|
const Identifier = 'Identifier';
|
|
1322
|
+
const IfStatement$1 = 'IfStatement';
|
|
1104
1323
|
const Literal = 'Literal';
|
|
1105
1324
|
const MemberExpression = 'MemberExpression';
|
|
1106
1325
|
const ObjectExpression = 'ObjectExpression';
|
|
@@ -1114,7 +1333,7 @@ const StaticBlock = 'StaticBlock';
|
|
|
1114
1333
|
const TemplateLiteral = 'TemplateLiteral';
|
|
1115
1334
|
const VariableDeclarator = 'VariableDeclarator';
|
|
1116
1335
|
|
|
1117
|
-
// This file is generated by scripts/generate-string-constants.
|
|
1336
|
+
// This file is generated by scripts/generate-string-constants.ts.
|
|
1118
1337
|
// Do not edit this file directly.
|
|
1119
1338
|
const FIXED_STRINGS = [
|
|
1120
1339
|
'var',
|
|
@@ -1145,8 +1364,6 @@ const FIXED_STRINGS = [
|
|
|
1145
1364
|
'<<',
|
|
1146
1365
|
'>>',
|
|
1147
1366
|
'>>>',
|
|
1148
|
-
'+',
|
|
1149
|
-
'-',
|
|
1150
1367
|
'*',
|
|
1151
1368
|
'/',
|
|
1152
1369
|
'%',
|
|
@@ -1184,8 +1401,6 @@ const FIXED_STRINGS = [
|
|
|
1184
1401
|
'defer'
|
|
1185
1402
|
];
|
|
1186
1403
|
|
|
1187
|
-
const ANNOTATION_KEY = '_rollupAnnotations';
|
|
1188
|
-
const INVALID_ANNOTATION_KEY = '_rollupRemoved';
|
|
1189
1404
|
const convertAnnotations = (position, buffer) => {
|
|
1190
1405
|
if (position === 0)
|
|
1191
1406
|
return EMPTY_ARRAY;
|
|
@@ -1203,10 +1418,10 @@ const convertAnnotation = (position, buffer) => {
|
|
|
1203
1418
|
return { end, start, type };
|
|
1204
1419
|
};
|
|
1205
1420
|
|
|
1206
|
-
// This file is generated by scripts/generate-buffer-to-ast.
|
|
1421
|
+
// This file is generated by scripts/generate-buffer-to-lazy-ast.ts.
|
|
1207
1422
|
// Do not edit this file directly.
|
|
1208
|
-
|
|
1209
|
-
const node = convertNode(
|
|
1423
|
+
const deserializeLazyAstBuffer = (buffer, position) => {
|
|
1424
|
+
const node = convertNode$1(position, buffer);
|
|
1210
1425
|
switch (node.type) {
|
|
1211
1426
|
case PanicError: {
|
|
1212
1427
|
return error(getRollupError(logParseError(node.message)));
|
|
@@ -1218,621 +1433,1119 @@ function convertProgram(buffer) {
|
|
|
1218
1433
|
return node;
|
|
1219
1434
|
}
|
|
1220
1435
|
}
|
|
1221
|
-
}
|
|
1436
|
+
};
|
|
1222
1437
|
/* eslint-disable sort-keys */
|
|
1223
|
-
const nodeConverters = [
|
|
1438
|
+
const nodeConverters$1 = [
|
|
1224
1439
|
function panicError(position, buffer) {
|
|
1225
|
-
|
|
1440
|
+
const node = {
|
|
1226
1441
|
type: 'PanicError',
|
|
1227
1442
|
start: buffer[position],
|
|
1228
1443
|
end: buffer[position + 1],
|
|
1229
|
-
message
|
|
1444
|
+
get message() {
|
|
1445
|
+
const result = buffer.convertString(buffer[position + 2]);
|
|
1446
|
+
Object.defineProperty(node, 'message', { value: result });
|
|
1447
|
+
return result;
|
|
1448
|
+
}
|
|
1230
1449
|
};
|
|
1450
|
+
return node;
|
|
1231
1451
|
},
|
|
1232
1452
|
function parseError(position, buffer) {
|
|
1233
|
-
|
|
1453
|
+
const node = {
|
|
1234
1454
|
type: 'ParseError',
|
|
1235
1455
|
start: buffer[position],
|
|
1236
1456
|
end: buffer[position + 1],
|
|
1237
|
-
message
|
|
1457
|
+
get message() {
|
|
1458
|
+
const result = buffer.convertString(buffer[position + 2]);
|
|
1459
|
+
Object.defineProperty(node, 'message', { value: result });
|
|
1460
|
+
return result;
|
|
1461
|
+
}
|
|
1238
1462
|
};
|
|
1463
|
+
return node;
|
|
1239
1464
|
},
|
|
1240
1465
|
function arrayExpression(position, buffer) {
|
|
1241
|
-
|
|
1466
|
+
const node = {
|
|
1242
1467
|
type: 'ArrayExpression',
|
|
1243
1468
|
start: buffer[position],
|
|
1244
1469
|
end: buffer[position + 1],
|
|
1245
|
-
elements
|
|
1470
|
+
get elements() {
|
|
1471
|
+
const result = convertNodeList$1(buffer[position + 2], buffer);
|
|
1472
|
+
Object.defineProperty(node, 'elements', { value: result });
|
|
1473
|
+
return result;
|
|
1474
|
+
}
|
|
1246
1475
|
};
|
|
1476
|
+
return node;
|
|
1247
1477
|
},
|
|
1248
1478
|
function arrayPattern(position, buffer) {
|
|
1249
|
-
|
|
1479
|
+
const node = {
|
|
1250
1480
|
type: 'ArrayPattern',
|
|
1251
1481
|
start: buffer[position],
|
|
1252
1482
|
end: buffer[position + 1],
|
|
1253
|
-
elements
|
|
1483
|
+
get elements() {
|
|
1484
|
+
const result = convertNodeList$1(buffer[position + 2], buffer);
|
|
1485
|
+
Object.defineProperty(node, 'elements', { value: result });
|
|
1486
|
+
return result;
|
|
1487
|
+
}
|
|
1254
1488
|
};
|
|
1489
|
+
return node;
|
|
1255
1490
|
},
|
|
1256
1491
|
function arrowFunctionExpression(position, buffer) {
|
|
1257
1492
|
const flags = buffer[position + 2];
|
|
1258
1493
|
const annotations = convertAnnotations(buffer[position + 3], buffer);
|
|
1259
|
-
|
|
1494
|
+
const node = {
|
|
1260
1495
|
type: 'ArrowFunctionExpression',
|
|
1261
1496
|
start: buffer[position],
|
|
1262
1497
|
end: buffer[position + 1],
|
|
1263
1498
|
async: (flags & 1) === 1,
|
|
1264
1499
|
expression: (flags & 2) === 2,
|
|
1265
1500
|
generator: (flags & 4) === 4,
|
|
1266
|
-
...(annotations.length > 0 ? {
|
|
1267
|
-
params
|
|
1268
|
-
|
|
1501
|
+
...(annotations.length > 0 ? { annotations } : {}),
|
|
1502
|
+
get params() {
|
|
1503
|
+
const result = convertNodeList$1(buffer[position + 4], buffer);
|
|
1504
|
+
Object.defineProperty(node, 'params', { value: result });
|
|
1505
|
+
return result;
|
|
1506
|
+
},
|
|
1507
|
+
get body() {
|
|
1508
|
+
const result = convertNode$1(buffer[position + 5], buffer);
|
|
1509
|
+
Object.defineProperty(node, 'body', { value: result });
|
|
1510
|
+
return result;
|
|
1511
|
+
},
|
|
1269
1512
|
id: null
|
|
1270
1513
|
};
|
|
1514
|
+
return node;
|
|
1271
1515
|
},
|
|
1272
1516
|
function assignmentExpression(position, buffer) {
|
|
1273
|
-
|
|
1517
|
+
const node = {
|
|
1274
1518
|
type: 'AssignmentExpression',
|
|
1275
1519
|
start: buffer[position],
|
|
1276
1520
|
end: buffer[position + 1],
|
|
1277
|
-
operator
|
|
1278
|
-
|
|
1279
|
-
|
|
1521
|
+
get operator() {
|
|
1522
|
+
const result = FIXED_STRINGS[buffer[position + 2]];
|
|
1523
|
+
Object.defineProperty(node, 'operator', { value: result });
|
|
1524
|
+
return result;
|
|
1525
|
+
},
|
|
1526
|
+
get left() {
|
|
1527
|
+
const result = convertNode$1(buffer[position + 3], buffer);
|
|
1528
|
+
Object.defineProperty(node, 'left', { value: result });
|
|
1529
|
+
return result;
|
|
1530
|
+
},
|
|
1531
|
+
get right() {
|
|
1532
|
+
const result = convertNode$1(buffer[position + 4], buffer);
|
|
1533
|
+
Object.defineProperty(node, 'right', { value: result });
|
|
1534
|
+
return result;
|
|
1535
|
+
}
|
|
1280
1536
|
};
|
|
1537
|
+
return node;
|
|
1281
1538
|
},
|
|
1282
1539
|
function assignmentPattern(position, buffer) {
|
|
1283
|
-
|
|
1540
|
+
const node = {
|
|
1284
1541
|
type: 'AssignmentPattern',
|
|
1285
1542
|
start: buffer[position],
|
|
1286
1543
|
end: buffer[position + 1],
|
|
1287
|
-
left
|
|
1288
|
-
|
|
1544
|
+
get left() {
|
|
1545
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
1546
|
+
Object.defineProperty(node, 'left', { value: result });
|
|
1547
|
+
return result;
|
|
1548
|
+
},
|
|
1549
|
+
get right() {
|
|
1550
|
+
const result = convertNode$1(buffer[position + 3], buffer);
|
|
1551
|
+
Object.defineProperty(node, 'right', { value: result });
|
|
1552
|
+
return result;
|
|
1553
|
+
}
|
|
1289
1554
|
};
|
|
1555
|
+
return node;
|
|
1290
1556
|
},
|
|
1291
1557
|
function awaitExpression(position, buffer) {
|
|
1292
|
-
|
|
1558
|
+
const node = {
|
|
1293
1559
|
type: 'AwaitExpression',
|
|
1294
1560
|
start: buffer[position],
|
|
1295
1561
|
end: buffer[position + 1],
|
|
1296
|
-
argument
|
|
1562
|
+
get argument() {
|
|
1563
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
1564
|
+
Object.defineProperty(node, 'argument', { value: result });
|
|
1565
|
+
return result;
|
|
1566
|
+
}
|
|
1297
1567
|
};
|
|
1568
|
+
return node;
|
|
1298
1569
|
},
|
|
1299
1570
|
function binaryExpression(position, buffer) {
|
|
1300
|
-
|
|
1571
|
+
const node = {
|
|
1301
1572
|
type: 'BinaryExpression',
|
|
1302
1573
|
start: buffer[position],
|
|
1303
1574
|
end: buffer[position + 1],
|
|
1304
|
-
operator
|
|
1305
|
-
|
|
1306
|
-
|
|
1575
|
+
get operator() {
|
|
1576
|
+
const result = FIXED_STRINGS[buffer[position + 2]];
|
|
1577
|
+
Object.defineProperty(node, 'operator', { value: result });
|
|
1578
|
+
return result;
|
|
1579
|
+
},
|
|
1580
|
+
get left() {
|
|
1581
|
+
const result = convertNode$1(buffer[position + 3], buffer);
|
|
1582
|
+
Object.defineProperty(node, 'left', { value: result });
|
|
1583
|
+
return result;
|
|
1584
|
+
},
|
|
1585
|
+
get right() {
|
|
1586
|
+
const result = convertNode$1(buffer[position + 4], buffer);
|
|
1587
|
+
Object.defineProperty(node, 'right', { value: result });
|
|
1588
|
+
return result;
|
|
1589
|
+
}
|
|
1307
1590
|
};
|
|
1591
|
+
return node;
|
|
1308
1592
|
},
|
|
1309
1593
|
function blockStatement(position, buffer) {
|
|
1310
|
-
|
|
1594
|
+
const node = {
|
|
1311
1595
|
type: 'BlockStatement',
|
|
1312
1596
|
start: buffer[position],
|
|
1313
1597
|
end: buffer[position + 1],
|
|
1314
|
-
body
|
|
1598
|
+
get body() {
|
|
1599
|
+
const result = convertNodeList$1(buffer[position + 2], buffer);
|
|
1600
|
+
Object.defineProperty(node, 'body', { value: result });
|
|
1601
|
+
return result;
|
|
1602
|
+
}
|
|
1315
1603
|
};
|
|
1604
|
+
return node;
|
|
1316
1605
|
},
|
|
1317
1606
|
function breakStatement(position, buffer) {
|
|
1318
1607
|
const labelPosition = buffer[position + 2];
|
|
1319
|
-
|
|
1608
|
+
const node = {
|
|
1320
1609
|
type: 'BreakStatement',
|
|
1321
1610
|
start: buffer[position],
|
|
1322
1611
|
end: buffer[position + 1],
|
|
1323
|
-
label
|
|
1612
|
+
get label() {
|
|
1613
|
+
const result = labelPosition === 0 ? null : convertNode$1(labelPosition, buffer);
|
|
1614
|
+
Object.defineProperty(node, 'label', { value: result });
|
|
1615
|
+
return result;
|
|
1616
|
+
}
|
|
1324
1617
|
};
|
|
1618
|
+
return node;
|
|
1325
1619
|
},
|
|
1326
1620
|
function callExpression(position, buffer) {
|
|
1327
1621
|
const flags = buffer[position + 2];
|
|
1328
1622
|
const annotations = convertAnnotations(buffer[position + 3], buffer);
|
|
1329
|
-
|
|
1623
|
+
const node = {
|
|
1330
1624
|
type: 'CallExpression',
|
|
1331
1625
|
start: buffer[position],
|
|
1332
1626
|
end: buffer[position + 1],
|
|
1333
1627
|
optional: (flags & 1) === 1,
|
|
1334
|
-
...(annotations.length > 0 ? {
|
|
1335
|
-
callee
|
|
1336
|
-
|
|
1628
|
+
...(annotations.length > 0 ? { annotations } : {}),
|
|
1629
|
+
get callee() {
|
|
1630
|
+
const result = convertNode$1(buffer[position + 4], buffer);
|
|
1631
|
+
Object.defineProperty(node, 'callee', { value: result });
|
|
1632
|
+
return result;
|
|
1633
|
+
},
|
|
1634
|
+
get arguments() {
|
|
1635
|
+
const result = convertNodeList$1(buffer[position + 5], buffer);
|
|
1636
|
+
Object.defineProperty(node, 'arguments', { value: result });
|
|
1637
|
+
return result;
|
|
1638
|
+
}
|
|
1337
1639
|
};
|
|
1640
|
+
return node;
|
|
1338
1641
|
},
|
|
1339
1642
|
function catchClause(position, buffer) {
|
|
1340
1643
|
const parameterPosition = buffer[position + 2];
|
|
1341
|
-
|
|
1644
|
+
const node = {
|
|
1342
1645
|
type: 'CatchClause',
|
|
1343
1646
|
start: buffer[position],
|
|
1344
1647
|
end: buffer[position + 1],
|
|
1345
|
-
param
|
|
1346
|
-
|
|
1648
|
+
get param() {
|
|
1649
|
+
const result = parameterPosition === 0 ? null : convertNode$1(parameterPosition, buffer);
|
|
1650
|
+
Object.defineProperty(node, 'param', { value: result });
|
|
1651
|
+
return result;
|
|
1652
|
+
},
|
|
1653
|
+
get body() {
|
|
1654
|
+
const result = convertNode$1(buffer[position + 3], buffer);
|
|
1655
|
+
Object.defineProperty(node, 'body', { value: result });
|
|
1656
|
+
return result;
|
|
1657
|
+
}
|
|
1347
1658
|
};
|
|
1659
|
+
return node;
|
|
1348
1660
|
},
|
|
1349
1661
|
function chainExpression(position, buffer) {
|
|
1350
|
-
|
|
1662
|
+
const node = {
|
|
1351
1663
|
type: 'ChainExpression',
|
|
1352
1664
|
start: buffer[position],
|
|
1353
1665
|
end: buffer[position + 1],
|
|
1354
|
-
expression
|
|
1666
|
+
get expression() {
|
|
1667
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
1668
|
+
Object.defineProperty(node, 'expression', { value: result });
|
|
1669
|
+
return result;
|
|
1670
|
+
}
|
|
1355
1671
|
};
|
|
1672
|
+
return node;
|
|
1356
1673
|
},
|
|
1357
1674
|
function classBody(position, buffer) {
|
|
1358
|
-
|
|
1675
|
+
const node = {
|
|
1359
1676
|
type: 'ClassBody',
|
|
1360
1677
|
start: buffer[position],
|
|
1361
1678
|
end: buffer[position + 1],
|
|
1362
|
-
body
|
|
1679
|
+
get body() {
|
|
1680
|
+
const result = convertNodeList$1(buffer[position + 2], buffer);
|
|
1681
|
+
Object.defineProperty(node, 'body', { value: result });
|
|
1682
|
+
return result;
|
|
1683
|
+
}
|
|
1363
1684
|
};
|
|
1685
|
+
return node;
|
|
1364
1686
|
},
|
|
1365
1687
|
function classDeclaration(position, buffer) {
|
|
1366
1688
|
const idPosition = buffer[position + 3];
|
|
1367
1689
|
const superClassPosition = buffer[position + 4];
|
|
1368
|
-
|
|
1690
|
+
const node = {
|
|
1369
1691
|
type: 'ClassDeclaration',
|
|
1370
1692
|
start: buffer[position],
|
|
1371
1693
|
end: buffer[position + 1],
|
|
1372
|
-
decorators
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1694
|
+
get decorators() {
|
|
1695
|
+
const result = convertNodeList$1(buffer[position + 2], buffer);
|
|
1696
|
+
Object.defineProperty(node, 'decorators', { value: result });
|
|
1697
|
+
return result;
|
|
1698
|
+
},
|
|
1699
|
+
get id() {
|
|
1700
|
+
const result = idPosition === 0 ? null : convertNode$1(idPosition, buffer);
|
|
1701
|
+
Object.defineProperty(node, 'id', { value: result });
|
|
1702
|
+
return result;
|
|
1703
|
+
},
|
|
1704
|
+
get superClass() {
|
|
1705
|
+
const result = superClassPosition === 0 ? null : convertNode$1(superClassPosition, buffer);
|
|
1706
|
+
Object.defineProperty(node, 'superClass', { value: result });
|
|
1707
|
+
return result;
|
|
1708
|
+
},
|
|
1709
|
+
get body() {
|
|
1710
|
+
const result = convertNode$1(buffer[position + 5], buffer);
|
|
1711
|
+
Object.defineProperty(node, 'body', { value: result });
|
|
1712
|
+
return result;
|
|
1713
|
+
}
|
|
1376
1714
|
};
|
|
1715
|
+
return node;
|
|
1377
1716
|
},
|
|
1378
1717
|
function classExpression(position, buffer) {
|
|
1379
1718
|
const idPosition = buffer[position + 3];
|
|
1380
1719
|
const superClassPosition = buffer[position + 4];
|
|
1381
|
-
|
|
1720
|
+
const node = {
|
|
1382
1721
|
type: 'ClassExpression',
|
|
1383
1722
|
start: buffer[position],
|
|
1384
1723
|
end: buffer[position + 1],
|
|
1385
|
-
decorators
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1724
|
+
get decorators() {
|
|
1725
|
+
const result = convertNodeList$1(buffer[position + 2], buffer);
|
|
1726
|
+
Object.defineProperty(node, 'decorators', { value: result });
|
|
1727
|
+
return result;
|
|
1728
|
+
},
|
|
1729
|
+
get id() {
|
|
1730
|
+
const result = idPosition === 0 ? null : convertNode$1(idPosition, buffer);
|
|
1731
|
+
Object.defineProperty(node, 'id', { value: result });
|
|
1732
|
+
return result;
|
|
1733
|
+
},
|
|
1734
|
+
get superClass() {
|
|
1735
|
+
const result = superClassPosition === 0 ? null : convertNode$1(superClassPosition, buffer);
|
|
1736
|
+
Object.defineProperty(node, 'superClass', { value: result });
|
|
1737
|
+
return result;
|
|
1738
|
+
},
|
|
1739
|
+
get body() {
|
|
1740
|
+
const result = convertNode$1(buffer[position + 5], buffer);
|
|
1741
|
+
Object.defineProperty(node, 'body', { value: result });
|
|
1742
|
+
return result;
|
|
1743
|
+
}
|
|
1389
1744
|
};
|
|
1745
|
+
return node;
|
|
1390
1746
|
},
|
|
1391
1747
|
function conditionalExpression(position, buffer) {
|
|
1392
|
-
|
|
1748
|
+
const node = {
|
|
1393
1749
|
type: 'ConditionalExpression',
|
|
1394
1750
|
start: buffer[position],
|
|
1395
1751
|
end: buffer[position + 1],
|
|
1396
|
-
test
|
|
1397
|
-
|
|
1398
|
-
|
|
1752
|
+
get test() {
|
|
1753
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
1754
|
+
Object.defineProperty(node, 'test', { value: result });
|
|
1755
|
+
return result;
|
|
1756
|
+
},
|
|
1757
|
+
get consequent() {
|
|
1758
|
+
const result = convertNode$1(buffer[position + 3], buffer);
|
|
1759
|
+
Object.defineProperty(node, 'consequent', { value: result });
|
|
1760
|
+
return result;
|
|
1761
|
+
},
|
|
1762
|
+
get alternate() {
|
|
1763
|
+
const result = convertNode$1(buffer[position + 4], buffer);
|
|
1764
|
+
Object.defineProperty(node, 'alternate', { value: result });
|
|
1765
|
+
return result;
|
|
1766
|
+
}
|
|
1399
1767
|
};
|
|
1768
|
+
return node;
|
|
1400
1769
|
},
|
|
1401
1770
|
function continueStatement(position, buffer) {
|
|
1402
1771
|
const labelPosition = buffer[position + 2];
|
|
1403
|
-
|
|
1772
|
+
const node = {
|
|
1404
1773
|
type: 'ContinueStatement',
|
|
1405
1774
|
start: buffer[position],
|
|
1406
1775
|
end: buffer[position + 1],
|
|
1407
|
-
label
|
|
1776
|
+
get label() {
|
|
1777
|
+
const result = labelPosition === 0 ? null : convertNode$1(labelPosition, buffer);
|
|
1778
|
+
Object.defineProperty(node, 'label', { value: result });
|
|
1779
|
+
return result;
|
|
1780
|
+
}
|
|
1408
1781
|
};
|
|
1782
|
+
return node;
|
|
1409
1783
|
},
|
|
1410
1784
|
function debuggerStatement(position, buffer) {
|
|
1411
|
-
|
|
1785
|
+
const node = {
|
|
1412
1786
|
type: 'DebuggerStatement',
|
|
1413
1787
|
start: buffer[position],
|
|
1414
1788
|
end: buffer[position + 1]
|
|
1415
1789
|
};
|
|
1790
|
+
return node;
|
|
1416
1791
|
},
|
|
1417
1792
|
function decorator(position, buffer) {
|
|
1418
|
-
|
|
1793
|
+
const node = {
|
|
1419
1794
|
type: 'Decorator',
|
|
1420
1795
|
start: buffer[position],
|
|
1421
1796
|
end: buffer[position + 1],
|
|
1422
|
-
expression
|
|
1797
|
+
get expression() {
|
|
1798
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
1799
|
+
Object.defineProperty(node, 'expression', { value: result });
|
|
1800
|
+
return result;
|
|
1801
|
+
}
|
|
1423
1802
|
};
|
|
1803
|
+
return node;
|
|
1424
1804
|
},
|
|
1425
1805
|
function directive(position, buffer) {
|
|
1426
|
-
|
|
1806
|
+
const node = {
|
|
1427
1807
|
type: 'ExpressionStatement',
|
|
1428
1808
|
start: buffer[position],
|
|
1429
1809
|
end: buffer[position + 1],
|
|
1430
|
-
directive
|
|
1431
|
-
|
|
1810
|
+
get directive() {
|
|
1811
|
+
const result = buffer.convertString(buffer[position + 2]);
|
|
1812
|
+
Object.defineProperty(node, 'directive', { value: result });
|
|
1813
|
+
return result;
|
|
1814
|
+
},
|
|
1815
|
+
get expression() {
|
|
1816
|
+
const result = convertNode$1(buffer[position + 3], buffer);
|
|
1817
|
+
Object.defineProperty(node, 'expression', { value: result });
|
|
1818
|
+
return result;
|
|
1819
|
+
}
|
|
1432
1820
|
};
|
|
1821
|
+
return node;
|
|
1433
1822
|
},
|
|
1434
1823
|
function doWhileStatement(position, buffer) {
|
|
1435
|
-
|
|
1824
|
+
const node = {
|
|
1436
1825
|
type: 'DoWhileStatement',
|
|
1437
1826
|
start: buffer[position],
|
|
1438
1827
|
end: buffer[position + 1],
|
|
1439
|
-
body
|
|
1440
|
-
|
|
1828
|
+
get body() {
|
|
1829
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
1830
|
+
Object.defineProperty(node, 'body', { value: result });
|
|
1831
|
+
return result;
|
|
1832
|
+
},
|
|
1833
|
+
get test() {
|
|
1834
|
+
const result = convertNode$1(buffer[position + 3], buffer);
|
|
1835
|
+
Object.defineProperty(node, 'test', { value: result });
|
|
1836
|
+
return result;
|
|
1837
|
+
}
|
|
1441
1838
|
};
|
|
1839
|
+
return node;
|
|
1442
1840
|
},
|
|
1443
1841
|
function emptyStatement(position, buffer) {
|
|
1444
|
-
|
|
1842
|
+
const node = {
|
|
1445
1843
|
type: 'EmptyStatement',
|
|
1446
1844
|
start: buffer[position],
|
|
1447
1845
|
end: buffer[position + 1]
|
|
1448
1846
|
};
|
|
1847
|
+
return node;
|
|
1449
1848
|
},
|
|
1450
1849
|
function exportAllDeclaration(position, buffer) {
|
|
1451
1850
|
const exportedPosition = buffer[position + 2];
|
|
1452
|
-
|
|
1851
|
+
const node = {
|
|
1453
1852
|
type: 'ExportAllDeclaration',
|
|
1454
1853
|
start: buffer[position],
|
|
1455
1854
|
end: buffer[position + 1],
|
|
1456
|
-
exported
|
|
1457
|
-
|
|
1458
|
-
|
|
1855
|
+
get exported() {
|
|
1856
|
+
const result = exportedPosition === 0 ? null : convertNode$1(exportedPosition, buffer);
|
|
1857
|
+
Object.defineProperty(node, 'exported', { value: result });
|
|
1858
|
+
return result;
|
|
1859
|
+
},
|
|
1860
|
+
get source() {
|
|
1861
|
+
const result = convertNode$1(buffer[position + 3], buffer);
|
|
1862
|
+
Object.defineProperty(node, 'source', { value: result });
|
|
1863
|
+
return result;
|
|
1864
|
+
},
|
|
1865
|
+
get attributes() {
|
|
1866
|
+
const result = convertNodeList$1(buffer[position + 4], buffer);
|
|
1867
|
+
Object.defineProperty(node, 'attributes', { value: result });
|
|
1868
|
+
return result;
|
|
1869
|
+
}
|
|
1459
1870
|
};
|
|
1871
|
+
return node;
|
|
1460
1872
|
},
|
|
1461
1873
|
function exportDefaultDeclaration(position, buffer) {
|
|
1462
|
-
|
|
1874
|
+
const node = {
|
|
1463
1875
|
type: 'ExportDefaultDeclaration',
|
|
1464
1876
|
start: buffer[position],
|
|
1465
1877
|
end: buffer[position + 1],
|
|
1466
|
-
declaration
|
|
1878
|
+
get declaration() {
|
|
1879
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
1880
|
+
Object.defineProperty(node, 'declaration', { value: result });
|
|
1881
|
+
return result;
|
|
1882
|
+
}
|
|
1467
1883
|
};
|
|
1884
|
+
return node;
|
|
1468
1885
|
},
|
|
1469
1886
|
function exportNamedDeclaration(position, buffer) {
|
|
1470
1887
|
const sourcePosition = buffer[position + 3];
|
|
1471
1888
|
const declarationPosition = buffer[position + 5];
|
|
1472
|
-
|
|
1889
|
+
const node = {
|
|
1473
1890
|
type: 'ExportNamedDeclaration',
|
|
1474
1891
|
start: buffer[position],
|
|
1475
1892
|
end: buffer[position + 1],
|
|
1476
|
-
specifiers
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1893
|
+
get specifiers() {
|
|
1894
|
+
const result = convertNodeList$1(buffer[position + 2], buffer);
|
|
1895
|
+
Object.defineProperty(node, 'specifiers', { value: result });
|
|
1896
|
+
return result;
|
|
1897
|
+
},
|
|
1898
|
+
get source() {
|
|
1899
|
+
const result = sourcePosition === 0 ? null : convertNode$1(sourcePosition, buffer);
|
|
1900
|
+
Object.defineProperty(node, 'source', { value: result });
|
|
1901
|
+
return result;
|
|
1902
|
+
},
|
|
1903
|
+
get attributes() {
|
|
1904
|
+
const result = convertNodeList$1(buffer[position + 4], buffer);
|
|
1905
|
+
Object.defineProperty(node, 'attributes', { value: result });
|
|
1906
|
+
return result;
|
|
1907
|
+
},
|
|
1908
|
+
get declaration() {
|
|
1909
|
+
const result = declarationPosition === 0 ? null : convertNode$1(declarationPosition, buffer);
|
|
1910
|
+
Object.defineProperty(node, 'declaration', { value: result });
|
|
1911
|
+
return result;
|
|
1912
|
+
}
|
|
1480
1913
|
};
|
|
1914
|
+
return node;
|
|
1481
1915
|
},
|
|
1482
1916
|
function exportSpecifier(position, buffer) {
|
|
1483
|
-
const local = convertNode(buffer[position + 2], buffer);
|
|
1917
|
+
const local = convertNode$1(buffer[position + 2], buffer);
|
|
1484
1918
|
const exportedPosition = buffer[position + 3];
|
|
1485
|
-
|
|
1919
|
+
const node = {
|
|
1486
1920
|
type: 'ExportSpecifier',
|
|
1487
1921
|
start: buffer[position],
|
|
1488
1922
|
end: buffer[position + 1],
|
|
1489
1923
|
local,
|
|
1490
|
-
exported
|
|
1924
|
+
get exported() {
|
|
1925
|
+
const result = exportedPosition === 0 ? { ...local } : convertNode$1(exportedPosition, buffer);
|
|
1926
|
+
Object.defineProperty(node, 'exported', { value: result });
|
|
1927
|
+
return result;
|
|
1928
|
+
}
|
|
1491
1929
|
};
|
|
1930
|
+
return node;
|
|
1492
1931
|
},
|
|
1493
1932
|
function expressionStatement(position, buffer) {
|
|
1494
|
-
|
|
1933
|
+
const node = {
|
|
1495
1934
|
type: 'ExpressionStatement',
|
|
1496
1935
|
start: buffer[position],
|
|
1497
1936
|
end: buffer[position + 1],
|
|
1498
|
-
expression
|
|
1937
|
+
get expression() {
|
|
1938
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
1939
|
+
Object.defineProperty(node, 'expression', { value: result });
|
|
1940
|
+
return result;
|
|
1941
|
+
}
|
|
1499
1942
|
};
|
|
1943
|
+
return node;
|
|
1500
1944
|
},
|
|
1501
1945
|
function forInStatement(position, buffer) {
|
|
1502
|
-
|
|
1946
|
+
const node = {
|
|
1503
1947
|
type: 'ForInStatement',
|
|
1504
1948
|
start: buffer[position],
|
|
1505
1949
|
end: buffer[position + 1],
|
|
1506
|
-
left
|
|
1507
|
-
|
|
1508
|
-
|
|
1950
|
+
get left() {
|
|
1951
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
1952
|
+
Object.defineProperty(node, 'left', { value: result });
|
|
1953
|
+
return result;
|
|
1954
|
+
},
|
|
1955
|
+
get right() {
|
|
1956
|
+
const result = convertNode$1(buffer[position + 3], buffer);
|
|
1957
|
+
Object.defineProperty(node, 'right', { value: result });
|
|
1958
|
+
return result;
|
|
1959
|
+
},
|
|
1960
|
+
get body() {
|
|
1961
|
+
const result = convertNode$1(buffer[position + 4], buffer);
|
|
1962
|
+
Object.defineProperty(node, 'body', { value: result });
|
|
1963
|
+
return result;
|
|
1964
|
+
}
|
|
1509
1965
|
};
|
|
1966
|
+
return node;
|
|
1510
1967
|
},
|
|
1511
1968
|
function forOfStatement(position, buffer) {
|
|
1512
1969
|
const flags = buffer[position + 2];
|
|
1513
|
-
|
|
1970
|
+
const node = {
|
|
1514
1971
|
type: 'ForOfStatement',
|
|
1515
1972
|
start: buffer[position],
|
|
1516
1973
|
end: buffer[position + 1],
|
|
1517
1974
|
await: (flags & 1) === 1,
|
|
1518
|
-
left
|
|
1519
|
-
|
|
1520
|
-
|
|
1975
|
+
get left() {
|
|
1976
|
+
const result = convertNode$1(buffer[position + 3], buffer);
|
|
1977
|
+
Object.defineProperty(node, 'left', { value: result });
|
|
1978
|
+
return result;
|
|
1979
|
+
},
|
|
1980
|
+
get right() {
|
|
1981
|
+
const result = convertNode$1(buffer[position + 4], buffer);
|
|
1982
|
+
Object.defineProperty(node, 'right', { value: result });
|
|
1983
|
+
return result;
|
|
1984
|
+
},
|
|
1985
|
+
get body() {
|
|
1986
|
+
const result = convertNode$1(buffer[position + 5], buffer);
|
|
1987
|
+
Object.defineProperty(node, 'body', { value: result });
|
|
1988
|
+
return result;
|
|
1989
|
+
}
|
|
1521
1990
|
};
|
|
1991
|
+
return node;
|
|
1522
1992
|
},
|
|
1523
1993
|
function forStatement(position, buffer) {
|
|
1524
1994
|
const initPosition = buffer[position + 2];
|
|
1525
1995
|
const testPosition = buffer[position + 3];
|
|
1526
1996
|
const updatePosition = buffer[position + 4];
|
|
1527
|
-
|
|
1997
|
+
const node = {
|
|
1528
1998
|
type: 'ForStatement',
|
|
1529
1999
|
start: buffer[position],
|
|
1530
2000
|
end: buffer[position + 1],
|
|
1531
|
-
init
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
2001
|
+
get init() {
|
|
2002
|
+
const result = initPosition === 0 ? null : convertNode$1(initPosition, buffer);
|
|
2003
|
+
Object.defineProperty(node, 'init', { value: result });
|
|
2004
|
+
return result;
|
|
2005
|
+
},
|
|
2006
|
+
get test() {
|
|
2007
|
+
const result = testPosition === 0 ? null : convertNode$1(testPosition, buffer);
|
|
2008
|
+
Object.defineProperty(node, 'test', { value: result });
|
|
2009
|
+
return result;
|
|
2010
|
+
},
|
|
2011
|
+
get update() {
|
|
2012
|
+
const result = updatePosition === 0 ? null : convertNode$1(updatePosition, buffer);
|
|
2013
|
+
Object.defineProperty(node, 'update', { value: result });
|
|
2014
|
+
return result;
|
|
2015
|
+
},
|
|
2016
|
+
get body() {
|
|
2017
|
+
const result = convertNode$1(buffer[position + 5], buffer);
|
|
2018
|
+
Object.defineProperty(node, 'body', { value: result });
|
|
2019
|
+
return result;
|
|
2020
|
+
}
|
|
1535
2021
|
};
|
|
2022
|
+
return node;
|
|
1536
2023
|
},
|
|
1537
2024
|
function functionDeclaration(position, buffer) {
|
|
1538
2025
|
const flags = buffer[position + 2];
|
|
1539
2026
|
const annotations = convertAnnotations(buffer[position + 3], buffer);
|
|
1540
2027
|
const idPosition = buffer[position + 4];
|
|
1541
|
-
|
|
2028
|
+
const node = {
|
|
1542
2029
|
type: 'FunctionDeclaration',
|
|
1543
2030
|
start: buffer[position],
|
|
1544
2031
|
end: buffer[position + 1],
|
|
1545
2032
|
async: (flags & 1) === 1,
|
|
1546
2033
|
generator: (flags & 2) === 2,
|
|
1547
|
-
...(annotations.length > 0 ? {
|
|
1548
|
-
id
|
|
1549
|
-
|
|
1550
|
-
|
|
2034
|
+
...(annotations.length > 0 ? { annotations } : {}),
|
|
2035
|
+
get id() {
|
|
2036
|
+
const result = idPosition === 0 ? null : convertNode$1(idPosition, buffer);
|
|
2037
|
+
Object.defineProperty(node, 'id', { value: result });
|
|
2038
|
+
return result;
|
|
2039
|
+
},
|
|
2040
|
+
get params() {
|
|
2041
|
+
const result = convertNodeList$1(buffer[position + 5], buffer);
|
|
2042
|
+
Object.defineProperty(node, 'params', { value: result });
|
|
2043
|
+
return result;
|
|
2044
|
+
},
|
|
2045
|
+
get body() {
|
|
2046
|
+
const result = convertNode$1(buffer[position + 6], buffer);
|
|
2047
|
+
Object.defineProperty(node, 'body', { value: result });
|
|
2048
|
+
return result;
|
|
2049
|
+
},
|
|
1551
2050
|
expression: false
|
|
1552
2051
|
};
|
|
2052
|
+
return node;
|
|
1553
2053
|
},
|
|
1554
2054
|
function functionExpression(position, buffer) {
|
|
1555
2055
|
const flags = buffer[position + 2];
|
|
1556
2056
|
const annotations = convertAnnotations(buffer[position + 3], buffer);
|
|
1557
2057
|
const idPosition = buffer[position + 4];
|
|
1558
|
-
|
|
2058
|
+
const node = {
|
|
1559
2059
|
type: 'FunctionExpression',
|
|
1560
2060
|
start: buffer[position],
|
|
1561
2061
|
end: buffer[position + 1],
|
|
1562
2062
|
async: (flags & 1) === 1,
|
|
1563
2063
|
generator: (flags & 2) === 2,
|
|
1564
|
-
...(annotations.length > 0 ? {
|
|
1565
|
-
id
|
|
1566
|
-
|
|
1567
|
-
|
|
2064
|
+
...(annotations.length > 0 ? { annotations } : {}),
|
|
2065
|
+
get id() {
|
|
2066
|
+
const result = idPosition === 0 ? null : convertNode$1(idPosition, buffer);
|
|
2067
|
+
Object.defineProperty(node, 'id', { value: result });
|
|
2068
|
+
return result;
|
|
2069
|
+
},
|
|
2070
|
+
get params() {
|
|
2071
|
+
const result = convertNodeList$1(buffer[position + 5], buffer);
|
|
2072
|
+
Object.defineProperty(node, 'params', { value: result });
|
|
2073
|
+
return result;
|
|
2074
|
+
},
|
|
2075
|
+
get body() {
|
|
2076
|
+
const result = convertNode$1(buffer[position + 6], buffer);
|
|
2077
|
+
Object.defineProperty(node, 'body', { value: result });
|
|
2078
|
+
return result;
|
|
2079
|
+
},
|
|
1568
2080
|
expression: false
|
|
1569
2081
|
};
|
|
2082
|
+
return node;
|
|
1570
2083
|
},
|
|
1571
2084
|
function identifier(position, buffer) {
|
|
1572
|
-
|
|
2085
|
+
const node = {
|
|
1573
2086
|
type: 'Identifier',
|
|
1574
2087
|
start: buffer[position],
|
|
1575
2088
|
end: buffer[position + 1],
|
|
1576
|
-
name
|
|
2089
|
+
get name() {
|
|
2090
|
+
const result = buffer.convertString(buffer[position + 2]);
|
|
2091
|
+
Object.defineProperty(node, 'name', { value: result });
|
|
2092
|
+
return result;
|
|
2093
|
+
}
|
|
1577
2094
|
};
|
|
2095
|
+
return node;
|
|
1578
2096
|
},
|
|
1579
2097
|
function ifStatement(position, buffer) {
|
|
1580
2098
|
const alternatePosition = buffer[position + 4];
|
|
1581
|
-
|
|
2099
|
+
const node = {
|
|
1582
2100
|
type: 'IfStatement',
|
|
1583
2101
|
start: buffer[position],
|
|
1584
2102
|
end: buffer[position + 1],
|
|
1585
|
-
test
|
|
1586
|
-
|
|
1587
|
-
|
|
2103
|
+
get test() {
|
|
2104
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
2105
|
+
Object.defineProperty(node, 'test', { value: result });
|
|
2106
|
+
return result;
|
|
2107
|
+
},
|
|
2108
|
+
get consequent() {
|
|
2109
|
+
const result = convertNode$1(buffer[position + 3], buffer);
|
|
2110
|
+
Object.defineProperty(node, 'consequent', { value: result });
|
|
2111
|
+
return result;
|
|
2112
|
+
},
|
|
2113
|
+
get alternate() {
|
|
2114
|
+
const result = alternatePosition === 0 ? null : convertNode$1(alternatePosition, buffer);
|
|
2115
|
+
Object.defineProperty(node, 'alternate', { value: result });
|
|
2116
|
+
return result;
|
|
2117
|
+
}
|
|
1588
2118
|
};
|
|
2119
|
+
return node;
|
|
1589
2120
|
},
|
|
1590
2121
|
function importAttribute(position, buffer) {
|
|
1591
|
-
|
|
2122
|
+
const node = {
|
|
1592
2123
|
type: 'ImportAttribute',
|
|
1593
2124
|
start: buffer[position],
|
|
1594
2125
|
end: buffer[position + 1],
|
|
1595
|
-
key
|
|
1596
|
-
|
|
2126
|
+
get key() {
|
|
2127
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
2128
|
+
Object.defineProperty(node, 'key', { value: result });
|
|
2129
|
+
return result;
|
|
2130
|
+
},
|
|
2131
|
+
get value() {
|
|
2132
|
+
const result = convertNode$1(buffer[position + 3], buffer);
|
|
2133
|
+
Object.defineProperty(node, 'value', { value: result });
|
|
2134
|
+
return result;
|
|
2135
|
+
}
|
|
1597
2136
|
};
|
|
2137
|
+
return node;
|
|
1598
2138
|
},
|
|
1599
2139
|
function importDeclaration(position, buffer) {
|
|
1600
|
-
const
|
|
1601
|
-
|
|
2140
|
+
const phasePosition = buffer[position + 5];
|
|
2141
|
+
const node = {
|
|
1602
2142
|
type: 'ImportDeclaration',
|
|
1603
2143
|
start: buffer[position],
|
|
1604
2144
|
end: buffer[position + 1],
|
|
1605
|
-
specifiers
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
2145
|
+
get specifiers() {
|
|
2146
|
+
const result = convertNodeList$1(buffer[position + 2], buffer);
|
|
2147
|
+
Object.defineProperty(node, 'specifiers', { value: result });
|
|
2148
|
+
return result;
|
|
2149
|
+
},
|
|
2150
|
+
get source() {
|
|
2151
|
+
const result = convertNode$1(buffer[position + 3], buffer);
|
|
2152
|
+
Object.defineProperty(node, 'source', { value: result });
|
|
2153
|
+
return result;
|
|
2154
|
+
},
|
|
2155
|
+
get attributes() {
|
|
2156
|
+
const result = convertNodeList$1(buffer[position + 4], buffer);
|
|
2157
|
+
Object.defineProperty(node, 'attributes', { value: result });
|
|
2158
|
+
return result;
|
|
2159
|
+
},
|
|
2160
|
+
get phase() {
|
|
2161
|
+
const result = phasePosition === 0
|
|
2162
|
+
? undefined
|
|
2163
|
+
: FIXED_STRINGS[buffer[position + 5]];
|
|
2164
|
+
Object.defineProperty(node, 'phase', { value: result });
|
|
2165
|
+
return result;
|
|
2166
|
+
}
|
|
1609
2167
|
};
|
|
2168
|
+
return node;
|
|
1610
2169
|
},
|
|
1611
2170
|
function importDefaultSpecifier(position, buffer) {
|
|
1612
|
-
|
|
2171
|
+
const node = {
|
|
1613
2172
|
type: 'ImportDefaultSpecifier',
|
|
1614
2173
|
start: buffer[position],
|
|
1615
2174
|
end: buffer[position + 1],
|
|
1616
|
-
local
|
|
2175
|
+
get local() {
|
|
2176
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
2177
|
+
Object.defineProperty(node, 'local', { value: result });
|
|
2178
|
+
return result;
|
|
2179
|
+
}
|
|
1617
2180
|
};
|
|
2181
|
+
return node;
|
|
1618
2182
|
},
|
|
1619
2183
|
function importExpression(position, buffer) {
|
|
1620
2184
|
const optionsPosition = buffer[position + 3];
|
|
1621
|
-
const
|
|
1622
|
-
|
|
2185
|
+
const phasePosition = buffer[position + 4];
|
|
2186
|
+
const node = {
|
|
1623
2187
|
type: 'ImportExpression',
|
|
1624
2188
|
start: buffer[position],
|
|
1625
2189
|
end: buffer[position + 1],
|
|
1626
|
-
source
|
|
1627
|
-
|
|
1628
|
-
|
|
2190
|
+
get source() {
|
|
2191
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
2192
|
+
Object.defineProperty(node, 'source', { value: result });
|
|
2193
|
+
return result;
|
|
2194
|
+
},
|
|
2195
|
+
get options() {
|
|
2196
|
+
const result = optionsPosition === 0 ? null : convertNode$1(optionsPosition, buffer);
|
|
2197
|
+
Object.defineProperty(node, 'options', { value: result });
|
|
2198
|
+
return result;
|
|
2199
|
+
},
|
|
2200
|
+
get phase() {
|
|
2201
|
+
const result = phasePosition === 0
|
|
2202
|
+
? undefined
|
|
2203
|
+
: FIXED_STRINGS[buffer[position + 4]];
|
|
2204
|
+
Object.defineProperty(node, 'phase', { value: result });
|
|
2205
|
+
return result;
|
|
2206
|
+
}
|
|
1629
2207
|
};
|
|
2208
|
+
return node;
|
|
1630
2209
|
},
|
|
1631
2210
|
function importNamespaceSpecifier(position, buffer) {
|
|
1632
|
-
|
|
2211
|
+
const node = {
|
|
1633
2212
|
type: 'ImportNamespaceSpecifier',
|
|
1634
2213
|
start: buffer[position],
|
|
1635
2214
|
end: buffer[position + 1],
|
|
1636
|
-
local
|
|
2215
|
+
get local() {
|
|
2216
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
2217
|
+
Object.defineProperty(node, 'local', { value: result });
|
|
2218
|
+
return result;
|
|
2219
|
+
}
|
|
1637
2220
|
};
|
|
2221
|
+
return node;
|
|
1638
2222
|
},
|
|
1639
2223
|
function importSpecifier(position, buffer) {
|
|
1640
2224
|
const importedPosition = buffer[position + 2];
|
|
1641
|
-
const local = convertNode(buffer[position + 3], buffer);
|
|
1642
|
-
|
|
2225
|
+
const local = convertNode$1(buffer[position + 3], buffer);
|
|
2226
|
+
const node = {
|
|
1643
2227
|
type: 'ImportSpecifier',
|
|
1644
2228
|
start: buffer[position],
|
|
1645
2229
|
end: buffer[position + 1],
|
|
1646
|
-
imported
|
|
2230
|
+
get imported() {
|
|
2231
|
+
const result = importedPosition === 0 ? { ...local } : convertNode$1(importedPosition, buffer);
|
|
2232
|
+
Object.defineProperty(node, 'imported', { value: result });
|
|
2233
|
+
return result;
|
|
2234
|
+
},
|
|
1647
2235
|
local
|
|
1648
2236
|
};
|
|
2237
|
+
return node;
|
|
1649
2238
|
},
|
|
1650
2239
|
function jsxAttribute(position, buffer) {
|
|
1651
2240
|
const valuePosition = buffer[position + 3];
|
|
1652
|
-
|
|
2241
|
+
const node = {
|
|
1653
2242
|
type: 'JSXAttribute',
|
|
1654
2243
|
start: buffer[position],
|
|
1655
2244
|
end: buffer[position + 1],
|
|
1656
|
-
name
|
|
1657
|
-
|
|
2245
|
+
get name() {
|
|
2246
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
2247
|
+
Object.defineProperty(node, 'name', { value: result });
|
|
2248
|
+
return result;
|
|
2249
|
+
},
|
|
2250
|
+
get value() {
|
|
2251
|
+
const result = valuePosition === 0 ? null : convertNode$1(valuePosition, buffer);
|
|
2252
|
+
Object.defineProperty(node, 'value', { value: result });
|
|
2253
|
+
return result;
|
|
2254
|
+
}
|
|
1658
2255
|
};
|
|
2256
|
+
return node;
|
|
1659
2257
|
},
|
|
1660
2258
|
function jsxClosingElement(position, buffer) {
|
|
1661
|
-
|
|
2259
|
+
const node = {
|
|
1662
2260
|
type: 'JSXClosingElement',
|
|
1663
2261
|
start: buffer[position],
|
|
1664
2262
|
end: buffer[position + 1],
|
|
1665
|
-
name
|
|
2263
|
+
get name() {
|
|
2264
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
2265
|
+
Object.defineProperty(node, 'name', { value: result });
|
|
2266
|
+
return result;
|
|
2267
|
+
}
|
|
1666
2268
|
};
|
|
2269
|
+
return node;
|
|
1667
2270
|
},
|
|
1668
2271
|
function jsxClosingFragment(position, buffer) {
|
|
1669
|
-
|
|
2272
|
+
const node = {
|
|
1670
2273
|
type: 'JSXClosingFragment',
|
|
1671
2274
|
start: buffer[position],
|
|
1672
2275
|
end: buffer[position + 1]
|
|
1673
2276
|
};
|
|
2277
|
+
return node;
|
|
1674
2278
|
},
|
|
1675
2279
|
function jsxElement(position, buffer) {
|
|
1676
2280
|
const closingElementPosition = buffer[position + 4];
|
|
1677
|
-
|
|
2281
|
+
const node = {
|
|
1678
2282
|
type: 'JSXElement',
|
|
1679
2283
|
start: buffer[position],
|
|
1680
2284
|
end: buffer[position + 1],
|
|
1681
|
-
openingElement
|
|
1682
|
-
|
|
1683
|
-
|
|
2285
|
+
get openingElement() {
|
|
2286
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
2287
|
+
Object.defineProperty(node, 'openingElement', { value: result });
|
|
2288
|
+
return result;
|
|
2289
|
+
},
|
|
2290
|
+
get children() {
|
|
2291
|
+
const result = convertNodeList$1(buffer[position + 3], buffer);
|
|
2292
|
+
Object.defineProperty(node, 'children', { value: result });
|
|
2293
|
+
return result;
|
|
2294
|
+
},
|
|
2295
|
+
get closingElement() {
|
|
2296
|
+
const result = closingElementPosition === 0 ? null : convertNode$1(closingElementPosition, buffer);
|
|
2297
|
+
Object.defineProperty(node, 'closingElement', { value: result });
|
|
2298
|
+
return result;
|
|
2299
|
+
}
|
|
1684
2300
|
};
|
|
2301
|
+
return node;
|
|
1685
2302
|
},
|
|
1686
2303
|
function jsxEmptyExpression(position, buffer) {
|
|
1687
|
-
|
|
2304
|
+
const node = {
|
|
1688
2305
|
type: 'JSXEmptyExpression',
|
|
1689
2306
|
start: buffer[position],
|
|
1690
2307
|
end: buffer[position + 1]
|
|
1691
2308
|
};
|
|
2309
|
+
return node;
|
|
1692
2310
|
},
|
|
1693
2311
|
function jsxExpressionContainer(position, buffer) {
|
|
1694
|
-
|
|
2312
|
+
const node = {
|
|
1695
2313
|
type: 'JSXExpressionContainer',
|
|
1696
2314
|
start: buffer[position],
|
|
1697
2315
|
end: buffer[position + 1],
|
|
1698
|
-
expression
|
|
2316
|
+
get expression() {
|
|
2317
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
2318
|
+
Object.defineProperty(node, 'expression', { value: result });
|
|
2319
|
+
return result;
|
|
2320
|
+
}
|
|
1699
2321
|
};
|
|
2322
|
+
return node;
|
|
1700
2323
|
},
|
|
1701
2324
|
function jsxFragment(position, buffer) {
|
|
1702
|
-
|
|
2325
|
+
const node = {
|
|
1703
2326
|
type: 'JSXFragment',
|
|
1704
2327
|
start: buffer[position],
|
|
1705
2328
|
end: buffer[position + 1],
|
|
1706
|
-
openingFragment
|
|
1707
|
-
|
|
1708
|
-
|
|
2329
|
+
get openingFragment() {
|
|
2330
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
2331
|
+
Object.defineProperty(node, 'openingFragment', { value: result });
|
|
2332
|
+
return result;
|
|
2333
|
+
},
|
|
2334
|
+
get children() {
|
|
2335
|
+
const result = convertNodeList$1(buffer[position + 3], buffer);
|
|
2336
|
+
Object.defineProperty(node, 'children', { value: result });
|
|
2337
|
+
return result;
|
|
2338
|
+
},
|
|
2339
|
+
get closingFragment() {
|
|
2340
|
+
const result = convertNode$1(buffer[position + 4], buffer);
|
|
2341
|
+
Object.defineProperty(node, 'closingFragment', { value: result });
|
|
2342
|
+
return result;
|
|
2343
|
+
}
|
|
1709
2344
|
};
|
|
2345
|
+
return node;
|
|
1710
2346
|
},
|
|
1711
2347
|
function jsxIdentifier(position, buffer) {
|
|
1712
|
-
|
|
2348
|
+
const node = {
|
|
1713
2349
|
type: 'JSXIdentifier',
|
|
1714
2350
|
start: buffer[position],
|
|
1715
2351
|
end: buffer[position + 1],
|
|
1716
|
-
name
|
|
2352
|
+
get name() {
|
|
2353
|
+
const result = buffer.convertString(buffer[position + 2]);
|
|
2354
|
+
Object.defineProperty(node, 'name', { value: result });
|
|
2355
|
+
return result;
|
|
2356
|
+
}
|
|
1717
2357
|
};
|
|
2358
|
+
return node;
|
|
1718
2359
|
},
|
|
1719
2360
|
function jsxMemberExpression(position, buffer) {
|
|
1720
|
-
|
|
2361
|
+
const node = {
|
|
1721
2362
|
type: 'JSXMemberExpression',
|
|
1722
2363
|
start: buffer[position],
|
|
1723
2364
|
end: buffer[position + 1],
|
|
1724
|
-
object
|
|
1725
|
-
|
|
2365
|
+
get object() {
|
|
2366
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
2367
|
+
Object.defineProperty(node, 'object', { value: result });
|
|
2368
|
+
return result;
|
|
2369
|
+
},
|
|
2370
|
+
get property() {
|
|
2371
|
+
const result = convertNode$1(buffer[position + 3], buffer);
|
|
2372
|
+
Object.defineProperty(node, 'property', { value: result });
|
|
2373
|
+
return result;
|
|
2374
|
+
}
|
|
1726
2375
|
};
|
|
2376
|
+
return node;
|
|
1727
2377
|
},
|
|
1728
2378
|
function jsxNamespacedName(position, buffer) {
|
|
1729
|
-
|
|
2379
|
+
const node = {
|
|
1730
2380
|
type: 'JSXNamespacedName',
|
|
1731
2381
|
start: buffer[position],
|
|
1732
2382
|
end: buffer[position + 1],
|
|
1733
|
-
namespace
|
|
1734
|
-
|
|
2383
|
+
get namespace() {
|
|
2384
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
2385
|
+
Object.defineProperty(node, 'namespace', { value: result });
|
|
2386
|
+
return result;
|
|
2387
|
+
},
|
|
2388
|
+
get name() {
|
|
2389
|
+
const result = convertNode$1(buffer[position + 3], buffer);
|
|
2390
|
+
Object.defineProperty(node, 'name', { value: result });
|
|
2391
|
+
return result;
|
|
2392
|
+
}
|
|
1735
2393
|
};
|
|
2394
|
+
return node;
|
|
1736
2395
|
},
|
|
1737
2396
|
function jsxOpeningElement(position, buffer) {
|
|
1738
2397
|
const flags = buffer[position + 2];
|
|
1739
|
-
|
|
2398
|
+
const node = {
|
|
1740
2399
|
type: 'JSXOpeningElement',
|
|
1741
2400
|
start: buffer[position],
|
|
1742
2401
|
end: buffer[position + 1],
|
|
1743
2402
|
selfClosing: (flags & 1) === 1,
|
|
1744
|
-
name
|
|
1745
|
-
|
|
2403
|
+
get name() {
|
|
2404
|
+
const result = convertNode$1(buffer[position + 3], buffer);
|
|
2405
|
+
Object.defineProperty(node, 'name', { value: result });
|
|
2406
|
+
return result;
|
|
2407
|
+
},
|
|
2408
|
+
get attributes() {
|
|
2409
|
+
const result = convertNodeList$1(buffer[position + 4], buffer);
|
|
2410
|
+
Object.defineProperty(node, 'attributes', { value: result });
|
|
2411
|
+
return result;
|
|
2412
|
+
}
|
|
1746
2413
|
};
|
|
2414
|
+
return node;
|
|
1747
2415
|
},
|
|
1748
2416
|
function jsxOpeningFragment(position, buffer) {
|
|
1749
|
-
|
|
2417
|
+
const node = {
|
|
1750
2418
|
type: 'JSXOpeningFragment',
|
|
1751
2419
|
start: buffer[position],
|
|
1752
2420
|
end: buffer[position + 1],
|
|
1753
2421
|
attributes: [],
|
|
1754
2422
|
selfClosing: false
|
|
1755
2423
|
};
|
|
2424
|
+
return node;
|
|
1756
2425
|
},
|
|
1757
2426
|
function jsxSpreadAttribute(position, buffer) {
|
|
1758
|
-
|
|
2427
|
+
const node = {
|
|
1759
2428
|
type: 'JSXSpreadAttribute',
|
|
1760
2429
|
start: buffer[position],
|
|
1761
2430
|
end: buffer[position + 1],
|
|
1762
|
-
argument
|
|
2431
|
+
get argument() {
|
|
2432
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
2433
|
+
Object.defineProperty(node, 'argument', { value: result });
|
|
2434
|
+
return result;
|
|
2435
|
+
}
|
|
1763
2436
|
};
|
|
2437
|
+
return node;
|
|
1764
2438
|
},
|
|
1765
2439
|
function jsxSpreadChild(position, buffer) {
|
|
1766
|
-
|
|
2440
|
+
const node = {
|
|
1767
2441
|
type: 'JSXSpreadChild',
|
|
1768
2442
|
start: buffer[position],
|
|
1769
2443
|
end: buffer[position + 1],
|
|
1770
|
-
expression
|
|
2444
|
+
get expression() {
|
|
2445
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
2446
|
+
Object.defineProperty(node, 'expression', { value: result });
|
|
2447
|
+
return result;
|
|
2448
|
+
}
|
|
1771
2449
|
};
|
|
2450
|
+
return node;
|
|
1772
2451
|
},
|
|
1773
2452
|
function jsxText(position, buffer) {
|
|
1774
|
-
|
|
2453
|
+
const node = {
|
|
1775
2454
|
type: 'JSXText',
|
|
1776
2455
|
start: buffer[position],
|
|
1777
2456
|
end: buffer[position + 1],
|
|
1778
|
-
value
|
|
1779
|
-
|
|
2457
|
+
get value() {
|
|
2458
|
+
const result = buffer.convertString(buffer[position + 2]);
|
|
2459
|
+
Object.defineProperty(node, 'value', { value: result });
|
|
2460
|
+
return result;
|
|
2461
|
+
},
|
|
2462
|
+
get raw() {
|
|
2463
|
+
const result = buffer.convertString(buffer[position + 3]);
|
|
2464
|
+
Object.defineProperty(node, 'raw', { value: result });
|
|
2465
|
+
return result;
|
|
2466
|
+
}
|
|
1780
2467
|
};
|
|
2468
|
+
return node;
|
|
1781
2469
|
},
|
|
1782
2470
|
function labeledStatement(position, buffer) {
|
|
1783
|
-
|
|
2471
|
+
const node = {
|
|
1784
2472
|
type: 'LabeledStatement',
|
|
1785
2473
|
start: buffer[position],
|
|
1786
2474
|
end: buffer[position + 1],
|
|
1787
|
-
label
|
|
1788
|
-
|
|
2475
|
+
get label() {
|
|
2476
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
2477
|
+
Object.defineProperty(node, 'label', { value: result });
|
|
2478
|
+
return result;
|
|
2479
|
+
},
|
|
2480
|
+
get body() {
|
|
2481
|
+
const result = convertNode$1(buffer[position + 3], buffer);
|
|
2482
|
+
Object.defineProperty(node, 'body', { value: result });
|
|
2483
|
+
return result;
|
|
2484
|
+
}
|
|
1789
2485
|
};
|
|
2486
|
+
return node;
|
|
1790
2487
|
},
|
|
1791
2488
|
function literalBigInt(position, buffer) {
|
|
1792
2489
|
const bigint = buffer.convertString(buffer[position + 2]);
|
|
1793
|
-
|
|
2490
|
+
const node = {
|
|
1794
2491
|
type: 'Literal',
|
|
1795
2492
|
start: buffer[position],
|
|
1796
2493
|
end: buffer[position + 1],
|
|
1797
2494
|
bigint,
|
|
1798
|
-
raw
|
|
2495
|
+
get raw() {
|
|
2496
|
+
const result = buffer.convertString(buffer[position + 3]);
|
|
2497
|
+
Object.defineProperty(node, 'raw', { value: result });
|
|
2498
|
+
return result;
|
|
2499
|
+
},
|
|
1799
2500
|
value: BigInt(bigint)
|
|
1800
2501
|
};
|
|
2502
|
+
return node;
|
|
1801
2503
|
},
|
|
1802
2504
|
function literalBoolean(position, buffer) {
|
|
1803
2505
|
const flags = buffer[position + 2];
|
|
1804
2506
|
const value = (flags & 1) === 1;
|
|
1805
|
-
|
|
2507
|
+
const node = {
|
|
1806
2508
|
type: 'Literal',
|
|
1807
2509
|
start: buffer[position],
|
|
1808
2510
|
end: buffer[position + 1],
|
|
1809
2511
|
value,
|
|
1810
2512
|
raw: value ? 'true' : 'false'
|
|
1811
2513
|
};
|
|
2514
|
+
return node;
|
|
1812
2515
|
},
|
|
1813
2516
|
function literalNull(position, buffer) {
|
|
1814
|
-
|
|
2517
|
+
const node = {
|
|
1815
2518
|
type: 'Literal',
|
|
1816
2519
|
start: buffer[position],
|
|
1817
2520
|
end: buffer[position + 1],
|
|
1818
2521
|
raw: 'null',
|
|
1819
2522
|
value: null
|
|
1820
2523
|
};
|
|
2524
|
+
return node;
|
|
1821
2525
|
},
|
|
1822
2526
|
function literalNumber(position, buffer) {
|
|
1823
2527
|
const rawPosition = buffer[position + 2];
|
|
1824
|
-
|
|
2528
|
+
const node = {
|
|
1825
2529
|
type: 'Literal',
|
|
1826
2530
|
start: buffer[position],
|
|
1827
2531
|
end: buffer[position + 1],
|
|
1828
|
-
raw
|
|
1829
|
-
|
|
2532
|
+
get raw() {
|
|
2533
|
+
const result = rawPosition === 0 ? undefined : buffer.convertString(rawPosition);
|
|
2534
|
+
Object.defineProperty(node, 'raw', { value: result });
|
|
2535
|
+
return result;
|
|
2536
|
+
},
|
|
2537
|
+
get value() {
|
|
2538
|
+
const result = buffer.convertFloat64(position + 3);
|
|
2539
|
+
Object.defineProperty(node, 'value', { value: result });
|
|
2540
|
+
return result;
|
|
2541
|
+
}
|
|
1830
2542
|
};
|
|
2543
|
+
return node;
|
|
1831
2544
|
},
|
|
1832
2545
|
function literalRegExp(position, buffer) {
|
|
1833
2546
|
const flags = buffer.convertString(buffer[position + 2]);
|
|
1834
2547
|
const pattern = buffer.convertString(buffer[position + 3]);
|
|
1835
|
-
|
|
2548
|
+
const node = {
|
|
1836
2549
|
type: 'Literal',
|
|
1837
2550
|
start: buffer[position],
|
|
1838
2551
|
end: buffer[position + 1],
|
|
@@ -1840,25 +2553,1513 @@ const nodeConverters = [
|
|
|
1840
2553
|
regex: { flags, pattern },
|
|
1841
2554
|
value: new RegExp(pattern, flags)
|
|
1842
2555
|
};
|
|
2556
|
+
return node;
|
|
1843
2557
|
},
|
|
1844
2558
|
function literalString(position, buffer) {
|
|
1845
2559
|
const rawPosition = buffer[position + 3];
|
|
1846
|
-
|
|
2560
|
+
const node = {
|
|
1847
2561
|
type: 'Literal',
|
|
1848
2562
|
start: buffer[position],
|
|
1849
2563
|
end: buffer[position + 1],
|
|
1850
|
-
value
|
|
1851
|
-
|
|
2564
|
+
get value() {
|
|
2565
|
+
const result = buffer.convertString(buffer[position + 2]);
|
|
2566
|
+
Object.defineProperty(node, 'value', { value: result });
|
|
2567
|
+
return result;
|
|
2568
|
+
},
|
|
2569
|
+
get raw() {
|
|
2570
|
+
const result = rawPosition === 0 ? undefined : buffer.convertString(rawPosition);
|
|
2571
|
+
Object.defineProperty(node, 'raw', { value: result });
|
|
2572
|
+
return result;
|
|
2573
|
+
}
|
|
1852
2574
|
};
|
|
2575
|
+
return node;
|
|
1853
2576
|
},
|
|
1854
2577
|
function logicalExpression(position, buffer) {
|
|
1855
|
-
|
|
2578
|
+
const node = {
|
|
1856
2579
|
type: 'LogicalExpression',
|
|
1857
2580
|
start: buffer[position],
|
|
1858
2581
|
end: buffer[position + 1],
|
|
1859
|
-
operator
|
|
1860
|
-
|
|
1861
|
-
|
|
2582
|
+
get operator() {
|
|
2583
|
+
const result = FIXED_STRINGS[buffer[position + 2]];
|
|
2584
|
+
Object.defineProperty(node, 'operator', { value: result });
|
|
2585
|
+
return result;
|
|
2586
|
+
},
|
|
2587
|
+
get left() {
|
|
2588
|
+
const result = convertNode$1(buffer[position + 3], buffer);
|
|
2589
|
+
Object.defineProperty(node, 'left', { value: result });
|
|
2590
|
+
return result;
|
|
2591
|
+
},
|
|
2592
|
+
get right() {
|
|
2593
|
+
const result = convertNode$1(buffer[position + 4], buffer);
|
|
2594
|
+
Object.defineProperty(node, 'right', { value: result });
|
|
2595
|
+
return result;
|
|
2596
|
+
}
|
|
2597
|
+
};
|
|
2598
|
+
return node;
|
|
2599
|
+
},
|
|
2600
|
+
function memberExpression(position, buffer) {
|
|
2601
|
+
const flags = buffer[position + 2];
|
|
2602
|
+
const node = {
|
|
2603
|
+
type: 'MemberExpression',
|
|
2604
|
+
start: buffer[position],
|
|
2605
|
+
end: buffer[position + 1],
|
|
2606
|
+
computed: (flags & 1) === 1,
|
|
2607
|
+
optional: (flags & 2) === 2,
|
|
2608
|
+
get object() {
|
|
2609
|
+
const result = convertNode$1(buffer[position + 3], buffer);
|
|
2610
|
+
Object.defineProperty(node, 'object', { value: result });
|
|
2611
|
+
return result;
|
|
2612
|
+
},
|
|
2613
|
+
get property() {
|
|
2614
|
+
const result = convertNode$1(buffer[position + 4], buffer);
|
|
2615
|
+
Object.defineProperty(node, 'property', { value: result });
|
|
2616
|
+
return result;
|
|
2617
|
+
}
|
|
2618
|
+
};
|
|
2619
|
+
return node;
|
|
2620
|
+
},
|
|
2621
|
+
function metaProperty(position, buffer) {
|
|
2622
|
+
const node = {
|
|
2623
|
+
type: 'MetaProperty',
|
|
2624
|
+
start: buffer[position],
|
|
2625
|
+
end: buffer[position + 1],
|
|
2626
|
+
get meta() {
|
|
2627
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
2628
|
+
Object.defineProperty(node, 'meta', { value: result });
|
|
2629
|
+
return result;
|
|
2630
|
+
},
|
|
2631
|
+
get property() {
|
|
2632
|
+
const result = convertNode$1(buffer[position + 3], buffer);
|
|
2633
|
+
Object.defineProperty(node, 'property', { value: result });
|
|
2634
|
+
return result;
|
|
2635
|
+
}
|
|
2636
|
+
};
|
|
2637
|
+
return node;
|
|
2638
|
+
},
|
|
2639
|
+
function methodDefinition(position, buffer) {
|
|
2640
|
+
const flags = buffer[position + 2];
|
|
2641
|
+
const node = {
|
|
2642
|
+
type: 'MethodDefinition',
|
|
2643
|
+
start: buffer[position],
|
|
2644
|
+
end: buffer[position + 1],
|
|
2645
|
+
static: (flags & 1) === 1,
|
|
2646
|
+
computed: (flags & 2) === 2,
|
|
2647
|
+
get decorators() {
|
|
2648
|
+
const result = convertNodeList$1(buffer[position + 3], buffer);
|
|
2649
|
+
Object.defineProperty(node, 'decorators', { value: result });
|
|
2650
|
+
return result;
|
|
2651
|
+
},
|
|
2652
|
+
get key() {
|
|
2653
|
+
const result = convertNode$1(buffer[position + 4], buffer);
|
|
2654
|
+
Object.defineProperty(node, 'key', { value: result });
|
|
2655
|
+
return result;
|
|
2656
|
+
},
|
|
2657
|
+
get value() {
|
|
2658
|
+
const result = convertNode$1(buffer[position + 5], buffer);
|
|
2659
|
+
Object.defineProperty(node, 'value', { value: result });
|
|
2660
|
+
return result;
|
|
2661
|
+
},
|
|
2662
|
+
get kind() {
|
|
2663
|
+
const result = FIXED_STRINGS[buffer[position + 6]];
|
|
2664
|
+
Object.defineProperty(node, 'kind', { value: result });
|
|
2665
|
+
return result;
|
|
2666
|
+
}
|
|
2667
|
+
};
|
|
2668
|
+
return node;
|
|
2669
|
+
},
|
|
2670
|
+
function newExpression(position, buffer) {
|
|
2671
|
+
const annotations = convertAnnotations(buffer[position + 2], buffer);
|
|
2672
|
+
const node = {
|
|
2673
|
+
type: 'NewExpression',
|
|
2674
|
+
start: buffer[position],
|
|
2675
|
+
end: buffer[position + 1],
|
|
2676
|
+
...(annotations.length > 0 ? { annotations } : {}),
|
|
2677
|
+
get callee() {
|
|
2678
|
+
const result = convertNode$1(buffer[position + 3], buffer);
|
|
2679
|
+
Object.defineProperty(node, 'callee', { value: result });
|
|
2680
|
+
return result;
|
|
2681
|
+
},
|
|
2682
|
+
get arguments() {
|
|
2683
|
+
const result = convertNodeList$1(buffer[position + 4], buffer);
|
|
2684
|
+
Object.defineProperty(node, 'arguments', { value: result });
|
|
2685
|
+
return result;
|
|
2686
|
+
}
|
|
2687
|
+
};
|
|
2688
|
+
return node;
|
|
2689
|
+
},
|
|
2690
|
+
function objectExpression(position, buffer) {
|
|
2691
|
+
const node = {
|
|
2692
|
+
type: 'ObjectExpression',
|
|
2693
|
+
start: buffer[position],
|
|
2694
|
+
end: buffer[position + 1],
|
|
2695
|
+
get properties() {
|
|
2696
|
+
const result = convertNodeList$1(buffer[position + 2], buffer);
|
|
2697
|
+
Object.defineProperty(node, 'properties', { value: result });
|
|
2698
|
+
return result;
|
|
2699
|
+
}
|
|
2700
|
+
};
|
|
2701
|
+
return node;
|
|
2702
|
+
},
|
|
2703
|
+
function objectPattern(position, buffer) {
|
|
2704
|
+
const node = {
|
|
2705
|
+
type: 'ObjectPattern',
|
|
2706
|
+
start: buffer[position],
|
|
2707
|
+
end: buffer[position + 1],
|
|
2708
|
+
get properties() {
|
|
2709
|
+
const result = convertNodeList$1(buffer[position + 2], buffer);
|
|
2710
|
+
Object.defineProperty(node, 'properties', { value: result });
|
|
2711
|
+
return result;
|
|
2712
|
+
}
|
|
2713
|
+
};
|
|
2714
|
+
return node;
|
|
2715
|
+
},
|
|
2716
|
+
function privateIdentifier(position, buffer) {
|
|
2717
|
+
const node = {
|
|
2718
|
+
type: 'PrivateIdentifier',
|
|
2719
|
+
start: buffer[position],
|
|
2720
|
+
end: buffer[position + 1],
|
|
2721
|
+
get name() {
|
|
2722
|
+
const result = buffer.convertString(buffer[position + 2]);
|
|
2723
|
+
Object.defineProperty(node, 'name', { value: result });
|
|
2724
|
+
return result;
|
|
2725
|
+
}
|
|
2726
|
+
};
|
|
2727
|
+
return node;
|
|
2728
|
+
},
|
|
2729
|
+
function program(position, buffer) {
|
|
2730
|
+
const invalidAnnotations = convertAnnotations(buffer[position + 3], buffer);
|
|
2731
|
+
const node = {
|
|
2732
|
+
type: 'Program',
|
|
2733
|
+
start: buffer[position],
|
|
2734
|
+
end: buffer[position + 1],
|
|
2735
|
+
get body() {
|
|
2736
|
+
const result = convertNodeList$1(buffer[position + 2], buffer);
|
|
2737
|
+
Object.defineProperty(node, 'body', { value: result });
|
|
2738
|
+
return result;
|
|
2739
|
+
},
|
|
2740
|
+
...(invalidAnnotations.length > 0 ? { invalidAnnotations } : {}),
|
|
2741
|
+
sourceType: 'module'
|
|
2742
|
+
};
|
|
2743
|
+
return node;
|
|
2744
|
+
},
|
|
2745
|
+
function property(position, buffer) {
|
|
2746
|
+
const flags = buffer[position + 2];
|
|
2747
|
+
const keyPosition = buffer[position + 3];
|
|
2748
|
+
const value = convertNode$1(buffer[position + 4], buffer);
|
|
2749
|
+
const node = {
|
|
2750
|
+
type: 'Property',
|
|
2751
|
+
start: buffer[position],
|
|
2752
|
+
end: buffer[position + 1],
|
|
2753
|
+
method: (flags & 1) === 1,
|
|
2754
|
+
shorthand: (flags & 2) === 2,
|
|
2755
|
+
computed: (flags & 4) === 4,
|
|
2756
|
+
get key() {
|
|
2757
|
+
const result = keyPosition === 0 ? { ...value } : convertNode$1(keyPosition, buffer);
|
|
2758
|
+
Object.defineProperty(node, 'key', { value: result });
|
|
2759
|
+
return result;
|
|
2760
|
+
},
|
|
2761
|
+
value,
|
|
2762
|
+
get kind() {
|
|
2763
|
+
const result = FIXED_STRINGS[buffer[position + 5]];
|
|
2764
|
+
Object.defineProperty(node, 'kind', { value: result });
|
|
2765
|
+
return result;
|
|
2766
|
+
}
|
|
2767
|
+
};
|
|
2768
|
+
return node;
|
|
2769
|
+
},
|
|
2770
|
+
function propertyDefinition(position, buffer) {
|
|
2771
|
+
const flags = buffer[position + 2];
|
|
2772
|
+
const valuePosition = buffer[position + 5];
|
|
2773
|
+
const node = {
|
|
2774
|
+
type: 'PropertyDefinition',
|
|
2775
|
+
start: buffer[position],
|
|
2776
|
+
end: buffer[position + 1],
|
|
2777
|
+
static: (flags & 1) === 1,
|
|
2778
|
+
computed: (flags & 2) === 2,
|
|
2779
|
+
get decorators() {
|
|
2780
|
+
const result = convertNodeList$1(buffer[position + 3], buffer);
|
|
2781
|
+
Object.defineProperty(node, 'decorators', { value: result });
|
|
2782
|
+
return result;
|
|
2783
|
+
},
|
|
2784
|
+
get key() {
|
|
2785
|
+
const result = convertNode$1(buffer[position + 4], buffer);
|
|
2786
|
+
Object.defineProperty(node, 'key', { value: result });
|
|
2787
|
+
return result;
|
|
2788
|
+
},
|
|
2789
|
+
get value() {
|
|
2790
|
+
const result = valuePosition === 0 ? null : convertNode$1(valuePosition, buffer);
|
|
2791
|
+
Object.defineProperty(node, 'value', { value: result });
|
|
2792
|
+
return result;
|
|
2793
|
+
}
|
|
2794
|
+
};
|
|
2795
|
+
return node;
|
|
2796
|
+
},
|
|
2797
|
+
function restElement(position, buffer) {
|
|
2798
|
+
const node = {
|
|
2799
|
+
type: 'RestElement',
|
|
2800
|
+
start: buffer[position],
|
|
2801
|
+
end: buffer[position + 1],
|
|
2802
|
+
get argument() {
|
|
2803
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
2804
|
+
Object.defineProperty(node, 'argument', { value: result });
|
|
2805
|
+
return result;
|
|
2806
|
+
}
|
|
2807
|
+
};
|
|
2808
|
+
return node;
|
|
2809
|
+
},
|
|
2810
|
+
function returnStatement(position, buffer) {
|
|
2811
|
+
const argumentPosition = buffer[position + 2];
|
|
2812
|
+
const node = {
|
|
2813
|
+
type: 'ReturnStatement',
|
|
2814
|
+
start: buffer[position],
|
|
2815
|
+
end: buffer[position + 1],
|
|
2816
|
+
get argument() {
|
|
2817
|
+
const result = argumentPosition === 0 ? null : convertNode$1(argumentPosition, buffer);
|
|
2818
|
+
Object.defineProperty(node, 'argument', { value: result });
|
|
2819
|
+
return result;
|
|
2820
|
+
}
|
|
2821
|
+
};
|
|
2822
|
+
return node;
|
|
2823
|
+
},
|
|
2824
|
+
function sequenceExpression(position, buffer) {
|
|
2825
|
+
const node = {
|
|
2826
|
+
type: 'SequenceExpression',
|
|
2827
|
+
start: buffer[position],
|
|
2828
|
+
end: buffer[position + 1],
|
|
2829
|
+
get expressions() {
|
|
2830
|
+
const result = convertNodeList$1(buffer[position + 2], buffer);
|
|
2831
|
+
Object.defineProperty(node, 'expressions', { value: result });
|
|
2832
|
+
return result;
|
|
2833
|
+
}
|
|
2834
|
+
};
|
|
2835
|
+
return node;
|
|
2836
|
+
},
|
|
2837
|
+
function spreadElement(position, buffer) {
|
|
2838
|
+
const node = {
|
|
2839
|
+
type: 'SpreadElement',
|
|
2840
|
+
start: buffer[position],
|
|
2841
|
+
end: buffer[position + 1],
|
|
2842
|
+
get argument() {
|
|
2843
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
2844
|
+
Object.defineProperty(node, 'argument', { value: result });
|
|
2845
|
+
return result;
|
|
2846
|
+
}
|
|
2847
|
+
};
|
|
2848
|
+
return node;
|
|
2849
|
+
},
|
|
2850
|
+
function staticBlock(position, buffer) {
|
|
2851
|
+
const node = {
|
|
2852
|
+
type: 'StaticBlock',
|
|
2853
|
+
start: buffer[position],
|
|
2854
|
+
end: buffer[position + 1],
|
|
2855
|
+
get body() {
|
|
2856
|
+
const result = convertNodeList$1(buffer[position + 2], buffer);
|
|
2857
|
+
Object.defineProperty(node, 'body', { value: result });
|
|
2858
|
+
return result;
|
|
2859
|
+
}
|
|
2860
|
+
};
|
|
2861
|
+
return node;
|
|
2862
|
+
},
|
|
2863
|
+
function superElement(position, buffer) {
|
|
2864
|
+
const node = {
|
|
2865
|
+
type: 'Super',
|
|
2866
|
+
start: buffer[position],
|
|
2867
|
+
end: buffer[position + 1]
|
|
2868
|
+
};
|
|
2869
|
+
return node;
|
|
2870
|
+
},
|
|
2871
|
+
function switchCase(position, buffer) {
|
|
2872
|
+
const testPosition = buffer[position + 2];
|
|
2873
|
+
const node = {
|
|
2874
|
+
type: 'SwitchCase',
|
|
2875
|
+
start: buffer[position],
|
|
2876
|
+
end: buffer[position + 1],
|
|
2877
|
+
get test() {
|
|
2878
|
+
const result = testPosition === 0 ? null : convertNode$1(testPosition, buffer);
|
|
2879
|
+
Object.defineProperty(node, 'test', { value: result });
|
|
2880
|
+
return result;
|
|
2881
|
+
},
|
|
2882
|
+
get consequent() {
|
|
2883
|
+
const result = convertNodeList$1(buffer[position + 3], buffer);
|
|
2884
|
+
Object.defineProperty(node, 'consequent', { value: result });
|
|
2885
|
+
return result;
|
|
2886
|
+
}
|
|
2887
|
+
};
|
|
2888
|
+
return node;
|
|
2889
|
+
},
|
|
2890
|
+
function switchStatement(position, buffer) {
|
|
2891
|
+
const node = {
|
|
2892
|
+
type: 'SwitchStatement',
|
|
2893
|
+
start: buffer[position],
|
|
2894
|
+
end: buffer[position + 1],
|
|
2895
|
+
get discriminant() {
|
|
2896
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
2897
|
+
Object.defineProperty(node, 'discriminant', { value: result });
|
|
2898
|
+
return result;
|
|
2899
|
+
},
|
|
2900
|
+
get cases() {
|
|
2901
|
+
const result = convertNodeList$1(buffer[position + 3], buffer);
|
|
2902
|
+
Object.defineProperty(node, 'cases', { value: result });
|
|
2903
|
+
return result;
|
|
2904
|
+
}
|
|
2905
|
+
};
|
|
2906
|
+
return node;
|
|
2907
|
+
},
|
|
2908
|
+
function taggedTemplateExpression(position, buffer) {
|
|
2909
|
+
const node = {
|
|
2910
|
+
type: 'TaggedTemplateExpression',
|
|
2911
|
+
start: buffer[position],
|
|
2912
|
+
end: buffer[position + 1],
|
|
2913
|
+
get tag() {
|
|
2914
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
2915
|
+
Object.defineProperty(node, 'tag', { value: result });
|
|
2916
|
+
return result;
|
|
2917
|
+
},
|
|
2918
|
+
get quasi() {
|
|
2919
|
+
const result = convertNode$1(buffer[position + 3], buffer);
|
|
2920
|
+
Object.defineProperty(node, 'quasi', { value: result });
|
|
2921
|
+
return result;
|
|
2922
|
+
}
|
|
2923
|
+
};
|
|
2924
|
+
return node;
|
|
2925
|
+
},
|
|
2926
|
+
function templateElement(position, buffer) {
|
|
2927
|
+
const flags = buffer[position + 2];
|
|
2928
|
+
const cookedPosition = buffer[position + 3];
|
|
2929
|
+
const cooked = cookedPosition === 0 ? undefined : buffer.convertString(cookedPosition);
|
|
2930
|
+
const raw = buffer.convertString(buffer[position + 4]);
|
|
2931
|
+
const node = {
|
|
2932
|
+
type: 'TemplateElement',
|
|
2933
|
+
start: buffer[position],
|
|
2934
|
+
end: buffer[position + 1],
|
|
2935
|
+
tail: (flags & 1) === 1,
|
|
2936
|
+
value: { cooked, raw }
|
|
2937
|
+
};
|
|
2938
|
+
return node;
|
|
2939
|
+
},
|
|
2940
|
+
function templateLiteral(position, buffer) {
|
|
2941
|
+
const node = {
|
|
2942
|
+
type: 'TemplateLiteral',
|
|
2943
|
+
start: buffer[position],
|
|
2944
|
+
end: buffer[position + 1],
|
|
2945
|
+
get quasis() {
|
|
2946
|
+
const result = convertNodeList$1(buffer[position + 2], buffer);
|
|
2947
|
+
Object.defineProperty(node, 'quasis', { value: result });
|
|
2948
|
+
return result;
|
|
2949
|
+
},
|
|
2950
|
+
get expressions() {
|
|
2951
|
+
const result = convertNodeList$1(buffer[position + 3], buffer);
|
|
2952
|
+
Object.defineProperty(node, 'expressions', { value: result });
|
|
2953
|
+
return result;
|
|
2954
|
+
}
|
|
2955
|
+
};
|
|
2956
|
+
return node;
|
|
2957
|
+
},
|
|
2958
|
+
function thisExpression(position, buffer) {
|
|
2959
|
+
const node = {
|
|
2960
|
+
type: 'ThisExpression',
|
|
2961
|
+
start: buffer[position],
|
|
2962
|
+
end: buffer[position + 1]
|
|
2963
|
+
};
|
|
2964
|
+
return node;
|
|
2965
|
+
},
|
|
2966
|
+
function throwStatement(position, buffer) {
|
|
2967
|
+
const node = {
|
|
2968
|
+
type: 'ThrowStatement',
|
|
2969
|
+
start: buffer[position],
|
|
2970
|
+
end: buffer[position + 1],
|
|
2971
|
+
get argument() {
|
|
2972
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
2973
|
+
Object.defineProperty(node, 'argument', { value: result });
|
|
2974
|
+
return result;
|
|
2975
|
+
}
|
|
2976
|
+
};
|
|
2977
|
+
return node;
|
|
2978
|
+
},
|
|
2979
|
+
function tryStatement(position, buffer) {
|
|
2980
|
+
const handlerPosition = buffer[position + 3];
|
|
2981
|
+
const finalizerPosition = buffer[position + 4];
|
|
2982
|
+
const node = {
|
|
2983
|
+
type: 'TryStatement',
|
|
2984
|
+
start: buffer[position],
|
|
2985
|
+
end: buffer[position + 1],
|
|
2986
|
+
get block() {
|
|
2987
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
2988
|
+
Object.defineProperty(node, 'block', { value: result });
|
|
2989
|
+
return result;
|
|
2990
|
+
},
|
|
2991
|
+
get handler() {
|
|
2992
|
+
const result = handlerPosition === 0 ? null : convertNode$1(handlerPosition, buffer);
|
|
2993
|
+
Object.defineProperty(node, 'handler', { value: result });
|
|
2994
|
+
return result;
|
|
2995
|
+
},
|
|
2996
|
+
get finalizer() {
|
|
2997
|
+
const result = finalizerPosition === 0 ? null : convertNode$1(finalizerPosition, buffer);
|
|
2998
|
+
Object.defineProperty(node, 'finalizer', { value: result });
|
|
2999
|
+
return result;
|
|
3000
|
+
}
|
|
3001
|
+
};
|
|
3002
|
+
return node;
|
|
3003
|
+
},
|
|
3004
|
+
function unaryExpression(position, buffer) {
|
|
3005
|
+
const node = {
|
|
3006
|
+
type: 'UnaryExpression',
|
|
3007
|
+
start: buffer[position],
|
|
3008
|
+
end: buffer[position + 1],
|
|
3009
|
+
get operator() {
|
|
3010
|
+
const result = FIXED_STRINGS[buffer[position + 2]];
|
|
3011
|
+
Object.defineProperty(node, 'operator', { value: result });
|
|
3012
|
+
return result;
|
|
3013
|
+
},
|
|
3014
|
+
get argument() {
|
|
3015
|
+
const result = convertNode$1(buffer[position + 3], buffer);
|
|
3016
|
+
Object.defineProperty(node, 'argument', { value: result });
|
|
3017
|
+
return result;
|
|
3018
|
+
},
|
|
3019
|
+
prefix: true
|
|
3020
|
+
};
|
|
3021
|
+
return node;
|
|
3022
|
+
},
|
|
3023
|
+
function updateExpression(position, buffer) {
|
|
3024
|
+
const flags = buffer[position + 2];
|
|
3025
|
+
const node = {
|
|
3026
|
+
type: 'UpdateExpression',
|
|
3027
|
+
start: buffer[position],
|
|
3028
|
+
end: buffer[position + 1],
|
|
3029
|
+
prefix: (flags & 1) === 1,
|
|
3030
|
+
get operator() {
|
|
3031
|
+
const result = FIXED_STRINGS[buffer[position + 3]];
|
|
3032
|
+
Object.defineProperty(node, 'operator', { value: result });
|
|
3033
|
+
return result;
|
|
3034
|
+
},
|
|
3035
|
+
get argument() {
|
|
3036
|
+
const result = convertNode$1(buffer[position + 4], buffer);
|
|
3037
|
+
Object.defineProperty(node, 'argument', { value: result });
|
|
3038
|
+
return result;
|
|
3039
|
+
}
|
|
3040
|
+
};
|
|
3041
|
+
return node;
|
|
3042
|
+
},
|
|
3043
|
+
function variableDeclaration(position, buffer) {
|
|
3044
|
+
const node = {
|
|
3045
|
+
type: 'VariableDeclaration',
|
|
3046
|
+
start: buffer[position],
|
|
3047
|
+
end: buffer[position + 1],
|
|
3048
|
+
get kind() {
|
|
3049
|
+
const result = FIXED_STRINGS[buffer[position + 2]];
|
|
3050
|
+
Object.defineProperty(node, 'kind', { value: result });
|
|
3051
|
+
return result;
|
|
3052
|
+
},
|
|
3053
|
+
get declarations() {
|
|
3054
|
+
const result = convertNodeList$1(buffer[position + 3], buffer);
|
|
3055
|
+
Object.defineProperty(node, 'declarations', { value: result });
|
|
3056
|
+
return result;
|
|
3057
|
+
}
|
|
3058
|
+
};
|
|
3059
|
+
return node;
|
|
3060
|
+
},
|
|
3061
|
+
function variableDeclarator(position, buffer) {
|
|
3062
|
+
const initPosition = buffer[position + 3];
|
|
3063
|
+
const node = {
|
|
3064
|
+
type: 'VariableDeclarator',
|
|
3065
|
+
start: buffer[position],
|
|
3066
|
+
end: buffer[position + 1],
|
|
3067
|
+
get id() {
|
|
3068
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
3069
|
+
Object.defineProperty(node, 'id', { value: result });
|
|
3070
|
+
return result;
|
|
3071
|
+
},
|
|
3072
|
+
get init() {
|
|
3073
|
+
const result = initPosition === 0 ? null : convertNode$1(initPosition, buffer);
|
|
3074
|
+
Object.defineProperty(node, 'init', { value: result });
|
|
3075
|
+
return result;
|
|
3076
|
+
}
|
|
3077
|
+
};
|
|
3078
|
+
return node;
|
|
3079
|
+
},
|
|
3080
|
+
function whileStatement(position, buffer) {
|
|
3081
|
+
const node = {
|
|
3082
|
+
type: 'WhileStatement',
|
|
3083
|
+
start: buffer[position],
|
|
3084
|
+
end: buffer[position + 1],
|
|
3085
|
+
get test() {
|
|
3086
|
+
const result = convertNode$1(buffer[position + 2], buffer);
|
|
3087
|
+
Object.defineProperty(node, 'test', { value: result });
|
|
3088
|
+
return result;
|
|
3089
|
+
},
|
|
3090
|
+
get body() {
|
|
3091
|
+
const result = convertNode$1(buffer[position + 3], buffer);
|
|
3092
|
+
Object.defineProperty(node, 'body', { value: result });
|
|
3093
|
+
return result;
|
|
3094
|
+
}
|
|
3095
|
+
};
|
|
3096
|
+
return node;
|
|
3097
|
+
},
|
|
3098
|
+
function yieldExpression(position, buffer) {
|
|
3099
|
+
const flags = buffer[position + 2];
|
|
3100
|
+
const argumentPosition = buffer[position + 3];
|
|
3101
|
+
const node = {
|
|
3102
|
+
type: 'YieldExpression',
|
|
3103
|
+
start: buffer[position],
|
|
3104
|
+
end: buffer[position + 1],
|
|
3105
|
+
delegate: (flags & 1) === 1,
|
|
3106
|
+
get argument() {
|
|
3107
|
+
const result = argumentPosition === 0 ? null : convertNode$1(argumentPosition, buffer);
|
|
3108
|
+
Object.defineProperty(node, 'argument', { value: result });
|
|
3109
|
+
return result;
|
|
3110
|
+
}
|
|
3111
|
+
};
|
|
3112
|
+
return node;
|
|
3113
|
+
}
|
|
3114
|
+
];
|
|
3115
|
+
function convertNode$1(position, buffer) {
|
|
3116
|
+
const nodeType = buffer[position];
|
|
3117
|
+
const converter = nodeConverters$1[nodeType];
|
|
3118
|
+
/* istanbul ignore if: This should never be executed but is a safeguard against faulty buffers */
|
|
3119
|
+
if (!converter) {
|
|
3120
|
+
console.trace();
|
|
3121
|
+
throw new Error(`Unknown node type: ${nodeType}`);
|
|
3122
|
+
}
|
|
3123
|
+
return converter(position + 1, buffer);
|
|
3124
|
+
}
|
|
3125
|
+
function convertNodeList$1(position, buffer) {
|
|
3126
|
+
if (position === 0)
|
|
3127
|
+
return EMPTY_ARRAY;
|
|
3128
|
+
const length = buffer[position++];
|
|
3129
|
+
const list = new Array(length);
|
|
3130
|
+
for (let index = 0; index < length; index++) {
|
|
3131
|
+
const nodePosition = buffer[position++];
|
|
3132
|
+
list[index] = nodePosition ? convertNode$1(nodePosition, buffer) : null;
|
|
3133
|
+
}
|
|
3134
|
+
return list;
|
|
3135
|
+
}
|
|
3136
|
+
|
|
3137
|
+
// Buffers hold 32-bit words in host byte order. For words that represent
|
|
3138
|
+
// strings, the four string bytes are packed LSB-first into the word, which on
|
|
3139
|
+
// little-endian hosts leaves the raw encoded string bytes in memory while
|
|
3140
|
+
// big-endian hosts need the byte order of each word reversed.
|
|
3141
|
+
const isBigEndianHost = new Uint8Array(new Uint32Array([1]).buffer)[0] === 0;
|
|
3142
|
+
const scratchFloat64 = new DataView(new ArrayBuffer(8));
|
|
3143
|
+
let scratchStringBytes = new Uint8Array(0);
|
|
3144
|
+
const writeFloat64 = function (value, wordPosition) {
|
|
3145
|
+
scratchFloat64.setFloat64(0, value, true);
|
|
3146
|
+
this[wordPosition] = scratchFloat64.getUint32(0, true);
|
|
3147
|
+
this[wordPosition + 1] = scratchFloat64.getUint32(4, true);
|
|
3148
|
+
};
|
|
3149
|
+
function writeStringWordsBigEndian(buffer, byteBuffer, bytePosition, byteLength) {
|
|
3150
|
+
const firstWordPosition = bytePosition >> 2;
|
|
3151
|
+
const wordCount = (byteLength + 3) >> 2;
|
|
3152
|
+
for (let index = 0; index < wordCount; index++) {
|
|
3153
|
+
const offset = bytePosition + (index << 2);
|
|
3154
|
+
buffer[firstWordPosition + index] =
|
|
3155
|
+
byteBuffer[offset] |
|
|
3156
|
+
(byteBuffer[offset + 1] << 8) |
|
|
3157
|
+
(byteBuffer[offset + 2] << 16) |
|
|
3158
|
+
(byteBuffer[offset + 3] << 24);
|
|
3159
|
+
}
|
|
3160
|
+
}
|
|
3161
|
+
const expandPackedString = (array, position, length) => {
|
|
3162
|
+
const paddedByteLength = ((length + 3) >> 2) << 2;
|
|
3163
|
+
if (scratchStringBytes.length < paddedByteLength) {
|
|
3164
|
+
scratchStringBytes = new Uint8Array(paddedByteLength);
|
|
3165
|
+
}
|
|
3166
|
+
const firstStringWord = position + 1;
|
|
3167
|
+
for (let index = 0; index < paddedByteLength >> 2; index++) {
|
|
3168
|
+
const word = array[firstStringWord + index];
|
|
3169
|
+
scratchStringBytes[index << 2] = word & 0xff;
|
|
3170
|
+
scratchStringBytes[(index << 2) + 1] = (word >>> 8) & 0xff;
|
|
3171
|
+
scratchStringBytes[(index << 2) + 2] = (word >>> 16) & 0xff;
|
|
3172
|
+
scratchStringBytes[(index << 2) + 3] = (word >>> 24) & 0xff;
|
|
3173
|
+
}
|
|
3174
|
+
return scratchStringBytes.subarray(0, length);
|
|
3175
|
+
};
|
|
3176
|
+
const decodePackedString = (array, position, length) => {
|
|
3177
|
+
const bytes = expandPackedString(array, position, length);
|
|
3178
|
+
return typeof Buffer !== 'undefined'
|
|
3179
|
+
? Buffer.from(bytes.buffer, bytes.byteOffset, bytes.length).toString('utf8')
|
|
3180
|
+
: new TextDecoder().decode(bytes);
|
|
3181
|
+
};
|
|
3182
|
+
function getAstBuffer(byteBuffer) {
|
|
3183
|
+
// Create an aligned copy for misaligned views, e.g. buffers restored by
|
|
3184
|
+
// v8.deserialize, as the Uint32Array below requires a 4-byte aligned offset
|
|
3185
|
+
const alignedByteBuffer = byteBuffer.byteOffset & 3 ? new Uint8Array(byteBuffer) : byteBuffer;
|
|
3186
|
+
const array = new Uint32Array(alignedByteBuffer.buffer, alignedByteBuffer.byteOffset, alignedByteBuffer.byteLength >> 2);
|
|
3187
|
+
let convertString;
|
|
3188
|
+
if (isBigEndianHost) {
|
|
3189
|
+
convertString = position => decodePackedString(array, position, array[position]);
|
|
3190
|
+
}
|
|
3191
|
+
else if (typeof Buffer !== 'undefined' && byteBuffer instanceof Buffer) {
|
|
3192
|
+
convertString = position => {
|
|
3193
|
+
const length = array[position];
|
|
3194
|
+
const bytePosition = (position + 1) << 2;
|
|
3195
|
+
return byteBuffer.toString('utf8', bytePosition, bytePosition + length);
|
|
3196
|
+
};
|
|
3197
|
+
}
|
|
3198
|
+
else {
|
|
3199
|
+
const textDecoder = new TextDecoder();
|
|
3200
|
+
convertString = position => {
|
|
3201
|
+
const length = array[position];
|
|
3202
|
+
const bytePosition = (position + 1) << 2;
|
|
3203
|
+
return textDecoder.decode(byteBuffer.subarray(bytePosition, bytePosition + length));
|
|
3204
|
+
};
|
|
3205
|
+
}
|
|
3206
|
+
return Object.assign(array, {
|
|
3207
|
+
convertFloat64(position) {
|
|
3208
|
+
scratchFloat64.setUint32(0, this[position], true);
|
|
3209
|
+
scratchFloat64.setUint32(4, this[position + 1], true);
|
|
3210
|
+
return scratchFloat64.getFloat64(0, true);
|
|
3211
|
+
},
|
|
3212
|
+
convertString
|
|
3213
|
+
});
|
|
3214
|
+
}
|
|
3215
|
+
function createAstBufferUint8(uInt32Size) {
|
|
3216
|
+
const buffer = new Uint32Array(uInt32Size);
|
|
3217
|
+
const encoder = new TextEncoder();
|
|
3218
|
+
const byteBuffer = new Uint8Array(buffer.buffer);
|
|
3219
|
+
return Object.assign(buffer, {
|
|
3220
|
+
addStringToBuffer(text, referencePosition) {
|
|
3221
|
+
const insertPosition = buffer.position;
|
|
3222
|
+
buffer[referencePosition] = insertPosition;
|
|
3223
|
+
const encoded = encoder.encode(text);
|
|
3224
|
+
const encodedByteLength = encoded.length;
|
|
3225
|
+
// Round up to the next 4-byte boundary, add 1 for the length
|
|
3226
|
+
const reservedSize = 1 + ((encodedByteLength + 3) >> 2);
|
|
3227
|
+
const extendedBuffer = buffer.reserve(reservedSize);
|
|
3228
|
+
extendedBuffer[insertPosition] = encodedByteLength;
|
|
3229
|
+
const stringBytePosition = (insertPosition + 1) << 2;
|
|
3230
|
+
extendedBuffer.byteBuffer.set(encoded, stringBytePosition);
|
|
3231
|
+
if (isBigEndianHost) {
|
|
3232
|
+
writeStringWordsBigEndian(extendedBuffer, extendedBuffer.byteBuffer, stringBytePosition, encodedByteLength);
|
|
3233
|
+
}
|
|
3234
|
+
return extendedBuffer;
|
|
3235
|
+
},
|
|
3236
|
+
byteBuffer,
|
|
3237
|
+
position: 0,
|
|
3238
|
+
reserve(size) {
|
|
3239
|
+
const newPosition = buffer.position + size;
|
|
3240
|
+
if (newPosition <= buffer.length) {
|
|
3241
|
+
buffer.position = newPosition;
|
|
3242
|
+
return buffer;
|
|
3243
|
+
}
|
|
3244
|
+
const newBuffer = createAstBufferUint8(newPosition * 2);
|
|
3245
|
+
newBuffer.set(buffer);
|
|
3246
|
+
newBuffer.position = newPosition;
|
|
3247
|
+
return newBuffer;
|
|
3248
|
+
},
|
|
3249
|
+
toOutput() {
|
|
3250
|
+
const byteSize = buffer.position << 2;
|
|
3251
|
+
return byteBuffer.slice(0, byteSize);
|
|
3252
|
+
},
|
|
3253
|
+
writeFloat64
|
|
3254
|
+
});
|
|
3255
|
+
}
|
|
3256
|
+
function createAstBufferNode(uInt32Size) {
|
|
3257
|
+
const buffer = new Uint32Array(uInt32Size);
|
|
3258
|
+
const byteBuffer = Buffer.from(buffer.buffer);
|
|
3259
|
+
return Object.assign(buffer, {
|
|
3260
|
+
addStringToBuffer(text, referencePosition) {
|
|
3261
|
+
let extendedBuffer = buffer;
|
|
3262
|
+
const requiredSize = buffer.position + 1 + ((text.length * 3 + 3) >> 2);
|
|
3263
|
+
if (requiredSize > buffer.length) {
|
|
3264
|
+
// Reserve more space if needed
|
|
3265
|
+
extendedBuffer = createAstBufferNode(requiredSize * 2);
|
|
3266
|
+
byteBuffer.copy(extendedBuffer.byteBuffer, 0, 0, buffer.position << 2);
|
|
3267
|
+
extendedBuffer.position = buffer.position;
|
|
3268
|
+
}
|
|
3269
|
+
const insertPosition = extendedBuffer.position;
|
|
3270
|
+
extendedBuffer[referencePosition] = insertPosition;
|
|
3271
|
+
const stringBytePosition = (insertPosition + 1) << 2;
|
|
3272
|
+
const encodedLength = extendedBuffer.byteBuffer.write(text, stringBytePosition);
|
|
3273
|
+
extendedBuffer[insertPosition] = encodedLength;
|
|
3274
|
+
if (isBigEndianHost) {
|
|
3275
|
+
writeStringWordsBigEndian(extendedBuffer, extendedBuffer.byteBuffer, stringBytePosition, encodedLength);
|
|
3276
|
+
}
|
|
3277
|
+
// Round up to the next 4-byte boundary
|
|
3278
|
+
extendedBuffer.position = (stringBytePosition + encodedLength + 3) >> 2;
|
|
3279
|
+
return extendedBuffer;
|
|
3280
|
+
},
|
|
3281
|
+
byteBuffer,
|
|
3282
|
+
position: 0,
|
|
3283
|
+
reserve(size) {
|
|
3284
|
+
const newPosition = buffer.position + size;
|
|
3285
|
+
if (newPosition <= buffer.length) {
|
|
3286
|
+
buffer.position = newPosition;
|
|
3287
|
+
return buffer;
|
|
3288
|
+
}
|
|
3289
|
+
const newBuffer = createAstBufferNode(newPosition * 2);
|
|
3290
|
+
byteBuffer.copy(newBuffer.byteBuffer, 0, 0, buffer.position << 2);
|
|
3291
|
+
newBuffer.position = newPosition;
|
|
3292
|
+
return newBuffer;
|
|
3293
|
+
},
|
|
3294
|
+
toOutput() {
|
|
3295
|
+
const byteSize = buffer.position << 2;
|
|
3296
|
+
// The "slow" version will allocate exactly the needed size and is preferable
|
|
3297
|
+
// for long-term memory usage.
|
|
3298
|
+
const truncatedBuffer = Buffer.allocUnsafeSlow(byteSize);
|
|
3299
|
+
byteBuffer.copy(truncatedBuffer, 0, 0, byteSize);
|
|
3300
|
+
return truncatedBuffer;
|
|
3301
|
+
},
|
|
3302
|
+
writeFloat64
|
|
3303
|
+
});
|
|
3304
|
+
}
|
|
3305
|
+
|
|
3306
|
+
// This file is generated by scripts/generate-scope-constants.ts.
|
|
3307
|
+
// Do not edit this file directly.
|
|
3308
|
+
const SCOPE_PARENT_OFFSET = 0;
|
|
3309
|
+
const SCOPE_DECLARATION_COUNT_OFFSET = 1;
|
|
3310
|
+
const SCOPE_DECLARATIONS_OFFSET = 2;
|
|
3311
|
+
|
|
3312
|
+
const IDENTIFIER_NAME_OFFSET = 3;
|
|
3313
|
+
async function parseAndWalk(input, visitors, { allowReturnOutsideFunction = false, collectScopes = false, jsx = false } = {}) {
|
|
3314
|
+
const selectedNodesBuffer = getSelectedNodesBitsetBuffer(visitors);
|
|
3315
|
+
const astBuffer = getAstBuffer(await native_js.parseAndWalk(input, allowReturnOutsideFunction, jsx, selectedNodesBuffer, collectScopes));
|
|
3316
|
+
walkAstBuffer(astBuffer, visitors, collectScopes);
|
|
3317
|
+
}
|
|
3318
|
+
function getSelectedNodesBitsetBuffer(visitors) {
|
|
3319
|
+
let selectedNodesBitset = 0n;
|
|
3320
|
+
for (const nodeType of Object.keys(visitors)) {
|
|
3321
|
+
const ids = nodeIds[nodeType];
|
|
3322
|
+
if (ids) {
|
|
3323
|
+
for (const id of ids) {
|
|
3324
|
+
selectedNodesBitset |= 1n << BigInt(id);
|
|
3325
|
+
}
|
|
3326
|
+
}
|
|
3327
|
+
else {
|
|
3328
|
+
throw new Error(`Unknown node type "${nodeType}" when calling "parseAndWalk".`);
|
|
3329
|
+
}
|
|
3330
|
+
}
|
|
3331
|
+
const selectedNodesBuffer = new BigUint64Array(2); // 2 × 64 bits = 128 bits
|
|
3332
|
+
selectedNodesBuffer[0] = selectedNodesBitset & ((1n << 64n) - 1n);
|
|
3333
|
+
selectedNodesBuffer[1] = selectedNodesBitset >> 64n;
|
|
3334
|
+
return selectedNodesBuffer;
|
|
3335
|
+
}
|
|
3336
|
+
// TODO Lukas Can we expose parseAndWalk as a separate method? Can we also make
|
|
3337
|
+
// sure to include its tests in the smoke tests to test on a big endian system?
|
|
3338
|
+
function walkAstBuffer(astBuffer, visitors, collectScopes) {
|
|
3339
|
+
const walkingInfoOffset = astBuffer[0];
|
|
3340
|
+
const entrySize = 3;
|
|
3341
|
+
// If it is 0, there are no walking buffer or walked nodes
|
|
3342
|
+
if (walkingInfoOffset === 0) {
|
|
3343
|
+
// This will throw the correct error if there was a parse error
|
|
3344
|
+
return deserializeLazyAstBuffer(astBuffer, 1);
|
|
3345
|
+
}
|
|
3346
|
+
let walkingPosition = walkingInfoOffset;
|
|
3347
|
+
const scopeCache = new Map();
|
|
3348
|
+
const api = {
|
|
3349
|
+
parseChildren() {
|
|
3350
|
+
const endPosition = walkingInfoOffset + astBuffer[walkingPosition + 1] * entrySize;
|
|
3351
|
+
walkingPosition += entrySize;
|
|
3352
|
+
walkUntilPosition(endPosition);
|
|
3353
|
+
// After parseChildren, the walkingPosition must point to the last child,
|
|
3354
|
+
// not beyond. Otherwise, we would skip the next element.
|
|
3355
|
+
walkingPosition -= entrySize;
|
|
3356
|
+
},
|
|
3357
|
+
skipChildren() {
|
|
3358
|
+
// Like parseChildren, the pointer must point to the last child after
|
|
3359
|
+
// skipping, not beyond.
|
|
3360
|
+
walkingPosition = walkingInfoOffset + astBuffer[walkingPosition + 1] * entrySize - entrySize;
|
|
3361
|
+
}
|
|
3362
|
+
};
|
|
3363
|
+
function walkUntilPosition(endPosition) {
|
|
3364
|
+
for (; walkingPosition < endPosition; walkingPosition += entrySize) {
|
|
3365
|
+
const elementIndex = astBuffer[walkingPosition];
|
|
3366
|
+
if (collectScopes) {
|
|
3367
|
+
api.scope = getScope(astBuffer[walkingPosition + 2]);
|
|
3368
|
+
}
|
|
3369
|
+
const nodeTypeString = nodeTypeStrings[astBuffer[elementIndex]];
|
|
3370
|
+
visitors[nodeTypeString](deserializeLazyAstBuffer(astBuffer, elementIndex), api);
|
|
3371
|
+
}
|
|
3372
|
+
}
|
|
3373
|
+
function getScope(scopePosition) {
|
|
3374
|
+
/* istanbul ignore next */
|
|
3375
|
+
if (scopePosition === 0) {
|
|
3376
|
+
throw new Error('Internal Error: Missing scope information in parseAndWalk.');
|
|
3377
|
+
}
|
|
3378
|
+
let scope = scopeCache.get(scopePosition);
|
|
3379
|
+
if (!scope) {
|
|
3380
|
+
scope = {
|
|
3381
|
+
contains(name) {
|
|
3382
|
+
for (let currentScopePosition = scopePosition; currentScopePosition;) {
|
|
3383
|
+
const declarationCount = astBuffer[currentScopePosition + SCOPE_DECLARATION_COUNT_OFFSET];
|
|
3384
|
+
for (let index = 0; index < declarationCount; index++) {
|
|
3385
|
+
const identifierPosition = astBuffer[currentScopePosition + SCOPE_DECLARATIONS_OFFSET + index];
|
|
3386
|
+
if (astBuffer.convertString(astBuffer[identifierPosition + IDENTIFIER_NAME_OFFSET]) ===
|
|
3387
|
+
name) {
|
|
3388
|
+
return true;
|
|
3389
|
+
}
|
|
3390
|
+
}
|
|
3391
|
+
currentScopePosition = astBuffer[currentScopePosition + SCOPE_PARENT_OFFSET];
|
|
3392
|
+
}
|
|
3393
|
+
return false;
|
|
3394
|
+
}
|
|
3395
|
+
};
|
|
3396
|
+
scopeCache.set(scopePosition, scope);
|
|
3397
|
+
}
|
|
3398
|
+
return scope;
|
|
3399
|
+
}
|
|
3400
|
+
walkUntilPosition(astBuffer.length);
|
|
3401
|
+
}
|
|
3402
|
+
|
|
3403
|
+
// This file is generated by scripts/generate-buffer-to-ast.ts.
|
|
3404
|
+
// Do not edit this file directly.
|
|
3405
|
+
const deserializeAstBuffer = (buffer, position) => {
|
|
3406
|
+
const node = convertNode(position, buffer);
|
|
3407
|
+
switch (node.type) {
|
|
3408
|
+
case PanicError: {
|
|
3409
|
+
return error(getRollupError(logParseError(node.message)));
|
|
3410
|
+
}
|
|
3411
|
+
case ParseError: {
|
|
3412
|
+
return error(getRollupError(logParseError(node.message, node.start)));
|
|
3413
|
+
}
|
|
3414
|
+
default: {
|
|
3415
|
+
return node;
|
|
3416
|
+
}
|
|
3417
|
+
}
|
|
3418
|
+
};
|
|
3419
|
+
/* eslint-disable sort-keys */
|
|
3420
|
+
const nodeConverters = [
|
|
3421
|
+
function panicError(position, buffer) {
|
|
3422
|
+
return {
|
|
3423
|
+
type: 'PanicError',
|
|
3424
|
+
start: buffer[position],
|
|
3425
|
+
end: buffer[position + 1],
|
|
3426
|
+
message: buffer.convertString(buffer[position + 2])
|
|
3427
|
+
};
|
|
3428
|
+
},
|
|
3429
|
+
function parseError(position, buffer) {
|
|
3430
|
+
return {
|
|
3431
|
+
type: 'ParseError',
|
|
3432
|
+
start: buffer[position],
|
|
3433
|
+
end: buffer[position + 1],
|
|
3434
|
+
message: buffer.convertString(buffer[position + 2])
|
|
3435
|
+
};
|
|
3436
|
+
},
|
|
3437
|
+
function arrayExpression(position, buffer) {
|
|
3438
|
+
return {
|
|
3439
|
+
type: 'ArrayExpression',
|
|
3440
|
+
start: buffer[position],
|
|
3441
|
+
end: buffer[position + 1],
|
|
3442
|
+
elements: convertNodeList(buffer[position + 2], buffer)
|
|
3443
|
+
};
|
|
3444
|
+
},
|
|
3445
|
+
function arrayPattern(position, buffer) {
|
|
3446
|
+
return {
|
|
3447
|
+
type: 'ArrayPattern',
|
|
3448
|
+
start: buffer[position],
|
|
3449
|
+
end: buffer[position + 1],
|
|
3450
|
+
elements: convertNodeList(buffer[position + 2], buffer)
|
|
3451
|
+
};
|
|
3452
|
+
},
|
|
3453
|
+
function arrowFunctionExpression(position, buffer) {
|
|
3454
|
+
const flags = buffer[position + 2];
|
|
3455
|
+
const annotations = convertAnnotations(buffer[position + 3], buffer);
|
|
3456
|
+
return {
|
|
3457
|
+
type: 'ArrowFunctionExpression',
|
|
3458
|
+
start: buffer[position],
|
|
3459
|
+
end: buffer[position + 1],
|
|
3460
|
+
async: (flags & 1) === 1,
|
|
3461
|
+
expression: (flags & 2) === 2,
|
|
3462
|
+
generator: (flags & 4) === 4,
|
|
3463
|
+
...(annotations.length > 0 ? { annotations } : {}),
|
|
3464
|
+
params: convertNodeList(buffer[position + 4], buffer),
|
|
3465
|
+
body: convertNode(buffer[position + 5], buffer),
|
|
3466
|
+
id: null
|
|
3467
|
+
};
|
|
3468
|
+
},
|
|
3469
|
+
function assignmentExpression(position, buffer) {
|
|
3470
|
+
return {
|
|
3471
|
+
type: 'AssignmentExpression',
|
|
3472
|
+
start: buffer[position],
|
|
3473
|
+
end: buffer[position + 1],
|
|
3474
|
+
operator: FIXED_STRINGS[buffer[position + 2]],
|
|
3475
|
+
left: convertNode(buffer[position + 3], buffer),
|
|
3476
|
+
right: convertNode(buffer[position + 4], buffer)
|
|
3477
|
+
};
|
|
3478
|
+
},
|
|
3479
|
+
function assignmentPattern(position, buffer) {
|
|
3480
|
+
return {
|
|
3481
|
+
type: 'AssignmentPattern',
|
|
3482
|
+
start: buffer[position],
|
|
3483
|
+
end: buffer[position + 1],
|
|
3484
|
+
left: convertNode(buffer[position + 2], buffer),
|
|
3485
|
+
right: convertNode(buffer[position + 3], buffer)
|
|
3486
|
+
};
|
|
3487
|
+
},
|
|
3488
|
+
function awaitExpression(position, buffer) {
|
|
3489
|
+
return {
|
|
3490
|
+
type: 'AwaitExpression',
|
|
3491
|
+
start: buffer[position],
|
|
3492
|
+
end: buffer[position + 1],
|
|
3493
|
+
argument: convertNode(buffer[position + 2], buffer)
|
|
3494
|
+
};
|
|
3495
|
+
},
|
|
3496
|
+
function binaryExpression(position, buffer) {
|
|
3497
|
+
return {
|
|
3498
|
+
type: 'BinaryExpression',
|
|
3499
|
+
start: buffer[position],
|
|
3500
|
+
end: buffer[position + 1],
|
|
3501
|
+
operator: FIXED_STRINGS[buffer[position + 2]],
|
|
3502
|
+
left: convertNode(buffer[position + 3], buffer),
|
|
3503
|
+
right: convertNode(buffer[position + 4], buffer)
|
|
3504
|
+
};
|
|
3505
|
+
},
|
|
3506
|
+
function blockStatement(position, buffer) {
|
|
3507
|
+
return {
|
|
3508
|
+
type: 'BlockStatement',
|
|
3509
|
+
start: buffer[position],
|
|
3510
|
+
end: buffer[position + 1],
|
|
3511
|
+
body: convertNodeList(buffer[position + 2], buffer)
|
|
3512
|
+
};
|
|
3513
|
+
},
|
|
3514
|
+
function breakStatement(position, buffer) {
|
|
3515
|
+
const labelPosition = buffer[position + 2];
|
|
3516
|
+
return {
|
|
3517
|
+
type: 'BreakStatement',
|
|
3518
|
+
start: buffer[position],
|
|
3519
|
+
end: buffer[position + 1],
|
|
3520
|
+
label: labelPosition === 0 ? null : convertNode(labelPosition, buffer)
|
|
3521
|
+
};
|
|
3522
|
+
},
|
|
3523
|
+
function callExpression(position, buffer) {
|
|
3524
|
+
const flags = buffer[position + 2];
|
|
3525
|
+
const annotations = convertAnnotations(buffer[position + 3], buffer);
|
|
3526
|
+
return {
|
|
3527
|
+
type: 'CallExpression',
|
|
3528
|
+
start: buffer[position],
|
|
3529
|
+
end: buffer[position + 1],
|
|
3530
|
+
optional: (flags & 1) === 1,
|
|
3531
|
+
...(annotations.length > 0 ? { annotations } : {}),
|
|
3532
|
+
callee: convertNode(buffer[position + 4], buffer),
|
|
3533
|
+
arguments: convertNodeList(buffer[position + 5], buffer)
|
|
3534
|
+
};
|
|
3535
|
+
},
|
|
3536
|
+
function catchClause(position, buffer) {
|
|
3537
|
+
const parameterPosition = buffer[position + 2];
|
|
3538
|
+
return {
|
|
3539
|
+
type: 'CatchClause',
|
|
3540
|
+
start: buffer[position],
|
|
3541
|
+
end: buffer[position + 1],
|
|
3542
|
+
param: parameterPosition === 0 ? null : convertNode(parameterPosition, buffer),
|
|
3543
|
+
body: convertNode(buffer[position + 3], buffer)
|
|
3544
|
+
};
|
|
3545
|
+
},
|
|
3546
|
+
function chainExpression(position, buffer) {
|
|
3547
|
+
return {
|
|
3548
|
+
type: 'ChainExpression',
|
|
3549
|
+
start: buffer[position],
|
|
3550
|
+
end: buffer[position + 1],
|
|
3551
|
+
expression: convertNode(buffer[position + 2], buffer)
|
|
3552
|
+
};
|
|
3553
|
+
},
|
|
3554
|
+
function classBody(position, buffer) {
|
|
3555
|
+
return {
|
|
3556
|
+
type: 'ClassBody',
|
|
3557
|
+
start: buffer[position],
|
|
3558
|
+
end: buffer[position + 1],
|
|
3559
|
+
body: convertNodeList(buffer[position + 2], buffer)
|
|
3560
|
+
};
|
|
3561
|
+
},
|
|
3562
|
+
function classDeclaration(position, buffer) {
|
|
3563
|
+
const idPosition = buffer[position + 3];
|
|
3564
|
+
const superClassPosition = buffer[position + 4];
|
|
3565
|
+
return {
|
|
3566
|
+
type: 'ClassDeclaration',
|
|
3567
|
+
start: buffer[position],
|
|
3568
|
+
end: buffer[position + 1],
|
|
3569
|
+
decorators: convertNodeList(buffer[position + 2], buffer),
|
|
3570
|
+
id: idPosition === 0 ? null : convertNode(idPosition, buffer),
|
|
3571
|
+
superClass: superClassPosition === 0 ? null : convertNode(superClassPosition, buffer),
|
|
3572
|
+
body: convertNode(buffer[position + 5], buffer)
|
|
3573
|
+
};
|
|
3574
|
+
},
|
|
3575
|
+
function classExpression(position, buffer) {
|
|
3576
|
+
const idPosition = buffer[position + 3];
|
|
3577
|
+
const superClassPosition = buffer[position + 4];
|
|
3578
|
+
return {
|
|
3579
|
+
type: 'ClassExpression',
|
|
3580
|
+
start: buffer[position],
|
|
3581
|
+
end: buffer[position + 1],
|
|
3582
|
+
decorators: convertNodeList(buffer[position + 2], buffer),
|
|
3583
|
+
id: idPosition === 0 ? null : convertNode(idPosition, buffer),
|
|
3584
|
+
superClass: superClassPosition === 0 ? null : convertNode(superClassPosition, buffer),
|
|
3585
|
+
body: convertNode(buffer[position + 5], buffer)
|
|
3586
|
+
};
|
|
3587
|
+
},
|
|
3588
|
+
function conditionalExpression(position, buffer) {
|
|
3589
|
+
return {
|
|
3590
|
+
type: 'ConditionalExpression',
|
|
3591
|
+
start: buffer[position],
|
|
3592
|
+
end: buffer[position + 1],
|
|
3593
|
+
test: convertNode(buffer[position + 2], buffer),
|
|
3594
|
+
consequent: convertNode(buffer[position + 3], buffer),
|
|
3595
|
+
alternate: convertNode(buffer[position + 4], buffer)
|
|
3596
|
+
};
|
|
3597
|
+
},
|
|
3598
|
+
function continueStatement(position, buffer) {
|
|
3599
|
+
const labelPosition = buffer[position + 2];
|
|
3600
|
+
return {
|
|
3601
|
+
type: 'ContinueStatement',
|
|
3602
|
+
start: buffer[position],
|
|
3603
|
+
end: buffer[position + 1],
|
|
3604
|
+
label: labelPosition === 0 ? null : convertNode(labelPosition, buffer)
|
|
3605
|
+
};
|
|
3606
|
+
},
|
|
3607
|
+
function debuggerStatement(position, buffer) {
|
|
3608
|
+
return {
|
|
3609
|
+
type: 'DebuggerStatement',
|
|
3610
|
+
start: buffer[position],
|
|
3611
|
+
end: buffer[position + 1]
|
|
3612
|
+
};
|
|
3613
|
+
},
|
|
3614
|
+
function decorator(position, buffer) {
|
|
3615
|
+
return {
|
|
3616
|
+
type: 'Decorator',
|
|
3617
|
+
start: buffer[position],
|
|
3618
|
+
end: buffer[position + 1],
|
|
3619
|
+
expression: convertNode(buffer[position + 2], buffer)
|
|
3620
|
+
};
|
|
3621
|
+
},
|
|
3622
|
+
function directive(position, buffer) {
|
|
3623
|
+
return {
|
|
3624
|
+
type: 'ExpressionStatement',
|
|
3625
|
+
start: buffer[position],
|
|
3626
|
+
end: buffer[position + 1],
|
|
3627
|
+
directive: buffer.convertString(buffer[position + 2]),
|
|
3628
|
+
expression: convertNode(buffer[position + 3], buffer)
|
|
3629
|
+
};
|
|
3630
|
+
},
|
|
3631
|
+
function doWhileStatement(position, buffer) {
|
|
3632
|
+
return {
|
|
3633
|
+
type: 'DoWhileStatement',
|
|
3634
|
+
start: buffer[position],
|
|
3635
|
+
end: buffer[position + 1],
|
|
3636
|
+
body: convertNode(buffer[position + 2], buffer),
|
|
3637
|
+
test: convertNode(buffer[position + 3], buffer)
|
|
3638
|
+
};
|
|
3639
|
+
},
|
|
3640
|
+
function emptyStatement(position, buffer) {
|
|
3641
|
+
return {
|
|
3642
|
+
type: 'EmptyStatement',
|
|
3643
|
+
start: buffer[position],
|
|
3644
|
+
end: buffer[position + 1]
|
|
3645
|
+
};
|
|
3646
|
+
},
|
|
3647
|
+
function exportAllDeclaration(position, buffer) {
|
|
3648
|
+
const exportedPosition = buffer[position + 2];
|
|
3649
|
+
return {
|
|
3650
|
+
type: 'ExportAllDeclaration',
|
|
3651
|
+
start: buffer[position],
|
|
3652
|
+
end: buffer[position + 1],
|
|
3653
|
+
exported: exportedPosition === 0 ? null : convertNode(exportedPosition, buffer),
|
|
3654
|
+
source: convertNode(buffer[position + 3], buffer),
|
|
3655
|
+
attributes: convertNodeList(buffer[position + 4], buffer)
|
|
3656
|
+
};
|
|
3657
|
+
},
|
|
3658
|
+
function exportDefaultDeclaration(position, buffer) {
|
|
3659
|
+
return {
|
|
3660
|
+
type: 'ExportDefaultDeclaration',
|
|
3661
|
+
start: buffer[position],
|
|
3662
|
+
end: buffer[position + 1],
|
|
3663
|
+
declaration: convertNode(buffer[position + 2], buffer)
|
|
3664
|
+
};
|
|
3665
|
+
},
|
|
3666
|
+
function exportNamedDeclaration(position, buffer) {
|
|
3667
|
+
const sourcePosition = buffer[position + 3];
|
|
3668
|
+
const declarationPosition = buffer[position + 5];
|
|
3669
|
+
return {
|
|
3670
|
+
type: 'ExportNamedDeclaration',
|
|
3671
|
+
start: buffer[position],
|
|
3672
|
+
end: buffer[position + 1],
|
|
3673
|
+
specifiers: convertNodeList(buffer[position + 2], buffer),
|
|
3674
|
+
source: sourcePosition === 0 ? null : convertNode(sourcePosition, buffer),
|
|
3675
|
+
attributes: convertNodeList(buffer[position + 4], buffer),
|
|
3676
|
+
declaration: declarationPosition === 0 ? null : convertNode(declarationPosition, buffer)
|
|
3677
|
+
};
|
|
3678
|
+
},
|
|
3679
|
+
function exportSpecifier(position, buffer) {
|
|
3680
|
+
const local = convertNode(buffer[position + 2], buffer);
|
|
3681
|
+
const exportedPosition = buffer[position + 3];
|
|
3682
|
+
return {
|
|
3683
|
+
type: 'ExportSpecifier',
|
|
3684
|
+
start: buffer[position],
|
|
3685
|
+
end: buffer[position + 1],
|
|
3686
|
+
local,
|
|
3687
|
+
exported: exportedPosition === 0 ? { ...local } : convertNode(exportedPosition, buffer)
|
|
3688
|
+
};
|
|
3689
|
+
},
|
|
3690
|
+
function expressionStatement(position, buffer) {
|
|
3691
|
+
return {
|
|
3692
|
+
type: 'ExpressionStatement',
|
|
3693
|
+
start: buffer[position],
|
|
3694
|
+
end: buffer[position + 1],
|
|
3695
|
+
expression: convertNode(buffer[position + 2], buffer)
|
|
3696
|
+
};
|
|
3697
|
+
},
|
|
3698
|
+
function forInStatement(position, buffer) {
|
|
3699
|
+
return {
|
|
3700
|
+
type: 'ForInStatement',
|
|
3701
|
+
start: buffer[position],
|
|
3702
|
+
end: buffer[position + 1],
|
|
3703
|
+
left: convertNode(buffer[position + 2], buffer),
|
|
3704
|
+
right: convertNode(buffer[position + 3], buffer),
|
|
3705
|
+
body: convertNode(buffer[position + 4], buffer)
|
|
3706
|
+
};
|
|
3707
|
+
},
|
|
3708
|
+
function forOfStatement(position, buffer) {
|
|
3709
|
+
const flags = buffer[position + 2];
|
|
3710
|
+
return {
|
|
3711
|
+
type: 'ForOfStatement',
|
|
3712
|
+
start: buffer[position],
|
|
3713
|
+
end: buffer[position + 1],
|
|
3714
|
+
await: (flags & 1) === 1,
|
|
3715
|
+
left: convertNode(buffer[position + 3], buffer),
|
|
3716
|
+
right: convertNode(buffer[position + 4], buffer),
|
|
3717
|
+
body: convertNode(buffer[position + 5], buffer)
|
|
3718
|
+
};
|
|
3719
|
+
},
|
|
3720
|
+
function forStatement(position, buffer) {
|
|
3721
|
+
const initPosition = buffer[position + 2];
|
|
3722
|
+
const testPosition = buffer[position + 3];
|
|
3723
|
+
const updatePosition = buffer[position + 4];
|
|
3724
|
+
return {
|
|
3725
|
+
type: 'ForStatement',
|
|
3726
|
+
start: buffer[position],
|
|
3727
|
+
end: buffer[position + 1],
|
|
3728
|
+
init: initPosition === 0 ? null : convertNode(initPosition, buffer),
|
|
3729
|
+
test: testPosition === 0 ? null : convertNode(testPosition, buffer),
|
|
3730
|
+
update: updatePosition === 0 ? null : convertNode(updatePosition, buffer),
|
|
3731
|
+
body: convertNode(buffer[position + 5], buffer)
|
|
3732
|
+
};
|
|
3733
|
+
},
|
|
3734
|
+
function functionDeclaration(position, buffer) {
|
|
3735
|
+
const flags = buffer[position + 2];
|
|
3736
|
+
const annotations = convertAnnotations(buffer[position + 3], buffer);
|
|
3737
|
+
const idPosition = buffer[position + 4];
|
|
3738
|
+
return {
|
|
3739
|
+
type: 'FunctionDeclaration',
|
|
3740
|
+
start: buffer[position],
|
|
3741
|
+
end: buffer[position + 1],
|
|
3742
|
+
async: (flags & 1) === 1,
|
|
3743
|
+
generator: (flags & 2) === 2,
|
|
3744
|
+
...(annotations.length > 0 ? { annotations } : {}),
|
|
3745
|
+
id: idPosition === 0 ? null : convertNode(idPosition, buffer),
|
|
3746
|
+
params: convertNodeList(buffer[position + 5], buffer),
|
|
3747
|
+
body: convertNode(buffer[position + 6], buffer),
|
|
3748
|
+
expression: false
|
|
3749
|
+
};
|
|
3750
|
+
},
|
|
3751
|
+
function functionExpression(position, buffer) {
|
|
3752
|
+
const flags = buffer[position + 2];
|
|
3753
|
+
const annotations = convertAnnotations(buffer[position + 3], buffer);
|
|
3754
|
+
const idPosition = buffer[position + 4];
|
|
3755
|
+
return {
|
|
3756
|
+
type: 'FunctionExpression',
|
|
3757
|
+
start: buffer[position],
|
|
3758
|
+
end: buffer[position + 1],
|
|
3759
|
+
async: (flags & 1) === 1,
|
|
3760
|
+
generator: (flags & 2) === 2,
|
|
3761
|
+
...(annotations.length > 0 ? { annotations } : {}),
|
|
3762
|
+
id: idPosition === 0 ? null : convertNode(idPosition, buffer),
|
|
3763
|
+
params: convertNodeList(buffer[position + 5], buffer),
|
|
3764
|
+
body: convertNode(buffer[position + 6], buffer),
|
|
3765
|
+
expression: false
|
|
3766
|
+
};
|
|
3767
|
+
},
|
|
3768
|
+
function identifier(position, buffer) {
|
|
3769
|
+
return {
|
|
3770
|
+
type: 'Identifier',
|
|
3771
|
+
start: buffer[position],
|
|
3772
|
+
end: buffer[position + 1],
|
|
3773
|
+
name: buffer.convertString(buffer[position + 2])
|
|
3774
|
+
};
|
|
3775
|
+
},
|
|
3776
|
+
function ifStatement(position, buffer) {
|
|
3777
|
+
const alternatePosition = buffer[position + 4];
|
|
3778
|
+
return {
|
|
3779
|
+
type: 'IfStatement',
|
|
3780
|
+
start: buffer[position],
|
|
3781
|
+
end: buffer[position + 1],
|
|
3782
|
+
test: convertNode(buffer[position + 2], buffer),
|
|
3783
|
+
consequent: convertNode(buffer[position + 3], buffer),
|
|
3784
|
+
alternate: alternatePosition === 0 ? null : convertNode(alternatePosition, buffer)
|
|
3785
|
+
};
|
|
3786
|
+
},
|
|
3787
|
+
function importAttribute(position, buffer) {
|
|
3788
|
+
return {
|
|
3789
|
+
type: 'ImportAttribute',
|
|
3790
|
+
start: buffer[position],
|
|
3791
|
+
end: buffer[position + 1],
|
|
3792
|
+
key: convertNode(buffer[position + 2], buffer),
|
|
3793
|
+
value: convertNode(buffer[position + 3], buffer)
|
|
3794
|
+
};
|
|
3795
|
+
},
|
|
3796
|
+
function importDeclaration(position, buffer) {
|
|
3797
|
+
const phasePosition = buffer[position + 5];
|
|
3798
|
+
return {
|
|
3799
|
+
type: 'ImportDeclaration',
|
|
3800
|
+
start: buffer[position],
|
|
3801
|
+
end: buffer[position + 1],
|
|
3802
|
+
specifiers: convertNodeList(buffer[position + 2], buffer),
|
|
3803
|
+
source: convertNode(buffer[position + 3], buffer),
|
|
3804
|
+
attributes: convertNodeList(buffer[position + 4], buffer),
|
|
3805
|
+
phase: phasePosition === 0
|
|
3806
|
+
? undefined
|
|
3807
|
+
: FIXED_STRINGS[buffer[position + 5]]
|
|
3808
|
+
};
|
|
3809
|
+
},
|
|
3810
|
+
function importDefaultSpecifier(position, buffer) {
|
|
3811
|
+
return {
|
|
3812
|
+
type: 'ImportDefaultSpecifier',
|
|
3813
|
+
start: buffer[position],
|
|
3814
|
+
end: buffer[position + 1],
|
|
3815
|
+
local: convertNode(buffer[position + 2], buffer)
|
|
3816
|
+
};
|
|
3817
|
+
},
|
|
3818
|
+
function importExpression(position, buffer) {
|
|
3819
|
+
const optionsPosition = buffer[position + 3];
|
|
3820
|
+
const phasePosition = buffer[position + 4];
|
|
3821
|
+
return {
|
|
3822
|
+
type: 'ImportExpression',
|
|
3823
|
+
start: buffer[position],
|
|
3824
|
+
end: buffer[position + 1],
|
|
3825
|
+
source: convertNode(buffer[position + 2], buffer),
|
|
3826
|
+
options: optionsPosition === 0 ? null : convertNode(optionsPosition, buffer),
|
|
3827
|
+
phase: phasePosition === 0
|
|
3828
|
+
? undefined
|
|
3829
|
+
: FIXED_STRINGS[buffer[position + 4]]
|
|
3830
|
+
};
|
|
3831
|
+
},
|
|
3832
|
+
function importNamespaceSpecifier(position, buffer) {
|
|
3833
|
+
return {
|
|
3834
|
+
type: 'ImportNamespaceSpecifier',
|
|
3835
|
+
start: buffer[position],
|
|
3836
|
+
end: buffer[position + 1],
|
|
3837
|
+
local: convertNode(buffer[position + 2], buffer)
|
|
3838
|
+
};
|
|
3839
|
+
},
|
|
3840
|
+
function importSpecifier(position, buffer) {
|
|
3841
|
+
const importedPosition = buffer[position + 2];
|
|
3842
|
+
const local = convertNode(buffer[position + 3], buffer);
|
|
3843
|
+
return {
|
|
3844
|
+
type: 'ImportSpecifier',
|
|
3845
|
+
start: buffer[position],
|
|
3846
|
+
end: buffer[position + 1],
|
|
3847
|
+
imported: importedPosition === 0 ? { ...local } : convertNode(importedPosition, buffer),
|
|
3848
|
+
local
|
|
3849
|
+
};
|
|
3850
|
+
},
|
|
3851
|
+
function jsxAttribute(position, buffer) {
|
|
3852
|
+
const valuePosition = buffer[position + 3];
|
|
3853
|
+
return {
|
|
3854
|
+
type: 'JSXAttribute',
|
|
3855
|
+
start: buffer[position],
|
|
3856
|
+
end: buffer[position + 1],
|
|
3857
|
+
name: convertNode(buffer[position + 2], buffer),
|
|
3858
|
+
value: valuePosition === 0 ? null : convertNode(valuePosition, buffer)
|
|
3859
|
+
};
|
|
3860
|
+
},
|
|
3861
|
+
function jsxClosingElement(position, buffer) {
|
|
3862
|
+
return {
|
|
3863
|
+
type: 'JSXClosingElement',
|
|
3864
|
+
start: buffer[position],
|
|
3865
|
+
end: buffer[position + 1],
|
|
3866
|
+
name: convertNode(buffer[position + 2], buffer)
|
|
3867
|
+
};
|
|
3868
|
+
},
|
|
3869
|
+
function jsxClosingFragment(position, buffer) {
|
|
3870
|
+
return {
|
|
3871
|
+
type: 'JSXClosingFragment',
|
|
3872
|
+
start: buffer[position],
|
|
3873
|
+
end: buffer[position + 1]
|
|
3874
|
+
};
|
|
3875
|
+
},
|
|
3876
|
+
function jsxElement(position, buffer) {
|
|
3877
|
+
const closingElementPosition = buffer[position + 4];
|
|
3878
|
+
return {
|
|
3879
|
+
type: 'JSXElement',
|
|
3880
|
+
start: buffer[position],
|
|
3881
|
+
end: buffer[position + 1],
|
|
3882
|
+
openingElement: convertNode(buffer[position + 2], buffer),
|
|
3883
|
+
children: convertNodeList(buffer[position + 3], buffer),
|
|
3884
|
+
closingElement: closingElementPosition === 0 ? null : convertNode(closingElementPosition, buffer)
|
|
3885
|
+
};
|
|
3886
|
+
},
|
|
3887
|
+
function jsxEmptyExpression(position, buffer) {
|
|
3888
|
+
return {
|
|
3889
|
+
type: 'JSXEmptyExpression',
|
|
3890
|
+
start: buffer[position],
|
|
3891
|
+
end: buffer[position + 1]
|
|
3892
|
+
};
|
|
3893
|
+
},
|
|
3894
|
+
function jsxExpressionContainer(position, buffer) {
|
|
3895
|
+
return {
|
|
3896
|
+
type: 'JSXExpressionContainer',
|
|
3897
|
+
start: buffer[position],
|
|
3898
|
+
end: buffer[position + 1],
|
|
3899
|
+
expression: convertNode(buffer[position + 2], buffer)
|
|
3900
|
+
};
|
|
3901
|
+
},
|
|
3902
|
+
function jsxFragment(position, buffer) {
|
|
3903
|
+
return {
|
|
3904
|
+
type: 'JSXFragment',
|
|
3905
|
+
start: buffer[position],
|
|
3906
|
+
end: buffer[position + 1],
|
|
3907
|
+
openingFragment: convertNode(buffer[position + 2], buffer),
|
|
3908
|
+
children: convertNodeList(buffer[position + 3], buffer),
|
|
3909
|
+
closingFragment: convertNode(buffer[position + 4], buffer)
|
|
3910
|
+
};
|
|
3911
|
+
},
|
|
3912
|
+
function jsxIdentifier(position, buffer) {
|
|
3913
|
+
return {
|
|
3914
|
+
type: 'JSXIdentifier',
|
|
3915
|
+
start: buffer[position],
|
|
3916
|
+
end: buffer[position + 1],
|
|
3917
|
+
name: buffer.convertString(buffer[position + 2])
|
|
3918
|
+
};
|
|
3919
|
+
},
|
|
3920
|
+
function jsxMemberExpression(position, buffer) {
|
|
3921
|
+
return {
|
|
3922
|
+
type: 'JSXMemberExpression',
|
|
3923
|
+
start: buffer[position],
|
|
3924
|
+
end: buffer[position + 1],
|
|
3925
|
+
object: convertNode(buffer[position + 2], buffer),
|
|
3926
|
+
property: convertNode(buffer[position + 3], buffer)
|
|
3927
|
+
};
|
|
3928
|
+
},
|
|
3929
|
+
function jsxNamespacedName(position, buffer) {
|
|
3930
|
+
return {
|
|
3931
|
+
type: 'JSXNamespacedName',
|
|
3932
|
+
start: buffer[position],
|
|
3933
|
+
end: buffer[position + 1],
|
|
3934
|
+
namespace: convertNode(buffer[position + 2], buffer),
|
|
3935
|
+
name: convertNode(buffer[position + 3], buffer)
|
|
3936
|
+
};
|
|
3937
|
+
},
|
|
3938
|
+
function jsxOpeningElement(position, buffer) {
|
|
3939
|
+
const flags = buffer[position + 2];
|
|
3940
|
+
return {
|
|
3941
|
+
type: 'JSXOpeningElement',
|
|
3942
|
+
start: buffer[position],
|
|
3943
|
+
end: buffer[position + 1],
|
|
3944
|
+
selfClosing: (flags & 1) === 1,
|
|
3945
|
+
name: convertNode(buffer[position + 3], buffer),
|
|
3946
|
+
attributes: convertNodeList(buffer[position + 4], buffer)
|
|
3947
|
+
};
|
|
3948
|
+
},
|
|
3949
|
+
function jsxOpeningFragment(position, buffer) {
|
|
3950
|
+
return {
|
|
3951
|
+
type: 'JSXOpeningFragment',
|
|
3952
|
+
start: buffer[position],
|
|
3953
|
+
end: buffer[position + 1],
|
|
3954
|
+
attributes: [],
|
|
3955
|
+
selfClosing: false
|
|
3956
|
+
};
|
|
3957
|
+
},
|
|
3958
|
+
function jsxSpreadAttribute(position, buffer) {
|
|
3959
|
+
return {
|
|
3960
|
+
type: 'JSXSpreadAttribute',
|
|
3961
|
+
start: buffer[position],
|
|
3962
|
+
end: buffer[position + 1],
|
|
3963
|
+
argument: convertNode(buffer[position + 2], buffer)
|
|
3964
|
+
};
|
|
3965
|
+
},
|
|
3966
|
+
function jsxSpreadChild(position, buffer) {
|
|
3967
|
+
return {
|
|
3968
|
+
type: 'JSXSpreadChild',
|
|
3969
|
+
start: buffer[position],
|
|
3970
|
+
end: buffer[position + 1],
|
|
3971
|
+
expression: convertNode(buffer[position + 2], buffer)
|
|
3972
|
+
};
|
|
3973
|
+
},
|
|
3974
|
+
function jsxText(position, buffer) {
|
|
3975
|
+
return {
|
|
3976
|
+
type: 'JSXText',
|
|
3977
|
+
start: buffer[position],
|
|
3978
|
+
end: buffer[position + 1],
|
|
3979
|
+
value: buffer.convertString(buffer[position + 2]),
|
|
3980
|
+
raw: buffer.convertString(buffer[position + 3])
|
|
3981
|
+
};
|
|
3982
|
+
},
|
|
3983
|
+
function labeledStatement(position, buffer) {
|
|
3984
|
+
return {
|
|
3985
|
+
type: 'LabeledStatement',
|
|
3986
|
+
start: buffer[position],
|
|
3987
|
+
end: buffer[position + 1],
|
|
3988
|
+
label: convertNode(buffer[position + 2], buffer),
|
|
3989
|
+
body: convertNode(buffer[position + 3], buffer)
|
|
3990
|
+
};
|
|
3991
|
+
},
|
|
3992
|
+
function literalBigInt(position, buffer) {
|
|
3993
|
+
const bigint = buffer.convertString(buffer[position + 2]);
|
|
3994
|
+
return {
|
|
3995
|
+
type: 'Literal',
|
|
3996
|
+
start: buffer[position],
|
|
3997
|
+
end: buffer[position + 1],
|
|
3998
|
+
bigint,
|
|
3999
|
+
raw: buffer.convertString(buffer[position + 3]),
|
|
4000
|
+
value: BigInt(bigint)
|
|
4001
|
+
};
|
|
4002
|
+
},
|
|
4003
|
+
function literalBoolean(position, buffer) {
|
|
4004
|
+
const flags = buffer[position + 2];
|
|
4005
|
+
const value = (flags & 1) === 1;
|
|
4006
|
+
return {
|
|
4007
|
+
type: 'Literal',
|
|
4008
|
+
start: buffer[position],
|
|
4009
|
+
end: buffer[position + 1],
|
|
4010
|
+
value,
|
|
4011
|
+
raw: value ? 'true' : 'false'
|
|
4012
|
+
};
|
|
4013
|
+
},
|
|
4014
|
+
function literalNull(position, buffer) {
|
|
4015
|
+
return {
|
|
4016
|
+
type: 'Literal',
|
|
4017
|
+
start: buffer[position],
|
|
4018
|
+
end: buffer[position + 1],
|
|
4019
|
+
raw: 'null',
|
|
4020
|
+
value: null
|
|
4021
|
+
};
|
|
4022
|
+
},
|
|
4023
|
+
function literalNumber(position, buffer) {
|
|
4024
|
+
const rawPosition = buffer[position + 2];
|
|
4025
|
+
return {
|
|
4026
|
+
type: 'Literal',
|
|
4027
|
+
start: buffer[position],
|
|
4028
|
+
end: buffer[position + 1],
|
|
4029
|
+
raw: rawPosition === 0 ? undefined : buffer.convertString(rawPosition),
|
|
4030
|
+
value: buffer.convertFloat64(position + 3)
|
|
4031
|
+
};
|
|
4032
|
+
},
|
|
4033
|
+
function literalRegExp(position, buffer) {
|
|
4034
|
+
const flags = buffer.convertString(buffer[position + 2]);
|
|
4035
|
+
const pattern = buffer.convertString(buffer[position + 3]);
|
|
4036
|
+
return {
|
|
4037
|
+
type: 'Literal',
|
|
4038
|
+
start: buffer[position],
|
|
4039
|
+
end: buffer[position + 1],
|
|
4040
|
+
raw: `/${pattern}/${flags}`,
|
|
4041
|
+
regex: { flags, pattern },
|
|
4042
|
+
value: new RegExp(pattern, flags)
|
|
4043
|
+
};
|
|
4044
|
+
},
|
|
4045
|
+
function literalString(position, buffer) {
|
|
4046
|
+
const rawPosition = buffer[position + 3];
|
|
4047
|
+
return {
|
|
4048
|
+
type: 'Literal',
|
|
4049
|
+
start: buffer[position],
|
|
4050
|
+
end: buffer[position + 1],
|
|
4051
|
+
value: buffer.convertString(buffer[position + 2]),
|
|
4052
|
+
raw: rawPosition === 0 ? undefined : buffer.convertString(rawPosition)
|
|
4053
|
+
};
|
|
4054
|
+
},
|
|
4055
|
+
function logicalExpression(position, buffer) {
|
|
4056
|
+
return {
|
|
4057
|
+
type: 'LogicalExpression',
|
|
4058
|
+
start: buffer[position],
|
|
4059
|
+
end: buffer[position + 1],
|
|
4060
|
+
operator: FIXED_STRINGS[buffer[position + 2]],
|
|
4061
|
+
left: convertNode(buffer[position + 3], buffer),
|
|
4062
|
+
right: convertNode(buffer[position + 4], buffer)
|
|
1862
4063
|
};
|
|
1863
4064
|
},
|
|
1864
4065
|
function memberExpression(position, buffer) {
|
|
@@ -1902,7 +4103,7 @@ const nodeConverters = [
|
|
|
1902
4103
|
type: 'NewExpression',
|
|
1903
4104
|
start: buffer[position],
|
|
1904
4105
|
end: buffer[position + 1],
|
|
1905
|
-
...(annotations.length > 0 ? {
|
|
4106
|
+
...(annotations.length > 0 ? { annotations } : {}),
|
|
1906
4107
|
callee: convertNode(buffer[position + 3], buffer),
|
|
1907
4108
|
arguments: convertNodeList(buffer[position + 4], buffer)
|
|
1908
4109
|
};
|
|
@@ -1938,7 +4139,7 @@ const nodeConverters = [
|
|
|
1938
4139
|
start: buffer[position],
|
|
1939
4140
|
end: buffer[position + 1],
|
|
1940
4141
|
body: convertNodeList(buffer[position + 2], buffer),
|
|
1941
|
-
...(invalidAnnotations.length > 0 ? {
|
|
4142
|
+
...(invalidAnnotations.length > 0 ? { invalidAnnotations } : {}),
|
|
1942
4143
|
sourceType: 'module'
|
|
1943
4144
|
};
|
|
1944
4145
|
},
|
|
@@ -2051,7 +4252,7 @@ const nodeConverters = [
|
|
|
2051
4252
|
function templateElement(position, buffer) {
|
|
2052
4253
|
const flags = buffer[position + 2];
|
|
2053
4254
|
const cookedPosition = buffer[position + 3];
|
|
2054
|
-
const cooked = cookedPosition === 0 ?
|
|
4255
|
+
const cooked = cookedPosition === 0 ? undefined : buffer.convertString(cookedPosition);
|
|
2055
4256
|
const raw = buffer.convertString(buffer[position + 4]);
|
|
2056
4257
|
return {
|
|
2057
4258
|
type: 'TemplateElement',
|
|
@@ -2180,31 +4381,1161 @@ function convertNodeList(position, buffer) {
|
|
|
2180
4381
|
return list;
|
|
2181
4382
|
}
|
|
2182
4383
|
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
4384
|
+
// This file is generated by scripts/generate-string-constants.ts.
|
|
4385
|
+
// Do not edit this file directly.
|
|
4386
|
+
const FIXED_STRING_INDICES = {
|
|
4387
|
+
'!': 10,
|
|
4388
|
+
'!=': 18,
|
|
4389
|
+
'!==': 20,
|
|
4390
|
+
'%': 30,
|
|
4391
|
+
'%=': 45,
|
|
4392
|
+
'&': 33,
|
|
4393
|
+
'&&': 35,
|
|
4394
|
+
'&&=': 53,
|
|
4395
|
+
'&=': 51,
|
|
4396
|
+
'*': 28,
|
|
4397
|
+
'**': 38,
|
|
4398
|
+
'**=': 52,
|
|
4399
|
+
'*=': 43,
|
|
4400
|
+
'+': 9,
|
|
4401
|
+
'++': 15,
|
|
4402
|
+
'+=': 41,
|
|
4403
|
+
'-': 8,
|
|
4404
|
+
'--': 16,
|
|
4405
|
+
'-=': 42,
|
|
4406
|
+
'/': 29,
|
|
4407
|
+
'/=': 44,
|
|
4408
|
+
'<': 21,
|
|
4409
|
+
'<<': 25,
|
|
4410
|
+
'<<=': 46,
|
|
4411
|
+
'<=': 22,
|
|
4412
|
+
'=': 40,
|
|
4413
|
+
'==': 17,
|
|
4414
|
+
'===': 19,
|
|
4415
|
+
'>': 23,
|
|
4416
|
+
'>=': 24,
|
|
4417
|
+
'>>': 26,
|
|
4418
|
+
'>>=': 47,
|
|
4419
|
+
'>>>': 27,
|
|
4420
|
+
'>>>=': 48,
|
|
4421
|
+
'??': 39,
|
|
4422
|
+
'??=': 55,
|
|
4423
|
+
'^': 32,
|
|
4424
|
+
'^=': 50,
|
|
4425
|
+
'await using': 60,
|
|
4426
|
+
const: 2,
|
|
4427
|
+
constructor: 6,
|
|
4428
|
+
defer: 62,
|
|
4429
|
+
delete: 14,
|
|
4430
|
+
get: 4,
|
|
4431
|
+
in: 36,
|
|
4432
|
+
init: 3,
|
|
4433
|
+
instanceof: 37,
|
|
4434
|
+
let: 1,
|
|
4435
|
+
method: 7,
|
|
4436
|
+
noSideEffects: 57,
|
|
4437
|
+
pure: 56,
|
|
4438
|
+
set: 5,
|
|
4439
|
+
source: 61,
|
|
4440
|
+
sourcemap: 58,
|
|
4441
|
+
typeof: 12,
|
|
4442
|
+
using: 59,
|
|
4443
|
+
var: 0,
|
|
4444
|
+
void: 13,
|
|
4445
|
+
'|': 31,
|
|
4446
|
+
'|=': 49,
|
|
4447
|
+
'||': 34,
|
|
4448
|
+
'||=': 54,
|
|
4449
|
+
'~': 11
|
|
4450
|
+
};
|
|
4451
|
+
|
|
4452
|
+
// This file is generated by scripts/generate-ast-to-buffer.ts.
|
|
4453
|
+
// Do not edit this file directly.
|
|
4454
|
+
const INITIAL_BUFFER_SIZE = 2 ** 16; // 64KB
|
|
4455
|
+
const serializeAst = node => {
|
|
4456
|
+
const initialBuffer = (typeof Buffer === 'undefined' ? createAstBufferUint8 : createAstBufferNode)(INITIAL_BUFFER_SIZE);
|
|
4457
|
+
const buffer = (nodeSerializers[node.type] || error(logUnknownNodeType(node.type, null, '')))(node, initialBuffer);
|
|
4458
|
+
return buffer.toOutput();
|
|
4459
|
+
};
|
|
4460
|
+
const serializeExpressionStatementNode = (node, buffer) => {
|
|
4461
|
+
return 'directive' in node
|
|
4462
|
+
? serializeDirective(node, buffer)
|
|
4463
|
+
: serializeExpressionStatement(node, buffer);
|
|
4464
|
+
};
|
|
4465
|
+
const serializeLiteralNode = (node, buffer) => {
|
|
4466
|
+
switch (typeof node.value) {
|
|
4467
|
+
case 'object':
|
|
4468
|
+
if (node.value === null) {
|
|
4469
|
+
return serializeLiteralNull(node, buffer);
|
|
4470
|
+
}
|
|
4471
|
+
return serializeLiteralRegExp(node, buffer);
|
|
4472
|
+
case 'boolean':
|
|
4473
|
+
return serializeLiteralBoolean(node, buffer);
|
|
4474
|
+
case 'number':
|
|
4475
|
+
return serializeLiteralNumber(node, buffer);
|
|
4476
|
+
case 'string':
|
|
4477
|
+
return serializeLiteralString(node, buffer);
|
|
4478
|
+
case 'bigint':
|
|
4479
|
+
return serializeLiteralBigInt(node, buffer);
|
|
4480
|
+
default: {
|
|
4481
|
+
/* istanbul ignore next */
|
|
4482
|
+
throw new Error(`Unexpected node value type for Literal: ${typeof node.value}`);
|
|
4483
|
+
}
|
|
2192
4484
|
}
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
4485
|
+
};
|
|
4486
|
+
const nodeSerializers = {
|
|
4487
|
+
ArrayExpression: (node, buffer) => {
|
|
4488
|
+
const nodePosition = buffer.position;
|
|
4489
|
+
buffer = buffer.reserve(4);
|
|
4490
|
+
buffer[nodePosition] = 2;
|
|
4491
|
+
buffer[nodePosition + 1] = node.start;
|
|
4492
|
+
buffer[nodePosition + 2] = node.end;
|
|
4493
|
+
buffer = serializeNodeList('elements', node, buffer, nodePosition + 3);
|
|
4494
|
+
return buffer;
|
|
4495
|
+
},
|
|
4496
|
+
ArrayPattern: (node, buffer) => {
|
|
4497
|
+
const nodePosition = buffer.position;
|
|
4498
|
+
buffer = buffer.reserve(4);
|
|
4499
|
+
buffer[nodePosition] = 3;
|
|
4500
|
+
buffer[nodePosition + 1] = node.start;
|
|
4501
|
+
buffer[nodePosition + 2] = node.end;
|
|
4502
|
+
buffer = serializeNodeList('elements', node, buffer, nodePosition + 3);
|
|
4503
|
+
return buffer;
|
|
4504
|
+
},
|
|
4505
|
+
ArrowFunctionExpression: (node, buffer) => {
|
|
4506
|
+
const nodePosition = buffer.position;
|
|
4507
|
+
buffer = buffer.reserve(8);
|
|
4508
|
+
buffer[nodePosition] = 4;
|
|
4509
|
+
buffer[nodePosition + 1] = node.start;
|
|
4510
|
+
buffer[nodePosition + 2] = node.end;
|
|
4511
|
+
buffer[nodePosition + 3] =
|
|
4512
|
+
(node.async << 0) | (node.expression << 1) | (node.generator << 2);
|
|
4513
|
+
buffer = serializeAnnotations(node.annotations, buffer, nodePosition + 4);
|
|
4514
|
+
buffer = serializeNodeList('params', node, buffer, nodePosition + 5);
|
|
4515
|
+
buffer = serializeNode('body', node, buffer, nodePosition + 6);
|
|
4516
|
+
return buffer;
|
|
4517
|
+
},
|
|
4518
|
+
AssignmentExpression: (node, buffer) => {
|
|
4519
|
+
const nodePosition = buffer.position;
|
|
4520
|
+
buffer = buffer.reserve(6);
|
|
4521
|
+
buffer[nodePosition] = 5;
|
|
4522
|
+
buffer[nodePosition + 1] = node.start;
|
|
4523
|
+
buffer[nodePosition + 2] = node.end;
|
|
4524
|
+
buffer[nodePosition + 3] = FIXED_STRING_INDICES[node.operator];
|
|
4525
|
+
buffer = serializeNode('left', node, buffer, nodePosition + 4);
|
|
4526
|
+
buffer = serializeNode('right', node, buffer, nodePosition + 5);
|
|
4527
|
+
return buffer;
|
|
4528
|
+
},
|
|
4529
|
+
AssignmentPattern: (node, buffer) => {
|
|
4530
|
+
const nodePosition = buffer.position;
|
|
4531
|
+
buffer = buffer.reserve(5);
|
|
4532
|
+
buffer[nodePosition] = 6;
|
|
4533
|
+
buffer[nodePosition + 1] = node.start;
|
|
4534
|
+
buffer[nodePosition + 2] = node.end;
|
|
4535
|
+
buffer = serializeNode('left', node, buffer, nodePosition + 3);
|
|
4536
|
+
buffer = serializeNode('right', node, buffer, nodePosition + 4);
|
|
4537
|
+
return buffer;
|
|
4538
|
+
},
|
|
4539
|
+
AwaitExpression: (node, buffer) => {
|
|
4540
|
+
const nodePosition = buffer.position;
|
|
4541
|
+
buffer = buffer.reserve(4);
|
|
4542
|
+
buffer[nodePosition] = 7;
|
|
4543
|
+
buffer[nodePosition + 1] = node.start;
|
|
4544
|
+
buffer[nodePosition + 2] = node.end;
|
|
4545
|
+
buffer = serializeNode('argument', node, buffer, nodePosition + 3);
|
|
4546
|
+
return buffer;
|
|
4547
|
+
},
|
|
4548
|
+
BinaryExpression: (node, buffer) => {
|
|
4549
|
+
const nodePosition = buffer.position;
|
|
4550
|
+
buffer = buffer.reserve(6);
|
|
4551
|
+
buffer[nodePosition] = 8;
|
|
4552
|
+
buffer[nodePosition + 1] = node.start;
|
|
4553
|
+
buffer[nodePosition + 2] = node.end;
|
|
4554
|
+
buffer[nodePosition + 3] = FIXED_STRING_INDICES[node.operator];
|
|
4555
|
+
buffer = serializeNode('left', node, buffer, nodePosition + 4);
|
|
4556
|
+
buffer = serializeNode('right', node, buffer, nodePosition + 5);
|
|
4557
|
+
return buffer;
|
|
4558
|
+
},
|
|
4559
|
+
BlockStatement: (node, buffer) => {
|
|
4560
|
+
const nodePosition = buffer.position;
|
|
4561
|
+
buffer = buffer.reserve(5);
|
|
4562
|
+
buffer[nodePosition] = 9;
|
|
4563
|
+
buffer[nodePosition + 1] = node.start;
|
|
4564
|
+
buffer[nodePosition + 2] = node.end;
|
|
4565
|
+
buffer = serializeNodeList('body', node, buffer, nodePosition + 3);
|
|
4566
|
+
return buffer;
|
|
4567
|
+
},
|
|
4568
|
+
BreakStatement: (node, buffer) => {
|
|
4569
|
+
const nodePosition = buffer.position;
|
|
4570
|
+
buffer = buffer.reserve(4);
|
|
4571
|
+
buffer[nodePosition] = 10;
|
|
4572
|
+
buffer[nodePosition + 1] = node.start;
|
|
4573
|
+
buffer[nodePosition + 2] = node.end;
|
|
4574
|
+
if (node.label != null)
|
|
4575
|
+
buffer = serializeNode('label', node, buffer, nodePosition + 3);
|
|
4576
|
+
return buffer;
|
|
4577
|
+
},
|
|
4578
|
+
CallExpression: (node, buffer) => {
|
|
4579
|
+
const nodePosition = buffer.position;
|
|
4580
|
+
buffer = buffer.reserve(7);
|
|
4581
|
+
buffer[nodePosition] = 11;
|
|
4582
|
+
buffer[nodePosition + 1] = node.start;
|
|
4583
|
+
buffer[nodePosition + 2] = node.end;
|
|
4584
|
+
buffer[nodePosition + 3] = node.optional << 0;
|
|
4585
|
+
buffer = serializeAnnotations(node.annotations, buffer, nodePosition + 4);
|
|
4586
|
+
buffer = serializeNode('callee', node, buffer, nodePosition + 5);
|
|
4587
|
+
buffer = serializeNodeList('arguments', node, buffer, nodePosition + 6);
|
|
4588
|
+
return buffer;
|
|
4589
|
+
},
|
|
4590
|
+
CatchClause: (node, buffer) => {
|
|
4591
|
+
const nodePosition = buffer.position;
|
|
4592
|
+
buffer = buffer.reserve(6);
|
|
4593
|
+
buffer[nodePosition] = 12;
|
|
4594
|
+
buffer[nodePosition + 1] = node.start;
|
|
4595
|
+
buffer[nodePosition + 2] = node.end;
|
|
4596
|
+
if (node.param != null)
|
|
4597
|
+
buffer = serializeNode('param', node, buffer, nodePosition + 3);
|
|
4598
|
+
buffer = serializeNode('body', node, buffer, nodePosition + 4);
|
|
4599
|
+
return buffer;
|
|
4600
|
+
},
|
|
4601
|
+
ChainExpression: (node, buffer) => {
|
|
4602
|
+
const nodePosition = buffer.position;
|
|
4603
|
+
buffer = buffer.reserve(4);
|
|
4604
|
+
buffer[nodePosition] = 13;
|
|
4605
|
+
buffer[nodePosition + 1] = node.start;
|
|
4606
|
+
buffer[nodePosition + 2] = node.end;
|
|
4607
|
+
buffer = serializeNode('expression', node, buffer, nodePosition + 3);
|
|
4608
|
+
return buffer;
|
|
4609
|
+
},
|
|
4610
|
+
ClassBody: (node, buffer) => {
|
|
4611
|
+
const nodePosition = buffer.position;
|
|
4612
|
+
buffer = buffer.reserve(4);
|
|
4613
|
+
buffer[nodePosition] = 14;
|
|
4614
|
+
buffer[nodePosition + 1] = node.start;
|
|
4615
|
+
buffer[nodePosition + 2] = node.end;
|
|
4616
|
+
buffer = serializeNodeList('body', node, buffer, nodePosition + 3);
|
|
4617
|
+
return buffer;
|
|
4618
|
+
},
|
|
4619
|
+
ClassDeclaration: (node, buffer) => {
|
|
4620
|
+
const nodePosition = buffer.position;
|
|
4621
|
+
buffer = buffer.reserve(8);
|
|
4622
|
+
buffer[nodePosition] = 15;
|
|
4623
|
+
buffer[nodePosition + 1] = node.start;
|
|
4624
|
+
buffer[nodePosition + 2] = node.end;
|
|
4625
|
+
buffer = serializeNodeList('decorators', node, buffer, nodePosition + 3);
|
|
4626
|
+
if (node.id != null)
|
|
4627
|
+
buffer = serializeNode('id', node, buffer, nodePosition + 4);
|
|
4628
|
+
if (node.superClass != null)
|
|
4629
|
+
buffer = serializeNode('superClass', node, buffer, nodePosition + 5);
|
|
4630
|
+
buffer = serializeNode('body', node, buffer, nodePosition + 6);
|
|
4631
|
+
return buffer;
|
|
4632
|
+
},
|
|
4633
|
+
ClassExpression: (node, buffer) => {
|
|
4634
|
+
const nodePosition = buffer.position;
|
|
4635
|
+
buffer = buffer.reserve(8);
|
|
4636
|
+
buffer[nodePosition] = 16;
|
|
4637
|
+
buffer[nodePosition + 1] = node.start;
|
|
4638
|
+
buffer[nodePosition + 2] = node.end;
|
|
4639
|
+
buffer = serializeNodeList('decorators', node, buffer, nodePosition + 3);
|
|
4640
|
+
if (node.id != null)
|
|
4641
|
+
buffer = serializeNode('id', node, buffer, nodePosition + 4);
|
|
4642
|
+
if (node.superClass != null)
|
|
4643
|
+
buffer = serializeNode('superClass', node, buffer, nodePosition + 5);
|
|
4644
|
+
buffer = serializeNode('body', node, buffer, nodePosition + 6);
|
|
4645
|
+
return buffer;
|
|
4646
|
+
},
|
|
4647
|
+
ConditionalExpression: (node, buffer) => {
|
|
4648
|
+
const nodePosition = buffer.position;
|
|
4649
|
+
buffer = buffer.reserve(6);
|
|
4650
|
+
buffer[nodePosition] = 17;
|
|
4651
|
+
buffer[nodePosition + 1] = node.start;
|
|
4652
|
+
buffer[nodePosition + 2] = node.end;
|
|
4653
|
+
buffer = serializeNode('test', node, buffer, nodePosition + 3);
|
|
4654
|
+
buffer = serializeNode('consequent', node, buffer, nodePosition + 4);
|
|
4655
|
+
buffer = serializeNode('alternate', node, buffer, nodePosition + 5);
|
|
4656
|
+
return buffer;
|
|
4657
|
+
},
|
|
4658
|
+
ContinueStatement: (node, buffer) => {
|
|
4659
|
+
const nodePosition = buffer.position;
|
|
4660
|
+
buffer = buffer.reserve(4);
|
|
4661
|
+
buffer[nodePosition] = 18;
|
|
4662
|
+
buffer[nodePosition + 1] = node.start;
|
|
4663
|
+
buffer[nodePosition + 2] = node.end;
|
|
4664
|
+
if (node.label != null)
|
|
4665
|
+
buffer = serializeNode('label', node, buffer, nodePosition + 3);
|
|
4666
|
+
return buffer;
|
|
4667
|
+
},
|
|
4668
|
+
DebuggerStatement: (node, buffer) => {
|
|
4669
|
+
const nodePosition = buffer.position;
|
|
4670
|
+
buffer = buffer.reserve(3);
|
|
4671
|
+
buffer[nodePosition] = 19;
|
|
4672
|
+
buffer[nodePosition + 1] = node.start;
|
|
4673
|
+
buffer[nodePosition + 2] = node.end;
|
|
4674
|
+
return buffer;
|
|
4675
|
+
},
|
|
4676
|
+
Decorator: (node, buffer) => {
|
|
4677
|
+
const nodePosition = buffer.position;
|
|
4678
|
+
buffer = buffer.reserve(4);
|
|
4679
|
+
buffer[nodePosition] = 20;
|
|
4680
|
+
buffer[nodePosition + 1] = node.start;
|
|
4681
|
+
buffer[nodePosition + 2] = node.end;
|
|
4682
|
+
buffer = serializeNode('expression', node, buffer, nodePosition + 3);
|
|
4683
|
+
return buffer;
|
|
4684
|
+
},
|
|
4685
|
+
DoWhileStatement: (node, buffer) => {
|
|
4686
|
+
const nodePosition = buffer.position;
|
|
4687
|
+
buffer = buffer.reserve(5);
|
|
4688
|
+
buffer[nodePosition] = 22;
|
|
4689
|
+
buffer[nodePosition + 1] = node.start;
|
|
4690
|
+
buffer[nodePosition + 2] = node.end;
|
|
4691
|
+
buffer = serializeNode('body', node, buffer, nodePosition + 3);
|
|
4692
|
+
buffer = serializeNode('test', node, buffer, nodePosition + 4);
|
|
4693
|
+
return buffer;
|
|
4694
|
+
},
|
|
4695
|
+
EmptyStatement: (node, buffer) => {
|
|
4696
|
+
const nodePosition = buffer.position;
|
|
4697
|
+
buffer = buffer.reserve(3);
|
|
4698
|
+
buffer[nodePosition] = 23;
|
|
4699
|
+
buffer[nodePosition + 1] = node.start;
|
|
4700
|
+
buffer[nodePosition + 2] = node.end;
|
|
4701
|
+
return buffer;
|
|
4702
|
+
},
|
|
4703
|
+
ExportAllDeclaration: (node, buffer) => {
|
|
4704
|
+
const nodePosition = buffer.position;
|
|
4705
|
+
buffer = buffer.reserve(6);
|
|
4706
|
+
buffer[nodePosition] = 24;
|
|
4707
|
+
buffer[nodePosition + 1] = node.start;
|
|
4708
|
+
buffer[nodePosition + 2] = node.end;
|
|
4709
|
+
if (node.exported != null)
|
|
4710
|
+
buffer = serializeNode('exported', node, buffer, nodePosition + 3);
|
|
4711
|
+
buffer = serializeNode('source', node, buffer, nodePosition + 4);
|
|
4712
|
+
buffer = serializeNodeList('attributes', node, buffer, nodePosition + 5);
|
|
4713
|
+
return buffer;
|
|
4714
|
+
},
|
|
4715
|
+
ExportDefaultDeclaration: (node, buffer) => {
|
|
4716
|
+
const nodePosition = buffer.position;
|
|
4717
|
+
buffer = buffer.reserve(4);
|
|
4718
|
+
buffer[nodePosition] = 25;
|
|
4719
|
+
buffer[nodePosition + 1] = node.start;
|
|
4720
|
+
buffer[nodePosition + 2] = node.end;
|
|
4721
|
+
buffer = serializeNode('declaration', node, buffer, nodePosition + 3);
|
|
4722
|
+
return buffer;
|
|
4723
|
+
},
|
|
4724
|
+
ExportNamedDeclaration: (node, buffer) => {
|
|
4725
|
+
const nodePosition = buffer.position;
|
|
4726
|
+
buffer = buffer.reserve(7);
|
|
4727
|
+
buffer[nodePosition] = 26;
|
|
4728
|
+
buffer[nodePosition + 1] = node.start;
|
|
4729
|
+
buffer[nodePosition + 2] = node.end;
|
|
4730
|
+
buffer = serializeNodeList('specifiers', node, buffer, nodePosition + 3);
|
|
4731
|
+
if (node.source != null)
|
|
4732
|
+
buffer = serializeNode('source', node, buffer, nodePosition + 4);
|
|
4733
|
+
buffer = serializeNodeList('attributes', node, buffer, nodePosition + 5);
|
|
4734
|
+
if (node.declaration != null)
|
|
4735
|
+
buffer = serializeNode('declaration', node, buffer, nodePosition + 6);
|
|
4736
|
+
return buffer;
|
|
4737
|
+
},
|
|
4738
|
+
ExportSpecifier: (node, buffer) => {
|
|
4739
|
+
const nodePosition = buffer.position;
|
|
4740
|
+
buffer = buffer.reserve(5);
|
|
4741
|
+
buffer[nodePosition] = 27;
|
|
4742
|
+
buffer[nodePosition + 1] = node.start;
|
|
4743
|
+
buffer[nodePosition + 2] = node.end;
|
|
4744
|
+
buffer = serializeNode('local', node, buffer, nodePosition + 3);
|
|
4745
|
+
if (node.exported.end != node.local.end)
|
|
4746
|
+
buffer = serializeNode('exported', node, buffer, nodePosition + 4);
|
|
4747
|
+
return buffer;
|
|
4748
|
+
},
|
|
4749
|
+
ExpressionStatement: serializeExpressionStatementNode,
|
|
4750
|
+
ForInStatement: (node, buffer) => {
|
|
4751
|
+
const nodePosition = buffer.position;
|
|
4752
|
+
buffer = buffer.reserve(7);
|
|
4753
|
+
buffer[nodePosition] = 29;
|
|
4754
|
+
buffer[nodePosition + 1] = node.start;
|
|
4755
|
+
buffer[nodePosition + 2] = node.end;
|
|
4756
|
+
buffer = serializeNode('left', node, buffer, nodePosition + 3);
|
|
4757
|
+
buffer = serializeNode('right', node, buffer, nodePosition + 4);
|
|
4758
|
+
buffer = serializeNode('body', node, buffer, nodePosition + 5);
|
|
4759
|
+
return buffer;
|
|
4760
|
+
},
|
|
4761
|
+
ForOfStatement: (node, buffer) => {
|
|
4762
|
+
const nodePosition = buffer.position;
|
|
4763
|
+
buffer = buffer.reserve(8);
|
|
4764
|
+
buffer[nodePosition] = 30;
|
|
4765
|
+
buffer[nodePosition + 1] = node.start;
|
|
4766
|
+
buffer[nodePosition + 2] = node.end;
|
|
4767
|
+
buffer[nodePosition + 3] = node.await << 0;
|
|
4768
|
+
buffer = serializeNode('left', node, buffer, nodePosition + 4);
|
|
4769
|
+
buffer = serializeNode('right', node, buffer, nodePosition + 5);
|
|
4770
|
+
buffer = serializeNode('body', node, buffer, nodePosition + 6);
|
|
4771
|
+
return buffer;
|
|
4772
|
+
},
|
|
4773
|
+
ForStatement: (node, buffer) => {
|
|
4774
|
+
const nodePosition = buffer.position;
|
|
4775
|
+
buffer = buffer.reserve(8);
|
|
4776
|
+
buffer[nodePosition] = 31;
|
|
4777
|
+
buffer[nodePosition + 1] = node.start;
|
|
4778
|
+
buffer[nodePosition + 2] = node.end;
|
|
4779
|
+
if (node.init != null)
|
|
4780
|
+
buffer = serializeNode('init', node, buffer, nodePosition + 3);
|
|
4781
|
+
if (node.test != null)
|
|
4782
|
+
buffer = serializeNode('test', node, buffer, nodePosition + 4);
|
|
4783
|
+
if (node.update != null)
|
|
4784
|
+
buffer = serializeNode('update', node, buffer, nodePosition + 5);
|
|
4785
|
+
buffer = serializeNode('body', node, buffer, nodePosition + 6);
|
|
4786
|
+
return buffer;
|
|
4787
|
+
},
|
|
4788
|
+
FunctionDeclaration: (node, buffer) => {
|
|
4789
|
+
const nodePosition = buffer.position;
|
|
4790
|
+
buffer = buffer.reserve(9);
|
|
4791
|
+
buffer[nodePosition] = 32;
|
|
4792
|
+
buffer[nodePosition + 1] = node.start;
|
|
4793
|
+
buffer[nodePosition + 2] = node.end;
|
|
4794
|
+
buffer[nodePosition + 3] = (node.async << 0) | (node.generator << 1);
|
|
4795
|
+
buffer = serializeAnnotations(node.annotations, buffer, nodePosition + 4);
|
|
4796
|
+
if (node.id != null)
|
|
4797
|
+
buffer = serializeNode('id', node, buffer, nodePosition + 5);
|
|
4798
|
+
buffer = serializeNodeList('params', node, buffer, nodePosition + 6);
|
|
4799
|
+
buffer = serializeNode('body', node, buffer, nodePosition + 7);
|
|
4800
|
+
return buffer;
|
|
4801
|
+
},
|
|
4802
|
+
FunctionExpression: (node, buffer) => {
|
|
4803
|
+
const nodePosition = buffer.position;
|
|
4804
|
+
buffer = buffer.reserve(9);
|
|
4805
|
+
buffer[nodePosition] = 33;
|
|
4806
|
+
buffer[nodePosition + 1] = node.start;
|
|
4807
|
+
buffer[nodePosition + 2] = node.end;
|
|
4808
|
+
buffer[nodePosition + 3] = (node.async << 0) | (node.generator << 1);
|
|
4809
|
+
buffer = serializeAnnotations(node.annotations, buffer, nodePosition + 4);
|
|
4810
|
+
if (node.id != null)
|
|
4811
|
+
buffer = serializeNode('id', node, buffer, nodePosition + 5);
|
|
4812
|
+
buffer = serializeNodeList('params', node, buffer, nodePosition + 6);
|
|
4813
|
+
buffer = serializeNode('body', node, buffer, nodePosition + 7);
|
|
4814
|
+
return buffer;
|
|
4815
|
+
},
|
|
4816
|
+
Identifier: (node, buffer) => {
|
|
4817
|
+
const nodePosition = buffer.position;
|
|
4818
|
+
buffer = buffer.reserve(4);
|
|
4819
|
+
buffer[nodePosition] = 34;
|
|
4820
|
+
buffer[nodePosition + 1] = node.start;
|
|
4821
|
+
buffer[nodePosition + 2] = node.end;
|
|
4822
|
+
buffer = buffer.addStringToBuffer(node.name, nodePosition + 3);
|
|
4823
|
+
return buffer;
|
|
4824
|
+
},
|
|
4825
|
+
IfStatement: (node, buffer) => {
|
|
4826
|
+
const nodePosition = buffer.position;
|
|
4827
|
+
buffer = buffer.reserve(6);
|
|
4828
|
+
buffer[nodePosition] = 35;
|
|
4829
|
+
buffer[nodePosition + 1] = node.start;
|
|
4830
|
+
buffer[nodePosition + 2] = node.end;
|
|
4831
|
+
buffer = serializeNode('test', node, buffer, nodePosition + 3);
|
|
4832
|
+
buffer = serializeNode('consequent', node, buffer, nodePosition + 4);
|
|
4833
|
+
if (node.alternate != null)
|
|
4834
|
+
buffer = serializeNode('alternate', node, buffer, nodePosition + 5);
|
|
4835
|
+
return buffer;
|
|
4836
|
+
},
|
|
4837
|
+
ImportAttribute: (node, buffer) => {
|
|
4838
|
+
const nodePosition = buffer.position;
|
|
4839
|
+
buffer = buffer.reserve(5);
|
|
4840
|
+
buffer[nodePosition] = 36;
|
|
4841
|
+
buffer[nodePosition + 1] = node.start;
|
|
4842
|
+
buffer[nodePosition + 2] = node.end;
|
|
4843
|
+
buffer = serializeNode('key', node, buffer, nodePosition + 3);
|
|
4844
|
+
buffer = serializeNode('value', node, buffer, nodePosition + 4);
|
|
4845
|
+
return buffer;
|
|
4846
|
+
},
|
|
4847
|
+
ImportDeclaration: (node, buffer) => {
|
|
4848
|
+
const nodePosition = buffer.position;
|
|
4849
|
+
buffer = buffer.reserve(7);
|
|
4850
|
+
buffer[nodePosition] = 37;
|
|
4851
|
+
buffer[nodePosition + 1] = node.start;
|
|
4852
|
+
buffer[nodePosition + 2] = node.end;
|
|
4853
|
+
buffer = serializeNodeList('specifiers', node, buffer, nodePosition + 3);
|
|
4854
|
+
buffer = serializeNode('source', node, buffer, nodePosition + 4);
|
|
4855
|
+
buffer = serializeNodeList('attributes', node, buffer, nodePosition + 5);
|
|
4856
|
+
if (node.phase != null) {
|
|
4857
|
+
buffer[nodePosition + 6] = FIXED_STRING_INDICES[node.phase];
|
|
4858
|
+
}
|
|
4859
|
+
return buffer;
|
|
4860
|
+
},
|
|
4861
|
+
ImportDefaultSpecifier: (node, buffer) => {
|
|
4862
|
+
const nodePosition = buffer.position;
|
|
4863
|
+
buffer = buffer.reserve(4);
|
|
4864
|
+
buffer[nodePosition] = 38;
|
|
4865
|
+
buffer[nodePosition + 1] = node.start;
|
|
4866
|
+
buffer[nodePosition + 2] = node.end;
|
|
4867
|
+
buffer = serializeNode('local', node, buffer, nodePosition + 3);
|
|
4868
|
+
return buffer;
|
|
4869
|
+
},
|
|
4870
|
+
ImportExpression: (node, buffer) => {
|
|
4871
|
+
const nodePosition = buffer.position;
|
|
4872
|
+
buffer = buffer.reserve(6);
|
|
4873
|
+
buffer[nodePosition] = 39;
|
|
4874
|
+
buffer[nodePosition + 1] = node.start;
|
|
4875
|
+
buffer[nodePosition + 2] = node.end;
|
|
4876
|
+
buffer = serializeNode('source', node, buffer, nodePosition + 3);
|
|
4877
|
+
if (node.options != null)
|
|
4878
|
+
buffer = serializeNode('options', node, buffer, nodePosition + 4);
|
|
4879
|
+
if (node.phase != null) {
|
|
4880
|
+
buffer[nodePosition + 5] = FIXED_STRING_INDICES[node.phase];
|
|
4881
|
+
}
|
|
4882
|
+
return buffer;
|
|
4883
|
+
},
|
|
4884
|
+
ImportNamespaceSpecifier: (node, buffer) => {
|
|
4885
|
+
const nodePosition = buffer.position;
|
|
4886
|
+
buffer = buffer.reserve(4);
|
|
4887
|
+
buffer[nodePosition] = 40;
|
|
4888
|
+
buffer[nodePosition + 1] = node.start;
|
|
4889
|
+
buffer[nodePosition + 2] = node.end;
|
|
4890
|
+
buffer = serializeNode('local', node, buffer, nodePosition + 3);
|
|
4891
|
+
return buffer;
|
|
4892
|
+
},
|
|
4893
|
+
ImportSpecifier: (node, buffer) => {
|
|
4894
|
+
const nodePosition = buffer.position;
|
|
4895
|
+
buffer = buffer.reserve(5);
|
|
4896
|
+
buffer[nodePosition] = 41;
|
|
4897
|
+
buffer[nodePosition + 1] = node.start;
|
|
4898
|
+
buffer[nodePosition + 2] = node.end;
|
|
4899
|
+
if (node.imported.end != node.local.end)
|
|
4900
|
+
buffer = serializeNode('imported', node, buffer, nodePosition + 3);
|
|
4901
|
+
buffer = serializeNode('local', node, buffer, nodePosition + 4);
|
|
4902
|
+
return buffer;
|
|
4903
|
+
},
|
|
4904
|
+
JSXAttribute: (node, buffer) => {
|
|
4905
|
+
const nodePosition = buffer.position;
|
|
4906
|
+
buffer = buffer.reserve(5);
|
|
4907
|
+
buffer[nodePosition] = 42;
|
|
4908
|
+
buffer[nodePosition + 1] = node.start;
|
|
4909
|
+
buffer[nodePosition + 2] = node.end;
|
|
4910
|
+
buffer = serializeNode('name', node, buffer, nodePosition + 3);
|
|
4911
|
+
if (node.value != null)
|
|
4912
|
+
buffer = serializeNode('value', node, buffer, nodePosition + 4);
|
|
4913
|
+
return buffer;
|
|
4914
|
+
},
|
|
4915
|
+
JSXClosingElement: (node, buffer) => {
|
|
4916
|
+
const nodePosition = buffer.position;
|
|
4917
|
+
buffer = buffer.reserve(4);
|
|
4918
|
+
buffer[nodePosition] = 43;
|
|
4919
|
+
buffer[nodePosition + 1] = node.start;
|
|
4920
|
+
buffer[nodePosition + 2] = node.end;
|
|
4921
|
+
buffer = serializeNode('name', node, buffer, nodePosition + 3);
|
|
4922
|
+
return buffer;
|
|
4923
|
+
},
|
|
4924
|
+
JSXClosingFragment: (node, buffer) => {
|
|
4925
|
+
const nodePosition = buffer.position;
|
|
4926
|
+
buffer = buffer.reserve(3);
|
|
4927
|
+
buffer[nodePosition] = 44;
|
|
4928
|
+
buffer[nodePosition + 1] = node.start;
|
|
4929
|
+
buffer[nodePosition + 2] = node.end;
|
|
4930
|
+
return buffer;
|
|
4931
|
+
},
|
|
4932
|
+
JSXElement: (node, buffer) => {
|
|
4933
|
+
const nodePosition = buffer.position;
|
|
4934
|
+
buffer = buffer.reserve(6);
|
|
4935
|
+
buffer[nodePosition] = 45;
|
|
4936
|
+
buffer[nodePosition + 1] = node.start;
|
|
4937
|
+
buffer[nodePosition + 2] = node.end;
|
|
4938
|
+
buffer = serializeNode('openingElement', node, buffer, nodePosition + 3);
|
|
4939
|
+
buffer = serializeNodeList('children', node, buffer, nodePosition + 4);
|
|
4940
|
+
if (node.closingElement != null)
|
|
4941
|
+
buffer = serializeNode('closingElement', node, buffer, nodePosition + 5);
|
|
4942
|
+
return buffer;
|
|
4943
|
+
},
|
|
4944
|
+
JSXEmptyExpression: (node, buffer) => {
|
|
4945
|
+
const nodePosition = buffer.position;
|
|
4946
|
+
buffer = buffer.reserve(3);
|
|
4947
|
+
buffer[nodePosition] = 46;
|
|
4948
|
+
buffer[nodePosition + 1] = node.start;
|
|
4949
|
+
buffer[nodePosition + 2] = node.end;
|
|
4950
|
+
return buffer;
|
|
4951
|
+
},
|
|
4952
|
+
JSXExpressionContainer: (node, buffer) => {
|
|
4953
|
+
const nodePosition = buffer.position;
|
|
4954
|
+
buffer = buffer.reserve(4);
|
|
4955
|
+
buffer[nodePosition] = 47;
|
|
4956
|
+
buffer[nodePosition + 1] = node.start;
|
|
4957
|
+
buffer[nodePosition + 2] = node.end;
|
|
4958
|
+
buffer = serializeNode('expression', node, buffer, nodePosition + 3);
|
|
4959
|
+
return buffer;
|
|
4960
|
+
},
|
|
4961
|
+
JSXFragment: (node, buffer) => {
|
|
4962
|
+
const nodePosition = buffer.position;
|
|
4963
|
+
buffer = buffer.reserve(6);
|
|
4964
|
+
buffer[nodePosition] = 48;
|
|
4965
|
+
buffer[nodePosition + 1] = node.start;
|
|
4966
|
+
buffer[nodePosition + 2] = node.end;
|
|
4967
|
+
buffer = serializeNode('openingFragment', node, buffer, nodePosition + 3);
|
|
4968
|
+
buffer = serializeNodeList('children', node, buffer, nodePosition + 4);
|
|
4969
|
+
buffer = serializeNode('closingFragment', node, buffer, nodePosition + 5);
|
|
4970
|
+
return buffer;
|
|
4971
|
+
},
|
|
4972
|
+
JSXIdentifier: (node, buffer) => {
|
|
4973
|
+
const nodePosition = buffer.position;
|
|
4974
|
+
buffer = buffer.reserve(4);
|
|
4975
|
+
buffer[nodePosition] = 49;
|
|
4976
|
+
buffer[nodePosition + 1] = node.start;
|
|
4977
|
+
buffer[nodePosition + 2] = node.end;
|
|
4978
|
+
buffer = buffer.addStringToBuffer(node.name, nodePosition + 3);
|
|
4979
|
+
return buffer;
|
|
4980
|
+
},
|
|
4981
|
+
JSXMemberExpression: (node, buffer) => {
|
|
4982
|
+
const nodePosition = buffer.position;
|
|
4983
|
+
buffer = buffer.reserve(5);
|
|
4984
|
+
buffer[nodePosition] = 50;
|
|
4985
|
+
buffer[nodePosition + 1] = node.start;
|
|
4986
|
+
buffer[nodePosition + 2] = node.end;
|
|
4987
|
+
buffer = serializeNode('object', node, buffer, nodePosition + 3);
|
|
4988
|
+
buffer = serializeNode('property', node, buffer, nodePosition + 4);
|
|
4989
|
+
return buffer;
|
|
4990
|
+
},
|
|
4991
|
+
JSXNamespacedName: (node, buffer) => {
|
|
4992
|
+
const nodePosition = buffer.position;
|
|
4993
|
+
buffer = buffer.reserve(5);
|
|
4994
|
+
buffer[nodePosition] = 51;
|
|
4995
|
+
buffer[nodePosition + 1] = node.start;
|
|
4996
|
+
buffer[nodePosition + 2] = node.end;
|
|
4997
|
+
buffer = serializeNode('namespace', node, buffer, nodePosition + 3);
|
|
4998
|
+
buffer = serializeNode('name', node, buffer, nodePosition + 4);
|
|
4999
|
+
return buffer;
|
|
5000
|
+
},
|
|
5001
|
+
JSXOpeningElement: (node, buffer) => {
|
|
5002
|
+
const nodePosition = buffer.position;
|
|
5003
|
+
buffer = buffer.reserve(6);
|
|
5004
|
+
buffer[nodePosition] = 52;
|
|
5005
|
+
buffer[nodePosition + 1] = node.start;
|
|
5006
|
+
buffer[nodePosition + 2] = node.end;
|
|
5007
|
+
buffer[nodePosition + 3] = node.selfClosing << 0;
|
|
5008
|
+
buffer = serializeNode('name', node, buffer, nodePosition + 4);
|
|
5009
|
+
buffer = serializeNodeList('attributes', node, buffer, nodePosition + 5);
|
|
5010
|
+
return buffer;
|
|
5011
|
+
},
|
|
5012
|
+
JSXOpeningFragment: (node, buffer) => {
|
|
5013
|
+
const nodePosition = buffer.position;
|
|
5014
|
+
buffer = buffer.reserve(3);
|
|
5015
|
+
buffer[nodePosition] = 53;
|
|
5016
|
+
buffer[nodePosition + 1] = node.start;
|
|
5017
|
+
buffer[nodePosition + 2] = node.end;
|
|
5018
|
+
return buffer;
|
|
5019
|
+
},
|
|
5020
|
+
JSXSpreadAttribute: (node, buffer) => {
|
|
5021
|
+
const nodePosition = buffer.position;
|
|
5022
|
+
buffer = buffer.reserve(4);
|
|
5023
|
+
buffer[nodePosition] = 54;
|
|
5024
|
+
buffer[nodePosition + 1] = node.start;
|
|
5025
|
+
buffer[nodePosition + 2] = node.end;
|
|
5026
|
+
buffer = serializeNode('argument', node, buffer, nodePosition + 3);
|
|
5027
|
+
return buffer;
|
|
5028
|
+
},
|
|
5029
|
+
JSXSpreadChild: (node, buffer) => {
|
|
5030
|
+
const nodePosition = buffer.position;
|
|
5031
|
+
buffer = buffer.reserve(4);
|
|
5032
|
+
buffer[nodePosition] = 55;
|
|
5033
|
+
buffer[nodePosition + 1] = node.start;
|
|
5034
|
+
buffer[nodePosition + 2] = node.end;
|
|
5035
|
+
buffer = serializeNode('expression', node, buffer, nodePosition + 3);
|
|
5036
|
+
return buffer;
|
|
5037
|
+
},
|
|
5038
|
+
JSXText: (node, buffer) => {
|
|
5039
|
+
const nodePosition = buffer.position;
|
|
5040
|
+
buffer = buffer.reserve(5);
|
|
5041
|
+
buffer[nodePosition] = 56;
|
|
5042
|
+
buffer[nodePosition + 1] = node.start;
|
|
5043
|
+
buffer[nodePosition + 2] = node.end;
|
|
5044
|
+
buffer = buffer.addStringToBuffer(node.value, nodePosition + 3);
|
|
5045
|
+
buffer = buffer.addStringToBuffer(node.raw, nodePosition + 4);
|
|
5046
|
+
return buffer;
|
|
5047
|
+
},
|
|
5048
|
+
LabeledStatement: (node, buffer) => {
|
|
5049
|
+
const nodePosition = buffer.position;
|
|
5050
|
+
buffer = buffer.reserve(5);
|
|
5051
|
+
buffer[nodePosition] = 57;
|
|
5052
|
+
buffer[nodePosition + 1] = node.start;
|
|
5053
|
+
buffer[nodePosition + 2] = node.end;
|
|
5054
|
+
buffer = serializeNode('label', node, buffer, nodePosition + 3);
|
|
5055
|
+
buffer = serializeNode('body', node, buffer, nodePosition + 4);
|
|
5056
|
+
return buffer;
|
|
5057
|
+
},
|
|
5058
|
+
Literal: serializeLiteralNode,
|
|
5059
|
+
LogicalExpression: (node, buffer) => {
|
|
5060
|
+
const nodePosition = buffer.position;
|
|
5061
|
+
buffer = buffer.reserve(6);
|
|
5062
|
+
buffer[nodePosition] = 64;
|
|
5063
|
+
buffer[nodePosition + 1] = node.start;
|
|
5064
|
+
buffer[nodePosition + 2] = node.end;
|
|
5065
|
+
buffer[nodePosition + 3] = FIXED_STRING_INDICES[node.operator];
|
|
5066
|
+
buffer = serializeNode('left', node, buffer, nodePosition + 4);
|
|
5067
|
+
buffer = serializeNode('right', node, buffer, nodePosition + 5);
|
|
5068
|
+
return buffer;
|
|
5069
|
+
},
|
|
5070
|
+
MemberExpression: (node, buffer) => {
|
|
5071
|
+
const nodePosition = buffer.position;
|
|
5072
|
+
buffer = buffer.reserve(6);
|
|
5073
|
+
buffer[nodePosition] = 65;
|
|
5074
|
+
buffer[nodePosition + 1] = node.start;
|
|
5075
|
+
buffer[nodePosition + 2] = node.end;
|
|
5076
|
+
buffer[nodePosition + 3] = (node.computed << 0) | (node.optional << 1);
|
|
5077
|
+
buffer = serializeNode('object', node, buffer, nodePosition + 4);
|
|
5078
|
+
buffer = serializeNode('property', node, buffer, nodePosition + 5);
|
|
5079
|
+
return buffer;
|
|
5080
|
+
},
|
|
5081
|
+
MetaProperty: (node, buffer) => {
|
|
5082
|
+
const nodePosition = buffer.position;
|
|
5083
|
+
buffer = buffer.reserve(5);
|
|
5084
|
+
buffer[nodePosition] = 66;
|
|
5085
|
+
buffer[nodePosition + 1] = node.start;
|
|
5086
|
+
buffer[nodePosition + 2] = node.end;
|
|
5087
|
+
buffer = serializeNode('meta', node, buffer, nodePosition + 3);
|
|
5088
|
+
buffer = serializeNode('property', node, buffer, nodePosition + 4);
|
|
5089
|
+
return buffer;
|
|
5090
|
+
},
|
|
5091
|
+
MethodDefinition: (node, buffer) => {
|
|
5092
|
+
const nodePosition = buffer.position;
|
|
5093
|
+
buffer = buffer.reserve(8);
|
|
5094
|
+
buffer[nodePosition] = 67;
|
|
5095
|
+
buffer[nodePosition + 1] = node.start;
|
|
5096
|
+
buffer[nodePosition + 2] = node.end;
|
|
5097
|
+
buffer[nodePosition + 3] = (node.static << 0) | (node.computed << 1);
|
|
5098
|
+
buffer = serializeNodeList('decorators', node, buffer, nodePosition + 4);
|
|
5099
|
+
buffer = serializeNode('key', node, buffer, nodePosition + 5);
|
|
5100
|
+
buffer = serializeNode('value', node, buffer, nodePosition + 6);
|
|
5101
|
+
buffer[nodePosition + 7] = FIXED_STRING_INDICES[node.kind];
|
|
5102
|
+
return buffer;
|
|
5103
|
+
},
|
|
5104
|
+
NewExpression: (node, buffer) => {
|
|
5105
|
+
const nodePosition = buffer.position;
|
|
5106
|
+
buffer = buffer.reserve(6);
|
|
5107
|
+
buffer[nodePosition] = 68;
|
|
5108
|
+
buffer[nodePosition + 1] = node.start;
|
|
5109
|
+
buffer[nodePosition + 2] = node.end;
|
|
5110
|
+
buffer = serializeAnnotations(node.annotations, buffer, nodePosition + 3);
|
|
5111
|
+
buffer = serializeNode('callee', node, buffer, nodePosition + 4);
|
|
5112
|
+
buffer = serializeNodeList('arguments', node, buffer, nodePosition + 5);
|
|
5113
|
+
return buffer;
|
|
5114
|
+
},
|
|
5115
|
+
ObjectExpression: (node, buffer) => {
|
|
5116
|
+
const nodePosition = buffer.position;
|
|
5117
|
+
buffer = buffer.reserve(4);
|
|
5118
|
+
buffer[nodePosition] = 69;
|
|
5119
|
+
buffer[nodePosition + 1] = node.start;
|
|
5120
|
+
buffer[nodePosition + 2] = node.end;
|
|
5121
|
+
buffer = serializeNodeList('properties', node, buffer, nodePosition + 3);
|
|
5122
|
+
return buffer;
|
|
5123
|
+
},
|
|
5124
|
+
ObjectPattern: (node, buffer) => {
|
|
5125
|
+
const nodePosition = buffer.position;
|
|
5126
|
+
buffer = buffer.reserve(4);
|
|
5127
|
+
buffer[nodePosition] = 70;
|
|
5128
|
+
buffer[nodePosition + 1] = node.start;
|
|
5129
|
+
buffer[nodePosition + 2] = node.end;
|
|
5130
|
+
buffer = serializeNodeList('properties', node, buffer, nodePosition + 3);
|
|
5131
|
+
return buffer;
|
|
5132
|
+
},
|
|
5133
|
+
PanicError: (node, buffer) => {
|
|
5134
|
+
const nodePosition = buffer.position;
|
|
5135
|
+
buffer = buffer.reserve(4);
|
|
5136
|
+
buffer[nodePosition] = 0;
|
|
5137
|
+
buffer[nodePosition + 1] = node.start;
|
|
5138
|
+
buffer[nodePosition + 2] = node.end;
|
|
5139
|
+
buffer = buffer.addStringToBuffer(node.message, nodePosition + 3);
|
|
5140
|
+
return buffer;
|
|
5141
|
+
},
|
|
5142
|
+
ParseError: (node, buffer) => {
|
|
5143
|
+
const nodePosition = buffer.position;
|
|
5144
|
+
buffer = buffer.reserve(4);
|
|
5145
|
+
buffer[nodePosition] = 1;
|
|
5146
|
+
buffer[nodePosition + 1] = node.start;
|
|
5147
|
+
buffer[nodePosition + 2] = node.end;
|
|
5148
|
+
buffer = buffer.addStringToBuffer(node.message, nodePosition + 3);
|
|
5149
|
+
return buffer;
|
|
5150
|
+
},
|
|
5151
|
+
PrivateIdentifier: (node, buffer) => {
|
|
5152
|
+
const nodePosition = buffer.position;
|
|
5153
|
+
buffer = buffer.reserve(4);
|
|
5154
|
+
buffer[nodePosition] = 71;
|
|
5155
|
+
buffer[nodePosition + 1] = node.start;
|
|
5156
|
+
buffer[nodePosition + 2] = node.end;
|
|
5157
|
+
buffer = buffer.addStringToBuffer(node.name, nodePosition + 3);
|
|
5158
|
+
return buffer;
|
|
5159
|
+
},
|
|
5160
|
+
Program: (node, buffer) => {
|
|
5161
|
+
const nodePosition = buffer.position;
|
|
5162
|
+
buffer = buffer.reserve(6);
|
|
5163
|
+
buffer[nodePosition] = 72;
|
|
5164
|
+
buffer[nodePosition + 1] = node.start;
|
|
5165
|
+
buffer[nodePosition + 2] = node.end;
|
|
5166
|
+
buffer = serializeNodeList('body', node, buffer, nodePosition + 3);
|
|
5167
|
+
buffer = serializeAnnotations(node.invalidAnnotations, buffer, nodePosition + 4);
|
|
5168
|
+
return buffer;
|
|
5169
|
+
},
|
|
5170
|
+
Property: (node, buffer) => {
|
|
5171
|
+
const nodePosition = buffer.position;
|
|
5172
|
+
buffer = buffer.reserve(7);
|
|
5173
|
+
buffer[nodePosition] = 73;
|
|
5174
|
+
buffer[nodePosition + 1] = node.start;
|
|
5175
|
+
buffer[nodePosition + 2] = node.end;
|
|
5176
|
+
buffer[nodePosition + 3] =
|
|
5177
|
+
(node.method << 0) | (node.shorthand << 1) | (node.computed << 2);
|
|
5178
|
+
if (node.key.end != node.value.end)
|
|
5179
|
+
buffer = serializeNode('key', node, buffer, nodePosition + 4);
|
|
5180
|
+
buffer = serializeNode('value', node, buffer, nodePosition + 5);
|
|
5181
|
+
buffer[nodePosition + 6] = FIXED_STRING_INDICES[node.kind];
|
|
5182
|
+
return buffer;
|
|
5183
|
+
},
|
|
5184
|
+
PropertyDefinition: (node, buffer) => {
|
|
5185
|
+
const nodePosition = buffer.position;
|
|
5186
|
+
buffer = buffer.reserve(7);
|
|
5187
|
+
buffer[nodePosition] = 74;
|
|
5188
|
+
buffer[nodePosition + 1] = node.start;
|
|
5189
|
+
buffer[nodePosition + 2] = node.end;
|
|
5190
|
+
buffer[nodePosition + 3] = (node.static << 0) | (node.computed << 1);
|
|
5191
|
+
buffer = serializeNodeList('decorators', node, buffer, nodePosition + 4);
|
|
5192
|
+
buffer = serializeNode('key', node, buffer, nodePosition + 5);
|
|
5193
|
+
if (node.value != null)
|
|
5194
|
+
buffer = serializeNode('value', node, buffer, nodePosition + 6);
|
|
5195
|
+
return buffer;
|
|
5196
|
+
},
|
|
5197
|
+
RestElement: (node, buffer) => {
|
|
5198
|
+
const nodePosition = buffer.position;
|
|
5199
|
+
buffer = buffer.reserve(4);
|
|
5200
|
+
buffer[nodePosition] = 75;
|
|
5201
|
+
buffer[nodePosition + 1] = node.start;
|
|
5202
|
+
buffer[nodePosition + 2] = node.end;
|
|
5203
|
+
buffer = serializeNode('argument', node, buffer, nodePosition + 3);
|
|
5204
|
+
return buffer;
|
|
5205
|
+
},
|
|
5206
|
+
ReturnStatement: (node, buffer) => {
|
|
5207
|
+
const nodePosition = buffer.position;
|
|
5208
|
+
buffer = buffer.reserve(4);
|
|
5209
|
+
buffer[nodePosition] = 76;
|
|
5210
|
+
buffer[nodePosition + 1] = node.start;
|
|
5211
|
+
buffer[nodePosition + 2] = node.end;
|
|
5212
|
+
if (node.argument != null)
|
|
5213
|
+
buffer = serializeNode('argument', node, buffer, nodePosition + 3);
|
|
5214
|
+
return buffer;
|
|
5215
|
+
},
|
|
5216
|
+
SequenceExpression: (node, buffer) => {
|
|
5217
|
+
const nodePosition = buffer.position;
|
|
5218
|
+
buffer = buffer.reserve(4);
|
|
5219
|
+
buffer[nodePosition] = 77;
|
|
5220
|
+
buffer[nodePosition + 1] = node.start;
|
|
5221
|
+
buffer[nodePosition + 2] = node.end;
|
|
5222
|
+
buffer = serializeNodeList('expressions', node, buffer, nodePosition + 3);
|
|
5223
|
+
return buffer;
|
|
5224
|
+
},
|
|
5225
|
+
SpreadElement: (node, buffer) => {
|
|
5226
|
+
const nodePosition = buffer.position;
|
|
5227
|
+
buffer = buffer.reserve(4);
|
|
5228
|
+
buffer[nodePosition] = 78;
|
|
5229
|
+
buffer[nodePosition + 1] = node.start;
|
|
5230
|
+
buffer[nodePosition + 2] = node.end;
|
|
5231
|
+
buffer = serializeNode('argument', node, buffer, nodePosition + 3);
|
|
5232
|
+
return buffer;
|
|
5233
|
+
},
|
|
5234
|
+
StaticBlock: (node, buffer) => {
|
|
5235
|
+
const nodePosition = buffer.position;
|
|
5236
|
+
buffer = buffer.reserve(5);
|
|
5237
|
+
buffer[nodePosition] = 79;
|
|
5238
|
+
buffer[nodePosition + 1] = node.start;
|
|
5239
|
+
buffer[nodePosition + 2] = node.end;
|
|
5240
|
+
buffer = serializeNodeList('body', node, buffer, nodePosition + 3);
|
|
5241
|
+
return buffer;
|
|
5242
|
+
},
|
|
5243
|
+
Super: (node, buffer) => {
|
|
5244
|
+
const nodePosition = buffer.position;
|
|
5245
|
+
buffer = buffer.reserve(3);
|
|
5246
|
+
buffer[nodePosition] = 80;
|
|
5247
|
+
buffer[nodePosition + 1] = node.start;
|
|
5248
|
+
buffer[nodePosition + 2] = node.end;
|
|
5249
|
+
return buffer;
|
|
5250
|
+
},
|
|
5251
|
+
SwitchCase: (node, buffer) => {
|
|
5252
|
+
const nodePosition = buffer.position;
|
|
5253
|
+
buffer = buffer.reserve(5);
|
|
5254
|
+
buffer[nodePosition] = 81;
|
|
5255
|
+
buffer[nodePosition + 1] = node.start;
|
|
5256
|
+
buffer[nodePosition + 2] = node.end;
|
|
5257
|
+
if (node.test != null)
|
|
5258
|
+
buffer = serializeNode('test', node, buffer, nodePosition + 3);
|
|
5259
|
+
buffer = serializeNodeList('consequent', node, buffer, nodePosition + 4);
|
|
5260
|
+
return buffer;
|
|
5261
|
+
},
|
|
5262
|
+
SwitchStatement: (node, buffer) => {
|
|
5263
|
+
const nodePosition = buffer.position;
|
|
5264
|
+
buffer = buffer.reserve(6);
|
|
5265
|
+
buffer[nodePosition] = 82;
|
|
5266
|
+
buffer[nodePosition + 1] = node.start;
|
|
5267
|
+
buffer[nodePosition + 2] = node.end;
|
|
5268
|
+
buffer = serializeNode('discriminant', node, buffer, nodePosition + 3);
|
|
5269
|
+
buffer = serializeNodeList('cases', node, buffer, nodePosition + 4);
|
|
5270
|
+
return buffer;
|
|
5271
|
+
},
|
|
5272
|
+
TaggedTemplateExpression: (node, buffer) => {
|
|
5273
|
+
const nodePosition = buffer.position;
|
|
5274
|
+
buffer = buffer.reserve(5);
|
|
5275
|
+
buffer[nodePosition] = 83;
|
|
5276
|
+
buffer[nodePosition + 1] = node.start;
|
|
5277
|
+
buffer[nodePosition + 2] = node.end;
|
|
5278
|
+
buffer = serializeNode('tag', node, buffer, nodePosition + 3);
|
|
5279
|
+
buffer = serializeNode('quasi', node, buffer, nodePosition + 4);
|
|
5280
|
+
return buffer;
|
|
5281
|
+
},
|
|
5282
|
+
TemplateElement: (node, buffer) => {
|
|
5283
|
+
const nodePosition = buffer.position;
|
|
5284
|
+
buffer = buffer.reserve(6);
|
|
5285
|
+
buffer[nodePosition] = 84;
|
|
5286
|
+
buffer[nodePosition + 1] = node.start;
|
|
5287
|
+
buffer[nodePosition + 2] = node.end;
|
|
5288
|
+
buffer[nodePosition + 3] = node.tail << 0;
|
|
5289
|
+
if (node.value.cooked != null) {
|
|
5290
|
+
buffer = buffer.addStringToBuffer(node.value.cooked, nodePosition + 4);
|
|
5291
|
+
}
|
|
5292
|
+
buffer = buffer.addStringToBuffer(node.value.raw, nodePosition + 5);
|
|
5293
|
+
return buffer;
|
|
5294
|
+
},
|
|
5295
|
+
TemplateLiteral: (node, buffer) => {
|
|
5296
|
+
const nodePosition = buffer.position;
|
|
5297
|
+
buffer = buffer.reserve(5);
|
|
5298
|
+
buffer[nodePosition] = 85;
|
|
5299
|
+
buffer[nodePosition + 1] = node.start;
|
|
5300
|
+
buffer[nodePosition + 2] = node.end;
|
|
5301
|
+
buffer = serializeNodeList('quasis', node, buffer, nodePosition + 3);
|
|
5302
|
+
buffer = serializeNodeList('expressions', node, buffer, nodePosition + 4);
|
|
5303
|
+
return buffer;
|
|
5304
|
+
},
|
|
5305
|
+
ThisExpression: (node, buffer) => {
|
|
5306
|
+
const nodePosition = buffer.position;
|
|
5307
|
+
buffer = buffer.reserve(3);
|
|
5308
|
+
buffer[nodePosition] = 86;
|
|
5309
|
+
buffer[nodePosition + 1] = node.start;
|
|
5310
|
+
buffer[nodePosition + 2] = node.end;
|
|
5311
|
+
return buffer;
|
|
5312
|
+
},
|
|
5313
|
+
ThrowStatement: (node, buffer) => {
|
|
5314
|
+
const nodePosition = buffer.position;
|
|
5315
|
+
buffer = buffer.reserve(4);
|
|
5316
|
+
buffer[nodePosition] = 87;
|
|
5317
|
+
buffer[nodePosition + 1] = node.start;
|
|
5318
|
+
buffer[nodePosition + 2] = node.end;
|
|
5319
|
+
buffer = serializeNode('argument', node, buffer, nodePosition + 3);
|
|
5320
|
+
return buffer;
|
|
5321
|
+
},
|
|
5322
|
+
TryStatement: (node, buffer) => {
|
|
5323
|
+
const nodePosition = buffer.position;
|
|
5324
|
+
buffer = buffer.reserve(6);
|
|
5325
|
+
buffer[nodePosition] = 88;
|
|
5326
|
+
buffer[nodePosition + 1] = node.start;
|
|
5327
|
+
buffer[nodePosition + 2] = node.end;
|
|
5328
|
+
buffer = serializeNode('block', node, buffer, nodePosition + 3);
|
|
5329
|
+
if (node.handler != null)
|
|
5330
|
+
buffer = serializeNode('handler', node, buffer, nodePosition + 4);
|
|
5331
|
+
if (node.finalizer != null)
|
|
5332
|
+
buffer = serializeNode('finalizer', node, buffer, nodePosition + 5);
|
|
5333
|
+
return buffer;
|
|
5334
|
+
},
|
|
5335
|
+
UnaryExpression: (node, buffer) => {
|
|
5336
|
+
const nodePosition = buffer.position;
|
|
5337
|
+
buffer = buffer.reserve(5);
|
|
5338
|
+
buffer[nodePosition] = 89;
|
|
5339
|
+
buffer[nodePosition + 1] = node.start;
|
|
5340
|
+
buffer[nodePosition + 2] = node.end;
|
|
5341
|
+
buffer[nodePosition + 3] = FIXED_STRING_INDICES[node.operator];
|
|
5342
|
+
buffer = serializeNode('argument', node, buffer, nodePosition + 4);
|
|
5343
|
+
return buffer;
|
|
5344
|
+
},
|
|
5345
|
+
UpdateExpression: (node, buffer) => {
|
|
5346
|
+
const nodePosition = buffer.position;
|
|
5347
|
+
buffer = buffer.reserve(6);
|
|
5348
|
+
buffer[nodePosition] = 90;
|
|
5349
|
+
buffer[nodePosition + 1] = node.start;
|
|
5350
|
+
buffer[nodePosition + 2] = node.end;
|
|
5351
|
+
buffer[nodePosition + 3] = node.prefix << 0;
|
|
5352
|
+
buffer[nodePosition + 4] = FIXED_STRING_INDICES[node.operator];
|
|
5353
|
+
buffer = serializeNode('argument', node, buffer, nodePosition + 5);
|
|
5354
|
+
return buffer;
|
|
5355
|
+
},
|
|
5356
|
+
VariableDeclaration: (node, buffer) => {
|
|
5357
|
+
const nodePosition = buffer.position;
|
|
5358
|
+
buffer = buffer.reserve(5);
|
|
5359
|
+
buffer[nodePosition] = 91;
|
|
5360
|
+
buffer[nodePosition + 1] = node.start;
|
|
5361
|
+
buffer[nodePosition + 2] = node.end;
|
|
5362
|
+
buffer[nodePosition + 3] = FIXED_STRING_INDICES[node.kind];
|
|
5363
|
+
buffer = serializeNodeList('declarations', node, buffer, nodePosition + 4);
|
|
5364
|
+
return buffer;
|
|
5365
|
+
},
|
|
5366
|
+
VariableDeclarator: (node, buffer) => {
|
|
5367
|
+
const nodePosition = buffer.position;
|
|
5368
|
+
buffer = buffer.reserve(5);
|
|
5369
|
+
buffer[nodePosition] = 92;
|
|
5370
|
+
buffer[nodePosition + 1] = node.start;
|
|
5371
|
+
buffer[nodePosition + 2] = node.end;
|
|
5372
|
+
buffer = serializeNode('id', node, buffer, nodePosition + 3);
|
|
5373
|
+
if (node.init != null)
|
|
5374
|
+
buffer = serializeNode('init', node, buffer, nodePosition + 4);
|
|
5375
|
+
return buffer;
|
|
5376
|
+
},
|
|
5377
|
+
WhileStatement: (node, buffer) => {
|
|
5378
|
+
const nodePosition = buffer.position;
|
|
5379
|
+
buffer = buffer.reserve(5);
|
|
5380
|
+
buffer[nodePosition] = 93;
|
|
5381
|
+
buffer[nodePosition + 1] = node.start;
|
|
5382
|
+
buffer[nodePosition + 2] = node.end;
|
|
5383
|
+
buffer = serializeNode('test', node, buffer, nodePosition + 3);
|
|
5384
|
+
buffer = serializeNode('body', node, buffer, nodePosition + 4);
|
|
5385
|
+
return buffer;
|
|
5386
|
+
},
|
|
5387
|
+
YieldExpression: (node, buffer) => {
|
|
5388
|
+
const nodePosition = buffer.position;
|
|
5389
|
+
buffer = buffer.reserve(5);
|
|
5390
|
+
buffer[nodePosition] = 94;
|
|
5391
|
+
buffer[nodePosition + 1] = node.start;
|
|
5392
|
+
buffer[nodePosition + 2] = node.end;
|
|
5393
|
+
buffer[nodePosition + 3] = node.delegate << 0;
|
|
5394
|
+
if (node.argument != null)
|
|
5395
|
+
buffer = serializeNode('argument', node, buffer, nodePosition + 4);
|
|
5396
|
+
return buffer;
|
|
5397
|
+
}
|
|
5398
|
+
};
|
|
5399
|
+
const serializeDirective = (node, buffer) => {
|
|
5400
|
+
const nodePosition = buffer.position;
|
|
5401
|
+
buffer = buffer.reserve(5);
|
|
5402
|
+
buffer[nodePosition] = 21;
|
|
5403
|
+
buffer[nodePosition + 1] = node.start;
|
|
5404
|
+
buffer[nodePosition + 2] = node.end;
|
|
5405
|
+
buffer = buffer.addStringToBuffer(node.directive, nodePosition + 3);
|
|
5406
|
+
buffer = serializeNode('expression', node, buffer, nodePosition + 4);
|
|
5407
|
+
return buffer;
|
|
5408
|
+
};
|
|
5409
|
+
const serializeExpressionStatement = (node, buffer) => {
|
|
5410
|
+
const nodePosition = buffer.position;
|
|
5411
|
+
buffer = buffer.reserve(4);
|
|
5412
|
+
buffer[nodePosition] = 28;
|
|
5413
|
+
buffer[nodePosition + 1] = node.start;
|
|
5414
|
+
buffer[nodePosition + 2] = node.end;
|
|
5415
|
+
buffer = serializeNode('expression', node, buffer, nodePosition + 3);
|
|
5416
|
+
return buffer;
|
|
5417
|
+
};
|
|
5418
|
+
const serializeLiteralBigInt = (node, buffer) => {
|
|
5419
|
+
const nodePosition = buffer.position;
|
|
5420
|
+
buffer = buffer.reserve(5);
|
|
5421
|
+
buffer[nodePosition] = 58;
|
|
5422
|
+
buffer[nodePosition + 1] = node.start;
|
|
5423
|
+
buffer[nodePosition + 2] = node.end;
|
|
5424
|
+
buffer = buffer.addStringToBuffer(node.bigint, nodePosition + 3);
|
|
5425
|
+
buffer = buffer.addStringToBuffer(node.raw, nodePosition + 4);
|
|
5426
|
+
return buffer;
|
|
5427
|
+
};
|
|
5428
|
+
const serializeLiteralBoolean = (node, buffer) => {
|
|
5429
|
+
const nodePosition = buffer.position;
|
|
5430
|
+
buffer = buffer.reserve(4);
|
|
5431
|
+
buffer[nodePosition] = 59;
|
|
5432
|
+
buffer[nodePosition + 1] = node.start;
|
|
5433
|
+
buffer[nodePosition + 2] = node.end;
|
|
5434
|
+
buffer[nodePosition + 3] = node.value << 0;
|
|
5435
|
+
return buffer;
|
|
5436
|
+
};
|
|
5437
|
+
const serializeLiteralNull = (node, buffer) => {
|
|
5438
|
+
const nodePosition = buffer.position;
|
|
5439
|
+
buffer = buffer.reserve(3);
|
|
5440
|
+
buffer[nodePosition] = 60;
|
|
5441
|
+
buffer[nodePosition + 1] = node.start;
|
|
5442
|
+
buffer[nodePosition + 2] = node.end;
|
|
5443
|
+
return buffer;
|
|
5444
|
+
};
|
|
5445
|
+
const serializeLiteralNumber = (node, buffer) => {
|
|
5446
|
+
const nodePosition = buffer.position;
|
|
5447
|
+
buffer = buffer.reserve(6);
|
|
5448
|
+
buffer[nodePosition] = 61;
|
|
5449
|
+
buffer[nodePosition + 1] = node.start;
|
|
5450
|
+
buffer[nodePosition + 2] = node.end;
|
|
5451
|
+
if (node.raw != null) {
|
|
5452
|
+
buffer = buffer.addStringToBuffer(node.raw, nodePosition + 3);
|
|
5453
|
+
}
|
|
5454
|
+
buffer.writeFloat64(node.value, nodePosition + 4);
|
|
5455
|
+
return buffer;
|
|
5456
|
+
};
|
|
5457
|
+
const serializeLiteralRegExp = (node, buffer) => {
|
|
5458
|
+
const nodePosition = buffer.position;
|
|
5459
|
+
buffer = buffer.reserve(5);
|
|
5460
|
+
buffer[nodePosition] = 62;
|
|
5461
|
+
buffer[nodePosition + 1] = node.start;
|
|
5462
|
+
buffer[nodePosition + 2] = node.end;
|
|
5463
|
+
buffer = buffer.addStringToBuffer(node.regex.flags, nodePosition + 3);
|
|
5464
|
+
buffer = buffer.addStringToBuffer(node.regex.pattern, nodePosition + 4);
|
|
5465
|
+
return buffer;
|
|
5466
|
+
};
|
|
5467
|
+
const serializeLiteralString = (node, buffer) => {
|
|
5468
|
+
const nodePosition = buffer.position;
|
|
5469
|
+
buffer = buffer.reserve(5);
|
|
5470
|
+
buffer[nodePosition] = 63;
|
|
5471
|
+
buffer[nodePosition + 1] = node.start;
|
|
5472
|
+
buffer[nodePosition + 2] = node.end;
|
|
5473
|
+
buffer = buffer.addStringToBuffer(node.value, nodePosition + 3);
|
|
5474
|
+
if (node.raw != null) {
|
|
5475
|
+
buffer = buffer.addStringToBuffer(node.raw, nodePosition + 4);
|
|
5476
|
+
}
|
|
5477
|
+
return buffer;
|
|
5478
|
+
};
|
|
5479
|
+
function serializeNode(field, parent, buffer, referencePosition) {
|
|
5480
|
+
buffer[referencePosition] = buffer.position;
|
|
5481
|
+
const node = parent[field];
|
|
5482
|
+
return (nodeSerializers[node.type] || error(logUnknownNodeType(node.type, parent.type, field)))(node, buffer);
|
|
5483
|
+
}
|
|
5484
|
+
function serializeNodeList(field, parent, buffer, referencePosition) {
|
|
5485
|
+
const nodes = parent[field];
|
|
5486
|
+
if (nodes == null) {
|
|
5487
|
+
return buffer;
|
|
5488
|
+
}
|
|
5489
|
+
const { length } = nodes;
|
|
5490
|
+
if (length === 0) {
|
|
5491
|
+
return buffer;
|
|
5492
|
+
}
|
|
5493
|
+
if (length == null) {
|
|
5494
|
+
return error(logExpectedNodeList(parent.type, field, parent[field]));
|
|
5495
|
+
}
|
|
5496
|
+
let insertPosition = buffer.position;
|
|
5497
|
+
buffer = buffer.reserve(length + 1);
|
|
5498
|
+
buffer[referencePosition] = insertPosition;
|
|
5499
|
+
buffer[insertPosition] = length;
|
|
5500
|
+
insertPosition++;
|
|
5501
|
+
for (let index = 0; index < length; index++) {
|
|
5502
|
+
const node = nodes[index];
|
|
5503
|
+
if (node != null) {
|
|
5504
|
+
buffer[insertPosition + index] = buffer.position;
|
|
5505
|
+
buffer = (nodeSerializers[node.type] || error(logUnknownNodeType(node.type, parent.type, field)))(node, buffer);
|
|
5506
|
+
}
|
|
5507
|
+
}
|
|
5508
|
+
return buffer;
|
|
5509
|
+
}
|
|
5510
|
+
function serializeAnnotations(annotations, buffer, referencePosition) {
|
|
5511
|
+
if (!annotations?.length) {
|
|
5512
|
+
return buffer;
|
|
5513
|
+
}
|
|
5514
|
+
const { length } = annotations;
|
|
5515
|
+
let insertPosition = buffer.position;
|
|
5516
|
+
buffer = buffer.reserve(length + 1);
|
|
5517
|
+
buffer[referencePosition] = insertPosition;
|
|
5518
|
+
buffer[insertPosition] = length;
|
|
5519
|
+
insertPosition++;
|
|
5520
|
+
for (let index = 0; index < length; index++) {
|
|
5521
|
+
const annotation = annotations[index];
|
|
5522
|
+
const annotationPosition = buffer.position;
|
|
5523
|
+
buffer = buffer.reserve(3); // 3 for start, end, type
|
|
5524
|
+
buffer[insertPosition + index] = annotationPosition;
|
|
5525
|
+
buffer[annotationPosition] = annotation.start;
|
|
5526
|
+
buffer[annotationPosition + 1] = annotation.end;
|
|
5527
|
+
buffer[annotationPosition + 2] = FIXED_STRING_INDICES[annotation.type];
|
|
2200
5528
|
}
|
|
2201
|
-
return
|
|
5529
|
+
return buffer;
|
|
2202
5530
|
}
|
|
2203
5531
|
|
|
2204
|
-
const
|
|
2205
|
-
const
|
|
5532
|
+
const deserializeAst = (buffer, position = 0) => deserializeAstBuffer(getAstBuffer(buffer), position);
|
|
5533
|
+
const deserializeLazyAst = (buffer, position = 0) => deserializeLazyAstBuffer(getAstBuffer(buffer), position);
|
|
5534
|
+
const parseAst = (input, { allowReturnOutsideFunction = false, jsx = false } = {}) => deserializeAst(native_js.parse(input, allowReturnOutsideFunction, jsx));
|
|
5535
|
+
const parseAstAsync = async (input, { allowReturnOutsideFunction = false, jsx = false } = {}) => deserializeAst(await native_js.parseAsync(input, allowReturnOutsideFunction, jsx));
|
|
5536
|
+
const parseLazyAst = (input, { allowReturnOutsideFunction = false, jsx = false } = {}) => deserializeLazyAst(native_js.parse(input, allowReturnOutsideFunction, jsx));
|
|
5537
|
+
const parseLazyAstAsync = async (input, { allowReturnOutsideFunction = false, jsx = false } = {}) => deserializeLazyAst(await native_js.parseAsync(input, allowReturnOutsideFunction, jsx));
|
|
2206
5538
|
|
|
2207
|
-
exports.ANNOTATION_KEY = ANNOTATION_KEY;
|
|
2208
5539
|
exports.ArrowFunctionExpression = ArrowFunctionExpression;
|
|
2209
5540
|
exports.AwaitExpression = AwaitExpression;
|
|
2210
5541
|
exports.BLANK = BLANK;
|
|
@@ -2217,9 +5548,10 @@ exports.EMPTY_SET = EMPTY_SET;
|
|
|
2217
5548
|
exports.ExportDefaultDeclaration = ExportDefaultDeclaration;
|
|
2218
5549
|
exports.ExpressionStatement = ExpressionStatement;
|
|
2219
5550
|
exports.FIXED_STRINGS = FIXED_STRINGS;
|
|
5551
|
+
exports.FunctionDeclaration = FunctionDeclaration;
|
|
2220
5552
|
exports.FunctionExpression = FunctionExpression;
|
|
2221
|
-
exports.INVALID_ANNOTATION_KEY = INVALID_ANNOTATION_KEY;
|
|
2222
5553
|
exports.Identifier = Identifier;
|
|
5554
|
+
exports.IfStatement = IfStatement$1;
|
|
2223
5555
|
exports.LOGLEVEL_DEBUG = LOGLEVEL_DEBUG;
|
|
2224
5556
|
exports.LOGLEVEL_ERROR = LOGLEVEL_ERROR;
|
|
2225
5557
|
exports.LOGLEVEL_INFO = LOGLEVEL_INFO;
|
|
@@ -2246,6 +5578,7 @@ exports.URL_OUTPUT_EXTERNALIMPORTATTRIBUTES = URL_OUTPUT_EXTERNALIMPORTATTRIBUTE
|
|
|
2246
5578
|
exports.URL_OUTPUT_FORMAT = URL_OUTPUT_FORMAT;
|
|
2247
5579
|
exports.URL_OUTPUT_GENERATEDCODE = URL_OUTPUT_GENERATEDCODE;
|
|
2248
5580
|
exports.URL_OUTPUT_GLOBALS = URL_OUTPUT_GLOBALS;
|
|
5581
|
+
exports.URL_OUTPUT_IMPORTATTRIBUTESKEY = URL_OUTPUT_IMPORTATTRIBUTESKEY;
|
|
2249
5582
|
exports.URL_OUTPUT_INLINEDYNAMICIMPORTS = URL_OUTPUT_INLINEDYNAMICIMPORTS;
|
|
2250
5583
|
exports.URL_OUTPUT_INTEROP = URL_OUTPUT_INTEROP;
|
|
2251
5584
|
exports.URL_OUTPUT_MANUALCHUNKS = URL_OUTPUT_MANUALCHUNKS;
|
|
@@ -2254,6 +5587,7 @@ exports.URL_OUTPUT_SOURCEMAPFILE = URL_OUTPUT_SOURCEMAPFILE;
|
|
|
2254
5587
|
exports.URL_PRESERVEENTRYSIGNATURES = URL_PRESERVEENTRYSIGNATURES;
|
|
2255
5588
|
exports.URL_SOURCEMAP_IS_LIKELY_TO_BE_INCORRECT = URL_SOURCEMAP_IS_LIKELY_TO_BE_INCORRECT;
|
|
2256
5589
|
exports.URL_THIS_IS_UNDEFINED = URL_THIS_IS_UNDEFINED;
|
|
5590
|
+
exports.URL_THIS_RESOLVE = URL_THIS_RESOLVE;
|
|
2257
5591
|
exports.URL_TRANSFORM = URL_TRANSFORM;
|
|
2258
5592
|
exports.URL_TREATING_MODULE_AS_EXTERNAL_DEPENDENCY = URL_TREATING_MODULE_AS_EXTERNAL_DEPENDENCY;
|
|
2259
5593
|
exports.URL_TREESHAKE = URL_TREESHAKE;
|
|
@@ -2264,7 +5598,9 @@ exports.addTrailingSlashIfMissed = addTrailingSlashIfMissed;
|
|
|
2264
5598
|
exports.augmentCodeLocation = augmentCodeLocation;
|
|
2265
5599
|
exports.augmentLogMessage = augmentLogMessage;
|
|
2266
5600
|
exports.convertAnnotations = convertAnnotations;
|
|
2267
|
-
exports.convertNode = convertNode;
|
|
5601
|
+
exports.convertNode = convertNode$1;
|
|
5602
|
+
exports.deserializeAst = deserializeAst;
|
|
5603
|
+
exports.deserializeLazyAst = deserializeLazyAst;
|
|
2268
5604
|
exports.error = error;
|
|
2269
5605
|
exports.getAliasName = getAliasName;
|
|
2270
5606
|
exports.getAstBuffer = getAstBuffer;
|
|
@@ -2279,6 +5615,7 @@ exports.locate = locate;
|
|
|
2279
5615
|
exports.logAddonNotGenerated = logAddonNotGenerated;
|
|
2280
5616
|
exports.logAlreadyClosed = logAlreadyClosed;
|
|
2281
5617
|
exports.logAmbiguousExternalNamespaces = logAmbiguousExternalNamespaces;
|
|
5618
|
+
exports.logAmbiguousGlobalName = logAmbiguousGlobalName;
|
|
2282
5619
|
exports.logAnonymousPluginCache = logAnonymousPluginCache;
|
|
2283
5620
|
exports.logAssetNotFinalisedForFileName = logAssetNotFinalisedForFileName;
|
|
2284
5621
|
exports.logAssetReferenceIdNotFoundForSetSource = logAssetReferenceIdNotFoundForSetSource;
|
|
@@ -2303,6 +5640,7 @@ exports.logDuplicateExportError = logDuplicateExportError;
|
|
|
2303
5640
|
exports.logDuplicateImportOptions = logDuplicateImportOptions;
|
|
2304
5641
|
exports.logDuplicatePluginName = logDuplicatePluginName;
|
|
2305
5642
|
exports.logEmptyChunk = logEmptyChunk;
|
|
5643
|
+
exports.logEmptyManualChunk = logEmptyManualChunk;
|
|
2306
5644
|
exports.logEntryCannotBeExternal = logEntryCannotBeExternal;
|
|
2307
5645
|
exports.logEval = logEval;
|
|
2308
5646
|
exports.logExternalModulesCannotBeIncludedInManualChunks = logExternalModulesCannotBeIncludedInManualChunks;
|
|
@@ -2321,7 +5659,6 @@ exports.logImplicitDependantIsNotIncluded = logImplicitDependantIsNotIncluded;
|
|
|
2321
5659
|
exports.logImportAttributeIsInvalid = logImportAttributeIsInvalid;
|
|
2322
5660
|
exports.logImportOptionsAreInvalid = logImportOptionsAreInvalid;
|
|
2323
5661
|
exports.logIncompatibleExportOptionValue = logIncompatibleExportOptionValue;
|
|
2324
|
-
exports.logInconsistentImportAttributes = logInconsistentImportAttributes;
|
|
2325
5662
|
exports.logInputHookInOutputPlugin = logInputHookInOutputPlugin;
|
|
2326
5663
|
exports.logInternalIdCannotBeExternal = logInternalIdCannotBeExternal;
|
|
2327
5664
|
exports.logInvalidAddonPluginHook = logInvalidAddonPluginHook;
|
|
@@ -2371,11 +5708,16 @@ exports.logUnresolvedImplicitDependant = logUnresolvedImplicitDependant;
|
|
|
2371
5708
|
exports.logUnresolvedImport = logUnresolvedImport;
|
|
2372
5709
|
exports.logUnresolvedImportTreatedAsExternal = logUnresolvedImportTreatedAsExternal;
|
|
2373
5710
|
exports.logUnusedExternalImports = logUnusedExternalImports;
|
|
5711
|
+
exports.nodeTypeStrings = nodeTypeStrings;
|
|
2374
5712
|
exports.normalize = normalize;
|
|
5713
|
+
exports.parseAndWalk = parseAndWalk;
|
|
2375
5714
|
exports.parseAst = parseAst;
|
|
2376
5715
|
exports.parseAstAsync = parseAstAsync;
|
|
5716
|
+
exports.parseLazyAst = parseLazyAst;
|
|
5717
|
+
exports.parseLazyAstAsync = parseLazyAstAsync;
|
|
2377
5718
|
exports.printQuotedStringList = printQuotedStringList;
|
|
2378
5719
|
exports.relative = relative;
|
|
2379
5720
|
exports.relativeId = relativeId;
|
|
5721
|
+
exports.serializeAst = serializeAst;
|
|
2380
5722
|
exports.warnDeprecation = warnDeprecation;
|
|
2381
5723
|
//# sourceMappingURL=parseAst.js.map
|