@rollup/wasm-node 4.11.0 → 4.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.11.0
4
- Thu, 15 Feb 2024 06:09:01 GMT - commit 90ad652b745c5fe7167d92b4ad671cc387577a99
3
+ Rollup.js v4.12.0
4
+ Fri, 16 Feb 2024 13:31:42 GMT - commit 0146b84be33a8416b4df4b9382549a7ca19dd64a
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -10,6 +10,20 @@
10
10
  import { parse, parseAsync } from '../../native.js';
11
11
  import { resolve, basename, extname, dirname } from 'node:path';
12
12
 
13
+ const ArrowFunctionExpression = 'ArrowFunctionExpression';
14
+ const BlockStatement = 'BlockStatement';
15
+ const CallExpression = 'CallExpression';
16
+ const CatchClause = 'CatchClause';
17
+ const ExpressionStatement = 'ExpressionStatement';
18
+ const Identifier = 'Identifier';
19
+ const Literal = 'Literal';
20
+ const PanicError = 'PanicError';
21
+ const ParseError = 'ParseError';
22
+ const Program = 'Program';
23
+ const Property = 'Property';
24
+ const ReturnStatement = 'ReturnStatement';
25
+ const TemplateLiteral = 'TemplateLiteral';
26
+
13
27
  const FIXED_STRINGS = [
14
28
  'var',
15
29
  'let',
@@ -73,6 +87,28 @@ const FIXED_STRINGS = [
73
87
  'noSideEffects'
74
88
  ];
75
89
 
90
+ const ANNOTATION_KEY = '_rollupAnnotations';
91
+ const INVALID_ANNOTATION_KEY = '_rollupRemoved';
92
+ const convertAnnotations = (position, buffer) => {
93
+ const length = buffer[position++];
94
+ const list = [];
95
+ for (let index = 0; index < length; index++) {
96
+ list.push(convertAnnotation(buffer[position++], buffer));
97
+ }
98
+ return list;
99
+ };
100
+ const convertAnnotation = (position, buffer) => {
101
+ const start = buffer[position++];
102
+ const end = buffer[position++];
103
+ const type = FIXED_STRINGS[buffer[position]];
104
+ return { end, start, type };
105
+ };
106
+ const convertString = (position, buffer, readString) => {
107
+ const length = buffer[position++];
108
+ const bytePosition = position << 2;
109
+ return readString(bytePosition, length);
110
+ };
111
+
76
112
  /** @typedef {import('./types').Location} Location */
77
113
 
78
114
  /**
@@ -333,11 +369,12 @@ const URL_TREESHAKE_MODULESIDEEFFECTS = 'configuration-options/#treeshake-module
333
369
  const URL_WATCH = 'configuration-options/#watch';
334
370
 
335
371
  function error(base) {
336
- if (!(base instanceof Error)) {
337
- base = Object.assign(new Error(base.message), base);
338
- Object.defineProperty(base, 'name', { value: 'RollupError', writable: true });
339
- }
340
- throw base;
372
+ throw base instanceof Error ? base : getRollupEror(base);
373
+ }
374
+ function getRollupEror(base) {
375
+ const errorInstance = Object.assign(new Error(base.message), base);
376
+ Object.defineProperty(errorInstance, 'name', { value: 'RollupError', writable: true });
377
+ return errorInstance;
341
378
  }
342
379
  function augmentCodeLocation(properties, pos, source, id) {
343
380
  if (typeof pos === 'object') {
@@ -965,21 +1002,43 @@ function warnDeprecationWithOptions(deprecation, urlSnippet, activeDeprecation,
965
1002
 
966
1003
  // This file is generated by scripts/generate-ast-converters.js.
967
1004
  // Do not edit this file directly.
968
- const ANNOTATION_KEY = '_rollupAnnotations';
969
- const INVALID_ANNOTATION_KEY = '_rollupRemoved';
970
1005
  function convertProgram(buffer, readString) {
971
- return convertNode(0, new Uint32Array(buffer), readString);
1006
+ const node = convertNode(0, new Uint32Array(buffer), readString);
1007
+ switch (node.type) {
1008
+ case PanicError: {
1009
+ return error(getRollupEror(logParseError(node.message)));
1010
+ }
1011
+ case ParseError: {
1012
+ return error(getRollupEror(logParseError(node.message, node.start)));
1013
+ }
1014
+ default: {
1015
+ return node;
1016
+ }
1017
+ }
972
1018
  }
973
1019
  /* eslint-disable sort-keys */
974
1020
  const nodeConverters = [
975
- function parseError(position, buffer, readString) {
976
- const pos = buffer[position++];
1021
+ function panicError(position, buffer, readString) {
1022
+ const start = buffer[position++];
1023
+ const end = buffer[position++];
977
1024
  const message = convertString(position, buffer, readString);
978
- error(logParseError(message, pos));
1025
+ return {
1026
+ type: 'PanicError',
1027
+ start,
1028
+ end,
1029
+ message
1030
+ };
979
1031
  },
980
- function panicError(position, buffer, readString) {
1032
+ function parseError(position, buffer, readString) {
1033
+ const start = buffer[position++];
1034
+ const end = buffer[position++];
981
1035
  const message = convertString(position, buffer, readString);
982
- error(logParseError(message));
1036
+ return {
1037
+ type: 'ParseError',
1038
+ start,
1039
+ end,
1040
+ message
1041
+ };
983
1042
  },
984
1043
  function arrayExpression(position, buffer, readString) {
985
1044
  const start = buffer[position++];
@@ -1680,8 +1739,8 @@ const nodeConverters = [
1680
1739
  const start = buffer[position++];
1681
1740
  const end = buffer[position++];
1682
1741
  const flags = buffer[position++];
1683
- const computed = (flags & 1) === 1;
1684
- const isStatic = (flags & 2) === 2;
1742
+ const isStatic = (flags & 1) === 1;
1743
+ const computed = (flags & 2) === 2;
1685
1744
  const value = convertNode(buffer[position++], buffer, readString);
1686
1745
  const kind = FIXED_STRINGS[buffer[position++]];
1687
1746
  const key = convertNode(position, buffer, readString);
@@ -1689,8 +1748,8 @@ const nodeConverters = [
1689
1748
  type: 'MethodDefinition',
1690
1749
  start,
1691
1750
  end,
1692
- computed,
1693
1751
  static: isStatic,
1752
+ computed,
1694
1753
  key,
1695
1754
  value,
1696
1755
  kind
@@ -1747,14 +1806,14 @@ const nodeConverters = [
1747
1806
  function program(position, buffer, readString) {
1748
1807
  const start = buffer[position++];
1749
1808
  const end = buffer[position++];
1750
- const annotations = convertAnnotations(buffer[position++], buffer);
1809
+ const invalidAnnotations = convertAnnotations(buffer[position++], buffer);
1751
1810
  const body = convertNodeList(position, buffer, readString);
1752
1811
  return {
1753
1812
  type: 'Program',
1754
1813
  start,
1755
1814
  end,
1756
1815
  body,
1757
- ...(annotations.length > 0 ? { [INVALID_ANNOTATION_KEY]: annotations } : {}),
1816
+ ...(invalidAnnotations.length > 0 ? { [INVALID_ANNOTATION_KEY]: invalidAnnotations } : {}),
1758
1817
  sourceType: 'module'
1759
1818
  };
1760
1819
  },
@@ -1784,8 +1843,8 @@ const nodeConverters = [
1784
1843
  const start = buffer[position++];
1785
1844
  const end = buffer[position++];
1786
1845
  const flags = buffer[position++];
1787
- const computed = (flags & 1) === 1;
1788
- const isStatic = (flags & 2) === 2;
1846
+ const isStatic = (flags & 1) === 1;
1847
+ const computed = (flags & 2) === 2;
1789
1848
  const valuePosition = buffer[position++];
1790
1849
  const value = valuePosition === 0 ? null : convertNode(valuePosition, buffer, readString);
1791
1850
  const key = convertNode(position, buffer, readString);
@@ -1793,8 +1852,8 @@ const nodeConverters = [
1793
1852
  type: 'PropertyDefinition',
1794
1853
  start,
1795
1854
  end,
1796
- computed,
1797
1855
  static: isStatic,
1856
+ computed,
1798
1857
  key,
1799
1858
  value
1800
1859
  };
@@ -2075,25 +2134,6 @@ function convertNodeList(position, buffer, readString) {
2075
2134
  }
2076
2135
  return list;
2077
2136
  }
2078
- const convertAnnotations = (position, buffer) => {
2079
- const length = buffer[position++];
2080
- const list = [];
2081
- for (let index = 0; index < length; index++) {
2082
- list.push(convertAnnotation(buffer[position++], buffer));
2083
- }
2084
- return list;
2085
- };
2086
- const convertAnnotation = (position, buffer) => {
2087
- const start = buffer[position++];
2088
- const end = buffer[position++];
2089
- const type = FIXED_STRINGS[buffer[position]];
2090
- return { end, start, type };
2091
- };
2092
- const convertString = (position, buffer, readString) => {
2093
- const length = buffer[position++];
2094
- const bytePosition = position << 2;
2095
- return readString(bytePosition, length);
2096
- };
2097
2137
 
2098
2138
  function getReadStringFunction(astBuffer) {
2099
2139
  if (typeof Buffer !== 'undefined' && astBuffer instanceof Buffer) {
@@ -2118,4 +2158,4 @@ const parseAstAsync = async (input, { allowReturnOutsideFunction = false, signal
2118
2158
  return convertProgram(astBuffer.buffer, getReadStringFunction(astBuffer));
2119
2159
  };
2120
2160
 
2121
- export { ANNOTATION_KEY, INVALID_ANNOTATION_KEY, LOGLEVEL_DEBUG, LOGLEVEL_ERROR, LOGLEVEL_INFO, LOGLEVEL_WARN, URL_OUTPUT_AMD_BASEPATH, URL_OUTPUT_AMD_ID, URL_OUTPUT_DIR, URL_OUTPUT_EXTERNALIMPORTATTRIBUTES, URL_OUTPUT_FORMAT, URL_OUTPUT_GENERATEDCODE, URL_OUTPUT_INLINEDYNAMICIMPORTS, URL_OUTPUT_INTEROP, URL_OUTPUT_MANUALCHUNKS, URL_OUTPUT_SOURCEMAPBASEURL, URL_OUTPUT_SOURCEMAPFILE, URL_PRESERVEENTRYSIGNATURES, URL_TREESHAKE, URL_TREESHAKE_MODULESIDEEFFECTS, URL_WATCH, addTrailingSlashIfMissed, augmentCodeLocation, error, getAliasName, getImportPath, isAbsolute, isPathFragment, isRelative, isValidUrl, locate, logAddonNotGenerated, logAlreadyClosed, logAmbiguousExternalNamespaces, logAnonymousPluginCache, logAssetNotFinalisedForFileName, logAssetReferenceIdNotFoundForSetSource, logAssetSourceAlreadySet, logBadLoader, logCannotAssignModuleToChunk, logCannotCallNamespace, logCannotEmitFromOptionsHook, logChunkInvalid, logChunkNotGeneratedForFileName, logCircularDependency, logCircularReexport, logConflictingSourcemapSources, logConstVariableReassignError, logCyclicCrossChunkReexport, logDuplicateArgumentNameError, logDuplicateExportError, logDuplicatePluginName, logEmptyChunk, logEntryCannotBeExternal, logEval, logExternalModulesCannotBeIncludedInManualChunks, logExternalModulesCannotBeTransformedToModules, logExternalSyntheticExports, logFailedValidation, logFileNameConflict, logFileReferenceIdNotFoundForFilename, logFirstSideEffect, logIllegalIdentifierAsName, logIllegalImportReassignment, logImplicitDependantCannotBeExternal, logImplicitDependantIsNotIncluded, logImportAttributeIsInvalid, logImportOptionsAreInvalid, logIncompatibleExportOptionValue, logInconsistentImportAttributes, logInputHookInOutputPlugin, logInternalIdCannotBeExternal, logInvalidAddonPluginHook, logInvalidAnnotation, logInvalidExportOptionValue, logInvalidFormatForTopLevelAwait, logInvalidFunctionPluginHook, logInvalidLogPosition, logInvalidOption, logInvalidRollupPhaseForChunkEmission, logInvalidSetAssetSourceCall, logInvalidSourcemapForError, logLevelPriority, logMissingEntryExport, logMissingExport, logMissingFileOrDirOption, logMissingGlobalName, logMissingNameOptionForIifeExport, logMissingNameOptionForUmdExport, logMissingNodeBuiltins, logMixedExport, logModuleLevelDirective, logModuleParseError, logNamespaceConflict, logNoAssetSourceSet, logNoTransformMapOrAstWithoutCode, logOptimizeChunkStatus, logPluginError, logRedeclarationError, logShimmedExport, logSourcemapBroken, logSyntheticNamedExportsNeedNamespaceExport, logThisIsUndefined, logUnexpectedNamedImport, logUnexpectedNamespaceReexport, logUnknownOption, logUnresolvedEntry, logUnresolvedImplicitDependant, logUnresolvedImport, logUnresolvedImportTreatedAsExternal, logUnusedExternalImports, normalize, parseAst, parseAstAsync, printQuotedStringList, relative, relativeId, warnDeprecation };
2161
+ export { ANNOTATION_KEY, ArrowFunctionExpression, BlockStatement, CallExpression, CatchClause, ExpressionStatement, FIXED_STRINGS, INVALID_ANNOTATION_KEY, Identifier, LOGLEVEL_DEBUG, LOGLEVEL_ERROR, LOGLEVEL_INFO, LOGLEVEL_WARN, Literal, Program, Property, ReturnStatement, TemplateLiteral, URL_OUTPUT_AMD_BASEPATH, URL_OUTPUT_AMD_ID, URL_OUTPUT_DIR, URL_OUTPUT_EXTERNALIMPORTATTRIBUTES, URL_OUTPUT_FORMAT, URL_OUTPUT_GENERATEDCODE, URL_OUTPUT_INLINEDYNAMICIMPORTS, URL_OUTPUT_INTEROP, URL_OUTPUT_MANUALCHUNKS, URL_OUTPUT_SOURCEMAPBASEURL, URL_OUTPUT_SOURCEMAPFILE, URL_PRESERVEENTRYSIGNATURES, URL_TREESHAKE, URL_TREESHAKE_MODULESIDEEFFECTS, URL_WATCH, addTrailingSlashIfMissed, augmentCodeLocation, convertAnnotations, convertNode, convertString, error, getAliasName, getImportPath, getReadStringFunction, getRollupEror, isAbsolute, isPathFragment, isRelative, isValidUrl, locate, logAddonNotGenerated, logAlreadyClosed, logAmbiguousExternalNamespaces, logAnonymousPluginCache, logAssetNotFinalisedForFileName, logAssetReferenceIdNotFoundForSetSource, logAssetSourceAlreadySet, logBadLoader, logCannotAssignModuleToChunk, logCannotCallNamespace, logCannotEmitFromOptionsHook, logChunkInvalid, logChunkNotGeneratedForFileName, logCircularDependency, logCircularReexport, logConflictingSourcemapSources, logConstVariableReassignError, logCyclicCrossChunkReexport, logDuplicateArgumentNameError, logDuplicateExportError, logDuplicatePluginName, logEmptyChunk, logEntryCannotBeExternal, logEval, logExternalModulesCannotBeIncludedInManualChunks, logExternalModulesCannotBeTransformedToModules, logExternalSyntheticExports, logFailedValidation, logFileNameConflict, logFileReferenceIdNotFoundForFilename, logFirstSideEffect, logIllegalIdentifierAsName, logIllegalImportReassignment, logImplicitDependantCannotBeExternal, logImplicitDependantIsNotIncluded, logImportAttributeIsInvalid, logImportOptionsAreInvalid, logIncompatibleExportOptionValue, logInconsistentImportAttributes, logInputHookInOutputPlugin, logInternalIdCannotBeExternal, logInvalidAddonPluginHook, logInvalidAnnotation, logInvalidExportOptionValue, logInvalidFormatForTopLevelAwait, logInvalidFunctionPluginHook, logInvalidLogPosition, logInvalidOption, logInvalidRollupPhaseForChunkEmission, logInvalidSetAssetSourceCall, logInvalidSourcemapForError, logLevelPriority, logMissingEntryExport, logMissingExport, logMissingFileOrDirOption, logMissingGlobalName, logMissingNameOptionForIifeExport, logMissingNameOptionForUmdExport, logMissingNodeBuiltins, logMixedExport, logModuleLevelDirective, logModuleParseError, logNamespaceConflict, logNoAssetSourceSet, logNoTransformMapOrAstWithoutCode, logOptimizeChunkStatus, logParseError, logPluginError, logRedeclarationError, logShimmedExport, logSourcemapBroken, logSyntheticNamedExportsNeedNamespaceExport, logThisIsUndefined, logUnexpectedNamedImport, logUnexpectedNamespaceReexport, logUnknownOption, logUnresolvedEntry, logUnresolvedImplicitDependant, logUnresolvedImport, logUnresolvedImportTreatedAsExternal, logUnusedExternalImports, normalize, parseAst, parseAstAsync, printQuotedStringList, relative, relativeId, warnDeprecation };
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.11.0
4
- Thu, 15 Feb 2024 06:09:01 GMT - commit 90ad652b745c5fe7167d92b4ad671cc387577a99
3
+ Rollup.js v4.12.0
4
+ Fri, 16 Feb 2024 13:31:42 GMT - commit 0146b84be33a8416b4df4b9382549a7ca19dd64a
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.11.0
4
- Thu, 15 Feb 2024 06:09:01 GMT - commit 90ad652b745c5fe7167d92b4ad671cc387577a99
3
+ Rollup.js v4.12.0
4
+ Fri, 16 Feb 2024 13:31:42 GMT - commit 0146b84be33a8416b4df4b9382549a7ca19dd64a
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.11.0
4
- Thu, 15 Feb 2024 06:09:01 GMT - commit 90ad652b745c5fe7167d92b4ad671cc387577a99
3
+ Rollup.js v4.12.0
4
+ Fri, 16 Feb 2024 13:31:42 GMT - commit 0146b84be33a8416b4df4b9382549a7ca19dd64a
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -20,8 +20,8 @@ require('./shared/parseAst.js');
20
20
  const loadConfigFile_js = require('./shared/loadConfigFile.js');
21
21
  require('tty');
22
22
  require('path');
23
- require('node:perf_hooks');
24
23
  require('./native.js');
24
+ require('node:perf_hooks');
25
25
  require('./getLogFilter.js');
26
26
 
27
27
 
package/dist/parseAst.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.11.0
4
- Thu, 15 Feb 2024 06:09:01 GMT - commit 90ad652b745c5fe7167d92b4ad671cc387577a99
3
+ Rollup.js v4.12.0
4
+ Fri, 16 Feb 2024 13:31:42 GMT - commit 0146b84be33a8416b4df4b9382549a7ca19dd64a
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/dist/rollup.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Program } from 'estree';
1
+ import type { Node as EstreeNode, Program } from 'estree';
2
2
 
3
3
  export const VERSION: string;
4
4
 
@@ -979,13 +979,22 @@ export type RollupWatcher = AwaitingEventEmitter<{
979
979
 
980
980
  export function watch(config: RollupWatchOptions | RollupWatchOptions[]): RollupWatcher;
981
981
 
982
- interface AstNode {
982
+ interface AstNodeLocation {
983
983
  end: number;
984
984
  start: number;
985
- type: string;
986
985
  }
987
986
 
988
- type ProgramNode = Program & AstNode;
987
+ type OmittedEstreeKeys =
988
+ | 'loc'
989
+ | 'range'
990
+ | 'leadingComments'
991
+ | 'trailingComments'
992
+ | 'innerComments'
993
+ | 'comments';
994
+ type RollupAstNode<T> = Omit<T, OmittedEstreeKeys> & AstNodeLocation;
995
+
996
+ type ProgramNode = RollupAstNode<Program>;
997
+ export type AstNode = RollupAstNode<EstreeNode>;
989
998
 
990
999
  export function defineConfig(options: RollupOptions): RollupOptions;
991
1000
  export function defineConfig(options: RollupOptions[]): RollupOptions[];
package/dist/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.11.0
4
- Thu, 15 Feb 2024 06:09:01 GMT - commit 90ad652b745c5fe7167d92b4ad671cc387577a99
3
+ Rollup.js v4.12.0
4
+ Fri, 16 Feb 2024 13:31:42 GMT - commit 0146b84be33a8416b4df4b9382549a7ca19dd64a
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -18,8 +18,8 @@ require('node:process');
18
18
  require('tty');
19
19
  require('node:path');
20
20
  require('path');
21
- require('node:perf_hooks');
22
21
  require('./native.js');
22
+ require('node:perf_hooks');
23
23
  require('node:fs/promises');
24
24
 
25
25
  class WatchEmitter {
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.11.0
4
- Thu, 15 Feb 2024 06:09:01 GMT - commit 90ad652b745c5fe7167d92b4ad671cc387577a99
3
+ Rollup.js v4.12.0
4
+ Fri, 16 Feb 2024 13:31:42 GMT - commit 0146b84be33a8416b4df4b9382549a7ca19dd64a
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.11.0
4
- Thu, 15 Feb 2024 06:09:01 GMT - commit 90ad652b745c5fe7167d92b4ad671cc387577a99
3
+ Rollup.js v4.12.0
4
+ Fri, 16 Feb 2024 13:31:42 GMT - commit 0146b84be33a8416b4df4b9382549a7ca19dd64a
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.11.0
4
- Thu, 15 Feb 2024 06:09:01 GMT - commit 90ad652b745c5fe7167d92b4ad671cc387577a99
3
+ Rollup.js v4.12.0
4
+ Fri, 16 Feb 2024 13:31:42 GMT - commit 0146b84be33a8416b4df4b9382549a7ca19dd64a
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.11.0
4
- Thu, 15 Feb 2024 06:09:01 GMT - commit 90ad652b745c5fe7167d92b4ad671cc387577a99
3
+ Rollup.js v4.12.0
4
+ Fri, 16 Feb 2024 13:31:42 GMT - commit 0146b84be33a8416b4df4b9382549a7ca19dd64a
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -275,11 +275,12 @@ const URL_BUNDLE_CONFIG_AS_CJS = 'command-line-interface/#bundleconfigascjs';
275
275
  const URL_CONFIGURATION_FILES = 'command-line-interface/#configuration-files';
276
276
 
277
277
  function error(base) {
278
- if (!(base instanceof Error)) {
279
- base = Object.assign(new Error(base.message), base);
280
- Object.defineProperty(base, 'name', { value: 'RollupError', writable: true });
281
- }
282
- throw base;
278
+ throw base instanceof Error ? base : getRollupEror(base);
279
+ }
280
+ function getRollupEror(base) {
281
+ const errorInstance = Object.assign(new Error(base.message), base);
282
+ Object.defineProperty(errorInstance, 'name', { value: 'RollupError', writable: true });
283
+ return errorInstance;
283
284
  }
284
285
  function augmentCodeLocation(properties, pos, source, id) {
285
286
  if (typeof pos === 'object') {
@@ -963,6 +964,20 @@ function warnDeprecationWithOptions(deprecation, urlSnippet, activeDeprecation,
963
964
  }
964
965
  }
965
966
 
967
+ const ArrowFunctionExpression = 'ArrowFunctionExpression';
968
+ const BlockStatement = 'BlockStatement';
969
+ const CallExpression = 'CallExpression';
970
+ const CatchClause = 'CatchClause';
971
+ const ExpressionStatement = 'ExpressionStatement';
972
+ const Identifier = 'Identifier';
973
+ const Literal = 'Literal';
974
+ const PanicError = 'PanicError';
975
+ const ParseError = 'ParseError';
976
+ const Program = 'Program';
977
+ const Property = 'Property';
978
+ const ReturnStatement = 'ReturnStatement';
979
+ const TemplateLiteral = 'TemplateLiteral';
980
+
966
981
  const FIXED_STRINGS = [
967
982
  'var',
968
983
  'let',
@@ -1026,23 +1041,67 @@ const FIXED_STRINGS = [
1026
1041
  'noSideEffects'
1027
1042
  ];
1028
1043
 
1029
- // This file is generated by scripts/generate-ast-converters.js.
1030
- // Do not edit this file directly.
1031
1044
  const ANNOTATION_KEY = '_rollupAnnotations';
1032
1045
  const INVALID_ANNOTATION_KEY = '_rollupRemoved';
1046
+ const convertAnnotations = (position, buffer) => {
1047
+ const length = buffer[position++];
1048
+ const list = [];
1049
+ for (let index = 0; index < length; index++) {
1050
+ list.push(convertAnnotation(buffer[position++], buffer));
1051
+ }
1052
+ return list;
1053
+ };
1054
+ const convertAnnotation = (position, buffer) => {
1055
+ const start = buffer[position++];
1056
+ const end = buffer[position++];
1057
+ const type = FIXED_STRINGS[buffer[position]];
1058
+ return { end, start, type };
1059
+ };
1060
+ const convertString = (position, buffer, readString) => {
1061
+ const length = buffer[position++];
1062
+ const bytePosition = position << 2;
1063
+ return readString(bytePosition, length);
1064
+ };
1065
+
1066
+ // This file is generated by scripts/generate-ast-converters.js.
1067
+ // Do not edit this file directly.
1033
1068
  function convertProgram(buffer, readString) {
1034
- return convertNode(0, new Uint32Array(buffer), readString);
1069
+ const node = convertNode(0, new Uint32Array(buffer), readString);
1070
+ switch (node.type) {
1071
+ case PanicError: {
1072
+ return error(getRollupEror(logParseError(node.message)));
1073
+ }
1074
+ case ParseError: {
1075
+ return error(getRollupEror(logParseError(node.message, node.start)));
1076
+ }
1077
+ default: {
1078
+ return node;
1079
+ }
1080
+ }
1035
1081
  }
1036
1082
  /* eslint-disable sort-keys */
1037
1083
  const nodeConverters = [
1038
- function parseError(position, buffer, readString) {
1039
- const pos = buffer[position++];
1084
+ function panicError(position, buffer, readString) {
1085
+ const start = buffer[position++];
1086
+ const end = buffer[position++];
1040
1087
  const message = convertString(position, buffer, readString);
1041
- error(logParseError(message, pos));
1088
+ return {
1089
+ type: 'PanicError',
1090
+ start,
1091
+ end,
1092
+ message
1093
+ };
1042
1094
  },
1043
- function panicError(position, buffer, readString) {
1095
+ function parseError(position, buffer, readString) {
1096
+ const start = buffer[position++];
1097
+ const end = buffer[position++];
1044
1098
  const message = convertString(position, buffer, readString);
1045
- error(logParseError(message));
1099
+ return {
1100
+ type: 'ParseError',
1101
+ start,
1102
+ end,
1103
+ message
1104
+ };
1046
1105
  },
1047
1106
  function arrayExpression(position, buffer, readString) {
1048
1107
  const start = buffer[position++];
@@ -1743,8 +1802,8 @@ const nodeConverters = [
1743
1802
  const start = buffer[position++];
1744
1803
  const end = buffer[position++];
1745
1804
  const flags = buffer[position++];
1746
- const computed = (flags & 1) === 1;
1747
- const isStatic = (flags & 2) === 2;
1805
+ const isStatic = (flags & 1) === 1;
1806
+ const computed = (flags & 2) === 2;
1748
1807
  const value = convertNode(buffer[position++], buffer, readString);
1749
1808
  const kind = FIXED_STRINGS[buffer[position++]];
1750
1809
  const key = convertNode(position, buffer, readString);
@@ -1752,8 +1811,8 @@ const nodeConverters = [
1752
1811
  type: 'MethodDefinition',
1753
1812
  start,
1754
1813
  end,
1755
- computed,
1756
1814
  static: isStatic,
1815
+ computed,
1757
1816
  key,
1758
1817
  value,
1759
1818
  kind
@@ -1810,14 +1869,14 @@ const nodeConverters = [
1810
1869
  function program(position, buffer, readString) {
1811
1870
  const start = buffer[position++];
1812
1871
  const end = buffer[position++];
1813
- const annotations = convertAnnotations(buffer[position++], buffer);
1872
+ const invalidAnnotations = convertAnnotations(buffer[position++], buffer);
1814
1873
  const body = convertNodeList(position, buffer, readString);
1815
1874
  return {
1816
1875
  type: 'Program',
1817
1876
  start,
1818
1877
  end,
1819
1878
  body,
1820
- ...(annotations.length > 0 ? { [INVALID_ANNOTATION_KEY]: annotations } : {}),
1879
+ ...(invalidAnnotations.length > 0 ? { [INVALID_ANNOTATION_KEY]: invalidAnnotations } : {}),
1821
1880
  sourceType: 'module'
1822
1881
  };
1823
1882
  },
@@ -1847,8 +1906,8 @@ const nodeConverters = [
1847
1906
  const start = buffer[position++];
1848
1907
  const end = buffer[position++];
1849
1908
  const flags = buffer[position++];
1850
- const computed = (flags & 1) === 1;
1851
- const isStatic = (flags & 2) === 2;
1909
+ const isStatic = (flags & 1) === 1;
1910
+ const computed = (flags & 2) === 2;
1852
1911
  const valuePosition = buffer[position++];
1853
1912
  const value = valuePosition === 0 ? null : convertNode(valuePosition, buffer, readString);
1854
1913
  const key = convertNode(position, buffer, readString);
@@ -1856,8 +1915,8 @@ const nodeConverters = [
1856
1915
  type: 'PropertyDefinition',
1857
1916
  start,
1858
1917
  end,
1859
- computed,
1860
1918
  static: isStatic,
1919
+ computed,
1861
1920
  key,
1862
1921
  value
1863
1922
  };
@@ -2138,25 +2197,6 @@ function convertNodeList(position, buffer, readString) {
2138
2197
  }
2139
2198
  return list;
2140
2199
  }
2141
- const convertAnnotations = (position, buffer) => {
2142
- const length = buffer[position++];
2143
- const list = [];
2144
- for (let index = 0; index < length; index++) {
2145
- list.push(convertAnnotation(buffer[position++], buffer));
2146
- }
2147
- return list;
2148
- };
2149
- const convertAnnotation = (position, buffer) => {
2150
- const start = buffer[position++];
2151
- const end = buffer[position++];
2152
- const type = FIXED_STRINGS[buffer[position]];
2153
- return { end, start, type };
2154
- };
2155
- const convertString = (position, buffer, readString) => {
2156
- const length = buffer[position++];
2157
- const bytePosition = position << 2;
2158
- return readString(bytePosition, length);
2159
- };
2160
2200
 
2161
2201
  function getReadStringFunction(astBuffer) {
2162
2202
  if (typeof Buffer !== 'undefined' && astBuffer instanceof Buffer) {
@@ -2182,11 +2222,23 @@ const parseAstAsync = async (input, { allowReturnOutsideFunction = false, signal
2182
2222
  };
2183
2223
 
2184
2224
  exports.ANNOTATION_KEY = ANNOTATION_KEY;
2225
+ exports.ArrowFunctionExpression = ArrowFunctionExpression;
2226
+ exports.BlockStatement = BlockStatement;
2227
+ exports.CallExpression = CallExpression;
2228
+ exports.CatchClause = CatchClause;
2229
+ exports.ExpressionStatement = ExpressionStatement;
2230
+ exports.FIXED_STRINGS = FIXED_STRINGS;
2185
2231
  exports.INVALID_ANNOTATION_KEY = INVALID_ANNOTATION_KEY;
2232
+ exports.Identifier = Identifier;
2186
2233
  exports.LOGLEVEL_DEBUG = LOGLEVEL_DEBUG;
2187
2234
  exports.LOGLEVEL_ERROR = LOGLEVEL_ERROR;
2188
2235
  exports.LOGLEVEL_INFO = LOGLEVEL_INFO;
2189
2236
  exports.LOGLEVEL_WARN = LOGLEVEL_WARN;
2237
+ exports.Literal = Literal;
2238
+ exports.Program = Program;
2239
+ exports.Property = Property;
2240
+ exports.ReturnStatement = ReturnStatement;
2241
+ exports.TemplateLiteral = TemplateLiteral;
2190
2242
  exports.URL_AVOIDING_EVAL = URL_AVOIDING_EVAL;
2191
2243
  exports.URL_NAME_IS_NOT_EXPORTED = URL_NAME_IS_NOT_EXPORTED;
2192
2244
  exports.URL_OUTPUT_AMD_BASEPATH = URL_OUTPUT_AMD_BASEPATH;
@@ -2211,9 +2263,14 @@ exports.URL_TREESHAKE_MODULESIDEEFFECTS = URL_TREESHAKE_MODULESIDEEFFECTS;
2211
2263
  exports.URL_WATCH = URL_WATCH;
2212
2264
  exports.addTrailingSlashIfMissed = addTrailingSlashIfMissed;
2213
2265
  exports.augmentCodeLocation = augmentCodeLocation;
2266
+ exports.convertAnnotations = convertAnnotations;
2267
+ exports.convertNode = convertNode;
2268
+ exports.convertString = convertString;
2214
2269
  exports.error = error;
2215
2270
  exports.getAliasName = getAliasName;
2216
2271
  exports.getImportPath = getImportPath;
2272
+ exports.getReadStringFunction = getReadStringFunction;
2273
+ exports.getRollupEror = getRollupEror;
2217
2274
  exports.getRollupUrl = getRollupUrl;
2218
2275
  exports.isAbsolute = isAbsolute;
2219
2276
  exports.isPathFragment = isPathFragment;
@@ -2294,6 +2351,7 @@ exports.logNoAssetSourceSet = logNoAssetSourceSet;
2294
2351
  exports.logNoTransformMapOrAstWithoutCode = logNoTransformMapOrAstWithoutCode;
2295
2352
  exports.logOnlyInlineSourcemapsForStdout = logOnlyInlineSourcemapsForStdout;
2296
2353
  exports.logOptimizeChunkStatus = logOptimizeChunkStatus;
2354
+ exports.logParseError = logParseError;
2297
2355
  exports.logPluginError = logPluginError;
2298
2356
  exports.logRedeclarationError = logRedeclarationError;
2299
2357
  exports.logShimmedExport = logShimmedExport;