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