rollup 3.25.1 → 3.25.3
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/LICENSE.md +1 -1
- package/dist/bin/rollup +2 -2
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/node-entry.js +595 -182
- package/dist/es/shared/watch.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/rollup.d.ts +1 -1
- package/dist/rollup.js +2 -2
- package/dist/shared/fsevents-importer.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/rollup.js +595 -182
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch-proxy.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/package.json +22 -19
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v3.25.
|
|
4
|
-
Mon,
|
|
3
|
+
Rollup.js v3.25.3
|
|
4
|
+
Mon, 26 Jun 2023 20:07:14 GMT - commit 83d21a4eacbc9f207bb084df78365a456cdb1973
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -15,7 +15,7 @@ import { createHash as createHash$1 } from 'node:crypto';
|
|
|
15
15
|
import { lstat, realpath, readdir, readFile, mkdir, writeFile } from 'node:fs/promises';
|
|
16
16
|
import * as tty from 'tty';
|
|
17
17
|
|
|
18
|
-
var version$1 = "3.25.
|
|
18
|
+
var version$1 = "3.25.3";
|
|
19
19
|
|
|
20
20
|
const comma = ','.charCodeAt(0);
|
|
21
21
|
const semicolon = ';'.charCodeAt(0);
|
|
@@ -2054,45 +2054,77 @@ const logLevelPriority = {
|
|
|
2054
2054
|
[LOGLEVEL_WARN]: 2
|
|
2055
2055
|
};
|
|
2056
2056
|
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
var range = { start: start, end: end, line: i };
|
|
2066
|
-
start = end;
|
|
2067
|
-
return range;
|
|
2068
|
-
});
|
|
2069
|
-
var i = 0;
|
|
2070
|
-
function rangeContains(range, index) {
|
|
2071
|
-
return range.start <= index && index < range.end;
|
|
2072
|
-
}
|
|
2073
|
-
function getLocation(range, index) {
|
|
2074
|
-
return { line: offsetLine + range.line, column: offsetColumn + index - range.start, character: index };
|
|
2075
|
-
}
|
|
2076
|
-
function locate(search, startIndex) {
|
|
2077
|
-
if (typeof search === 'string') {
|
|
2078
|
-
search = source.indexOf(search, startIndex || 0);
|
|
2079
|
-
}
|
|
2080
|
-
var range = lineRanges[i];
|
|
2081
|
-
var d = search >= range.end ? 1 : -1;
|
|
2082
|
-
while (range) {
|
|
2083
|
-
if (rangeContains(range, search))
|
|
2084
|
-
return getLocation(range, search);
|
|
2085
|
-
i += d;
|
|
2086
|
-
range = lineRanges[i];
|
|
2087
|
-
}
|
|
2088
|
-
}
|
|
2089
|
-
return locate;
|
|
2057
|
+
/** @typedef {import('./types').Location} Location */
|
|
2058
|
+
|
|
2059
|
+
/**
|
|
2060
|
+
* @param {import('./types').Range} range
|
|
2061
|
+
* @param {number} index
|
|
2062
|
+
*/
|
|
2063
|
+
function rangeContains(range, index) {
|
|
2064
|
+
return range.start <= index && index < range.end;
|
|
2090
2065
|
}
|
|
2066
|
+
|
|
2067
|
+
/**
|
|
2068
|
+
* @param {string} source
|
|
2069
|
+
* @param {import('./types').Options} [options]
|
|
2070
|
+
*/
|
|
2071
|
+
function getLocator(source, options = {}) {
|
|
2072
|
+
const { offsetLine = 0, offsetColumn = 0 } = options;
|
|
2073
|
+
|
|
2074
|
+
let start = 0;
|
|
2075
|
+
const ranges = source.split('\n').map((line, i) => {
|
|
2076
|
+
const end = start + line.length + 1;
|
|
2077
|
+
|
|
2078
|
+
/** @type {import('./types').Range} */
|
|
2079
|
+
const range = { start, end, line: i };
|
|
2080
|
+
|
|
2081
|
+
start = end;
|
|
2082
|
+
return range;
|
|
2083
|
+
});
|
|
2084
|
+
|
|
2085
|
+
let i = 0;
|
|
2086
|
+
|
|
2087
|
+
/**
|
|
2088
|
+
* @param {string | number} search
|
|
2089
|
+
* @param {number} [index]
|
|
2090
|
+
* @returns {Location | undefined}
|
|
2091
|
+
*/
|
|
2092
|
+
function locator(search, index) {
|
|
2093
|
+
if (typeof search === 'string') {
|
|
2094
|
+
search = source.indexOf(search, index ?? 0);
|
|
2095
|
+
}
|
|
2096
|
+
|
|
2097
|
+
if (search === -1) return undefined;
|
|
2098
|
+
|
|
2099
|
+
let range = ranges[i];
|
|
2100
|
+
|
|
2101
|
+
const d = search >= range.end ? 1 : -1;
|
|
2102
|
+
|
|
2103
|
+
while (range) {
|
|
2104
|
+
if (rangeContains(range, search)) {
|
|
2105
|
+
return {
|
|
2106
|
+
line: offsetLine + range.line,
|
|
2107
|
+
column: offsetColumn + search - range.start,
|
|
2108
|
+
character: search
|
|
2109
|
+
};
|
|
2110
|
+
}
|
|
2111
|
+
|
|
2112
|
+
i += d;
|
|
2113
|
+
range = ranges[i];
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2116
|
+
|
|
2117
|
+
return locator;
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
/**
|
|
2121
|
+
* @param {string} source
|
|
2122
|
+
* @param {string | number} search
|
|
2123
|
+
* @param {import('./types').Options} [options]
|
|
2124
|
+
* @returns {Location | undefined}
|
|
2125
|
+
*/
|
|
2091
2126
|
function locate(source, search, options) {
|
|
2092
|
-
|
|
2093
|
-
throw new Error('locate takes a { startIndex, offsetLine, offsetColumn } object as the third argument');
|
|
2094
|
-
}
|
|
2095
|
-
return getLocator(source, options)(search, options && options.startIndex);
|
|
2127
|
+
return getLocator(source, options)(search, options && options.startIndex);
|
|
2096
2128
|
}
|
|
2097
2129
|
|
|
2098
2130
|
function spaces(index) {
|
|
@@ -2630,8 +2662,11 @@ function logParseError(error, moduleId) {
|
|
|
2630
2662
|
};
|
|
2631
2663
|
}
|
|
2632
2664
|
function logPluginError(error, plugin, { hook, id } = {}) {
|
|
2633
|
-
|
|
2634
|
-
|
|
2665
|
+
const code = error.code;
|
|
2666
|
+
if (!error.pluginCode &&
|
|
2667
|
+
code != null &&
|
|
2668
|
+
(typeof code !== 'string' || (typeof code === 'string' && !code.startsWith('PLUGIN_')))) {
|
|
2669
|
+
error.pluginCode = code;
|
|
2635
2670
|
}
|
|
2636
2671
|
error.code = PLUGIN_ERROR;
|
|
2637
2672
|
error.plugin = plugin;
|
|
@@ -13581,7 +13616,7 @@ class Module {
|
|
|
13581
13616
|
this.implicitlyLoadedAfter.size > 0) {
|
|
13582
13617
|
for (const exportName of [...this.getReexports(), ...this.getExports()]) {
|
|
13583
13618
|
const [exportedVariable] = this.getVariableForExportName(exportName);
|
|
13584
|
-
if (exportedVariable) {
|
|
13619
|
+
if (exportedVariable?.included) {
|
|
13585
13620
|
dependencyVariables.add(exportedVariable);
|
|
13586
13621
|
}
|
|
13587
13622
|
}
|
|
@@ -16435,7 +16470,9 @@ class Chunk {
|
|
|
16435
16470
|
if (!this.outputOptions.preserveModules && this.includedNamespaces.has(module)) {
|
|
16436
16471
|
const memberVariables = module.namespace.getMemberVariables();
|
|
16437
16472
|
for (const variable of Object.values(memberVariables)) {
|
|
16438
|
-
|
|
16473
|
+
if (variable.included) {
|
|
16474
|
+
moduleImports.add(variable);
|
|
16475
|
+
}
|
|
16439
16476
|
}
|
|
16440
16477
|
}
|
|
16441
16478
|
for (let variable of moduleImports) {
|
|
@@ -17823,6 +17860,9 @@ var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\
|
|
|
17823
17860
|
var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u052f\u0531-\u0556\u0559\u0560-\u0588\u05d0-\u05ea\u05ef-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u09fc\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0af9\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c39\u0c3d\u0c58-\u0c5a\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f5\u13f8-\u13fd\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f8\u1700-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c88\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2118-\u211d\u2124\u2126\u2128\u212a-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309b-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7ca\ua7d0\ua7d1\ua7d3\ua7d5-\ua7d9\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\ua9e0-\ua9e4\ua9e6-\ua9ef\ua9fa-\ua9fe\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa7e-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uab30-\uab5a\uab5c-\uab69\uab70-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc";
|
|
17824
17861
|
|
|
17825
17862
|
// These are a run-length and offset encoded representation of the
|
|
17863
|
+
// >0xffff code points that are a valid part of identifiers. The
|
|
17864
|
+
// offset starts at 0x10000, and each pair of numbers represents an
|
|
17865
|
+
// offset to the next range, and then a size of the range.
|
|
17826
17866
|
|
|
17827
17867
|
// Reserved word lists for various dialects of the language
|
|
17828
17868
|
|
|
@@ -18941,6 +18981,16 @@ pp$8.parseThrowStatement = function(node) {
|
|
|
18941
18981
|
|
|
18942
18982
|
var empty$1 = [];
|
|
18943
18983
|
|
|
18984
|
+
pp$8.parseCatchClauseParam = function() {
|
|
18985
|
+
var param = this.parseBindingAtom();
|
|
18986
|
+
var simple = param.type === "Identifier";
|
|
18987
|
+
this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
|
|
18988
|
+
this.checkLValPattern(param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
|
|
18989
|
+
this.expect(types$1.parenR);
|
|
18990
|
+
|
|
18991
|
+
return param
|
|
18992
|
+
};
|
|
18993
|
+
|
|
18944
18994
|
pp$8.parseTryStatement = function(node) {
|
|
18945
18995
|
this.next();
|
|
18946
18996
|
node.block = this.parseBlock();
|
|
@@ -18949,11 +18999,7 @@ pp$8.parseTryStatement = function(node) {
|
|
|
18949
18999
|
var clause = this.startNode();
|
|
18950
19000
|
this.next();
|
|
18951
19001
|
if (this.eat(types$1.parenL)) {
|
|
18952
|
-
clause.param = this.
|
|
18953
|
-
var simple = clause.param.type === "Identifier";
|
|
18954
|
-
this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
|
|
18955
|
-
this.checkLValPattern(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
|
|
18956
|
-
this.expect(types$1.parenR);
|
|
19002
|
+
clause.param = this.parseCatchClauseParam();
|
|
18957
19003
|
} else {
|
|
18958
19004
|
if (this.options.ecmaVersion < 10) { this.unexpected(); }
|
|
18959
19005
|
clause.param = null;
|
|
@@ -18969,9 +19015,9 @@ pp$8.parseTryStatement = function(node) {
|
|
|
18969
19015
|
return this.finishNode(node, "TryStatement")
|
|
18970
19016
|
};
|
|
18971
19017
|
|
|
18972
|
-
pp$8.parseVarStatement = function(node, kind) {
|
|
19018
|
+
pp$8.parseVarStatement = function(node, kind, allowMissingInitializer) {
|
|
18973
19019
|
this.next();
|
|
18974
|
-
this.parseVar(node, false, kind);
|
|
19020
|
+
this.parseVar(node, false, kind, allowMissingInitializer);
|
|
18975
19021
|
this.semicolon();
|
|
18976
19022
|
return this.finishNode(node, "VariableDeclaration")
|
|
18977
19023
|
};
|
|
@@ -19100,7 +19146,7 @@ pp$8.parseForIn = function(node, init) {
|
|
|
19100
19146
|
|
|
19101
19147
|
// Parse a list of variable declarations.
|
|
19102
19148
|
|
|
19103
|
-
pp$8.parseVar = function(node, isFor, kind) {
|
|
19149
|
+
pp$8.parseVar = function(node, isFor, kind, allowMissingInitializer) {
|
|
19104
19150
|
node.declarations = [];
|
|
19105
19151
|
node.kind = kind;
|
|
19106
19152
|
for (;;) {
|
|
@@ -19108,9 +19154,9 @@ pp$8.parseVar = function(node, isFor, kind) {
|
|
|
19108
19154
|
this.parseVarId(decl, kind);
|
|
19109
19155
|
if (this.eat(types$1.eq)) {
|
|
19110
19156
|
decl.init = this.parseMaybeAssign(isFor);
|
|
19111
|
-
} else if (kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
|
|
19157
|
+
} else if (!allowMissingInitializer && kind === "const" && !(this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of")))) {
|
|
19112
19158
|
this.unexpected();
|
|
19113
|
-
} else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
|
|
19159
|
+
} else if (!allowMissingInitializer && decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) {
|
|
19114
19160
|
this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value");
|
|
19115
19161
|
} else {
|
|
19116
19162
|
decl.init = null;
|
|
@@ -19199,7 +19245,7 @@ pp$8.parseClass = function(node, isStatement) {
|
|
|
19199
19245
|
if (element) {
|
|
19200
19246
|
classBody.body.push(element);
|
|
19201
19247
|
if (element.type === "MethodDefinition" && element.kind === "constructor") {
|
|
19202
|
-
if (hadConstructor) { this.
|
|
19248
|
+
if (hadConstructor) { this.raiseRecoverable(element.start, "Duplicate constructor in the same class"); }
|
|
19203
19249
|
hadConstructor = true;
|
|
19204
19250
|
} else if (element.key && element.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element)) {
|
|
19205
19251
|
this.raiseRecoverable(element.key.start, ("Identifier '#" + (element.key.name) + "' has already been declared"));
|
|
@@ -19448,44 +19494,36 @@ function checkKeyName(node, name) {
|
|
|
19448
19494
|
|
|
19449
19495
|
// Parses module export declaration.
|
|
19450
19496
|
|
|
19497
|
+
pp$8.parseExportAllDeclaration = function(node, exports) {
|
|
19498
|
+
if (this.options.ecmaVersion >= 11) {
|
|
19499
|
+
if (this.eatContextual("as")) {
|
|
19500
|
+
node.exported = this.parseModuleExportName();
|
|
19501
|
+
this.checkExport(exports, node.exported, this.lastTokStart);
|
|
19502
|
+
} else {
|
|
19503
|
+
node.exported = null;
|
|
19504
|
+
}
|
|
19505
|
+
}
|
|
19506
|
+
this.expectContextual("from");
|
|
19507
|
+
if (this.type !== types$1.string) { this.unexpected(); }
|
|
19508
|
+
node.source = this.parseExprAtom();
|
|
19509
|
+
this.semicolon();
|
|
19510
|
+
return this.finishNode(node, "ExportAllDeclaration")
|
|
19511
|
+
};
|
|
19512
|
+
|
|
19451
19513
|
pp$8.parseExport = function(node, exports) {
|
|
19452
19514
|
this.next();
|
|
19453
19515
|
// export * from '...'
|
|
19454
19516
|
if (this.eat(types$1.star)) {
|
|
19455
|
-
|
|
19456
|
-
if (this.eatContextual("as")) {
|
|
19457
|
-
node.exported = this.parseModuleExportName();
|
|
19458
|
-
this.checkExport(exports, node.exported, this.lastTokStart);
|
|
19459
|
-
} else {
|
|
19460
|
-
node.exported = null;
|
|
19461
|
-
}
|
|
19462
|
-
}
|
|
19463
|
-
this.expectContextual("from");
|
|
19464
|
-
if (this.type !== types$1.string) { this.unexpected(); }
|
|
19465
|
-
node.source = this.parseExprAtom();
|
|
19466
|
-
this.semicolon();
|
|
19467
|
-
return this.finishNode(node, "ExportAllDeclaration")
|
|
19517
|
+
return this.parseExportAllDeclaration(node, exports)
|
|
19468
19518
|
}
|
|
19469
19519
|
if (this.eat(types$1._default)) { // export default ...
|
|
19470
19520
|
this.checkExport(exports, "default", this.lastTokStart);
|
|
19471
|
-
|
|
19472
|
-
if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
|
|
19473
|
-
var fNode = this.startNode();
|
|
19474
|
-
this.next();
|
|
19475
|
-
if (isAsync) { this.next(); }
|
|
19476
|
-
node.declaration = this.parseFunction(fNode, FUNC_STATEMENT$1 | FUNC_NULLABLE_ID$1, false, isAsync);
|
|
19477
|
-
} else if (this.type === types$1._class) {
|
|
19478
|
-
var cNode = this.startNode();
|
|
19479
|
-
node.declaration = this.parseClass(cNode, "nullableID");
|
|
19480
|
-
} else {
|
|
19481
|
-
node.declaration = this.parseMaybeAssign();
|
|
19482
|
-
this.semicolon();
|
|
19483
|
-
}
|
|
19521
|
+
node.declaration = this.parseExportDefaultDeclaration();
|
|
19484
19522
|
return this.finishNode(node, "ExportDefaultDeclaration")
|
|
19485
19523
|
}
|
|
19486
19524
|
// export var|const|let|function|class ...
|
|
19487
19525
|
if (this.shouldParseExportStatement()) {
|
|
19488
|
-
node.declaration = this.
|
|
19526
|
+
node.declaration = this.parseExportDeclaration(node);
|
|
19489
19527
|
if (node.declaration.type === "VariableDeclaration")
|
|
19490
19528
|
{ this.checkVariableExport(exports, node.declaration.declarations); }
|
|
19491
19529
|
else
|
|
@@ -19519,6 +19557,27 @@ pp$8.parseExport = function(node, exports) {
|
|
|
19519
19557
|
return this.finishNode(node, "ExportNamedDeclaration")
|
|
19520
19558
|
};
|
|
19521
19559
|
|
|
19560
|
+
pp$8.parseExportDeclaration = function(node) {
|
|
19561
|
+
return this.parseStatement(null)
|
|
19562
|
+
};
|
|
19563
|
+
|
|
19564
|
+
pp$8.parseExportDefaultDeclaration = function() {
|
|
19565
|
+
var isAsync;
|
|
19566
|
+
if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
|
|
19567
|
+
var fNode = this.startNode();
|
|
19568
|
+
this.next();
|
|
19569
|
+
if (isAsync) { this.next(); }
|
|
19570
|
+
return this.parseFunction(fNode, FUNC_STATEMENT$1 | FUNC_NULLABLE_ID$1, false, isAsync)
|
|
19571
|
+
} else if (this.type === types$1._class) {
|
|
19572
|
+
var cNode = this.startNode();
|
|
19573
|
+
return this.parseClass(cNode, "nullableID")
|
|
19574
|
+
} else {
|
|
19575
|
+
var declaration = this.parseMaybeAssign();
|
|
19576
|
+
this.semicolon();
|
|
19577
|
+
return declaration
|
|
19578
|
+
}
|
|
19579
|
+
};
|
|
19580
|
+
|
|
19522
19581
|
pp$8.checkExport = function(exports, name, pos) {
|
|
19523
19582
|
if (!exports) { return }
|
|
19524
19583
|
if (typeof name !== "string")
|
|
@@ -19576,6 +19635,20 @@ pp$8.shouldParseExportStatement = function() {
|
|
|
19576
19635
|
|
|
19577
19636
|
// Parses a comma-separated list of module exports.
|
|
19578
19637
|
|
|
19638
|
+
pp$8.parseExportSpecifier = function(exports) {
|
|
19639
|
+
var node = this.startNode();
|
|
19640
|
+
node.local = this.parseModuleExportName();
|
|
19641
|
+
|
|
19642
|
+
node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
|
|
19643
|
+
this.checkExport(
|
|
19644
|
+
exports,
|
|
19645
|
+
node.exported,
|
|
19646
|
+
node.exported.start
|
|
19647
|
+
);
|
|
19648
|
+
|
|
19649
|
+
return this.finishNode(node, "ExportSpecifier")
|
|
19650
|
+
};
|
|
19651
|
+
|
|
19579
19652
|
pp$8.parseExportSpecifiers = function(exports) {
|
|
19580
19653
|
var nodes = [], first = true;
|
|
19581
19654
|
// export { x, y as z } [from '...']
|
|
@@ -19586,15 +19659,7 @@ pp$8.parseExportSpecifiers = function(exports) {
|
|
|
19586
19659
|
if (this.afterTrailingComma(types$1.braceR)) { break }
|
|
19587
19660
|
} else { first = false; }
|
|
19588
19661
|
|
|
19589
|
-
|
|
19590
|
-
node.local = this.parseModuleExportName();
|
|
19591
|
-
node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
|
|
19592
|
-
this.checkExport(
|
|
19593
|
-
exports,
|
|
19594
|
-
node.exported,
|
|
19595
|
-
node.exported.start
|
|
19596
|
-
);
|
|
19597
|
-
nodes.push(this.finishNode(node, "ExportSpecifier"));
|
|
19662
|
+
nodes.push(this.parseExportSpecifier(exports));
|
|
19598
19663
|
}
|
|
19599
19664
|
return nodes
|
|
19600
19665
|
};
|
|
@@ -19603,6 +19668,7 @@ pp$8.parseExportSpecifiers = function(exports) {
|
|
|
19603
19668
|
|
|
19604
19669
|
pp$8.parseImport = function(node) {
|
|
19605
19670
|
this.next();
|
|
19671
|
+
|
|
19606
19672
|
// import '...'
|
|
19607
19673
|
if (this.type === types$1.string) {
|
|
19608
19674
|
node.specifiers = empty$1;
|
|
@@ -19618,23 +19684,46 @@ pp$8.parseImport = function(node) {
|
|
|
19618
19684
|
|
|
19619
19685
|
// Parses a comma-separated list of module imports.
|
|
19620
19686
|
|
|
19687
|
+
pp$8.parseImportSpecifier = function() {
|
|
19688
|
+
var node = this.startNode();
|
|
19689
|
+
node.imported = this.parseModuleExportName();
|
|
19690
|
+
|
|
19691
|
+
if (this.eatContextual("as")) {
|
|
19692
|
+
node.local = this.parseIdent();
|
|
19693
|
+
} else {
|
|
19694
|
+
this.checkUnreserved(node.imported);
|
|
19695
|
+
node.local = node.imported;
|
|
19696
|
+
}
|
|
19697
|
+
this.checkLValSimple(node.local, BIND_LEXICAL);
|
|
19698
|
+
|
|
19699
|
+
return this.finishNode(node, "ImportSpecifier")
|
|
19700
|
+
};
|
|
19701
|
+
|
|
19702
|
+
pp$8.parseImportDefaultSpecifier = function() {
|
|
19703
|
+
// import defaultObj, { x, y as z } from '...'
|
|
19704
|
+
var node = this.startNode();
|
|
19705
|
+
node.local = this.parseIdent();
|
|
19706
|
+
this.checkLValSimple(node.local, BIND_LEXICAL);
|
|
19707
|
+
return this.finishNode(node, "ImportDefaultSpecifier")
|
|
19708
|
+
};
|
|
19709
|
+
|
|
19710
|
+
pp$8.parseImportNamespaceSpecifier = function() {
|
|
19711
|
+
var node = this.startNode();
|
|
19712
|
+
this.next();
|
|
19713
|
+
this.expectContextual("as");
|
|
19714
|
+
node.local = this.parseIdent();
|
|
19715
|
+
this.checkLValSimple(node.local, BIND_LEXICAL);
|
|
19716
|
+
return this.finishNode(node, "ImportNamespaceSpecifier")
|
|
19717
|
+
};
|
|
19718
|
+
|
|
19621
19719
|
pp$8.parseImportSpecifiers = function() {
|
|
19622
19720
|
var nodes = [], first = true;
|
|
19623
19721
|
if (this.type === types$1.name) {
|
|
19624
|
-
|
|
19625
|
-
var node = this.startNode();
|
|
19626
|
-
node.local = this.parseIdent();
|
|
19627
|
-
this.checkLValSimple(node.local, BIND_LEXICAL);
|
|
19628
|
-
nodes.push(this.finishNode(node, "ImportDefaultSpecifier"));
|
|
19722
|
+
nodes.push(this.parseImportDefaultSpecifier());
|
|
19629
19723
|
if (!this.eat(types$1.comma)) { return nodes }
|
|
19630
19724
|
}
|
|
19631
19725
|
if (this.type === types$1.star) {
|
|
19632
|
-
|
|
19633
|
-
this.next();
|
|
19634
|
-
this.expectContextual("as");
|
|
19635
|
-
node$1.local = this.parseIdent();
|
|
19636
|
-
this.checkLValSimple(node$1.local, BIND_LEXICAL);
|
|
19637
|
-
nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier"));
|
|
19726
|
+
nodes.push(this.parseImportNamespaceSpecifier());
|
|
19638
19727
|
return nodes
|
|
19639
19728
|
}
|
|
19640
19729
|
this.expect(types$1.braceL);
|
|
@@ -19644,16 +19733,7 @@ pp$8.parseImportSpecifiers = function() {
|
|
|
19644
19733
|
if (this.afterTrailingComma(types$1.braceR)) { break }
|
|
19645
19734
|
} else { first = false; }
|
|
19646
19735
|
|
|
19647
|
-
|
|
19648
|
-
node$2.imported = this.parseModuleExportName();
|
|
19649
|
-
if (this.eatContextual("as")) {
|
|
19650
|
-
node$2.local = this.parseIdent();
|
|
19651
|
-
} else {
|
|
19652
|
-
this.checkUnreserved(node$2.imported);
|
|
19653
|
-
node$2.local = node$2.imported;
|
|
19654
|
-
}
|
|
19655
|
-
this.checkLValSimple(node$2.local, BIND_LEXICAL);
|
|
19656
|
-
nodes.push(this.finishNode(node$2, "ImportSpecifier"));
|
|
19736
|
+
nodes.push(this.parseImportSpecifier());
|
|
19657
19737
|
}
|
|
19658
19738
|
return nodes
|
|
19659
19739
|
};
|
|
@@ -19826,7 +19906,7 @@ pp$7.parseBindingAtom = function() {
|
|
|
19826
19906
|
return this.parseIdent()
|
|
19827
19907
|
};
|
|
19828
19908
|
|
|
19829
|
-
pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
|
|
19909
|
+
pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma, allowModifiers) {
|
|
19830
19910
|
var elts = [], first = true;
|
|
19831
19911
|
while (!this.eat(close)) {
|
|
19832
19912
|
if (first) { first = false; }
|
|
@@ -19839,18 +19919,22 @@ pp$7.parseBindingList = function(close, allowEmpty, allowTrailingComma) {
|
|
|
19839
19919
|
var rest = this.parseRestBinding();
|
|
19840
19920
|
this.parseBindingListItem(rest);
|
|
19841
19921
|
elts.push(rest);
|
|
19842
|
-
if (this.type === types$1.comma) { this.
|
|
19922
|
+
if (this.type === types$1.comma) { this.raiseRecoverable(this.start, "Comma is not permitted after the rest element"); }
|
|
19843
19923
|
this.expect(close);
|
|
19844
19924
|
break
|
|
19845
19925
|
} else {
|
|
19846
|
-
|
|
19847
|
-
this.parseBindingListItem(elem);
|
|
19848
|
-
elts.push(elem);
|
|
19926
|
+
elts.push(this.parseAssignableListItem(allowModifiers));
|
|
19849
19927
|
}
|
|
19850
19928
|
}
|
|
19851
19929
|
return elts
|
|
19852
19930
|
};
|
|
19853
19931
|
|
|
19932
|
+
pp$7.parseAssignableListItem = function(allowModifiers) {
|
|
19933
|
+
var elem = this.parseMaybeDefault(this.start, this.startLoc);
|
|
19934
|
+
this.parseBindingListItem(elem);
|
|
19935
|
+
return elem
|
|
19936
|
+
};
|
|
19937
|
+
|
|
19854
19938
|
pp$7.parseBindingListItem = function(param) {
|
|
19855
19939
|
return param
|
|
19856
19940
|
};
|
|
@@ -20016,6 +20100,9 @@ pp$7.checkLValInnerPattern = function(expr, bindingType, checkClashes) {
|
|
|
20016
20100
|
};
|
|
20017
20101
|
|
|
20018
20102
|
// The algorithm used to determine whether a regexp can appear at a
|
|
20103
|
+
// given point in the program is loosely based on sweet.js' approach.
|
|
20104
|
+
// See https://github.com/mozilla/sweet.js/wiki/design
|
|
20105
|
+
|
|
20019
20106
|
|
|
20020
20107
|
var TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) {
|
|
20021
20108
|
this.token = token;
|
|
@@ -20171,6 +20258,23 @@ types$1.name.updateContext = function(prevType) {
|
|
|
20171
20258
|
};
|
|
20172
20259
|
|
|
20173
20260
|
// A recursive descent parser operates by defining functions for all
|
|
20261
|
+
// syntactic elements, and recursively calling those, each function
|
|
20262
|
+
// advancing the input stream and returning an AST node. Precedence
|
|
20263
|
+
// of constructs (for example, the fact that `!x[1]` means `!(x[1])`
|
|
20264
|
+
// instead of `(!x)[1]` is handled by the fact that the parser
|
|
20265
|
+
// function that parses unary prefix operators is called first, and
|
|
20266
|
+
// in turn calls the function that parses `[]` subscripts — that
|
|
20267
|
+
// way, it'll receive the node for `x[1]` already parsed, and wraps
|
|
20268
|
+
// *that* in the unary operator node.
|
|
20269
|
+
//
|
|
20270
|
+
// Acorn uses an [operator precedence parser][opp] to handle binary
|
|
20271
|
+
// operator precedence, because it is much more compact than using
|
|
20272
|
+
// the technique outlined above, which uses different, nesting
|
|
20273
|
+
// functions to specify precedence, for all of the ten binary
|
|
20274
|
+
// precedence levels that JavaScript defines.
|
|
20275
|
+
//
|
|
20276
|
+
// [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser
|
|
20277
|
+
|
|
20174
20278
|
|
|
20175
20279
|
var pp$5 = Parser.prototype;
|
|
20176
20280
|
|
|
@@ -20474,6 +20578,14 @@ pp$5.parseSubscripts = function(base, startPos, startLoc, noCalls, forInit) {
|
|
|
20474
20578
|
}
|
|
20475
20579
|
};
|
|
20476
20580
|
|
|
20581
|
+
pp$5.shouldParseAsyncArrow = function() {
|
|
20582
|
+
return !this.canInsertSemicolon() && this.eat(types$1.arrow)
|
|
20583
|
+
};
|
|
20584
|
+
|
|
20585
|
+
pp$5.parseSubscriptAsyncArrow = function(startPos, startLoc, exprList, forInit) {
|
|
20586
|
+
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit)
|
|
20587
|
+
};
|
|
20588
|
+
|
|
20477
20589
|
pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
|
|
20478
20590
|
var optionalSupported = this.options.ecmaVersion >= 11;
|
|
20479
20591
|
var optional = optionalSupported && this.eat(types$1.questionDot);
|
|
@@ -20502,7 +20614,7 @@ pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
20502
20614
|
this.awaitPos = 0;
|
|
20503
20615
|
this.awaitIdentPos = 0;
|
|
20504
20616
|
var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
|
|
20505
|
-
if (maybeAsyncArrow && !optional &&
|
|
20617
|
+
if (maybeAsyncArrow && !optional && this.shouldParseAsyncArrow()) {
|
|
20506
20618
|
this.checkPatternErrors(refDestructuringErrors, false);
|
|
20507
20619
|
this.checkYieldAwaitInDefaultParams();
|
|
20508
20620
|
if (this.awaitIdentPos > 0)
|
|
@@ -20510,7 +20622,7 @@ pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
20510
20622
|
this.yieldPos = oldYieldPos;
|
|
20511
20623
|
this.awaitPos = oldAwaitPos;
|
|
20512
20624
|
this.awaitIdentPos = oldAwaitIdentPos;
|
|
20513
|
-
return this.
|
|
20625
|
+
return this.parseSubscriptAsyncArrow(startPos, startLoc, exprList, forInit)
|
|
20514
20626
|
}
|
|
20515
20627
|
this.checkExpressionErrors(refDestructuringErrors, true);
|
|
20516
20628
|
this.yieldPos = oldYieldPos || this.yieldPos;
|
|
@@ -20540,7 +20652,7 @@ pp$5.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArro
|
|
|
20540
20652
|
// `new`, or an expression wrapped in punctuation like `()`, `[]`,
|
|
20541
20653
|
// or `{}`.
|
|
20542
20654
|
|
|
20543
|
-
pp$5.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
20655
|
+
pp$5.parseExprAtom = function(refDestructuringErrors, forInit, forNew) {
|
|
20544
20656
|
// If a division operator appears in an expression position, the
|
|
20545
20657
|
// tokenizer got confused, and we force it to read a regexp instead.
|
|
20546
20658
|
if (this.type === types$1.slash) { this.readRegexp(); }
|
|
@@ -20641,17 +20753,21 @@ pp$5.parseExprAtom = function(refDestructuringErrors, forInit) {
|
|
|
20641
20753
|
|
|
20642
20754
|
case types$1._import:
|
|
20643
20755
|
if (this.options.ecmaVersion >= 11) {
|
|
20644
|
-
return this.parseExprImport()
|
|
20756
|
+
return this.parseExprImport(forNew)
|
|
20645
20757
|
} else {
|
|
20646
20758
|
return this.unexpected()
|
|
20647
20759
|
}
|
|
20648
20760
|
|
|
20649
20761
|
default:
|
|
20650
|
-
this.
|
|
20762
|
+
return this.parseExprAtomDefault()
|
|
20651
20763
|
}
|
|
20652
20764
|
};
|
|
20653
20765
|
|
|
20654
|
-
pp$5.
|
|
20766
|
+
pp$5.parseExprAtomDefault = function() {
|
|
20767
|
+
this.unexpected();
|
|
20768
|
+
};
|
|
20769
|
+
|
|
20770
|
+
pp$5.parseExprImport = function(forNew) {
|
|
20655
20771
|
var node = this.startNode();
|
|
20656
20772
|
|
|
20657
20773
|
// Consume `import` as an identifier for `import.meta`.
|
|
@@ -20659,13 +20775,12 @@ pp$5.parseExprImport = function() {
|
|
|
20659
20775
|
if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword import"); }
|
|
20660
20776
|
var meta = this.parseIdent(true);
|
|
20661
20777
|
|
|
20662
|
-
|
|
20663
|
-
case types$1.parenL:
|
|
20778
|
+
if (this.type === types$1.parenL && !forNew) {
|
|
20664
20779
|
return this.parseDynamicImport(node)
|
|
20665
|
-
|
|
20780
|
+
} else if (this.type === types$1.dot) {
|
|
20666
20781
|
node.meta = meta;
|
|
20667
20782
|
return this.parseImportMeta(node)
|
|
20668
|
-
|
|
20783
|
+
} else {
|
|
20669
20784
|
this.unexpected();
|
|
20670
20785
|
}
|
|
20671
20786
|
};
|
|
@@ -20721,6 +20836,10 @@ pp$5.parseParenExpression = function() {
|
|
|
20721
20836
|
return val
|
|
20722
20837
|
};
|
|
20723
20838
|
|
|
20839
|
+
pp$5.shouldParseArrow = function(exprList) {
|
|
20840
|
+
return !this.canInsertSemicolon()
|
|
20841
|
+
};
|
|
20842
|
+
|
|
20724
20843
|
pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
20725
20844
|
var startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.options.ecmaVersion >= 8;
|
|
20726
20845
|
if (this.options.ecmaVersion >= 6) {
|
|
@@ -20740,7 +20859,12 @@ pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
|
20740
20859
|
} else if (this.type === types$1.ellipsis) {
|
|
20741
20860
|
spreadStart = this.start;
|
|
20742
20861
|
exprList.push(this.parseParenItem(this.parseRestBinding()));
|
|
20743
|
-
if (this.type === types$1.comma) {
|
|
20862
|
+
if (this.type === types$1.comma) {
|
|
20863
|
+
this.raiseRecoverable(
|
|
20864
|
+
this.start,
|
|
20865
|
+
"Comma is not permitted after the rest element"
|
|
20866
|
+
);
|
|
20867
|
+
}
|
|
20744
20868
|
break
|
|
20745
20869
|
} else {
|
|
20746
20870
|
exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
|
|
@@ -20749,7 +20873,7 @@ pp$5.parseParenAndDistinguishExpression = function(canBeArrow, forInit) {
|
|
|
20749
20873
|
var innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc;
|
|
20750
20874
|
this.expect(types$1.parenR);
|
|
20751
20875
|
|
|
20752
|
-
if (canBeArrow &&
|
|
20876
|
+
if (canBeArrow && this.shouldParseArrow(exprList) && this.eat(types$1.arrow)) {
|
|
20753
20877
|
this.checkPatternErrors(refDestructuringErrors, false);
|
|
20754
20878
|
this.checkYieldAwaitInDefaultParams();
|
|
20755
20879
|
this.yieldPos = oldYieldPos;
|
|
@@ -20815,11 +20939,8 @@ pp$5.parseNew = function() {
|
|
|
20815
20939
|
{ this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"); }
|
|
20816
20940
|
return this.finishNode(node, "MetaProperty")
|
|
20817
20941
|
}
|
|
20818
|
-
var startPos = this.start, startLoc = this.startLoc
|
|
20819
|
-
node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true, false);
|
|
20820
|
-
if (isImport && node.callee.type === "ImportExpression") {
|
|
20821
|
-
this.raise(startPos, "Cannot use new with import()");
|
|
20822
|
-
}
|
|
20942
|
+
var startPos = this.start, startLoc = this.startLoc;
|
|
20943
|
+
node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false);
|
|
20823
20944
|
if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); }
|
|
20824
20945
|
else { node.arguments = empty; }
|
|
20825
20946
|
return this.finishNode(node, "NewExpression")
|
|
@@ -20901,7 +21022,7 @@ pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
20901
21022
|
if (isPattern) {
|
|
20902
21023
|
prop.argument = this.parseIdent(false);
|
|
20903
21024
|
if (this.type === types$1.comma) {
|
|
20904
|
-
this.
|
|
21025
|
+
this.raiseRecoverable(this.start, "Comma is not permitted after the rest element");
|
|
20905
21026
|
}
|
|
20906
21027
|
return this.finishNode(prop, "RestElement")
|
|
20907
21028
|
}
|
|
@@ -20937,6 +21058,23 @@ pp$5.parseProperty = function(isPattern, refDestructuringErrors) {
|
|
|
20937
21058
|
return this.finishNode(prop, "Property")
|
|
20938
21059
|
};
|
|
20939
21060
|
|
|
21061
|
+
pp$5.parseGetterSetter = function(prop) {
|
|
21062
|
+
prop.kind = prop.key.name;
|
|
21063
|
+
this.parsePropertyName(prop);
|
|
21064
|
+
prop.value = this.parseMethod(false);
|
|
21065
|
+
var paramCount = prop.kind === "get" ? 0 : 1;
|
|
21066
|
+
if (prop.value.params.length !== paramCount) {
|
|
21067
|
+
var start = prop.value.start;
|
|
21068
|
+
if (prop.kind === "get")
|
|
21069
|
+
{ this.raiseRecoverable(start, "getter should have no params"); }
|
|
21070
|
+
else
|
|
21071
|
+
{ this.raiseRecoverable(start, "setter should have exactly one param"); }
|
|
21072
|
+
} else {
|
|
21073
|
+
if (prop.kind === "set" && prop.value.params[0].type === "RestElement")
|
|
21074
|
+
{ this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); }
|
|
21075
|
+
}
|
|
21076
|
+
};
|
|
21077
|
+
|
|
20940
21078
|
pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) {
|
|
20941
21079
|
if ((isGenerator || isAsync) && this.type === types$1.colon)
|
|
20942
21080
|
{ this.unexpected(); }
|
|
@@ -20954,20 +21092,7 @@ pp$5.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP
|
|
|
20954
21092
|
(prop.key.name === "get" || prop.key.name === "set") &&
|
|
20955
21093
|
(this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq)) {
|
|
20956
21094
|
if (isGenerator || isAsync) { this.unexpected(); }
|
|
20957
|
-
|
|
20958
|
-
this.parsePropertyName(prop);
|
|
20959
|
-
prop.value = this.parseMethod(false);
|
|
20960
|
-
var paramCount = prop.kind === "get" ? 0 : 1;
|
|
20961
|
-
if (prop.value.params.length !== paramCount) {
|
|
20962
|
-
var start = prop.value.start;
|
|
20963
|
-
if (prop.kind === "get")
|
|
20964
|
-
{ this.raiseRecoverable(start, "getter should have no params"); }
|
|
20965
|
-
else
|
|
20966
|
-
{ this.raiseRecoverable(start, "setter should have exactly one param"); }
|
|
20967
|
-
} else {
|
|
20968
|
-
if (prop.kind === "set" && prop.value.params[0].type === "RestElement")
|
|
20969
|
-
{ this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); }
|
|
20970
|
-
}
|
|
21095
|
+
this.parseGetterSetter(prop);
|
|
20971
21096
|
} else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") {
|
|
20972
21097
|
if (isGenerator || isAsync) { this.unexpected(); }
|
|
20973
21098
|
this.checkUnreserved(prop.key);
|
|
@@ -21179,6 +21304,18 @@ pp$5.checkUnreserved = function(ref) {
|
|
|
21179
21304
|
// identifiers.
|
|
21180
21305
|
|
|
21181
21306
|
pp$5.parseIdent = function(liberal) {
|
|
21307
|
+
var node = this.parseIdentNode();
|
|
21308
|
+
this.next(!!liberal);
|
|
21309
|
+
this.finishNode(node, "Identifier");
|
|
21310
|
+
if (!liberal) {
|
|
21311
|
+
this.checkUnreserved(node);
|
|
21312
|
+
if (node.name === "await" && !this.awaitIdentPos)
|
|
21313
|
+
{ this.awaitIdentPos = node.start; }
|
|
21314
|
+
}
|
|
21315
|
+
return node
|
|
21316
|
+
};
|
|
21317
|
+
|
|
21318
|
+
pp$5.parseIdentNode = function() {
|
|
21182
21319
|
var node = this.startNode();
|
|
21183
21320
|
if (this.type === types$1.name) {
|
|
21184
21321
|
node.name = this.value;
|
|
@@ -21190,19 +21327,12 @@ pp$5.parseIdent = function(liberal) {
|
|
|
21190
21327
|
// But there is no chance to pop the context if the keyword is consumed as an identifier such as a property name.
|
|
21191
21328
|
// If the previous token is a dot, this does not apply because the context-managing code already ignored the keyword
|
|
21192
21329
|
if ((node.name === "class" || node.name === "function") &&
|
|
21193
|
-
|
|
21330
|
+
(this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
|
|
21194
21331
|
this.context.pop();
|
|
21195
21332
|
}
|
|
21196
21333
|
} else {
|
|
21197
21334
|
this.unexpected();
|
|
21198
21335
|
}
|
|
21199
|
-
this.next(!!liberal);
|
|
21200
|
-
this.finishNode(node, "Identifier");
|
|
21201
|
-
if (!liberal) {
|
|
21202
|
-
this.checkUnreserved(node);
|
|
21203
|
-
if (node.name === "await" && !this.awaitIdentPos)
|
|
21204
|
-
{ this.awaitIdentPos = node.start; }
|
|
21205
|
-
}
|
|
21206
21336
|
return node
|
|
21207
21337
|
};
|
|
21208
21338
|
|
|
@@ -21442,6 +21572,18 @@ var unicodeBinaryProperties = {
|
|
|
21442
21572
|
14: ecma14BinaryProperties
|
|
21443
21573
|
};
|
|
21444
21574
|
|
|
21575
|
+
// #table-binary-unicode-properties-of-strings
|
|
21576
|
+
var ecma14BinaryPropertiesOfStrings = "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji";
|
|
21577
|
+
|
|
21578
|
+
var unicodeBinaryPropertiesOfStrings = {
|
|
21579
|
+
9: "",
|
|
21580
|
+
10: "",
|
|
21581
|
+
11: "",
|
|
21582
|
+
12: "",
|
|
21583
|
+
13: "",
|
|
21584
|
+
14: ecma14BinaryPropertiesOfStrings
|
|
21585
|
+
};
|
|
21586
|
+
|
|
21445
21587
|
// #table-unicode-general-category-values
|
|
21446
21588
|
var unicodeGeneralCategoryValues = "Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu";
|
|
21447
21589
|
|
|
@@ -21451,7 +21593,7 @@ var ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Han
|
|
|
21451
21593
|
var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho";
|
|
21452
21594
|
var ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi";
|
|
21453
21595
|
var ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith";
|
|
21454
|
-
var ecma14ScriptValues = ecma13ScriptValues + " Kawi Nag_Mundari Nagm";
|
|
21596
|
+
var ecma14ScriptValues = ecma13ScriptValues + " Hrkt Katakana_Or_Hiragana Kawi Nag_Mundari Nagm Unknown Zzzz";
|
|
21455
21597
|
|
|
21456
21598
|
var unicodeScriptValues = {
|
|
21457
21599
|
9: ecma9ScriptValues,
|
|
@@ -21466,6 +21608,7 @@ var data = {};
|
|
|
21466
21608
|
function buildUnicodeData(ecmaVersion) {
|
|
21467
21609
|
var d = data[ecmaVersion] = {
|
|
21468
21610
|
binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues),
|
|
21611
|
+
binaryOfStrings: wordsRegexp(unicodeBinaryPropertiesOfStrings[ecmaVersion]),
|
|
21469
21612
|
nonBinary: {
|
|
21470
21613
|
General_Category: wordsRegexp(unicodeGeneralCategoryValues),
|
|
21471
21614
|
Script: wordsRegexp(unicodeScriptValues[ecmaVersion])
|
|
@@ -21488,12 +21631,13 @@ var pp$1 = Parser.prototype;
|
|
|
21488
21631
|
|
|
21489
21632
|
var RegExpValidationState = function RegExpValidationState(parser) {
|
|
21490
21633
|
this.parser = parser;
|
|
21491
|
-
this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "");
|
|
21634
|
+
this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "") + (parser.options.ecmaVersion >= 15 ? "v" : "");
|
|
21492
21635
|
this.unicodeProperties = data[parser.options.ecmaVersion >= 14 ? 14 : parser.options.ecmaVersion];
|
|
21493
21636
|
this.source = "";
|
|
21494
21637
|
this.flags = "";
|
|
21495
21638
|
this.start = 0;
|
|
21496
21639
|
this.switchU = false;
|
|
21640
|
+
this.switchV = false;
|
|
21497
21641
|
this.switchN = false;
|
|
21498
21642
|
this.pos = 0;
|
|
21499
21643
|
this.lastIntValue = 0;
|
|
@@ -21506,12 +21650,20 @@ var RegExpValidationState = function RegExpValidationState(parser) {
|
|
|
21506
21650
|
};
|
|
21507
21651
|
|
|
21508
21652
|
RegExpValidationState.prototype.reset = function reset (start, pattern, flags) {
|
|
21653
|
+
var unicodeSets = flags.indexOf("v") !== -1;
|
|
21509
21654
|
var unicode = flags.indexOf("u") !== -1;
|
|
21510
21655
|
this.start = start | 0;
|
|
21511
21656
|
this.source = pattern + "";
|
|
21512
21657
|
this.flags = flags;
|
|
21513
|
-
|
|
21514
|
-
|
|
21658
|
+
if (unicodeSets && this.parser.options.ecmaVersion >= 15) {
|
|
21659
|
+
this.switchU = true;
|
|
21660
|
+
this.switchV = true;
|
|
21661
|
+
this.switchN = true;
|
|
21662
|
+
} else {
|
|
21663
|
+
this.switchU = unicode && this.parser.options.ecmaVersion >= 6;
|
|
21664
|
+
this.switchV = false;
|
|
21665
|
+
this.switchN = unicode && this.parser.options.ecmaVersion >= 9;
|
|
21666
|
+
}
|
|
21515
21667
|
};
|
|
21516
21668
|
|
|
21517
21669
|
RegExpValidationState.prototype.raise = function raise (message) {
|
|
@@ -21580,6 +21732,23 @@ RegExpValidationState.prototype.eat = function eat (ch, forceU) {
|
|
|
21580
21732
|
return false
|
|
21581
21733
|
};
|
|
21582
21734
|
|
|
21735
|
+
RegExpValidationState.prototype.eatChars = function eatChars (chs, forceU) {
|
|
21736
|
+
if ( forceU === void 0 ) forceU = false;
|
|
21737
|
+
|
|
21738
|
+
var pos = this.pos;
|
|
21739
|
+
for (var i = 0, list = chs; i < list.length; i += 1) {
|
|
21740
|
+
var ch = list[i];
|
|
21741
|
+
|
|
21742
|
+
var current = this.at(pos, forceU);
|
|
21743
|
+
if (current === -1 || current !== ch) {
|
|
21744
|
+
return false
|
|
21745
|
+
}
|
|
21746
|
+
pos = this.nextIndex(pos, forceU);
|
|
21747
|
+
}
|
|
21748
|
+
this.pos = pos;
|
|
21749
|
+
return true
|
|
21750
|
+
};
|
|
21751
|
+
|
|
21583
21752
|
/**
|
|
21584
21753
|
* Validate the flags part of a given RegExpLiteral.
|
|
21585
21754
|
*
|
|
@@ -21590,6 +21759,9 @@ pp$1.validateRegExpFlags = function(state) {
|
|
|
21590
21759
|
var validFlags = state.validFlags;
|
|
21591
21760
|
var flags = state.flags;
|
|
21592
21761
|
|
|
21762
|
+
var u = false;
|
|
21763
|
+
var v = false;
|
|
21764
|
+
|
|
21593
21765
|
for (var i = 0; i < flags.length; i++) {
|
|
21594
21766
|
var flag = flags.charAt(i);
|
|
21595
21767
|
if (validFlags.indexOf(flag) === -1) {
|
|
@@ -21598,6 +21770,11 @@ pp$1.validateRegExpFlags = function(state) {
|
|
|
21598
21770
|
if (flags.indexOf(flag, i + 1) > -1) {
|
|
21599
21771
|
this.raise(state.start, "Duplicate regular expression flag");
|
|
21600
21772
|
}
|
|
21773
|
+
if (flag === "u") { u = true; }
|
|
21774
|
+
if (flag === "v") { v = true; }
|
|
21775
|
+
}
|
|
21776
|
+
if (this.options.ecmaVersion >= 15 && u && v) {
|
|
21777
|
+
this.raise(state.start, "Invalid regular expression flag");
|
|
21601
21778
|
}
|
|
21602
21779
|
};
|
|
21603
21780
|
|
|
@@ -22216,6 +22393,12 @@ pp$1.regexp_eatDecimalEscape = function(state) {
|
|
|
22216
22393
|
return false
|
|
22217
22394
|
};
|
|
22218
22395
|
|
|
22396
|
+
// Return values used by character set parsing methods, needed to
|
|
22397
|
+
// forbid negation of sets that can match strings.
|
|
22398
|
+
var CharSetNone = 0; // Nothing parsed
|
|
22399
|
+
var CharSetOk = 1; // Construct parsed, cannot contain strings
|
|
22400
|
+
var CharSetString = 2; // Construct parsed, can contain strings
|
|
22401
|
+
|
|
22219
22402
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape
|
|
22220
22403
|
pp$1.regexp_eatCharacterClassEscape = function(state) {
|
|
22221
22404
|
var ch = state.current();
|
|
@@ -22223,28 +22406,32 @@ pp$1.regexp_eatCharacterClassEscape = function(state) {
|
|
|
22223
22406
|
if (isCharacterClassEscape(ch)) {
|
|
22224
22407
|
state.lastIntValue = -1;
|
|
22225
22408
|
state.advance();
|
|
22226
|
-
return
|
|
22409
|
+
return CharSetOk
|
|
22227
22410
|
}
|
|
22228
22411
|
|
|
22412
|
+
var negate = false;
|
|
22229
22413
|
if (
|
|
22230
22414
|
state.switchU &&
|
|
22231
22415
|
this.options.ecmaVersion >= 9 &&
|
|
22232
|
-
(ch === 0x50 /* P */ || ch === 0x70 /* p */)
|
|
22416
|
+
((negate = ch === 0x50 /* P */) || ch === 0x70 /* p */)
|
|
22233
22417
|
) {
|
|
22234
22418
|
state.lastIntValue = -1;
|
|
22235
22419
|
state.advance();
|
|
22420
|
+
var result;
|
|
22236
22421
|
if (
|
|
22237
22422
|
state.eat(0x7B /* { */) &&
|
|
22238
|
-
this.regexp_eatUnicodePropertyValueExpression(state) &&
|
|
22423
|
+
(result = this.regexp_eatUnicodePropertyValueExpression(state)) &&
|
|
22239
22424
|
state.eat(0x7D /* } */)
|
|
22240
22425
|
) {
|
|
22241
|
-
|
|
22426
|
+
if (negate && result === CharSetString) { state.raise("Invalid property name"); }
|
|
22427
|
+
return result
|
|
22242
22428
|
}
|
|
22243
22429
|
state.raise("Invalid property name");
|
|
22244
22430
|
}
|
|
22245
22431
|
|
|
22246
|
-
return
|
|
22432
|
+
return CharSetNone
|
|
22247
22433
|
};
|
|
22434
|
+
|
|
22248
22435
|
function isCharacterClassEscape(ch) {
|
|
22249
22436
|
return (
|
|
22250
22437
|
ch === 0x64 /* d */ ||
|
|
@@ -22268,7 +22455,7 @@ pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
|
|
|
22268
22455
|
if (this.regexp_eatUnicodePropertyValue(state)) {
|
|
22269
22456
|
var value = state.lastStringValue;
|
|
22270
22457
|
this.regexp_validateUnicodePropertyNameAndValue(state, name, value);
|
|
22271
|
-
return
|
|
22458
|
+
return CharSetOk
|
|
22272
22459
|
}
|
|
22273
22460
|
}
|
|
22274
22461
|
state.pos = start;
|
|
@@ -22276,20 +22463,22 @@ pp$1.regexp_eatUnicodePropertyValueExpression = function(state) {
|
|
|
22276
22463
|
// LoneUnicodePropertyNameOrValue
|
|
22277
22464
|
if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) {
|
|
22278
22465
|
var nameOrValue = state.lastStringValue;
|
|
22279
|
-
this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue)
|
|
22280
|
-
return true
|
|
22466
|
+
return this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue)
|
|
22281
22467
|
}
|
|
22282
|
-
return
|
|
22468
|
+
return CharSetNone
|
|
22283
22469
|
};
|
|
22470
|
+
|
|
22284
22471
|
pp$1.regexp_validateUnicodePropertyNameAndValue = function(state, name, value) {
|
|
22285
22472
|
if (!hasOwn(state.unicodeProperties.nonBinary, name))
|
|
22286
22473
|
{ state.raise("Invalid property name"); }
|
|
22287
22474
|
if (!state.unicodeProperties.nonBinary[name].test(value))
|
|
22288
22475
|
{ state.raise("Invalid property value"); }
|
|
22289
22476
|
};
|
|
22477
|
+
|
|
22290
22478
|
pp$1.regexp_validateUnicodePropertyNameOrValue = function(state, nameOrValue) {
|
|
22291
|
-
if (
|
|
22292
|
-
|
|
22479
|
+
if (state.unicodeProperties.binary.test(nameOrValue)) { return CharSetOk }
|
|
22480
|
+
if (state.switchV && state.unicodeProperties.binaryOfStrings.test(nameOrValue)) { return CharSetString }
|
|
22481
|
+
state.raise("Invalid property name");
|
|
22293
22482
|
};
|
|
22294
22483
|
|
|
22295
22484
|
// UnicodePropertyName ::
|
|
@@ -22303,6 +22492,7 @@ pp$1.regexp_eatUnicodePropertyName = function(state) {
|
|
|
22303
22492
|
}
|
|
22304
22493
|
return state.lastStringValue !== ""
|
|
22305
22494
|
};
|
|
22495
|
+
|
|
22306
22496
|
function isUnicodePropertyNameCharacter(ch) {
|
|
22307
22497
|
return isControlLetter(ch) || ch === 0x5F /* _ */
|
|
22308
22498
|
}
|
|
@@ -22331,21 +22521,29 @@ pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function(state) {
|
|
|
22331
22521
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass
|
|
22332
22522
|
pp$1.regexp_eatCharacterClass = function(state) {
|
|
22333
22523
|
if (state.eat(0x5B /* [ */)) {
|
|
22334
|
-
state.eat(0x5E /* ^ */);
|
|
22335
|
-
this.
|
|
22336
|
-
if (state.eat(0x5D /* ] */))
|
|
22337
|
-
|
|
22338
|
-
|
|
22339
|
-
|
|
22340
|
-
|
|
22524
|
+
var negate = state.eat(0x5E /* ^ */);
|
|
22525
|
+
var result = this.regexp_classContents(state);
|
|
22526
|
+
if (!state.eat(0x5D /* ] */))
|
|
22527
|
+
{ state.raise("Unterminated character class"); }
|
|
22528
|
+
if (negate && result === CharSetString)
|
|
22529
|
+
{ state.raise("Negated character class may contain strings"); }
|
|
22530
|
+
return true
|
|
22341
22531
|
}
|
|
22342
22532
|
return false
|
|
22343
22533
|
};
|
|
22344
22534
|
|
|
22535
|
+
// https://tc39.es/ecma262/#prod-ClassContents
|
|
22345
22536
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges
|
|
22537
|
+
pp$1.regexp_classContents = function(state) {
|
|
22538
|
+
if (state.current() === 0x5D /* ] */) { return CharSetOk }
|
|
22539
|
+
if (state.switchV) { return this.regexp_classSetExpression(state) }
|
|
22540
|
+
this.regexp_nonEmptyClassRanges(state);
|
|
22541
|
+
return CharSetOk
|
|
22542
|
+
};
|
|
22543
|
+
|
|
22346
22544
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges
|
|
22347
22545
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash
|
|
22348
|
-
pp$1.
|
|
22546
|
+
pp$1.regexp_nonEmptyClassRanges = function(state) {
|
|
22349
22547
|
while (this.regexp_eatClassAtom(state)) {
|
|
22350
22548
|
var left = state.lastIntValue;
|
|
22351
22549
|
if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {
|
|
@@ -22417,6 +22615,205 @@ pp$1.regexp_eatClassEscape = function(state) {
|
|
|
22417
22615
|
)
|
|
22418
22616
|
};
|
|
22419
22617
|
|
|
22618
|
+
// https://tc39.es/ecma262/#prod-ClassSetExpression
|
|
22619
|
+
// https://tc39.es/ecma262/#prod-ClassUnion
|
|
22620
|
+
// https://tc39.es/ecma262/#prod-ClassIntersection
|
|
22621
|
+
// https://tc39.es/ecma262/#prod-ClassSubtraction
|
|
22622
|
+
pp$1.regexp_classSetExpression = function(state) {
|
|
22623
|
+
var result = CharSetOk, subResult;
|
|
22624
|
+
if (this.regexp_eatClassSetRange(state)) ; else if (subResult = this.regexp_eatClassSetOperand(state)) {
|
|
22625
|
+
if (subResult === CharSetString) { result = CharSetString; }
|
|
22626
|
+
// https://tc39.es/ecma262/#prod-ClassIntersection
|
|
22627
|
+
var start = state.pos;
|
|
22628
|
+
while (state.eatChars([0x26, 0x26] /* && */)) {
|
|
22629
|
+
if (
|
|
22630
|
+
state.current() !== 0x26 /* & */ &&
|
|
22631
|
+
(subResult = this.regexp_eatClassSetOperand(state))
|
|
22632
|
+
) {
|
|
22633
|
+
if (subResult !== CharSetString) { result = CharSetOk; }
|
|
22634
|
+
continue
|
|
22635
|
+
}
|
|
22636
|
+
state.raise("Invalid character in character class");
|
|
22637
|
+
}
|
|
22638
|
+
if (start !== state.pos) { return result }
|
|
22639
|
+
// https://tc39.es/ecma262/#prod-ClassSubtraction
|
|
22640
|
+
while (state.eatChars([0x2D, 0x2D] /* -- */)) {
|
|
22641
|
+
if (this.regexp_eatClassSetOperand(state)) { continue }
|
|
22642
|
+
state.raise("Invalid character in character class");
|
|
22643
|
+
}
|
|
22644
|
+
if (start !== state.pos) { return result }
|
|
22645
|
+
} else {
|
|
22646
|
+
state.raise("Invalid character in character class");
|
|
22647
|
+
}
|
|
22648
|
+
// https://tc39.es/ecma262/#prod-ClassUnion
|
|
22649
|
+
for (;;) {
|
|
22650
|
+
if (this.regexp_eatClassSetRange(state)) { continue }
|
|
22651
|
+
subResult = this.regexp_eatClassSetOperand(state);
|
|
22652
|
+
if (!subResult) { return result }
|
|
22653
|
+
if (subResult === CharSetString) { result = CharSetString; }
|
|
22654
|
+
}
|
|
22655
|
+
};
|
|
22656
|
+
|
|
22657
|
+
// https://tc39.es/ecma262/#prod-ClassSetRange
|
|
22658
|
+
pp$1.regexp_eatClassSetRange = function(state) {
|
|
22659
|
+
var start = state.pos;
|
|
22660
|
+
if (this.regexp_eatClassSetCharacter(state)) {
|
|
22661
|
+
var left = state.lastIntValue;
|
|
22662
|
+
if (state.eat(0x2D /* - */) && this.regexp_eatClassSetCharacter(state)) {
|
|
22663
|
+
var right = state.lastIntValue;
|
|
22664
|
+
if (left !== -1 && right !== -1 && left > right) {
|
|
22665
|
+
state.raise("Range out of order in character class");
|
|
22666
|
+
}
|
|
22667
|
+
return true
|
|
22668
|
+
}
|
|
22669
|
+
state.pos = start;
|
|
22670
|
+
}
|
|
22671
|
+
return false
|
|
22672
|
+
};
|
|
22673
|
+
|
|
22674
|
+
// https://tc39.es/ecma262/#prod-ClassSetOperand
|
|
22675
|
+
pp$1.regexp_eatClassSetOperand = function(state) {
|
|
22676
|
+
if (this.regexp_eatClassSetCharacter(state)) { return CharSetOk }
|
|
22677
|
+
return this.regexp_eatClassStringDisjunction(state) || this.regexp_eatNestedClass(state)
|
|
22678
|
+
};
|
|
22679
|
+
|
|
22680
|
+
// https://tc39.es/ecma262/#prod-NestedClass
|
|
22681
|
+
pp$1.regexp_eatNestedClass = function(state) {
|
|
22682
|
+
var start = state.pos;
|
|
22683
|
+
if (state.eat(0x5B /* [ */)) {
|
|
22684
|
+
var negate = state.eat(0x5E /* ^ */);
|
|
22685
|
+
var result = this.regexp_classContents(state);
|
|
22686
|
+
if (state.eat(0x5D /* ] */)) {
|
|
22687
|
+
if (negate && result === CharSetString) {
|
|
22688
|
+
state.raise("Negated character class may contain strings");
|
|
22689
|
+
}
|
|
22690
|
+
return result
|
|
22691
|
+
}
|
|
22692
|
+
state.pos = start;
|
|
22693
|
+
}
|
|
22694
|
+
if (state.eat(0x5C /* \ */)) {
|
|
22695
|
+
var result$1 = this.regexp_eatCharacterClassEscape(state);
|
|
22696
|
+
if (result$1) {
|
|
22697
|
+
return result$1
|
|
22698
|
+
}
|
|
22699
|
+
state.pos = start;
|
|
22700
|
+
}
|
|
22701
|
+
return null
|
|
22702
|
+
};
|
|
22703
|
+
|
|
22704
|
+
// https://tc39.es/ecma262/#prod-ClassStringDisjunction
|
|
22705
|
+
pp$1.regexp_eatClassStringDisjunction = function(state) {
|
|
22706
|
+
var start = state.pos;
|
|
22707
|
+
if (state.eatChars([0x5C, 0x71] /* \q */)) {
|
|
22708
|
+
if (state.eat(0x7B /* { */)) {
|
|
22709
|
+
var result = this.regexp_classStringDisjunctionContents(state);
|
|
22710
|
+
if (state.eat(0x7D /* } */)) {
|
|
22711
|
+
return result
|
|
22712
|
+
}
|
|
22713
|
+
} else {
|
|
22714
|
+
// Make the same message as V8.
|
|
22715
|
+
state.raise("Invalid escape");
|
|
22716
|
+
}
|
|
22717
|
+
state.pos = start;
|
|
22718
|
+
}
|
|
22719
|
+
return null
|
|
22720
|
+
};
|
|
22721
|
+
|
|
22722
|
+
// https://tc39.es/ecma262/#prod-ClassStringDisjunctionContents
|
|
22723
|
+
pp$1.regexp_classStringDisjunctionContents = function(state) {
|
|
22724
|
+
var result = this.regexp_classString(state);
|
|
22725
|
+
while (state.eat(0x7C /* | */)) {
|
|
22726
|
+
if (this.regexp_classString(state) === CharSetString) { result = CharSetString; }
|
|
22727
|
+
}
|
|
22728
|
+
return result
|
|
22729
|
+
};
|
|
22730
|
+
|
|
22731
|
+
// https://tc39.es/ecma262/#prod-ClassString
|
|
22732
|
+
// https://tc39.es/ecma262/#prod-NonEmptyClassString
|
|
22733
|
+
pp$1.regexp_classString = function(state) {
|
|
22734
|
+
var count = 0;
|
|
22735
|
+
while (this.regexp_eatClassSetCharacter(state)) { count++; }
|
|
22736
|
+
return count === 1 ? CharSetOk : CharSetString
|
|
22737
|
+
};
|
|
22738
|
+
|
|
22739
|
+
// https://tc39.es/ecma262/#prod-ClassSetCharacter
|
|
22740
|
+
pp$1.regexp_eatClassSetCharacter = function(state) {
|
|
22741
|
+
var start = state.pos;
|
|
22742
|
+
if (state.eat(0x5C /* \ */)) {
|
|
22743
|
+
if (
|
|
22744
|
+
this.regexp_eatCharacterEscape(state) ||
|
|
22745
|
+
this.regexp_eatClassSetReservedPunctuator(state)
|
|
22746
|
+
) {
|
|
22747
|
+
return true
|
|
22748
|
+
}
|
|
22749
|
+
if (state.eat(0x62 /* b */)) {
|
|
22750
|
+
state.lastIntValue = 0x08; /* <BS> */
|
|
22751
|
+
return true
|
|
22752
|
+
}
|
|
22753
|
+
state.pos = start;
|
|
22754
|
+
return false
|
|
22755
|
+
}
|
|
22756
|
+
var ch = state.current();
|
|
22757
|
+
if (ch < 0 || ch === state.lookahead() && isClassSetReservedDoublePunctuatorCharacter(ch)) { return false }
|
|
22758
|
+
if (isClassSetSyntaxCharacter(ch)) { return false }
|
|
22759
|
+
state.advance();
|
|
22760
|
+
state.lastIntValue = ch;
|
|
22761
|
+
return true
|
|
22762
|
+
};
|
|
22763
|
+
|
|
22764
|
+
// https://tc39.es/ecma262/#prod-ClassSetReservedDoublePunctuator
|
|
22765
|
+
function isClassSetReservedDoublePunctuatorCharacter(ch) {
|
|
22766
|
+
return (
|
|
22767
|
+
ch === 0x21 /* ! */ ||
|
|
22768
|
+
ch >= 0x23 /* # */ && ch <= 0x26 /* & */ ||
|
|
22769
|
+
ch >= 0x2A /* * */ && ch <= 0x2C /* , */ ||
|
|
22770
|
+
ch === 0x2E /* . */ ||
|
|
22771
|
+
ch >= 0x3A /* : */ && ch <= 0x40 /* @ */ ||
|
|
22772
|
+
ch === 0x5E /* ^ */ ||
|
|
22773
|
+
ch === 0x60 /* ` */ ||
|
|
22774
|
+
ch === 0x7E /* ~ */
|
|
22775
|
+
)
|
|
22776
|
+
}
|
|
22777
|
+
|
|
22778
|
+
// https://tc39.es/ecma262/#prod-ClassSetSyntaxCharacter
|
|
22779
|
+
function isClassSetSyntaxCharacter(ch) {
|
|
22780
|
+
return (
|
|
22781
|
+
ch === 0x28 /* ( */ ||
|
|
22782
|
+
ch === 0x29 /* ) */ ||
|
|
22783
|
+
ch === 0x2D /* - */ ||
|
|
22784
|
+
ch === 0x2F /* / */ ||
|
|
22785
|
+
ch >= 0x5B /* [ */ && ch <= 0x5D /* ] */ ||
|
|
22786
|
+
ch >= 0x7B /* { */ && ch <= 0x7D /* } */
|
|
22787
|
+
)
|
|
22788
|
+
}
|
|
22789
|
+
|
|
22790
|
+
// https://tc39.es/ecma262/#prod-ClassSetReservedPunctuator
|
|
22791
|
+
pp$1.regexp_eatClassSetReservedPunctuator = function(state) {
|
|
22792
|
+
var ch = state.current();
|
|
22793
|
+
if (isClassSetReservedPunctuator(ch)) {
|
|
22794
|
+
state.lastIntValue = ch;
|
|
22795
|
+
state.advance();
|
|
22796
|
+
return true
|
|
22797
|
+
}
|
|
22798
|
+
return false
|
|
22799
|
+
};
|
|
22800
|
+
|
|
22801
|
+
// https://tc39.es/ecma262/#prod-ClassSetReservedPunctuator
|
|
22802
|
+
function isClassSetReservedPunctuator(ch) {
|
|
22803
|
+
return (
|
|
22804
|
+
ch === 0x21 /* ! */ ||
|
|
22805
|
+
ch === 0x23 /* # */ ||
|
|
22806
|
+
ch === 0x25 /* % */ ||
|
|
22807
|
+
ch === 0x26 /* & */ ||
|
|
22808
|
+
ch === 0x2C /* , */ ||
|
|
22809
|
+
ch === 0x2D /* - */ ||
|
|
22810
|
+
ch >= 0x3A /* : */ && ch <= 0x3E /* > */ ||
|
|
22811
|
+
ch === 0x40 /* @ */ ||
|
|
22812
|
+
ch === 0x60 /* ` */ ||
|
|
22813
|
+
ch === 0x7E /* ~ */
|
|
22814
|
+
)
|
|
22815
|
+
}
|
|
22816
|
+
|
|
22420
22817
|
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter
|
|
22421
22818
|
pp$1.regexp_eatClassControlLetter = function(state) {
|
|
22422
22819
|
var ch = state.current();
|
|
@@ -23337,8 +23734,23 @@ pp.readWord = function() {
|
|
|
23337
23734
|
};
|
|
23338
23735
|
|
|
23339
23736
|
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
|
|
23737
|
+
//
|
|
23738
|
+
// Acorn was written by Marijn Haverbeke, Ingvar Stepanyan, and
|
|
23739
|
+
// various contributors and released under an MIT license.
|
|
23740
|
+
//
|
|
23741
|
+
// Git repositories for Acorn are available at
|
|
23742
|
+
//
|
|
23743
|
+
// http://marijnhaverbeke.nl/git/acorn
|
|
23744
|
+
// https://github.com/acornjs/acorn.git
|
|
23745
|
+
//
|
|
23746
|
+
// Please use the [github bug tracker][ghbt] to report issues.
|
|
23747
|
+
//
|
|
23748
|
+
// [ghbt]: https://github.com/acornjs/acorn/issues
|
|
23749
|
+
//
|
|
23750
|
+
// [walk]: util/walk.js
|
|
23751
|
+
|
|
23340
23752
|
|
|
23341
|
-
var version = "8.
|
|
23753
|
+
var version = "8.9.0";
|
|
23342
23754
|
|
|
23343
23755
|
Parser.acorn = {
|
|
23344
23756
|
Parser: Parser,
|
|
@@ -23768,7 +24180,7 @@ async function transform(source, module, pluginDriver, log) {
|
|
|
23768
24180
|
let customTransformCache = false;
|
|
23769
24181
|
const useCustomTransformCache = () => (customTransformCache = true);
|
|
23770
24182
|
let pluginName = '';
|
|
23771
|
-
|
|
24183
|
+
let currentSource = source.code;
|
|
23772
24184
|
function transformReducer(previousCode, result, plugin) {
|
|
23773
24185
|
let code;
|
|
23774
24186
|
let map;
|
|
@@ -23796,6 +24208,7 @@ async function transform(source, module, pluginDriver, log) {
|
|
|
23796
24208
|
plugin: plugin.name
|
|
23797
24209
|
});
|
|
23798
24210
|
}
|
|
24211
|
+
currentSource = code;
|
|
23799
24212
|
return code;
|
|
23800
24213
|
}
|
|
23801
24214
|
const getLogHandler = (handler) => (log, pos) => {
|