@parcel/utils 2.10.3 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +173 -162
- package/lib/index.js.map +1 -1
- package/package.json +7 -7
package/lib/index.js
CHANGED
|
@@ -1119,7 +1119,18 @@ var $9kveb = parcelRequire("9kveb");
|
|
|
1119
1119
|
let extglobStar = star;
|
|
1120
1120
|
if (token.inner && token.inner.length > 1 && token.inner.includes("/")) extglobStar = globstar(opts);
|
|
1121
1121
|
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) output = token.close = `)$))${extglobStar}`;
|
|
1122
|
-
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest))
|
|
1122
|
+
if (token.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
|
1123
|
+
// Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis.
|
|
1124
|
+
// In this case, we need to parse the string and use it in the output of the original pattern.
|
|
1125
|
+
// Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`.
|
|
1126
|
+
//
|
|
1127
|
+
// Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`.
|
|
1128
|
+
const expression = $8b2f0c2eaecf2312$var$parse(rest, {
|
|
1129
|
+
...options,
|
|
1130
|
+
fastpaths: false
|
|
1131
|
+
}).output;
|
|
1132
|
+
output = token.close = `)${expression})${extglobStar})`;
|
|
1133
|
+
}
|
|
1123
1134
|
if (token.prev.type === "bos") state.negatedExtglob = true;
|
|
1124
1135
|
}
|
|
1125
1136
|
push({
|
|
@@ -1854,19 +1865,19 @@ parcelRegister("2nj4a", function(module, exports) {
|
|
|
1854
1865
|
/* eslint-disable no-new-wrappers, no-eval, camelcase, operator-linebreak */ module.exports = makeParserClass((parcelRequire("ibqqh")));
|
|
1855
1866
|
module.exports.makeParserClass = makeParserClass;
|
|
1856
1867
|
class TomlError extends Error {
|
|
1857
|
-
constructor(
|
|
1858
|
-
super(
|
|
1868
|
+
constructor(msg){
|
|
1869
|
+
super(msg);
|
|
1859
1870
|
this.name = "TomlError";
|
|
1860
1871
|
/* istanbul ignore next */ if (Error.captureStackTrace) Error.captureStackTrace(this, TomlError);
|
|
1861
1872
|
this.fromTOML = true;
|
|
1862
1873
|
this.wrapped = null;
|
|
1863
1874
|
}
|
|
1864
1875
|
}
|
|
1865
|
-
TomlError.wrap = (
|
|
1866
|
-
const
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
return
|
|
1876
|
+
TomlError.wrap = (err)=>{
|
|
1877
|
+
const terr = new TomlError(err.message);
|
|
1878
|
+
terr.code = err.code;
|
|
1879
|
+
terr.wrapped = err;
|
|
1880
|
+
return terr;
|
|
1870
1881
|
};
|
|
1871
1882
|
module.exports.TomlError = TomlError;
|
|
1872
1883
|
|
|
@@ -1934,23 +1945,23 @@ const escapes = {
|
|
|
1934
1945
|
[CHAR_QUOT]: '"',
|
|
1935
1946
|
[CHAR_BSOL]: "\\"
|
|
1936
1947
|
};
|
|
1937
|
-
function isDigit(
|
|
1938
|
-
return
|
|
1948
|
+
function isDigit(cp) {
|
|
1949
|
+
return cp >= CHAR_0 && cp <= CHAR_9;
|
|
1939
1950
|
}
|
|
1940
|
-
function isHexit(
|
|
1941
|
-
return
|
|
1951
|
+
function isHexit(cp) {
|
|
1952
|
+
return cp >= CHAR_A && cp <= CHAR_F || cp >= CHAR_a && cp <= CHAR_f || cp >= CHAR_0 && cp <= CHAR_9;
|
|
1942
1953
|
}
|
|
1943
|
-
function isBit(
|
|
1944
|
-
return
|
|
1954
|
+
function isBit(cp) {
|
|
1955
|
+
return cp === CHAR_1 || cp === CHAR_0;
|
|
1945
1956
|
}
|
|
1946
|
-
function isOctit(
|
|
1947
|
-
return
|
|
1957
|
+
function isOctit(cp) {
|
|
1958
|
+
return cp >= CHAR_0 && cp <= CHAR_7;
|
|
1948
1959
|
}
|
|
1949
|
-
function isAlphaNumQuoteHyphen(
|
|
1950
|
-
return
|
|
1960
|
+
function isAlphaNumQuoteHyphen(cp) {
|
|
1961
|
+
return cp >= CHAR_A && cp <= CHAR_Z || cp >= CHAR_a && cp <= CHAR_z || cp >= CHAR_0 && cp <= CHAR_9 || cp === CHAR_APOS || cp === CHAR_QUOT || cp === CHAR_LOWBAR || cp === CHAR_HYPHEN;
|
|
1951
1962
|
}
|
|
1952
|
-
function isAlphaNumHyphen(
|
|
1953
|
-
return
|
|
1963
|
+
function isAlphaNumHyphen(cp) {
|
|
1964
|
+
return cp >= CHAR_A && cp <= CHAR_Z || cp >= CHAR_a && cp <= CHAR_z || cp >= CHAR_0 && cp <= CHAR_9 || cp === CHAR_LOWBAR || cp === CHAR_HYPHEN;
|
|
1954
1965
|
}
|
|
1955
1966
|
const _type = Symbol("type");
|
|
1956
1967
|
const _declared = Symbol("declared");
|
|
@@ -1962,9 +1973,9 @@ const descriptor = {
|
|
|
1962
1973
|
writable: true,
|
|
1963
1974
|
value: undefined
|
|
1964
1975
|
};
|
|
1965
|
-
function hasKey(
|
|
1966
|
-
if (hasOwnProperty.call(
|
|
1967
|
-
if (
|
|
1976
|
+
function hasKey(obj, key) {
|
|
1977
|
+
if (hasOwnProperty.call(obj, key)) return true;
|
|
1978
|
+
if (key === "__proto__") defineProperty(obj, "__proto__", descriptor);
|
|
1968
1979
|
return false;
|
|
1969
1980
|
}
|
|
1970
1981
|
const INLINE_TABLE = Symbol("inline-table");
|
|
@@ -1975,9 +1986,9 @@ function InlineTable() {
|
|
|
1975
1986
|
}
|
|
1976
1987
|
});
|
|
1977
1988
|
}
|
|
1978
|
-
function isInlineTable(
|
|
1979
|
-
if (
|
|
1980
|
-
return
|
|
1989
|
+
function isInlineTable(obj) {
|
|
1990
|
+
if (obj === null || typeof obj !== "object") return false;
|
|
1991
|
+
return obj[_type] === INLINE_TABLE;
|
|
1981
1992
|
}
|
|
1982
1993
|
const TABLE = Symbol("table");
|
|
1983
1994
|
function Table() {
|
|
@@ -1991,25 +2002,25 @@ function Table() {
|
|
|
1991
2002
|
}
|
|
1992
2003
|
});
|
|
1993
2004
|
}
|
|
1994
|
-
function isTable(
|
|
1995
|
-
if (
|
|
1996
|
-
return
|
|
2005
|
+
function isTable(obj) {
|
|
2006
|
+
if (obj === null || typeof obj !== "object") return false;
|
|
2007
|
+
return obj[_type] === TABLE;
|
|
1997
2008
|
}
|
|
1998
2009
|
const _contentType = Symbol("content-type");
|
|
1999
2010
|
const INLINE_LIST = Symbol("inline-list");
|
|
2000
|
-
function InlineList(
|
|
2011
|
+
function InlineList(type) {
|
|
2001
2012
|
return Object.defineProperties([], {
|
|
2002
2013
|
[_type]: {
|
|
2003
2014
|
value: INLINE_LIST
|
|
2004
2015
|
},
|
|
2005
2016
|
[_contentType]: {
|
|
2006
|
-
value:
|
|
2017
|
+
value: type
|
|
2007
2018
|
}
|
|
2008
2019
|
});
|
|
2009
2020
|
}
|
|
2010
|
-
function isInlineList(
|
|
2011
|
-
if (
|
|
2012
|
-
return
|
|
2021
|
+
function isInlineList(obj) {
|
|
2022
|
+
if (obj === null || typeof obj !== "object") return false;
|
|
2023
|
+
return obj[_type] === INLINE_LIST;
|
|
2013
2024
|
}
|
|
2014
2025
|
const LIST = Symbol("list");
|
|
2015
2026
|
function List() {
|
|
@@ -2019,9 +2030,9 @@ function List() {
|
|
|
2019
2030
|
}
|
|
2020
2031
|
});
|
|
2021
2032
|
}
|
|
2022
|
-
function isList(
|
|
2023
|
-
if (
|
|
2024
|
-
return
|
|
2033
|
+
function isList(obj) {
|
|
2034
|
+
if (obj === null || typeof obj !== "object") return false;
|
|
2035
|
+
return obj[_type] === LIST;
|
|
2025
2036
|
}
|
|
2026
2037
|
// in an eval, to let bundlers not slurp in a util proxy
|
|
2027
2038
|
let _custom;
|
|
@@ -2032,10 +2043,10 @@ try {
|
|
|
2032
2043
|
/* eval require not available in transpiled bundle */ }
|
|
2033
2044
|
/* istanbul ignore next */ const _inspect = _custom || "inspect";
|
|
2034
2045
|
class BoxedBigInt {
|
|
2035
|
-
constructor(
|
|
2046
|
+
constructor(value){
|
|
2036
2047
|
try {
|
|
2037
|
-
this.value = $parcel$global.BigInt.asIntN(64,
|
|
2038
|
-
} catch (
|
|
2048
|
+
this.value = $parcel$global.BigInt.asIntN(64, value);
|
|
2049
|
+
} catch (_) {
|
|
2039
2050
|
/* istanbul ignore next */ this.value = null;
|
|
2040
2051
|
}
|
|
2041
2052
|
Object.defineProperty(this, _type, {
|
|
@@ -2056,12 +2067,12 @@ class BoxedBigInt {
|
|
|
2056
2067
|
}
|
|
2057
2068
|
}
|
|
2058
2069
|
const INTEGER = Symbol("integer");
|
|
2059
|
-
function Integer(
|
|
2060
|
-
let
|
|
2070
|
+
function Integer(value) {
|
|
2071
|
+
let num = Number(value);
|
|
2061
2072
|
// -0 is a float thing, not an int thing
|
|
2062
|
-
if (Object.is(
|
|
2063
|
-
/* istanbul ignore else */ if ($parcel$global.BigInt && !Number.isSafeInteger(
|
|
2064
|
-
else /* istanbul ignore next */ return Object.defineProperties(new Number(
|
|
2073
|
+
if (Object.is(num, -0)) num = 0;
|
|
2074
|
+
/* istanbul ignore else */ if ($parcel$global.BigInt && !Number.isSafeInteger(num)) return new BoxedBigInt(value);
|
|
2075
|
+
else /* istanbul ignore next */ return Object.defineProperties(new Number(num), {
|
|
2065
2076
|
isNaN: {
|
|
2066
2077
|
value: function() {
|
|
2067
2078
|
return isNaN(this);
|
|
@@ -2071,35 +2082,35 @@ function Integer(value11) {
|
|
|
2071
2082
|
value: INTEGER
|
|
2072
2083
|
},
|
|
2073
2084
|
[_inspect]: {
|
|
2074
|
-
value: ()=>`[Integer: ${
|
|
2085
|
+
value: ()=>`[Integer: ${value}]`
|
|
2075
2086
|
}
|
|
2076
2087
|
});
|
|
2077
2088
|
}
|
|
2078
|
-
function isInteger(
|
|
2079
|
-
if (
|
|
2080
|
-
return
|
|
2089
|
+
function isInteger(obj) {
|
|
2090
|
+
if (obj === null || typeof obj !== "object") return false;
|
|
2091
|
+
return obj[_type] === INTEGER;
|
|
2081
2092
|
}
|
|
2082
2093
|
const FLOAT = Symbol("float");
|
|
2083
|
-
function Float(
|
|
2084
|
-
/* istanbul ignore next */ return Object.defineProperties(new Number(
|
|
2094
|
+
function Float(value) {
|
|
2095
|
+
/* istanbul ignore next */ return Object.defineProperties(new Number(value), {
|
|
2085
2096
|
[_type]: {
|
|
2086
2097
|
value: FLOAT
|
|
2087
2098
|
},
|
|
2088
2099
|
[_inspect]: {
|
|
2089
|
-
value: ()=>`[Float: ${
|
|
2100
|
+
value: ()=>`[Float: ${value}]`
|
|
2090
2101
|
}
|
|
2091
2102
|
});
|
|
2092
2103
|
}
|
|
2093
|
-
function isFloat(
|
|
2094
|
-
if (
|
|
2095
|
-
return
|
|
2104
|
+
function isFloat(obj) {
|
|
2105
|
+
if (obj === null || typeof obj !== "object") return false;
|
|
2106
|
+
return obj[_type] === FLOAT;
|
|
2096
2107
|
}
|
|
2097
|
-
function tomlType(
|
|
2098
|
-
const
|
|
2099
|
-
if (
|
|
2100
|
-
/* istanbul ignore if */ if (
|
|
2101
|
-
if (
|
|
2102
|
-
/* istanbul ignore else */ if (_type in
|
|
2108
|
+
function tomlType(value) {
|
|
2109
|
+
const type = typeof value;
|
|
2110
|
+
if (type === "object") {
|
|
2111
|
+
/* istanbul ignore if */ if (value === null) return "null";
|
|
2112
|
+
if (value instanceof Date) return "datetime";
|
|
2113
|
+
/* istanbul ignore else */ if (_type in value) switch(value[_type]){
|
|
2103
2114
|
case INLINE_TABLE:
|
|
2104
2115
|
return "inline-table";
|
|
2105
2116
|
case INLINE_LIST:
|
|
@@ -2114,10 +2125,10 @@ function tomlType(value11) {
|
|
|
2114
2125
|
return "integer";
|
|
2115
2126
|
}
|
|
2116
2127
|
}
|
|
2117
|
-
return
|
|
2128
|
+
return type;
|
|
2118
2129
|
}
|
|
2119
|
-
function makeParserClass(
|
|
2120
|
-
class
|
|
2130
|
+
function makeParserClass(Parser) {
|
|
2131
|
+
class TOMLParser extends Parser {
|
|
2121
2132
|
constructor(){
|
|
2122
2133
|
super();
|
|
2123
2134
|
this.ctx = this.obj = Table();
|
|
@@ -2126,10 +2137,10 @@ function makeParserClass(Parser11) {
|
|
|
2126
2137
|
return this.char === CHAR_NUM || this.char === CTRL_I || this.char === CHAR_SP || this.atEndOfLine();
|
|
2127
2138
|
}
|
|
2128
2139
|
atEndOfLine() {
|
|
2129
|
-
return this.char ===
|
|
2140
|
+
return this.char === Parser.END || this.char === CTRL_J || this.char === CTRL_M;
|
|
2130
2141
|
}
|
|
2131
2142
|
parseStart() {
|
|
2132
|
-
if (this.char ===
|
|
2143
|
+
if (this.char === Parser.END) return null;
|
|
2133
2144
|
else if (this.char === CHAR_LSQB) return this.call(this.parseTableOrList);
|
|
2134
2145
|
else if (this.char === CHAR_NUM) return this.call(this.parseComment);
|
|
2135
2146
|
else if (this.char === CTRL_J || this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) return null;
|
|
@@ -2141,32 +2152,32 @@ function makeParserClass(Parser11) {
|
|
|
2141
2152
|
parseWhitespaceToEOL() {
|
|
2142
2153
|
if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) return null;
|
|
2143
2154
|
else if (this.char === CHAR_NUM) return this.goto(this.parseComment);
|
|
2144
|
-
else if (this.char ===
|
|
2155
|
+
else if (this.char === Parser.END || this.char === CTRL_J) return this.return();
|
|
2145
2156
|
else throw this.error(new TomlError("Unexpected character, expected only whitespace or comments till end of line"));
|
|
2146
2157
|
}
|
|
2147
2158
|
/* ASSIGNMENT: key = value */ parseAssignStatement() {
|
|
2148
2159
|
return this.callNow(this.parseAssign, this.recordAssignStatement);
|
|
2149
2160
|
}
|
|
2150
|
-
recordAssignStatement(
|
|
2151
|
-
let
|
|
2152
|
-
let
|
|
2153
|
-
for (let
|
|
2154
|
-
if (hasKey(
|
|
2155
|
-
|
|
2161
|
+
recordAssignStatement(kv) {
|
|
2162
|
+
let target = this.ctx;
|
|
2163
|
+
let finalKey = kv.key.pop();
|
|
2164
|
+
for (let kw of kv.key){
|
|
2165
|
+
if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) throw this.error(new TomlError("Can't redefine existing key"));
|
|
2166
|
+
target = target[kw] = target[kw] || Table();
|
|
2156
2167
|
}
|
|
2157
|
-
if (hasKey(
|
|
2168
|
+
if (hasKey(target, finalKey)) throw this.error(new TomlError("Can't redefine existing key"));
|
|
2158
2169
|
// unbox our numbers
|
|
2159
|
-
if (isInteger(
|
|
2160
|
-
else
|
|
2170
|
+
if (isInteger(kv.value) || isFloat(kv.value)) target[finalKey] = kv.value.valueOf();
|
|
2171
|
+
else target[finalKey] = kv.value;
|
|
2161
2172
|
return this.goto(this.parseWhitespaceToEOL);
|
|
2162
2173
|
}
|
|
2163
2174
|
/* ASSSIGNMENT expression, key = value possibly inside an inline table */ parseAssign() {
|
|
2164
2175
|
return this.callNow(this.parseKeyword, this.recordAssignKeyword);
|
|
2165
2176
|
}
|
|
2166
|
-
recordAssignKeyword(
|
|
2167
|
-
if (this.state.resultTable) this.state.resultTable.push(
|
|
2177
|
+
recordAssignKeyword(key) {
|
|
2178
|
+
if (this.state.resultTable) this.state.resultTable.push(key);
|
|
2168
2179
|
else this.state.resultTable = [
|
|
2169
|
-
|
|
2180
|
+
key
|
|
2170
2181
|
];
|
|
2171
2182
|
return this.goto(this.parseAssignKeywordPreDot);
|
|
2172
2183
|
}
|
|
@@ -2185,15 +2196,15 @@ function makeParserClass(Parser11) {
|
|
|
2185
2196
|
if (this.char === CHAR_SP || this.char === CTRL_I) return null;
|
|
2186
2197
|
else return this.callNow(this.parseValue, this.recordAssignValue);
|
|
2187
2198
|
}
|
|
2188
|
-
recordAssignValue(
|
|
2199
|
+
recordAssignValue(value) {
|
|
2189
2200
|
return this.returnNow({
|
|
2190
2201
|
key: this.state.resultTable,
|
|
2191
|
-
value:
|
|
2202
|
+
value: value
|
|
2192
2203
|
});
|
|
2193
2204
|
}
|
|
2194
2205
|
/* COMMENTS: #...eol */ parseComment() {
|
|
2195
2206
|
do {
|
|
2196
|
-
if (this.char ===
|
|
2207
|
+
if (this.char === Parser.END || this.char === CTRL_J) return this.return();
|
|
2197
2208
|
}while (this.nextChar());
|
|
2198
2209
|
}
|
|
2199
2210
|
/* TABLES AND LISTS, [foo] and [[foo]] */ parseTableOrList() {
|
|
@@ -2208,19 +2219,19 @@ function makeParserClass(Parser11) {
|
|
|
2208
2219
|
if (this.char === CHAR_SP || this.char === CTRL_I) return null;
|
|
2209
2220
|
else return this.callNow(this.parseKeyword, this.parseTableMore);
|
|
2210
2221
|
}
|
|
2211
|
-
parseTableMore(
|
|
2222
|
+
parseTableMore(keyword) {
|
|
2212
2223
|
if (this.char === CHAR_SP || this.char === CTRL_I) return null;
|
|
2213
2224
|
else if (this.char === CHAR_RSQB) {
|
|
2214
|
-
if (hasKey(this.ctx,
|
|
2225
|
+
if (hasKey(this.ctx, keyword) && (!isTable(this.ctx[keyword]) || this.ctx[keyword][_declared])) throw this.error(new TomlError("Can't redefine existing key"));
|
|
2215
2226
|
else {
|
|
2216
|
-
this.ctx = this.ctx[
|
|
2227
|
+
this.ctx = this.ctx[keyword] = this.ctx[keyword] || Table();
|
|
2217
2228
|
this.ctx[_declared] = true;
|
|
2218
2229
|
}
|
|
2219
2230
|
return this.next(this.parseWhitespaceToEOL);
|
|
2220
2231
|
} else if (this.char === CHAR_PERIOD) {
|
|
2221
|
-
if (!hasKey(this.ctx,
|
|
2222
|
-
else if (isTable(this.ctx[
|
|
2223
|
-
else if (isList(this.ctx[
|
|
2232
|
+
if (!hasKey(this.ctx, keyword)) this.ctx = this.ctx[keyword] = Table();
|
|
2233
|
+
else if (isTable(this.ctx[keyword])) this.ctx = this.ctx[keyword];
|
|
2234
|
+
else if (isList(this.ctx[keyword])) this.ctx = this.ctx[keyword][this.ctx[keyword].length - 1];
|
|
2224
2235
|
else throw this.error(new TomlError("Can't redefine existing key"));
|
|
2225
2236
|
return this.next(this.parseTableNext);
|
|
2226
2237
|
} else throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
|
|
@@ -2233,33 +2244,33 @@ function makeParserClass(Parser11) {
|
|
|
2233
2244
|
if (this.char === CHAR_SP || this.char === CTRL_I) return null;
|
|
2234
2245
|
else return this.callNow(this.parseKeyword, this.parseListMore);
|
|
2235
2246
|
}
|
|
2236
|
-
parseListMore(
|
|
2247
|
+
parseListMore(keyword) {
|
|
2237
2248
|
if (this.char === CHAR_SP || this.char === CTRL_I) return null;
|
|
2238
2249
|
else if (this.char === CHAR_RSQB) {
|
|
2239
|
-
if (!hasKey(this.ctx,
|
|
2240
|
-
if (isInlineList(this.ctx[
|
|
2241
|
-
else if (isList(this.ctx[
|
|
2242
|
-
const
|
|
2243
|
-
this.ctx[
|
|
2244
|
-
this.ctx =
|
|
2250
|
+
if (!hasKey(this.ctx, keyword)) this.ctx[keyword] = List();
|
|
2251
|
+
if (isInlineList(this.ctx[keyword])) throw this.error(new TomlError("Can't extend an inline array"));
|
|
2252
|
+
else if (isList(this.ctx[keyword])) {
|
|
2253
|
+
const next = Table();
|
|
2254
|
+
this.ctx[keyword].push(next);
|
|
2255
|
+
this.ctx = next;
|
|
2245
2256
|
} else throw this.error(new TomlError("Can't redefine an existing key"));
|
|
2246
2257
|
return this.next(this.parseListEnd);
|
|
2247
2258
|
} else if (this.char === CHAR_PERIOD) {
|
|
2248
|
-
if (!hasKey(this.ctx,
|
|
2249
|
-
else if (isInlineList(this.ctx[
|
|
2250
|
-
else if (isInlineTable(this.ctx[
|
|
2251
|
-
else if (isList(this.ctx[
|
|
2252
|
-
else if (isTable(this.ctx[
|
|
2259
|
+
if (!hasKey(this.ctx, keyword)) this.ctx = this.ctx[keyword] = Table();
|
|
2260
|
+
else if (isInlineList(this.ctx[keyword])) throw this.error(new TomlError("Can't extend an inline array"));
|
|
2261
|
+
else if (isInlineTable(this.ctx[keyword])) throw this.error(new TomlError("Can't extend an inline table"));
|
|
2262
|
+
else if (isList(this.ctx[keyword])) this.ctx = this.ctx[keyword][this.ctx[keyword].length - 1];
|
|
2263
|
+
else if (isTable(this.ctx[keyword])) this.ctx = this.ctx[keyword];
|
|
2253
2264
|
else throw this.error(new TomlError("Can't redefine an existing key"));
|
|
2254
2265
|
return this.next(this.parseListNext);
|
|
2255
2266
|
} else throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
|
|
2256
2267
|
}
|
|
2257
|
-
parseListEnd(
|
|
2268
|
+
parseListEnd(keyword) {
|
|
2258
2269
|
if (this.char === CHAR_RSQB) return this.next(this.parseWhitespaceToEOL);
|
|
2259
2270
|
else throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
|
|
2260
2271
|
}
|
|
2261
2272
|
/* VALUE string, number, boolean, inline list, inline object */ parseValue() {
|
|
2262
|
-
if (this.char ===
|
|
2273
|
+
if (this.char === Parser.END) throw this.error(new TomlError("Key without value"));
|
|
2263
2274
|
else if (this.char === CHAR_QUOT) return this.next(this.parseDoubleString);
|
|
2264
2275
|
if (this.char === CHAR_APOS) return this.next(this.parseSingleString);
|
|
2265
2276
|
else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) return this.goto(this.parseNumberSign);
|
|
@@ -2271,8 +2282,8 @@ function makeParserClass(Parser11) {
|
|
|
2271
2282
|
else if (this.char === CHAR_LCUB) return this.call(this.parseInlineTable, this.recordValue);
|
|
2272
2283
|
else throw this.error(new TomlError("Unexpected character, expecting string, number, datetime, boolean, inline array or inline table"));
|
|
2273
2284
|
}
|
|
2274
|
-
recordValue(
|
|
2275
|
-
return this.returnNow(
|
|
2285
|
+
recordValue(value) {
|
|
2286
|
+
return this.returnNow(value);
|
|
2276
2287
|
}
|
|
2277
2288
|
parseInf() {
|
|
2278
2289
|
if (this.char === CHAR_n) return this.next(this.parseInf2);
|
|
@@ -2299,7 +2310,7 @@ function makeParserClass(Parser11) {
|
|
|
2299
2310
|
}
|
|
2300
2311
|
/* KEYS: barewords */ parseBareKey() {
|
|
2301
2312
|
do {
|
|
2302
|
-
if (this.char ===
|
|
2313
|
+
if (this.char === Parser.END) throw this.error(new TomlError("Key ended without value"));
|
|
2303
2314
|
else if (isAlphaNumHyphen(this.char)) this.consume();
|
|
2304
2315
|
else if (this.state.buf.length === 0) throw this.error(new TomlError("Empty bare keys are not allowed"));
|
|
2305
2316
|
else return this.returnNow();
|
|
@@ -2329,7 +2340,7 @@ function makeParserClass(Parser11) {
|
|
|
2329
2340
|
parseLiteralMultiStringContent() {
|
|
2330
2341
|
do {
|
|
2331
2342
|
if (this.char === CHAR_APOS) return this.next(this.parseLiteralMultiEnd);
|
|
2332
|
-
else if (this.char ===
|
|
2343
|
+
else if (this.char === Parser.END) throw this.error(new TomlError("Unterminated multi-line string"));
|
|
2333
2344
|
else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M) throw this.errorControlCharInString();
|
|
2334
2345
|
else this.consume();
|
|
2335
2346
|
}while (this.nextChar());
|
|
@@ -2361,8 +2372,8 @@ function makeParserClass(Parser11) {
|
|
|
2361
2372
|
else this.consume();
|
|
2362
2373
|
}while (this.nextChar());
|
|
2363
2374
|
}
|
|
2364
|
-
recordEscapeReplacement(
|
|
2365
|
-
this.state.buf +=
|
|
2375
|
+
recordEscapeReplacement(replacement) {
|
|
2376
|
+
this.state.buf += replacement;
|
|
2366
2377
|
return this.goto(this.parseBasicString);
|
|
2367
2378
|
}
|
|
2368
2379
|
parseMultiStringMaybe() {
|
|
@@ -2378,19 +2389,19 @@ function makeParserClass(Parser11) {
|
|
|
2378
2389
|
do {
|
|
2379
2390
|
if (this.char === CHAR_BSOL) return this.call(this.parseMultiEscape, this.recordMultiEscapeReplacement);
|
|
2380
2391
|
else if (this.char === CHAR_QUOT) return this.next(this.parseMultiEnd);
|
|
2381
|
-
else if (this.char ===
|
|
2392
|
+
else if (this.char === Parser.END) throw this.error(new TomlError("Unterminated multi-line string"));
|
|
2382
2393
|
else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M) throw this.errorControlCharInString();
|
|
2383
2394
|
else this.consume();
|
|
2384
2395
|
}while (this.nextChar());
|
|
2385
2396
|
}
|
|
2386
2397
|
errorControlCharInString() {
|
|
2387
|
-
let
|
|
2388
|
-
if (this.char < 16)
|
|
2389
|
-
|
|
2390
|
-
return this.error(new TomlError(`Control characters (codes < 0x1f and 0x7f) are not allowed in strings, use ${
|
|
2398
|
+
let displayCode = "\\u00";
|
|
2399
|
+
if (this.char < 16) displayCode += "0";
|
|
2400
|
+
displayCode += this.char.toString(16);
|
|
2401
|
+
return this.error(new TomlError(`Control characters (codes < 0x1f and 0x7f) are not allowed in strings, use ${displayCode} instead`));
|
|
2391
2402
|
}
|
|
2392
|
-
recordMultiEscapeReplacement(
|
|
2393
|
-
this.state.buf +=
|
|
2403
|
+
recordMultiEscapeReplacement(replacement) {
|
|
2404
|
+
this.state.buf += replacement;
|
|
2394
2405
|
return this.goto(this.parseMultiStringContent);
|
|
2395
2406
|
}
|
|
2396
2407
|
parseMultiEnd() {
|
|
@@ -2428,13 +2439,13 @@ function makeParserClass(Parser11) {
|
|
|
2428
2439
|
else if (this.char === CHAR_U) return this.call(this.parseLargeUnicode, this.parseUnicodeReturn);
|
|
2429
2440
|
else throw this.error(new TomlError("Unknown escape character: " + this.char));
|
|
2430
2441
|
}
|
|
2431
|
-
parseUnicodeReturn(
|
|
2442
|
+
parseUnicodeReturn(char) {
|
|
2432
2443
|
try {
|
|
2433
|
-
const
|
|
2434
|
-
if (
|
|
2435
|
-
return this.returnNow(String.fromCodePoint(
|
|
2436
|
-
} catch (
|
|
2437
|
-
throw this.error(TomlError.wrap(
|
|
2444
|
+
const codePoint = parseInt(char, 16);
|
|
2445
|
+
if (codePoint >= SURROGATE_FIRST && codePoint <= SURROGATE_LAST) throw this.error(new TomlError("Invalid unicode, character in range 0xD800 - 0xDFFF is reserved"));
|
|
2446
|
+
return this.returnNow(String.fromCodePoint(codePoint));
|
|
2447
|
+
} catch (err) {
|
|
2448
|
+
throw this.error(TomlError.wrap(err));
|
|
2438
2449
|
}
|
|
2439
2450
|
}
|
|
2440
2451
|
parseSmallUnicode() {
|
|
@@ -2485,9 +2496,9 @@ function makeParserClass(Parser11) {
|
|
|
2485
2496
|
this.consume();
|
|
2486
2497
|
return this.call(this.parseNoUnder, this.parseNumberFloat);
|
|
2487
2498
|
} else {
|
|
2488
|
-
const
|
|
2489
|
-
/* istanbul ignore if */ if (
|
|
2490
|
-
else return this.returnNow(
|
|
2499
|
+
const result = Integer(this.state.buf);
|
|
2500
|
+
/* istanbul ignore if */ if (result.isNaN()) throw this.error(new TomlError("Invalid number"));
|
|
2501
|
+
else return this.returnNow(result);
|
|
2491
2502
|
}
|
|
2492
2503
|
}
|
|
2493
2504
|
parseNoUnder() {
|
|
@@ -2565,27 +2576,27 @@ function makeParserClass(Parser11) {
|
|
|
2565
2576
|
if (isHexit(this.char)) this.consume();
|
|
2566
2577
|
else if (this.char === CHAR_LOWBAR) return this.call(this.parseNoUnder);
|
|
2567
2578
|
else {
|
|
2568
|
-
const
|
|
2569
|
-
/* istanbul ignore if */ if (
|
|
2570
|
-
else return this.returnNow(
|
|
2579
|
+
const result = Integer(this.state.buf);
|
|
2580
|
+
/* istanbul ignore if */ if (result.isNaN()) throw this.error(new TomlError("Invalid number"));
|
|
2581
|
+
else return this.returnNow(result);
|
|
2571
2582
|
}
|
|
2572
2583
|
}
|
|
2573
2584
|
parseIntegerOct() {
|
|
2574
2585
|
if (isOctit(this.char)) this.consume();
|
|
2575
2586
|
else if (this.char === CHAR_LOWBAR) return this.call(this.parseNoUnder);
|
|
2576
2587
|
else {
|
|
2577
|
-
const
|
|
2578
|
-
/* istanbul ignore if */ if (
|
|
2579
|
-
else return this.returnNow(
|
|
2588
|
+
const result = Integer(this.state.buf);
|
|
2589
|
+
/* istanbul ignore if */ if (result.isNaN()) throw this.error(new TomlError("Invalid number"));
|
|
2590
|
+
else return this.returnNow(result);
|
|
2580
2591
|
}
|
|
2581
2592
|
}
|
|
2582
2593
|
parseIntegerBin() {
|
|
2583
2594
|
if (isBit(this.char)) this.consume();
|
|
2584
2595
|
else if (this.char === CHAR_LOWBAR) return this.call(this.parseNoUnder);
|
|
2585
2596
|
else {
|
|
2586
|
-
const
|
|
2587
|
-
/* istanbul ignore if */ if (
|
|
2588
|
-
else return this.returnNow(
|
|
2597
|
+
const result = Integer(this.state.buf);
|
|
2598
|
+
/* istanbul ignore if */ if (result.isNaN()) throw this.error(new TomlError("Invalid number"));
|
|
2599
|
+
else return this.returnNow(result);
|
|
2589
2600
|
}
|
|
2590
2601
|
}
|
|
2591
2602
|
/* DATETIME */ parseDateTime() {
|
|
@@ -2774,20 +2785,20 @@ function makeParserClass(Parser11) {
|
|
|
2774
2785
|
}
|
|
2775
2786
|
/* INLINE LISTS */ parseInlineList() {
|
|
2776
2787
|
if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M || this.char === CTRL_J) return null;
|
|
2777
|
-
else if (this.char ===
|
|
2788
|
+
else if (this.char === Parser.END) throw this.error(new TomlError("Unterminated inline array"));
|
|
2778
2789
|
else if (this.char === CHAR_NUM) return this.call(this.parseComment);
|
|
2779
2790
|
else if (this.char === CHAR_RSQB) return this.return(this.state.resultArr || InlineList());
|
|
2780
2791
|
else return this.callNow(this.parseValue, this.recordInlineListValue);
|
|
2781
2792
|
}
|
|
2782
|
-
recordInlineListValue(
|
|
2793
|
+
recordInlineListValue(value) {
|
|
2783
2794
|
if (this.state.resultArr) {
|
|
2784
|
-
const
|
|
2785
|
-
const
|
|
2786
|
-
if (
|
|
2787
|
-
} else this.state.resultArr = InlineList(tomlType(
|
|
2788
|
-
if (isFloat(
|
|
2789
|
-
this.state.resultArr.push(
|
|
2790
|
-
else this.state.resultArr.push(
|
|
2795
|
+
const listType = this.state.resultArr[_contentType];
|
|
2796
|
+
const valueType = tomlType(value);
|
|
2797
|
+
if (listType !== valueType) throw this.error(new TomlError(`Inline lists must be a single type, not a mix of ${listType} and ${valueType}`));
|
|
2798
|
+
} else this.state.resultArr = InlineList(tomlType(value));
|
|
2799
|
+
if (isFloat(value) || isInteger(value)) // unbox now that we've verified they're ok
|
|
2800
|
+
this.state.resultArr.push(value.valueOf());
|
|
2801
|
+
else this.state.resultArr.push(value);
|
|
2791
2802
|
return this.goto(this.parseInlineListNext);
|
|
2792
2803
|
}
|
|
2793
2804
|
parseInlineListNext() {
|
|
@@ -2799,34 +2810,34 @@ function makeParserClass(Parser11) {
|
|
|
2799
2810
|
}
|
|
2800
2811
|
/* INLINE TABLE */ parseInlineTable() {
|
|
2801
2812
|
if (this.char === CHAR_SP || this.char === CTRL_I) return null;
|
|
2802
|
-
else if (this.char ===
|
|
2813
|
+
else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) throw this.error(new TomlError("Unterminated inline array"));
|
|
2803
2814
|
else if (this.char === CHAR_RCUB) return this.return(this.state.resultTable || InlineTable());
|
|
2804
2815
|
else {
|
|
2805
2816
|
if (!this.state.resultTable) this.state.resultTable = InlineTable();
|
|
2806
2817
|
return this.callNow(this.parseAssign, this.recordInlineTableValue);
|
|
2807
2818
|
}
|
|
2808
2819
|
}
|
|
2809
|
-
recordInlineTableValue(
|
|
2810
|
-
let
|
|
2811
|
-
let
|
|
2812
|
-
for (let
|
|
2813
|
-
if (hasKey(
|
|
2814
|
-
|
|
2820
|
+
recordInlineTableValue(kv) {
|
|
2821
|
+
let target = this.state.resultTable;
|
|
2822
|
+
let finalKey = kv.key.pop();
|
|
2823
|
+
for (let kw of kv.key){
|
|
2824
|
+
if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) throw this.error(new TomlError("Can't redefine existing key"));
|
|
2825
|
+
target = target[kw] = target[kw] || Table();
|
|
2815
2826
|
}
|
|
2816
|
-
if (hasKey(
|
|
2817
|
-
if (isInteger(
|
|
2818
|
-
else
|
|
2827
|
+
if (hasKey(target, finalKey)) throw this.error(new TomlError("Can't redefine existing key"));
|
|
2828
|
+
if (isInteger(kv.value) || isFloat(kv.value)) target[finalKey] = kv.value.valueOf();
|
|
2829
|
+
else target[finalKey] = kv.value;
|
|
2819
2830
|
return this.goto(this.parseInlineTableNext);
|
|
2820
2831
|
}
|
|
2821
2832
|
parseInlineTableNext() {
|
|
2822
2833
|
if (this.char === CHAR_SP || this.char === CTRL_I) return null;
|
|
2823
|
-
else if (this.char ===
|
|
2834
|
+
else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) throw this.error(new TomlError("Unterminated inline array"));
|
|
2824
2835
|
else if (this.char === CHAR_COMMA) return this.next(this.parseInlineTable);
|
|
2825
2836
|
else if (this.char === CHAR_RCUB) return this.goto(this.parseInlineTable);
|
|
2826
2837
|
else throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"));
|
|
2827
2838
|
}
|
|
2828
2839
|
}
|
|
2829
|
-
return
|
|
2840
|
+
return TOMLParser;
|
|
2830
2841
|
}
|
|
2831
2842
|
|
|
2832
2843
|
});
|
|
@@ -31136,11 +31147,11 @@ const $69e4bed225e2da9c$var$isEmptyString = (val)=>val === "" || val === "./";
|
|
|
31136
31147
|
if (options.onResult) options.onResult(state);
|
|
31137
31148
|
items.push(state.output);
|
|
31138
31149
|
};
|
|
31139
|
-
let matches = $69e4bed225e2da9c$var$micromatch(list, patterns, {
|
|
31150
|
+
let matches = new Set($69e4bed225e2da9c$var$micromatch(list, patterns, {
|
|
31140
31151
|
...options,
|
|
31141
31152
|
onResult: onResult
|
|
31142
|
-
});
|
|
31143
|
-
for (let item of items)if (!matches.
|
|
31153
|
+
}));
|
|
31154
|
+
for (let item of items)if (!matches.has(item)) result.add(item);
|
|
31144
31155
|
return [
|
|
31145
31156
|
...result
|
|
31146
31157
|
];
|
|
@@ -31344,7 +31355,7 @@ const $69e4bed225e2da9c$var$isEmptyString = (val)=>val === "" || val === "./";
|
|
|
31344
31355
|
*
|
|
31345
31356
|
* ```js
|
|
31346
31357
|
* const mm = require('micromatch');
|
|
31347
|
-
* const state = mm(pattern[, options]);
|
|
31358
|
+
* const state = mm.parse(pattern[, options]);
|
|
31348
31359
|
* ```
|
|
31349
31360
|
* @param {String} `glob`
|
|
31350
31361
|
* @param {Object} `options`
|
|
@@ -33435,11 +33446,11 @@ const $3f4e287414e2d74a$var$isEmptyString = (val)=>val === "" || val === "./";
|
|
|
33435
33446
|
if (options.onResult) options.onResult(state);
|
|
33436
33447
|
items.push(state.output);
|
|
33437
33448
|
};
|
|
33438
|
-
let matches = $3f4e287414e2d74a$var$micromatch(list, patterns, {
|
|
33449
|
+
let matches = new Set($3f4e287414e2d74a$var$micromatch(list, patterns, {
|
|
33439
33450
|
...options,
|
|
33440
33451
|
onResult: onResult
|
|
33441
|
-
});
|
|
33442
|
-
for (let item of items)if (!matches.
|
|
33452
|
+
}));
|
|
33453
|
+
for (let item of items)if (!matches.has(item)) result.add(item);
|
|
33443
33454
|
return [
|
|
33444
33455
|
...result
|
|
33445
33456
|
];
|
|
@@ -33643,7 +33654,7 @@ const $3f4e287414e2d74a$var$isEmptyString = (val)=>val === "" || val === "./";
|
|
|
33643
33654
|
*
|
|
33644
33655
|
* ```js
|
|
33645
33656
|
* const mm = require('micromatch');
|
|
33646
|
-
* const state = mm(pattern[, options]);
|
|
33657
|
+
* const state = mm.parse(pattern[, options]);
|
|
33647
33658
|
* ```
|
|
33648
33659
|
* @param {String} `glob`
|
|
33649
33660
|
* @param {Object} `options`
|