source: node_modules/rollup/dist/shared/parseAst.js

Last change on this file was 57e58a3, checked in by ste08 <sjovanoska@…>, 4 months ago

Initial commit

  • Property mode set to 100644
File size: 89.9 KB
Line 
1/*
2 @license
3 Rollup.js v4.34.4
4 Wed, 05 Feb 2025 21:30:40 GMT - commit 19312a762c3cda56a0f6dc80a0887a4499db2257
5
6 https://github.com/rollup/rollup
7
8 Released under the MIT License.
9*/
10'use strict';
11
12const native_js = require('../native.js');
13const path = require('node:path');
14
15/** @typedef {import('./types').Location} Location */
16
17/**
18 * @param {import('./types').Range} range
19 * @param {number} index
20 */
21function rangeContains(range, index) {
22 return range.start <= index && index < range.end;
23}
24
25/**
26 * @param {string} source
27 * @param {import('./types').Options} [options]
28 */
29function getLocator(source, options = {}) {
30 const { offsetLine = 0, offsetColumn = 0 } = options;
31
32 let start = 0;
33 const ranges = source.split('\n').map((line, i) => {
34 const end = start + line.length + 1;
35
36 /** @type {import('./types').Range} */
37 const range = { start, end, line: i };
38
39 start = end;
40 return range;
41 });
42
43 let i = 0;
44
45 /**
46 * @param {string | number} search
47 * @param {number} [index]
48 * @returns {Location | undefined}
49 */
50 function locator(search, index) {
51 if (typeof search === 'string') {
52 search = source.indexOf(search, index ?? 0);
53 }
54
55 if (search === -1) return undefined;
56
57 let range = ranges[i];
58
59 const d = search >= range.end ? 1 : -1;
60
61 while (range) {
62 if (rangeContains(range, search)) {
63 return {
64 line: offsetLine + range.line,
65 column: offsetColumn + search - range.start,
66 character: search
67 };
68 }
69
70 i += d;
71 range = ranges[i];
72 }
73 }
74
75 return locator;
76}
77
78/**
79 * @param {string} source
80 * @param {string | number} search
81 * @param {import('./types').Options} [options]
82 * @returns {Location | undefined}
83 */
84function locate(source, search, options) {
85 return getLocator(source, options)(search, options && options.startIndex);
86}
87
88function spaces(index) {
89 let result = '';
90 while (index--)
91 result += ' ';
92 return result;
93}
94function tabsToSpaces(value) {
95 return value.replace(/^\t+/, match => match.split('\t').join(' '));
96}
97const LINE_TRUNCATE_LENGTH = 120;
98const MIN_CHARACTERS_SHOWN_AFTER_LOCATION = 10;
99const ELLIPSIS = '...';
100function getCodeFrame(source, line, column) {
101 let lines = source.split('\n');
102 // Needed if a plugin did not generate correct sourcemaps
103 if (line > lines.length)
104 return '';
105 const maxLineLength = Math.max(tabsToSpaces(lines[line - 1].slice(0, column)).length +
106 MIN_CHARACTERS_SHOWN_AFTER_LOCATION +
107 ELLIPSIS.length, LINE_TRUNCATE_LENGTH);
108 const frameStart = Math.max(0, line - 3);
109 let frameEnd = Math.min(line + 2, lines.length);
110 lines = lines.slice(frameStart, frameEnd);
111 while (!/\S/.test(lines[lines.length - 1])) {
112 lines.pop();
113 frameEnd -= 1;
114 }
115 const digits = String(frameEnd).length;
116 return lines
117 .map((sourceLine, index) => {
118 const isErrorLine = frameStart + index + 1 === line;
119 let lineNumber = String(index + frameStart + 1);
120 while (lineNumber.length < digits)
121 lineNumber = ` ${lineNumber}`;
122 let displayedLine = tabsToSpaces(sourceLine);
123 if (displayedLine.length > maxLineLength) {
124 displayedLine = `${displayedLine.slice(0, maxLineLength - ELLIPSIS.length)}${ELLIPSIS}`;
125 }
126 if (isErrorLine) {
127 const indicator = spaces(digits + 2 + tabsToSpaces(sourceLine.slice(0, column)).length) + '^';
128 return `${lineNumber}: ${displayedLine}\n${indicator}`;
129 }
130 return `${lineNumber}: ${displayedLine}`;
131 })
132 .join('\n');
133}
134
135const LOGLEVEL_SILENT = 'silent';
136const LOGLEVEL_ERROR = 'error';
137const LOGLEVEL_WARN = 'warn';
138const LOGLEVEL_INFO = 'info';
139const LOGLEVEL_DEBUG = 'debug';
140const logLevelPriority = {
141 [LOGLEVEL_DEBUG]: 0,
142 [LOGLEVEL_INFO]: 1,
143 [LOGLEVEL_SILENT]: 3,
144 [LOGLEVEL_WARN]: 2
145};
146
147const ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Za-z]:)?[/\\|])/;
148const RELATIVE_PATH_REGEX = /^\.?\.(\/|$)/;
149function isAbsolute(path) {
150 return ABSOLUTE_PATH_REGEX.test(path);
151}
152function isRelative(path) {
153 return RELATIVE_PATH_REGEX.test(path);
154}
155const BACKSLASH_REGEX = /\\/g;
156function normalize(path) {
157 return path.replace(BACKSLASH_REGEX, '/');
158}
159
160function printQuotedStringList(list, verbs) {
161 const isSingleItem = list.length <= 1;
162 const quotedList = list.map(item => `"${item}"`);
163 let output = isSingleItem
164 ? quotedList[0]
165 : `${quotedList.slice(0, -1).join(', ')} and ${quotedList.slice(-1)[0]}`;
166 if (verbs) {
167 output += ` ${isSingleItem ? verbs[0] : verbs[1]}`;
168 }
169 return output;
170}
171
172const ANY_SLASH_REGEX = /[/\\]/;
173function relative(from, to) {
174 const fromParts = from.split(ANY_SLASH_REGEX).filter(Boolean);
175 const toParts = to.split(ANY_SLASH_REGEX).filter(Boolean);
176 if (fromParts[0] === '.')
177 fromParts.shift();
178 if (toParts[0] === '.')
179 toParts.shift();
180 while (fromParts[0] && toParts[0] && fromParts[0] === toParts[0]) {
181 fromParts.shift();
182 toParts.shift();
183 }
184 while (toParts[0] === '..' && fromParts.length > 0) {
185 toParts.shift();
186 fromParts.pop();
187 }
188 while (fromParts.pop()) {
189 toParts.unshift('..');
190 }
191 return toParts.join('/');
192}
193
194function getAliasName(id) {
195 const base = path.basename(id);
196 return base.slice(0, Math.max(0, base.length - path.extname(id).length));
197}
198function relativeId(id) {
199 if (!isAbsolute(id))
200 return id;
201 return relative(path.resolve(), id);
202}
203function isPathFragment(name) {
204 // starting with "/", "./", "../", "C:/"
205 return (name[0] === '/' || (name[0] === '.' && (name[1] === '/' || name[1] === '.')) || isAbsolute(name));
206}
207const UPPER_DIR_REGEX = /^(\.\.\/)*\.\.$/;
208function getImportPath(importerId, targetPath, stripJsExtension, ensureFileName) {
209 while (targetPath.startsWith('../')) {
210 targetPath = targetPath.slice(3);
211 importerId = '_/' + importerId;
212 }
213 let relativePath = normalize(relative(path.dirname(importerId), targetPath));
214 if (stripJsExtension && relativePath.endsWith('.js')) {
215 relativePath = relativePath.slice(0, -3);
216 }
217 if (ensureFileName) {
218 if (relativePath === '')
219 return '../' + path.basename(targetPath);
220 if (UPPER_DIR_REGEX.test(relativePath)) {
221 return [...relativePath.split('/'), '..', path.basename(targetPath)].join('/');
222 }
223 }
224 return relativePath ? (relativePath.startsWith('..') ? relativePath : './' + relativePath) : '.';
225}
226
227function isValidUrl(url) {
228 try {
229 new URL(url);
230 }
231 catch {
232 return false;
233 }
234 return true;
235}
236function getRollupUrl(snippet) {
237 return `https://rollupjs.org/${snippet}`;
238}
239function addTrailingSlashIfMissed(url) {
240 if (!url.endsWith('/')) {
241 return url + '/';
242 }
243 return url;
244}
245
246// troubleshooting
247const URL_AVOIDING_EVAL = 'troubleshooting/#avoiding-eval';
248const URL_NAME_IS_NOT_EXPORTED = 'troubleshooting/#error-name-is-not-exported-by-module';
249const URL_THIS_IS_UNDEFINED = 'troubleshooting/#error-this-is-undefined';
250const URL_TREATING_MODULE_AS_EXTERNAL_DEPENDENCY = 'troubleshooting/#warning-treating-module-as-external-dependency';
251const URL_SOURCEMAP_IS_LIKELY_TO_BE_INCORRECT = 'troubleshooting/#warning-sourcemap-is-likely-to-be-incorrect';
252// configuration-options
253const URL_JSX = 'configuration-options/#jsx';
254const URL_OUTPUT_AMD_ID = 'configuration-options/#output-amd-id';
255const URL_OUTPUT_AMD_BASEPATH = 'configuration-options/#output-amd-basepath';
256const URL_OUTPUT_DIR = 'configuration-options/#output-dir';
257const URL_OUTPUT_EXPORTS = 'configuration-options/#output-exports';
258const URL_OUTPUT_EXTEND = 'configuration-options/#output-extend';
259const URL_OUTPUT_EXTERNALIMPORTATTRIBUTES = 'configuration-options/#output-externalimportattributes';
260const URL_OUTPUT_FORMAT = 'configuration-options/#output-format';
261const URL_OUTPUT_GENERATEDCODE = 'configuration-options/#output-generatedcode';
262const URL_OUTPUT_GLOBALS = 'configuration-options/#output-globals';
263const URL_OUTPUT_INLINEDYNAMICIMPORTS = 'configuration-options/#output-inlinedynamicimports';
264const URL_OUTPUT_INTEROP = 'configuration-options/#output-interop';
265const URL_OUTPUT_MANUALCHUNKS = 'configuration-options/#output-manualchunks';
266const URL_OUTPUT_NAME = 'configuration-options/#output-name';
267const URL_OUTPUT_SOURCEMAPBASEURL = 'configuration-options/#output-sourcemapbaseurl';
268const URL_OUTPUT_SOURCEMAPFILE = 'configuration-options/#output-sourcemapfile';
269const URL_PRESERVEENTRYSIGNATURES = 'configuration-options/#preserveentrysignatures';
270const URL_TREESHAKE = 'configuration-options/#treeshake';
271const URL_TREESHAKE_PURE = 'configuration-options/#pure';
272const URL_TREESHAKE_NOSIDEEFFECTS = 'configuration-options/#no-side-effects';
273const URL_TREESHAKE_MODULESIDEEFFECTS = 'configuration-options/#treeshake-modulesideeffects';
274const URL_WATCH = 'configuration-options/#watch';
275// command-line-interface
276const URL_BUNDLE_CONFIG_AS_CJS = 'command-line-interface/#bundleconfigascjs';
277const URL_CONFIGURATION_FILES = 'command-line-interface/#configuration-files';
278const URL_GENERATEBUNDLE = 'plugin-development/#generatebundle';
279
280function error(base) {
281 throw base instanceof Error ? base : getRollupError(base);
282}
283function getRollupError(base) {
284 augmentLogMessage(base);
285 const errorInstance = Object.assign(new Error(base.message), base);
286 Object.defineProperty(errorInstance, 'name', {
287 value: 'RollupError',
288 writable: true
289 });
290 return errorInstance;
291}
292function augmentCodeLocation(properties, pos, source, id) {
293 if (typeof pos === 'object') {
294 const { line, column } = pos;
295 properties.loc = { column, file: id, line };
296 }
297 else {
298 properties.pos = pos;
299 const location = locate(source, pos, { offsetLine: 1 });
300 if (!location) {
301 return;
302 }
303 const { line, column } = location;
304 properties.loc = { column, file: id, line };
305 }
306 if (properties.frame === undefined) {
307 const { line, column } = properties.loc;
308 properties.frame = getCodeFrame(source, line, column);
309 }
310}
311const symbolAugmented = Symbol('augmented');
312function augmentLogMessage(log) {
313 // Make sure to only augment the log message once
314 if (!(log.plugin || log.loc) || log[symbolAugmented]) {
315 return;
316 }
317 log[symbolAugmented] = true;
318 let prefix = '';
319 if (log.plugin) {
320 prefix += `[plugin ${log.plugin}] `;
321 }
322 const id = log.id || log.loc?.file;
323 if (id) {
324 const position = log.loc ? ` (${log.loc.line}:${log.loc.column})` : '';
325 prefix += `${relativeId(id)}${position}: `;
326 }
327 const oldMessage = log.message;
328 log.message = prefix + log.message;
329 tweakStackMessage(log, oldMessage);
330}
331// Error codes should be sorted alphabetically while errors should be sorted by
332// error code below
333const 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_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_NOT_FOUND = 'FILE_NOT_FOUND', FIRST_SIDE_EFFECT = 'FIRST_SIDE_EFFECT', ILLEGAL_IDENTIFIER_AS_NAME = 'ILLEGAL_IDENTIFIER_AS_NAME', ILLEGAL_REASSIGNMENT = 'ILLEGAL_REASSIGNMENT', INCONSISTENT_IMPORT_ATTRIBUTES = 'INCONSISTENT_IMPORT_ATTRIBUTES', 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', 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', 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';
334function logAddonNotGenerated(message, hook, plugin) {
335 return {
336 code: ADDON_ERROR,
337 message: `Could not retrieve "${hook}". Check configuration of plugin "${plugin}".
338\tError Message: ${message}`
339 };
340}
341function logAlreadyClosed() {
342 return {
343 code: ALREADY_CLOSED,
344 message: 'Bundle is already closed, no more calls to "generate" or "write" are allowed.'
345 };
346}
347function logAmbiguousExternalNamespaces(binding, reexportingModule, usedModule, sources) {
348 return {
349 binding,
350 code: AMBIGUOUS_EXTERNAL_NAMESPACES,
351 ids: sources,
352 message: `Ambiguous external namespace resolution: "${relativeId(reexportingModule)}" re-exports "${binding}" from one of the external modules ${printQuotedStringList(sources.map(module => relativeId(module)))}, guessing "${relativeId(usedModule)}".`,
353 reexporter: reexportingModule
354 };
355}
356function logAnonymousPluginCache() {
357 return {
358 code: ANONYMOUS_PLUGIN_CACHE,
359 message: 'A plugin is trying to use the Rollup cache but is not declaring a plugin name or cacheKey.'
360 };
361}
362function logAssetNotFinalisedForFileName(name) {
363 return {
364 code: ASSET_NOT_FINALISED,
365 message: `Plugin error - Unable to get file name for asset "${name}". Ensure that the source is set and that generate is called first. If you reference assets via import.meta.ROLLUP_FILE_URL_<referenceId>, you need to either have set their source after "renderStart" or need to provide an explicit "fileName" when emitting them.`
366 };
367}
368function logAssetReferenceIdNotFoundForSetSource(assetReferenceId) {
369 return {
370 code: ASSET_NOT_FOUND,
371 message: `Plugin error - Unable to set the source for unknown asset "${assetReferenceId}".`
372 };
373}
374function logAssetSourceAlreadySet(name) {
375 return {
376 code: ASSET_SOURCE_ALREADY_SET,
377 message: `Unable to set the source for asset "${name}", source already set.`
378 };
379}
380function logNoAssetSourceSet(assetName) {
381 return {
382 code: ASSET_SOURCE_MISSING,
383 message: `Plugin error creating asset "${assetName}" - no asset source set.`
384 };
385}
386function logBadLoader(id) {
387 return {
388 code: BAD_LOADER,
389 message: `Error loading "${relativeId(id)}": plugin load hook should return a string, a { code, map } object, or nothing/null.`
390 };
391}
392function logCannotCallNamespace(name) {
393 return {
394 code: CANNOT_CALL_NAMESPACE,
395 message: `Cannot call a namespace ("${name}").`
396 };
397}
398function logCannotEmitFromOptionsHook() {
399 return {
400 code: CANNOT_EMIT_FROM_OPTIONS_HOOK,
401 message: `Cannot emit files or set asset sources in the "outputOptions" hook, use the "renderStart" hook instead.`
402 };
403}
404function logChunkNotGeneratedForFileName(name) {
405 return {
406 code: CHUNK_NOT_GENERATED,
407 message: `Plugin error - Unable to get file name for emitted chunk "${name}". You can only get file names once chunks have been generated after the "renderStart" hook.`
408 };
409}
410function logChunkInvalid({ fileName, code }, { pos, message }) {
411 const errorProperties = {
412 code: CHUNK_INVALID,
413 message: `Chunk "${fileName}" is not valid JavaScript: ${message}.`
414 };
415 augmentCodeLocation(errorProperties, pos, code, fileName);
416 return errorProperties;
417}
418function logCircularDependency(cyclePath) {
419 return {
420 code: CIRCULAR_DEPENDENCY,
421 ids: cyclePath,
422 message: `Circular dependency: ${cyclePath.map(relativeId).join(' -> ')}`
423 };
424}
425function logCircularReexport(exportName, exporter) {
426 return {
427 code: CIRCULAR_REEXPORT,
428 exporter,
429 message: `"${exportName}" cannot be exported from "${relativeId(exporter)}" as it is a reexport that references itself.`
430 };
431}
432function logCyclicCrossChunkReexport(exportName, exporter, reexporter, importer, preserveModules) {
433 return {
434 code: CYCLIC_CROSS_CHUNK_REEXPORT,
435 exporter,
436 id: importer,
437 message: `Export "${exportName}" of module "${relativeId(exporter)}" was reexported through module "${relativeId(reexporter)}" while both modules are dependencies of each other and will end up in different chunks by current Rollup settings. This scenario is not well supported at the moment as it will produce a circular dependency between chunks and will likely lead to broken execution order.\nEither change the import in "${relativeId(importer)}" to point directly to the exporting module or ${preserveModules ? 'do not use "output.preserveModules"' : 'reconfigure "output.manualChunks"'} to ensure these modules end up in the same chunk.`,
438 reexporter
439 };
440}
441function logDeprecation(deprecation, urlSnippet, plugin) {
442 return {
443 code: DEPRECATED_FEATURE,
444 message: deprecation,
445 url: getRollupUrl(urlSnippet),
446 ...({})
447 };
448}
449function logConstVariableReassignError() {
450 return {
451 code: CONST_REASSIGN,
452 message: 'Cannot reassign a variable declared with `const`'
453 };
454}
455function logDuplicateArgumentNameError(name) {
456 return {
457 code: DUPLICATE_ARGUMENT_NAME,
458 message: `Duplicate argument name "${name}"`
459 };
460}
461function logDuplicateExportError(name) {
462 return { code: DUPLICATE_EXPORT, message: `Duplicate export "${name}"` };
463}
464function logDuplicateImportOptions() {
465 return {
466 code: DUPLICATE_IMPORT_OPTIONS,
467 message: 'Either use --input, or pass input path as argument'
468 };
469}
470function logDuplicatePluginName(plugin) {
471 return {
472 code: DUPLICATE_PLUGIN_NAME,
473 message: `The plugin name ${plugin} is being used twice in the same build. Plugin names must be distinct or provide a cacheKey (please post an issue to the plugin if you are a plugin user).`
474 };
475}
476function logEmptyChunk(chunkName) {
477 return {
478 code: EMPTY_BUNDLE,
479 message: `Generated an empty chunk: "${chunkName}".`,
480 names: [chunkName]
481 };
482}
483function logEval(id) {
484 return {
485 code: EVAL,
486 id,
487 message: `Use of eval in "${relativeId(id)}" is strongly discouraged as it poses security risks and may cause issues with minification.`,
488 url: getRollupUrl(URL_AVOIDING_EVAL)
489 };
490}
491function logExternalSyntheticExports(id, importer) {
492 return {
493 code: EXTERNAL_SYNTHETIC_EXPORTS,
494 exporter: id,
495 message: `External "${id}" cannot have "syntheticNamedExports" enabled (imported by "${relativeId(importer)}").`
496 };
497}
498function logFailAfterWarnings() {
499 return {
500 code: FAIL_AFTER_WARNINGS,
501 message: 'Warnings occurred and --failAfterWarnings flag present.'
502 };
503}
504function logFileNameConflict(fileName) {
505 return {
506 code: FILE_NAME_CONFLICT,
507 message: `The emitted file "${fileName}" overwrites a previously emitted file of the same name.`
508 };
509}
510function logFileReferenceIdNotFoundForFilename(assetReferenceId) {
511 return {
512 code: FILE_NOT_FOUND,
513 message: `Plugin error - Unable to get file name for unknown file "${assetReferenceId}".`
514 };
515}
516function logFirstSideEffect(source, id, { line, column }) {
517 return {
518 code: FIRST_SIDE_EFFECT,
519 message: `First side effect in ${relativeId(id)} is at (${line}:${column})\n${getCodeFrame(source, line, column)}`
520 };
521}
522function logIllegalIdentifierAsName(name) {
523 return {
524 code: ILLEGAL_IDENTIFIER_AS_NAME,
525 message: `Given name "${name}" is not a legal JS identifier. If you need this, you can try "output.extend: true".`,
526 url: getRollupUrl(URL_OUTPUT_EXTEND)
527 };
528}
529function logIllegalImportReassignment(name, importingId) {
530 return {
531 code: ILLEGAL_REASSIGNMENT,
532 message: `Illegal reassignment of import "${name}" in "${relativeId(importingId)}".`
533 };
534}
535function logInconsistentImportAttributes(existingAttributes, newAttributes, source, importer) {
536 return {
537 code: INCONSISTENT_IMPORT_ATTRIBUTES,
538 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.`
539 };
540}
541const formatAttributes = (attributes) => {
542 const entries = Object.entries(attributes);
543 if (entries.length === 0)
544 return 'no';
545 return entries.map(([key, value]) => `"${key}": "${value}"`).join(', ');
546};
547function logInvalidAnnotation(comment, id, type) {
548 return {
549 code: INVALID_ANNOTATION,
550 id,
551 message: `A comment\n\n"${comment}"\n\nin "${relativeId(id)}" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.`,
552 url: getRollupUrl(type === 'noSideEffects' ? URL_TREESHAKE_NOSIDEEFFECTS : URL_TREESHAKE_PURE)
553 };
554}
555function logInputHookInOutputPlugin(pluginName, hookName) {
556 return {
557 code: INPUT_HOOK_IN_OUTPUT_PLUGIN,
558 message: `The "${hookName}" hook used by the output plugin ${pluginName} is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.`
559 };
560}
561function logCannotAssignModuleToChunk(moduleId, assignToAlias, currentAlias) {
562 return {
563 code: INVALID_CHUNK,
564 message: `Cannot assign "${relativeId(moduleId)}" to the "${assignToAlias}" chunk as it is already in the "${currentAlias}" chunk.`
565 };
566}
567function tweakStackMessage(error, oldMessage) {
568 if (!error.stack) {
569 return error;
570 }
571 error.stack = error.stack.replace(oldMessage, error.message);
572 return error;
573}
574function logCannotBundleConfigAsEsm(originalError) {
575 return tweakStackMessage({
576 cause: originalError,
577 code: INVALID_CONFIG_MODULE_FORMAT,
578 message: `Rollup transpiled your configuration to an ES module even though it appears to contain CommonJS elements. To resolve this, you can pass the "--bundleConfigAsCjs" flag to Rollup or change your configuration to only contain valid ESM code.\n\nOriginal error: ${originalError.message}`,
579 stack: originalError.stack,
580 url: getRollupUrl(URL_BUNDLE_CONFIG_AS_CJS)
581 }, originalError.message);
582}
583function logCannotLoadConfigAsCjs(originalError) {
584 return tweakStackMessage({
585 cause: originalError,
586 code: INVALID_CONFIG_MODULE_FORMAT,
587 message: `Node tried to load your configuration file as CommonJS even though it is likely an ES module. To resolve this, change the extension of your configuration to ".mjs", set "type": "module" in your package.json file or pass the "--bundleConfigAsCjs" flag.\n\nOriginal error: ${originalError.message}`,
588 stack: originalError.stack,
589 url: getRollupUrl(URL_BUNDLE_CONFIG_AS_CJS)
590 }, originalError.message);
591}
592function logCannotLoadConfigAsEsm(originalError) {
593 return tweakStackMessage({
594 cause: originalError,
595 code: INVALID_CONFIG_MODULE_FORMAT,
596 message: `Node tried to load your configuration as an ES module even though it is likely CommonJS. To resolve this, change the extension of your configuration to ".cjs" or pass the "--bundleConfigAsCjs" flag.\n\nOriginal error: ${originalError.message}`,
597 stack: originalError.stack,
598 url: getRollupUrl(URL_BUNDLE_CONFIG_AS_CJS)
599 }, originalError.message);
600}
601function logInvalidExportOptionValue(optionValue) {
602 return {
603 code: INVALID_EXPORT_OPTION,
604 message: `"output.exports" must be "default", "named", "none", "auto", or left unspecified (defaults to "auto"), received "${optionValue}".`,
605 url: getRollupUrl(URL_OUTPUT_EXPORTS)
606 };
607}
608function logIncompatibleExportOptionValue(optionValue, keys, entryModule) {
609 return {
610 code: INVALID_EXPORT_OPTION,
611 message: `"${optionValue}" was specified for "output.exports", but entry module "${relativeId(entryModule)}" has the following exports: ${printQuotedStringList(keys)}`,
612 url: getRollupUrl(URL_OUTPUT_EXPORTS)
613 };
614}
615function logInternalIdCannotBeExternal(source, importer) {
616 return {
617 code: INVALID_EXTERNAL_ID,
618 message: `"${source}" is imported as an external by "${relativeId(importer)}", but is already an existing non-external module id.`
619 };
620}
621function logImportOptionsAreInvalid(importer) {
622 return {
623 code: INVALID_IMPORT_ATTRIBUTE,
624 message: `Rollup could not statically analyze the options argument of a dynamic import in "${relativeId(importer)}". Dynamic import options need to be an object with a nested attributes object.`
625 };
626}
627function logImportAttributeIsInvalid(importer) {
628 return {
629 code: INVALID_IMPORT_ATTRIBUTE,
630 message: `Rollup could not statically analyze an import attribute of a dynamic import in "${relativeId(importer)}". Import attributes need to have string keys and values. The attribute will be removed.`
631 };
632}
633function logInvalidLogPosition(plugin) {
634 return {
635 code: INVALID_LOG_POSITION,
636 message: `Plugin "${plugin}" tried to add a file position to a log or warning. This is only supported in the "transform" hook at the moment and will be ignored.`
637 };
638}
639function logInvalidOption(option, urlSnippet, explanation, value) {
640 return {
641 code: INVALID_OPTION,
642 message: `Invalid value ${value === undefined ? '' : `${JSON.stringify(value)} `}for option "${option}" - ${explanation}.`,
643 url: getRollupUrl(urlSnippet)
644 };
645}
646function logInvalidAddonPluginHook(hook, plugin) {
647 return {
648 code: INVALID_PLUGIN_HOOK,
649 hook,
650 message: `Error running plugin hook "${hook}" for plugin "${plugin}", expected a string, a function hook or an object with a "handler" string or function.`,
651 plugin
652 };
653}
654function logInvalidFunctionPluginHook(hook, plugin) {
655 return {
656 code: INVALID_PLUGIN_HOOK,
657 hook,
658 message: `Error running plugin hook "${hook}" for plugin "${plugin}", expected a function hook or an object with a "handler" function.`,
659 plugin
660 };
661}
662function logInvalidRollupPhaseForChunkEmission() {
663 return {
664 code: INVALID_ROLLUP_PHASE,
665 message: `Cannot emit chunks after module loading has finished.`
666 };
667}
668function logInvalidSetAssetSourceCall() {
669 return {
670 code: INVALID_SETASSETSOURCE,
671 message: `setAssetSource cannot be called in transform for caching reasons. Use emitFile with a source, or call setAssetSource in another hook.`
672 };
673}
674function logInvalidFormatForTopLevelAwait(id, format) {
675 return {
676 code: INVALID_TLA_FORMAT,
677 id,
678 message: `Module format "${format}" does not support top-level await. Use the "es" or "system" output formats rather.`
679 };
680}
681function logMissingConfig() {
682 return {
683 code: MISSING_CONFIG,
684 message: 'Config file must export an options object, or an array of options objects',
685 url: getRollupUrl(URL_CONFIGURATION_FILES)
686 };
687}
688function logMissingEntryExport(binding, exporter) {
689 return {
690 binding,
691 code: MISSING_EXPORT,
692 exporter,
693 message: `Exported variable "${binding}" is not defined in "${relativeId(exporter)}".`,
694 url: getRollupUrl(URL_NAME_IS_NOT_EXPORTED)
695 };
696}
697function logMissingExport(binding, importingModule, exporter) {
698 const isJson = path.extname(exporter) === '.json';
699 return {
700 binding,
701 code: MISSING_EXPORT,
702 exporter,
703 id: importingModule,
704 message: `"${binding}" is not exported by "${relativeId(exporter)}", imported by "${relativeId(importingModule)}".${isJson ? ' (Note that you need @rollup/plugin-json to import JSON files)' : ''}`,
705 url: getRollupUrl(URL_NAME_IS_NOT_EXPORTED)
706 };
707}
708function logMissingExternalConfig(file) {
709 return {
710 code: MISSING_EXTERNAL_CONFIG,
711 message: `Could not resolve config file "${file}"`
712 };
713}
714function logMissingGlobalName(externalId, guess) {
715 return {
716 code: MISSING_GLOBAL_NAME,
717 id: externalId,
718 message: `No name was provided for external module "${externalId}" in "output.globals" – guessing "${guess}".`,
719 names: [guess],
720 url: getRollupUrl(URL_OUTPUT_GLOBALS)
721 };
722}
723function logImplicitDependantCannotBeExternal(unresolvedId, implicitlyLoadedBefore) {
724 return {
725 code: MISSING_IMPLICIT_DEPENDANT,
726 message: `Module "${relativeId(unresolvedId)}" that should be implicitly loaded before "${relativeId(implicitlyLoadedBefore)}" cannot be external.`
727 };
728}
729function logUnresolvedImplicitDependant(unresolvedId, implicitlyLoadedBefore) {
730 return {
731 code: MISSING_IMPLICIT_DEPENDANT,
732 message: `Module "${relativeId(unresolvedId)}" that should be implicitly loaded before "${relativeId(implicitlyLoadedBefore)}" could not be resolved.`
733 };
734}
735function logImplicitDependantIsNotIncluded(module) {
736 const implicitDependencies = [...module.implicitlyLoadedBefore]
737 .map(dependency => relativeId(dependency.id))
738 .sort();
739 return {
740 code: MISSING_IMPLICIT_DEPENDANT,
741 message: `Module "${relativeId(module.id)}" that should be implicitly loaded before ${printQuotedStringList(implicitDependencies)} is not included in the module graph. Either it was not imported by an included module or only via a tree-shaken dynamic import, or no imported bindings were used and it had otherwise no side-effects.`
742 };
743}
744function logMissingJsxExport(name, exporter, importer) {
745 return {
746 code: MISSING_JSX_EXPORT,
747 exporter,
748 id: importer,
749 message: `Export "${name}" is not defined in module "${relativeId(exporter)}" even though it is needed in "${relativeId(importer)}" to provide JSX syntax. Please check your "jsx" option.`,
750 names: [name],
751 url: getRollupUrl(URL_JSX)
752 };
753}
754function logMissingNameOptionForIifeExport() {
755 return {
756 code: MISSING_NAME_OPTION_FOR_IIFE_EXPORT,
757 message: `If you do not supply "output.name", you may not be able to access the exports of an IIFE bundle.`,
758 url: getRollupUrl(URL_OUTPUT_NAME)
759 };
760}
761function logMissingNameOptionForUmdExport() {
762 return {
763 code: MISSING_NAME_OPTION_FOR_IIFE_EXPORT,
764 message: 'You must supply "output.name" for UMD bundles that have exports so that the exports are accessible in environments without a module loader.',
765 url: getRollupUrl(URL_OUTPUT_NAME)
766 };
767}
768function logMissingNodeBuiltins(externalBuiltins) {
769 return {
770 code: MISSING_NODE_BUILTINS,
771 ids: externalBuiltins,
772 message: `Creating a browser bundle that depends on Node.js built-in modules (${printQuotedStringList(externalBuiltins)}). You might need to include https://github.com/FredKSchott/rollup-plugin-polyfill-node`
773 };
774}
775function logMissingFileOrDirOption() {
776 return {
777 code: MISSING_OPTION,
778 message: 'You must specify "output.file" or "output.dir" for the build.',
779 url: getRollupUrl(URL_OUTPUT_DIR)
780 };
781}
782function logMixedExport(facadeModuleId, name) {
783 return {
784 code: MIXED_EXPORTS,
785 id: facadeModuleId,
786 message: `Entry module "${relativeId(facadeModuleId)}" is using named and default exports together. Consumers of your bundle will have to use \`${name || 'chunk'}.default\` to access the default export, which may not be what you want. Use \`output.exports: "named"\` to disable this warning.`,
787 url: getRollupUrl(URL_OUTPUT_EXPORTS)
788 };
789}
790function logModuleLevelDirective(directive, id) {
791 return {
792 code: MODULE_LEVEL_DIRECTIVE,
793 id,
794 message: `Module level directives cause errors when bundled, "${directive}" in "${relativeId(id)}" was ignored.`
795 };
796}
797function logNamespaceConflict(binding, reexportingModuleId, sources) {
798 return {
799 binding,
800 code: NAMESPACE_CONFLICT,
801 ids: sources,
802 message: `Conflicting namespaces: "${relativeId(reexportingModuleId)}" re-exports "${binding}" from one of the modules ${printQuotedStringList(sources.map(moduleId => relativeId(moduleId)))} (will be ignored).`,
803 reexporter: reexportingModuleId
804 };
805}
806function logNoTransformMapOrAstWithoutCode(pluginName) {
807 return {
808 code: NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE,
809 message: `The plugin "${pluginName}" returned a "map" or "ast" without returning ` +
810 'a "code". This will be ignored.'
811 };
812}
813function logOnlyInlineSourcemapsForStdout() {
814 return {
815 code: ONLY_INLINE_SOURCEMAPS,
816 message: 'Only inline sourcemaps are supported when bundling to stdout.'
817 };
818}
819function logOptimizeChunkStatus(chunks, smallChunks, pointInTime) {
820 return {
821 code: OPTIMIZE_CHUNK_STATUS,
822 message: `${pointInTime}, there are\n` +
823 `${chunks} chunks, of which\n` +
824 `${smallChunks} are below minChunkSize.`
825 };
826}
827function logParseError(message, pos) {
828 return { code: PARSE_ERROR, message, pos };
829}
830function logRedeclarationError(name) {
831 return {
832 code: REDECLARATION_ERROR,
833 message: `Identifier "${name}" has already been declared`
834 };
835}
836function logReservedNamespace(namespace) {
837 return {
838 code: RESERVED_NAMESPACE,
839 message: `You have overided reserved namespace "${namespace}"`
840 };
841}
842function logModuleParseError(error, moduleId) {
843 let message = error.message.replace(/ \(\d+:\d+\)$/, '');
844 if (moduleId.endsWith('.json')) {
845 message += ' (Note that you need @rollup/plugin-json to import JSON files)';
846 }
847 else if (!moduleId.endsWith('.js')) {
848 message += ' (Note that you need plugins to import files that are not JavaScript)';
849 }
850 return tweakStackMessage({
851 cause: error,
852 code: PARSE_ERROR,
853 id: moduleId,
854 message,
855 stack: error.stack
856 }, error.message);
857}
858function logPluginError(error, plugin, { hook, id } = {}) {
859 const code = error.code;
860 if (!error.pluginCode &&
861 code != null &&
862 (typeof code !== 'string' || !code.startsWith('PLUGIN_'))) {
863 error.pluginCode = code;
864 }
865 error.code = PLUGIN_ERROR;
866 error.plugin = plugin;
867 if (hook) {
868 error.hook = hook;
869 }
870 if (id) {
871 error.id = id;
872 }
873 return error;
874}
875function logShimmedExport(id, binding) {
876 return {
877 binding,
878 code: SHIMMED_EXPORT,
879 exporter: id,
880 message: `Missing export "${binding}" has been shimmed in module "${relativeId(id)}".`
881 };
882}
883function logSourcemapBroken(plugin) {
884 return {
885 code: SOURCEMAP_BROKEN,
886 message: `Sourcemap is likely to be incorrect: a plugin (${plugin}) was used to transform files, but didn't generate a sourcemap for the transformation. Consult the plugin documentation for help`,
887 plugin,
888 url: getRollupUrl(URL_SOURCEMAP_IS_LIKELY_TO_BE_INCORRECT)
889 };
890}
891function logConflictingSourcemapSources(filename) {
892 return {
893 code: SOURCEMAP_BROKEN,
894 message: `Multiple conflicting contents for sourcemap source ${filename}`
895 };
896}
897function logInvalidSourcemapForError(error, id, column, line, pos) {
898 return {
899 cause: error,
900 code: SOURCEMAP_ERROR,
901 id,
902 loc: {
903 column,
904 file: id,
905 line
906 },
907 message: `Error when using sourcemap for reporting an error: ${error.message}`,
908 pos
909 };
910}
911function logSyntheticNamedExportsNeedNamespaceExport(id, syntheticNamedExportsOption) {
912 return {
913 code: SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT,
914 exporter: id,
915 message: `Module "${relativeId(id)}" that is marked with \`syntheticNamedExports: ${JSON.stringify(syntheticNamedExportsOption)}\` needs ${typeof syntheticNamedExportsOption === 'string' && syntheticNamedExportsOption !== 'default'
916 ? `an explicit export named "${syntheticNamedExportsOption}"`
917 : 'a default export'} that does not reexport an unresolved named export of the same module.`
918 };
919}
920function logThisIsUndefined() {
921 return {
922 code: THIS_IS_UNDEFINED,
923 message: `The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten`,
924 url: getRollupUrl(URL_THIS_IS_UNDEFINED)
925 };
926}
927function logUnexpectedNamedImport(id, imported, isReexport) {
928 const importType = isReexport ? 'reexport' : 'import';
929 return {
930 code: UNEXPECTED_NAMED_IMPORT,
931 exporter: id,
932 message: `The named export "${imported}" was ${importType}ed from the external module "${relativeId(id)}" even though its interop type is "defaultOnly". Either remove or change this ${importType} or change the value of the "output.interop" option.`,
933 url: getRollupUrl(URL_OUTPUT_INTEROP)
934 };
935}
936function logUnexpectedNamespaceReexport(id) {
937 return {
938 code: UNEXPECTED_NAMED_IMPORT,
939 exporter: id,
940 message: `There was a namespace "*" reexport from the external module "${relativeId(id)}" even though its interop type is "defaultOnly". This will be ignored as namespace reexports only reexport named exports. If this is not intended, either remove or change this reexport or change the value of the "output.interop" option.`,
941 url: getRollupUrl(URL_OUTPUT_INTEROP)
942 };
943}
944function logUnknownOption(optionType, unknownOptions, validOptions) {
945 return {
946 code: UNKNOWN_OPTION,
947 message: `Unknown ${optionType}: ${unknownOptions.join(', ')}. Allowed options: ${validOptions.join(', ')}`
948 };
949}
950function logEntryCannotBeExternal(unresolvedId) {
951 return {
952 code: UNRESOLVED_ENTRY,
953 message: `Entry module "${relativeId(unresolvedId)}" cannot be external.`
954 };
955}
956function logExternalModulesCannotBeIncludedInManualChunks(source) {
957 return {
958 code: EXTERNAL_MODULES_CANNOT_BE_INCLUDED_IN_MANUAL_CHUNKS,
959 message: `"${source}" cannot be included in manualChunks because it is resolved as an external module by the "external" option or plugins.`
960 };
961}
962function logExternalModulesCannotBeTransformedToModules(source) {
963 return {
964 code: EXTERNAL_MODULES_CANNOT_BE_TRANSFORMED_TO_MODULES,
965 message: `${source} is resolved as a module now, but it was an external module before. Please check whether there are conflicts in your Rollup options "external" and "manualChunks", manualChunks cannot include external modules.`
966 };
967}
968function logUnresolvedEntry(unresolvedId) {
969 return {
970 code: UNRESOLVED_ENTRY,
971 message: `Could not resolve entry module "${relativeId(unresolvedId)}".`
972 };
973}
974function logUnresolvedImport(source, importer) {
975 return {
976 code: UNRESOLVED_IMPORT,
977 exporter: source,
978 id: importer,
979 message: `Could not resolve "${source}" from "${relativeId(importer)}"`
980 };
981}
982function logUnresolvedImportTreatedAsExternal(source, importer) {
983 return {
984 code: UNRESOLVED_IMPORT,
985 exporter: source,
986 id: importer,
987 message: `"${source}" is imported by "${relativeId(importer)}", but could not be resolved – treating it as an external dependency.`,
988 url: getRollupUrl(URL_TREATING_MODULE_AS_EXTERNAL_DEPENDENCY)
989 };
990}
991function logUnusedExternalImports(externalId, names, importers) {
992 return {
993 code: UNUSED_EXTERNAL_IMPORT,
994 exporter: externalId,
995 ids: importers,
996 message: `${printQuotedStringList(names, [
997 'is',
998 'are'
999 ])} imported from external module "${externalId}" but never used in ${printQuotedStringList(importers.map(importer => relativeId(importer)))}.`,
1000 names
1001 };
1002}
1003function logFailedValidation(message) {
1004 return {
1005 code: VALIDATION_ERROR,
1006 message
1007 };
1008}
1009function warnDeprecation(deprecation, urlSnippet, activeDeprecation, options, plugin) {
1010 warnDeprecationWithOptions(deprecation, urlSnippet, activeDeprecation, options.onLog, options.strictDeprecations);
1011}
1012function warnDeprecationWithOptions(deprecation, urlSnippet, activeDeprecation, log, strictDeprecations, plugin) {
1013 if (activeDeprecation || strictDeprecations) {
1014 const warning = logDeprecation(deprecation, urlSnippet);
1015 if (strictDeprecations) {
1016 return error(warning);
1017 }
1018 log(LOGLEVEL_WARN, warning);
1019 }
1020}
1021
1022const BLANK = Object.freeze(Object.create(null));
1023const EMPTY_OBJECT = Object.freeze({});
1024const EMPTY_ARRAY = Object.freeze([]);
1025const EMPTY_SET = Object.freeze(new (class extends Set {
1026 add() {
1027 throw new Error('Cannot add to empty set');
1028 }
1029})());
1030
1031// This file is generated by scripts/generate-node-types.js.
1032// Do not edit this file directly.
1033const ArrowFunctionExpression = 'ArrowFunctionExpression';
1034const BlockStatement = 'BlockStatement';
1035const CallExpression = 'CallExpression';
1036const CatchClause = 'CatchClause';
1037const ExportDefaultDeclaration = 'ExportDefaultDeclaration';
1038const ExpressionStatement = 'ExpressionStatement';
1039const Identifier = 'Identifier';
1040const Literal = 'Literal';
1041const ObjectExpression = 'ObjectExpression';
1042const PanicError = 'PanicError';
1043const ParseError = 'ParseError';
1044const Program = 'Program';
1045const Property = 'Property';
1046const RestElement = 'RestElement';
1047const ReturnStatement = 'ReturnStatement';
1048const StaticBlock = 'StaticBlock';
1049const TemplateLiteral = 'TemplateLiteral';
1050const VariableDeclarator = 'VariableDeclarator';
1051
1052// This file is generated by scripts/generate-string-constants.js.
1053// Do not edit this file directly.
1054const FIXED_STRINGS = [
1055 'var',
1056 'let',
1057 'const',
1058 'init',
1059 'get',
1060 'set',
1061 'constructor',
1062 'method',
1063 '-',
1064 '+',
1065 '!',
1066 '~',
1067 'typeof',
1068 'void',
1069 'delete',
1070 '++',
1071 '--',
1072 '==',
1073 '!=',
1074 '===',
1075 '!==',
1076 '<',
1077 '<=',
1078 '>',
1079 '>=',
1080 '<<',
1081 '>>',
1082 '>>>',
1083 '+',
1084 '-',
1085 '*',
1086 '/',
1087 '%',
1088 '|',
1089 '^',
1090 '&',
1091 '||',
1092 '&&',
1093 'in',
1094 'instanceof',
1095 '**',
1096 '??',
1097 '=',
1098 '+=',
1099 '-=',
1100 '*=',
1101 '/=',
1102 '%=',
1103 '<<=',
1104 '>>=',
1105 '>>>=',
1106 '|=',
1107 '^=',
1108 '&=',
1109 '**=',
1110 '&&=',
1111 '||=',
1112 '??=',
1113 'pure',
1114 'noSideEffects',
1115 'sourcemap',
1116 'using',
1117 'await using'
1118];
1119
1120const ANNOTATION_KEY = '_rollupAnnotations';
1121const INVALID_ANNOTATION_KEY = '_rollupRemoved';
1122const convertAnnotations = (position, buffer) => {
1123 if (position === 0)
1124 return EMPTY_ARRAY;
1125 const length = buffer[position++];
1126 const list = new Array(length);
1127 for (let index = 0; index < length; index++) {
1128 list[index] = convertAnnotation(buffer[position++], buffer);
1129 }
1130 return list;
1131};
1132const convertAnnotation = (position, buffer) => {
1133 const start = buffer[position++];
1134 const end = buffer[position++];
1135 const type = FIXED_STRINGS[buffer[position]];
1136 return { end, start, type };
1137};
1138
1139// This file is generated by scripts/generate-buffer-to-ast.js.
1140// Do not edit this file directly.
1141function convertProgram(buffer) {
1142 const node = convertNode(0, buffer);
1143 switch (node.type) {
1144 case PanicError: {
1145 return error(getRollupError(logParseError(node.message)));
1146 }
1147 case ParseError: {
1148 return error(getRollupError(logParseError(node.message, node.start)));
1149 }
1150 default: {
1151 return node;
1152 }
1153 }
1154}
1155/* eslint-disable sort-keys */
1156const nodeConverters = [
1157 function panicError(position, buffer) {
1158 return {
1159 type: 'PanicError',
1160 start: buffer[position],
1161 end: buffer[position + 1],
1162 message: buffer.convertString(buffer[position + 2])
1163 };
1164 },
1165 function parseError(position, buffer) {
1166 return {
1167 type: 'ParseError',
1168 start: buffer[position],
1169 end: buffer[position + 1],
1170 message: buffer.convertString(buffer[position + 2])
1171 };
1172 },
1173 function arrayExpression(position, buffer) {
1174 return {
1175 type: 'ArrayExpression',
1176 start: buffer[position],
1177 end: buffer[position + 1],
1178 elements: convertNodeList(buffer[position + 2], buffer)
1179 };
1180 },
1181 function arrayPattern(position, buffer) {
1182 return {
1183 type: 'ArrayPattern',
1184 start: buffer[position],
1185 end: buffer[position + 1],
1186 elements: convertNodeList(buffer[position + 2], buffer)
1187 };
1188 },
1189 function arrowFunctionExpression(position, buffer) {
1190 const flags = buffer[position + 2];
1191 const annotations = convertAnnotations(buffer[position + 3], buffer);
1192 return {
1193 type: 'ArrowFunctionExpression',
1194 start: buffer[position],
1195 end: buffer[position + 1],
1196 async: (flags & 1) === 1,
1197 expression: (flags & 2) === 2,
1198 generator: (flags & 4) === 4,
1199 ...(annotations.length > 0 ? { [ANNOTATION_KEY]: annotations } : {}),
1200 params: convertNodeList(buffer[position + 4], buffer),
1201 body: convertNode(buffer[position + 5], buffer),
1202 id: null
1203 };
1204 },
1205 function assignmentExpression(position, buffer) {
1206 return {
1207 type: 'AssignmentExpression',
1208 start: buffer[position],
1209 end: buffer[position + 1],
1210 operator: FIXED_STRINGS[buffer[position + 2]],
1211 left: convertNode(buffer[position + 3], buffer),
1212 right: convertNode(buffer[position + 4], buffer)
1213 };
1214 },
1215 function assignmentPattern(position, buffer) {
1216 return {
1217 type: 'AssignmentPattern',
1218 start: buffer[position],
1219 end: buffer[position + 1],
1220 left: convertNode(buffer[position + 2], buffer),
1221 right: convertNode(buffer[position + 3], buffer)
1222 };
1223 },
1224 function awaitExpression(position, buffer) {
1225 return {
1226 type: 'AwaitExpression',
1227 start: buffer[position],
1228 end: buffer[position + 1],
1229 argument: convertNode(buffer[position + 2], buffer)
1230 };
1231 },
1232 function binaryExpression(position, buffer) {
1233 return {
1234 type: 'BinaryExpression',
1235 start: buffer[position],
1236 end: buffer[position + 1],
1237 operator: FIXED_STRINGS[buffer[position + 2]],
1238 left: convertNode(buffer[position + 3], buffer),
1239 right: convertNode(buffer[position + 4], buffer)
1240 };
1241 },
1242 function blockStatement(position, buffer) {
1243 return {
1244 type: 'BlockStatement',
1245 start: buffer[position],
1246 end: buffer[position + 1],
1247 body: convertNodeList(buffer[position + 2], buffer)
1248 };
1249 },
1250 function breakStatement(position, buffer) {
1251 const labelPosition = buffer[position + 2];
1252 return {
1253 type: 'BreakStatement',
1254 start: buffer[position],
1255 end: buffer[position + 1],
1256 label: labelPosition === 0 ? null : convertNode(labelPosition, buffer)
1257 };
1258 },
1259 function callExpression(position, buffer) {
1260 const flags = buffer[position + 2];
1261 const annotations = convertAnnotations(buffer[position + 3], buffer);
1262 return {
1263 type: 'CallExpression',
1264 start: buffer[position],
1265 end: buffer[position + 1],
1266 optional: (flags & 1) === 1,
1267 ...(annotations.length > 0 ? { [ANNOTATION_KEY]: annotations } : {}),
1268 callee: convertNode(buffer[position + 4], buffer),
1269 arguments: convertNodeList(buffer[position + 5], buffer)
1270 };
1271 },
1272 function catchClause(position, buffer) {
1273 const parameterPosition = buffer[position + 2];
1274 return {
1275 type: 'CatchClause',
1276 start: buffer[position],
1277 end: buffer[position + 1],
1278 param: parameterPosition === 0 ? null : convertNode(parameterPosition, buffer),
1279 body: convertNode(buffer[position + 3], buffer)
1280 };
1281 },
1282 function chainExpression(position, buffer) {
1283 return {
1284 type: 'ChainExpression',
1285 start: buffer[position],
1286 end: buffer[position + 1],
1287 expression: convertNode(buffer[position + 2], buffer)
1288 };
1289 },
1290 function classBody(position, buffer) {
1291 return {
1292 type: 'ClassBody',
1293 start: buffer[position],
1294 end: buffer[position + 1],
1295 body: convertNodeList(buffer[position + 2], buffer)
1296 };
1297 },
1298 function classDeclaration(position, buffer) {
1299 const idPosition = buffer[position + 3];
1300 const superClassPosition = buffer[position + 4];
1301 return {
1302 type: 'ClassDeclaration',
1303 start: buffer[position],
1304 end: buffer[position + 1],
1305 decorators: convertNodeList(buffer[position + 2], buffer),
1306 id: idPosition === 0 ? null : convertNode(idPosition, buffer),
1307 superClass: superClassPosition === 0 ? null : convertNode(superClassPosition, buffer),
1308 body: convertNode(buffer[position + 5], buffer)
1309 };
1310 },
1311 function classExpression(position, buffer) {
1312 const idPosition = buffer[position + 3];
1313 const superClassPosition = buffer[position + 4];
1314 return {
1315 type: 'ClassExpression',
1316 start: buffer[position],
1317 end: buffer[position + 1],
1318 decorators: convertNodeList(buffer[position + 2], buffer),
1319 id: idPosition === 0 ? null : convertNode(idPosition, buffer),
1320 superClass: superClassPosition === 0 ? null : convertNode(superClassPosition, buffer),
1321 body: convertNode(buffer[position + 5], buffer)
1322 };
1323 },
1324 function conditionalExpression(position, buffer) {
1325 return {
1326 type: 'ConditionalExpression',
1327 start: buffer[position],
1328 end: buffer[position + 1],
1329 test: convertNode(buffer[position + 2], buffer),
1330 consequent: convertNode(buffer[position + 3], buffer),
1331 alternate: convertNode(buffer[position + 4], buffer)
1332 };
1333 },
1334 function continueStatement(position, buffer) {
1335 const labelPosition = buffer[position + 2];
1336 return {
1337 type: 'ContinueStatement',
1338 start: buffer[position],
1339 end: buffer[position + 1],
1340 label: labelPosition === 0 ? null : convertNode(labelPosition, buffer)
1341 };
1342 },
1343 function debuggerStatement(position, buffer) {
1344 return {
1345 type: 'DebuggerStatement',
1346 start: buffer[position],
1347 end: buffer[position + 1]
1348 };
1349 },
1350 function decorator(position, buffer) {
1351 return {
1352 type: 'Decorator',
1353 start: buffer[position],
1354 end: buffer[position + 1],
1355 expression: convertNode(buffer[position + 2], buffer)
1356 };
1357 },
1358 function directive(position, buffer) {
1359 return {
1360 type: 'ExpressionStatement',
1361 start: buffer[position],
1362 end: buffer[position + 1],
1363 directive: buffer.convertString(buffer[position + 2]),
1364 expression: convertNode(buffer[position + 3], buffer)
1365 };
1366 },
1367 function doWhileStatement(position, buffer) {
1368 return {
1369 type: 'DoWhileStatement',
1370 start: buffer[position],
1371 end: buffer[position + 1],
1372 body: convertNode(buffer[position + 2], buffer),
1373 test: convertNode(buffer[position + 3], buffer)
1374 };
1375 },
1376 function emptyStatement(position, buffer) {
1377 return {
1378 type: 'EmptyStatement',
1379 start: buffer[position],
1380 end: buffer[position + 1]
1381 };
1382 },
1383 function exportAllDeclaration(position, buffer) {
1384 const exportedPosition = buffer[position + 2];
1385 return {
1386 type: 'ExportAllDeclaration',
1387 start: buffer[position],
1388 end: buffer[position + 1],
1389 exported: exportedPosition === 0 ? null : convertNode(exportedPosition, buffer),
1390 source: convertNode(buffer[position + 3], buffer),
1391 attributes: convertNodeList(buffer[position + 4], buffer)
1392 };
1393 },
1394 function exportDefaultDeclaration(position, buffer) {
1395 return {
1396 type: 'ExportDefaultDeclaration',
1397 start: buffer[position],
1398 end: buffer[position + 1],
1399 declaration: convertNode(buffer[position + 2], buffer)
1400 };
1401 },
1402 function exportNamedDeclaration(position, buffer) {
1403 const sourcePosition = buffer[position + 3];
1404 const declarationPosition = buffer[position + 5];
1405 return {
1406 type: 'ExportNamedDeclaration',
1407 start: buffer[position],
1408 end: buffer[position + 1],
1409 specifiers: convertNodeList(buffer[position + 2], buffer),
1410 source: sourcePosition === 0 ? null : convertNode(sourcePosition, buffer),
1411 attributes: convertNodeList(buffer[position + 4], buffer),
1412 declaration: declarationPosition === 0 ? null : convertNode(declarationPosition, buffer)
1413 };
1414 },
1415 function exportSpecifier(position, buffer) {
1416 const local = convertNode(buffer[position + 2], buffer);
1417 const exportedPosition = buffer[position + 3];
1418 return {
1419 type: 'ExportSpecifier',
1420 start: buffer[position],
1421 end: buffer[position + 1],
1422 local,
1423 exported: exportedPosition === 0 ? { ...local } : convertNode(exportedPosition, buffer)
1424 };
1425 },
1426 function expressionStatement(position, buffer) {
1427 return {
1428 type: 'ExpressionStatement',
1429 start: buffer[position],
1430 end: buffer[position + 1],
1431 expression: convertNode(buffer[position + 2], buffer)
1432 };
1433 },
1434 function forInStatement(position, buffer) {
1435 return {
1436 type: 'ForInStatement',
1437 start: buffer[position],
1438 end: buffer[position + 1],
1439 left: convertNode(buffer[position + 2], buffer),
1440 right: convertNode(buffer[position + 3], buffer),
1441 body: convertNode(buffer[position + 4], buffer)
1442 };
1443 },
1444 function forOfStatement(position, buffer) {
1445 const flags = buffer[position + 2];
1446 return {
1447 type: 'ForOfStatement',
1448 start: buffer[position],
1449 end: buffer[position + 1],
1450 await: (flags & 1) === 1,
1451 left: convertNode(buffer[position + 3], buffer),
1452 right: convertNode(buffer[position + 4], buffer),
1453 body: convertNode(buffer[position + 5], buffer)
1454 };
1455 },
1456 function forStatement(position, buffer) {
1457 const initPosition = buffer[position + 2];
1458 const testPosition = buffer[position + 3];
1459 const updatePosition = buffer[position + 4];
1460 return {
1461 type: 'ForStatement',
1462 start: buffer[position],
1463 end: buffer[position + 1],
1464 init: initPosition === 0 ? null : convertNode(initPosition, buffer),
1465 test: testPosition === 0 ? null : convertNode(testPosition, buffer),
1466 update: updatePosition === 0 ? null : convertNode(updatePosition, buffer),
1467 body: convertNode(buffer[position + 5], buffer)
1468 };
1469 },
1470 function functionDeclaration(position, buffer) {
1471 const flags = buffer[position + 2];
1472 const annotations = convertAnnotations(buffer[position + 3], buffer);
1473 const idPosition = buffer[position + 4];
1474 return {
1475 type: 'FunctionDeclaration',
1476 start: buffer[position],
1477 end: buffer[position + 1],
1478 async: (flags & 1) === 1,
1479 generator: (flags & 2) === 2,
1480 ...(annotations.length > 0 ? { [ANNOTATION_KEY]: annotations } : {}),
1481 id: idPosition === 0 ? null : convertNode(idPosition, buffer),
1482 params: convertNodeList(buffer[position + 5], buffer),
1483 body: convertNode(buffer[position + 6], buffer),
1484 expression: false
1485 };
1486 },
1487 function functionExpression(position, buffer) {
1488 const flags = buffer[position + 2];
1489 const annotations = convertAnnotations(buffer[position + 3], buffer);
1490 const idPosition = buffer[position + 4];
1491 return {
1492 type: 'FunctionExpression',
1493 start: buffer[position],
1494 end: buffer[position + 1],
1495 async: (flags & 1) === 1,
1496 generator: (flags & 2) === 2,
1497 ...(annotations.length > 0 ? { [ANNOTATION_KEY]: annotations } : {}),
1498 id: idPosition === 0 ? null : convertNode(idPosition, buffer),
1499 params: convertNodeList(buffer[position + 5], buffer),
1500 body: convertNode(buffer[position + 6], buffer),
1501 expression: false
1502 };
1503 },
1504 function identifier(position, buffer) {
1505 return {
1506 type: 'Identifier',
1507 start: buffer[position],
1508 end: buffer[position + 1],
1509 name: buffer.convertString(buffer[position + 2])
1510 };
1511 },
1512 function ifStatement(position, buffer) {
1513 const alternatePosition = buffer[position + 4];
1514 return {
1515 type: 'IfStatement',
1516 start: buffer[position],
1517 end: buffer[position + 1],
1518 test: convertNode(buffer[position + 2], buffer),
1519 consequent: convertNode(buffer[position + 3], buffer),
1520 alternate: alternatePosition === 0 ? null : convertNode(alternatePosition, buffer)
1521 };
1522 },
1523 function importAttribute(position, buffer) {
1524 return {
1525 type: 'ImportAttribute',
1526 start: buffer[position],
1527 end: buffer[position + 1],
1528 key: convertNode(buffer[position + 2], buffer),
1529 value: convertNode(buffer[position + 3], buffer)
1530 };
1531 },
1532 function importDeclaration(position, buffer) {
1533 return {
1534 type: 'ImportDeclaration',
1535 start: buffer[position],
1536 end: buffer[position + 1],
1537 specifiers: convertNodeList(buffer[position + 2], buffer),
1538 source: convertNode(buffer[position + 3], buffer),
1539 attributes: convertNodeList(buffer[position + 4], buffer)
1540 };
1541 },
1542 function importDefaultSpecifier(position, buffer) {
1543 return {
1544 type: 'ImportDefaultSpecifier',
1545 start: buffer[position],
1546 end: buffer[position + 1],
1547 local: convertNode(buffer[position + 2], buffer)
1548 };
1549 },
1550 function importExpression(position, buffer) {
1551 const optionsPosition = buffer[position + 3];
1552 return {
1553 type: 'ImportExpression',
1554 start: buffer[position],
1555 end: buffer[position + 1],
1556 source: convertNode(buffer[position + 2], buffer),
1557 options: optionsPosition === 0 ? null : convertNode(optionsPosition, buffer)
1558 };
1559 },
1560 function importNamespaceSpecifier(position, buffer) {
1561 return {
1562 type: 'ImportNamespaceSpecifier',
1563 start: buffer[position],
1564 end: buffer[position + 1],
1565 local: convertNode(buffer[position + 2], buffer)
1566 };
1567 },
1568 function importSpecifier(position, buffer) {
1569 const importedPosition = buffer[position + 2];
1570 const local = convertNode(buffer[position + 3], buffer);
1571 return {
1572 type: 'ImportSpecifier',
1573 start: buffer[position],
1574 end: buffer[position + 1],
1575 imported: importedPosition === 0 ? { ...local } : convertNode(importedPosition, buffer),
1576 local
1577 };
1578 },
1579 function jsxAttribute(position, buffer) {
1580 const valuePosition = buffer[position + 3];
1581 return {
1582 type: 'JSXAttribute',
1583 start: buffer[position],
1584 end: buffer[position + 1],
1585 name: convertNode(buffer[position + 2], buffer),
1586 value: valuePosition === 0 ? null : convertNode(valuePosition, buffer)
1587 };
1588 },
1589 function jsxClosingElement(position, buffer) {
1590 return {
1591 type: 'JSXClosingElement',
1592 start: buffer[position],
1593 end: buffer[position + 1],
1594 name: convertNode(buffer[position + 2], buffer)
1595 };
1596 },
1597 function jsxClosingFragment(position, buffer) {
1598 return {
1599 type: 'JSXClosingFragment',
1600 start: buffer[position],
1601 end: buffer[position + 1]
1602 };
1603 },
1604 function jsxElement(position, buffer) {
1605 const closingElementPosition = buffer[position + 4];
1606 return {
1607 type: 'JSXElement',
1608 start: buffer[position],
1609 end: buffer[position + 1],
1610 openingElement: convertNode(buffer[position + 2], buffer),
1611 children: convertNodeList(buffer[position + 3], buffer),
1612 closingElement: closingElementPosition === 0 ? null : convertNode(closingElementPosition, buffer)
1613 };
1614 },
1615 function jsxEmptyExpression(position, buffer) {
1616 return {
1617 type: 'JSXEmptyExpression',
1618 start: buffer[position],
1619 end: buffer[position + 1]
1620 };
1621 },
1622 function jsxExpressionContainer(position, buffer) {
1623 return {
1624 type: 'JSXExpressionContainer',
1625 start: buffer[position],
1626 end: buffer[position + 1],
1627 expression: convertNode(buffer[position + 2], buffer)
1628 };
1629 },
1630 function jsxFragment(position, buffer) {
1631 return {
1632 type: 'JSXFragment',
1633 start: buffer[position],
1634 end: buffer[position + 1],
1635 openingFragment: convertNode(buffer[position + 2], buffer),
1636 children: convertNodeList(buffer[position + 3], buffer),
1637 closingFragment: convertNode(buffer[position + 4], buffer)
1638 };
1639 },
1640 function jsxIdentifier(position, buffer) {
1641 return {
1642 type: 'JSXIdentifier',
1643 start: buffer[position],
1644 end: buffer[position + 1],
1645 name: buffer.convertString(buffer[position + 2])
1646 };
1647 },
1648 function jsxMemberExpression(position, buffer) {
1649 return {
1650 type: 'JSXMemberExpression',
1651 start: buffer[position],
1652 end: buffer[position + 1],
1653 object: convertNode(buffer[position + 2], buffer),
1654 property: convertNode(buffer[position + 3], buffer)
1655 };
1656 },
1657 function jsxNamespacedName(position, buffer) {
1658 return {
1659 type: 'JSXNamespacedName',
1660 start: buffer[position],
1661 end: buffer[position + 1],
1662 namespace: convertNode(buffer[position + 2], buffer),
1663 name: convertNode(buffer[position + 3], buffer)
1664 };
1665 },
1666 function jsxOpeningElement(position, buffer) {
1667 const flags = buffer[position + 2];
1668 return {
1669 type: 'JSXOpeningElement',
1670 start: buffer[position],
1671 end: buffer[position + 1],
1672 selfClosing: (flags & 1) === 1,
1673 name: convertNode(buffer[position + 3], buffer),
1674 attributes: convertNodeList(buffer[position + 4], buffer)
1675 };
1676 },
1677 function jsxOpeningFragment(position, buffer) {
1678 return {
1679 type: 'JSXOpeningFragment',
1680 start: buffer[position],
1681 end: buffer[position + 1],
1682 attributes: [],
1683 selfClosing: false
1684 };
1685 },
1686 function jsxSpreadAttribute(position, buffer) {
1687 return {
1688 type: 'JSXSpreadAttribute',
1689 start: buffer[position],
1690 end: buffer[position + 1],
1691 argument: convertNode(buffer[position + 2], buffer)
1692 };
1693 },
1694 function jsxSpreadChild(position, buffer) {
1695 return {
1696 type: 'JSXSpreadChild',
1697 start: buffer[position],
1698 end: buffer[position + 1],
1699 expression: convertNode(buffer[position + 2], buffer)
1700 };
1701 },
1702 function jsxText(position, buffer) {
1703 return {
1704 type: 'JSXText',
1705 start: buffer[position],
1706 end: buffer[position + 1],
1707 value: buffer.convertString(buffer[position + 2]),
1708 raw: buffer.convertString(buffer[position + 3])
1709 };
1710 },
1711 function labeledStatement(position, buffer) {
1712 return {
1713 type: 'LabeledStatement',
1714 start: buffer[position],
1715 end: buffer[position + 1],
1716 label: convertNode(buffer[position + 2], buffer),
1717 body: convertNode(buffer[position + 3], buffer)
1718 };
1719 },
1720 function literalBigInt(position, buffer) {
1721 const bigint = buffer.convertString(buffer[position + 2]);
1722 return {
1723 type: 'Literal',
1724 start: buffer[position],
1725 end: buffer[position + 1],
1726 bigint,
1727 raw: buffer.convertString(buffer[position + 3]),
1728 value: BigInt(bigint)
1729 };
1730 },
1731 function literalBoolean(position, buffer) {
1732 const flags = buffer[position + 2];
1733 const value = (flags & 1) === 1;
1734 return {
1735 type: 'Literal',
1736 start: buffer[position],
1737 end: buffer[position + 1],
1738 value,
1739 raw: value ? 'true' : 'false'
1740 };
1741 },
1742 function literalNull(position, buffer) {
1743 return {
1744 type: 'Literal',
1745 start: buffer[position],
1746 end: buffer[position + 1],
1747 raw: 'null',
1748 value: null
1749 };
1750 },
1751 function literalNumber(position, buffer) {
1752 const rawPosition = buffer[position + 2];
1753 return {
1754 type: 'Literal',
1755 start: buffer[position],
1756 end: buffer[position + 1],
1757 raw: rawPosition === 0 ? undefined : buffer.convertString(rawPosition),
1758 value: new DataView(buffer.buffer).getFloat64((position + 3) << 2, true)
1759 };
1760 },
1761 function literalRegExp(position, buffer) {
1762 const flags = buffer.convertString(buffer[position + 2]);
1763 const pattern = buffer.convertString(buffer[position + 3]);
1764 return {
1765 type: 'Literal',
1766 start: buffer[position],
1767 end: buffer[position + 1],
1768 raw: `/${pattern}/${flags}`,
1769 regex: { flags, pattern },
1770 value: new RegExp(pattern, flags)
1771 };
1772 },
1773 function literalString(position, buffer) {
1774 const rawPosition = buffer[position + 3];
1775 return {
1776 type: 'Literal',
1777 start: buffer[position],
1778 end: buffer[position + 1],
1779 value: buffer.convertString(buffer[position + 2]),
1780 raw: rawPosition === 0 ? undefined : buffer.convertString(rawPosition)
1781 };
1782 },
1783 function logicalExpression(position, buffer) {
1784 return {
1785 type: 'LogicalExpression',
1786 start: buffer[position],
1787 end: buffer[position + 1],
1788 operator: FIXED_STRINGS[buffer[position + 2]],
1789 left: convertNode(buffer[position + 3], buffer),
1790 right: convertNode(buffer[position + 4], buffer)
1791 };
1792 },
1793 function memberExpression(position, buffer) {
1794 const flags = buffer[position + 2];
1795 return {
1796 type: 'MemberExpression',
1797 start: buffer[position],
1798 end: buffer[position + 1],
1799 computed: (flags & 1) === 1,
1800 optional: (flags & 2) === 2,
1801 object: convertNode(buffer[position + 3], buffer),
1802 property: convertNode(buffer[position + 4], buffer)
1803 };
1804 },
1805 function metaProperty(position, buffer) {
1806 return {
1807 type: 'MetaProperty',
1808 start: buffer[position],
1809 end: buffer[position + 1],
1810 meta: convertNode(buffer[position + 2], buffer),
1811 property: convertNode(buffer[position + 3], buffer)
1812 };
1813 },
1814 function methodDefinition(position, buffer) {
1815 const flags = buffer[position + 2];
1816 return {
1817 type: 'MethodDefinition',
1818 start: buffer[position],
1819 end: buffer[position + 1],
1820 static: (flags & 1) === 1,
1821 computed: (flags & 2) === 2,
1822 decorators: convertNodeList(buffer[position + 3], buffer),
1823 key: convertNode(buffer[position + 4], buffer),
1824 value: convertNode(buffer[position + 5], buffer),
1825 kind: FIXED_STRINGS[buffer[position + 6]]
1826 };
1827 },
1828 function newExpression(position, buffer) {
1829 const annotations = convertAnnotations(buffer[position + 2], buffer);
1830 return {
1831 type: 'NewExpression',
1832 start: buffer[position],
1833 end: buffer[position + 1],
1834 ...(annotations.length > 0 ? { [ANNOTATION_KEY]: annotations } : {}),
1835 callee: convertNode(buffer[position + 3], buffer),
1836 arguments: convertNodeList(buffer[position + 4], buffer)
1837 };
1838 },
1839 function objectExpression(position, buffer) {
1840 return {
1841 type: 'ObjectExpression',
1842 start: buffer[position],
1843 end: buffer[position + 1],
1844 properties: convertNodeList(buffer[position + 2], buffer)
1845 };
1846 },
1847 function objectPattern(position, buffer) {
1848 return {
1849 type: 'ObjectPattern',
1850 start: buffer[position],
1851 end: buffer[position + 1],
1852 properties: convertNodeList(buffer[position + 2], buffer)
1853 };
1854 },
1855 function privateIdentifier(position, buffer) {
1856 return {
1857 type: 'PrivateIdentifier',
1858 start: buffer[position],
1859 end: buffer[position + 1],
1860 name: buffer.convertString(buffer[position + 2])
1861 };
1862 },
1863 function program(position, buffer) {
1864 const invalidAnnotations = convertAnnotations(buffer[position + 3], buffer);
1865 return {
1866 type: 'Program',
1867 start: buffer[position],
1868 end: buffer[position + 1],
1869 body: convertNodeList(buffer[position + 2], buffer),
1870 ...(invalidAnnotations.length > 0 ? { [INVALID_ANNOTATION_KEY]: invalidAnnotations } : {}),
1871 sourceType: 'module'
1872 };
1873 },
1874 function property(position, buffer) {
1875 const flags = buffer[position + 2];
1876 const keyPosition = buffer[position + 3];
1877 const value = convertNode(buffer[position + 4], buffer);
1878 return {
1879 type: 'Property',
1880 start: buffer[position],
1881 end: buffer[position + 1],
1882 method: (flags & 1) === 1,
1883 shorthand: (flags & 2) === 2,
1884 computed: (flags & 4) === 4,
1885 key: keyPosition === 0 ? { ...value } : convertNode(keyPosition, buffer),
1886 value,
1887 kind: FIXED_STRINGS[buffer[position + 5]]
1888 };
1889 },
1890 function propertyDefinition(position, buffer) {
1891 const flags = buffer[position + 2];
1892 const valuePosition = buffer[position + 5];
1893 return {
1894 type: 'PropertyDefinition',
1895 start: buffer[position],
1896 end: buffer[position + 1],
1897 static: (flags & 1) === 1,
1898 computed: (flags & 2) === 2,
1899 decorators: convertNodeList(buffer[position + 3], buffer),
1900 key: convertNode(buffer[position + 4], buffer),
1901 value: valuePosition === 0 ? null : convertNode(valuePosition, buffer)
1902 };
1903 },
1904 function restElement(position, buffer) {
1905 return {
1906 type: 'RestElement',
1907 start: buffer[position],
1908 end: buffer[position + 1],
1909 argument: convertNode(buffer[position + 2], buffer)
1910 };
1911 },
1912 function returnStatement(position, buffer) {
1913 const argumentPosition = buffer[position + 2];
1914 return {
1915 type: 'ReturnStatement',
1916 start: buffer[position],
1917 end: buffer[position + 1],
1918 argument: argumentPosition === 0 ? null : convertNode(argumentPosition, buffer)
1919 };
1920 },
1921 function sequenceExpression(position, buffer) {
1922 return {
1923 type: 'SequenceExpression',
1924 start: buffer[position],
1925 end: buffer[position + 1],
1926 expressions: convertNodeList(buffer[position + 2], buffer)
1927 };
1928 },
1929 function spreadElement(position, buffer) {
1930 return {
1931 type: 'SpreadElement',
1932 start: buffer[position],
1933 end: buffer[position + 1],
1934 argument: convertNode(buffer[position + 2], buffer)
1935 };
1936 },
1937 function staticBlock(position, buffer) {
1938 return {
1939 type: 'StaticBlock',
1940 start: buffer[position],
1941 end: buffer[position + 1],
1942 body: convertNodeList(buffer[position + 2], buffer)
1943 };
1944 },
1945 function superElement(position, buffer) {
1946 return {
1947 type: 'Super',
1948 start: buffer[position],
1949 end: buffer[position + 1]
1950 };
1951 },
1952 function switchCase(position, buffer) {
1953 const testPosition = buffer[position + 2];
1954 return {
1955 type: 'SwitchCase',
1956 start: buffer[position],
1957 end: buffer[position + 1],
1958 test: testPosition === 0 ? null : convertNode(testPosition, buffer),
1959 consequent: convertNodeList(buffer[position + 3], buffer)
1960 };
1961 },
1962 function switchStatement(position, buffer) {
1963 return {
1964 type: 'SwitchStatement',
1965 start: buffer[position],
1966 end: buffer[position + 1],
1967 discriminant: convertNode(buffer[position + 2], buffer),
1968 cases: convertNodeList(buffer[position + 3], buffer)
1969 };
1970 },
1971 function taggedTemplateExpression(position, buffer) {
1972 return {
1973 type: 'TaggedTemplateExpression',
1974 start: buffer[position],
1975 end: buffer[position + 1],
1976 tag: convertNode(buffer[position + 2], buffer),
1977 quasi: convertNode(buffer[position + 3], buffer)
1978 };
1979 },
1980 function templateElement(position, buffer) {
1981 const flags = buffer[position + 2];
1982 const cookedPosition = buffer[position + 3];
1983 const cooked = cookedPosition === 0 ? undefined : buffer.convertString(cookedPosition);
1984 const raw = buffer.convertString(buffer[position + 4]);
1985 return {
1986 type: 'TemplateElement',
1987 start: buffer[position],
1988 end: buffer[position + 1],
1989 tail: (flags & 1) === 1,
1990 value: { cooked, raw }
1991 };
1992 },
1993 function templateLiteral(position, buffer) {
1994 return {
1995 type: 'TemplateLiteral',
1996 start: buffer[position],
1997 end: buffer[position + 1],
1998 quasis: convertNodeList(buffer[position + 2], buffer),
1999 expressions: convertNodeList(buffer[position + 3], buffer)
2000 };
2001 },
2002 function thisExpression(position, buffer) {
2003 return {
2004 type: 'ThisExpression',
2005 start: buffer[position],
2006 end: buffer[position + 1]
2007 };
2008 },
2009 function throwStatement(position, buffer) {
2010 return {
2011 type: 'ThrowStatement',
2012 start: buffer[position],
2013 end: buffer[position + 1],
2014 argument: convertNode(buffer[position + 2], buffer)
2015 };
2016 },
2017 function tryStatement(position, buffer) {
2018 const handlerPosition = buffer[position + 3];
2019 const finalizerPosition = buffer[position + 4];
2020 return {
2021 type: 'TryStatement',
2022 start: buffer[position],
2023 end: buffer[position + 1],
2024 block: convertNode(buffer[position + 2], buffer),
2025 handler: handlerPosition === 0 ? null : convertNode(handlerPosition, buffer),
2026 finalizer: finalizerPosition === 0 ? null : convertNode(finalizerPosition, buffer)
2027 };
2028 },
2029 function unaryExpression(position, buffer) {
2030 return {
2031 type: 'UnaryExpression',
2032 start: buffer[position],
2033 end: buffer[position + 1],
2034 operator: FIXED_STRINGS[buffer[position + 2]],
2035 argument: convertNode(buffer[position + 3], buffer),
2036 prefix: true
2037 };
2038 },
2039 function updateExpression(position, buffer) {
2040 const flags = buffer[position + 2];
2041 return {
2042 type: 'UpdateExpression',
2043 start: buffer[position],
2044 end: buffer[position + 1],
2045 prefix: (flags & 1) === 1,
2046 operator: FIXED_STRINGS[buffer[position + 3]],
2047 argument: convertNode(buffer[position + 4], buffer)
2048 };
2049 },
2050 function variableDeclaration(position, buffer) {
2051 return {
2052 type: 'VariableDeclaration',
2053 start: buffer[position],
2054 end: buffer[position + 1],
2055 kind: FIXED_STRINGS[buffer[position + 2]],
2056 declarations: convertNodeList(buffer[position + 3], buffer)
2057 };
2058 },
2059 function variableDeclarator(position, buffer) {
2060 const initPosition = buffer[position + 3];
2061 return {
2062 type: 'VariableDeclarator',
2063 start: buffer[position],
2064 end: buffer[position + 1],
2065 id: convertNode(buffer[position + 2], buffer),
2066 init: initPosition === 0 ? null : convertNode(initPosition, buffer)
2067 };
2068 },
2069 function whileStatement(position, buffer) {
2070 return {
2071 type: 'WhileStatement',
2072 start: buffer[position],
2073 end: buffer[position + 1],
2074 test: convertNode(buffer[position + 2], buffer),
2075 body: convertNode(buffer[position + 3], buffer)
2076 };
2077 },
2078 function yieldExpression(position, buffer) {
2079 const flags = buffer[position + 2];
2080 const argumentPosition = buffer[position + 3];
2081 return {
2082 type: 'YieldExpression',
2083 start: buffer[position],
2084 end: buffer[position + 1],
2085 delegate: (flags & 1) === 1,
2086 argument: argumentPosition === 0 ? null : convertNode(argumentPosition, buffer)
2087 };
2088 }
2089];
2090function convertNode(position, buffer) {
2091 const nodeType = buffer[position];
2092 const converter = nodeConverters[nodeType];
2093 /* istanbul ignore if: This should never be executed but is a safeguard against faulty buffers */
2094 if (!converter) {
2095 console.trace();
2096 throw new Error(`Unknown node type: ${nodeType}`);
2097 }
2098 return converter(position + 1, buffer);
2099}
2100function convertNodeList(position, buffer) {
2101 if (position === 0)
2102 return EMPTY_ARRAY;
2103 const length = buffer[position++];
2104 const list = new Array(length);
2105 for (let index = 0; index < length; index++) {
2106 const nodePosition = buffer[position++];
2107 list[index] = nodePosition ? convertNode(nodePosition, buffer) : null;
2108 }
2109 return list;
2110}
2111
2112function getAstBuffer(astBuffer) {
2113 const array = new Uint32Array(astBuffer.buffer);
2114 let convertString;
2115 if (typeof Buffer !== 'undefined' && astBuffer instanceof Buffer) {
2116 convertString = (position) => {
2117 const length = array[position++];
2118 const bytePosition = position << 2;
2119 return astBuffer.toString('utf8', bytePosition, bytePosition + length);
2120 };
2121 }
2122 else {
2123 const textDecoder = new TextDecoder();
2124 convertString = (position) => {
2125 const length = array[position++];
2126 const bytePosition = position << 2;
2127 return textDecoder.decode(astBuffer.subarray(bytePosition, bytePosition + length));
2128 };
2129 }
2130 return Object.assign(array, { convertString });
2131}
2132
2133const parseAst = (input, { allowReturnOutsideFunction = false, jsx = false } = {}) => convertProgram(getAstBuffer(native_js.parse(input, allowReturnOutsideFunction, jsx)));
2134const parseAstAsync = async (input, { allowReturnOutsideFunction = false, jsx = false, signal } = {}) => convertProgram(getAstBuffer(await native_js.parseAsync(input, allowReturnOutsideFunction, jsx, signal)));
2135
2136exports.ANNOTATION_KEY = ANNOTATION_KEY;
2137exports.ArrowFunctionExpression = ArrowFunctionExpression;
2138exports.BLANK = BLANK;
2139exports.BlockStatement = BlockStatement;
2140exports.CallExpression = CallExpression;
2141exports.CatchClause = CatchClause;
2142exports.EMPTY_ARRAY = EMPTY_ARRAY;
2143exports.EMPTY_OBJECT = EMPTY_OBJECT;
2144exports.EMPTY_SET = EMPTY_SET;
2145exports.ExportDefaultDeclaration = ExportDefaultDeclaration;
2146exports.ExpressionStatement = ExpressionStatement;
2147exports.FIXED_STRINGS = FIXED_STRINGS;
2148exports.INVALID_ANNOTATION_KEY = INVALID_ANNOTATION_KEY;
2149exports.Identifier = Identifier;
2150exports.LOGLEVEL_DEBUG = LOGLEVEL_DEBUG;
2151exports.LOGLEVEL_ERROR = LOGLEVEL_ERROR;
2152exports.LOGLEVEL_INFO = LOGLEVEL_INFO;
2153exports.LOGLEVEL_WARN = LOGLEVEL_WARN;
2154exports.Literal = Literal;
2155exports.ObjectExpression = ObjectExpression;
2156exports.Program = Program;
2157exports.Property = Property;
2158exports.RestElement = RestElement;
2159exports.ReturnStatement = ReturnStatement;
2160exports.StaticBlock = StaticBlock;
2161exports.TemplateLiteral = TemplateLiteral;
2162exports.URL_AVOIDING_EVAL = URL_AVOIDING_EVAL;
2163exports.URL_GENERATEBUNDLE = URL_GENERATEBUNDLE;
2164exports.URL_JSX = URL_JSX;
2165exports.URL_NAME_IS_NOT_EXPORTED = URL_NAME_IS_NOT_EXPORTED;
2166exports.URL_OUTPUT_AMD_BASEPATH = URL_OUTPUT_AMD_BASEPATH;
2167exports.URL_OUTPUT_AMD_ID = URL_OUTPUT_AMD_ID;
2168exports.URL_OUTPUT_DIR = URL_OUTPUT_DIR;
2169exports.URL_OUTPUT_EXPORTS = URL_OUTPUT_EXPORTS;
2170exports.URL_OUTPUT_EXTERNALIMPORTATTRIBUTES = URL_OUTPUT_EXTERNALIMPORTATTRIBUTES;
2171exports.URL_OUTPUT_FORMAT = URL_OUTPUT_FORMAT;
2172exports.URL_OUTPUT_GENERATEDCODE = URL_OUTPUT_GENERATEDCODE;
2173exports.URL_OUTPUT_GLOBALS = URL_OUTPUT_GLOBALS;
2174exports.URL_OUTPUT_INLINEDYNAMICIMPORTS = URL_OUTPUT_INLINEDYNAMICIMPORTS;
2175exports.URL_OUTPUT_INTEROP = URL_OUTPUT_INTEROP;
2176exports.URL_OUTPUT_MANUALCHUNKS = URL_OUTPUT_MANUALCHUNKS;
2177exports.URL_OUTPUT_SOURCEMAPBASEURL = URL_OUTPUT_SOURCEMAPBASEURL;
2178exports.URL_OUTPUT_SOURCEMAPFILE = URL_OUTPUT_SOURCEMAPFILE;
2179exports.URL_PRESERVEENTRYSIGNATURES = URL_PRESERVEENTRYSIGNATURES;
2180exports.URL_SOURCEMAP_IS_LIKELY_TO_BE_INCORRECT = URL_SOURCEMAP_IS_LIKELY_TO_BE_INCORRECT;
2181exports.URL_THIS_IS_UNDEFINED = URL_THIS_IS_UNDEFINED;
2182exports.URL_TREATING_MODULE_AS_EXTERNAL_DEPENDENCY = URL_TREATING_MODULE_AS_EXTERNAL_DEPENDENCY;
2183exports.URL_TREESHAKE = URL_TREESHAKE;
2184exports.URL_TREESHAKE_MODULESIDEEFFECTS = URL_TREESHAKE_MODULESIDEEFFECTS;
2185exports.URL_WATCH = URL_WATCH;
2186exports.VariableDeclarator = VariableDeclarator;
2187exports.addTrailingSlashIfMissed = addTrailingSlashIfMissed;
2188exports.augmentCodeLocation = augmentCodeLocation;
2189exports.augmentLogMessage = augmentLogMessage;
2190exports.convertAnnotations = convertAnnotations;
2191exports.convertNode = convertNode;
2192exports.error = error;
2193exports.getAliasName = getAliasName;
2194exports.getAstBuffer = getAstBuffer;
2195exports.getImportPath = getImportPath;
2196exports.getRollupError = getRollupError;
2197exports.getRollupUrl = getRollupUrl;
2198exports.isAbsolute = isAbsolute;
2199exports.isPathFragment = isPathFragment;
2200exports.isRelative = isRelative;
2201exports.isValidUrl = isValidUrl;
2202exports.locate = locate;
2203exports.logAddonNotGenerated = logAddonNotGenerated;
2204exports.logAlreadyClosed = logAlreadyClosed;
2205exports.logAmbiguousExternalNamespaces = logAmbiguousExternalNamespaces;
2206exports.logAnonymousPluginCache = logAnonymousPluginCache;
2207exports.logAssetNotFinalisedForFileName = logAssetNotFinalisedForFileName;
2208exports.logAssetReferenceIdNotFoundForSetSource = logAssetReferenceIdNotFoundForSetSource;
2209exports.logAssetSourceAlreadySet = logAssetSourceAlreadySet;
2210exports.logBadLoader = logBadLoader;
2211exports.logCannotAssignModuleToChunk = logCannotAssignModuleToChunk;
2212exports.logCannotBundleConfigAsEsm = logCannotBundleConfigAsEsm;
2213exports.logCannotCallNamespace = logCannotCallNamespace;
2214exports.logCannotEmitFromOptionsHook = logCannotEmitFromOptionsHook;
2215exports.logCannotLoadConfigAsCjs = logCannotLoadConfigAsCjs;
2216exports.logCannotLoadConfigAsEsm = logCannotLoadConfigAsEsm;
2217exports.logChunkInvalid = logChunkInvalid;
2218exports.logChunkNotGeneratedForFileName = logChunkNotGeneratedForFileName;
2219exports.logCircularDependency = logCircularDependency;
2220exports.logCircularReexport = logCircularReexport;
2221exports.logConflictingSourcemapSources = logConflictingSourcemapSources;
2222exports.logConstVariableReassignError = logConstVariableReassignError;
2223exports.logCyclicCrossChunkReexport = logCyclicCrossChunkReexport;
2224exports.logDuplicateArgumentNameError = logDuplicateArgumentNameError;
2225exports.logDuplicateExportError = logDuplicateExportError;
2226exports.logDuplicateImportOptions = logDuplicateImportOptions;
2227exports.logDuplicatePluginName = logDuplicatePluginName;
2228exports.logEmptyChunk = logEmptyChunk;
2229exports.logEntryCannotBeExternal = logEntryCannotBeExternal;
2230exports.logEval = logEval;
2231exports.logExternalModulesCannotBeIncludedInManualChunks = logExternalModulesCannotBeIncludedInManualChunks;
2232exports.logExternalModulesCannotBeTransformedToModules = logExternalModulesCannotBeTransformedToModules;
2233exports.logExternalSyntheticExports = logExternalSyntheticExports;
2234exports.logFailAfterWarnings = logFailAfterWarnings;
2235exports.logFailedValidation = logFailedValidation;
2236exports.logFileNameConflict = logFileNameConflict;
2237exports.logFileReferenceIdNotFoundForFilename = logFileReferenceIdNotFoundForFilename;
2238exports.logFirstSideEffect = logFirstSideEffect;
2239exports.logIllegalIdentifierAsName = logIllegalIdentifierAsName;
2240exports.logIllegalImportReassignment = logIllegalImportReassignment;
2241exports.logImplicitDependantCannotBeExternal = logImplicitDependantCannotBeExternal;
2242exports.logImplicitDependantIsNotIncluded = logImplicitDependantIsNotIncluded;
2243exports.logImportAttributeIsInvalid = logImportAttributeIsInvalid;
2244exports.logImportOptionsAreInvalid = logImportOptionsAreInvalid;
2245exports.logIncompatibleExportOptionValue = logIncompatibleExportOptionValue;
2246exports.logInconsistentImportAttributes = logInconsistentImportAttributes;
2247exports.logInputHookInOutputPlugin = logInputHookInOutputPlugin;
2248exports.logInternalIdCannotBeExternal = logInternalIdCannotBeExternal;
2249exports.logInvalidAddonPluginHook = logInvalidAddonPluginHook;
2250exports.logInvalidAnnotation = logInvalidAnnotation;
2251exports.logInvalidExportOptionValue = logInvalidExportOptionValue;
2252exports.logInvalidFormatForTopLevelAwait = logInvalidFormatForTopLevelAwait;
2253exports.logInvalidFunctionPluginHook = logInvalidFunctionPluginHook;
2254exports.logInvalidLogPosition = logInvalidLogPosition;
2255exports.logInvalidOption = logInvalidOption;
2256exports.logInvalidRollupPhaseForChunkEmission = logInvalidRollupPhaseForChunkEmission;
2257exports.logInvalidSetAssetSourceCall = logInvalidSetAssetSourceCall;
2258exports.logInvalidSourcemapForError = logInvalidSourcemapForError;
2259exports.logLevelPriority = logLevelPriority;
2260exports.logMissingConfig = logMissingConfig;
2261exports.logMissingEntryExport = logMissingEntryExport;
2262exports.logMissingExport = logMissingExport;
2263exports.logMissingExternalConfig = logMissingExternalConfig;
2264exports.logMissingFileOrDirOption = logMissingFileOrDirOption;
2265exports.logMissingGlobalName = logMissingGlobalName;
2266exports.logMissingJsxExport = logMissingJsxExport;
2267exports.logMissingNameOptionForIifeExport = logMissingNameOptionForIifeExport;
2268exports.logMissingNameOptionForUmdExport = logMissingNameOptionForUmdExport;
2269exports.logMissingNodeBuiltins = logMissingNodeBuiltins;
2270exports.logMixedExport = logMixedExport;
2271exports.logModuleLevelDirective = logModuleLevelDirective;
2272exports.logModuleParseError = logModuleParseError;
2273exports.logNamespaceConflict = logNamespaceConflict;
2274exports.logNoAssetSourceSet = logNoAssetSourceSet;
2275exports.logNoTransformMapOrAstWithoutCode = logNoTransformMapOrAstWithoutCode;
2276exports.logOnlyInlineSourcemapsForStdout = logOnlyInlineSourcemapsForStdout;
2277exports.logOptimizeChunkStatus = logOptimizeChunkStatus;
2278exports.logParseError = logParseError;
2279exports.logPluginError = logPluginError;
2280exports.logRedeclarationError = logRedeclarationError;
2281exports.logReservedNamespace = logReservedNamespace;
2282exports.logShimmedExport = logShimmedExport;
2283exports.logSourcemapBroken = logSourcemapBroken;
2284exports.logSyntheticNamedExportsNeedNamespaceExport = logSyntheticNamedExportsNeedNamespaceExport;
2285exports.logThisIsUndefined = logThisIsUndefined;
2286exports.logUnexpectedNamedImport = logUnexpectedNamedImport;
2287exports.logUnexpectedNamespaceReexport = logUnexpectedNamespaceReexport;
2288exports.logUnknownOption = logUnknownOption;
2289exports.logUnresolvedEntry = logUnresolvedEntry;
2290exports.logUnresolvedImplicitDependant = logUnresolvedImplicitDependant;
2291exports.logUnresolvedImport = logUnresolvedImport;
2292exports.logUnresolvedImportTreatedAsExternal = logUnresolvedImportTreatedAsExternal;
2293exports.logUnusedExternalImports = logUnusedExternalImports;
2294exports.normalize = normalize;
2295exports.parseAst = parseAst;
2296exports.parseAstAsync = parseAstAsync;
2297exports.printQuotedStringList = printQuotedStringList;
2298exports.relative = relative;
2299exports.relativeId = relativeId;
2300exports.warnDeprecation = warnDeprecation;
2301//# sourceMappingURL=parseAst.js.map
Note: See TracBrowser for help on using the repository browser.