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