@rollup/wasm-node 4.0.0-24 → 4.0.0-25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/rollup +9 -8
- package/dist/es/getLogFilter.js +2 -2
- package/dist/es/parseAst.js +12 -0
- package/dist/es/rollup.js +4 -3
- package/dist/es/shared/node-entry.js +1021 -3121
- package/dist/es/shared/parseAst.js +2134 -0
- package/dist/es/shared/watch.js +4 -3
- package/dist/getLogFilter.js +2 -2
- package/dist/loadConfigFile.js +3 -2
- package/dist/parseAst.d.ts +3 -0
- package/dist/parseAst.js +21 -0
- package/dist/rollup.d.ts +6 -1
- package/dist/rollup.js +5 -4
- package/dist/shared/fsevents-importer.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +33 -32
- package/dist/shared/parseAst.js +2326 -0
- package/dist/shared/rollup.js +2269 -4454
- package/dist/shared/watch-cli.js +5 -4
- package/dist/shared/watch-proxy.js +4 -3
- package/dist/shared/watch.js +4 -3
- package/dist/wasm-node/bindings_wasm.js +14 -4
- package/dist/wasm-node/bindings_wasm_bg.wasm +0 -0
- package/package.json +18 -13
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.0.0-
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.0.0-25
|
|
4
|
+
Thu, 05 Oct 2023 14:11:47 GMT - commit 1ac6bbc437c7ed0de3ad23e4e0904f00783e703d
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
8
8
|
Released under the MIT License.
|
|
9
9
|
*/
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
10
|
+
import { normalize, getImportPath, LOGLEVEL_WARN, logUnusedExternalImports, ANNOTATION_KEY, INVALID_ANNOTATION_KEY, logInvalidAnnotation, logModuleLevelDirective, logIllegalImportReassignment, logMissingExport, logCannotCallNamespace, logEval, LOGLEVEL_INFO, logFirstSideEffect, locate, logThisIsUndefined, logImportAttributeIsInvalid, logImportOptionsAreInvalid, error, logSyntheticNamedExportsNeedNamespaceExport, logInvalidFormatForTopLevelAwait, logInvalidSourcemapForError, augmentCodeLocation, logInconsistentImportAttributes, logNamespaceConflict, logAmbiguousExternalNamespaces, logShimmedExport, parseAst, logModuleParseError, logCircularReexport, logMissingNodeBuiltins, logIllegalIdentifierAsName, logMissingNameOptionForIifeExport, logMissingNameOptionForUmdExport, logAddonNotGenerated, logIncompatibleExportOptionValue, logMixedExport, logFailedValidation, isPathFragment, logCyclicCrossChunkReexport, getAliasName, logUnexpectedNamedImport, isAbsolute as isAbsolute$1, relative as relative$1, logUnexpectedNamespaceReexport, logEmptyChunk, logMissingGlobalName, logOptimizeChunkStatus, logSourcemapBroken, logConflictingSourcemapSources, logChunkInvalid, logInvalidOption, URL_OUTPUT_FORMAT, URL_OUTPUT_DIR, URL_OUTPUT_SOURCEMAPFILE, URL_OUTPUT_AMD_ID, logCannotAssignModuleToChunk, logAnonymousPluginCache, logDuplicatePluginName, LOGLEVEL_ERROR, logLevelPriority, relativeId, LOGLEVEL_DEBUG, logUnknownOption, printQuotedStringList, logInvalidSetAssetSourceCall, logPluginError, logNoTransformMapOrAstWithoutCode, logBadLoader, logExternalModulesCannotBeTransformedToModules, logInternalIdCannotBeExternal, isRelative, logUnresolvedImport, logUnresolvedImportTreatedAsExternal, logExternalSyntheticExports, logUnresolvedEntry, logUnresolvedImplicitDependant, logExternalModulesCannotBeIncludedInManualChunks, logEntryCannotBeExternal, logImplicitDependantCannotBeExternal, logNoAssetSourceSet, logFileReferenceIdNotFoundForFilename, logAssetReferenceIdNotFoundForSetSource, logAssetSourceAlreadySet, logInvalidRollupPhaseForChunkEmission, logFileNameConflict, logAssetNotFinalisedForFileName, logChunkNotGeneratedForFileName, logInvalidLogPosition, logInvalidRollupPhaseForAddWatchFile, logInputHookInOutputPlugin, logInvalidFunctionPluginHook, logInvalidAddonPluginHook, logImplicitDependantIsNotIncluded, logCircularDependency, URL_TREESHAKE_MODULESIDEEFFECTS, URL_TREESHAKE, URL_OUTPUT_INLINEDYNAMICIMPORTS, URL_PRESERVEENTRYSIGNATURES, URL_OUTPUT_AMD_BASEPATH, logInvalidExportOptionValue, warnDeprecation, URL_OUTPUT_INTEROP, URL_OUTPUT_MANUALCHUNKS, isValidUrl, addTrailingSlashIfMissed, URL_OUTPUT_SOURCEMAPBASEURL, URL_OUTPUT_GENERATEDCODE, URL_OUTPUT_EXTERNALIMPORTATTRIBUTES, logAlreadyClosed, logMissingFileOrDirOption, logCannotEmitFromOptionsHook, URL_WATCH } from './parseAst.js';
|
|
11
|
+
import { relative, dirname, basename, extname, resolve as resolve$1 } from 'node:path';
|
|
12
|
+
import require$$0$1, { win32, posix, isAbsolute, resolve } from 'path';
|
|
12
13
|
import process$1, { env as env$1 } from 'node:process';
|
|
13
14
|
import { performance } from 'node:perf_hooks';
|
|
14
|
-
import { xxhashBase64Url
|
|
15
|
+
import { xxhashBase64Url } from '../../native.js';
|
|
15
16
|
import { lstat, realpath, readdir, readFile, mkdir, writeFile } from 'node:fs/promises';
|
|
16
17
|
import * as tty from 'tty';
|
|
17
18
|
|
|
18
|
-
var version = "4.0.0-
|
|
19
|
+
var version = "4.0.0-25";
|
|
19
20
|
|
|
20
21
|
const comma = ','.charCodeAt(0);
|
|
21
22
|
const semicolon = ';'.charCodeAt(0);
|
|
@@ -449,7 +450,7 @@ function isObject$1(thing) {
|
|
|
449
450
|
return toString.call(thing) === '[object Object]';
|
|
450
451
|
}
|
|
451
452
|
|
|
452
|
-
function getLocator
|
|
453
|
+
function getLocator(source) {
|
|
453
454
|
const originalLines = source.split('\n');
|
|
454
455
|
const lineOffsets = [];
|
|
455
456
|
|
|
@@ -489,16 +490,35 @@ class Mappings {
|
|
|
489
490
|
|
|
490
491
|
addEdit(sourceIndex, content, loc, nameIndex) {
|
|
491
492
|
if (content.length) {
|
|
493
|
+
let contentLineEnd = content.indexOf('\n', 0);
|
|
494
|
+
let previousContentLineEnd = -1;
|
|
495
|
+
while (contentLineEnd >= 0) {
|
|
496
|
+
const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
497
|
+
if (nameIndex >= 0) {
|
|
498
|
+
segment.push(nameIndex);
|
|
499
|
+
}
|
|
500
|
+
this.rawSegments.push(segment);
|
|
501
|
+
|
|
502
|
+
this.generatedCodeLine += 1;
|
|
503
|
+
this.raw[this.generatedCodeLine] = this.rawSegments = [];
|
|
504
|
+
this.generatedCodeColumn = 0;
|
|
505
|
+
|
|
506
|
+
previousContentLineEnd = contentLineEnd;
|
|
507
|
+
contentLineEnd = content.indexOf('\n', contentLineEnd + 1);
|
|
508
|
+
}
|
|
509
|
+
|
|
492
510
|
const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
|
|
493
511
|
if (nameIndex >= 0) {
|
|
494
512
|
segment.push(nameIndex);
|
|
495
513
|
}
|
|
496
514
|
this.rawSegments.push(segment);
|
|
515
|
+
|
|
516
|
+
this.advance(content.slice(previousContentLineEnd + 1));
|
|
497
517
|
} else if (this.pending) {
|
|
498
518
|
this.rawSegments.push(this.pending);
|
|
519
|
+
this.advance(content);
|
|
499
520
|
}
|
|
500
521
|
|
|
501
|
-
this.advance(content);
|
|
502
522
|
this.pending = null;
|
|
503
523
|
}
|
|
504
524
|
|
|
@@ -684,7 +704,7 @@ class MagicString {
|
|
|
684
704
|
const names = Object.keys(this.storedNames);
|
|
685
705
|
const mappings = new Mappings(options.hires);
|
|
686
706
|
|
|
687
|
-
const locate = getLocator
|
|
707
|
+
const locate = getLocator(this.original);
|
|
688
708
|
|
|
689
709
|
if (this.intro) {
|
|
690
710
|
mappings.advance(this.intro);
|
|
@@ -1137,7 +1157,7 @@ class MagicString {
|
|
|
1137
1157
|
_splitChunk(chunk, index) {
|
|
1138
1158
|
if (chunk.edited && chunk.content.length) {
|
|
1139
1159
|
// zero-length edited chunks are a special case (overlapping replacements)
|
|
1140
|
-
const loc = getLocator
|
|
1160
|
+
const loc = getLocator(this.original)(index);
|
|
1141
1161
|
throw new Error(
|
|
1142
1162
|
`Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – "${chunk.original}")`,
|
|
1143
1163
|
);
|
|
@@ -1460,7 +1480,7 @@ let Bundle$1 = class Bundle {
|
|
|
1460
1480
|
|
|
1461
1481
|
const sourceIndex = source.filename ? this.uniqueSourceIndexByFilename[source.filename] : -1;
|
|
1462
1482
|
const magicString = source.content;
|
|
1463
|
-
const locate = getLocator
|
|
1483
|
+
const locate = getLocator(magicString.original);
|
|
1464
1484
|
|
|
1465
1485
|
if (magicString.intro) {
|
|
1466
1486
|
mappings.advance(magicString.intro);
|
|
@@ -1652,28 +1672,6 @@ let Bundle$1 = class Bundle {
|
|
|
1652
1672
|
}
|
|
1653
1673
|
};
|
|
1654
1674
|
|
|
1655
|
-
const ANY_SLASH_REGEX = /[/\\]/;
|
|
1656
|
-
function relative(from, to) {
|
|
1657
|
-
const fromParts = from.split(ANY_SLASH_REGEX).filter(Boolean);
|
|
1658
|
-
const toParts = to.split(ANY_SLASH_REGEX).filter(Boolean);
|
|
1659
|
-
if (fromParts[0] === '.')
|
|
1660
|
-
fromParts.shift();
|
|
1661
|
-
if (toParts[0] === '.')
|
|
1662
|
-
toParts.shift();
|
|
1663
|
-
while (fromParts[0] && toParts[0] && fromParts[0] === toParts[0]) {
|
|
1664
|
-
fromParts.shift();
|
|
1665
|
-
toParts.shift();
|
|
1666
|
-
}
|
|
1667
|
-
while (toParts[0] === '..' && fromParts.length > 0) {
|
|
1668
|
-
toParts.shift();
|
|
1669
|
-
fromParts.pop();
|
|
1670
|
-
}
|
|
1671
|
-
while (fromParts.pop()) {
|
|
1672
|
-
toParts.unshift('..');
|
|
1673
|
-
}
|
|
1674
|
-
return toParts.join('/');
|
|
1675
|
-
}
|
|
1676
|
-
|
|
1677
1675
|
const needsEscapeRegEx = /[\n\r'\\\u2028\u2029]/;
|
|
1678
1676
|
const quoteNewlineRegEx = /([\n\r'\u2028\u2029])/g;
|
|
1679
1677
|
const backSlashRegEx = /\\/g;
|
|
@@ -1683,52 +1681,6 @@ function escapeId(id) {
|
|
|
1683
1681
|
return id.replace(backSlashRegEx, '\\\\').replace(quoteNewlineRegEx, '\\$1');
|
|
1684
1682
|
}
|
|
1685
1683
|
|
|
1686
|
-
const ABSOLUTE_PATH_REGEX = /^(?:\/|(?:[A-Za-z]:)?[/\\|])/;
|
|
1687
|
-
const RELATIVE_PATH_REGEX = /^\.?\.(\/|$)/;
|
|
1688
|
-
function isAbsolute(path) {
|
|
1689
|
-
return ABSOLUTE_PATH_REGEX.test(path);
|
|
1690
|
-
}
|
|
1691
|
-
function isRelative(path) {
|
|
1692
|
-
return RELATIVE_PATH_REGEX.test(path);
|
|
1693
|
-
}
|
|
1694
|
-
const BACKSLASH_REGEX = /\\/g;
|
|
1695
|
-
function normalize(path) {
|
|
1696
|
-
return path.replace(BACKSLASH_REGEX, '/');
|
|
1697
|
-
}
|
|
1698
|
-
|
|
1699
|
-
function getAliasName(id) {
|
|
1700
|
-
const base = basename(id);
|
|
1701
|
-
return base.slice(0, Math.max(0, base.length - extname(id).length));
|
|
1702
|
-
}
|
|
1703
|
-
function relativeId(id) {
|
|
1704
|
-
if (!isAbsolute(id))
|
|
1705
|
-
return id;
|
|
1706
|
-
return relative(resolve(), id);
|
|
1707
|
-
}
|
|
1708
|
-
function isPathFragment(name) {
|
|
1709
|
-
// starting with "/", "./", "../", "C:/"
|
|
1710
|
-
return (name[0] === '/' || (name[0] === '.' && (name[1] === '/' || name[1] === '.')) || isAbsolute(name));
|
|
1711
|
-
}
|
|
1712
|
-
const UPPER_DIR_REGEX = /^(\.\.\/)*\.\.$/;
|
|
1713
|
-
function getImportPath(importerId, targetPath, stripJsExtension, ensureFileName) {
|
|
1714
|
-
while (targetPath.startsWith('../')) {
|
|
1715
|
-
targetPath = targetPath.slice(3);
|
|
1716
|
-
importerId = '_/' + importerId;
|
|
1717
|
-
}
|
|
1718
|
-
let relativePath = normalize(relative(dirname(importerId), targetPath));
|
|
1719
|
-
if (stripJsExtension && relativePath.endsWith('.js')) {
|
|
1720
|
-
relativePath = relativePath.slice(0, -3);
|
|
1721
|
-
}
|
|
1722
|
-
if (ensureFileName) {
|
|
1723
|
-
if (relativePath === '')
|
|
1724
|
-
return '../' + basename(targetPath);
|
|
1725
|
-
if (UPPER_DIR_REGEX.test(relativePath)) {
|
|
1726
|
-
return [...relativePath.split('/'), '..', basename(targetPath)].join('/');
|
|
1727
|
-
}
|
|
1728
|
-
}
|
|
1729
|
-
return relativePath ? (relativePath.startsWith('..') ? relativePath : './' + relativePath) : '.';
|
|
1730
|
-
}
|
|
1731
|
-
|
|
1732
1684
|
class ExternalChunk {
|
|
1733
1685
|
constructor(module, options, inputBase) {
|
|
1734
1686
|
this.options = options;
|
|
@@ -1750,10 +1702,10 @@ class ExternalChunk {
|
|
|
1750
1702
|
const { paths } = this.options;
|
|
1751
1703
|
return (this.fileName =
|
|
1752
1704
|
(typeof paths === 'function' ? paths(this.id) : paths[this.id]) ||
|
|
1753
|
-
(this.renormalizeRenderPath ? normalize(relative
|
|
1705
|
+
(this.renormalizeRenderPath ? normalize(relative(this.inputBase, this.id)) : this.id));
|
|
1754
1706
|
}
|
|
1755
1707
|
getImportAttributes(snippets) {
|
|
1756
|
-
return (this.importAttributes ||= formatAttributes
|
|
1708
|
+
return (this.importAttributes ||= formatAttributes(this.options.format === 'es' &&
|
|
1757
1709
|
this.options.externalImportAttributes &&
|
|
1758
1710
|
this.moduleInfo.attributes, snippets));
|
|
1759
1711
|
}
|
|
@@ -1763,7 +1715,7 @@ class ExternalChunk {
|
|
|
1763
1715
|
: this.getFileName());
|
|
1764
1716
|
}
|
|
1765
1717
|
}
|
|
1766
|
-
function formatAttributes
|
|
1718
|
+
function formatAttributes(attributes, { getObject }) {
|
|
1767
1719
|
if (!attributes) {
|
|
1768
1720
|
return null;
|
|
1769
1721
|
}
|
|
@@ -2084,1031 +2036,231 @@ function makeLegal(value) {
|
|
|
2084
2036
|
return value || '_';
|
|
2085
2037
|
}
|
|
2086
2038
|
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2039
|
+
class ExternalModule {
|
|
2040
|
+
constructor(options, id, moduleSideEffects, meta, renormalizeRenderPath, attributes) {
|
|
2041
|
+
this.options = options;
|
|
2042
|
+
this.id = id;
|
|
2043
|
+
this.renormalizeRenderPath = renormalizeRenderPath;
|
|
2044
|
+
this.dynamicImporters = [];
|
|
2045
|
+
this.execIndex = Infinity;
|
|
2046
|
+
this.exportedVariables = new Map();
|
|
2047
|
+
this.importers = [];
|
|
2048
|
+
this.reexported = false;
|
|
2049
|
+
this.used = false;
|
|
2050
|
+
this.declarations = new Map();
|
|
2051
|
+
this.mostCommonSuggestion = 0;
|
|
2052
|
+
this.nameSuggestions = new Map();
|
|
2053
|
+
this.suggestedVariableName = makeLegal(id.split(/[/\\]/).pop());
|
|
2054
|
+
const { importers, dynamicImporters } = this;
|
|
2055
|
+
this.info = {
|
|
2056
|
+
ast: null,
|
|
2057
|
+
attributes,
|
|
2058
|
+
code: null,
|
|
2059
|
+
dynamicallyImportedIdResolutions: EMPTY_ARRAY,
|
|
2060
|
+
dynamicallyImportedIds: EMPTY_ARRAY,
|
|
2061
|
+
get dynamicImporters() {
|
|
2062
|
+
return dynamicImporters.sort();
|
|
2063
|
+
},
|
|
2064
|
+
exportedBindings: null,
|
|
2065
|
+
exports: null,
|
|
2066
|
+
hasDefaultExport: null,
|
|
2067
|
+
id,
|
|
2068
|
+
implicitlyLoadedAfterOneOf: EMPTY_ARRAY,
|
|
2069
|
+
implicitlyLoadedBefore: EMPTY_ARRAY,
|
|
2070
|
+
importedIdResolutions: EMPTY_ARRAY,
|
|
2071
|
+
importedIds: EMPTY_ARRAY,
|
|
2072
|
+
get importers() {
|
|
2073
|
+
return importers.sort();
|
|
2074
|
+
},
|
|
2075
|
+
isEntry: false,
|
|
2076
|
+
isExternal: true,
|
|
2077
|
+
isIncluded: null,
|
|
2078
|
+
meta,
|
|
2079
|
+
moduleSideEffects,
|
|
2080
|
+
syntheticNamedExports: false
|
|
2081
|
+
};
|
|
2082
|
+
}
|
|
2083
|
+
getVariableForExportName(name) {
|
|
2084
|
+
const declaration = this.declarations.get(name);
|
|
2085
|
+
if (declaration)
|
|
2086
|
+
return [declaration];
|
|
2087
|
+
const externalVariable = new ExternalVariable(this, name);
|
|
2088
|
+
this.declarations.set(name, externalVariable);
|
|
2089
|
+
this.exportedVariables.set(externalVariable, name);
|
|
2090
|
+
return [externalVariable];
|
|
2091
|
+
}
|
|
2092
|
+
suggestName(name) {
|
|
2093
|
+
const value = (this.nameSuggestions.get(name) ?? 0) + 1;
|
|
2094
|
+
this.nameSuggestions.set(name, value);
|
|
2095
|
+
if (value > this.mostCommonSuggestion) {
|
|
2096
|
+
this.mostCommonSuggestion = value;
|
|
2097
|
+
this.suggestedVariableName = name;
|
|
2098
|
+
}
|
|
2099
|
+
}
|
|
2100
|
+
warnUnusedImports() {
|
|
2101
|
+
const unused = [...this.declarations]
|
|
2102
|
+
.filter(([name, declaration]) => name !== '*' && !declaration.included && !this.reexported && !declaration.referenced)
|
|
2103
|
+
.map(([name]) => name);
|
|
2104
|
+
if (unused.length === 0)
|
|
2105
|
+
return;
|
|
2106
|
+
const importersSet = new Set();
|
|
2107
|
+
for (const name of unused) {
|
|
2108
|
+
for (const importer of this.declarations.get(name).module.importers) {
|
|
2109
|
+
importersSet.add(importer);
|
|
2110
|
+
}
|
|
2111
|
+
}
|
|
2112
|
+
const importersArray = [...importersSet];
|
|
2113
|
+
this.options.onLog(LOGLEVEL_WARN, logUnusedExternalImports(this.id, unused, importersArray));
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2098
2116
|
|
|
2099
|
-
|
|
2117
|
+
function getDefaultExportFromCjs (x) {
|
|
2118
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
2119
|
+
}
|
|
2100
2120
|
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
function
|
|
2106
|
-
|
|
2121
|
+
function getAugmentedNamespace(n) {
|
|
2122
|
+
if (n.__esModule) return n;
|
|
2123
|
+
var f = n.default;
|
|
2124
|
+
if (typeof f == "function") {
|
|
2125
|
+
var a = function a () {
|
|
2126
|
+
if (this instanceof a) {
|
|
2127
|
+
return Reflect.construct(f, arguments, this.constructor);
|
|
2128
|
+
}
|
|
2129
|
+
return f.apply(this, arguments);
|
|
2130
|
+
};
|
|
2131
|
+
a.prototype = f.prototype;
|
|
2132
|
+
} else a = {};
|
|
2133
|
+
Object.defineProperty(a, '__esModule', {value: true});
|
|
2134
|
+
Object.keys(n).forEach(function (k) {
|
|
2135
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
2136
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
2137
|
+
enumerable: true,
|
|
2138
|
+
get: function () {
|
|
2139
|
+
return n[k];
|
|
2140
|
+
}
|
|
2141
|
+
});
|
|
2142
|
+
});
|
|
2143
|
+
return a;
|
|
2107
2144
|
}
|
|
2108
2145
|
|
|
2146
|
+
var utils$3 = {};
|
|
2147
|
+
|
|
2148
|
+
const path$1 = require$$0$1;
|
|
2149
|
+
const WIN_SLASH = '\\\\/';
|
|
2150
|
+
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
2151
|
+
|
|
2109
2152
|
/**
|
|
2110
|
-
*
|
|
2111
|
-
* @param {import('./types').Options} [options]
|
|
2153
|
+
* Posix glob regex
|
|
2112
2154
|
*/
|
|
2113
|
-
function getLocator(source, options = {}) {
|
|
2114
|
-
const { offsetLine = 0, offsetColumn = 0 } = options;
|
|
2115
2155
|
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2156
|
+
const DOT_LITERAL = '\\.';
|
|
2157
|
+
const PLUS_LITERAL = '\\+';
|
|
2158
|
+
const QMARK_LITERAL = '\\?';
|
|
2159
|
+
const SLASH_LITERAL = '\\/';
|
|
2160
|
+
const ONE_CHAR = '(?=.)';
|
|
2161
|
+
const QMARK = '[^/]';
|
|
2162
|
+
const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
|
2163
|
+
const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
|
2164
|
+
const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
|
2165
|
+
const NO_DOT = `(?!${DOT_LITERAL})`;
|
|
2166
|
+
const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
|
|
2167
|
+
const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
|
|
2168
|
+
const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
|
|
2169
|
+
const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
|
|
2170
|
+
const STAR = `${QMARK}*?`;
|
|
2119
2171
|
|
|
2120
|
-
|
|
2121
|
-
|
|
2172
|
+
const POSIX_CHARS = {
|
|
2173
|
+
DOT_LITERAL,
|
|
2174
|
+
PLUS_LITERAL,
|
|
2175
|
+
QMARK_LITERAL,
|
|
2176
|
+
SLASH_LITERAL,
|
|
2177
|
+
ONE_CHAR,
|
|
2178
|
+
QMARK,
|
|
2179
|
+
END_ANCHOR,
|
|
2180
|
+
DOTS_SLASH,
|
|
2181
|
+
NO_DOT,
|
|
2182
|
+
NO_DOTS,
|
|
2183
|
+
NO_DOT_SLASH,
|
|
2184
|
+
NO_DOTS_SLASH,
|
|
2185
|
+
QMARK_NO_DOT,
|
|
2186
|
+
STAR,
|
|
2187
|
+
START_ANCHOR
|
|
2188
|
+
};
|
|
2122
2189
|
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2190
|
+
/**
|
|
2191
|
+
* Windows glob regex
|
|
2192
|
+
*/
|
|
2126
2193
|
|
|
2127
|
-
|
|
2194
|
+
const WINDOWS_CHARS = {
|
|
2195
|
+
...POSIX_CHARS,
|
|
2128
2196
|
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2197
|
+
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
|
2198
|
+
QMARK: WIN_NO_SLASH,
|
|
2199
|
+
STAR: `${WIN_NO_SLASH}*?`,
|
|
2200
|
+
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
|
2201
|
+
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
2202
|
+
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
2203
|
+
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
|
2204
|
+
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
2205
|
+
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
|
2206
|
+
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
|
2207
|
+
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
|
|
2208
|
+
};
|
|
2138
2209
|
|
|
2139
|
-
|
|
2210
|
+
/**
|
|
2211
|
+
* POSIX Bracket Regex
|
|
2212
|
+
*/
|
|
2140
2213
|
|
|
2141
|
-
|
|
2214
|
+
const POSIX_REGEX_SOURCE$1 = {
|
|
2215
|
+
alnum: 'a-zA-Z0-9',
|
|
2216
|
+
alpha: 'a-zA-Z',
|
|
2217
|
+
ascii: '\\x00-\\x7F',
|
|
2218
|
+
blank: ' \\t',
|
|
2219
|
+
cntrl: '\\x00-\\x1F\\x7F',
|
|
2220
|
+
digit: '0-9',
|
|
2221
|
+
graph: '\\x21-\\x7E',
|
|
2222
|
+
lower: 'a-z',
|
|
2223
|
+
print: '\\x20-\\x7E ',
|
|
2224
|
+
punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
|
|
2225
|
+
space: ' \\t\\r\\n\\v\\f',
|
|
2226
|
+
upper: 'A-Z',
|
|
2227
|
+
word: 'A-Za-z0-9_',
|
|
2228
|
+
xdigit: 'A-Fa-f0-9'
|
|
2229
|
+
};
|
|
2142
2230
|
|
|
2143
|
-
|
|
2231
|
+
var constants$2 = {
|
|
2232
|
+
MAX_LENGTH: 1024 * 64,
|
|
2233
|
+
POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1,
|
|
2144
2234
|
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
}
|
|
2235
|
+
// regular expressions
|
|
2236
|
+
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
2237
|
+
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
2238
|
+
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
2239
|
+
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
2240
|
+
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
2241
|
+
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
2153
2242
|
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2243
|
+
// Replace globs with equivalent patterns to reduce parsing time.
|
|
2244
|
+
REPLACEMENTS: {
|
|
2245
|
+
'***': '*',
|
|
2246
|
+
'**/**': '**',
|
|
2247
|
+
'**/**/**': '**'
|
|
2248
|
+
},
|
|
2158
2249
|
|
|
2159
|
-
|
|
2160
|
-
|
|
2250
|
+
// Digits
|
|
2251
|
+
CHAR_0: 48, /* 0 */
|
|
2252
|
+
CHAR_9: 57, /* 9 */
|
|
2161
2253
|
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
*/
|
|
2168
|
-
function locate(source, search, options) {
|
|
2169
|
-
return getLocator(source, options)(search, options && options.startIndex);
|
|
2170
|
-
}
|
|
2254
|
+
// Alphabet chars.
|
|
2255
|
+
CHAR_UPPERCASE_A: 65, /* A */
|
|
2256
|
+
CHAR_LOWERCASE_A: 97, /* a */
|
|
2257
|
+
CHAR_UPPERCASE_Z: 90, /* Z */
|
|
2258
|
+
CHAR_LOWERCASE_Z: 122, /* z */
|
|
2171
2259
|
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
while (index--)
|
|
2175
|
-
result += ' ';
|
|
2176
|
-
return result;
|
|
2177
|
-
}
|
|
2178
|
-
function tabsToSpaces(value) {
|
|
2179
|
-
return value.replace(/^\t+/, match => match.split('\t').join(' '));
|
|
2180
|
-
}
|
|
2181
|
-
const LINE_TRUNCATE_LENGTH = 120;
|
|
2182
|
-
const MIN_CHARACTERS_SHOWN_AFTER_LOCATION = 10;
|
|
2183
|
-
const ELLIPSIS = '...';
|
|
2184
|
-
function getCodeFrame(source, line, column) {
|
|
2185
|
-
let lines = source.split('\n');
|
|
2186
|
-
// Needed if a plugin did not generate correct sourcemaps
|
|
2187
|
-
if (line > lines.length)
|
|
2188
|
-
return '';
|
|
2189
|
-
const maxLineLength = Math.max(tabsToSpaces(lines[line - 1].slice(0, column)).length +
|
|
2190
|
-
MIN_CHARACTERS_SHOWN_AFTER_LOCATION +
|
|
2191
|
-
ELLIPSIS.length, LINE_TRUNCATE_LENGTH);
|
|
2192
|
-
const frameStart = Math.max(0, line - 3);
|
|
2193
|
-
let frameEnd = Math.min(line + 2, lines.length);
|
|
2194
|
-
lines = lines.slice(frameStart, frameEnd);
|
|
2195
|
-
while (!/\S/.test(lines[lines.length - 1])) {
|
|
2196
|
-
lines.pop();
|
|
2197
|
-
frameEnd -= 1;
|
|
2198
|
-
}
|
|
2199
|
-
const digits = String(frameEnd).length;
|
|
2200
|
-
return lines
|
|
2201
|
-
.map((sourceLine, index) => {
|
|
2202
|
-
const isErrorLine = frameStart + index + 1 === line;
|
|
2203
|
-
let lineNumber = String(index + frameStart + 1);
|
|
2204
|
-
while (lineNumber.length < digits)
|
|
2205
|
-
lineNumber = ` ${lineNumber}`;
|
|
2206
|
-
let displayedLine = tabsToSpaces(sourceLine);
|
|
2207
|
-
if (displayedLine.length > maxLineLength) {
|
|
2208
|
-
displayedLine = `${displayedLine.slice(0, maxLineLength - ELLIPSIS.length)}${ELLIPSIS}`;
|
|
2209
|
-
}
|
|
2210
|
-
if (isErrorLine) {
|
|
2211
|
-
const indicator = spaces(digits + 2 + tabsToSpaces(sourceLine.slice(0, column)).length) + '^';
|
|
2212
|
-
return `${lineNumber}: ${displayedLine}\n${indicator}`;
|
|
2213
|
-
}
|
|
2214
|
-
return `${lineNumber}: ${displayedLine}`;
|
|
2215
|
-
})
|
|
2216
|
-
.join('\n');
|
|
2217
|
-
}
|
|
2260
|
+
CHAR_LEFT_PARENTHESES: 40, /* ( */
|
|
2261
|
+
CHAR_RIGHT_PARENTHESES: 41, /* ) */
|
|
2218
2262
|
|
|
2219
|
-
|
|
2220
|
-
const isSingleItem = list.length <= 1;
|
|
2221
|
-
const quotedList = list.map(item => `"${item}"`);
|
|
2222
|
-
let output = isSingleItem
|
|
2223
|
-
? quotedList[0]
|
|
2224
|
-
: `${quotedList.slice(0, -1).join(', ')} and ${quotedList.slice(-1)[0]}`;
|
|
2225
|
-
if (verbs) {
|
|
2226
|
-
output += ` ${isSingleItem ? verbs[0] : verbs[1]}`;
|
|
2227
|
-
}
|
|
2228
|
-
return output;
|
|
2229
|
-
}
|
|
2230
|
-
|
|
2231
|
-
function isValidUrl(url) {
|
|
2232
|
-
try {
|
|
2233
|
-
new URL(url);
|
|
2234
|
-
}
|
|
2235
|
-
catch {
|
|
2236
|
-
return false;
|
|
2237
|
-
}
|
|
2238
|
-
return true;
|
|
2239
|
-
}
|
|
2240
|
-
function getRollupUrl(snippet) {
|
|
2241
|
-
return `https://rollupjs.org/${snippet}`;
|
|
2242
|
-
}
|
|
2243
|
-
function addTrailingSlashIfMissed(url) {
|
|
2244
|
-
if (!url.endsWith('/')) {
|
|
2245
|
-
return url + '/';
|
|
2246
|
-
}
|
|
2247
|
-
return url;
|
|
2248
|
-
}
|
|
2249
|
-
|
|
2250
|
-
// troubleshooting
|
|
2251
|
-
const URL_AVOIDING_EVAL = 'troubleshooting/#avoiding-eval';
|
|
2252
|
-
const URL_NAME_IS_NOT_EXPORTED = 'troubleshooting/#error-name-is-not-exported-by-module';
|
|
2253
|
-
const URL_THIS_IS_UNDEFINED = 'troubleshooting/#error-this-is-undefined';
|
|
2254
|
-
const URL_TREATING_MODULE_AS_EXTERNAL_DEPENDENCY = 'troubleshooting/#warning-treating-module-as-external-dependency';
|
|
2255
|
-
const URL_SOURCEMAP_IS_LIKELY_TO_BE_INCORRECT = 'troubleshooting/#warning-sourcemap-is-likely-to-be-incorrect';
|
|
2256
|
-
const URL_OUTPUT_AMD_ID = 'configuration-options/#output-amd-id';
|
|
2257
|
-
const URL_OUTPUT_AMD_BASEPATH = 'configuration-options/#output-amd-basepath';
|
|
2258
|
-
const URL_OUTPUT_DIR = 'configuration-options/#output-dir';
|
|
2259
|
-
const URL_OUTPUT_EXPORTS = 'configuration-options/#output-exports';
|
|
2260
|
-
const URL_OUTPUT_EXTEND = 'configuration-options/#output-extend';
|
|
2261
|
-
const URL_OUTPUT_EXTERNALIMPORTATTRIBUTES = 'configuration-options/#output-externalimportattributes';
|
|
2262
|
-
const URL_OUTPUT_FORMAT = 'configuration-options/#output-format';
|
|
2263
|
-
const URL_OUTPUT_GENERATEDCODE = 'configuration-options/#output-generatedcode';
|
|
2264
|
-
const URL_OUTPUT_GLOBALS = 'configuration-options/#output-globals';
|
|
2265
|
-
const URL_OUTPUT_INLINEDYNAMICIMPORTS = 'configuration-options/#output-inlinedynamicimports';
|
|
2266
|
-
const URL_OUTPUT_INTEROP = 'configuration-options/#output-interop';
|
|
2267
|
-
const URL_OUTPUT_MANUALCHUNKS = 'configuration-options/#output-manualchunks';
|
|
2268
|
-
const URL_OUTPUT_NAME = 'configuration-options/#output-name';
|
|
2269
|
-
const URL_OUTPUT_SOURCEMAPBASEURL = 'configuration-options/#output-sourcemapbaseurl';
|
|
2270
|
-
const URL_OUTPUT_SOURCEMAPFILE = 'configuration-options/#output-sourcemapfile';
|
|
2271
|
-
const URL_PRESERVEENTRYSIGNATURES = 'configuration-options/#preserveentrysignatures';
|
|
2272
|
-
const URL_TREESHAKE = 'configuration-options/#treeshake';
|
|
2273
|
-
const URL_TREESHAKE_PURE = 'configuration-options/#pure';
|
|
2274
|
-
const URL_TREESHAKE_NOSIDEEFFECTS = 'configuration-options/#no-side-effects';
|
|
2275
|
-
const URL_TREESHAKE_MODULESIDEEFFECTS = 'configuration-options/#treeshake-modulesideeffects';
|
|
2276
|
-
const URL_WATCH = 'configuration-options/#watch';
|
|
2277
|
-
|
|
2278
|
-
function error(base) {
|
|
2279
|
-
if (!(base instanceof Error)) {
|
|
2280
|
-
base = Object.assign(new Error(base.message), base);
|
|
2281
|
-
Object.defineProperty(base, 'name', { value: 'RollupError' });
|
|
2282
|
-
}
|
|
2283
|
-
throw base;
|
|
2284
|
-
}
|
|
2285
|
-
function augmentCodeLocation(properties, pos, source, id) {
|
|
2286
|
-
if (typeof pos === 'object') {
|
|
2287
|
-
const { line, column } = pos;
|
|
2288
|
-
properties.loc = { column, file: id, line };
|
|
2289
|
-
}
|
|
2290
|
-
else {
|
|
2291
|
-
properties.pos = pos;
|
|
2292
|
-
const location = locate(source, pos, { offsetLine: 1 });
|
|
2293
|
-
if (!location) {
|
|
2294
|
-
return;
|
|
2295
|
-
}
|
|
2296
|
-
const { line, column } = location;
|
|
2297
|
-
properties.loc = { column, file: id, line };
|
|
2298
|
-
}
|
|
2299
|
-
if (properties.frame === undefined) {
|
|
2300
|
-
const { line, column } = properties.loc;
|
|
2301
|
-
properties.frame = getCodeFrame(source, line, column);
|
|
2302
|
-
}
|
|
2303
|
-
}
|
|
2304
|
-
// Error codes should be sorted alphabetically while errors should be sorted by
|
|
2305
|
-
// error code below
|
|
2306
|
-
const ADDON_ERROR = 'ADDON_ERROR', ALREADY_CLOSED = 'ALREADY_CLOSED', AMBIGUOUS_EXTERNAL_NAMESPACES = 'AMBIGUOUS_EXTERNAL_NAMESPACES', ANONYMOUS_PLUGIN_CACHE = 'ANONYMOUS_PLUGIN_CACHE', ASSET_NOT_FINALISED = 'ASSET_NOT_FINALISED', ASSET_NOT_FOUND = 'ASSET_NOT_FOUND', ASSET_SOURCE_ALREADY_SET = 'ASSET_SOURCE_ALREADY_SET', ASSET_SOURCE_MISSING = 'ASSET_SOURCE_MISSING', BAD_LOADER = 'BAD_LOADER', CANNOT_CALL_NAMESPACE = 'CANNOT_CALL_NAMESPACE', CANNOT_EMIT_FROM_OPTIONS_HOOK = 'CANNOT_EMIT_FROM_OPTIONS_HOOK', CHUNK_NOT_GENERATED = 'CHUNK_NOT_GENERATED', CHUNK_INVALID = 'CHUNK_INVALID', CIRCULAR_DEPENDENCY = 'CIRCULAR_DEPENDENCY', CIRCULAR_REEXPORT = 'CIRCULAR_REEXPORT', CYCLIC_CROSS_CHUNK_REEXPORT = 'CYCLIC_CROSS_CHUNK_REEXPORT', DEPRECATED_FEATURE = 'DEPRECATED_FEATURE', DUPLICATE_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', 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_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_EXPORT = 'MISSING_EXPORT', 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', OPTIMIZE_CHUNK_STATUS = 'OPTIMIZE_CHUNK_STATUS', PARSE_ERROR = 'PARSE_ERROR', PLUGIN_ERROR = 'PLUGIN_ERROR', SHIMMED_EXPORT = 'SHIMMED_EXPORT', SOURCEMAP_BROKEN = 'SOURCEMAP_BROKEN', SOURCEMAP_ERROR = 'SOURCEMAP_ERROR', SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT = 'SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT', THIS_IS_UNDEFINED = 'THIS_IS_UNDEFINED', UNEXPECTED_NAMED_IMPORT = 'UNEXPECTED_NAMED_IMPORT', UNKNOWN_OPTION = 'UNKNOWN_OPTION', UNRESOLVED_ENTRY = 'UNRESOLVED_ENTRY', UNRESOLVED_IMPORT = 'UNRESOLVED_IMPORT', UNUSED_EXTERNAL_IMPORT = 'UNUSED_EXTERNAL_IMPORT', VALIDATION_ERROR = 'VALIDATION_ERROR';
|
|
2307
|
-
function logAddonNotGenerated(message, hook, plugin) {
|
|
2308
|
-
return {
|
|
2309
|
-
code: ADDON_ERROR,
|
|
2310
|
-
message: `Could not retrieve "${hook}". Check configuration of plugin "${plugin}".
|
|
2311
|
-
\tError Message: ${message}`
|
|
2312
|
-
};
|
|
2313
|
-
}
|
|
2314
|
-
function logAlreadyClosed() {
|
|
2315
|
-
return {
|
|
2316
|
-
code: ALREADY_CLOSED,
|
|
2317
|
-
message: 'Bundle is already closed, no more calls to "generate" or "write" are allowed.'
|
|
2318
|
-
};
|
|
2319
|
-
}
|
|
2320
|
-
function logAmbiguousExternalNamespaces(binding, reexportingModule, usedModule, sources) {
|
|
2321
|
-
return {
|
|
2322
|
-
binding,
|
|
2323
|
-
code: AMBIGUOUS_EXTERNAL_NAMESPACES,
|
|
2324
|
-
ids: sources,
|
|
2325
|
-
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)}".`,
|
|
2326
|
-
reexporter: reexportingModule
|
|
2327
|
-
};
|
|
2328
|
-
}
|
|
2329
|
-
function logAnonymousPluginCache() {
|
|
2330
|
-
return {
|
|
2331
|
-
code: ANONYMOUS_PLUGIN_CACHE,
|
|
2332
|
-
message: 'A plugin is trying to use the Rollup cache but is not declaring a plugin name or cacheKey.'
|
|
2333
|
-
};
|
|
2334
|
-
}
|
|
2335
|
-
function logAssetNotFinalisedForFileName(name) {
|
|
2336
|
-
return {
|
|
2337
|
-
code: ASSET_NOT_FINALISED,
|
|
2338
|
-
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.`
|
|
2339
|
-
};
|
|
2340
|
-
}
|
|
2341
|
-
function logAssetReferenceIdNotFoundForSetSource(assetReferenceId) {
|
|
2342
|
-
return {
|
|
2343
|
-
code: ASSET_NOT_FOUND,
|
|
2344
|
-
message: `Plugin error - Unable to set the source for unknown asset "${assetReferenceId}".`
|
|
2345
|
-
};
|
|
2346
|
-
}
|
|
2347
|
-
function logAssetSourceAlreadySet(name) {
|
|
2348
|
-
return {
|
|
2349
|
-
code: ASSET_SOURCE_ALREADY_SET,
|
|
2350
|
-
message: `Unable to set the source for asset "${name}", source already set.`
|
|
2351
|
-
};
|
|
2352
|
-
}
|
|
2353
|
-
function logNoAssetSourceSet(assetName) {
|
|
2354
|
-
return {
|
|
2355
|
-
code: ASSET_SOURCE_MISSING,
|
|
2356
|
-
message: `Plugin error creating asset "${assetName}" - no asset source set.`
|
|
2357
|
-
};
|
|
2358
|
-
}
|
|
2359
|
-
function logBadLoader(id) {
|
|
2360
|
-
return {
|
|
2361
|
-
code: BAD_LOADER,
|
|
2362
|
-
message: `Error loading "${relativeId(id)}": plugin load hook should return a string, a { code, map } object, or nothing/null.`
|
|
2363
|
-
};
|
|
2364
|
-
}
|
|
2365
|
-
function logCannotCallNamespace(name) {
|
|
2366
|
-
return {
|
|
2367
|
-
code: CANNOT_CALL_NAMESPACE,
|
|
2368
|
-
message: `Cannot call a namespace ("${name}").`
|
|
2369
|
-
};
|
|
2370
|
-
}
|
|
2371
|
-
function logCannotEmitFromOptionsHook() {
|
|
2372
|
-
return {
|
|
2373
|
-
code: CANNOT_EMIT_FROM_OPTIONS_HOOK,
|
|
2374
|
-
message: `Cannot emit files or set asset sources in the "outputOptions" hook, use the "renderStart" hook instead.`
|
|
2375
|
-
};
|
|
2376
|
-
}
|
|
2377
|
-
function logChunkNotGeneratedForFileName(name) {
|
|
2378
|
-
return {
|
|
2379
|
-
code: CHUNK_NOT_GENERATED,
|
|
2380
|
-
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.`
|
|
2381
|
-
};
|
|
2382
|
-
}
|
|
2383
|
-
function logChunkInvalid({ fileName, code }, { pos, message }) {
|
|
2384
|
-
const errorProperties = {
|
|
2385
|
-
code: CHUNK_INVALID,
|
|
2386
|
-
message: `Chunk "${fileName}" is not valid JavaScript: ${message}.`
|
|
2387
|
-
};
|
|
2388
|
-
augmentCodeLocation(errorProperties, pos, code, fileName);
|
|
2389
|
-
return errorProperties;
|
|
2390
|
-
}
|
|
2391
|
-
function logCircularDependency(cyclePath) {
|
|
2392
|
-
return {
|
|
2393
|
-
code: CIRCULAR_DEPENDENCY,
|
|
2394
|
-
ids: cyclePath,
|
|
2395
|
-
message: `Circular dependency: ${cyclePath.map(relativeId).join(' -> ')}`
|
|
2396
|
-
};
|
|
2397
|
-
}
|
|
2398
|
-
function logCircularReexport(exportName, exporter) {
|
|
2399
|
-
return {
|
|
2400
|
-
code: CIRCULAR_REEXPORT,
|
|
2401
|
-
exporter,
|
|
2402
|
-
message: `"${exportName}" cannot be exported from "${relativeId(exporter)}" as it is a reexport that references itself.`
|
|
2403
|
-
};
|
|
2404
|
-
}
|
|
2405
|
-
function logCyclicCrossChunkReexport(exportName, exporter, reexporter, importer, preserveModules) {
|
|
2406
|
-
return {
|
|
2407
|
-
code: CYCLIC_CROSS_CHUNK_REEXPORT,
|
|
2408
|
-
exporter,
|
|
2409
|
-
id: importer,
|
|
2410
|
-
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.`,
|
|
2411
|
-
reexporter
|
|
2412
|
-
};
|
|
2413
|
-
}
|
|
2414
|
-
function logDeprecation(deprecation, urlSnippet, plugin) {
|
|
2415
|
-
return {
|
|
2416
|
-
code: DEPRECATED_FEATURE,
|
|
2417
|
-
message: deprecation,
|
|
2418
|
-
url: getRollupUrl(urlSnippet),
|
|
2419
|
-
...(plugin ? { plugin } : {})
|
|
2420
|
-
};
|
|
2421
|
-
}
|
|
2422
|
-
function logDuplicatePluginName(plugin) {
|
|
2423
|
-
return {
|
|
2424
|
-
code: DUPLICATE_PLUGIN_NAME,
|
|
2425
|
-
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).`
|
|
2426
|
-
};
|
|
2427
|
-
}
|
|
2428
|
-
function logEmptyChunk(chunkName) {
|
|
2429
|
-
return {
|
|
2430
|
-
code: EMPTY_BUNDLE,
|
|
2431
|
-
message: `Generated an empty chunk: "${chunkName}".`,
|
|
2432
|
-
names: [chunkName]
|
|
2433
|
-
};
|
|
2434
|
-
}
|
|
2435
|
-
function logEval(id) {
|
|
2436
|
-
return {
|
|
2437
|
-
code: EVAL,
|
|
2438
|
-
id,
|
|
2439
|
-
message: `Use of eval in "${relativeId(id)}" is strongly discouraged as it poses security risks and may cause issues with minification.`,
|
|
2440
|
-
url: getRollupUrl(URL_AVOIDING_EVAL)
|
|
2441
|
-
};
|
|
2442
|
-
}
|
|
2443
|
-
function logExternalSyntheticExports(id, importer) {
|
|
2444
|
-
return {
|
|
2445
|
-
code: EXTERNAL_SYNTHETIC_EXPORTS,
|
|
2446
|
-
exporter: id,
|
|
2447
|
-
message: `External "${id}" cannot have "syntheticNamedExports" enabled (imported by "${relativeId(importer)}").`
|
|
2448
|
-
};
|
|
2449
|
-
}
|
|
2450
|
-
function logFileNameConflict(fileName) {
|
|
2451
|
-
return {
|
|
2452
|
-
code: FILE_NAME_CONFLICT,
|
|
2453
|
-
message: `The emitted file "${fileName}" overwrites a previously emitted file of the same name.`
|
|
2454
|
-
};
|
|
2455
|
-
}
|
|
2456
|
-
function logFileReferenceIdNotFoundForFilename(assetReferenceId) {
|
|
2457
|
-
return {
|
|
2458
|
-
code: FILE_NOT_FOUND,
|
|
2459
|
-
message: `Plugin error - Unable to get file name for unknown file "${assetReferenceId}".`
|
|
2460
|
-
};
|
|
2461
|
-
}
|
|
2462
|
-
function logFirstSideEffect(source, id, { line, column }) {
|
|
2463
|
-
return {
|
|
2464
|
-
code: FIRST_SIDE_EFFECT,
|
|
2465
|
-
message: `First side effect in ${relativeId(id)} is at (${line}:${column})\n${getCodeFrame(source, line, column)}`
|
|
2466
|
-
};
|
|
2467
|
-
}
|
|
2468
|
-
function logIllegalIdentifierAsName(name) {
|
|
2469
|
-
return {
|
|
2470
|
-
code: ILLEGAL_IDENTIFIER_AS_NAME,
|
|
2471
|
-
message: `Given name "${name}" is not a legal JS identifier. If you need this, you can try "output.extend: true".`,
|
|
2472
|
-
url: getRollupUrl(URL_OUTPUT_EXTEND)
|
|
2473
|
-
};
|
|
2474
|
-
}
|
|
2475
|
-
function logIllegalImportReassignment(name, importingId) {
|
|
2476
|
-
return {
|
|
2477
|
-
code: ILLEGAL_REASSIGNMENT,
|
|
2478
|
-
message: `Illegal reassignment of import "${name}" in "${relativeId(importingId)}".`
|
|
2479
|
-
};
|
|
2480
|
-
}
|
|
2481
|
-
function logInconsistentImportAttributes(existingAttributes, newAttributes, source, importer) {
|
|
2482
|
-
return {
|
|
2483
|
-
code: INCONSISTENT_IMPORT_ATTRIBUTES,
|
|
2484
|
-
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.`
|
|
2485
|
-
};
|
|
2486
|
-
}
|
|
2487
|
-
const formatAttributes = (attributes) => {
|
|
2488
|
-
const entries = Object.entries(attributes);
|
|
2489
|
-
if (entries.length === 0)
|
|
2490
|
-
return 'no';
|
|
2491
|
-
return entries.map(([key, value]) => `"${key}": "${value}"`).join(', ');
|
|
2492
|
-
};
|
|
2493
|
-
function logInvalidAnnotation(comment, id, type) {
|
|
2494
|
-
return {
|
|
2495
|
-
code: INVALID_ANNOTATION,
|
|
2496
|
-
id,
|
|
2497
|
-
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.`,
|
|
2498
|
-
url: getRollupUrl(type === 'noSideEffects' ? URL_TREESHAKE_NOSIDEEFFECTS : URL_TREESHAKE_PURE)
|
|
2499
|
-
};
|
|
2500
|
-
}
|
|
2501
|
-
function logInputHookInOutputPlugin(pluginName, hookName) {
|
|
2502
|
-
return {
|
|
2503
|
-
code: INPUT_HOOK_IN_OUTPUT_PLUGIN,
|
|
2504
|
-
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.`
|
|
2505
|
-
};
|
|
2506
|
-
}
|
|
2507
|
-
function logCannotAssignModuleToChunk(moduleId, assignToAlias, currentAlias) {
|
|
2508
|
-
return {
|
|
2509
|
-
code: INVALID_CHUNK,
|
|
2510
|
-
message: `Cannot assign "${relativeId(moduleId)}" to the "${assignToAlias}" chunk as it is already in the "${currentAlias}" chunk.`
|
|
2511
|
-
};
|
|
2512
|
-
}
|
|
2513
|
-
function logInvalidExportOptionValue(optionValue) {
|
|
2514
|
-
return {
|
|
2515
|
-
code: INVALID_EXPORT_OPTION,
|
|
2516
|
-
message: `"output.exports" must be "default", "named", "none", "auto", or left unspecified (defaults to "auto"), received "${optionValue}".`,
|
|
2517
|
-
url: getRollupUrl(URL_OUTPUT_EXPORTS)
|
|
2518
|
-
};
|
|
2519
|
-
}
|
|
2520
|
-
function logIncompatibleExportOptionValue(optionValue, keys, entryModule) {
|
|
2521
|
-
return {
|
|
2522
|
-
code: INVALID_EXPORT_OPTION,
|
|
2523
|
-
message: `"${optionValue}" was specified for "output.exports", but entry module "${relativeId(entryModule)}" has the following exports: ${printQuotedStringList(keys)}`,
|
|
2524
|
-
url: getRollupUrl(URL_OUTPUT_EXPORTS)
|
|
2525
|
-
};
|
|
2526
|
-
}
|
|
2527
|
-
function logInternalIdCannotBeExternal(source, importer) {
|
|
2528
|
-
return {
|
|
2529
|
-
code: INVALID_EXTERNAL_ID,
|
|
2530
|
-
message: `"${source}" is imported as an external by "${relativeId(importer)}", but is already an existing non-external module id.`
|
|
2531
|
-
};
|
|
2532
|
-
}
|
|
2533
|
-
function logImportOptionsAreInvalid(importer) {
|
|
2534
|
-
return {
|
|
2535
|
-
code: INVALID_IMPORT_ATTRIBUTE,
|
|
2536
|
-
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.`
|
|
2537
|
-
};
|
|
2538
|
-
}
|
|
2539
|
-
function logImportAttributeIsInvalid(importer) {
|
|
2540
|
-
return {
|
|
2541
|
-
code: INVALID_IMPORT_ATTRIBUTE,
|
|
2542
|
-
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.`
|
|
2543
|
-
};
|
|
2544
|
-
}
|
|
2545
|
-
function logInvalidLogPosition(plugin) {
|
|
2546
|
-
return {
|
|
2547
|
-
code: INVALID_LOG_POSITION,
|
|
2548
|
-
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.`
|
|
2549
|
-
};
|
|
2550
|
-
}
|
|
2551
|
-
function logInvalidOption(option, urlSnippet, explanation, value) {
|
|
2552
|
-
return {
|
|
2553
|
-
code: INVALID_OPTION,
|
|
2554
|
-
message: `Invalid value ${value === undefined ? '' : `${JSON.stringify(value)} `}for option "${option}" - ${explanation}.`,
|
|
2555
|
-
url: getRollupUrl(urlSnippet)
|
|
2556
|
-
};
|
|
2557
|
-
}
|
|
2558
|
-
function logInvalidAddonPluginHook(hook, plugin) {
|
|
2559
|
-
return {
|
|
2560
|
-
code: INVALID_PLUGIN_HOOK,
|
|
2561
|
-
hook,
|
|
2562
|
-
message: `Error running plugin hook "${hook}" for plugin "${plugin}", expected a string, a function hook or an object with a "handler" string or function.`,
|
|
2563
|
-
plugin
|
|
2564
|
-
};
|
|
2565
|
-
}
|
|
2566
|
-
function logInvalidFunctionPluginHook(hook, plugin) {
|
|
2567
|
-
return {
|
|
2568
|
-
code: INVALID_PLUGIN_HOOK,
|
|
2569
|
-
hook,
|
|
2570
|
-
message: `Error running plugin hook "${hook}" for plugin "${plugin}", expected a function hook or an object with a "handler" function.`,
|
|
2571
|
-
plugin
|
|
2572
|
-
};
|
|
2573
|
-
}
|
|
2574
|
-
function logInvalidRollupPhaseForAddWatchFile() {
|
|
2575
|
-
return {
|
|
2576
|
-
code: INVALID_ROLLUP_PHASE,
|
|
2577
|
-
message: `Cannot call "addWatchFile" after the build has finished.`
|
|
2578
|
-
};
|
|
2579
|
-
}
|
|
2580
|
-
function logInvalidRollupPhaseForChunkEmission() {
|
|
2581
|
-
return {
|
|
2582
|
-
code: INVALID_ROLLUP_PHASE,
|
|
2583
|
-
message: `Cannot emit chunks after module loading has finished.`
|
|
2584
|
-
};
|
|
2585
|
-
}
|
|
2586
|
-
function logInvalidSetAssetSourceCall() {
|
|
2587
|
-
return {
|
|
2588
|
-
code: INVALID_SETASSETSOURCE,
|
|
2589
|
-
message: `setAssetSource cannot be called in transform for caching reasons. Use emitFile with a source, or call setAssetSource in another hook.`
|
|
2590
|
-
};
|
|
2591
|
-
}
|
|
2592
|
-
function logInvalidFormatForTopLevelAwait(id, format) {
|
|
2593
|
-
return {
|
|
2594
|
-
code: INVALID_TLA_FORMAT,
|
|
2595
|
-
id,
|
|
2596
|
-
message: `Module format "${format}" does not support top-level await. Use the "es" or "system" output formats rather.`
|
|
2597
|
-
};
|
|
2598
|
-
}
|
|
2599
|
-
function logMissingExport(binding, importingModule, exporter) {
|
|
2600
|
-
const isJson = extname(exporter) === '.json';
|
|
2601
|
-
return {
|
|
2602
|
-
binding,
|
|
2603
|
-
code: MISSING_EXPORT,
|
|
2604
|
-
exporter,
|
|
2605
|
-
id: importingModule,
|
|
2606
|
-
message: `"${binding}" is not exported by "${relativeId(exporter)}", imported by "${relativeId(importingModule)}".${isJson ? ' (Note that you need @rollup/plugin-json to import JSON files)' : ''}`,
|
|
2607
|
-
url: getRollupUrl(URL_NAME_IS_NOT_EXPORTED)
|
|
2608
|
-
};
|
|
2609
|
-
}
|
|
2610
|
-
function logMissingGlobalName(externalId, guess) {
|
|
2611
|
-
return {
|
|
2612
|
-
code: MISSING_GLOBAL_NAME,
|
|
2613
|
-
id: externalId,
|
|
2614
|
-
message: `No name was provided for external module "${externalId}" in "output.globals" – guessing "${guess}".`,
|
|
2615
|
-
names: [guess],
|
|
2616
|
-
url: getRollupUrl(URL_OUTPUT_GLOBALS)
|
|
2617
|
-
};
|
|
2618
|
-
}
|
|
2619
|
-
function logImplicitDependantCannotBeExternal(unresolvedId, implicitlyLoadedBefore) {
|
|
2620
|
-
return {
|
|
2621
|
-
code: MISSING_IMPLICIT_DEPENDANT,
|
|
2622
|
-
message: `Module "${relativeId(unresolvedId)}" that should be implicitly loaded before "${relativeId(implicitlyLoadedBefore)}" cannot be external.`
|
|
2623
|
-
};
|
|
2624
|
-
}
|
|
2625
|
-
function logUnresolvedImplicitDependant(unresolvedId, implicitlyLoadedBefore) {
|
|
2626
|
-
return {
|
|
2627
|
-
code: MISSING_IMPLICIT_DEPENDANT,
|
|
2628
|
-
message: `Module "${relativeId(unresolvedId)}" that should be implicitly loaded before "${relativeId(implicitlyLoadedBefore)}" could not be resolved.`
|
|
2629
|
-
};
|
|
2630
|
-
}
|
|
2631
|
-
function logImplicitDependantIsNotIncluded(module) {
|
|
2632
|
-
const implicitDependencies = [...module.implicitlyLoadedBefore]
|
|
2633
|
-
.map(dependency => relativeId(dependency.id))
|
|
2634
|
-
.sort();
|
|
2635
|
-
return {
|
|
2636
|
-
code: MISSING_IMPLICIT_DEPENDANT,
|
|
2637
|
-
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.`
|
|
2638
|
-
};
|
|
2639
|
-
}
|
|
2640
|
-
function logMissingNameOptionForIifeExport() {
|
|
2641
|
-
return {
|
|
2642
|
-
code: MISSING_NAME_OPTION_FOR_IIFE_EXPORT,
|
|
2643
|
-
message: `If you do not supply "output.name", you may not be able to access the exports of an IIFE bundle.`,
|
|
2644
|
-
url: getRollupUrl(URL_OUTPUT_NAME)
|
|
2645
|
-
};
|
|
2646
|
-
}
|
|
2647
|
-
function logMissingNameOptionForUmdExport() {
|
|
2648
|
-
return {
|
|
2649
|
-
code: MISSING_NAME_OPTION_FOR_IIFE_EXPORT,
|
|
2650
|
-
message: 'You must supply "output.name" for UMD bundles that have exports so that the exports are accessible in environments without a module loader.',
|
|
2651
|
-
url: getRollupUrl(URL_OUTPUT_NAME)
|
|
2652
|
-
};
|
|
2653
|
-
}
|
|
2654
|
-
function logMissingNodeBuiltins(externalBuiltins) {
|
|
2655
|
-
return {
|
|
2656
|
-
code: MISSING_NODE_BUILTINS,
|
|
2657
|
-
ids: externalBuiltins,
|
|
2658
|
-
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`
|
|
2659
|
-
};
|
|
2660
|
-
}
|
|
2661
|
-
// eslint-disable-next-line unicorn/prevent-abbreviations
|
|
2662
|
-
function logMissingFileOrDirOption() {
|
|
2663
|
-
return {
|
|
2664
|
-
code: MISSING_OPTION,
|
|
2665
|
-
message: 'You must specify "output.file" or "output.dir" for the build.',
|
|
2666
|
-
url: getRollupUrl(URL_OUTPUT_DIR)
|
|
2667
|
-
};
|
|
2668
|
-
}
|
|
2669
|
-
function logMixedExport(facadeModuleId, name) {
|
|
2670
|
-
return {
|
|
2671
|
-
code: MIXED_EXPORTS,
|
|
2672
|
-
id: facadeModuleId,
|
|
2673
|
-
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.`,
|
|
2674
|
-
url: getRollupUrl(URL_OUTPUT_EXPORTS)
|
|
2675
|
-
};
|
|
2676
|
-
}
|
|
2677
|
-
function logModuleLevelDirective(directive, id) {
|
|
2678
|
-
return {
|
|
2679
|
-
code: MODULE_LEVEL_DIRECTIVE,
|
|
2680
|
-
id,
|
|
2681
|
-
message: `Module level directives cause errors when bundled, "${directive}" in "${relativeId(id)}" was ignored.`
|
|
2682
|
-
};
|
|
2683
|
-
}
|
|
2684
|
-
function logNamespaceConflict(binding, reexportingModuleId, sources) {
|
|
2685
|
-
return {
|
|
2686
|
-
binding,
|
|
2687
|
-
code: NAMESPACE_CONFLICT,
|
|
2688
|
-
ids: sources,
|
|
2689
|
-
message: `Conflicting namespaces: "${relativeId(reexportingModuleId)}" re-exports "${binding}" from one of the modules ${printQuotedStringList(sources.map(moduleId => relativeId(moduleId)))} (will be ignored).`,
|
|
2690
|
-
reexporter: reexportingModuleId
|
|
2691
|
-
};
|
|
2692
|
-
}
|
|
2693
|
-
function logNoTransformMapOrAstWithoutCode(pluginName) {
|
|
2694
|
-
return {
|
|
2695
|
-
code: NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE,
|
|
2696
|
-
message: `The plugin "${pluginName}" returned a "map" or "ast" without returning ` +
|
|
2697
|
-
'a "code". This will be ignored.'
|
|
2698
|
-
};
|
|
2699
|
-
}
|
|
2700
|
-
function logOptimizeChunkStatus(chunks, smallChunks, pointInTime) {
|
|
2701
|
-
return {
|
|
2702
|
-
code: OPTIMIZE_CHUNK_STATUS,
|
|
2703
|
-
message: `${pointInTime}, there are\n` +
|
|
2704
|
-
`${chunks} chunks, of which\n` +
|
|
2705
|
-
`${smallChunks} are below minChunkSize.`
|
|
2706
|
-
};
|
|
2707
|
-
}
|
|
2708
|
-
function logParseError(error, moduleId) {
|
|
2709
|
-
let message = error.message.replace(/ \(\d+:\d+\)$/, '');
|
|
2710
|
-
if (moduleId.endsWith('.json')) {
|
|
2711
|
-
message += ' (Note that you need @rollup/plugin-json to import JSON files)';
|
|
2712
|
-
}
|
|
2713
|
-
else if (!moduleId.endsWith('.js')) {
|
|
2714
|
-
message += ' (Note that you need plugins to import files that are not JavaScript)';
|
|
2715
|
-
}
|
|
2716
|
-
return {
|
|
2717
|
-
cause: error,
|
|
2718
|
-
code: PARSE_ERROR,
|
|
2719
|
-
id: moduleId,
|
|
2720
|
-
message
|
|
2721
|
-
};
|
|
2722
|
-
}
|
|
2723
|
-
function logPluginError(error, plugin, { hook, id } = {}) {
|
|
2724
|
-
const code = error.code;
|
|
2725
|
-
if (!error.pluginCode &&
|
|
2726
|
-
code != null &&
|
|
2727
|
-
(typeof code !== 'string' || (typeof code === 'string' && !code.startsWith('PLUGIN_')))) {
|
|
2728
|
-
error.pluginCode = code;
|
|
2729
|
-
}
|
|
2730
|
-
error.code = PLUGIN_ERROR;
|
|
2731
|
-
error.plugin = plugin;
|
|
2732
|
-
if (hook) {
|
|
2733
|
-
error.hook = hook;
|
|
2734
|
-
}
|
|
2735
|
-
if (id) {
|
|
2736
|
-
error.id = id;
|
|
2737
|
-
}
|
|
2738
|
-
return error;
|
|
2739
|
-
}
|
|
2740
|
-
function logShimmedExport(id, binding) {
|
|
2741
|
-
return {
|
|
2742
|
-
binding,
|
|
2743
|
-
code: SHIMMED_EXPORT,
|
|
2744
|
-
exporter: id,
|
|
2745
|
-
message: `Missing export "${binding}" has been shimmed in module "${relativeId(id)}".`
|
|
2746
|
-
};
|
|
2747
|
-
}
|
|
2748
|
-
function logSourcemapBroken(plugin) {
|
|
2749
|
-
return {
|
|
2750
|
-
code: SOURCEMAP_BROKEN,
|
|
2751
|
-
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`,
|
|
2752
|
-
plugin,
|
|
2753
|
-
url: getRollupUrl(URL_SOURCEMAP_IS_LIKELY_TO_BE_INCORRECT)
|
|
2754
|
-
};
|
|
2755
|
-
}
|
|
2756
|
-
function logConflictingSourcemapSources(filename) {
|
|
2757
|
-
return {
|
|
2758
|
-
code: SOURCEMAP_BROKEN,
|
|
2759
|
-
message: `Multiple conflicting contents for sourcemap source ${filename}`
|
|
2760
|
-
};
|
|
2761
|
-
}
|
|
2762
|
-
function logInvalidSourcemapForError(error, id, column, line, pos) {
|
|
2763
|
-
return {
|
|
2764
|
-
cause: error,
|
|
2765
|
-
code: SOURCEMAP_ERROR,
|
|
2766
|
-
id,
|
|
2767
|
-
loc: {
|
|
2768
|
-
column,
|
|
2769
|
-
file: id,
|
|
2770
|
-
line
|
|
2771
|
-
},
|
|
2772
|
-
message: `Error when using sourcemap for reporting an error: ${error.message}`,
|
|
2773
|
-
pos
|
|
2774
|
-
};
|
|
2775
|
-
}
|
|
2776
|
-
function logSyntheticNamedExportsNeedNamespaceExport(id, syntheticNamedExportsOption) {
|
|
2777
|
-
return {
|
|
2778
|
-
code: SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT,
|
|
2779
|
-
exporter: id,
|
|
2780
|
-
message: `Module "${relativeId(id)}" that is marked with \`syntheticNamedExports: ${JSON.stringify(syntheticNamedExportsOption)}\` needs ${typeof syntheticNamedExportsOption === 'string' && syntheticNamedExportsOption !== 'default'
|
|
2781
|
-
? `an explicit export named "${syntheticNamedExportsOption}"`
|
|
2782
|
-
: 'a default export'} that does not reexport an unresolved named export of the same module.`
|
|
2783
|
-
};
|
|
2784
|
-
}
|
|
2785
|
-
function logThisIsUndefined() {
|
|
2786
|
-
return {
|
|
2787
|
-
code: THIS_IS_UNDEFINED,
|
|
2788
|
-
message: `The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten`,
|
|
2789
|
-
url: getRollupUrl(URL_THIS_IS_UNDEFINED)
|
|
2790
|
-
};
|
|
2791
|
-
}
|
|
2792
|
-
function logUnexpectedNamedImport(id, imported, isReexport) {
|
|
2793
|
-
const importType = isReexport ? 'reexport' : 'import';
|
|
2794
|
-
return {
|
|
2795
|
-
code: UNEXPECTED_NAMED_IMPORT,
|
|
2796
|
-
exporter: id,
|
|
2797
|
-
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.`,
|
|
2798
|
-
url: getRollupUrl(URL_OUTPUT_INTEROP)
|
|
2799
|
-
};
|
|
2800
|
-
}
|
|
2801
|
-
function logUnexpectedNamespaceReexport(id) {
|
|
2802
|
-
return {
|
|
2803
|
-
code: UNEXPECTED_NAMED_IMPORT,
|
|
2804
|
-
exporter: id,
|
|
2805
|
-
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.`,
|
|
2806
|
-
url: getRollupUrl(URL_OUTPUT_INTEROP)
|
|
2807
|
-
};
|
|
2808
|
-
}
|
|
2809
|
-
function logUnknownOption(optionType, unknownOptions, validOptions) {
|
|
2810
|
-
return {
|
|
2811
|
-
code: UNKNOWN_OPTION,
|
|
2812
|
-
message: `Unknown ${optionType}: ${unknownOptions.join(', ')}. Allowed options: ${validOptions.join(', ')}`
|
|
2813
|
-
};
|
|
2814
|
-
}
|
|
2815
|
-
function logEntryCannotBeExternal(unresolvedId) {
|
|
2816
|
-
return {
|
|
2817
|
-
code: UNRESOLVED_ENTRY,
|
|
2818
|
-
message: `Entry module "${relativeId(unresolvedId)}" cannot be external.`
|
|
2819
|
-
};
|
|
2820
|
-
}
|
|
2821
|
-
function logExternalModulesCannotBeIncludedInManualChunks(source) {
|
|
2822
|
-
return {
|
|
2823
|
-
code: EXTERNAL_MODULES_CANNOT_BE_INCLUDED_IN_MANUAL_CHUNKS,
|
|
2824
|
-
message: `"${source}" cannot be included in manualChunks because it is resolved as an external module by the "external" option or plugins.`
|
|
2825
|
-
};
|
|
2826
|
-
}
|
|
2827
|
-
function logExternalModulesCannotBeTransformedToModules(source) {
|
|
2828
|
-
return {
|
|
2829
|
-
code: EXTERNAL_MODULES_CANNOT_BE_TRANSFORMED_TO_MODULES,
|
|
2830
|
-
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.`
|
|
2831
|
-
};
|
|
2832
|
-
}
|
|
2833
|
-
function logUnresolvedEntry(unresolvedId) {
|
|
2834
|
-
return {
|
|
2835
|
-
code: UNRESOLVED_ENTRY,
|
|
2836
|
-
message: `Could not resolve entry module "${relativeId(unresolvedId)}".`
|
|
2837
|
-
};
|
|
2838
|
-
}
|
|
2839
|
-
function logUnresolvedImport(source, importer) {
|
|
2840
|
-
return {
|
|
2841
|
-
code: UNRESOLVED_IMPORT,
|
|
2842
|
-
exporter: source,
|
|
2843
|
-
id: importer,
|
|
2844
|
-
message: `Could not resolve "${source}" from "${relativeId(importer)}"`
|
|
2845
|
-
};
|
|
2846
|
-
}
|
|
2847
|
-
function logUnresolvedImportTreatedAsExternal(source, importer) {
|
|
2848
|
-
return {
|
|
2849
|
-
code: UNRESOLVED_IMPORT,
|
|
2850
|
-
exporter: source,
|
|
2851
|
-
id: importer,
|
|
2852
|
-
message: `"${source}" is imported by "${relativeId(importer)}", but could not be resolved – treating it as an external dependency.`,
|
|
2853
|
-
url: getRollupUrl(URL_TREATING_MODULE_AS_EXTERNAL_DEPENDENCY)
|
|
2854
|
-
};
|
|
2855
|
-
}
|
|
2856
|
-
function logUnusedExternalImports(externalId, names, importers) {
|
|
2857
|
-
return {
|
|
2858
|
-
code: UNUSED_EXTERNAL_IMPORT,
|
|
2859
|
-
exporter: externalId,
|
|
2860
|
-
ids: importers,
|
|
2861
|
-
message: `${printQuotedStringList(names, [
|
|
2862
|
-
'is',
|
|
2863
|
-
'are'
|
|
2864
|
-
])} imported from external module "${externalId}" but never used in ${printQuotedStringList(importers.map(importer => relativeId(importer)))}.`,
|
|
2865
|
-
names
|
|
2866
|
-
};
|
|
2867
|
-
}
|
|
2868
|
-
function logFailedValidation(message) {
|
|
2869
|
-
return {
|
|
2870
|
-
code: VALIDATION_ERROR,
|
|
2871
|
-
message
|
|
2872
|
-
};
|
|
2873
|
-
}
|
|
2874
|
-
function warnDeprecation(deprecation, urlSnippet, activeDeprecation, options, plugin) {
|
|
2875
|
-
warnDeprecationWithOptions(deprecation, urlSnippet, activeDeprecation, options.onLog, options.strictDeprecations, plugin);
|
|
2876
|
-
}
|
|
2877
|
-
function warnDeprecationWithOptions(deprecation, urlSnippet, activeDeprecation, log, strictDeprecations, plugin) {
|
|
2878
|
-
if (activeDeprecation || strictDeprecations) {
|
|
2879
|
-
const warning = logDeprecation(deprecation, urlSnippet, plugin);
|
|
2880
|
-
if (strictDeprecations) {
|
|
2881
|
-
return error(warning);
|
|
2882
|
-
}
|
|
2883
|
-
log(LOGLEVEL_WARN, warning);
|
|
2884
|
-
}
|
|
2885
|
-
}
|
|
2886
|
-
|
|
2887
|
-
class ExternalModule {
|
|
2888
|
-
constructor(options, id, moduleSideEffects, meta, renormalizeRenderPath, attributes) {
|
|
2889
|
-
this.options = options;
|
|
2890
|
-
this.id = id;
|
|
2891
|
-
this.renormalizeRenderPath = renormalizeRenderPath;
|
|
2892
|
-
this.dynamicImporters = [];
|
|
2893
|
-
this.execIndex = Infinity;
|
|
2894
|
-
this.exportedVariables = new Map();
|
|
2895
|
-
this.importers = [];
|
|
2896
|
-
this.reexported = false;
|
|
2897
|
-
this.used = false;
|
|
2898
|
-
this.declarations = new Map();
|
|
2899
|
-
this.mostCommonSuggestion = 0;
|
|
2900
|
-
this.nameSuggestions = new Map();
|
|
2901
|
-
this.suggestedVariableName = makeLegal(id.split(/[/\\]/).pop());
|
|
2902
|
-
const { importers, dynamicImporters } = this;
|
|
2903
|
-
this.info = {
|
|
2904
|
-
ast: null,
|
|
2905
|
-
attributes,
|
|
2906
|
-
code: null,
|
|
2907
|
-
dynamicallyImportedIdResolutions: EMPTY_ARRAY,
|
|
2908
|
-
dynamicallyImportedIds: EMPTY_ARRAY,
|
|
2909
|
-
get dynamicImporters() {
|
|
2910
|
-
return dynamicImporters.sort();
|
|
2911
|
-
},
|
|
2912
|
-
exportedBindings: null,
|
|
2913
|
-
exports: null,
|
|
2914
|
-
hasDefaultExport: null,
|
|
2915
|
-
id,
|
|
2916
|
-
implicitlyLoadedAfterOneOf: EMPTY_ARRAY,
|
|
2917
|
-
implicitlyLoadedBefore: EMPTY_ARRAY,
|
|
2918
|
-
importedIdResolutions: EMPTY_ARRAY,
|
|
2919
|
-
importedIds: EMPTY_ARRAY,
|
|
2920
|
-
get importers() {
|
|
2921
|
-
return importers.sort();
|
|
2922
|
-
},
|
|
2923
|
-
isEntry: false,
|
|
2924
|
-
isExternal: true,
|
|
2925
|
-
isIncluded: null,
|
|
2926
|
-
meta,
|
|
2927
|
-
moduleSideEffects,
|
|
2928
|
-
syntheticNamedExports: false
|
|
2929
|
-
};
|
|
2930
|
-
}
|
|
2931
|
-
getVariableForExportName(name) {
|
|
2932
|
-
const declaration = this.declarations.get(name);
|
|
2933
|
-
if (declaration)
|
|
2934
|
-
return [declaration];
|
|
2935
|
-
const externalVariable = new ExternalVariable(this, name);
|
|
2936
|
-
this.declarations.set(name, externalVariable);
|
|
2937
|
-
this.exportedVariables.set(externalVariable, name);
|
|
2938
|
-
return [externalVariable];
|
|
2939
|
-
}
|
|
2940
|
-
suggestName(name) {
|
|
2941
|
-
const value = (this.nameSuggestions.get(name) ?? 0) + 1;
|
|
2942
|
-
this.nameSuggestions.set(name, value);
|
|
2943
|
-
if (value > this.mostCommonSuggestion) {
|
|
2944
|
-
this.mostCommonSuggestion = value;
|
|
2945
|
-
this.suggestedVariableName = name;
|
|
2946
|
-
}
|
|
2947
|
-
}
|
|
2948
|
-
warnUnusedImports() {
|
|
2949
|
-
const unused = [...this.declarations]
|
|
2950
|
-
.filter(([name, declaration]) => name !== '*' && !declaration.included && !this.reexported && !declaration.referenced)
|
|
2951
|
-
.map(([name]) => name);
|
|
2952
|
-
if (unused.length === 0)
|
|
2953
|
-
return;
|
|
2954
|
-
const importersSet = new Set();
|
|
2955
|
-
for (const name of unused) {
|
|
2956
|
-
for (const importer of this.declarations.get(name).module.importers) {
|
|
2957
|
-
importersSet.add(importer);
|
|
2958
|
-
}
|
|
2959
|
-
}
|
|
2960
|
-
const importersArray = [...importersSet];
|
|
2961
|
-
this.options.onLog(LOGLEVEL_WARN, logUnusedExternalImports(this.id, unused, importersArray));
|
|
2962
|
-
}
|
|
2963
|
-
}
|
|
2964
|
-
|
|
2965
|
-
function getDefaultExportFromCjs (x) {
|
|
2966
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
2967
|
-
}
|
|
2968
|
-
|
|
2969
|
-
function getAugmentedNamespace(n) {
|
|
2970
|
-
if (n.__esModule) return n;
|
|
2971
|
-
var f = n.default;
|
|
2972
|
-
if (typeof f == "function") {
|
|
2973
|
-
var a = function a () {
|
|
2974
|
-
if (this instanceof a) {
|
|
2975
|
-
return Reflect.construct(f, arguments, this.constructor);
|
|
2976
|
-
}
|
|
2977
|
-
return f.apply(this, arguments);
|
|
2978
|
-
};
|
|
2979
|
-
a.prototype = f.prototype;
|
|
2980
|
-
} else a = {};
|
|
2981
|
-
Object.defineProperty(a, '__esModule', {value: true});
|
|
2982
|
-
Object.keys(n).forEach(function (k) {
|
|
2983
|
-
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
2984
|
-
Object.defineProperty(a, k, d.get ? d : {
|
|
2985
|
-
enumerable: true,
|
|
2986
|
-
get: function () {
|
|
2987
|
-
return n[k];
|
|
2988
|
-
}
|
|
2989
|
-
});
|
|
2990
|
-
});
|
|
2991
|
-
return a;
|
|
2992
|
-
}
|
|
2993
|
-
|
|
2994
|
-
var utils$3 = {};
|
|
2995
|
-
|
|
2996
|
-
const path$1 = require$$0$1;
|
|
2997
|
-
const WIN_SLASH = '\\\\/';
|
|
2998
|
-
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
2999
|
-
|
|
3000
|
-
/**
|
|
3001
|
-
* Posix glob regex
|
|
3002
|
-
*/
|
|
3003
|
-
|
|
3004
|
-
const DOT_LITERAL = '\\.';
|
|
3005
|
-
const PLUS_LITERAL = '\\+';
|
|
3006
|
-
const QMARK_LITERAL = '\\?';
|
|
3007
|
-
const SLASH_LITERAL = '\\/';
|
|
3008
|
-
const ONE_CHAR = '(?=.)';
|
|
3009
|
-
const QMARK = '[^/]';
|
|
3010
|
-
const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
|
3011
|
-
const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
|
3012
|
-
const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
|
3013
|
-
const NO_DOT = `(?!${DOT_LITERAL})`;
|
|
3014
|
-
const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
|
|
3015
|
-
const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
|
|
3016
|
-
const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
|
|
3017
|
-
const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
|
|
3018
|
-
const STAR = `${QMARK}*?`;
|
|
3019
|
-
|
|
3020
|
-
const POSIX_CHARS = {
|
|
3021
|
-
DOT_LITERAL,
|
|
3022
|
-
PLUS_LITERAL,
|
|
3023
|
-
QMARK_LITERAL,
|
|
3024
|
-
SLASH_LITERAL,
|
|
3025
|
-
ONE_CHAR,
|
|
3026
|
-
QMARK,
|
|
3027
|
-
END_ANCHOR,
|
|
3028
|
-
DOTS_SLASH,
|
|
3029
|
-
NO_DOT,
|
|
3030
|
-
NO_DOTS,
|
|
3031
|
-
NO_DOT_SLASH,
|
|
3032
|
-
NO_DOTS_SLASH,
|
|
3033
|
-
QMARK_NO_DOT,
|
|
3034
|
-
STAR,
|
|
3035
|
-
START_ANCHOR
|
|
3036
|
-
};
|
|
3037
|
-
|
|
3038
|
-
/**
|
|
3039
|
-
* Windows glob regex
|
|
3040
|
-
*/
|
|
3041
|
-
|
|
3042
|
-
const WINDOWS_CHARS = {
|
|
3043
|
-
...POSIX_CHARS,
|
|
3044
|
-
|
|
3045
|
-
SLASH_LITERAL: `[${WIN_SLASH}]`,
|
|
3046
|
-
QMARK: WIN_NO_SLASH,
|
|
3047
|
-
STAR: `${WIN_NO_SLASH}*?`,
|
|
3048
|
-
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
|
3049
|
-
NO_DOT: `(?!${DOT_LITERAL})`,
|
|
3050
|
-
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
3051
|
-
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
|
3052
|
-
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
|
3053
|
-
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
|
3054
|
-
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
|
3055
|
-
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
|
|
3056
|
-
};
|
|
3057
|
-
|
|
3058
|
-
/**
|
|
3059
|
-
* POSIX Bracket Regex
|
|
3060
|
-
*/
|
|
3061
|
-
|
|
3062
|
-
const POSIX_REGEX_SOURCE$1 = {
|
|
3063
|
-
alnum: 'a-zA-Z0-9',
|
|
3064
|
-
alpha: 'a-zA-Z',
|
|
3065
|
-
ascii: '\\x00-\\x7F',
|
|
3066
|
-
blank: ' \\t',
|
|
3067
|
-
cntrl: '\\x00-\\x1F\\x7F',
|
|
3068
|
-
digit: '0-9',
|
|
3069
|
-
graph: '\\x21-\\x7E',
|
|
3070
|
-
lower: 'a-z',
|
|
3071
|
-
print: '\\x20-\\x7E ',
|
|
3072
|
-
punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
|
|
3073
|
-
space: ' \\t\\r\\n\\v\\f',
|
|
3074
|
-
upper: 'A-Z',
|
|
3075
|
-
word: 'A-Za-z0-9_',
|
|
3076
|
-
xdigit: 'A-Fa-f0-9'
|
|
3077
|
-
};
|
|
3078
|
-
|
|
3079
|
-
var constants$2 = {
|
|
3080
|
-
MAX_LENGTH: 1024 * 64,
|
|
3081
|
-
POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1,
|
|
3082
|
-
|
|
3083
|
-
// regular expressions
|
|
3084
|
-
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
3085
|
-
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
3086
|
-
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
3087
|
-
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
3088
|
-
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
3089
|
-
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
3090
|
-
|
|
3091
|
-
// Replace globs with equivalent patterns to reduce parsing time.
|
|
3092
|
-
REPLACEMENTS: {
|
|
3093
|
-
'***': '*',
|
|
3094
|
-
'**/**': '**',
|
|
3095
|
-
'**/**/**': '**'
|
|
3096
|
-
},
|
|
3097
|
-
|
|
3098
|
-
// Digits
|
|
3099
|
-
CHAR_0: 48, /* 0 */
|
|
3100
|
-
CHAR_9: 57, /* 9 */
|
|
3101
|
-
|
|
3102
|
-
// Alphabet chars.
|
|
3103
|
-
CHAR_UPPERCASE_A: 65, /* A */
|
|
3104
|
-
CHAR_LOWERCASE_A: 97, /* a */
|
|
3105
|
-
CHAR_UPPERCASE_Z: 90, /* Z */
|
|
3106
|
-
CHAR_LOWERCASE_Z: 122, /* z */
|
|
3107
|
-
|
|
3108
|
-
CHAR_LEFT_PARENTHESES: 40, /* ( */
|
|
3109
|
-
CHAR_RIGHT_PARENTHESES: 41, /* ) */
|
|
3110
|
-
|
|
3111
|
-
CHAR_ASTERISK: 42, /* * */
|
|
2263
|
+
CHAR_ASTERISK: 42, /* * */
|
|
3112
2264
|
|
|
3113
2265
|
// Non-alphabetic chars.
|
|
3114
2266
|
CHAR_AMPERSAND: 38, /* & */
|
|
@@ -4544,2086 +3696,853 @@ const parse$1 = (input, options) => {
|
|
|
4544
3696
|
if (prev.type === 'bos' || prev.type === 'slash') {
|
|
4545
3697
|
token.output = nodot + token.output;
|
|
4546
3698
|
}
|
|
4547
|
-
push(token);
|
|
4548
|
-
continue;
|
|
4549
|
-
}
|
|
4550
|
-
|
|
4551
|
-
if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) {
|
|
4552
|
-
token.output = value;
|
|
4553
|
-
push(token);
|
|
4554
|
-
continue;
|
|
4555
|
-
}
|
|
4556
|
-
|
|
4557
|
-
if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') {
|
|
4558
|
-
if (prev.type === 'dot') {
|
|
4559
|
-
state.output += NO_DOT_SLASH;
|
|
4560
|
-
prev.output += NO_DOT_SLASH;
|
|
4561
|
-
|
|
4562
|
-
} else if (opts.dot === true) {
|
|
4563
|
-
state.output += NO_DOTS_SLASH;
|
|
4564
|
-
prev.output += NO_DOTS_SLASH;
|
|
4565
|
-
|
|
4566
|
-
} else {
|
|
4567
|
-
state.output += nodot;
|
|
4568
|
-
prev.output += nodot;
|
|
4569
|
-
}
|
|
4570
|
-
|
|
4571
|
-
if (peek() !== '*') {
|
|
4572
|
-
state.output += ONE_CHAR;
|
|
4573
|
-
prev.output += ONE_CHAR;
|
|
4574
|
-
}
|
|
4575
|
-
}
|
|
4576
|
-
|
|
4577
|
-
push(token);
|
|
4578
|
-
}
|
|
4579
|
-
|
|
4580
|
-
while (state.brackets > 0) {
|
|
4581
|
-
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']'));
|
|
4582
|
-
state.output = utils$1.escapeLast(state.output, '[');
|
|
4583
|
-
decrement('brackets');
|
|
4584
|
-
}
|
|
4585
|
-
|
|
4586
|
-
while (state.parens > 0) {
|
|
4587
|
-
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')'));
|
|
4588
|
-
state.output = utils$1.escapeLast(state.output, '(');
|
|
4589
|
-
decrement('parens');
|
|
4590
|
-
}
|
|
4591
|
-
|
|
4592
|
-
while (state.braces > 0) {
|
|
4593
|
-
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}'));
|
|
4594
|
-
state.output = utils$1.escapeLast(state.output, '{');
|
|
4595
|
-
decrement('braces');
|
|
4596
|
-
}
|
|
4597
|
-
|
|
4598
|
-
if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) {
|
|
4599
|
-
push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` });
|
|
4600
|
-
}
|
|
4601
|
-
|
|
4602
|
-
// rebuild the output if we had to backtrack at any point
|
|
4603
|
-
if (state.backtrack === true) {
|
|
4604
|
-
state.output = '';
|
|
4605
|
-
|
|
4606
|
-
for (const token of state.tokens) {
|
|
4607
|
-
state.output += token.output != null ? token.output : token.value;
|
|
4608
|
-
|
|
4609
|
-
if (token.suffix) {
|
|
4610
|
-
state.output += token.suffix;
|
|
4611
|
-
}
|
|
4612
|
-
}
|
|
4613
|
-
}
|
|
4614
|
-
|
|
4615
|
-
return state;
|
|
4616
|
-
};
|
|
4617
|
-
|
|
4618
|
-
/**
|
|
4619
|
-
* Fast paths for creating regular expressions for common glob patterns.
|
|
4620
|
-
* This can significantly speed up processing and has very little downside
|
|
4621
|
-
* impact when none of the fast paths match.
|
|
4622
|
-
*/
|
|
4623
|
-
|
|
4624
|
-
parse$1.fastpaths = (input, options) => {
|
|
4625
|
-
const opts = { ...options };
|
|
4626
|
-
const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
4627
|
-
const len = input.length;
|
|
4628
|
-
if (len > max) {
|
|
4629
|
-
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
4630
|
-
}
|
|
4631
|
-
|
|
4632
|
-
input = REPLACEMENTS[input] || input;
|
|
4633
|
-
const win32 = utils$1.isWindows(options);
|
|
4634
|
-
|
|
4635
|
-
// create constants based on platform, for windows or posix
|
|
4636
|
-
const {
|
|
4637
|
-
DOT_LITERAL,
|
|
4638
|
-
SLASH_LITERAL,
|
|
4639
|
-
ONE_CHAR,
|
|
4640
|
-
DOTS_SLASH,
|
|
4641
|
-
NO_DOT,
|
|
4642
|
-
NO_DOTS,
|
|
4643
|
-
NO_DOTS_SLASH,
|
|
4644
|
-
STAR,
|
|
4645
|
-
START_ANCHOR
|
|
4646
|
-
} = constants$1.globChars(win32);
|
|
4647
|
-
|
|
4648
|
-
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
|
4649
|
-
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
|
4650
|
-
const capture = opts.capture ? '' : '?:';
|
|
4651
|
-
const state = { negated: false, prefix: '' };
|
|
4652
|
-
let star = opts.bash === true ? '.*?' : STAR;
|
|
4653
|
-
|
|
4654
|
-
if (opts.capture) {
|
|
4655
|
-
star = `(${star})`;
|
|
4656
|
-
}
|
|
4657
|
-
|
|
4658
|
-
const globstar = opts => {
|
|
4659
|
-
if (opts.noglobstar === true) return star;
|
|
4660
|
-
return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
4661
|
-
};
|
|
4662
|
-
|
|
4663
|
-
const create = str => {
|
|
4664
|
-
switch (str) {
|
|
4665
|
-
case '*':
|
|
4666
|
-
return `${nodot}${ONE_CHAR}${star}`;
|
|
4667
|
-
|
|
4668
|
-
case '.*':
|
|
4669
|
-
return `${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
4670
|
-
|
|
4671
|
-
case '*.*':
|
|
4672
|
-
return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
4673
|
-
|
|
4674
|
-
case '*/*':
|
|
4675
|
-
return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
|
|
4676
|
-
|
|
4677
|
-
case '**':
|
|
4678
|
-
return nodot + globstar(opts);
|
|
4679
|
-
|
|
4680
|
-
case '**/*':
|
|
4681
|
-
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
|
|
4682
|
-
|
|
4683
|
-
case '**/*.*':
|
|
4684
|
-
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
4685
|
-
|
|
4686
|
-
case '**/.*':
|
|
4687
|
-
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
4688
|
-
|
|
4689
|
-
default: {
|
|
4690
|
-
const match = /^(.*?)\.(\w+)$/.exec(str);
|
|
4691
|
-
if (!match) return;
|
|
4692
|
-
|
|
4693
|
-
const source = create(match[1]);
|
|
4694
|
-
if (!source) return;
|
|
4695
|
-
|
|
4696
|
-
return source + DOT_LITERAL + match[2];
|
|
4697
|
-
}
|
|
4698
|
-
}
|
|
4699
|
-
};
|
|
4700
|
-
|
|
4701
|
-
const output = utils$1.removePrefix(input, state);
|
|
4702
|
-
let source = create(output);
|
|
4703
|
-
|
|
4704
|
-
if (source && opts.strictSlashes !== true) {
|
|
4705
|
-
source += `${SLASH_LITERAL}?`;
|
|
4706
|
-
}
|
|
4707
|
-
|
|
4708
|
-
return source;
|
|
4709
|
-
};
|
|
4710
|
-
|
|
4711
|
-
var parse_1 = parse$1;
|
|
4712
|
-
|
|
4713
|
-
const path = require$$0$1;
|
|
4714
|
-
const scan = scan_1;
|
|
4715
|
-
const parse = parse_1;
|
|
4716
|
-
const utils = utils$3;
|
|
4717
|
-
const constants = constants$2;
|
|
4718
|
-
const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
|
|
4719
|
-
|
|
4720
|
-
/**
|
|
4721
|
-
* Creates a matcher function from one or more glob patterns. The
|
|
4722
|
-
* returned function takes a string to match as its first argument,
|
|
4723
|
-
* and returns true if the string is a match. The returned matcher
|
|
4724
|
-
* function also takes a boolean as the second argument that, when true,
|
|
4725
|
-
* returns an object with additional information.
|
|
4726
|
-
*
|
|
4727
|
-
* ```js
|
|
4728
|
-
* const picomatch = require('picomatch');
|
|
4729
|
-
* // picomatch(glob[, options]);
|
|
4730
|
-
*
|
|
4731
|
-
* const isMatch = picomatch('*.!(*a)');
|
|
4732
|
-
* console.log(isMatch('a.a')); //=> false
|
|
4733
|
-
* console.log(isMatch('a.b')); //=> true
|
|
4734
|
-
* ```
|
|
4735
|
-
* @name picomatch
|
|
4736
|
-
* @param {String|Array} `globs` One or more glob patterns.
|
|
4737
|
-
* @param {Object=} `options`
|
|
4738
|
-
* @return {Function=} Returns a matcher function.
|
|
4739
|
-
* @api public
|
|
4740
|
-
*/
|
|
4741
|
-
|
|
4742
|
-
const picomatch$1 = (glob, options, returnState = false) => {
|
|
4743
|
-
if (Array.isArray(glob)) {
|
|
4744
|
-
const fns = glob.map(input => picomatch$1(input, options, returnState));
|
|
4745
|
-
const arrayMatcher = str => {
|
|
4746
|
-
for (const isMatch of fns) {
|
|
4747
|
-
const state = isMatch(str);
|
|
4748
|
-
if (state) return state;
|
|
4749
|
-
}
|
|
4750
|
-
return false;
|
|
4751
|
-
};
|
|
4752
|
-
return arrayMatcher;
|
|
4753
|
-
}
|
|
4754
|
-
|
|
4755
|
-
const isState = isObject(glob) && glob.tokens && glob.input;
|
|
4756
|
-
|
|
4757
|
-
if (glob === '' || (typeof glob !== 'string' && !isState)) {
|
|
4758
|
-
throw new TypeError('Expected pattern to be a non-empty string');
|
|
4759
|
-
}
|
|
4760
|
-
|
|
4761
|
-
const opts = options || {};
|
|
4762
|
-
const posix = utils.isWindows(options);
|
|
4763
|
-
const regex = isState
|
|
4764
|
-
? picomatch$1.compileRe(glob, options)
|
|
4765
|
-
: picomatch$1.makeRe(glob, options, false, true);
|
|
4766
|
-
|
|
4767
|
-
const state = regex.state;
|
|
4768
|
-
delete regex.state;
|
|
4769
|
-
|
|
4770
|
-
let isIgnored = () => false;
|
|
4771
|
-
if (opts.ignore) {
|
|
4772
|
-
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
|
|
4773
|
-
isIgnored = picomatch$1(opts.ignore, ignoreOpts, returnState);
|
|
4774
|
-
}
|
|
4775
|
-
|
|
4776
|
-
const matcher = (input, returnObject = false) => {
|
|
4777
|
-
const { isMatch, match, output } = picomatch$1.test(input, regex, options, { glob, posix });
|
|
4778
|
-
const result = { glob, state, regex, posix, input, output, match, isMatch };
|
|
4779
|
-
|
|
4780
|
-
if (typeof opts.onResult === 'function') {
|
|
4781
|
-
opts.onResult(result);
|
|
3699
|
+
push(token);
|
|
3700
|
+
continue;
|
|
4782
3701
|
}
|
|
4783
3702
|
|
|
4784
|
-
if (
|
|
4785
|
-
|
|
4786
|
-
|
|
3703
|
+
if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) {
|
|
3704
|
+
token.output = value;
|
|
3705
|
+
push(token);
|
|
3706
|
+
continue;
|
|
4787
3707
|
}
|
|
4788
3708
|
|
|
4789
|
-
if (
|
|
4790
|
-
if (
|
|
4791
|
-
|
|
3709
|
+
if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') {
|
|
3710
|
+
if (prev.type === 'dot') {
|
|
3711
|
+
state.output += NO_DOT_SLASH;
|
|
3712
|
+
prev.output += NO_DOT_SLASH;
|
|
3713
|
+
|
|
3714
|
+
} else if (opts.dot === true) {
|
|
3715
|
+
state.output += NO_DOTS_SLASH;
|
|
3716
|
+
prev.output += NO_DOTS_SLASH;
|
|
3717
|
+
|
|
3718
|
+
} else {
|
|
3719
|
+
state.output += nodot;
|
|
3720
|
+
prev.output += nodot;
|
|
4792
3721
|
}
|
|
4793
|
-
result.isMatch = false;
|
|
4794
|
-
return returnObject ? result : false;
|
|
4795
|
-
}
|
|
4796
3722
|
|
|
4797
|
-
|
|
4798
|
-
|
|
3723
|
+
if (peek() !== '*') {
|
|
3724
|
+
state.output += ONE_CHAR;
|
|
3725
|
+
prev.output += ONE_CHAR;
|
|
3726
|
+
}
|
|
4799
3727
|
}
|
|
4800
|
-
return returnObject ? result : true;
|
|
4801
|
-
};
|
|
4802
3728
|
|
|
4803
|
-
|
|
4804
|
-
matcher.state = state;
|
|
3729
|
+
push(token);
|
|
4805
3730
|
}
|
|
4806
3731
|
|
|
4807
|
-
|
|
4808
|
-
|
|
3732
|
+
while (state.brackets > 0) {
|
|
3733
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']'));
|
|
3734
|
+
state.output = utils$1.escapeLast(state.output, '[');
|
|
3735
|
+
decrement('brackets');
|
|
3736
|
+
}
|
|
4809
3737
|
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
* const picomatch = require('picomatch');
|
|
4816
|
-
* // picomatch.test(input, regex[, options]);
|
|
4817
|
-
*
|
|
4818
|
-
* console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
|
|
4819
|
-
* // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
|
|
4820
|
-
* ```
|
|
4821
|
-
* @param {String} `input` String to test.
|
|
4822
|
-
* @param {RegExp} `regex`
|
|
4823
|
-
* @return {Object} Returns an object with matching info.
|
|
4824
|
-
* @api public
|
|
4825
|
-
*/
|
|
3738
|
+
while (state.parens > 0) {
|
|
3739
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')'));
|
|
3740
|
+
state.output = utils$1.escapeLast(state.output, '(');
|
|
3741
|
+
decrement('parens');
|
|
3742
|
+
}
|
|
4826
3743
|
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
3744
|
+
while (state.braces > 0) {
|
|
3745
|
+
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}'));
|
|
3746
|
+
state.output = utils$1.escapeLast(state.output, '{');
|
|
3747
|
+
decrement('braces');
|
|
4830
3748
|
}
|
|
4831
3749
|
|
|
4832
|
-
if (
|
|
4833
|
-
|
|
3750
|
+
if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) {
|
|
3751
|
+
push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` });
|
|
4834
3752
|
}
|
|
4835
3753
|
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
let output = (match && format) ? format(input) : input;
|
|
3754
|
+
// rebuild the output if we had to backtrack at any point
|
|
3755
|
+
if (state.backtrack === true) {
|
|
3756
|
+
state.output = '';
|
|
4840
3757
|
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
match = output === glob;
|
|
4844
|
-
}
|
|
3758
|
+
for (const token of state.tokens) {
|
|
3759
|
+
state.output += token.output != null ? token.output : token.value;
|
|
4845
3760
|
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
} else {
|
|
4850
|
-
match = regex.exec(output);
|
|
3761
|
+
if (token.suffix) {
|
|
3762
|
+
state.output += token.suffix;
|
|
3763
|
+
}
|
|
4851
3764
|
}
|
|
4852
3765
|
}
|
|
4853
3766
|
|
|
4854
|
-
return
|
|
3767
|
+
return state;
|
|
4855
3768
|
};
|
|
4856
3769
|
|
|
4857
3770
|
/**
|
|
4858
|
-
*
|
|
4859
|
-
*
|
|
4860
|
-
*
|
|
4861
|
-
* const picomatch = require('picomatch');
|
|
4862
|
-
* // picomatch.matchBase(input, glob[, options]);
|
|
4863
|
-
* console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
|
|
4864
|
-
* ```
|
|
4865
|
-
* @param {String} `input` String to test.
|
|
4866
|
-
* @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
|
|
4867
|
-
* @return {Boolean}
|
|
4868
|
-
* @api public
|
|
3771
|
+
* Fast paths for creating regular expressions for common glob patterns.
|
|
3772
|
+
* This can significantly speed up processing and has very little downside
|
|
3773
|
+
* impact when none of the fast paths match.
|
|
4869
3774
|
*/
|
|
4870
3775
|
|
|
4871
|
-
|
|
4872
|
-
const
|
|
4873
|
-
|
|
4874
|
-
|
|
3776
|
+
parse$1.fastpaths = (input, options) => {
|
|
3777
|
+
const opts = { ...options };
|
|
3778
|
+
const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
|
3779
|
+
const len = input.length;
|
|
3780
|
+
if (len > max) {
|
|
3781
|
+
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
|
3782
|
+
}
|
|
4875
3783
|
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
*
|
|
4879
|
-
* ```js
|
|
4880
|
-
* const picomatch = require('picomatch');
|
|
4881
|
-
* // picomatch.isMatch(string, patterns[, options]);
|
|
4882
|
-
*
|
|
4883
|
-
* console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
|
|
4884
|
-
* console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
|
|
4885
|
-
* ```
|
|
4886
|
-
* @param {String|Array} str The string to test.
|
|
4887
|
-
* @param {String|Array} patterns One or more glob patterns to use for matching.
|
|
4888
|
-
* @param {Object} [options] See available [options](#options).
|
|
4889
|
-
* @return {Boolean} Returns true if any patterns match `str`
|
|
4890
|
-
* @api public
|
|
4891
|
-
*/
|
|
3784
|
+
input = REPLACEMENTS[input] || input;
|
|
3785
|
+
const win32 = utils$1.isWindows(options);
|
|
4892
3786
|
|
|
4893
|
-
|
|
3787
|
+
// create constants based on platform, for windows or posix
|
|
3788
|
+
const {
|
|
3789
|
+
DOT_LITERAL,
|
|
3790
|
+
SLASH_LITERAL,
|
|
3791
|
+
ONE_CHAR,
|
|
3792
|
+
DOTS_SLASH,
|
|
3793
|
+
NO_DOT,
|
|
3794
|
+
NO_DOTS,
|
|
3795
|
+
NO_DOTS_SLASH,
|
|
3796
|
+
STAR,
|
|
3797
|
+
START_ANCHOR
|
|
3798
|
+
} = constants$1.globChars(win32);
|
|
4894
3799
|
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
* const picomatch = require('picomatch');
|
|
4901
|
-
* const result = picomatch.parse(pattern[, options]);
|
|
4902
|
-
* ```
|
|
4903
|
-
* @param {String} `pattern`
|
|
4904
|
-
* @param {Object} `options`
|
|
4905
|
-
* @return {Object} Returns an object with useful properties and output to be used as a regex source string.
|
|
4906
|
-
* @api public
|
|
4907
|
-
*/
|
|
3800
|
+
const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
|
3801
|
+
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
|
3802
|
+
const capture = opts.capture ? '' : '?:';
|
|
3803
|
+
const state = { negated: false, prefix: '' };
|
|
3804
|
+
let star = opts.bash === true ? '.*?' : STAR;
|
|
4908
3805
|
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
};
|
|
3806
|
+
if (opts.capture) {
|
|
3807
|
+
star = `(${star})`;
|
|
3808
|
+
}
|
|
4913
3809
|
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
* const picomatch = require('picomatch');
|
|
4919
|
-
* // picomatch.scan(input[, options]);
|
|
4920
|
-
*
|
|
4921
|
-
* const result = picomatch.scan('!./foo/*.js');
|
|
4922
|
-
* console.log(result);
|
|
4923
|
-
* { prefix: '!./',
|
|
4924
|
-
* input: '!./foo/*.js',
|
|
4925
|
-
* start: 3,
|
|
4926
|
-
* base: 'foo',
|
|
4927
|
-
* glob: '*.js',
|
|
4928
|
-
* isBrace: false,
|
|
4929
|
-
* isBracket: false,
|
|
4930
|
-
* isGlob: true,
|
|
4931
|
-
* isExtglob: false,
|
|
4932
|
-
* isGlobstar: false,
|
|
4933
|
-
* negated: true }
|
|
4934
|
-
* ```
|
|
4935
|
-
* @param {String} `input` Glob pattern to scan.
|
|
4936
|
-
* @param {Object} `options`
|
|
4937
|
-
* @return {Object} Returns an object with
|
|
4938
|
-
* @api public
|
|
4939
|
-
*/
|
|
3810
|
+
const globstar = opts => {
|
|
3811
|
+
if (opts.noglobstar === true) return star;
|
|
3812
|
+
return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
|
3813
|
+
};
|
|
4940
3814
|
|
|
4941
|
-
|
|
3815
|
+
const create = str => {
|
|
3816
|
+
switch (str) {
|
|
3817
|
+
case '*':
|
|
3818
|
+
return `${nodot}${ONE_CHAR}${star}`;
|
|
4942
3819
|
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
* [parse()](#parse) method.
|
|
4946
|
-
*
|
|
4947
|
-
* @param {Object} `state`
|
|
4948
|
-
* @param {Object} `options`
|
|
4949
|
-
* @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
|
|
4950
|
-
* @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
|
|
4951
|
-
* @return {RegExp}
|
|
4952
|
-
* @api public
|
|
4953
|
-
*/
|
|
3820
|
+
case '.*':
|
|
3821
|
+
return `${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
4954
3822
|
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
return state.output;
|
|
4958
|
-
}
|
|
3823
|
+
case '*.*':
|
|
3824
|
+
return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
4959
3825
|
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
const append = opts.contains ? '' : '$';
|
|
3826
|
+
case '*/*':
|
|
3827
|
+
return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
|
|
4963
3828
|
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
source = `^(?!${source}).*$`;
|
|
4967
|
-
}
|
|
3829
|
+
case '**':
|
|
3830
|
+
return nodot + globstar(opts);
|
|
4968
3831
|
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
regex.state = state;
|
|
4972
|
-
}
|
|
3832
|
+
case '**/*':
|
|
3833
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
|
|
4973
3834
|
|
|
4974
|
-
|
|
4975
|
-
}
|
|
3835
|
+
case '**/*.*':
|
|
3836
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
4976
3837
|
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
*
|
|
4980
|
-
* ```js
|
|
4981
|
-
* const picomatch = require('picomatch');
|
|
4982
|
-
* const state = picomatch.parse('*.js');
|
|
4983
|
-
* // picomatch.compileRe(state[, options]);
|
|
4984
|
-
*
|
|
4985
|
-
* console.log(picomatch.compileRe(state));
|
|
4986
|
-
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
4987
|
-
* ```
|
|
4988
|
-
* @param {String} `state` The object returned from the `.parse` method.
|
|
4989
|
-
* @param {Object} `options`
|
|
4990
|
-
* @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
|
|
4991
|
-
* @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
|
|
4992
|
-
* @return {RegExp} Returns a regex created from the given pattern.
|
|
4993
|
-
* @api public
|
|
4994
|
-
*/
|
|
3838
|
+
case '**/.*':
|
|
3839
|
+
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
|
|
4995
3840
|
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
}
|
|
3841
|
+
default: {
|
|
3842
|
+
const match = /^(.*?)\.(\w+)$/.exec(str);
|
|
3843
|
+
if (!match) return;
|
|
5000
3844
|
|
|
5001
|
-
|
|
3845
|
+
const source = create(match[1]);
|
|
3846
|
+
if (!source) return;
|
|
5002
3847
|
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
3848
|
+
return source + DOT_LITERAL + match[2];
|
|
3849
|
+
}
|
|
3850
|
+
}
|
|
3851
|
+
};
|
|
5006
3852
|
|
|
5007
|
-
|
|
5008
|
-
|
|
3853
|
+
const output = utils$1.removePrefix(input, state);
|
|
3854
|
+
let source = create(output);
|
|
3855
|
+
|
|
3856
|
+
if (source && opts.strictSlashes !== true) {
|
|
3857
|
+
source += `${SLASH_LITERAL}?`;
|
|
5009
3858
|
}
|
|
5010
3859
|
|
|
5011
|
-
return
|
|
3860
|
+
return source;
|
|
5012
3861
|
};
|
|
5013
3862
|
|
|
3863
|
+
var parse_1 = parse$1;
|
|
3864
|
+
|
|
3865
|
+
const path = require$$0$1;
|
|
3866
|
+
const scan = scan_1;
|
|
3867
|
+
const parse = parse_1;
|
|
3868
|
+
const utils = utils$3;
|
|
3869
|
+
const constants = constants$2;
|
|
3870
|
+
const isObject = val => val && typeof val === 'object' && !Array.isArray(val);
|
|
3871
|
+
|
|
5014
3872
|
/**
|
|
5015
|
-
*
|
|
3873
|
+
* Creates a matcher function from one or more glob patterns. The
|
|
3874
|
+
* returned function takes a string to match as its first argument,
|
|
3875
|
+
* and returns true if the string is a match. The returned matcher
|
|
3876
|
+
* function also takes a boolean as the second argument that, when true,
|
|
3877
|
+
* returns an object with additional information.
|
|
5016
3878
|
*
|
|
5017
3879
|
* ```js
|
|
5018
3880
|
* const picomatch = require('picomatch');
|
|
5019
|
-
* // picomatch
|
|
3881
|
+
* // picomatch(glob[, options]);
|
|
5020
3882
|
*
|
|
5021
|
-
* const
|
|
5022
|
-
* console.log(
|
|
5023
|
-
*
|
|
3883
|
+
* const isMatch = picomatch('*.!(*a)');
|
|
3884
|
+
* console.log(isMatch('a.a')); //=> false
|
|
3885
|
+
* console.log(isMatch('a.b')); //=> true
|
|
5024
3886
|
* ```
|
|
5025
|
-
* @
|
|
5026
|
-
* @param {
|
|
5027
|
-
* @
|
|
3887
|
+
* @name picomatch
|
|
3888
|
+
* @param {String|Array} `globs` One or more glob patterns.
|
|
3889
|
+
* @param {Object=} `options`
|
|
3890
|
+
* @return {Function=} Returns a matcher function.
|
|
5028
3891
|
* @api public
|
|
5029
3892
|
*/
|
|
5030
3893
|
|
|
5031
|
-
picomatch$1
|
|
5032
|
-
|
|
5033
|
-
const
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
3894
|
+
const picomatch$1 = (glob, options, returnState = false) => {
|
|
3895
|
+
if (Array.isArray(glob)) {
|
|
3896
|
+
const fns = glob.map(input => picomatch$1(input, options, returnState));
|
|
3897
|
+
const arrayMatcher = str => {
|
|
3898
|
+
for (const isMatch of fns) {
|
|
3899
|
+
const state = isMatch(str);
|
|
3900
|
+
if (state) return state;
|
|
3901
|
+
}
|
|
3902
|
+
return false;
|
|
3903
|
+
};
|
|
3904
|
+
return arrayMatcher;
|
|
5038
3905
|
}
|
|
5039
|
-
};
|
|
5040
|
-
|
|
5041
|
-
/**
|
|
5042
|
-
* Picomatch constants.
|
|
5043
|
-
* @return {Object}
|
|
5044
|
-
*/
|
|
5045
|
-
|
|
5046
|
-
picomatch$1.constants = constants;
|
|
5047
|
-
|
|
5048
|
-
/**
|
|
5049
|
-
* Expose "picomatch"
|
|
5050
|
-
*/
|
|
5051
|
-
|
|
5052
|
-
var picomatch_1 = picomatch$1;
|
|
5053
|
-
|
|
5054
|
-
var picomatch = picomatch_1;
|
|
5055
|
-
|
|
5056
|
-
const pm = /*@__PURE__*/getDefaultExportFromCjs(picomatch);
|
|
5057
3906
|
|
|
5058
|
-
const
|
|
5059
|
-
ArrayPattern(names, param) {
|
|
5060
|
-
for (const element of param.elements) {
|
|
5061
|
-
if (element)
|
|
5062
|
-
extractors[element.type](names, element);
|
|
5063
|
-
}
|
|
5064
|
-
},
|
|
5065
|
-
AssignmentPattern(names, param) {
|
|
5066
|
-
extractors[param.left.type](names, param.left);
|
|
5067
|
-
},
|
|
5068
|
-
Identifier(names, param) {
|
|
5069
|
-
names.push(param.name);
|
|
5070
|
-
},
|
|
5071
|
-
MemberExpression() { },
|
|
5072
|
-
ObjectPattern(names, param) {
|
|
5073
|
-
for (const prop of param.properties) {
|
|
5074
|
-
// @ts-ignore Typescript reports that this is not a valid type
|
|
5075
|
-
if (prop.type === 'RestElement') {
|
|
5076
|
-
extractors.RestElement(names, prop);
|
|
5077
|
-
}
|
|
5078
|
-
else {
|
|
5079
|
-
extractors[prop.value.type](names, prop.value);
|
|
5080
|
-
}
|
|
5081
|
-
}
|
|
5082
|
-
},
|
|
5083
|
-
RestElement(names, param) {
|
|
5084
|
-
extractors[param.argument.type](names, param.argument);
|
|
5085
|
-
}
|
|
5086
|
-
};
|
|
5087
|
-
const extractAssignedNames = function extractAssignedNames(param) {
|
|
5088
|
-
const names = [];
|
|
5089
|
-
extractors[param.type](names, param);
|
|
5090
|
-
return names;
|
|
5091
|
-
};
|
|
3907
|
+
const isState = isObject(glob) && glob.tokens && glob.input;
|
|
5092
3908
|
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
}
|
|
5097
|
-
function ensureArray$1(thing) {
|
|
5098
|
-
if (isArray(thing))
|
|
5099
|
-
return thing;
|
|
5100
|
-
if (thing == null)
|
|
5101
|
-
return [];
|
|
5102
|
-
return [thing];
|
|
5103
|
-
}
|
|
3909
|
+
if (glob === '' || (typeof glob !== 'string' && !isState)) {
|
|
3910
|
+
throw new TypeError('Expected pattern to be a non-empty string');
|
|
3911
|
+
}
|
|
5104
3912
|
|
|
5105
|
-
const
|
|
5106
|
-
|
|
5107
|
-
|
|
3913
|
+
const opts = options || {};
|
|
3914
|
+
const posix = utils.isWindows(options);
|
|
3915
|
+
const regex = isState
|
|
3916
|
+
? picomatch$1.compileRe(glob, options)
|
|
3917
|
+
: picomatch$1.makeRe(glob, options, false, true);
|
|
5108
3918
|
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
return normalizePath(id);
|
|
5112
|
-
}
|
|
5113
|
-
// resolve('') is valid and will default to process.cwd()
|
|
5114
|
-
const basePath = normalizePath(resolve$1(resolutionBase || ''))
|
|
5115
|
-
// escape all possible (posix + win) path characters that might interfere with regex
|
|
5116
|
-
.replace(/[-^$*+?.()|[\]{}]/g, '\\$&');
|
|
5117
|
-
// Note that we use posix.join because:
|
|
5118
|
-
// 1. the basePath has been normalized to use /
|
|
5119
|
-
// 2. the incoming glob (id) matcher, also uses /
|
|
5120
|
-
// otherwise Node will force backslash (\) on windows
|
|
5121
|
-
return posix.join(basePath, normalizePath(id));
|
|
5122
|
-
}
|
|
5123
|
-
const createFilter = function createFilter(include, exclude, options) {
|
|
5124
|
-
const resolutionBase = options && options.resolve;
|
|
5125
|
-
const getMatcher = (id) => id instanceof RegExp
|
|
5126
|
-
? id
|
|
5127
|
-
: {
|
|
5128
|
-
test: (what) => {
|
|
5129
|
-
// this refactor is a tad overly verbose but makes for easy debugging
|
|
5130
|
-
const pattern = getMatcherString(id, resolutionBase);
|
|
5131
|
-
const fn = pm(pattern, { dot: true });
|
|
5132
|
-
const result = fn(what);
|
|
5133
|
-
return result;
|
|
5134
|
-
}
|
|
5135
|
-
};
|
|
5136
|
-
const includeMatchers = ensureArray$1(include).map(getMatcher);
|
|
5137
|
-
const excludeMatchers = ensureArray$1(exclude).map(getMatcher);
|
|
5138
|
-
return function result(id) {
|
|
5139
|
-
if (typeof id !== 'string')
|
|
5140
|
-
return false;
|
|
5141
|
-
if (/\0/.test(id))
|
|
5142
|
-
return false;
|
|
5143
|
-
const pathId = normalizePath(id);
|
|
5144
|
-
for (let i = 0; i < excludeMatchers.length; ++i) {
|
|
5145
|
-
const matcher = excludeMatchers[i];
|
|
5146
|
-
if (matcher.test(pathId))
|
|
5147
|
-
return false;
|
|
5148
|
-
}
|
|
5149
|
-
for (let i = 0; i < includeMatchers.length; ++i) {
|
|
5150
|
-
const matcher = includeMatchers[i];
|
|
5151
|
-
if (matcher.test(pathId))
|
|
5152
|
-
return true;
|
|
5153
|
-
}
|
|
5154
|
-
return !includeMatchers.length;
|
|
5155
|
-
};
|
|
5156
|
-
};
|
|
3919
|
+
const state = regex.state;
|
|
3920
|
+
delete regex.state;
|
|
5157
3921
|
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
const
|
|
5161
|
-
|
|
3922
|
+
let isIgnored = () => false;
|
|
3923
|
+
if (opts.ignore) {
|
|
3924
|
+
const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
|
|
3925
|
+
isIgnored = picomatch$1(opts.ignore, ignoreOpts, returnState);
|
|
3926
|
+
}
|
|
5162
3927
|
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
hasBreak: false,
|
|
5167
|
-
hasContinue: false,
|
|
5168
|
-
includedCallArguments: new Set(),
|
|
5169
|
-
includedLabels: new Set()
|
|
5170
|
-
};
|
|
5171
|
-
}
|
|
5172
|
-
function createHasEffectsContext() {
|
|
5173
|
-
return {
|
|
5174
|
-
accessed: new PathTracker(),
|
|
5175
|
-
assigned: new PathTracker(),
|
|
5176
|
-
brokenFlow: false,
|
|
5177
|
-
called: new DiscriminatedPathTracker(),
|
|
5178
|
-
hasBreak: false,
|
|
5179
|
-
hasContinue: false,
|
|
5180
|
-
ignore: {
|
|
5181
|
-
breaks: false,
|
|
5182
|
-
continues: false,
|
|
5183
|
-
labels: new Set(),
|
|
5184
|
-
returnYield: false,
|
|
5185
|
-
this: false
|
|
5186
|
-
},
|
|
5187
|
-
includedLabels: new Set(),
|
|
5188
|
-
instantiated: new DiscriminatedPathTracker(),
|
|
5189
|
-
replacedVariableInits: new Map()
|
|
5190
|
-
};
|
|
5191
|
-
}
|
|
3928
|
+
const matcher = (input, returnObject = false) => {
|
|
3929
|
+
const { isMatch, match, output } = picomatch$1.test(input, regex, options, { glob, posix });
|
|
3930
|
+
const result = { glob, state, regex, posix, input, output, match, isMatch };
|
|
5192
3931
|
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
}
|
|
5196
|
-
const UNDEFINED_EXPRESSION = new (class UndefinedExpression extends ExpressionEntity {
|
|
5197
|
-
getLiteralValueAtPath() {
|
|
5198
|
-
return undefined;
|
|
5199
|
-
}
|
|
5200
|
-
})();
|
|
5201
|
-
const returnsUnknown = {
|
|
5202
|
-
value: {
|
|
5203
|
-
hasEffectsWhenCalled: null,
|
|
5204
|
-
returns: UNKNOWN_EXPRESSION
|
|
5205
|
-
}
|
|
5206
|
-
};
|
|
5207
|
-
const UNKNOWN_LITERAL_BOOLEAN = new (class UnknownBoolean extends ExpressionEntity {
|
|
5208
|
-
getReturnExpressionWhenCalledAtPath(path) {
|
|
5209
|
-
if (path.length === 1) {
|
|
5210
|
-
return getMemberReturnExpressionWhenCalled(literalBooleanMembers, path[0]);
|
|
5211
|
-
}
|
|
5212
|
-
return UNKNOWN_RETURN_EXPRESSION;
|
|
5213
|
-
}
|
|
5214
|
-
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
5215
|
-
if (interaction.type === INTERACTION_ACCESSED) {
|
|
5216
|
-
return path.length > 1;
|
|
5217
|
-
}
|
|
5218
|
-
if (interaction.type === INTERACTION_CALLED && path.length === 1) {
|
|
5219
|
-
return hasMemberEffectWhenCalled(literalBooleanMembers, path[0], interaction, context);
|
|
5220
|
-
}
|
|
5221
|
-
return true;
|
|
5222
|
-
}
|
|
5223
|
-
})();
|
|
5224
|
-
const returnsBoolean = {
|
|
5225
|
-
value: {
|
|
5226
|
-
hasEffectsWhenCalled: null,
|
|
5227
|
-
returns: UNKNOWN_LITERAL_BOOLEAN
|
|
5228
|
-
}
|
|
5229
|
-
};
|
|
5230
|
-
const UNKNOWN_LITERAL_NUMBER = new (class UnknownNumber extends ExpressionEntity {
|
|
5231
|
-
getReturnExpressionWhenCalledAtPath(path) {
|
|
5232
|
-
if (path.length === 1) {
|
|
5233
|
-
return getMemberReturnExpressionWhenCalled(literalNumberMembers, path[0]);
|
|
5234
|
-
}
|
|
5235
|
-
return UNKNOWN_RETURN_EXPRESSION;
|
|
5236
|
-
}
|
|
5237
|
-
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
5238
|
-
if (interaction.type === INTERACTION_ACCESSED) {
|
|
5239
|
-
return path.length > 1;
|
|
5240
|
-
}
|
|
5241
|
-
if (interaction.type === INTERACTION_CALLED && path.length === 1) {
|
|
5242
|
-
return hasMemberEffectWhenCalled(literalNumberMembers, path[0], interaction, context);
|
|
5243
|
-
}
|
|
5244
|
-
return true;
|
|
5245
|
-
}
|
|
5246
|
-
})();
|
|
5247
|
-
const returnsNumber = {
|
|
5248
|
-
value: {
|
|
5249
|
-
hasEffectsWhenCalled: null,
|
|
5250
|
-
returns: UNKNOWN_LITERAL_NUMBER
|
|
5251
|
-
}
|
|
5252
|
-
};
|
|
5253
|
-
const UNKNOWN_LITERAL_STRING = new (class UnknownString extends ExpressionEntity {
|
|
5254
|
-
getReturnExpressionWhenCalledAtPath(path) {
|
|
5255
|
-
if (path.length === 1) {
|
|
5256
|
-
return getMemberReturnExpressionWhenCalled(literalStringMembers, path[0]);
|
|
5257
|
-
}
|
|
5258
|
-
return UNKNOWN_RETURN_EXPRESSION;
|
|
3932
|
+
if (typeof opts.onResult === 'function') {
|
|
3933
|
+
opts.onResult(result);
|
|
5259
3934
|
}
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
if (interaction.type === INTERACTION_CALLED && path.length === 1) {
|
|
5265
|
-
return hasMemberEffectWhenCalled(literalStringMembers, path[0], interaction, context);
|
|
5266
|
-
}
|
|
5267
|
-
return true;
|
|
3935
|
+
|
|
3936
|
+
if (isMatch === false) {
|
|
3937
|
+
result.isMatch = false;
|
|
3938
|
+
return returnObject ? result : false;
|
|
5268
3939
|
}
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
3940
|
+
|
|
3941
|
+
if (isIgnored(input)) {
|
|
3942
|
+
if (typeof opts.onIgnore === 'function') {
|
|
3943
|
+
opts.onIgnore(result);
|
|
3944
|
+
}
|
|
3945
|
+
result.isMatch = false;
|
|
3946
|
+
return returnObject ? result : false;
|
|
5274
3947
|
}
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
hasEffectsWhenCalled({ args }, context) {
|
|
5279
|
-
const argument1 = args[2];
|
|
5280
|
-
return (args.length < 3 ||
|
|
5281
|
-
(typeof argument1.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, {
|
|
5282
|
-
deoptimizeCache() { }
|
|
5283
|
-
}) === 'symbol' &&
|
|
5284
|
-
argument1.hasEffectsOnInteractionAtPath(EMPTY_PATH, NODE_INTERACTION_UNKNOWN_CALL, context)));
|
|
5285
|
-
},
|
|
5286
|
-
returns: UNKNOWN_LITERAL_STRING
|
|
3948
|
+
|
|
3949
|
+
if (typeof opts.onMatch === 'function') {
|
|
3950
|
+
opts.onMatch(result);
|
|
5287
3951
|
}
|
|
3952
|
+
return returnObject ? result : true;
|
|
3953
|
+
};
|
|
3954
|
+
|
|
3955
|
+
if (returnState) {
|
|
3956
|
+
matcher.state = state;
|
|
3957
|
+
}
|
|
3958
|
+
|
|
3959
|
+
return matcher;
|
|
5288
3960
|
};
|
|
5289
|
-
|
|
5290
|
-
hasOwnProperty: returnsBoolean,
|
|
5291
|
-
isPrototypeOf: returnsBoolean,
|
|
5292
|
-
propertyIsEnumerable: returnsBoolean,
|
|
5293
|
-
toLocaleString: returnsString,
|
|
5294
|
-
toString: returnsString,
|
|
5295
|
-
valueOf: returnsUnknown
|
|
5296
|
-
});
|
|
5297
|
-
const literalBooleanMembers = assembleMemberDescriptions({
|
|
5298
|
-
valueOf: returnsBoolean
|
|
5299
|
-
}, objectMembers);
|
|
5300
|
-
const literalNumberMembers = assembleMemberDescriptions({
|
|
5301
|
-
toExponential: returnsString,
|
|
5302
|
-
toFixed: returnsString,
|
|
5303
|
-
toLocaleString: returnsString,
|
|
5304
|
-
toPrecision: returnsString,
|
|
5305
|
-
valueOf: returnsNumber
|
|
5306
|
-
}, objectMembers);
|
|
3961
|
+
|
|
5307
3962
|
/**
|
|
5308
|
-
*
|
|
5309
|
-
*
|
|
5310
|
-
*
|
|
3963
|
+
* Test `input` with the given `regex`. This is used by the main
|
|
3964
|
+
* `picomatch()` function to test the input string.
|
|
3965
|
+
*
|
|
3966
|
+
* ```js
|
|
3967
|
+
* const picomatch = require('picomatch');
|
|
3968
|
+
* // picomatch.test(input, regex[, options]);
|
|
3969
|
+
*
|
|
3970
|
+
* console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
|
|
3971
|
+
* // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
|
|
3972
|
+
* ```
|
|
3973
|
+
* @param {String} `input` String to test.
|
|
3974
|
+
* @param {RegExp} `regex`
|
|
3975
|
+
* @return {Object} Returns an object with matching info.
|
|
3976
|
+
* @api public
|
|
5311
3977
|
*/
|
|
5312
|
-
const literalRegExpMembers = assembleMemberDescriptions({
|
|
5313
|
-
exec: returnsUnknown,
|
|
5314
|
-
test: returnsBoolean
|
|
5315
|
-
}, objectMembers);
|
|
5316
|
-
const literalStringMembers = assembleMemberDescriptions({
|
|
5317
|
-
anchor: returnsString,
|
|
5318
|
-
at: returnsUnknown,
|
|
5319
|
-
big: returnsString,
|
|
5320
|
-
blink: returnsString,
|
|
5321
|
-
bold: returnsString,
|
|
5322
|
-
charAt: returnsString,
|
|
5323
|
-
charCodeAt: returnsNumber,
|
|
5324
|
-
codePointAt: returnsUnknown,
|
|
5325
|
-
concat: returnsString,
|
|
5326
|
-
endsWith: returnsBoolean,
|
|
5327
|
-
fixed: returnsString,
|
|
5328
|
-
fontcolor: returnsString,
|
|
5329
|
-
fontsize: returnsString,
|
|
5330
|
-
includes: returnsBoolean,
|
|
5331
|
-
indexOf: returnsNumber,
|
|
5332
|
-
italics: returnsString,
|
|
5333
|
-
lastIndexOf: returnsNumber,
|
|
5334
|
-
link: returnsString,
|
|
5335
|
-
localeCompare: returnsNumber,
|
|
5336
|
-
match: returnsUnknown,
|
|
5337
|
-
matchAll: returnsUnknown,
|
|
5338
|
-
normalize: returnsString,
|
|
5339
|
-
padEnd: returnsString,
|
|
5340
|
-
padStart: returnsString,
|
|
5341
|
-
repeat: returnsString,
|
|
5342
|
-
replace: stringReplace,
|
|
5343
|
-
replaceAll: stringReplace,
|
|
5344
|
-
search: returnsNumber,
|
|
5345
|
-
slice: returnsString,
|
|
5346
|
-
small: returnsString,
|
|
5347
|
-
split: returnsUnknown,
|
|
5348
|
-
startsWith: returnsBoolean,
|
|
5349
|
-
strike: returnsString,
|
|
5350
|
-
sub: returnsString,
|
|
5351
|
-
substr: returnsString,
|
|
5352
|
-
substring: returnsString,
|
|
5353
|
-
sup: returnsString,
|
|
5354
|
-
toLocaleLowerCase: returnsString,
|
|
5355
|
-
toLocaleUpperCase: returnsString,
|
|
5356
|
-
toLowerCase: returnsString,
|
|
5357
|
-
toString: returnsString,
|
|
5358
|
-
toUpperCase: returnsString,
|
|
5359
|
-
trim: returnsString,
|
|
5360
|
-
trimEnd: returnsString,
|
|
5361
|
-
trimLeft: returnsString,
|
|
5362
|
-
trimRight: returnsString,
|
|
5363
|
-
trimStart: returnsString,
|
|
5364
|
-
valueOf: returnsString
|
|
5365
|
-
}, objectMembers);
|
|
5366
|
-
function getLiteralMembersForValue(value) {
|
|
5367
|
-
if (value instanceof RegExp) {
|
|
5368
|
-
return literalRegExpMembers;
|
|
5369
|
-
}
|
|
5370
|
-
switch (typeof value) {
|
|
5371
|
-
case 'boolean': {
|
|
5372
|
-
return literalBooleanMembers;
|
|
5373
|
-
}
|
|
5374
|
-
case 'number': {
|
|
5375
|
-
return literalNumberMembers;
|
|
5376
|
-
}
|
|
5377
|
-
case 'string': {
|
|
5378
|
-
return literalStringMembers;
|
|
5379
|
-
}
|
|
5380
|
-
}
|
|
5381
|
-
return Object.create(null);
|
|
5382
|
-
}
|
|
5383
|
-
function hasMemberEffectWhenCalled(members, memberName, interaction, context) {
|
|
5384
|
-
if (typeof memberName !== 'string' || !members[memberName]) {
|
|
5385
|
-
return true;
|
|
5386
|
-
}
|
|
5387
|
-
return members[memberName].hasEffectsWhenCalled?.(interaction, context) || false;
|
|
5388
|
-
}
|
|
5389
|
-
function getMemberReturnExpressionWhenCalled(members, memberName) {
|
|
5390
|
-
if (typeof memberName !== 'string' || !members[memberName])
|
|
5391
|
-
return UNKNOWN_RETURN_EXPRESSION;
|
|
5392
|
-
return [members[memberName].returns, false];
|
|
5393
|
-
}
|
|
5394
3978
|
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
'
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
'
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
'==',
|
|
5414
|
-
'!=',
|
|
5415
|
-
'===',
|
|
5416
|
-
'!==',
|
|
5417
|
-
'<',
|
|
5418
|
-
'<=',
|
|
5419
|
-
'>',
|
|
5420
|
-
'>=',
|
|
5421
|
-
'<<',
|
|
5422
|
-
'>>',
|
|
5423
|
-
'>>>',
|
|
5424
|
-
'+',
|
|
5425
|
-
'-',
|
|
5426
|
-
'*',
|
|
5427
|
-
'/',
|
|
5428
|
-
'%',
|
|
5429
|
-
'|',
|
|
5430
|
-
'^',
|
|
5431
|
-
'&',
|
|
5432
|
-
'||',
|
|
5433
|
-
'&&',
|
|
5434
|
-
'in',
|
|
5435
|
-
'instanceof',
|
|
5436
|
-
'**',
|
|
5437
|
-
'??',
|
|
5438
|
-
'=',
|
|
5439
|
-
'+=',
|
|
5440
|
-
'-=',
|
|
5441
|
-
'*=',
|
|
5442
|
-
'/=',
|
|
5443
|
-
'%=',
|
|
5444
|
-
'<<=',
|
|
5445
|
-
'>>=',
|
|
5446
|
-
'>>>=',
|
|
5447
|
-
'|=',
|
|
5448
|
-
'^=',
|
|
5449
|
-
'&=',
|
|
5450
|
-
'**=',
|
|
5451
|
-
'&&=',
|
|
5452
|
-
'||=',
|
|
5453
|
-
'??=',
|
|
5454
|
-
'pure',
|
|
5455
|
-
'noSideEffects'
|
|
5456
|
-
];
|
|
3979
|
+
picomatch$1.test = (input, regex, options, { glob, posix } = {}) => {
|
|
3980
|
+
if (typeof input !== 'string') {
|
|
3981
|
+
throw new TypeError('Expected input to be a string');
|
|
3982
|
+
}
|
|
3983
|
+
|
|
3984
|
+
if (input === '') {
|
|
3985
|
+
return { isMatch: false, output: '' };
|
|
3986
|
+
}
|
|
3987
|
+
|
|
3988
|
+
const opts = options || {};
|
|
3989
|
+
const format = opts.format || (posix ? utils.toPosixSlashes : null);
|
|
3990
|
+
let match = input === glob;
|
|
3991
|
+
let output = (match && format) ? format(input) : input;
|
|
3992
|
+
|
|
3993
|
+
if (match === false) {
|
|
3994
|
+
output = format ? format(input) : input;
|
|
3995
|
+
match = output === glob;
|
|
3996
|
+
}
|
|
5457
3997
|
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
if (!converter) {
|
|
5464
|
-
console.trace();
|
|
5465
|
-
throw new Error(`Unknown node type: ${nodeType}`);
|
|
3998
|
+
if (match === false || opts.capture === true) {
|
|
3999
|
+
if (opts.matchBase === true || opts.basename === true) {
|
|
4000
|
+
match = picomatch$1.matchBase(input, regex, options, posix);
|
|
4001
|
+
} else {
|
|
4002
|
+
match = regex.exec(output);
|
|
5466
4003
|
}
|
|
5467
|
-
|
|
4004
|
+
}
|
|
4005
|
+
|
|
4006
|
+
return { isMatch: Boolean(match), match, output };
|
|
5468
4007
|
};
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
(
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
const
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
return {
|
|
5678
|
-
type: 'ClassExpression',
|
|
5679
|
-
start,
|
|
5680
|
-
end,
|
|
5681
|
-
body,
|
|
5682
|
-
id: idPosition ? convertNode(idPosition, buffer, readString) : null,
|
|
5683
|
-
superClass: superClassPosition ? convertNode(superClassPosition, buffer, readString) : null
|
|
5684
|
-
};
|
|
5685
|
-
},
|
|
5686
|
-
// index:15; ConditionalExpression
|
|
5687
|
-
(position, buffer, readString) => {
|
|
5688
|
-
const start = buffer[position++];
|
|
5689
|
-
const end = buffer[position++];
|
|
5690
|
-
const consequent = convertNode(buffer[position++], buffer, readString);
|
|
5691
|
-
const alternate = convertNode(buffer[position++], buffer, readString);
|
|
5692
|
-
const test = convertNode(position, buffer, readString);
|
|
5693
|
-
return {
|
|
5694
|
-
type: 'ConditionalExpression',
|
|
5695
|
-
start,
|
|
5696
|
-
end,
|
|
5697
|
-
alternate,
|
|
5698
|
-
consequent,
|
|
5699
|
-
test
|
|
5700
|
-
};
|
|
5701
|
-
},
|
|
5702
|
-
// index:16; ContinueStatement
|
|
5703
|
-
(position, buffer, readString) => {
|
|
5704
|
-
const start = buffer[position++];
|
|
5705
|
-
const end = buffer[position++];
|
|
5706
|
-
const labelPosition = buffer[position];
|
|
5707
|
-
return {
|
|
5708
|
-
type: 'ContinueStatement',
|
|
5709
|
-
start,
|
|
5710
|
-
end,
|
|
5711
|
-
label: labelPosition ? convertNode(labelPosition, buffer, readString) : null
|
|
5712
|
-
};
|
|
5713
|
-
},
|
|
5714
|
-
// index:17; DebuggerStatement
|
|
5715
|
-
(position, buffer) => {
|
|
5716
|
-
const start = buffer[position++];
|
|
5717
|
-
const end = buffer[position++];
|
|
5718
|
-
return {
|
|
5719
|
-
type: 'DebuggerStatement',
|
|
5720
|
-
start,
|
|
5721
|
-
end
|
|
5722
|
-
};
|
|
5723
|
-
},
|
|
5724
|
-
// index:18; DoWhileStatement
|
|
5725
|
-
(position, buffer, readString) => {
|
|
5726
|
-
const start = buffer[position++];
|
|
5727
|
-
const end = buffer[position++];
|
|
5728
|
-
const test = convertNode(buffer[position++], buffer, readString);
|
|
5729
|
-
const body = convertNode(position, buffer, readString);
|
|
5730
|
-
return {
|
|
5731
|
-
type: 'DoWhileStatement',
|
|
5732
|
-
start,
|
|
5733
|
-
end,
|
|
5734
|
-
body,
|
|
5735
|
-
test
|
|
5736
|
-
};
|
|
5737
|
-
},
|
|
5738
|
-
// index:19; EmptyStatement
|
|
5739
|
-
(position, buffer) => {
|
|
5740
|
-
const start = buffer[position++];
|
|
5741
|
-
const end = buffer[position++];
|
|
5742
|
-
return {
|
|
5743
|
-
type: 'EmptyStatement',
|
|
5744
|
-
start,
|
|
5745
|
-
end
|
|
5746
|
-
};
|
|
5747
|
-
},
|
|
5748
|
-
// index:20; ExportAllDeclaration
|
|
5749
|
-
(position, buffer, readString) => {
|
|
5750
|
-
const start = buffer[position++];
|
|
5751
|
-
const end = buffer[position++];
|
|
5752
|
-
const exportedPosition = buffer[position++];
|
|
5753
|
-
const source = convertNode(buffer[position++], buffer, readString);
|
|
5754
|
-
const attributes = convertNodeList(buffer[position], buffer, readString);
|
|
5755
|
-
return {
|
|
5756
|
-
type: 'ExportAllDeclaration',
|
|
5757
|
-
start,
|
|
5758
|
-
end,
|
|
5759
|
-
exported: exportedPosition ? convertNode(exportedPosition, buffer, readString) : null,
|
|
5760
|
-
source,
|
|
5761
|
-
attributes
|
|
5762
|
-
};
|
|
5763
|
-
},
|
|
5764
|
-
// index:21; ExportDefaultDeclaration
|
|
5765
|
-
(position, buffer, readString) => {
|
|
5766
|
-
const start = buffer[position++];
|
|
5767
|
-
const end = buffer[position++];
|
|
5768
|
-
const declaration = convertNode(position, buffer, readString);
|
|
5769
|
-
return {
|
|
5770
|
-
type: 'ExportDefaultDeclaration',
|
|
5771
|
-
start,
|
|
5772
|
-
end,
|
|
5773
|
-
declaration
|
|
5774
|
-
};
|
|
5775
|
-
},
|
|
5776
|
-
// index:22; ExportNamedDeclaration
|
|
5777
|
-
(position, buffer, readString) => {
|
|
5778
|
-
const start = buffer[position++];
|
|
5779
|
-
const end = buffer[position++];
|
|
5780
|
-
const declarationPosition = buffer[position++];
|
|
5781
|
-
const sourcePosition = buffer[position++];
|
|
5782
|
-
const attributes = convertNodeList(buffer[position++], buffer, readString);
|
|
5783
|
-
const specifiers = convertNodeList(position, buffer, readString);
|
|
5784
|
-
return {
|
|
5785
|
-
type: 'ExportNamedDeclaration',
|
|
5786
|
-
start,
|
|
5787
|
-
end,
|
|
5788
|
-
declaration: declarationPosition
|
|
5789
|
-
? convertNode(declarationPosition, buffer, readString)
|
|
5790
|
-
: null,
|
|
5791
|
-
source: sourcePosition ? convertNode(sourcePosition, buffer, readString) : null,
|
|
5792
|
-
specifiers,
|
|
5793
|
-
attributes
|
|
5794
|
-
};
|
|
5795
|
-
},
|
|
5796
|
-
// index:23; ExportSpecifier
|
|
5797
|
-
(position, buffer, readString) => {
|
|
5798
|
-
const start = buffer[position++];
|
|
5799
|
-
const end = buffer[position++];
|
|
5800
|
-
const exportedPosition = buffer[position++];
|
|
5801
|
-
const local = convertNode(position, buffer, readString);
|
|
5802
|
-
const exported = exportedPosition ? convertNode(exportedPosition, buffer, readString) : local;
|
|
5803
|
-
return {
|
|
5804
|
-
type: 'ExportSpecifier',
|
|
5805
|
-
start,
|
|
5806
|
-
end,
|
|
5807
|
-
exported,
|
|
5808
|
-
local
|
|
5809
|
-
};
|
|
5810
|
-
},
|
|
5811
|
-
// index:24; ExpressionStatement
|
|
5812
|
-
(position, buffer, readString) => {
|
|
5813
|
-
const start = buffer[position++];
|
|
5814
|
-
const end = buffer[position++];
|
|
5815
|
-
const directivePosition = buffer[position++];
|
|
5816
|
-
const expression = convertNode(position, buffer, readString);
|
|
5817
|
-
return {
|
|
5818
|
-
type: 'ExpressionStatement',
|
|
5819
|
-
start,
|
|
5820
|
-
end,
|
|
5821
|
-
expression,
|
|
5822
|
-
...(directivePosition
|
|
5823
|
-
? { directive: convertString(directivePosition, buffer, readString) }
|
|
5824
|
-
: {})
|
|
5825
|
-
};
|
|
5826
|
-
},
|
|
5827
|
-
// index:25; ForInStatement
|
|
5828
|
-
(position, buffer, readString) => {
|
|
5829
|
-
const start = buffer[position++];
|
|
5830
|
-
const end = buffer[position++];
|
|
5831
|
-
const right = convertNode(buffer[position++], buffer, readString);
|
|
5832
|
-
const body = convertNode(buffer[position++], buffer, readString);
|
|
5833
|
-
const left = convertNode(position, buffer, readString);
|
|
5834
|
-
return {
|
|
5835
|
-
type: 'ForInStatement',
|
|
5836
|
-
start,
|
|
5837
|
-
end,
|
|
5838
|
-
body,
|
|
5839
|
-
left,
|
|
5840
|
-
right
|
|
5841
|
-
};
|
|
5842
|
-
},
|
|
5843
|
-
// index:26; ForOfStatement
|
|
5844
|
-
(position, buffer, readString) => {
|
|
5845
|
-
const start = buffer[position++];
|
|
5846
|
-
const end = buffer[position++];
|
|
5847
|
-
const awaited = !!buffer[position++];
|
|
5848
|
-
const right = convertNode(buffer[position++], buffer, readString);
|
|
5849
|
-
const body = convertNode(buffer[position++], buffer, readString);
|
|
5850
|
-
const left = convertNode(position, buffer, readString);
|
|
5851
|
-
return {
|
|
5852
|
-
type: 'ForOfStatement',
|
|
5853
|
-
start,
|
|
5854
|
-
end,
|
|
5855
|
-
await: awaited,
|
|
5856
|
-
body,
|
|
5857
|
-
left,
|
|
5858
|
-
right
|
|
5859
|
-
};
|
|
5860
|
-
},
|
|
5861
|
-
// index:27; ForStatement
|
|
5862
|
-
(position, buffer, readString) => {
|
|
5863
|
-
const start = buffer[position++];
|
|
5864
|
-
const end = buffer[position++];
|
|
5865
|
-
const initPosition = buffer[position++];
|
|
5866
|
-
const testPosition = buffer[position++];
|
|
5867
|
-
const updatePosition = buffer[position++];
|
|
5868
|
-
const body = convertNode(buffer[position], buffer, readString);
|
|
5869
|
-
return {
|
|
5870
|
-
type: 'ForStatement',
|
|
5871
|
-
start,
|
|
5872
|
-
end,
|
|
5873
|
-
body,
|
|
5874
|
-
init: initPosition ? convertNode(initPosition, buffer, readString) : null,
|
|
5875
|
-
test: testPosition ? convertNode(testPosition, buffer, readString) : null,
|
|
5876
|
-
update: updatePosition ? convertNode(updatePosition, buffer, readString) : null
|
|
5877
|
-
};
|
|
5878
|
-
},
|
|
5879
|
-
// index:28; FunctionDeclaration
|
|
5880
|
-
(position, buffer, readString) => {
|
|
5881
|
-
const start = buffer[position++];
|
|
5882
|
-
const end = buffer[position++];
|
|
5883
|
-
const async = !!buffer[position++];
|
|
5884
|
-
const generator = !!buffer[position++];
|
|
5885
|
-
const idPosition = buffer[position++];
|
|
5886
|
-
const parameters = convertNodeList(buffer[position++], buffer, readString);
|
|
5887
|
-
const body = convertNode(buffer[position++], buffer, readString);
|
|
5888
|
-
const annotations = convertAnnotationList(position, buffer);
|
|
5889
|
-
return addAnnotationProperty({
|
|
5890
|
-
type: 'FunctionDeclaration',
|
|
5891
|
-
start,
|
|
5892
|
-
end,
|
|
5893
|
-
async,
|
|
5894
|
-
body,
|
|
5895
|
-
expression: false,
|
|
5896
|
-
generator,
|
|
5897
|
-
id: idPosition ? convertNode(idPosition, buffer, readString) : null,
|
|
5898
|
-
params: parameters
|
|
5899
|
-
}, annotations, ANNOTATION_KEY);
|
|
5900
|
-
},
|
|
5901
|
-
// index:29; FunctionExpression
|
|
5902
|
-
(position, buffer, readString) => {
|
|
5903
|
-
const start = buffer[position++];
|
|
5904
|
-
const end = buffer[position++];
|
|
5905
|
-
const async = !!buffer[position++];
|
|
5906
|
-
const generator = !!buffer[position++];
|
|
5907
|
-
const idPosition = buffer[position++];
|
|
5908
|
-
const parameters = convertNodeList(buffer[position++], buffer, readString);
|
|
5909
|
-
const body = convertNode(buffer[position++], buffer, readString);
|
|
5910
|
-
const annotations = convertAnnotationList(position, buffer);
|
|
5911
|
-
return addAnnotationProperty({
|
|
5912
|
-
type: 'FunctionExpression',
|
|
5913
|
-
start,
|
|
5914
|
-
end,
|
|
5915
|
-
async,
|
|
5916
|
-
body,
|
|
5917
|
-
expression: false,
|
|
5918
|
-
generator,
|
|
5919
|
-
id: idPosition ? convertNode(idPosition, buffer, readString) : null,
|
|
5920
|
-
params: parameters
|
|
5921
|
-
}, annotations, ANNOTATION_KEY);
|
|
5922
|
-
},
|
|
5923
|
-
// index:30; Identifier
|
|
5924
|
-
(position, buffer, readString) => {
|
|
5925
|
-
const start = buffer[position++];
|
|
5926
|
-
const end = buffer[position++];
|
|
5927
|
-
const name = convertString(position, buffer, readString);
|
|
5928
|
-
return {
|
|
5929
|
-
type: 'Identifier',
|
|
5930
|
-
start,
|
|
5931
|
-
end,
|
|
5932
|
-
name
|
|
5933
|
-
};
|
|
5934
|
-
},
|
|
5935
|
-
// index:31; IfStatement
|
|
5936
|
-
(position, buffer, readString) => {
|
|
5937
|
-
const start = buffer[position++];
|
|
5938
|
-
const end = buffer[position++];
|
|
5939
|
-
const consequent = convertNode(buffer[position++], buffer, readString);
|
|
5940
|
-
const alternatePosition = buffer[position++];
|
|
5941
|
-
const test = convertNode(position, buffer, readString);
|
|
5942
|
-
return {
|
|
5943
|
-
type: 'IfStatement',
|
|
5944
|
-
start,
|
|
5945
|
-
end,
|
|
5946
|
-
alternate: alternatePosition ? convertNode(alternatePosition, buffer, readString) : null,
|
|
5947
|
-
consequent,
|
|
5948
|
-
test
|
|
5949
|
-
};
|
|
5950
|
-
},
|
|
5951
|
-
// index:32; ImportAttribute
|
|
5952
|
-
(position, buffer, readString) => {
|
|
5953
|
-
const start = buffer[position++];
|
|
5954
|
-
const end = buffer[position++];
|
|
5955
|
-
const value = convertNode(buffer[position++], buffer, readString);
|
|
5956
|
-
const key = convertNode(position, buffer, readString);
|
|
5957
|
-
return {
|
|
5958
|
-
type: 'ImportAttribute',
|
|
5959
|
-
start,
|
|
5960
|
-
end,
|
|
5961
|
-
key,
|
|
5962
|
-
value
|
|
5963
|
-
};
|
|
5964
|
-
},
|
|
5965
|
-
// index:33; ImportDeclaration
|
|
5966
|
-
(position, buffer, readString) => {
|
|
5967
|
-
const start = buffer[position++];
|
|
5968
|
-
const end = buffer[position++];
|
|
5969
|
-
const source = convertNode(buffer[position++], buffer, readString);
|
|
5970
|
-
const attributes = convertNodeList(buffer[position++], buffer, readString);
|
|
5971
|
-
const specifiers = convertNodeList(position, buffer, readString);
|
|
5972
|
-
return {
|
|
5973
|
-
type: 'ImportDeclaration',
|
|
5974
|
-
start,
|
|
5975
|
-
end,
|
|
5976
|
-
source,
|
|
5977
|
-
specifiers,
|
|
5978
|
-
attributes
|
|
5979
|
-
};
|
|
5980
|
-
},
|
|
5981
|
-
// index:34; ImportDefaultSpecifier
|
|
5982
|
-
(position, buffer, readString) => {
|
|
5983
|
-
const start = buffer[position++];
|
|
5984
|
-
const end = buffer[position++];
|
|
5985
|
-
const local = convertNode(position, buffer, readString);
|
|
5986
|
-
return {
|
|
5987
|
-
type: 'ImportDefaultSpecifier',
|
|
5988
|
-
start,
|
|
5989
|
-
end,
|
|
5990
|
-
local
|
|
5991
|
-
};
|
|
5992
|
-
},
|
|
5993
|
-
// index:35; ImportExpression
|
|
5994
|
-
(position, buffer, readString) => {
|
|
5995
|
-
const start = buffer[position++];
|
|
5996
|
-
const end = buffer[position++];
|
|
5997
|
-
const optionsPosition = buffer[position++];
|
|
5998
|
-
const source = convertNode(position, buffer, readString);
|
|
5999
|
-
return {
|
|
6000
|
-
type: 'ImportExpression',
|
|
6001
|
-
start,
|
|
6002
|
-
end,
|
|
6003
|
-
source,
|
|
6004
|
-
options: optionsPosition ? convertNode(optionsPosition, buffer, readString) : null
|
|
6005
|
-
};
|
|
6006
|
-
},
|
|
6007
|
-
// index:36; ImportNamespaceSpecifier
|
|
6008
|
-
(position, buffer, readString) => {
|
|
6009
|
-
const start = buffer[position++];
|
|
6010
|
-
const end = buffer[position++];
|
|
6011
|
-
const local = convertNode(position, buffer, readString);
|
|
6012
|
-
return {
|
|
6013
|
-
type: 'ImportNamespaceSpecifier',
|
|
6014
|
-
start,
|
|
6015
|
-
end,
|
|
6016
|
-
local
|
|
6017
|
-
};
|
|
6018
|
-
},
|
|
6019
|
-
// index:37; ImportSpecifier
|
|
6020
|
-
(position, buffer, readString) => {
|
|
6021
|
-
const start = buffer[position++];
|
|
6022
|
-
const end = buffer[position++];
|
|
6023
|
-
const importedPosition = buffer[position++];
|
|
6024
|
-
const local = convertNode(buffer[position], buffer, readString);
|
|
6025
|
-
const imported = importedPosition ? convertNode(importedPosition, buffer, readString) : local;
|
|
6026
|
-
return {
|
|
6027
|
-
type: 'ImportSpecifier',
|
|
6028
|
-
start,
|
|
6029
|
-
end,
|
|
6030
|
-
imported,
|
|
6031
|
-
local
|
|
6032
|
-
};
|
|
6033
|
-
},
|
|
6034
|
-
// index:38; LabeledStatement
|
|
6035
|
-
(position, buffer, readString) => {
|
|
6036
|
-
const start = buffer[position++];
|
|
6037
|
-
const end = buffer[position++];
|
|
6038
|
-
const body = convertNode(buffer[position++], buffer, readString);
|
|
6039
|
-
const label = convertNode(position, buffer, readString);
|
|
6040
|
-
return {
|
|
6041
|
-
type: 'LabeledStatement',
|
|
6042
|
-
start,
|
|
6043
|
-
end,
|
|
6044
|
-
body,
|
|
6045
|
-
label
|
|
6046
|
-
};
|
|
6047
|
-
},
|
|
6048
|
-
// index:39; Literal<string>
|
|
6049
|
-
(position, buffer, readString) => {
|
|
6050
|
-
const start = buffer[position++];
|
|
6051
|
-
const end = buffer[position++];
|
|
6052
|
-
const rawPosition = buffer[position++];
|
|
6053
|
-
const raw = rawPosition ? convertString(rawPosition, buffer, readString) : undefined;
|
|
6054
|
-
const value = convertString(position, buffer, readString);
|
|
6055
|
-
return {
|
|
6056
|
-
type: 'Literal',
|
|
6057
|
-
start,
|
|
6058
|
-
end,
|
|
6059
|
-
raw,
|
|
6060
|
-
value
|
|
6061
|
-
};
|
|
6062
|
-
},
|
|
6063
|
-
// index:40; Literal<boolean>
|
|
6064
|
-
(position, buffer) => {
|
|
6065
|
-
const start = buffer[position++];
|
|
6066
|
-
const end = buffer[position++];
|
|
6067
|
-
const value = !!buffer[position++];
|
|
6068
|
-
return {
|
|
6069
|
-
type: 'Literal',
|
|
6070
|
-
start,
|
|
6071
|
-
end,
|
|
6072
|
-
raw: value ? 'true' : 'false',
|
|
6073
|
-
value
|
|
6074
|
-
};
|
|
6075
|
-
},
|
|
6076
|
-
// index:41; Literal<number>
|
|
6077
|
-
(position, buffer, readString) => {
|
|
6078
|
-
const start = buffer[position++];
|
|
6079
|
-
const end = buffer[position++];
|
|
6080
|
-
const rawPosition = buffer[position++];
|
|
6081
|
-
const raw = rawPosition ? convertString(rawPosition, buffer, readString) : undefined;
|
|
6082
|
-
const value = new DataView(buffer.buffer).getFloat64(position << 2, true);
|
|
6083
|
-
return {
|
|
6084
|
-
type: 'Literal',
|
|
6085
|
-
start,
|
|
6086
|
-
end,
|
|
6087
|
-
raw,
|
|
6088
|
-
value
|
|
6089
|
-
};
|
|
6090
|
-
},
|
|
6091
|
-
// index:42; Literal<null>
|
|
6092
|
-
(position, buffer) => {
|
|
6093
|
-
const start = buffer[position++];
|
|
6094
|
-
const end = buffer[position++];
|
|
6095
|
-
return {
|
|
6096
|
-
type: 'Literal',
|
|
6097
|
-
start,
|
|
6098
|
-
end,
|
|
6099
|
-
raw: 'null',
|
|
6100
|
-
value: null
|
|
6101
|
-
};
|
|
6102
|
-
},
|
|
6103
|
-
// index:43; Literal<RegExp>
|
|
6104
|
-
(position, buffer, readString) => {
|
|
6105
|
-
const start = buffer[position++];
|
|
6106
|
-
const end = buffer[position++];
|
|
6107
|
-
const pattern = convertString(buffer[position++], buffer, readString);
|
|
6108
|
-
const flags = convertString(position, buffer, readString);
|
|
6109
|
-
return {
|
|
6110
|
-
type: 'Literal',
|
|
6111
|
-
start,
|
|
6112
|
-
end,
|
|
6113
|
-
raw: `/${pattern}/${flags}`,
|
|
6114
|
-
regex: {
|
|
6115
|
-
flags,
|
|
6116
|
-
pattern
|
|
6117
|
-
},
|
|
6118
|
-
value: new RegExp(pattern, flags)
|
|
6119
|
-
};
|
|
6120
|
-
},
|
|
6121
|
-
// index:44; Literal<bigint>
|
|
6122
|
-
(position, buffer, readString) => {
|
|
6123
|
-
const start = buffer[position++];
|
|
6124
|
-
const end = buffer[position++];
|
|
6125
|
-
const bigint = convertString(buffer[position++], buffer, readString);
|
|
6126
|
-
const raw = convertString(position, buffer, readString);
|
|
6127
|
-
return {
|
|
6128
|
-
type: 'Literal',
|
|
6129
|
-
start,
|
|
6130
|
-
end,
|
|
6131
|
-
bigint,
|
|
6132
|
-
raw,
|
|
6133
|
-
value: BigInt(bigint)
|
|
6134
|
-
};
|
|
6135
|
-
},
|
|
6136
|
-
// index:45; LogicalExpression
|
|
6137
|
-
(position, buffer, readString) => {
|
|
6138
|
-
const start = buffer[position++];
|
|
6139
|
-
const end = buffer[position++];
|
|
6140
|
-
const operator = FIXED_STRINGS[buffer[position++]];
|
|
6141
|
-
const right = convertNode(buffer[position++], buffer, readString);
|
|
6142
|
-
const left = convertNode(position, buffer, readString);
|
|
6143
|
-
return {
|
|
6144
|
-
type: 'LogicalExpression',
|
|
6145
|
-
start,
|
|
6146
|
-
end,
|
|
6147
|
-
left,
|
|
6148
|
-
operator,
|
|
6149
|
-
right
|
|
6150
|
-
};
|
|
6151
|
-
},
|
|
6152
|
-
// index:46; MemberExpression
|
|
6153
|
-
(position, buffer, readString) => {
|
|
6154
|
-
const start = buffer[position++];
|
|
6155
|
-
const end = buffer[position++];
|
|
6156
|
-
const optional = !!buffer[position++];
|
|
6157
|
-
const computed = !!buffer[position++];
|
|
6158
|
-
const property = convertNode(buffer[position++], buffer, readString);
|
|
6159
|
-
const object = convertNode(position, buffer, readString);
|
|
6160
|
-
return {
|
|
6161
|
-
type: 'MemberExpression',
|
|
6162
|
-
start,
|
|
6163
|
-
end,
|
|
6164
|
-
computed,
|
|
6165
|
-
object,
|
|
6166
|
-
optional,
|
|
6167
|
-
property
|
|
6168
|
-
};
|
|
6169
|
-
},
|
|
6170
|
-
// index:47; MetaProperty
|
|
6171
|
-
(position, buffer, readString) => {
|
|
6172
|
-
const start = buffer[position++];
|
|
6173
|
-
const end = buffer[position++];
|
|
6174
|
-
const property = convertNode(buffer[position++], buffer, readString);
|
|
6175
|
-
const meta = convertNode(position, buffer, readString);
|
|
6176
|
-
return {
|
|
6177
|
-
type: 'MetaProperty',
|
|
6178
|
-
start,
|
|
6179
|
-
end,
|
|
6180
|
-
meta,
|
|
6181
|
-
property
|
|
6182
|
-
};
|
|
6183
|
-
},
|
|
6184
|
-
// index:48; MethodDefinition
|
|
6185
|
-
(position, buffer, readString) => {
|
|
6186
|
-
const start = buffer[position++];
|
|
6187
|
-
const end = buffer[position++];
|
|
6188
|
-
const kind = FIXED_STRINGS[buffer[position++]];
|
|
6189
|
-
const computed = !!buffer[position++];
|
|
6190
|
-
const isStatic = !!buffer[position++];
|
|
6191
|
-
const value = convertNode(buffer[position++], buffer, readString);
|
|
6192
|
-
const key = convertNode(position, buffer, readString);
|
|
6193
|
-
return {
|
|
6194
|
-
type: 'MethodDefinition',
|
|
6195
|
-
start,
|
|
6196
|
-
end,
|
|
6197
|
-
computed,
|
|
6198
|
-
key,
|
|
6199
|
-
kind,
|
|
6200
|
-
static: isStatic,
|
|
6201
|
-
value
|
|
6202
|
-
};
|
|
6203
|
-
},
|
|
6204
|
-
// index:49; NewExpression
|
|
6205
|
-
(position, buffer, readString) => {
|
|
6206
|
-
const start = buffer[position++];
|
|
6207
|
-
const end = buffer[position++];
|
|
6208
|
-
const callee = convertNode(buffer[position++], buffer, readString);
|
|
6209
|
-
const argumentsPosition = buffer[position++];
|
|
6210
|
-
const annotations = convertAnnotationList(position, buffer);
|
|
6211
|
-
return addAnnotationProperty({
|
|
6212
|
-
type: 'NewExpression',
|
|
6213
|
-
start,
|
|
6214
|
-
end,
|
|
6215
|
-
arguments: argumentsPosition ? convertNodeList(argumentsPosition, buffer, readString) : [],
|
|
6216
|
-
callee
|
|
6217
|
-
}, annotations, ANNOTATION_KEY);
|
|
6218
|
-
},
|
|
6219
|
-
// index:50; ObjectExpression
|
|
6220
|
-
(position, buffer, readString) => {
|
|
6221
|
-
const start = buffer[position++];
|
|
6222
|
-
const end = buffer[position++];
|
|
6223
|
-
const properties = convertNodeList(position, buffer, readString);
|
|
6224
|
-
return {
|
|
6225
|
-
type: 'ObjectExpression',
|
|
6226
|
-
start,
|
|
6227
|
-
end,
|
|
6228
|
-
properties
|
|
6229
|
-
};
|
|
6230
|
-
},
|
|
6231
|
-
// index:51; ObjectPattern
|
|
6232
|
-
(position, buffer, readString) => {
|
|
6233
|
-
const start = buffer[position++];
|
|
6234
|
-
const end = buffer[position++];
|
|
6235
|
-
const properties = convertNodeList(position, buffer, readString);
|
|
6236
|
-
return {
|
|
6237
|
-
type: 'ObjectPattern',
|
|
6238
|
-
start,
|
|
6239
|
-
end,
|
|
6240
|
-
properties
|
|
6241
|
-
};
|
|
6242
|
-
},
|
|
6243
|
-
// index:52; PrivateIdentifier
|
|
6244
|
-
(position, buffer, readString) => {
|
|
6245
|
-
const start = buffer[position++];
|
|
6246
|
-
const end = buffer[position++];
|
|
6247
|
-
const name = convertString(position, buffer, readString);
|
|
6248
|
-
return {
|
|
6249
|
-
type: 'PrivateIdentifier',
|
|
6250
|
-
start,
|
|
6251
|
-
end,
|
|
6252
|
-
name
|
|
6253
|
-
};
|
|
6254
|
-
},
|
|
6255
|
-
// index:53; Program
|
|
6256
|
-
(position, buffer, readString) => {
|
|
6257
|
-
const start = buffer[position++];
|
|
6258
|
-
const end = buffer[position++];
|
|
6259
|
-
const annotations = convertAnnotationList(buffer[position++], buffer);
|
|
6260
|
-
const body = convertNodeList(position, buffer, readString);
|
|
6261
|
-
return addAnnotationProperty({
|
|
6262
|
-
type: 'Program',
|
|
6263
|
-
start,
|
|
6264
|
-
end,
|
|
6265
|
-
body,
|
|
6266
|
-
sourceType: 'module'
|
|
6267
|
-
}, annotations, INVALID_ANNOTATION_KEY);
|
|
6268
|
-
},
|
|
6269
|
-
// index:54; Property
|
|
6270
|
-
(position, buffer, readString) => {
|
|
6271
|
-
const start = buffer[position++];
|
|
6272
|
-
const end = buffer[position++];
|
|
6273
|
-
const kind = FIXED_STRINGS[buffer[position++]];
|
|
6274
|
-
const method = !!buffer[position++];
|
|
6275
|
-
const computed = !!buffer[position++];
|
|
6276
|
-
const shorthand = !!buffer[position++];
|
|
6277
|
-
const key = convertNode(buffer[position++], buffer, readString);
|
|
6278
|
-
const valuePosition = buffer[position];
|
|
6279
|
-
return {
|
|
6280
|
-
type: 'Property',
|
|
6281
|
-
start,
|
|
6282
|
-
end,
|
|
6283
|
-
computed,
|
|
6284
|
-
key,
|
|
6285
|
-
kind,
|
|
6286
|
-
method,
|
|
6287
|
-
shorthand,
|
|
6288
|
-
value: valuePosition ? convertNode(valuePosition, buffer, readString) : key
|
|
6289
|
-
};
|
|
6290
|
-
},
|
|
6291
|
-
// index:55; PropertyDefinition
|
|
6292
|
-
(position, buffer, readString) => {
|
|
6293
|
-
const start = buffer[position++];
|
|
6294
|
-
const end = buffer[position++];
|
|
6295
|
-
const computed = !!buffer[position++];
|
|
6296
|
-
const isStatic = !!buffer[position++];
|
|
6297
|
-
const valuePosition = buffer[position++];
|
|
6298
|
-
const key = convertNode(position, buffer, readString);
|
|
6299
|
-
return {
|
|
6300
|
-
type: 'PropertyDefinition',
|
|
6301
|
-
start,
|
|
6302
|
-
end,
|
|
6303
|
-
computed,
|
|
6304
|
-
key,
|
|
6305
|
-
static: isStatic,
|
|
6306
|
-
value: valuePosition ? convertNode(valuePosition, buffer, readString) : null
|
|
6307
|
-
};
|
|
6308
|
-
},
|
|
6309
|
-
// index:56; RestElement
|
|
6310
|
-
(position, buffer, readString) => {
|
|
6311
|
-
const start = buffer[position++];
|
|
6312
|
-
const end = buffer[position++];
|
|
6313
|
-
const argument = convertNode(position, buffer, readString);
|
|
6314
|
-
return {
|
|
6315
|
-
type: 'RestElement',
|
|
6316
|
-
start,
|
|
6317
|
-
end,
|
|
6318
|
-
argument
|
|
6319
|
-
};
|
|
6320
|
-
},
|
|
6321
|
-
// index:57; ReturnStatement
|
|
6322
|
-
(position, buffer, readString) => {
|
|
6323
|
-
const start = buffer[position++];
|
|
6324
|
-
const end = buffer[position++];
|
|
6325
|
-
const argumentPosition = buffer[position];
|
|
6326
|
-
return {
|
|
6327
|
-
type: 'ReturnStatement',
|
|
6328
|
-
start,
|
|
6329
|
-
end,
|
|
6330
|
-
argument: argumentPosition ? convertNode(argumentPosition, buffer, readString) : null
|
|
6331
|
-
};
|
|
6332
|
-
},
|
|
6333
|
-
// index:58; SequenceExpression
|
|
6334
|
-
(position, buffer, readString) => {
|
|
6335
|
-
const start = buffer[position++];
|
|
6336
|
-
const end = buffer[position++];
|
|
6337
|
-
const expressions = convertNodeList(position, buffer, readString);
|
|
6338
|
-
return {
|
|
6339
|
-
type: 'SequenceExpression',
|
|
6340
|
-
start,
|
|
6341
|
-
end,
|
|
6342
|
-
expressions
|
|
6343
|
-
};
|
|
6344
|
-
},
|
|
6345
|
-
// index:59; SpreadElement
|
|
6346
|
-
(position, buffer, readString) => {
|
|
6347
|
-
const start = buffer[position++];
|
|
6348
|
-
const end = buffer[position++];
|
|
6349
|
-
const argument = convertNode(position, buffer, readString);
|
|
6350
|
-
return {
|
|
6351
|
-
type: 'SpreadElement',
|
|
6352
|
-
start,
|
|
6353
|
-
end,
|
|
6354
|
-
argument
|
|
6355
|
-
};
|
|
6356
|
-
},
|
|
6357
|
-
// index:60; StaticBlock
|
|
6358
|
-
(position, buffer, readString) => {
|
|
6359
|
-
const start = buffer[position++];
|
|
6360
|
-
const end = buffer[position++];
|
|
6361
|
-
const body = convertNodeList(position, buffer, readString);
|
|
6362
|
-
return {
|
|
6363
|
-
type: 'StaticBlock',
|
|
6364
|
-
start,
|
|
6365
|
-
end,
|
|
6366
|
-
body
|
|
6367
|
-
};
|
|
6368
|
-
},
|
|
6369
|
-
// index:61; Super
|
|
6370
|
-
(position, buffer) => {
|
|
6371
|
-
const start = buffer[position++];
|
|
6372
|
-
const end = buffer[position++];
|
|
6373
|
-
return {
|
|
6374
|
-
type: 'Super',
|
|
6375
|
-
start,
|
|
6376
|
-
end
|
|
6377
|
-
};
|
|
6378
|
-
},
|
|
6379
|
-
// index:62; SwitchCase
|
|
6380
|
-
(position, buffer, readString) => {
|
|
6381
|
-
const start = buffer[position++];
|
|
6382
|
-
const end = buffer[position++];
|
|
6383
|
-
const testPosition = buffer[position++];
|
|
6384
|
-
const consequent = convertNodeList(buffer[position], buffer, readString);
|
|
6385
|
-
return {
|
|
6386
|
-
type: 'SwitchCase',
|
|
6387
|
-
start,
|
|
6388
|
-
end,
|
|
6389
|
-
consequent,
|
|
6390
|
-
test: testPosition ? convertNode(testPosition, buffer, readString) : null
|
|
6391
|
-
};
|
|
4008
|
+
|
|
4009
|
+
/**
|
|
4010
|
+
* Match the basename of a filepath.
|
|
4011
|
+
*
|
|
4012
|
+
* ```js
|
|
4013
|
+
* const picomatch = require('picomatch');
|
|
4014
|
+
* // picomatch.matchBase(input, glob[, options]);
|
|
4015
|
+
* console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
|
|
4016
|
+
* ```
|
|
4017
|
+
* @param {String} `input` String to test.
|
|
4018
|
+
* @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
|
|
4019
|
+
* @return {Boolean}
|
|
4020
|
+
* @api public
|
|
4021
|
+
*/
|
|
4022
|
+
|
|
4023
|
+
picomatch$1.matchBase = (input, glob, options, posix = utils.isWindows(options)) => {
|
|
4024
|
+
const regex = glob instanceof RegExp ? glob : picomatch$1.makeRe(glob, options);
|
|
4025
|
+
return regex.test(path.basename(input));
|
|
4026
|
+
};
|
|
4027
|
+
|
|
4028
|
+
/**
|
|
4029
|
+
* Returns true if **any** of the given glob `patterns` match the specified `string`.
|
|
4030
|
+
*
|
|
4031
|
+
* ```js
|
|
4032
|
+
* const picomatch = require('picomatch');
|
|
4033
|
+
* // picomatch.isMatch(string, patterns[, options]);
|
|
4034
|
+
*
|
|
4035
|
+
* console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
|
|
4036
|
+
* console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
|
|
4037
|
+
* ```
|
|
4038
|
+
* @param {String|Array} str The string to test.
|
|
4039
|
+
* @param {String|Array} patterns One or more glob patterns to use for matching.
|
|
4040
|
+
* @param {Object} [options] See available [options](#options).
|
|
4041
|
+
* @return {Boolean} Returns true if any patterns match `str`
|
|
4042
|
+
* @api public
|
|
4043
|
+
*/
|
|
4044
|
+
|
|
4045
|
+
picomatch$1.isMatch = (str, patterns, options) => picomatch$1(patterns, options)(str);
|
|
4046
|
+
|
|
4047
|
+
/**
|
|
4048
|
+
* Parse a glob pattern to create the source string for a regular
|
|
4049
|
+
* expression.
|
|
4050
|
+
*
|
|
4051
|
+
* ```js
|
|
4052
|
+
* const picomatch = require('picomatch');
|
|
4053
|
+
* const result = picomatch.parse(pattern[, options]);
|
|
4054
|
+
* ```
|
|
4055
|
+
* @param {String} `pattern`
|
|
4056
|
+
* @param {Object} `options`
|
|
4057
|
+
* @return {Object} Returns an object with useful properties and output to be used as a regex source string.
|
|
4058
|
+
* @api public
|
|
4059
|
+
*/
|
|
4060
|
+
|
|
4061
|
+
picomatch$1.parse = (pattern, options) => {
|
|
4062
|
+
if (Array.isArray(pattern)) return pattern.map(p => picomatch$1.parse(p, options));
|
|
4063
|
+
return parse(pattern, { ...options, fastpaths: false });
|
|
4064
|
+
};
|
|
4065
|
+
|
|
4066
|
+
/**
|
|
4067
|
+
* Scan a glob pattern to separate the pattern into segments.
|
|
4068
|
+
*
|
|
4069
|
+
* ```js
|
|
4070
|
+
* const picomatch = require('picomatch');
|
|
4071
|
+
* // picomatch.scan(input[, options]);
|
|
4072
|
+
*
|
|
4073
|
+
* const result = picomatch.scan('!./foo/*.js');
|
|
4074
|
+
* console.log(result);
|
|
4075
|
+
* { prefix: '!./',
|
|
4076
|
+
* input: '!./foo/*.js',
|
|
4077
|
+
* start: 3,
|
|
4078
|
+
* base: 'foo',
|
|
4079
|
+
* glob: '*.js',
|
|
4080
|
+
* isBrace: false,
|
|
4081
|
+
* isBracket: false,
|
|
4082
|
+
* isGlob: true,
|
|
4083
|
+
* isExtglob: false,
|
|
4084
|
+
* isGlobstar: false,
|
|
4085
|
+
* negated: true }
|
|
4086
|
+
* ```
|
|
4087
|
+
* @param {String} `input` Glob pattern to scan.
|
|
4088
|
+
* @param {Object} `options`
|
|
4089
|
+
* @return {Object} Returns an object with
|
|
4090
|
+
* @api public
|
|
4091
|
+
*/
|
|
4092
|
+
|
|
4093
|
+
picomatch$1.scan = (input, options) => scan(input, options);
|
|
4094
|
+
|
|
4095
|
+
/**
|
|
4096
|
+
* Compile a regular expression from the `state` object returned by the
|
|
4097
|
+
* [parse()](#parse) method.
|
|
4098
|
+
*
|
|
4099
|
+
* @param {Object} `state`
|
|
4100
|
+
* @param {Object} `options`
|
|
4101
|
+
* @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
|
|
4102
|
+
* @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
|
|
4103
|
+
* @return {RegExp}
|
|
4104
|
+
* @api public
|
|
4105
|
+
*/
|
|
4106
|
+
|
|
4107
|
+
picomatch$1.compileRe = (state, options, returnOutput = false, returnState = false) => {
|
|
4108
|
+
if (returnOutput === true) {
|
|
4109
|
+
return state.output;
|
|
4110
|
+
}
|
|
4111
|
+
|
|
4112
|
+
const opts = options || {};
|
|
4113
|
+
const prepend = opts.contains ? '' : '^';
|
|
4114
|
+
const append = opts.contains ? '' : '$';
|
|
4115
|
+
|
|
4116
|
+
let source = `${prepend}(?:${state.output})${append}`;
|
|
4117
|
+
if (state && state.negated === true) {
|
|
4118
|
+
source = `^(?!${source}).*$`;
|
|
4119
|
+
}
|
|
4120
|
+
|
|
4121
|
+
const regex = picomatch$1.toRegex(source, options);
|
|
4122
|
+
if (returnState === true) {
|
|
4123
|
+
regex.state = state;
|
|
4124
|
+
}
|
|
4125
|
+
|
|
4126
|
+
return regex;
|
|
4127
|
+
};
|
|
4128
|
+
|
|
4129
|
+
/**
|
|
4130
|
+
* Create a regular expression from a parsed glob pattern.
|
|
4131
|
+
*
|
|
4132
|
+
* ```js
|
|
4133
|
+
* const picomatch = require('picomatch');
|
|
4134
|
+
* const state = picomatch.parse('*.js');
|
|
4135
|
+
* // picomatch.compileRe(state[, options]);
|
|
4136
|
+
*
|
|
4137
|
+
* console.log(picomatch.compileRe(state));
|
|
4138
|
+
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
4139
|
+
* ```
|
|
4140
|
+
* @param {String} `state` The object returned from the `.parse` method.
|
|
4141
|
+
* @param {Object} `options`
|
|
4142
|
+
* @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
|
|
4143
|
+
* @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
|
|
4144
|
+
* @return {RegExp} Returns a regex created from the given pattern.
|
|
4145
|
+
* @api public
|
|
4146
|
+
*/
|
|
4147
|
+
|
|
4148
|
+
picomatch$1.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
|
|
4149
|
+
if (!input || typeof input !== 'string') {
|
|
4150
|
+
throw new TypeError('Expected a non-empty string');
|
|
4151
|
+
}
|
|
4152
|
+
|
|
4153
|
+
let parsed = { negated: false, fastpaths: true };
|
|
4154
|
+
|
|
4155
|
+
if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
|
|
4156
|
+
parsed.output = parse.fastpaths(input, options);
|
|
4157
|
+
}
|
|
4158
|
+
|
|
4159
|
+
if (!parsed.output) {
|
|
4160
|
+
parsed = parse(input, options);
|
|
4161
|
+
}
|
|
4162
|
+
|
|
4163
|
+
return picomatch$1.compileRe(parsed, options, returnOutput, returnState);
|
|
4164
|
+
};
|
|
4165
|
+
|
|
4166
|
+
/**
|
|
4167
|
+
* Create a regular expression from the given regex source string.
|
|
4168
|
+
*
|
|
4169
|
+
* ```js
|
|
4170
|
+
* const picomatch = require('picomatch');
|
|
4171
|
+
* // picomatch.toRegex(source[, options]);
|
|
4172
|
+
*
|
|
4173
|
+
* const { output } = picomatch.parse('*.js');
|
|
4174
|
+
* console.log(picomatch.toRegex(output));
|
|
4175
|
+
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
|
|
4176
|
+
* ```
|
|
4177
|
+
* @param {String} `source` Regular expression source string.
|
|
4178
|
+
* @param {Object} `options`
|
|
4179
|
+
* @return {RegExp}
|
|
4180
|
+
* @api public
|
|
4181
|
+
*/
|
|
4182
|
+
|
|
4183
|
+
picomatch$1.toRegex = (source, options) => {
|
|
4184
|
+
try {
|
|
4185
|
+
const opts = options || {};
|
|
4186
|
+
return new RegExp(source, opts.flags || (opts.nocase ? 'i' : ''));
|
|
4187
|
+
} catch (err) {
|
|
4188
|
+
if (options && options.debug === true) throw err;
|
|
4189
|
+
return /$^/;
|
|
4190
|
+
}
|
|
4191
|
+
};
|
|
4192
|
+
|
|
4193
|
+
/**
|
|
4194
|
+
* Picomatch constants.
|
|
4195
|
+
* @return {Object}
|
|
4196
|
+
*/
|
|
4197
|
+
|
|
4198
|
+
picomatch$1.constants = constants;
|
|
4199
|
+
|
|
4200
|
+
/**
|
|
4201
|
+
* Expose "picomatch"
|
|
4202
|
+
*/
|
|
4203
|
+
|
|
4204
|
+
var picomatch_1 = picomatch$1;
|
|
4205
|
+
|
|
4206
|
+
var picomatch = picomatch_1;
|
|
4207
|
+
|
|
4208
|
+
const pm = /*@__PURE__*/getDefaultExportFromCjs(picomatch);
|
|
4209
|
+
|
|
4210
|
+
const extractors = {
|
|
4211
|
+
ArrayPattern(names, param) {
|
|
4212
|
+
for (const element of param.elements) {
|
|
4213
|
+
if (element)
|
|
4214
|
+
extractors[element.type](names, element);
|
|
4215
|
+
}
|
|
6392
4216
|
},
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
const start = buffer[position++];
|
|
6396
|
-
const end = buffer[position++];
|
|
6397
|
-
const cases = convertNodeList(buffer[position++], buffer, readString);
|
|
6398
|
-
const discriminant = convertNode(position, buffer, readString);
|
|
6399
|
-
return {
|
|
6400
|
-
type: 'SwitchStatement',
|
|
6401
|
-
start,
|
|
6402
|
-
end,
|
|
6403
|
-
cases,
|
|
6404
|
-
discriminant
|
|
6405
|
-
};
|
|
4217
|
+
AssignmentPattern(names, param) {
|
|
4218
|
+
extractors[param.left.type](names, param.left);
|
|
6406
4219
|
},
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
const start = buffer[position++];
|
|
6410
|
-
const end = buffer[position++];
|
|
6411
|
-
const quasi = convertNode(buffer[position++], buffer, readString);
|
|
6412
|
-
const tag = convertNode(position, buffer, readString);
|
|
6413
|
-
return {
|
|
6414
|
-
type: 'TaggedTemplateExpression',
|
|
6415
|
-
start,
|
|
6416
|
-
end,
|
|
6417
|
-
quasi,
|
|
6418
|
-
tag
|
|
6419
|
-
};
|
|
4220
|
+
Identifier(names, param) {
|
|
4221
|
+
names.push(param.name);
|
|
6420
4222
|
},
|
|
6421
|
-
|
|
6422
|
-
(
|
|
6423
|
-
const
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
const raw = convertString(position, buffer, readString);
|
|
6428
|
-
return {
|
|
6429
|
-
type: 'TemplateElement',
|
|
6430
|
-
start,
|
|
6431
|
-
end,
|
|
6432
|
-
tail,
|
|
6433
|
-
value: {
|
|
6434
|
-
cooked: cookedPosition ? convertString(cookedPosition, buffer, readString) : null,
|
|
6435
|
-
raw
|
|
4223
|
+
MemberExpression() { },
|
|
4224
|
+
ObjectPattern(names, param) {
|
|
4225
|
+
for (const prop of param.properties) {
|
|
4226
|
+
// @ts-ignore Typescript reports that this is not a valid type
|
|
4227
|
+
if (prop.type === 'RestElement') {
|
|
4228
|
+
extractors.RestElement(names, prop);
|
|
6436
4229
|
}
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
const start = buffer[position++];
|
|
6442
|
-
const end = buffer[position++];
|
|
6443
|
-
const expressions = convertNodeList(buffer[position++], buffer, readString);
|
|
6444
|
-
const quasis = convertNodeList(position, buffer, readString);
|
|
6445
|
-
return {
|
|
6446
|
-
type: 'TemplateLiteral',
|
|
6447
|
-
start,
|
|
6448
|
-
end,
|
|
6449
|
-
expressions,
|
|
6450
|
-
quasis
|
|
6451
|
-
};
|
|
6452
|
-
},
|
|
6453
|
-
// index:67; ThisExpression
|
|
6454
|
-
(position, buffer) => {
|
|
6455
|
-
const start = buffer[position++];
|
|
6456
|
-
const end = buffer[position++];
|
|
6457
|
-
return {
|
|
6458
|
-
type: 'ThisExpression',
|
|
6459
|
-
start,
|
|
6460
|
-
end
|
|
6461
|
-
};
|
|
6462
|
-
},
|
|
6463
|
-
// index:68; ThrowStatement
|
|
6464
|
-
(position, buffer, readString) => {
|
|
6465
|
-
const start = buffer[position++];
|
|
6466
|
-
const end = buffer[position++];
|
|
6467
|
-
const argument = convertNode(position, buffer, readString);
|
|
6468
|
-
return {
|
|
6469
|
-
type: 'ThrowStatement',
|
|
6470
|
-
start,
|
|
6471
|
-
end,
|
|
6472
|
-
argument
|
|
6473
|
-
};
|
|
6474
|
-
},
|
|
6475
|
-
// index:69; TryStatement
|
|
6476
|
-
(position, buffer, readString) => {
|
|
6477
|
-
const start = buffer[position++];
|
|
6478
|
-
const end = buffer[position++];
|
|
6479
|
-
const handlerPosition = buffer[position++];
|
|
6480
|
-
const finalizerPosition = buffer[position++];
|
|
6481
|
-
const block = convertNode(position, buffer, readString);
|
|
6482
|
-
return {
|
|
6483
|
-
type: 'TryStatement',
|
|
6484
|
-
start,
|
|
6485
|
-
end,
|
|
6486
|
-
block,
|
|
6487
|
-
finalizer: finalizerPosition ? convertNode(finalizerPosition, buffer, readString) : null,
|
|
6488
|
-
handler: handlerPosition ? convertNode(handlerPosition, buffer, readString) : null
|
|
6489
|
-
};
|
|
6490
|
-
},
|
|
6491
|
-
// index:70; UnaryExpression
|
|
6492
|
-
(position, buffer, readString) => {
|
|
6493
|
-
const start = buffer[position++];
|
|
6494
|
-
const end = buffer[position++];
|
|
6495
|
-
const operator = FIXED_STRINGS[buffer[position++]];
|
|
6496
|
-
const argument = convertNode(position, buffer, readString);
|
|
6497
|
-
return {
|
|
6498
|
-
type: 'UnaryExpression',
|
|
6499
|
-
start,
|
|
6500
|
-
end,
|
|
6501
|
-
argument,
|
|
6502
|
-
operator,
|
|
6503
|
-
prefix: true
|
|
6504
|
-
};
|
|
6505
|
-
},
|
|
6506
|
-
// index:71; UpdateExpression
|
|
6507
|
-
(position, buffer, readString) => {
|
|
6508
|
-
const start = buffer[position++];
|
|
6509
|
-
const end = buffer[position++];
|
|
6510
|
-
const prefix = !!buffer[position++];
|
|
6511
|
-
const operator = FIXED_STRINGS[buffer[position++]];
|
|
6512
|
-
const argument = convertNode(position, buffer, readString);
|
|
6513
|
-
return {
|
|
6514
|
-
type: 'UpdateExpression',
|
|
6515
|
-
start,
|
|
6516
|
-
end,
|
|
6517
|
-
argument,
|
|
6518
|
-
operator,
|
|
6519
|
-
prefix
|
|
6520
|
-
};
|
|
6521
|
-
},
|
|
6522
|
-
// index:72; VariableDeclaration
|
|
6523
|
-
(position, buffer, readString) => {
|
|
6524
|
-
const start = buffer[position++];
|
|
6525
|
-
const end = buffer[position++];
|
|
6526
|
-
const kind = FIXED_STRINGS[buffer[position++]];
|
|
6527
|
-
const declarations = convertNodeList(position, buffer, readString);
|
|
6528
|
-
return {
|
|
6529
|
-
type: 'VariableDeclaration',
|
|
6530
|
-
start,
|
|
6531
|
-
end,
|
|
6532
|
-
declarations,
|
|
6533
|
-
kind
|
|
6534
|
-
};
|
|
6535
|
-
},
|
|
6536
|
-
// index:73; VariableDeclarator
|
|
6537
|
-
(position, buffer, readString) => {
|
|
6538
|
-
const start = buffer[position++];
|
|
6539
|
-
const end = buffer[position++];
|
|
6540
|
-
const init_position = buffer[position++];
|
|
6541
|
-
const id = convertNode(position, buffer, readString);
|
|
6542
|
-
return {
|
|
6543
|
-
type: 'VariableDeclarator',
|
|
6544
|
-
start,
|
|
6545
|
-
end,
|
|
6546
|
-
id,
|
|
6547
|
-
init: init_position ? convertNode(init_position, buffer, readString) : null
|
|
6548
|
-
};
|
|
6549
|
-
},
|
|
6550
|
-
// index:74; WhileStatement
|
|
6551
|
-
(position, buffer, readString) => {
|
|
6552
|
-
const start = buffer[position++];
|
|
6553
|
-
const end = buffer[position++];
|
|
6554
|
-
const body = convertNode(buffer[position++], buffer, readString);
|
|
6555
|
-
const test = convertNode(position, buffer, readString);
|
|
6556
|
-
return {
|
|
6557
|
-
type: 'WhileStatement',
|
|
6558
|
-
start,
|
|
6559
|
-
end,
|
|
6560
|
-
body,
|
|
6561
|
-
test
|
|
6562
|
-
};
|
|
4230
|
+
else {
|
|
4231
|
+
extractors[prop.value.type](names, prop.value);
|
|
4232
|
+
}
|
|
4233
|
+
}
|
|
6563
4234
|
},
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
4235
|
+
RestElement(names, param) {
|
|
4236
|
+
extractors[param.argument.type](names, param.argument);
|
|
4237
|
+
}
|
|
4238
|
+
};
|
|
4239
|
+
const extractAssignedNames = function extractAssignedNames(param) {
|
|
4240
|
+
const names = [];
|
|
4241
|
+
extractors[param.type](names, param);
|
|
4242
|
+
return names;
|
|
4243
|
+
};
|
|
4244
|
+
|
|
4245
|
+
// Helper since Typescript can't detect readonly arrays with Array.isArray
|
|
4246
|
+
function isArray(arg) {
|
|
4247
|
+
return Array.isArray(arg);
|
|
4248
|
+
}
|
|
4249
|
+
function ensureArray$1(thing) {
|
|
4250
|
+
if (isArray(thing))
|
|
4251
|
+
return thing;
|
|
4252
|
+
if (thing == null)
|
|
4253
|
+
return [];
|
|
4254
|
+
return [thing];
|
|
4255
|
+
}
|
|
4256
|
+
|
|
4257
|
+
const normalizePath = function normalizePath(filename) {
|
|
4258
|
+
return filename.split(win32.sep).join(posix.sep);
|
|
4259
|
+
};
|
|
4260
|
+
|
|
4261
|
+
function getMatcherString(id, resolutionBase) {
|
|
4262
|
+
if (resolutionBase === false || isAbsolute(id) || id.startsWith('**')) {
|
|
4263
|
+
return normalizePath(id);
|
|
4264
|
+
}
|
|
4265
|
+
// resolve('') is valid and will default to process.cwd()
|
|
4266
|
+
const basePath = normalizePath(resolve(resolutionBase || ''))
|
|
4267
|
+
// escape all possible (posix + win) path characters that might interfere with regex
|
|
4268
|
+
.replace(/[-^$*+?.()|[\]{}]/g, '\\$&');
|
|
4269
|
+
// Note that we use posix.join because:
|
|
4270
|
+
// 1. the basePath has been normalized to use /
|
|
4271
|
+
// 2. the incoming glob (id) matcher, also uses /
|
|
4272
|
+
// otherwise Node will force backslash (\) on windows
|
|
4273
|
+
return posix.join(basePath, normalizePath(id));
|
|
4274
|
+
}
|
|
4275
|
+
const createFilter = function createFilter(include, exclude, options) {
|
|
4276
|
+
const resolutionBase = options && options.resolve;
|
|
4277
|
+
const getMatcher = (id) => id instanceof RegExp
|
|
4278
|
+
? id
|
|
4279
|
+
: {
|
|
4280
|
+
test: (what) => {
|
|
4281
|
+
// this refactor is a tad overly verbose but makes for easy debugging
|
|
4282
|
+
const pattern = getMatcherString(id, resolutionBase);
|
|
4283
|
+
const fn = pm(pattern, { dot: true });
|
|
4284
|
+
const result = fn(what);
|
|
4285
|
+
return result;
|
|
4286
|
+
}
|
|
6576
4287
|
};
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
4288
|
+
const includeMatchers = ensureArray$1(include).map(getMatcher);
|
|
4289
|
+
const excludeMatchers = ensureArray$1(exclude).map(getMatcher);
|
|
4290
|
+
return function result(id) {
|
|
4291
|
+
if (typeof id !== 'string')
|
|
4292
|
+
return false;
|
|
4293
|
+
if (/\0/.test(id))
|
|
4294
|
+
return false;
|
|
4295
|
+
const pathId = normalizePath(id);
|
|
4296
|
+
for (let i = 0; i < excludeMatchers.length; ++i) {
|
|
4297
|
+
const matcher = excludeMatchers[i];
|
|
4298
|
+
if (matcher.test(pathId))
|
|
4299
|
+
return false;
|
|
4300
|
+
}
|
|
4301
|
+
for (let i = 0; i < includeMatchers.length; ++i) {
|
|
4302
|
+
const matcher = includeMatchers[i];
|
|
4303
|
+
if (matcher.test(pathId))
|
|
4304
|
+
return true;
|
|
4305
|
+
}
|
|
4306
|
+
return !includeMatchers.length;
|
|
4307
|
+
};
|
|
4308
|
+
};
|
|
4309
|
+
|
|
4310
|
+
const reservedWords = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public';
|
|
4311
|
+
const builtins = 'arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl';
|
|
4312
|
+
const forbiddenIdentifiers = new Set(`${reservedWords} ${builtins}`.split(' '));
|
|
4313
|
+
forbiddenIdentifiers.add('');
|
|
4314
|
+
|
|
4315
|
+
function createInclusionContext() {
|
|
4316
|
+
return {
|
|
4317
|
+
brokenFlow: false,
|
|
4318
|
+
hasBreak: false,
|
|
4319
|
+
hasContinue: false,
|
|
4320
|
+
includedCallArguments: new Set(),
|
|
4321
|
+
includedLabels: new Set()
|
|
4322
|
+
};
|
|
4323
|
+
}
|
|
4324
|
+
function createHasEffectsContext() {
|
|
4325
|
+
return {
|
|
4326
|
+
accessed: new PathTracker(),
|
|
4327
|
+
assigned: new PathTracker(),
|
|
4328
|
+
brokenFlow: false,
|
|
4329
|
+
called: new DiscriminatedPathTracker(),
|
|
4330
|
+
hasBreak: false,
|
|
4331
|
+
hasContinue: false,
|
|
4332
|
+
ignore: {
|
|
4333
|
+
breaks: false,
|
|
4334
|
+
continues: false,
|
|
4335
|
+
labels: new Set(),
|
|
4336
|
+
returnYield: false,
|
|
4337
|
+
this: false
|
|
4338
|
+
},
|
|
4339
|
+
includedLabels: new Set(),
|
|
4340
|
+
instantiated: new DiscriminatedPathTracker(),
|
|
4341
|
+
replacedVariableInits: new Map()
|
|
4342
|
+
};
|
|
4343
|
+
}
|
|
4344
|
+
|
|
4345
|
+
function assembleMemberDescriptions(memberDescriptions, inheritedDescriptions = null) {
|
|
4346
|
+
return Object.create(inheritedDescriptions, memberDescriptions);
|
|
4347
|
+
}
|
|
4348
|
+
const UNDEFINED_EXPRESSION = new (class UndefinedExpression extends ExpressionEntity {
|
|
4349
|
+
getLiteralValueAtPath() {
|
|
4350
|
+
return undefined;
|
|
4351
|
+
}
|
|
4352
|
+
})();
|
|
4353
|
+
const returnsUnknown = {
|
|
4354
|
+
value: {
|
|
4355
|
+
hasEffectsWhenCalled: null,
|
|
4356
|
+
returns: UNKNOWN_EXPRESSION
|
|
6586
4357
|
}
|
|
6587
|
-
];
|
|
6588
|
-
const convertNodeList = (position, buffer, readString) => {
|
|
6589
|
-
const length = buffer[position++];
|
|
6590
|
-
const list = [];
|
|
6591
|
-
for (let index = 0; index < length; index++) {
|
|
6592
|
-
const nodePosition = buffer[position++];
|
|
6593
|
-
list.push(nodePosition ? convertNode(nodePosition, buffer, readString) : null);
|
|
6594
|
-
}
|
|
6595
|
-
return list;
|
|
6596
4358
|
};
|
|
6597
|
-
const
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
4359
|
+
const UNKNOWN_LITERAL_BOOLEAN = new (class UnknownBoolean extends ExpressionEntity {
|
|
4360
|
+
getReturnExpressionWhenCalledAtPath(path) {
|
|
4361
|
+
if (path.length === 1) {
|
|
4362
|
+
return getMemberReturnExpressionWhenCalled(literalBooleanMembers, path[0]);
|
|
4363
|
+
}
|
|
4364
|
+
return UNKNOWN_RETURN_EXPRESSION;
|
|
4365
|
+
}
|
|
4366
|
+
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
4367
|
+
if (interaction.type === INTERACTION_ACCESSED) {
|
|
4368
|
+
return path.length > 1;
|
|
4369
|
+
}
|
|
4370
|
+
if (interaction.type === INTERACTION_CALLED && path.length === 1) {
|
|
4371
|
+
return hasMemberEffectWhenCalled(literalBooleanMembers, path[0], interaction, context);
|
|
4372
|
+
}
|
|
4373
|
+
return true;
|
|
4374
|
+
}
|
|
4375
|
+
})();
|
|
4376
|
+
const returnsBoolean = {
|
|
4377
|
+
value: {
|
|
4378
|
+
hasEffectsWhenCalled: null,
|
|
4379
|
+
returns: UNKNOWN_LITERAL_BOOLEAN
|
|
6602
4380
|
}
|
|
6603
|
-
return list;
|
|
6604
4381
|
};
|
|
6605
|
-
const
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
4382
|
+
const UNKNOWN_LITERAL_NUMBER = new (class UnknownNumber extends ExpressionEntity {
|
|
4383
|
+
getReturnExpressionWhenCalledAtPath(path) {
|
|
4384
|
+
if (path.length === 1) {
|
|
4385
|
+
return getMemberReturnExpressionWhenCalled(literalNumberMembers, path[0]);
|
|
4386
|
+
}
|
|
4387
|
+
return UNKNOWN_RETURN_EXPRESSION;
|
|
4388
|
+
}
|
|
4389
|
+
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
4390
|
+
if (interaction.type === INTERACTION_ACCESSED) {
|
|
4391
|
+
return path.length > 1;
|
|
4392
|
+
}
|
|
4393
|
+
if (interaction.type === INTERACTION_CALLED && path.length === 1) {
|
|
4394
|
+
return hasMemberEffectWhenCalled(literalNumberMembers, path[0], interaction, context);
|
|
4395
|
+
}
|
|
4396
|
+
return true;
|
|
4397
|
+
}
|
|
4398
|
+
})();
|
|
4399
|
+
const returnsNumber = {
|
|
4400
|
+
value: {
|
|
4401
|
+
hasEffectsWhenCalled: null,
|
|
4402
|
+
returns: UNKNOWN_LITERAL_NUMBER
|
|
4403
|
+
}
|
|
6610
4404
|
};
|
|
6611
|
-
const
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
4405
|
+
const UNKNOWN_LITERAL_STRING = new (class UnknownString extends ExpressionEntity {
|
|
4406
|
+
getReturnExpressionWhenCalledAtPath(path) {
|
|
4407
|
+
if (path.length === 1) {
|
|
4408
|
+
return getMemberReturnExpressionWhenCalled(literalStringMembers, path[0]);
|
|
4409
|
+
}
|
|
4410
|
+
return UNKNOWN_RETURN_EXPRESSION;
|
|
4411
|
+
}
|
|
4412
|
+
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
4413
|
+
if (interaction.type === INTERACTION_ACCESSED) {
|
|
4414
|
+
return path.length > 1;
|
|
4415
|
+
}
|
|
4416
|
+
if (interaction.type === INTERACTION_CALLED && path.length === 1) {
|
|
4417
|
+
return hasMemberEffectWhenCalled(literalStringMembers, path[0], interaction, context);
|
|
4418
|
+
}
|
|
4419
|
+
return true;
|
|
4420
|
+
}
|
|
4421
|
+
})();
|
|
4422
|
+
const returnsString = {
|
|
4423
|
+
value: {
|
|
4424
|
+
hasEffectsWhenCalled: null,
|
|
4425
|
+
returns: UNKNOWN_LITERAL_STRING
|
|
6617
4426
|
}
|
|
6618
|
-
return node;
|
|
6619
4427
|
};
|
|
6620
|
-
const
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
4428
|
+
const stringReplace = {
|
|
4429
|
+
value: {
|
|
4430
|
+
hasEffectsWhenCalled({ args }, context) {
|
|
4431
|
+
const argument1 = args[2];
|
|
4432
|
+
return (args.length < 3 ||
|
|
4433
|
+
(typeof argument1.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, {
|
|
4434
|
+
deoptimizeCache() { }
|
|
4435
|
+
}) === 'symbol' &&
|
|
4436
|
+
argument1.hasEffectsOnInteractionAtPath(EMPTY_PATH, NODE_INTERACTION_UNKNOWN_CALL, context)));
|
|
4437
|
+
},
|
|
4438
|
+
returns: UNKNOWN_LITERAL_STRING
|
|
4439
|
+
}
|
|
6624
4440
|
};
|
|
6625
|
-
const
|
|
6626
|
-
|
|
4441
|
+
const objectMembers = assembleMemberDescriptions({
|
|
4442
|
+
hasOwnProperty: returnsBoolean,
|
|
4443
|
+
isPrototypeOf: returnsBoolean,
|
|
4444
|
+
propertyIsEnumerable: returnsBoolean,
|
|
4445
|
+
toLocaleString: returnsString,
|
|
4446
|
+
toString: returnsString,
|
|
4447
|
+
valueOf: returnsUnknown
|
|
4448
|
+
});
|
|
4449
|
+
const literalBooleanMembers = assembleMemberDescriptions({
|
|
4450
|
+
valueOf: returnsBoolean
|
|
4451
|
+
}, objectMembers);
|
|
4452
|
+
const literalNumberMembers = assembleMemberDescriptions({
|
|
4453
|
+
toExponential: returnsString,
|
|
4454
|
+
toFixed: returnsString,
|
|
4455
|
+
toLocaleString: returnsString,
|
|
4456
|
+
toPrecision: returnsString,
|
|
4457
|
+
valueOf: returnsNumber
|
|
4458
|
+
}, objectMembers);
|
|
4459
|
+
/**
|
|
4460
|
+
* RegExp are stateful when they have the global or sticky flags set.
|
|
4461
|
+
* But if we actually don't use them, the side effect does not matter.
|
|
4462
|
+
* the check logic in `hasEffectsOnInteractionAtPath`.
|
|
4463
|
+
*/
|
|
4464
|
+
const literalRegExpMembers = assembleMemberDescriptions({
|
|
4465
|
+
exec: returnsUnknown,
|
|
4466
|
+
test: returnsBoolean
|
|
4467
|
+
}, objectMembers);
|
|
4468
|
+
const literalStringMembers = assembleMemberDescriptions({
|
|
4469
|
+
anchor: returnsString,
|
|
4470
|
+
at: returnsUnknown,
|
|
4471
|
+
big: returnsString,
|
|
4472
|
+
blink: returnsString,
|
|
4473
|
+
bold: returnsString,
|
|
4474
|
+
charAt: returnsString,
|
|
4475
|
+
charCodeAt: returnsNumber,
|
|
4476
|
+
codePointAt: returnsUnknown,
|
|
4477
|
+
concat: returnsString,
|
|
4478
|
+
endsWith: returnsBoolean,
|
|
4479
|
+
fixed: returnsString,
|
|
4480
|
+
fontcolor: returnsString,
|
|
4481
|
+
fontsize: returnsString,
|
|
4482
|
+
includes: returnsBoolean,
|
|
4483
|
+
indexOf: returnsNumber,
|
|
4484
|
+
italics: returnsString,
|
|
4485
|
+
lastIndexOf: returnsNumber,
|
|
4486
|
+
link: returnsString,
|
|
4487
|
+
localeCompare: returnsNumber,
|
|
4488
|
+
match: returnsUnknown,
|
|
4489
|
+
matchAll: returnsUnknown,
|
|
4490
|
+
normalize: returnsString,
|
|
4491
|
+
padEnd: returnsString,
|
|
4492
|
+
padStart: returnsString,
|
|
4493
|
+
repeat: returnsString,
|
|
4494
|
+
replace: stringReplace,
|
|
4495
|
+
replaceAll: stringReplace,
|
|
4496
|
+
search: returnsNumber,
|
|
4497
|
+
slice: returnsString,
|
|
4498
|
+
small: returnsString,
|
|
4499
|
+
split: returnsUnknown,
|
|
4500
|
+
startsWith: returnsBoolean,
|
|
4501
|
+
strike: returnsString,
|
|
4502
|
+
sub: returnsString,
|
|
4503
|
+
substr: returnsString,
|
|
4504
|
+
substring: returnsString,
|
|
4505
|
+
sup: returnsString,
|
|
4506
|
+
toLocaleLowerCase: returnsString,
|
|
4507
|
+
toLocaleUpperCase: returnsString,
|
|
4508
|
+
toLowerCase: returnsString,
|
|
4509
|
+
toString: returnsString,
|
|
4510
|
+
toUpperCase: returnsString,
|
|
4511
|
+
trim: returnsString,
|
|
4512
|
+
trimEnd: returnsString,
|
|
4513
|
+
trimLeft: returnsString,
|
|
4514
|
+
trimRight: returnsString,
|
|
4515
|
+
trimStart: returnsString,
|
|
4516
|
+
valueOf: returnsString
|
|
4517
|
+
}, objectMembers);
|
|
4518
|
+
function getLiteralMembersForValue(value) {
|
|
4519
|
+
if (value instanceof RegExp) {
|
|
4520
|
+
return literalRegExpMembers;
|
|
4521
|
+
}
|
|
4522
|
+
switch (typeof value) {
|
|
4523
|
+
case 'boolean': {
|
|
4524
|
+
return literalBooleanMembers;
|
|
4525
|
+
}
|
|
4526
|
+
case 'number': {
|
|
4527
|
+
return literalNumberMembers;
|
|
4528
|
+
}
|
|
4529
|
+
case 'string': {
|
|
4530
|
+
return literalStringMembers;
|
|
4531
|
+
}
|
|
4532
|
+
}
|
|
4533
|
+
return Object.create(null);
|
|
4534
|
+
}
|
|
4535
|
+
function hasMemberEffectWhenCalled(members, memberName, interaction, context) {
|
|
4536
|
+
if (typeof memberName !== 'string' || !members[memberName]) {
|
|
4537
|
+
return true;
|
|
4538
|
+
}
|
|
4539
|
+
return members[memberName].hasEffectsWhenCalled?.(interaction, context) || false;
|
|
4540
|
+
}
|
|
4541
|
+
function getMemberReturnExpressionWhenCalled(members, memberName) {
|
|
4542
|
+
if (typeof memberName !== 'string' || !members[memberName])
|
|
4543
|
+
return UNKNOWN_RETURN_EXPRESSION;
|
|
4544
|
+
return [members[memberName].returns, false];
|
|
4545
|
+
}
|
|
6627
4546
|
|
|
6628
4547
|
const keys = {
|
|
6629
4548
|
Literal: [],
|
|
@@ -12591,7 +10510,7 @@ class MetaProperty extends NodeBase {
|
|
|
12591
10510
|
const chunkId = preliminaryChunkId;
|
|
12592
10511
|
if (referenceId) {
|
|
12593
10512
|
const fileName = pluginDriver.getFileName(referenceId);
|
|
12594
|
-
const relativePath = normalize(relative
|
|
10513
|
+
const relativePath = normalize(relative(dirname(chunkId), fileName));
|
|
12595
10514
|
const replacement = pluginDriver.hookFirstSync('resolveFileUrl', [
|
|
12596
10515
|
{ chunkId, fileName, format, moduleId, referenceId, relativePath }
|
|
12597
10516
|
]) || relativeUrlMechanisms[format](relativePath);
|
|
@@ -15272,10 +13191,10 @@ class Module {
|
|
|
15272
13191
|
}
|
|
15273
13192
|
tryParse() {
|
|
15274
13193
|
try {
|
|
15275
|
-
return
|
|
13194
|
+
return parseAst(this.info.code);
|
|
15276
13195
|
}
|
|
15277
13196
|
catch (error_) {
|
|
15278
|
-
return this.error(
|
|
13197
|
+
return this.error(logModuleParseError(error_, this.id), error_.pos);
|
|
15279
13198
|
}
|
|
15280
13199
|
}
|
|
15281
13200
|
}
|
|
@@ -17208,10 +15127,10 @@ class Chunk {
|
|
|
17208
15127
|
const idWithoutExtension = NON_ASSET_EXTENSIONS.has(extensionName)
|
|
17209
15128
|
? sanitizedId.slice(0, -extensionName.length)
|
|
17210
15129
|
: sanitizedId;
|
|
17211
|
-
if (isAbsolute(idWithoutExtension)) {
|
|
17212
|
-
return preserveModulesRoot && resolve(idWithoutExtension).startsWith(preserveModulesRoot)
|
|
15130
|
+
if (isAbsolute$1(idWithoutExtension)) {
|
|
15131
|
+
return preserveModulesRoot && resolve$1(idWithoutExtension).startsWith(preserveModulesRoot)
|
|
17213
15132
|
? idWithoutExtension.slice(preserveModulesRoot.length).replace(/^[/\\]/, '')
|
|
17214
|
-
: relative(this.inputBase, idWithoutExtension);
|
|
15133
|
+
: relative$1(this.inputBase, idWithoutExtension);
|
|
17215
15134
|
}
|
|
17216
15135
|
else {
|
|
17217
15136
|
return `_virtual/${basename(idWithoutExtension)}`;
|
|
@@ -18442,7 +16361,7 @@ function getCollapsedSourcemap(id, originalCode, originalSourcemap, sourcemapCha
|
|
|
18442
16361
|
const sourcesContent = originalSourcemap.sourcesContent || [];
|
|
18443
16362
|
const directory = dirname(id) || '.';
|
|
18444
16363
|
const sourceRoot = originalSourcemap.sourceRoot || '.';
|
|
18445
|
-
const baseSources = sources.map((source, index) => new Source(resolve(directory, sourceRoot, source), sourcesContent[index]));
|
|
16364
|
+
const baseSources = sources.map((source, index) => new Source(resolve$1(directory, sourceRoot, source), sourcesContent[index]));
|
|
18446
16365
|
source = new Link(originalSourcemap, baseSources);
|
|
18447
16366
|
}
|
|
18448
16367
|
else {
|
|
@@ -18460,7 +16379,7 @@ function collapseSourcemaps(file, map, modules, bundleSourcemapChain, excludeCon
|
|
|
18460
16379
|
let { sources, sourcesContent, names, mappings } = source.traceMappings();
|
|
18461
16380
|
if (file) {
|
|
18462
16381
|
const directory = dirname(file);
|
|
18463
|
-
sources = sources.map((source) => relative
|
|
16382
|
+
sources = sources.map((source) => relative(directory, source));
|
|
18464
16383
|
file = basename(file);
|
|
18465
16384
|
}
|
|
18466
16385
|
sourcesContent = (excludeContent ? null : sourcesContent);
|
|
@@ -18552,11 +16471,11 @@ async function transformChunk(magicString, fileName, usedModules, chunkGraph, op
|
|
|
18552
16471
|
timeStart('sourcemaps', 3);
|
|
18553
16472
|
let resultingFile;
|
|
18554
16473
|
if (file)
|
|
18555
|
-
resultingFile = resolve(sourcemapFile || file);
|
|
16474
|
+
resultingFile = resolve$1(sourcemapFile || file);
|
|
18556
16475
|
else if (dir)
|
|
18557
|
-
resultingFile = resolve(dir, fileName);
|
|
16476
|
+
resultingFile = resolve$1(dir, fileName);
|
|
18558
16477
|
else
|
|
18559
|
-
resultingFile = resolve(fileName);
|
|
16478
|
+
resultingFile = resolve$1(fileName);
|
|
18560
16479
|
const decodedMap = magicString.generateDecodedMap({});
|
|
18561
16480
|
map = collapseSourcemaps(resultingFile, decodedMap, usedModules, sourcemapChain, sourcemapExcludeSources, log);
|
|
18562
16481
|
for (let sourcesIndex = 0; sourcesIndex < map.sources.length; ++sourcesIndex) {
|
|
@@ -18799,7 +16718,7 @@ class Bundle {
|
|
|
18799
16718
|
for (const file of Object.values(bundle)) {
|
|
18800
16719
|
if ('code' in file) {
|
|
18801
16720
|
try {
|
|
18802
|
-
|
|
16721
|
+
parseAst(file.code);
|
|
18803
16722
|
}
|
|
18804
16723
|
catch (error_) {
|
|
18805
16724
|
this.inputOptions.onLog(LOGLEVEL_WARN, logChunkInvalid(file, error_));
|
|
@@ -18862,7 +16781,7 @@ function getIncludedModules(modulesById) {
|
|
|
18862
16781
|
function getAbsoluteEntryModulePaths(includedModules, preserveModules) {
|
|
18863
16782
|
const absoluteEntryModulePaths = [];
|
|
18864
16783
|
for (const module of includedModules) {
|
|
18865
|
-
if ((module.info.isEntry || preserveModules) && isAbsolute(module.id)) {
|
|
16784
|
+
if ((module.info.isEntry || preserveModules) && isAbsolute$1(module.id)) {
|
|
18866
16785
|
absoluteEntryModulePaths.push(module.id);
|
|
18867
16786
|
}
|
|
18868
16787
|
}
|
|
@@ -18970,13 +16889,13 @@ async function resolveId(source, importer, preserveSymlinks, pluginDriver, modul
|
|
|
18970
16889
|
}
|
|
18971
16890
|
// external modules (non-entry modules that start with neither '.' or '/')
|
|
18972
16891
|
// are skipped at this stage.
|
|
18973
|
-
if (importer !== undefined && !isAbsolute(source) && source[0] !== '.')
|
|
16892
|
+
if (importer !== undefined && !isAbsolute$1(source) && source[0] !== '.')
|
|
18974
16893
|
return null;
|
|
18975
16894
|
// `resolve` processes paths from right to left, prepending them until an
|
|
18976
16895
|
// absolute path is created. Absolute importees therefore shortcircuit the
|
|
18977
16896
|
// resolve call and require no special handing on our part.
|
|
18978
16897
|
// See https://nodejs.org/api/path.html#path_path_resolve_paths
|
|
18979
|
-
return addJsExtensionIfNecessary(importer ? resolve(dirname(importer), source) : resolve(source), preserveSymlinks);
|
|
16898
|
+
return addJsExtensionIfNecessary(importer ? resolve$1(dirname(importer), source) : resolve$1(source), preserveSymlinks);
|
|
18980
16899
|
}
|
|
18981
16900
|
async function addJsExtensionIfNecessary(file, preserveSymlinks) {
|
|
18982
16901
|
return ((await findFile(file, preserveSymlinks)) ??
|
|
@@ -19582,7 +17501,7 @@ class ModuleLoader {
|
|
|
19582
17501
|
const { attributes, external, id, moduleSideEffects, meta } = resolvedId;
|
|
19583
17502
|
let externalModule = this.modulesById.get(id);
|
|
19584
17503
|
if (!externalModule) {
|
|
19585
|
-
externalModule = new ExternalModule(this.options, id, moduleSideEffects, meta, external !== 'absolute' && isAbsolute(id), attributes);
|
|
17504
|
+
externalModule = new ExternalModule(this.options, id, moduleSideEffects, meta, external !== 'absolute' && isAbsolute$1(id), attributes);
|
|
19586
17505
|
this.modulesById.set(id, externalModule);
|
|
19587
17506
|
}
|
|
19588
17507
|
else if (!(externalModule instanceof ExternalModule)) {
|
|
@@ -19617,7 +17536,7 @@ class ModuleLoader {
|
|
|
19617
17536
|
...resolveIdResult,
|
|
19618
17537
|
external: external &&
|
|
19619
17538
|
(external === 'relative' ||
|
|
19620
|
-
!isAbsolute(resolveIdResult.id) ||
|
|
17539
|
+
!isAbsolute$1(resolveIdResult.id) ||
|
|
19621
17540
|
(external === true &&
|
|
19622
17541
|
isNotAbsoluteExternal(resolveIdResult.id, source, makeAbsoluteExternalsRelative)) ||
|
|
19623
17542
|
'absolute')
|
|
@@ -19767,8 +17686,8 @@ class ModuleLoader {
|
|
|
19767
17686
|
function normalizeRelativeExternalId(source, importer) {
|
|
19768
17687
|
return isRelative(source)
|
|
19769
17688
|
? importer
|
|
19770
|
-
? resolve(importer, '..', source)
|
|
19771
|
-
: resolve(source)
|
|
17689
|
+
? resolve$1(importer, '..', source)
|
|
17690
|
+
: resolve$1(source)
|
|
19772
17691
|
: source;
|
|
19773
17692
|
}
|
|
19774
17693
|
function addChunkNamesToModule(module, { fileName, name }, isUserDefined, priority) {
|
|
@@ -19786,7 +17705,7 @@ function addChunkNamesToModule(module, { fileName, name }, isUserDefined, priori
|
|
|
19786
17705
|
function isNotAbsoluteExternal(id, source, makeAbsoluteExternalsRelative) {
|
|
19787
17706
|
return (makeAbsoluteExternalsRelative === true ||
|
|
19788
17707
|
(makeAbsoluteExternalsRelative === 'ifRelativeSource' && isRelative(source)) ||
|
|
19789
|
-
!isAbsolute(id));
|
|
17708
|
+
!isAbsolute$1(id));
|
|
19790
17709
|
}
|
|
19791
17710
|
async function waitForDependencyResolution(loadPromise) {
|
|
19792
17711
|
const [resolveStaticDependencyPromises, resolveDynamicImportPromises] = await loadPromise;
|
|
@@ -20201,7 +18120,7 @@ function getPluginContext(plugin, pluginCache, graph, options, fileEmitter, exis
|
|
|
20201
18120
|
rollupVersion: version,
|
|
20202
18121
|
watchMode: graph.watchMode
|
|
20203
18122
|
},
|
|
20204
|
-
parse:
|
|
18123
|
+
parse: parseAst,
|
|
20205
18124
|
resolve(source, importer, { attributes, custom, isEntry, skipSelf } = BLANK) {
|
|
20206
18125
|
skipSelf ??= true;
|
|
20207
18126
|
return graph.moduleLoader.resolveId(source, importer, custom, isEntry, attributes || EMPTY_OBJECT, skipSelf ? [{ importer, plugin, source }] : null);
|
|
@@ -20493,20 +18412,6 @@ class Queue {
|
|
|
20493
18412
|
}
|
|
20494
18413
|
}
|
|
20495
18414
|
|
|
20496
|
-
function getReadStringFunction(astBuffer) {
|
|
20497
|
-
if (typeof Buffer !== 'undefined' && astBuffer instanceof Buffer) {
|
|
20498
|
-
return function readString(start, length) {
|
|
20499
|
-
return astBuffer.toString('utf8', start, start + length);
|
|
20500
|
-
};
|
|
20501
|
-
}
|
|
20502
|
-
else {
|
|
20503
|
-
const textDecoder = new TextDecoder();
|
|
20504
|
-
return function readString(start, length) {
|
|
20505
|
-
return textDecoder.decode(astBuffer.subarray(start, start + length));
|
|
20506
|
-
};
|
|
20507
|
-
}
|
|
20508
|
-
}
|
|
20509
|
-
|
|
20510
18415
|
function normalizeEntryModules(entryModules) {
|
|
20511
18416
|
if (Array.isArray(entryModules)) {
|
|
20512
18417
|
return entryModules.map(id => ({
|
|
@@ -20585,11 +18490,6 @@ class Graph {
|
|
|
20585
18490
|
timeEnd('mark included statements', 2);
|
|
20586
18491
|
this.phase = BuildPhase.GENERATE;
|
|
20587
18492
|
}
|
|
20588
|
-
contextParse(code, { allowReturnOutsideFunction = false } = {}) {
|
|
20589
|
-
const astBuffer = parse$2(code, allowReturnOutsideFunction);
|
|
20590
|
-
const readString = getReadStringFunction(astBuffer);
|
|
20591
|
-
return convertProgram(astBuffer.buffer, readString);
|
|
20592
|
-
}
|
|
20593
18493
|
getCache() {
|
|
20594
18494
|
// handle plugin cache eviction
|
|
20595
18495
|
for (const name in this.pluginCache) {
|
|
@@ -20871,7 +18771,7 @@ const getModuleContext = (config, context) => {
|
|
|
20871
18771
|
if (configModuleContext) {
|
|
20872
18772
|
const contextByModuleId = Object.create(null);
|
|
20873
18773
|
for (const [key, moduleContext] of Object.entries(configModuleContext)) {
|
|
20874
|
-
contextByModuleId[resolve(key)] = moduleContext;
|
|
18774
|
+
contextByModuleId[resolve$1(key)] = moduleContext;
|
|
20875
18775
|
}
|
|
20876
18776
|
return id => contextByModuleId[id] ?? context;
|
|
20877
18777
|
}
|
|
@@ -21060,7 +18960,7 @@ const getPreserveModulesRoot = (config) => {
|
|
|
21060
18960
|
if (preserveModulesRoot === null || preserveModulesRoot === undefined) {
|
|
21061
18961
|
return undefined;
|
|
21062
18962
|
}
|
|
21063
|
-
return resolve(preserveModulesRoot);
|
|
18963
|
+
return resolve$1(preserveModulesRoot);
|
|
21064
18964
|
};
|
|
21065
18965
|
const getAmd = (config) => {
|
|
21066
18966
|
const mergedOption = {
|
|
@@ -21358,7 +19258,7 @@ function getSortingFileType(file) {
|
|
|
21358
19258
|
return SortingFileType.SECONDARY_CHUNK;
|
|
21359
19259
|
}
|
|
21360
19260
|
async function writeOutputFile(outputFile, outputOptions) {
|
|
21361
|
-
const fileName = resolve(outputOptions.dir || dirname(outputOptions.file), outputFile.fileName);
|
|
19261
|
+
const fileName = resolve$1(outputOptions.dir || dirname(outputOptions.file), outputFile.fileName);
|
|
21362
19262
|
// 'recursive: true' does not throw if the folder structure, or parts of it, already exist
|
|
21363
19263
|
await mkdir(dirname(fileName), { recursive: true });
|
|
21364
19264
|
return writeFile(fileName, outputFile.type === 'asset' ? outputFile.source : outputFile.code);
|