@mnemonik/cli 7.114.2 → 7.115.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/dist/auth/credentials.js +587 -131
- package/dist/auth/index.js +587 -131
- package/dist/auth/installSession.js +587 -131
- package/dist/auth/status.js +587 -131
- package/dist/diagnostics.js +587 -131
- package/dist/digests.json +34 -34
- package/dist/identity/migrate.js +587 -131
- package/dist/install/hosts.js +587 -131
- package/dist/install/journal.js +587 -131
- package/dist/install/journey.js +587 -131
- package/dist/install/ownership.js +587 -131
- package/dist/install/transaction.js +587 -131
- package/dist/install/ui.js +587 -131
- package/dist/installSession.js +587 -131
- package/dist/installation.js +587 -131
- package/dist/launcher.js +587 -131
- package/dist/preflight.js +587 -131
- package/dist/project/eligibility.js +587 -131
- package/dist/project/records.js +587 -131
- package/dist/project.js +587 -131
- package/dist/router.js +587 -131
- package/dist/runtime/releaseSource.js +587 -131
- package/dist/runtime/selfUpdate.js +587 -131
- package/dist/runtime/updateCheck.js +587 -131
- package/dist/sbom.json +37 -37
- package/dist/scanner/control.js +587 -131
- package/dist/scanner/data.js +587 -131
- package/dist/scanner/discover.js +587 -131
- package/dist/scanner/enable.js +587 -131
- package/dist/scanner/picker.js +587 -131
- package/dist/scanner/service.js +587 -131
- package/dist/scanner/update.js +587 -131
- package/dist/scanner-release.json +29 -29
- package/dist/status.js +1067 -499
- package/dist/vendor/local-setup.js +587 -131
- package/package.json +43 -43
package/dist/status.js
CHANGED
|
@@ -53,13 +53,15 @@ var require_ignore = __commonJS({
|
|
|
53
53
|
var EMPTY = "";
|
|
54
54
|
var SPACE = " ";
|
|
55
55
|
var ESCAPE = "\\";
|
|
56
|
-
var
|
|
56
|
+
var REGEX_LITERAL_SPECIAL = /[.*+?()[\]{}^$|\\/]/;
|
|
57
|
+
var BOM = "\uFEFF";
|
|
57
58
|
var REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/;
|
|
58
59
|
var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
|
|
59
60
|
var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
|
|
60
61
|
var REGEX_SPLITALL_CRLF = /\r?\n/g;
|
|
61
|
-
var
|
|
62
|
-
var
|
|
62
|
+
var DOUBLE_SLASH = "//";
|
|
63
|
+
var SLASH_CODE = 47;
|
|
64
|
+
var DOT_CODE = 46;
|
|
63
65
|
var SLASH = "/";
|
|
64
66
|
var TMP_KEY_IGNORE = "node-ignore";
|
|
65
67
|
if (typeof Symbol !== "undefined") {
|
|
@@ -70,44 +72,173 @@ var require_ignore = __commonJS({
|
|
|
70
72
|
Object.defineProperty(object2, key, { value });
|
|
71
73
|
return value;
|
|
72
74
|
};
|
|
73
|
-
var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
|
|
74
75
|
var RETURN_FALSE = () => false;
|
|
75
|
-
var sanitizeRange = (range) => range.replace(
|
|
76
|
-
REGEX_REGEXP_RANGE,
|
|
77
|
-
(match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match : EMPTY
|
|
78
|
-
);
|
|
79
|
-
var negateRange = (range) => range.startsWith("!") || range.startsWith("\\^") ? `^${range.slice(range[0] === "!" ? 1 : 2)}` : range;
|
|
80
76
|
var cleanRangeBackSlash = (slashes) => {
|
|
81
77
|
const { length } = slashes;
|
|
82
78
|
return slashes.slice(0, length - length % 2);
|
|
83
79
|
};
|
|
80
|
+
var POSIX_CLASSES = {
|
|
81
|
+
alnum: "0-9A-Za-z",
|
|
82
|
+
alpha: "A-Za-z",
|
|
83
|
+
blank: " \\t",
|
|
84
|
+
cntrl: "\\x00-\\x1f\\x7f",
|
|
85
|
+
digit: "0-9",
|
|
86
|
+
graph: "!-.0-~",
|
|
87
|
+
lower: "a-z",
|
|
88
|
+
print: " -.0-~",
|
|
89
|
+
punct: "!-.:-@\\[-`{-~",
|
|
90
|
+
// git's `sane-ctype.h` classifies \v and \f as control, not space,
|
|
91
|
+
// unlike C's `isspace`
|
|
92
|
+
space: " \\t\\n\\r",
|
|
93
|
+
upper: "A-Z",
|
|
94
|
+
xdigit: "0-9A-Fa-f"
|
|
95
|
+
};
|
|
96
|
+
var CLASS_MEMBERS_TO_ESCAPE = "\\]^-[";
|
|
97
|
+
var escapeMember = (char) => CLASS_MEMBERS_TO_ESCAPE.indexOf(char) < 0 ? char : ESCAPE + char;
|
|
98
|
+
var NON_SLASH = "(?!\\/)";
|
|
99
|
+
var classSource = (negated, body2) => {
|
|
100
|
+
if (negated) {
|
|
101
|
+
return `[^\\/${body2}]`;
|
|
102
|
+
}
|
|
103
|
+
const source = `[${body2}]`;
|
|
104
|
+
return new RegExp(source).test("/") ? NON_SLASH + source : source;
|
|
105
|
+
};
|
|
106
|
+
var scanBracket = (pattern, start2) => {
|
|
107
|
+
const { length } = pattern;
|
|
108
|
+
let index = start2 + 1;
|
|
109
|
+
let negated = EMPTY;
|
|
110
|
+
const lead = pattern[index];
|
|
111
|
+
if (lead === "!" || lead === "^") {
|
|
112
|
+
negated = "^";
|
|
113
|
+
index++;
|
|
114
|
+
}
|
|
115
|
+
let body2 = EMPTY;
|
|
116
|
+
let prev = EMPTY;
|
|
117
|
+
for (; ; ) {
|
|
118
|
+
const char = pattern[index];
|
|
119
|
+
if (char === UNDEFINED) {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
if (char === ESCAPE) {
|
|
123
|
+
const escaped = pattern[index + 1];
|
|
124
|
+
if (escaped === UNDEFINED) {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
body2 += escapeMember(escaped);
|
|
128
|
+
prev = escaped;
|
|
129
|
+
index++;
|
|
130
|
+
} else if (char === "-" && prev && index + 1 < length && pattern[index + 1] !== "]") {
|
|
131
|
+
index++;
|
|
132
|
+
let to = pattern[index];
|
|
133
|
+
if (to === ESCAPE) {
|
|
134
|
+
to = pattern[index += 1];
|
|
135
|
+
}
|
|
136
|
+
if (prev <= to) {
|
|
137
|
+
body2 += `-${escapeMember(to)}`;
|
|
138
|
+
}
|
|
139
|
+
prev = EMPTY;
|
|
140
|
+
} else if (char === "[" && pattern[index + 1] === ":") {
|
|
141
|
+
const nameStart = index + 2;
|
|
142
|
+
let end = nameStart;
|
|
143
|
+
while (end < length && pattern[end] !== "]") {
|
|
144
|
+
end++;
|
|
145
|
+
}
|
|
146
|
+
if (end === length) {
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
if (end > nameStart && pattern[end - 1] === ":") {
|
|
150
|
+
const expanded = POSIX_CLASSES[pattern.slice(nameStart, end - 1)];
|
|
151
|
+
if (expanded === UNDEFINED) {
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
body2 += expanded;
|
|
155
|
+
prev = EMPTY;
|
|
156
|
+
index = end;
|
|
157
|
+
} else {
|
|
158
|
+
body2 += escapeMember("[");
|
|
159
|
+
prev = "[";
|
|
160
|
+
index = nameStart - 2;
|
|
161
|
+
}
|
|
162
|
+
} else {
|
|
163
|
+
body2 += escapeMember(char);
|
|
164
|
+
prev = char;
|
|
165
|
+
}
|
|
166
|
+
index++;
|
|
167
|
+
if (pattern[index] === "]") {
|
|
168
|
+
return {
|
|
169
|
+
end: index,
|
|
170
|
+
source: classSource(negated, body2)
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
var NEVER_MATCH = "[]";
|
|
176
|
+
var PLACEHOLDER = "\0";
|
|
177
|
+
var REGEX_RESTORE_PLACEHOLDER = new RegExp(
|
|
178
|
+
`${PLACEHOLDER}(\\d+)${PLACEHOLDER}`,
|
|
179
|
+
"g"
|
|
180
|
+
);
|
|
181
|
+
var TRAILING_WILDCARD = "\uE000";
|
|
182
|
+
var TRAILING_DOUBLESTAR = "\uE001";
|
|
183
|
+
var extractBrackets = (pattern) => {
|
|
184
|
+
const sources = [];
|
|
185
|
+
const hold = (source) => `${PLACEHOLDER}${sources.push(source) - 1}${PLACEHOLDER}`;
|
|
186
|
+
const { length } = pattern;
|
|
187
|
+
let out2 = EMPTY;
|
|
188
|
+
let index = 0;
|
|
189
|
+
while (index < length) {
|
|
190
|
+
const char = pattern[index];
|
|
191
|
+
if (char === ESCAPE) {
|
|
192
|
+
const escaped = pattern[index + 1];
|
|
193
|
+
if (escaped === UNDEFINED || escaped === SLASH && index + 2 === length) {
|
|
194
|
+
out2 += hold(NEVER_MATCH);
|
|
195
|
+
} else if (escaped === "*" || escaped === "[" || escaped === SPACE || escaped === ESCAPE) {
|
|
196
|
+
out2 += pattern.slice(index, index + 2);
|
|
197
|
+
} else {
|
|
198
|
+
out2 += hold(
|
|
199
|
+
REGEX_LITERAL_SPECIAL.test(escaped) ? ESCAPE + escaped : escaped
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
index += 2;
|
|
203
|
+
} else if (char === PLACEHOLDER) {
|
|
204
|
+
out2 += hold(`[${PLACEHOLDER}]`);
|
|
205
|
+
index++;
|
|
206
|
+
} else if (char === "[") {
|
|
207
|
+
const scanned = scanBracket(pattern, index);
|
|
208
|
+
if (scanned === null) {
|
|
209
|
+
out2 += hold(NEVER_MATCH);
|
|
210
|
+
index = length;
|
|
211
|
+
} else {
|
|
212
|
+
out2 += hold(scanned.source);
|
|
213
|
+
index = scanned.end + 1;
|
|
214
|
+
}
|
|
215
|
+
} else {
|
|
216
|
+
out2 += char;
|
|
217
|
+
index++;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return {
|
|
221
|
+
source: out2,
|
|
222
|
+
sources
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
var DIRECT = null;
|
|
226
|
+
var REGEX_INNER_SLASH = /\/(?!$)/;
|
|
84
227
|
var REPLACERS = [
|
|
85
|
-
[
|
|
86
|
-
// Remove BOM
|
|
87
|
-
// TODO:
|
|
88
|
-
// Other similar zero-width characters?
|
|
89
|
-
/^\uFEFF/,
|
|
90
|
-
() => EMPTY
|
|
91
|
-
],
|
|
92
|
-
// > Trailing spaces are ignored unless they are quoted with backslash ("\")
|
|
93
|
-
[
|
|
94
|
-
// (a\ ) -> (a )
|
|
95
|
-
// (a ) -> (a)
|
|
96
|
-
// (a ) -> (a)
|
|
97
|
-
// (a \ ) -> (a )
|
|
98
|
-
/((?:\\\\)*?)(\\?\s+)$/,
|
|
99
|
-
(_, m1, m2) => m1 + (m2.indexOf("\\") === 0 ? SPACE : EMPTY)
|
|
100
|
-
],
|
|
101
228
|
// Replace (\ ) with ' '
|
|
229
|
+
// Only a space: an escaped tab or other whitespace is already a literal by
|
|
230
|
+
// the time it reaches here, and a bare tab must be left as one, not turned
|
|
231
|
+
// into a space.
|
|
102
232
|
// (\ ) -> ' '
|
|
103
233
|
// (\\ ) -> '\\ '
|
|
104
234
|
// (\\\ ) -> '\\ '
|
|
105
235
|
[
|
|
106
|
-
|
|
107
|
-
(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
236
|
+
// A run of backslashes is taken whole, from its first one, so no match
|
|
237
|
+
// ever starts again inside it -- `(\\+?) ` did, which made a long run
|
|
238
|
+
// quadratic.
|
|
239
|
+
/(\\+)( ?)/g,
|
|
240
|
+
(_, run2, space) => space ? run2.slice(0, run2.length - run2.length % 2) + SPACE : run2,
|
|
241
|
+
ESCAPE + SPACE
|
|
111
242
|
],
|
|
112
243
|
// Escape metacharacters
|
|
113
244
|
// which is written down by users but means special for regular expressions.
|
|
@@ -132,7 +263,8 @@ var require_ignore = __commonJS({
|
|
|
132
263
|
[
|
|
133
264
|
// > a question mark (?) matches a single character
|
|
134
265
|
/(?!\\)\?/g,
|
|
135
|
-
() => "[^/]"
|
|
266
|
+
() => "[^/]",
|
|
267
|
+
"?"
|
|
136
268
|
],
|
|
137
269
|
// leading slash
|
|
138
270
|
[
|
|
@@ -140,12 +272,14 @@ var require_ignore = __commonJS({
|
|
|
140
272
|
// > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
|
|
141
273
|
// A leading slash matches the beginning of the pathname
|
|
142
274
|
/^\//,
|
|
143
|
-
() => "^"
|
|
275
|
+
() => "^",
|
|
276
|
+
SLASH
|
|
144
277
|
],
|
|
145
278
|
// replace special metacharacter slash after the leading slash
|
|
146
279
|
[
|
|
147
280
|
/\//g,
|
|
148
|
-
() => "\\/"
|
|
281
|
+
() => "\\/",
|
|
282
|
+
SLASH
|
|
149
283
|
],
|
|
150
284
|
[
|
|
151
285
|
// > A leading "**" followed by a slash means match in all directories.
|
|
@@ -156,16 +290,21 @@ var require_ignore = __commonJS({
|
|
|
156
290
|
// Notice that the '*'s have been replaced as '\\*'
|
|
157
291
|
/^\^*(?:\\\*\\\*\\\/)+/,
|
|
158
292
|
// '**/foo' <-> 'foo'
|
|
159
|
-
() => "^(?:.*\\/)?"
|
|
293
|
+
() => "^(?:.*\\/)?",
|
|
294
|
+
"*"
|
|
160
295
|
],
|
|
161
296
|
// starting
|
|
162
297
|
[
|
|
163
298
|
// there will be no leading '/'
|
|
164
299
|
// (which has been replaced by section "leading slash")
|
|
165
300
|
// If starts with '**', adding a '^' to the regular expression also works
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
301
|
+
DIRECT,
|
|
302
|
+
(source, pattern) => {
|
|
303
|
+
if (!source || source[0] === "^") {
|
|
304
|
+
return source;
|
|
305
|
+
}
|
|
306
|
+
const anchor = !REGEX_INNER_SLASH.test(pattern) ? "(?:^|\\/)" : "^";
|
|
307
|
+
return anchor + source;
|
|
169
308
|
}
|
|
170
309
|
],
|
|
171
310
|
// two globstars
|
|
@@ -175,7 +314,8 @@ var require_ignore = __commonJS({
|
|
|
175
314
|
// Zero, one or several directories
|
|
176
315
|
// should not use '*', or it will be replaced by the next replacer
|
|
177
316
|
// Check if it is not the last `'/**'`
|
|
178
|
-
(_, index, str) => index + 6 < str.length ? "(?:\\/[^\\/]+)
|
|
317
|
+
(_, index, str) => index + 6 < str.length ? str.slice(index + 6) === "\\/" ? "(?:\\/[^\\/]+)+" : "(?:\\/[^\\/]+)*" : `\\/${TRAILING_DOUBLESTAR}`,
|
|
318
|
+
"*"
|
|
179
319
|
],
|
|
180
320
|
// normal intermediate wildcards
|
|
181
321
|
[
|
|
@@ -190,32 +330,56 @@ var require_ignore = __commonJS({
|
|
|
190
330
|
(_, p1, p2) => {
|
|
191
331
|
const unescaped = p2.replace(/\\\*/g, "[^\\/]*");
|
|
192
332
|
return p1 + unescaped;
|
|
193
|
-
}
|
|
333
|
+
},
|
|
334
|
+
"*"
|
|
335
|
+
],
|
|
336
|
+
// trailing wildcard, held apart from a literal star
|
|
337
|
+
[
|
|
338
|
+
// The step above leaves a trailing `*` alone, so a single `\*` is all that
|
|
339
|
+
// can be left at the end here. Whether it is a wildcard or a literal
|
|
340
|
+
// turns on the backslashes the user put in front of it: the escaper has
|
|
341
|
+
// since doubled every one, so what stands here is those `2N` doubled
|
|
342
|
+
// backslashes and then the star's own escape. An even number of the
|
|
343
|
+
// original `N` leaves the star unescaped -- a wildcard -- and an odd
|
|
344
|
+
// number escapes it -- a literal. This runs while the two are still
|
|
345
|
+
// distinct, before the unescape steps below collapse the literal onto
|
|
346
|
+
// the very `\*` a wildcard leaves behind.
|
|
347
|
+
/(^|[^\\])((?:\\\\)*)\\\*$/,
|
|
348
|
+
(match, p1, p2) => (
|
|
349
|
+
// `p2` holds the doubled user backslashes; half of them is `N`.
|
|
350
|
+
p2.length / 2 % 2 === 0 ? p1 + p2 + TRAILING_WILDCARD : match
|
|
351
|
+
),
|
|
352
|
+
"*"
|
|
194
353
|
],
|
|
195
354
|
[
|
|
196
355
|
// unescape, revert step 3 except for back slash
|
|
197
356
|
// For example, if a user escape a '\\*',
|
|
198
357
|
// after step 3, the result will be '\\\\\\*'
|
|
199
358
|
/\\\\\\(?=[$.|*+(){^])/g,
|
|
200
|
-
() => ESCAPE
|
|
359
|
+
() => ESCAPE,
|
|
360
|
+
ESCAPE + ESCAPE
|
|
201
361
|
],
|
|
202
362
|
[
|
|
203
363
|
// '\\\\' -> '\\'
|
|
204
364
|
/\\\\/g,
|
|
205
|
-
() => ESCAPE
|
|
365
|
+
() => ESCAPE,
|
|
366
|
+
ESCAPE + ESCAPE
|
|
206
367
|
],
|
|
207
368
|
[
|
|
208
|
-
//
|
|
209
|
-
//
|
|
369
|
+
// Every real bracket expression -- POSIX classes included -- has already
|
|
370
|
+
// been held aside by `extractBrackets`, so the only `[` left in the
|
|
371
|
+
// pattern is an escaped, literal one.
|
|
210
372
|
// `\` is escaped by step 3
|
|
211
|
-
|
|
212
|
-
|
|
373
|
+
/\\\[([^\]/]*?)(\\*)($|\])/g,
|
|
374
|
+
// '\\[bar]' -> '\\\\[bar\\]'
|
|
375
|
+
(match, range, endEscape, close) => `\\[${range}${cleanRangeBackSlash(endEscape)}${close}`,
|
|
376
|
+
"["
|
|
213
377
|
],
|
|
214
378
|
// ending
|
|
215
379
|
[
|
|
216
380
|
// 'js' will not match 'js.'
|
|
217
381
|
// 'ab' will not match 'abc'
|
|
218
|
-
|
|
382
|
+
DIRECT,
|
|
219
383
|
// WTF!
|
|
220
384
|
// https://git-scm.com/docs/gitignore
|
|
221
385
|
// changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1)
|
|
@@ -226,29 +390,175 @@ var require_ignore = __commonJS({
|
|
|
226
390
|
// 'js*' will not match 'a.js'
|
|
227
391
|
// 'js/' will not match 'a.js'
|
|
228
392
|
// 'js' will match 'a.js' and 'a.js/'
|
|
229
|
-
(
|
|
393
|
+
(source) => {
|
|
394
|
+
const last = source[source.length - 1];
|
|
395
|
+
if (!last || last === TRAILING_WILDCARD || last === TRAILING_DOUBLESTAR) {
|
|
396
|
+
return source;
|
|
397
|
+
}
|
|
398
|
+
return last === SLASH ? `${source}$` : `${source}(?=$|\\/$)`;
|
|
399
|
+
}
|
|
230
400
|
]
|
|
231
401
|
];
|
|
232
|
-
var REGEX_REPLACE_TRAILING_WILDCARD = /(^|\\\/)
|
|
402
|
+
var REGEX_REPLACE_TRAILING_WILDCARD = /(^|\\\/)?\uE000$/;
|
|
233
403
|
var MODE_IGNORE = "regex";
|
|
234
404
|
var MODE_CHECK_IGNORE = "checkRegex";
|
|
235
405
|
var UNDERSCORE = "_";
|
|
236
|
-
var
|
|
237
|
-
[
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
406
|
+
var replaceTrailingWildcard = (_, p1) => {
|
|
407
|
+
const prefix = p1 ? `${p1}[^/]+` : "[^/]*";
|
|
408
|
+
return `${prefix}(?=$|\\/$)`;
|
|
409
|
+
};
|
|
410
|
+
var REGEX_REPLACE_TRAILING_DOUBLESTAR = /\uE001$/;
|
|
411
|
+
var replaceTrailingDoublestar = () => ".+(?=$|\\/$)";
|
|
412
|
+
var WILDCARD = "[^\\/]*";
|
|
413
|
+
var separatorAfter = (run2, at) => {
|
|
414
|
+
let separator = EMPTY;
|
|
415
|
+
for (let index = at + 1; index < run2.length && !run2[index].wildcard; index++) {
|
|
416
|
+
separator += run2[index].single;
|
|
417
|
+
}
|
|
418
|
+
return separator;
|
|
419
|
+
};
|
|
420
|
+
var pinWildcards = (source) => {
|
|
421
|
+
if (source.indexOf(WILDCARD) < 0) {
|
|
422
|
+
return source;
|
|
423
|
+
}
|
|
424
|
+
const tokens = [];
|
|
425
|
+
const { length } = source;
|
|
426
|
+
let index = 0;
|
|
427
|
+
while (index < length) {
|
|
428
|
+
const char = source[index];
|
|
429
|
+
if (source.startsWith(WILDCARD, index)) {
|
|
430
|
+
tokens.push({ wildcard: true });
|
|
431
|
+
index += WILDCARD.length;
|
|
432
|
+
} else if (char === "[") {
|
|
433
|
+
let end = index + 1;
|
|
434
|
+
if (source[end] === "^") {
|
|
435
|
+
end++;
|
|
436
|
+
}
|
|
437
|
+
if (source[end] === "]") {
|
|
438
|
+
end++;
|
|
439
|
+
}
|
|
440
|
+
while (end < length && source[end] !== "]") {
|
|
441
|
+
end += source[end] === ESCAPE ? 2 : 1;
|
|
442
|
+
}
|
|
443
|
+
end++;
|
|
444
|
+
tokens.push({ single: source.slice(index, end) });
|
|
445
|
+
index = end;
|
|
446
|
+
} else if (char === ESCAPE) {
|
|
447
|
+
tokens.push({ single: source.slice(index, index + 2) });
|
|
448
|
+
index += 2;
|
|
449
|
+
} else if (char === "(") {
|
|
450
|
+
let depth = 0;
|
|
451
|
+
let end = index;
|
|
452
|
+
do {
|
|
453
|
+
if (source[end] === ESCAPE) {
|
|
454
|
+
end++;
|
|
455
|
+
} else if (source[end] === "(") {
|
|
456
|
+
depth++;
|
|
457
|
+
} else if (source[end] === ")") {
|
|
458
|
+
depth--;
|
|
459
|
+
}
|
|
460
|
+
end++;
|
|
461
|
+
} while (end < length && depth > 0);
|
|
462
|
+
if ("*+?".indexOf(source[end]) >= 0) {
|
|
463
|
+
end++;
|
|
464
|
+
}
|
|
465
|
+
tokens.push({ boundary: source.slice(index, end) });
|
|
466
|
+
index = end;
|
|
467
|
+
} else if (char === "^" || char === "$") {
|
|
468
|
+
tokens.push({ boundary: char });
|
|
469
|
+
index++;
|
|
470
|
+
} else {
|
|
471
|
+
tokens.push({ single: char });
|
|
472
|
+
index++;
|
|
473
|
+
}
|
|
244
474
|
}
|
|
475
|
+
let out2 = EMPTY;
|
|
476
|
+
let run2 = [];
|
|
477
|
+
const flush = () => {
|
|
478
|
+
let lastWildcard;
|
|
479
|
+
run2.forEach((token, at) => {
|
|
480
|
+
if (token.wildcard) {
|
|
481
|
+
lastWildcard = at;
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
run2.forEach((token, at) => {
|
|
485
|
+
if (!token.wildcard) {
|
|
486
|
+
out2 += token.single;
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
out2 += at === lastWildcard ? WILDCARD : `(?:(?!${separatorAfter(run2, at)})[^\\/])*`;
|
|
490
|
+
});
|
|
491
|
+
run2 = [];
|
|
492
|
+
};
|
|
493
|
+
tokens.forEach((token) => {
|
|
494
|
+
if (token.boundary === void 0) {
|
|
495
|
+
run2.push(token);
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
flush();
|
|
499
|
+
out2 += token.boundary;
|
|
500
|
+
});
|
|
501
|
+
flush();
|
|
502
|
+
return out2;
|
|
503
|
+
};
|
|
504
|
+
var makeRegexPrefix = (pattern) => {
|
|
505
|
+
const { source, sources } = extractBrackets(pattern);
|
|
506
|
+
const replaced = REPLACERS.reduce(
|
|
507
|
+
// A pass whose matcher finds nothing hands back the very string it was
|
|
508
|
+
// given, so asking first costs a search and saves a rewrite. Ten of the
|
|
509
|
+
// fifteen passes never fire for a typical .gitignore line, and between
|
|
510
|
+
// them they were 45% of this chain.
|
|
511
|
+
(prev, [matcher, replacer, required]) => {
|
|
512
|
+
if (matcher === DIRECT) {
|
|
513
|
+
return replacer(prev, pattern);
|
|
514
|
+
}
|
|
515
|
+
if (required !== UNDEFINED && prev.indexOf(required) < 0) {
|
|
516
|
+
return prev;
|
|
517
|
+
}
|
|
518
|
+
return matcher.test(prev) ? prev.replace(matcher, replacer.bind(pattern)) : prev;
|
|
519
|
+
},
|
|
520
|
+
source
|
|
521
|
+
);
|
|
522
|
+
return sources.length ? replaced.replace(
|
|
523
|
+
REGEX_RESTORE_PLACEHOLDER,
|
|
524
|
+
(match, index) => sources[index]
|
|
525
|
+
) : replaced;
|
|
526
|
+
};
|
|
527
|
+
var checkSourceOf = (body2, prefix) => {
|
|
528
|
+
if (body2[body2.length - 1] === SLASH) {
|
|
529
|
+
prefix = makeRegexPrefix(body2.slice(0, -1));
|
|
530
|
+
}
|
|
531
|
+
const head = prefix.slice(0, -1);
|
|
532
|
+
const last = prefix[prefix.length - 1];
|
|
533
|
+
return last === TRAILING_WILDCARD ? `${head}$` : last === TRAILING_DOUBLESTAR ? `${head}.*$` : NEVER_MATCH;
|
|
534
|
+
};
|
|
535
|
+
var matchesBasename = (body2) => {
|
|
536
|
+
const index = body2.indexOf(SLASH);
|
|
537
|
+
return index < 0 || index === body2.length - 1;
|
|
538
|
+
};
|
|
539
|
+
var basenameOf = (path) => {
|
|
540
|
+
const end = path.length - 1;
|
|
541
|
+
const index = path.lastIndexOf(
|
|
542
|
+
SLASH,
|
|
543
|
+
path[end] === SLASH ? end - 1 : end
|
|
544
|
+
);
|
|
545
|
+
return index < 0 ? path : path.slice(index + 1);
|
|
546
|
+
};
|
|
547
|
+
var parentOf = (path) => {
|
|
548
|
+
if (path.charCodeAt(0) === SLASH_CODE || path.indexOf(DOUBLE_SLASH) >= 0) {
|
|
549
|
+
const slices = path.split(SLASH).filter(Boolean);
|
|
550
|
+
slices.pop();
|
|
551
|
+
return slices.length ? slices.join(SLASH) + SLASH : EMPTY;
|
|
552
|
+
}
|
|
553
|
+
const end = path.length - 1;
|
|
554
|
+
const cut = path.lastIndexOf(
|
|
555
|
+
SLASH,
|
|
556
|
+
path.charCodeAt(end) === SLASH_CODE ? end - 1 : end
|
|
557
|
+
);
|
|
558
|
+
return cut < 0 ? EMPTY : path.slice(0, cut + 1);
|
|
245
559
|
};
|
|
246
|
-
var makeRegexPrefix = (pattern) => REPLACERS.reduce(
|
|
247
|
-
(prev, [matcher, replacer]) => prev.replace(matcher, replacer.bind(pattern)),
|
|
248
|
-
pattern
|
|
249
|
-
);
|
|
250
560
|
var isString = (subject) => typeof subject === "string";
|
|
251
|
-
var checkPattern = (pattern) => pattern && isString(pattern) && !
|
|
561
|
+
var checkPattern = (pattern) => pattern && isString(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern);
|
|
252
562
|
var splitPattern = (pattern) => pattern.split(REGEX_SPLITALL_CRLF).filter(Boolean);
|
|
253
563
|
var IgnoreRule = class {
|
|
254
564
|
constructor(pattern, mark, body2, ignoreCase, negative, prefix) {
|
|
@@ -259,6 +569,14 @@ var require_ignore = __commonJS({
|
|
|
259
569
|
define(this, "ignoreCase", ignoreCase);
|
|
260
570
|
define(this, "regexPrefix", prefix);
|
|
261
571
|
}
|
|
572
|
+
// Worked out on first use and kept behind an own property, the way `regex`
|
|
573
|
+
// caches itself in `_regex`. Deciding it in the constructor instead would
|
|
574
|
+
// add a fourth `defineProperty` to every rule ever built, which cost 4% of
|
|
575
|
+
// every compile -- including the compiles of rules that are never matched
|
|
576
|
+
// against anything.
|
|
577
|
+
get _basenameOnly() {
|
|
578
|
+
return define(this, "_basenameOnly", matchesBasename(this.body));
|
|
579
|
+
}
|
|
262
580
|
get regex() {
|
|
263
581
|
const key = UNDERSCORE + MODE_IGNORE;
|
|
264
582
|
if (this[key]) {
|
|
@@ -274,24 +592,51 @@ var require_ignore = __commonJS({
|
|
|
274
592
|
return this._make(MODE_CHECK_IGNORE, key);
|
|
275
593
|
}
|
|
276
594
|
_make(mode, key) {
|
|
277
|
-
const str =
|
|
278
|
-
REGEX_REPLACE_TRAILING_WILDCARD,
|
|
279
|
-
// It does not need to bind pattern
|
|
280
|
-
TRAILING_WILD_CARD_REPLACERS[mode]
|
|
595
|
+
const str = pinWildcards(
|
|
596
|
+
mode === MODE_IGNORE ? this.regexPrefix.replace(REGEX_REPLACE_TRAILING_WILDCARD, replaceTrailingWildcard).replace(REGEX_REPLACE_TRAILING_DOUBLESTAR, replaceTrailingDoublestar) : checkSourceOf(this.body, this.regexPrefix)
|
|
281
597
|
);
|
|
282
598
|
const regex = this.ignoreCase ? new RegExp(str, "i") : new RegExp(str);
|
|
283
599
|
return define(this, key, regex);
|
|
284
600
|
}
|
|
285
601
|
};
|
|
602
|
+
var isLineEnd = (char) => char === "\r" || char === "\n";
|
|
603
|
+
var trimEnd = (body2) => {
|
|
604
|
+
let end = body2.length;
|
|
605
|
+
while (end && isLineEnd(body2[end - 1])) {
|
|
606
|
+
end--;
|
|
607
|
+
}
|
|
608
|
+
const lineEnd = end;
|
|
609
|
+
while (end && body2[end - 1] === SPACE) {
|
|
610
|
+
end--;
|
|
611
|
+
}
|
|
612
|
+
if (end === lineEnd) {
|
|
613
|
+
return body2.slice(0, end);
|
|
614
|
+
}
|
|
615
|
+
let backslashes = 0;
|
|
616
|
+
while (backslashes < end && body2[end - backslashes - 1] === ESCAPE) {
|
|
617
|
+
backslashes++;
|
|
618
|
+
}
|
|
619
|
+
return backslashes % 2 ? body2.slice(0, end - 1) + SPACE : body2.slice(0, end);
|
|
620
|
+
};
|
|
286
621
|
var createRule = ({
|
|
287
622
|
pattern,
|
|
288
623
|
mark
|
|
289
624
|
}, ignoreCase) => {
|
|
625
|
+
let body2 = pattern[0] === BOM ? pattern.slice(1) : pattern;
|
|
626
|
+
if (body2[0] === "#") {
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
290
629
|
let negative = false;
|
|
291
|
-
|
|
292
|
-
if (body2.indexOf("!") === 0) {
|
|
630
|
+
if (body2[0] === "!") {
|
|
293
631
|
negative = true;
|
|
294
|
-
body2 = body2.
|
|
632
|
+
body2 = body2.slice(1);
|
|
633
|
+
}
|
|
634
|
+
const last = body2[body2.length - 1];
|
|
635
|
+
if (last === SPACE || last === "\r" || last === "\n") {
|
|
636
|
+
body2 = trimEnd(body2);
|
|
637
|
+
}
|
|
638
|
+
if (!body2) {
|
|
639
|
+
return;
|
|
295
640
|
}
|
|
296
641
|
body2 = body2.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
|
|
297
642
|
const regexPrefix = makeRegexPrefix(body2);
|
|
@@ -308,10 +653,12 @@ var require_ignore = __commonJS({
|
|
|
308
653
|
constructor(ignoreCase) {
|
|
309
654
|
this._ignoreCase = ignoreCase;
|
|
310
655
|
this._rules = [];
|
|
656
|
+
this._basenameCount = 0;
|
|
311
657
|
}
|
|
312
658
|
_add(pattern) {
|
|
313
659
|
if (pattern && pattern[KEY_IGNORE]) {
|
|
314
660
|
this._rules = this._rules.concat(pattern._rules._rules);
|
|
661
|
+
this._basenameCount += pattern._rules._basenameCount;
|
|
315
662
|
this._added = true;
|
|
316
663
|
return;
|
|
317
664
|
}
|
|
@@ -320,10 +667,13 @@ var require_ignore = __commonJS({
|
|
|
320
667
|
pattern
|
|
321
668
|
};
|
|
322
669
|
}
|
|
323
|
-
|
|
324
|
-
|
|
670
|
+
const rule = checkPattern(pattern.pattern) && createRule(pattern, this._ignoreCase);
|
|
671
|
+
if (rule) {
|
|
325
672
|
this._added = true;
|
|
326
673
|
this._rules.push(rule);
|
|
674
|
+
if (matchesBasename(rule.body)) {
|
|
675
|
+
this._basenameCount++;
|
|
676
|
+
}
|
|
327
677
|
}
|
|
328
678
|
}
|
|
329
679
|
// @param {Array<string> | string | Ignore} pattern
|
|
@@ -332,8 +682,39 @@ var require_ignore = __commonJS({
|
|
|
332
682
|
makeArray(
|
|
333
683
|
isString(pattern) ? splitPattern(pattern) : pattern
|
|
334
684
|
).forEach(this._add, this);
|
|
685
|
+
if (this._added) {
|
|
686
|
+
this._literalRules = UNDEFINED;
|
|
687
|
+
}
|
|
335
688
|
return this._added;
|
|
336
689
|
}
|
|
690
|
+
// Match the literal 'abc/' for `checkIgnore`, last rule wins. Only a rule
|
|
691
|
+
// ending in a wildcard can match it (see `checkSourceOf`), so the rest
|
|
692
|
+
// are left out once, rather than tested or compiled for every path.
|
|
693
|
+
testLiteral(path) {
|
|
694
|
+
const rules = this._literalRules || (this._literalRules = this._rules.filter(
|
|
695
|
+
({ body: body2 }) => body2[body2.length - (body2[body2.length - 1] === SLASH ? 2 : 1)] === "*"
|
|
696
|
+
));
|
|
697
|
+
let ignored = false;
|
|
698
|
+
let unignored = false;
|
|
699
|
+
let matchedRule;
|
|
700
|
+
for (let index = rules.length - 1; index >= 0; index--) {
|
|
701
|
+
const rule = rules[index];
|
|
702
|
+
if (rule.checkRegex.test(path)) {
|
|
703
|
+
ignored = !rule.negative;
|
|
704
|
+
unignored = rule.negative;
|
|
705
|
+
matchedRule = rule.negative ? UNDEFINED : rule;
|
|
706
|
+
break;
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
const ret = {
|
|
710
|
+
ignored,
|
|
711
|
+
unignored
|
|
712
|
+
};
|
|
713
|
+
if (matchedRule) {
|
|
714
|
+
ret.rule = matchedRule;
|
|
715
|
+
}
|
|
716
|
+
return ret;
|
|
717
|
+
}
|
|
337
718
|
// Test one single path without recursively checking parent directories
|
|
338
719
|
//
|
|
339
720
|
// - checkUnignored `boolean` whether should check if the path is unignored,
|
|
@@ -345,19 +726,22 @@ var require_ignore = __commonJS({
|
|
|
345
726
|
let ignored = false;
|
|
346
727
|
let unignored = false;
|
|
347
728
|
let matchedRule;
|
|
348
|
-
this._rules
|
|
729
|
+
const rules = this._rules;
|
|
730
|
+
const { length } = rules;
|
|
731
|
+
const shortcut = this._basenameCount * 2 >= length;
|
|
732
|
+
const basename4 = shortcut ? basenameOf(path) : path;
|
|
733
|
+
for (let index = 0; index < length; index++) {
|
|
734
|
+
const rule = rules[index];
|
|
349
735
|
const { negative } = rule;
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
736
|
+
const skip = unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored;
|
|
737
|
+
if (!skip && rule[mode].test(
|
|
738
|
+
shortcut && rule._basenameOnly ? basename4 : path
|
|
739
|
+
)) {
|
|
740
|
+
ignored = !negative;
|
|
741
|
+
unignored = negative;
|
|
742
|
+
matchedRule = negative ? UNDEFINED : rule;
|
|
356
743
|
}
|
|
357
|
-
|
|
358
|
-
unignored = negative;
|
|
359
|
-
matchedRule = negative ? UNDEFINED : rule;
|
|
360
|
-
});
|
|
744
|
+
}
|
|
361
745
|
const ret = {
|
|
362
746
|
ignored,
|
|
363
747
|
unignored
|
|
@@ -390,7 +774,26 @@ var require_ignore = __commonJS({
|
|
|
390
774
|
}
|
|
391
775
|
return true;
|
|
392
776
|
};
|
|
393
|
-
var isNotRelative = (path) =>
|
|
777
|
+
var isNotRelative = (path) => {
|
|
778
|
+
const first = path.charCodeAt(0);
|
|
779
|
+
if (first === SLASH_CODE) {
|
|
780
|
+
return true;
|
|
781
|
+
}
|
|
782
|
+
if (first !== DOT_CODE) {
|
|
783
|
+
return false;
|
|
784
|
+
}
|
|
785
|
+
if (path.length === 1) {
|
|
786
|
+
return true;
|
|
787
|
+
}
|
|
788
|
+
const second = path.charCodeAt(1);
|
|
789
|
+
if (second === SLASH_CODE) {
|
|
790
|
+
return true;
|
|
791
|
+
}
|
|
792
|
+
if (second !== DOT_CODE) {
|
|
793
|
+
return false;
|
|
794
|
+
}
|
|
795
|
+
return path.length === 2 || path.charCodeAt(2) === SLASH_CODE;
|
|
796
|
+
};
|
|
394
797
|
checkPath.isNotRelative = isNotRelative;
|
|
395
798
|
checkPath.convert = (p) => p;
|
|
396
799
|
var Ignore = class {
|
|
@@ -419,52 +822,33 @@ var require_ignore = __commonJS({
|
|
|
419
822
|
return this.add(pattern);
|
|
420
823
|
}
|
|
421
824
|
// @returns {TestResult}
|
|
422
|
-
_test(originalPath, cache, checkUnignored
|
|
825
|
+
_test(originalPath, cache, checkUnignored) {
|
|
423
826
|
const path = originalPath && checkPath.convert(originalPath);
|
|
424
827
|
checkPath(
|
|
425
828
|
path,
|
|
426
829
|
originalPath,
|
|
427
830
|
this._strictPathCheck ? throwError : RETURN_FALSE
|
|
428
831
|
);
|
|
429
|
-
return this._t(path, cache, checkUnignored
|
|
832
|
+
return this._t(path, cache, checkUnignored);
|
|
430
833
|
}
|
|
431
834
|
checkIgnore(path) {
|
|
432
|
-
if (
|
|
835
|
+
if (path.charCodeAt(path.length - 1) !== SLASH_CODE) {
|
|
433
836
|
return this.test(path);
|
|
434
837
|
}
|
|
435
|
-
const
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
const parent = this._t(
|
|
439
|
-
slices.join(SLASH) + SLASH,
|
|
440
|
-
this._testCache,
|
|
441
|
-
true,
|
|
442
|
-
slices
|
|
443
|
-
);
|
|
444
|
-
if (parent.ignored) {
|
|
445
|
-
return parent;
|
|
446
|
-
}
|
|
838
|
+
const dir = this._t(path, this._testCache, true);
|
|
839
|
+
if (dir.ignored) {
|
|
840
|
+
return dir;
|
|
447
841
|
}
|
|
448
|
-
|
|
842
|
+
const literal = this._rules.testLiteral(path);
|
|
843
|
+
return literal.ignored || literal.unignored ? literal : dir;
|
|
449
844
|
}
|
|
450
|
-
_t(path, cache, checkUnignored
|
|
845
|
+
_t(path, cache, checkUnignored) {
|
|
451
846
|
if (path in cache) {
|
|
452
847
|
return cache[path];
|
|
453
848
|
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
slices.pop();
|
|
458
|
-
if (!slices.length) {
|
|
459
|
-
return cache[path] = this._rules.test(path, checkUnignored, MODE_IGNORE);
|
|
460
|
-
}
|
|
461
|
-
const parent = this._t(
|
|
462
|
-
slices.join(SLASH) + SLASH,
|
|
463
|
-
cache,
|
|
464
|
-
checkUnignored,
|
|
465
|
-
slices
|
|
466
|
-
);
|
|
467
|
-
return cache[path] = parent.ignored ? parent : this._rules.test(path, checkUnignored, MODE_IGNORE);
|
|
849
|
+
const parentPath = parentOf(path);
|
|
850
|
+
const parent = parentPath ? this._t(parentPath, cache, checkUnignored) : UNDEFINED;
|
|
851
|
+
return cache[path] = parent && parent.ignored ? parent : this._rules.test(path, checkUnignored, MODE_IGNORE);
|
|
468
852
|
}
|
|
469
853
|
ignores(path) {
|
|
470
854
|
return this._test(path, this._ignoreCache, false).ignored;
|
|
@@ -2478,6 +2862,18 @@ function setModule(module2) {
|
|
|
2478
2862
|
}
|
|
2479
2863
|
__name(setModule, "setModule");
|
|
2480
2864
|
var C;
|
|
2865
|
+
function newFinalizer(handler) {
|
|
2866
|
+
try {
|
|
2867
|
+
return new FinalizationRegistry(handler);
|
|
2868
|
+
} catch (e) {
|
|
2869
|
+
console.error("Unsupported FinalizationRegistry:", e);
|
|
2870
|
+
return;
|
|
2871
|
+
}
|
|
2872
|
+
}
|
|
2873
|
+
__name(newFinalizer, "newFinalizer");
|
|
2874
|
+
var finalizer = newFinalizer((address) => {
|
|
2875
|
+
C._ts_lookahead_iterator_delete(address);
|
|
2876
|
+
});
|
|
2481
2877
|
var LookaheadIterator = class {
|
|
2482
2878
|
static {
|
|
2483
2879
|
__name(this, "LookaheadIterator");
|
|
@@ -2488,21 +2884,39 @@ var LookaheadIterator = class {
|
|
|
2488
2884
|
/** @internal */
|
|
2489
2885
|
language;
|
|
2490
2886
|
/** @internal */
|
|
2887
|
+
positioned = false;
|
|
2888
|
+
/** @internal */
|
|
2491
2889
|
constructor(internal, address, language) {
|
|
2492
2890
|
assertInternal(internal);
|
|
2493
2891
|
this[0] = address;
|
|
2494
2892
|
this.language = language;
|
|
2893
|
+
finalizer?.register(this, address, this);
|
|
2495
2894
|
}
|
|
2496
|
-
/**
|
|
2895
|
+
/**
|
|
2896
|
+
* Get the current symbol of the lookahead iterator.
|
|
2897
|
+
*
|
|
2898
|
+
* Returns `null` if the iterator is not positioned on a symbol:
|
|
2899
|
+
*
|
|
2900
|
+
* - Before the first iteration step
|
|
2901
|
+
* - After the iterator is exhausted
|
|
2902
|
+
* - After a {@link reset} or {@link resetState} call
|
|
2903
|
+
*/
|
|
2497
2904
|
get currentTypeId() {
|
|
2498
|
-
return C._ts_lookahead_iterator_current_symbol(this[0]);
|
|
2905
|
+
return this.positioned ? C._ts_lookahead_iterator_current_symbol(this[0]) : null;
|
|
2499
2906
|
}
|
|
2500
|
-
/**
|
|
2907
|
+
/**
|
|
2908
|
+
* Get the current symbol name of the lookahead iterator.
|
|
2909
|
+
*
|
|
2910
|
+
* Returns `null` if the iterator is not positioned on a symbol.
|
|
2911
|
+
*/
|
|
2501
2912
|
get currentType() {
|
|
2502
|
-
|
|
2913
|
+
const id = this.currentTypeId;
|
|
2914
|
+
if (id === null) return null;
|
|
2915
|
+
return this.language.types[id] ?? C.UTF8ToString(C._ts_language_symbol_name(this.language[0], id));
|
|
2503
2916
|
}
|
|
2504
2917
|
/** Delete the lookahead iterator, freeing its resources. */
|
|
2505
2918
|
delete() {
|
|
2919
|
+
finalizer?.unregister(this);
|
|
2506
2920
|
C._ts_lookahead_iterator_delete(this[0]);
|
|
2507
2921
|
this[0] = 0;
|
|
2508
2922
|
}
|
|
@@ -2515,6 +2929,7 @@ var LookaheadIterator = class {
|
|
|
2515
2929
|
reset(language, stateId) {
|
|
2516
2930
|
if (C._ts_lookahead_iterator_reset(this[0], language[0], stateId)) {
|
|
2517
2931
|
this.language = language;
|
|
2932
|
+
this.positioned = false;
|
|
2518
2933
|
return true;
|
|
2519
2934
|
}
|
|
2520
2935
|
return false;
|
|
@@ -2526,7 +2941,9 @@ var LookaheadIterator = class {
|
|
|
2526
2941
|
* `false` otherwise.
|
|
2527
2942
|
*/
|
|
2528
2943
|
resetState(stateId) {
|
|
2529
|
-
|
|
2944
|
+
if (!C._ts_lookahead_iterator_reset_state(this[0], stateId)) return false;
|
|
2945
|
+
this.positioned = false;
|
|
2946
|
+
return true;
|
|
2530
2947
|
}
|
|
2531
2948
|
/**
|
|
2532
2949
|
* Returns an iterator that iterates over the symbols of the lookahead iterator.
|
|
@@ -2537,10 +2954,9 @@ var LookaheadIterator = class {
|
|
|
2537
2954
|
[Symbol.iterator]() {
|
|
2538
2955
|
return {
|
|
2539
2956
|
next: /* @__PURE__ */ __name(() => {
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
}
|
|
2543
|
-
return { done: true, value: "" };
|
|
2957
|
+
this.positioned = Boolean(C._ts_lookahead_iterator_next(this[0]));
|
|
2958
|
+
const value = this.currentType;
|
|
2959
|
+
return value === null ? { done: true, value: "" } : { done: false, value };
|
|
2544
2960
|
}, "next")
|
|
2545
2961
|
};
|
|
2546
2962
|
}
|
|
@@ -2566,6 +2982,9 @@ function getText(tree, startIndex, endIndex, startPosition) {
|
|
|
2566
2982
|
return result ?? "";
|
|
2567
2983
|
}
|
|
2568
2984
|
__name(getText, "getText");
|
|
2985
|
+
var finalizer2 = newFinalizer((address) => {
|
|
2986
|
+
C._ts_tree_delete(address);
|
|
2987
|
+
});
|
|
2569
2988
|
var Tree = class _Tree {
|
|
2570
2989
|
static {
|
|
2571
2990
|
__name(this, "Tree");
|
|
@@ -2583,6 +3002,7 @@ var Tree = class _Tree {
|
|
|
2583
3002
|
this[0] = address;
|
|
2584
3003
|
this.language = language;
|
|
2585
3004
|
this.textCallback = textCallback;
|
|
3005
|
+
finalizer2?.register(this, address, this);
|
|
2586
3006
|
}
|
|
2587
3007
|
/** Create a shallow copy of the syntax tree. This is very fast. */
|
|
2588
3008
|
copy() {
|
|
@@ -2591,6 +3011,7 @@ var Tree = class _Tree {
|
|
|
2591
3011
|
}
|
|
2592
3012
|
/** Delete the syntax tree, freeing its resources. */
|
|
2593
3013
|
delete() {
|
|
3014
|
+
finalizer2?.unregister(this);
|
|
2594
3015
|
C._ts_tree_delete(this[0]);
|
|
2595
3016
|
this[0] = 0;
|
|
2596
3017
|
}
|
|
@@ -2671,6 +3092,9 @@ var Tree = class _Tree {
|
|
|
2671
3092
|
return result;
|
|
2672
3093
|
}
|
|
2673
3094
|
};
|
|
3095
|
+
var finalizer3 = newFinalizer((address) => {
|
|
3096
|
+
C._ts_tree_cursor_delete_wasm(address);
|
|
3097
|
+
});
|
|
2674
3098
|
var TreeCursor = class _TreeCursor {
|
|
2675
3099
|
static {
|
|
2676
3100
|
__name(this, "TreeCursor");
|
|
@@ -2698,6 +3122,7 @@ var TreeCursor = class _TreeCursor {
|
|
|
2698
3122
|
assertInternal(internal);
|
|
2699
3123
|
this.tree = tree;
|
|
2700
3124
|
unmarshalTreeCursor(this);
|
|
3125
|
+
finalizer3?.register(this, this.tree[0], this);
|
|
2701
3126
|
}
|
|
2702
3127
|
/** Creates a deep copy of the tree cursor. This allocates new memory. */
|
|
2703
3128
|
copy() {
|
|
@@ -2708,6 +3133,7 @@ var TreeCursor = class _TreeCursor {
|
|
|
2708
3133
|
}
|
|
2709
3134
|
/** Delete the tree cursor, freeing its resources. */
|
|
2710
3135
|
delete() {
|
|
3136
|
+
finalizer3?.unregister(this);
|
|
2711
3137
|
marshalTreeCursor(this);
|
|
2712
3138
|
C._ts_tree_cursor_delete_wasm(this.tree[0]);
|
|
2713
3139
|
this[0] = this[1] = this[2] = 0;
|
|
@@ -3802,8 +4228,9 @@ var Language = class _Language {
|
|
|
3802
4228
|
* This returns `null` if state is invalid for this language.
|
|
3803
4229
|
*
|
|
3804
4230
|
* Iterating {@link LookaheadIterator} will yield valid symbols in the given
|
|
3805
|
-
* parse state.
|
|
3806
|
-
*
|
|
4231
|
+
* parse state. A newly created iterator is not positioned on a symbol, so
|
|
4232
|
+
* {@link LookaheadIterator#currentType} returns `null` until the first
|
|
4233
|
+
* iteration step.
|
|
3807
4234
|
*
|
|
3808
4235
|
* Lookahead iterators can be useful for generating suggestions and improving
|
|
3809
4236
|
* syntax error diagnostics. To get symbols valid in an `ERROR` node, use the
|
|
@@ -3818,7 +4245,8 @@ var Language = class _Language {
|
|
|
3818
4245
|
}
|
|
3819
4246
|
/**
|
|
3820
4247
|
* Load a language from a WebAssembly module.
|
|
3821
|
-
* The module can be provided as a path to a file or as a
|
|
4248
|
+
* The module can be provided as a path to a file, a `URL` to a file, or as a
|
|
4249
|
+
* buffer.
|
|
3822
4250
|
*/
|
|
3823
4251
|
static async load(input) {
|
|
3824
4252
|
let binary2;
|
|
@@ -3845,16 +4273,27 @@ ${body2}`);
|
|
|
3845
4273
|
}
|
|
3846
4274
|
}
|
|
3847
4275
|
const mod = await C.loadWebAssemblyModule(binary2, { loadAsync: true });
|
|
4276
|
+
return _Language.loadFromWasmExports(mod, { sync: false });
|
|
4277
|
+
}
|
|
4278
|
+
static loadFromWasmExports(mod, { sync }) {
|
|
3848
4279
|
const symbolNames = Object.keys(mod);
|
|
3849
4280
|
const functionName = symbolNames.find((key) => LANGUAGE_FUNCTION_REGEX.test(key) && !key.includes("external_scanner_"));
|
|
3850
4281
|
if (!functionName) {
|
|
3851
4282
|
console.log(`Couldn't find language function in Wasm file. Symbols:
|
|
3852
4283
|
${JSON.stringify(symbolNames, null, 2)}`);
|
|
3853
|
-
throw new Error("
|
|
4284
|
+
throw new Error(`Language.${sync ? "loadSync" : "load"} failed: no language function found in Wasm file`);
|
|
3854
4285
|
}
|
|
3855
4286
|
const languageAddress = mod[functionName]();
|
|
3856
4287
|
return new _Language(INTERNAL, languageAddress);
|
|
3857
4288
|
}
|
|
4289
|
+
/**
|
|
4290
|
+
* Load a language synchronously from a pre-compiled WebAssembly module.
|
|
4291
|
+
* Use this when the host environment provides a `WebAssembly.Module` directly.
|
|
4292
|
+
*/
|
|
4293
|
+
static loadSync(wasmModule) {
|
|
4294
|
+
const mod = C.loadWebAssemblyModule(wasmModule, { loadAsync: false });
|
|
4295
|
+
return _Language.loadFromWasmExports(mod, { sync: true });
|
|
4296
|
+
}
|
|
3858
4297
|
};
|
|
3859
4298
|
async function Module2(moduleArg = {}) {
|
|
3860
4299
|
var moduleRtn;
|
|
@@ -4377,7 +4816,7 @@ async function Module2(moduleArg = {}) {
|
|
|
4377
4816
|
newDSO("__main__", 0, wasmImports);
|
|
4378
4817
|
}
|
|
4379
4818
|
};
|
|
4380
|
-
var ___heap_base =
|
|
4819
|
+
var ___heap_base = 82240;
|
|
4381
4820
|
var alignMemory = /* @__PURE__ */ __name((size, alignment) => Math.ceil(size / alignment) * alignment, "alignMemory");
|
|
4382
4821
|
var getMemory = /* @__PURE__ */ __name((size) => {
|
|
4383
4822
|
if (runtimeInitialized) {
|
|
@@ -4942,12 +5381,12 @@ async function Module2(moduleArg = {}) {
|
|
|
4942
5381
|
"value": "i32",
|
|
4943
5382
|
"mutable": false
|
|
4944
5383
|
}, 1024);
|
|
4945
|
-
var ___stack_high =
|
|
4946
|
-
var ___stack_low =
|
|
5384
|
+
var ___stack_high = 82240;
|
|
5385
|
+
var ___stack_low = 16704;
|
|
4947
5386
|
var ___stack_pointer = new WebAssembly.Global({
|
|
4948
5387
|
"value": "i32",
|
|
4949
5388
|
"mutable": true
|
|
4950
|
-
},
|
|
5389
|
+
}, 82240);
|
|
4951
5390
|
var ___table_base = new WebAssembly.Global({
|
|
4952
5391
|
"value": "i32",
|
|
4953
5392
|
"mutable": false
|
|
@@ -5208,7 +5647,7 @@ async function Module2(moduleArg = {}) {
|
|
|
5208
5647
|
Module["loadWebAssemblyModule"] = loadWebAssemblyModule;
|
|
5209
5648
|
Module["LE_HEAP_STORE_I64"] = LE_HEAP_STORE_I64;
|
|
5210
5649
|
var ASM_CONSTS = {};
|
|
5211
|
-
var _malloc, _calloc, _realloc, _free, _ts_range_edit, _memcmp, _ts_language_symbol_count, _ts_language_state_count, _ts_language_abi_version, _ts_language_name, _ts_language_field_count, _ts_language_next_state, _ts_language_symbol_name, _ts_language_symbol_for_name, _strncmp, _ts_language_symbol_type, _ts_language_field_name_for_id, _ts_lookahead_iterator_new, _ts_lookahead_iterator_delete, _ts_lookahead_iterator_reset_state, _ts_lookahead_iterator_reset, _ts_lookahead_iterator_next, _ts_lookahead_iterator_current_symbol, _ts_point_edit, _ts_parser_delete, _ts_parser_reset, _ts_parser_set_language, _ts_parser_set_included_ranges, _ts_query_new, _ts_query_delete, _iswspace, _iswalnum, _ts_query_pattern_count, _ts_query_capture_count, _ts_query_string_count, _ts_query_capture_name_for_id, _ts_query_capture_quantifier_for_id, _ts_query_string_value_for_id, _ts_query_predicates_for_pattern, _ts_query_start_byte_for_pattern, _ts_query_end_byte_for_pattern, _ts_query_is_pattern_rooted, _ts_query_is_pattern_non_local, _ts_query_is_pattern_guaranteed_at_step, _ts_query_disable_capture, _ts_query_disable_pattern, _ts_tree_copy, _ts_tree_delete, _ts_init, _ts_parser_new_wasm, _ts_parser_enable_logger_wasm, _ts_parser_parse_wasm, _ts_parser_included_ranges_wasm, _ts_language_type_is_named_wasm, _ts_language_type_is_visible_wasm, _ts_language_metadata_wasm, _ts_language_supertypes_wasm, _ts_language_subtypes_wasm, _ts_tree_root_node_wasm, _ts_tree_root_node_with_offset_wasm, _ts_tree_edit_wasm, _ts_tree_included_ranges_wasm, _ts_tree_get_changed_ranges_wasm, _ts_tree_cursor_new_wasm, _ts_tree_cursor_copy_wasm, _ts_tree_cursor_delete_wasm, _ts_tree_cursor_reset_wasm, _ts_tree_cursor_reset_to_wasm, _ts_tree_cursor_goto_first_child_wasm, _ts_tree_cursor_goto_last_child_wasm, _ts_tree_cursor_goto_first_child_for_index_wasm, _ts_tree_cursor_goto_first_child_for_position_wasm, _ts_tree_cursor_goto_next_sibling_wasm, _ts_tree_cursor_goto_previous_sibling_wasm, _ts_tree_cursor_goto_descendant_wasm, _ts_tree_cursor_goto_parent_wasm, _ts_tree_cursor_current_node_type_id_wasm, _ts_tree_cursor_current_node_state_id_wasm, _ts_tree_cursor_current_node_is_named_wasm, _ts_tree_cursor_current_node_is_missing_wasm, _ts_tree_cursor_current_node_id_wasm, _ts_tree_cursor_start_position_wasm, _ts_tree_cursor_end_position_wasm, _ts_tree_cursor_start_index_wasm, _ts_tree_cursor_end_index_wasm, _ts_tree_cursor_current_field_id_wasm, _ts_tree_cursor_current_depth_wasm, _ts_tree_cursor_current_descendant_index_wasm, _ts_tree_cursor_current_node_wasm, _ts_node_symbol_wasm, _ts_node_field_name_for_child_wasm, _ts_node_field_name_for_named_child_wasm, _ts_node_children_by_field_id_wasm, _ts_node_first_child_for_byte_wasm, _ts_node_first_named_child_for_byte_wasm, _ts_node_grammar_symbol_wasm, _ts_node_child_count_wasm, _ts_node_named_child_count_wasm, _ts_node_child_wasm, _ts_node_named_child_wasm, _ts_node_child_by_field_id_wasm, _ts_node_next_sibling_wasm, _ts_node_prev_sibling_wasm, _ts_node_next_named_sibling_wasm, _ts_node_prev_named_sibling_wasm, _ts_node_descendant_count_wasm, _ts_node_parent_wasm, _ts_node_child_with_descendant_wasm, _ts_node_descendant_for_index_wasm, _ts_node_named_descendant_for_index_wasm, _ts_node_descendant_for_position_wasm, _ts_node_named_descendant_for_position_wasm, _ts_node_start_point_wasm, _ts_node_end_point_wasm, _ts_node_start_index_wasm, _ts_node_end_index_wasm, _ts_node_to_string_wasm, _ts_node_children_wasm, _ts_node_named_children_wasm, _ts_node_descendants_of_type_wasm, _ts_node_is_named_wasm, _ts_node_has_changes_wasm, _ts_node_has_error_wasm, _ts_node_is_error_wasm, _ts_node_is_missing_wasm, _ts_node_is_extra_wasm, _ts_node_parse_state_wasm, _ts_node_next_parse_state_wasm, _ts_query_matches_wasm, _ts_query_captures_wasm, _memset, _memcpy, _memmove, _iswalpha, _iswblank, _iswdigit, _iswlower, _iswupper, _iswxdigit, _memchr, _strlen, _strcmp, _strncat, _strncpy, _towlower, _towupper, _setThrew, __emscripten_stack_restore, __emscripten_stack_alloc, _emscripten_stack_get_current, ___wasm_apply_data_relocs;
|
|
5650
|
+
var _malloc, _calloc, _realloc, _free, _ts_range_edit, _memcmp, _ts_language_symbol_count, _ts_language_state_count, _ts_language_abi_version, _ts_language_name, _ts_language_field_count, _ts_language_next_state, _ts_language_symbol_name, _ts_language_symbol_for_name, _strncmp, _ts_language_symbol_type, _ts_language_field_name_for_id, _ts_lookahead_iterator_new, _ts_lookahead_iterator_delete, _ts_lookahead_iterator_reset_state, _ts_lookahead_iterator_reset, _ts_lookahead_iterator_next, _ts_lookahead_iterator_current_symbol, _ts_point_edit, _ts_parser_delete, _ts_parser_reset, _ts_parser_set_language, _ts_parser_set_included_ranges, _ts_query_new, _ts_query_delete, _iswspace, _iswalnum, _ts_query_copy, _ts_query_pattern_count, _ts_query_capture_count, _ts_query_string_count, _ts_query_capture_name_for_id, _ts_query_capture_quantifier_for_id, _ts_query_string_value_for_id, _ts_query_predicates_for_pattern, _ts_query_start_byte_for_pattern, _ts_query_end_byte_for_pattern, _ts_query_is_pattern_rooted, _ts_query_is_pattern_non_local, _ts_query_is_pattern_guaranteed_at_step, _ts_query_disable_capture, _ts_query_disable_pattern, _ts_tree_copy, _ts_tree_delete, _ts_init, _ts_parser_new_wasm, _ts_parser_enable_logger_wasm, _ts_parser_parse_wasm, _ts_parser_included_ranges_wasm, _ts_language_type_is_named_wasm, _ts_language_type_is_visible_wasm, _ts_language_metadata_wasm, _ts_language_supertypes_wasm, _ts_language_subtypes_wasm, _ts_tree_root_node_wasm, _ts_tree_root_node_with_offset_wasm, _ts_tree_edit_wasm, _ts_tree_included_ranges_wasm, _ts_tree_get_changed_ranges_wasm, _ts_tree_cursor_new_wasm, _ts_tree_cursor_copy_wasm, _ts_tree_cursor_delete_wasm, _ts_tree_cursor_reset_wasm, _ts_tree_cursor_reset_to_wasm, _ts_tree_cursor_goto_first_child_wasm, _ts_tree_cursor_goto_last_child_wasm, _ts_tree_cursor_goto_first_child_for_index_wasm, _ts_tree_cursor_goto_first_child_for_position_wasm, _ts_tree_cursor_goto_next_sibling_wasm, _ts_tree_cursor_goto_previous_sibling_wasm, _ts_tree_cursor_goto_descendant_wasm, _ts_tree_cursor_goto_parent_wasm, _ts_tree_cursor_current_node_type_id_wasm, _ts_tree_cursor_current_node_state_id_wasm, _ts_tree_cursor_current_node_is_named_wasm, _ts_tree_cursor_current_node_is_missing_wasm, _ts_tree_cursor_current_node_id_wasm, _ts_tree_cursor_start_position_wasm, _ts_tree_cursor_end_position_wasm, _ts_tree_cursor_start_index_wasm, _ts_tree_cursor_end_index_wasm, _ts_tree_cursor_current_field_id_wasm, _ts_tree_cursor_current_depth_wasm, _ts_tree_cursor_current_descendant_index_wasm, _ts_tree_cursor_current_node_wasm, _ts_node_symbol_wasm, _ts_node_field_name_for_child_wasm, _ts_node_field_name_for_named_child_wasm, _ts_node_children_by_field_id_wasm, _ts_node_first_child_for_byte_wasm, _ts_node_first_named_child_for_byte_wasm, _ts_node_grammar_symbol_wasm, _ts_node_child_count_wasm, _ts_node_named_child_count_wasm, _ts_node_child_wasm, _ts_node_named_child_wasm, _ts_node_child_by_field_id_wasm, _ts_node_next_sibling_wasm, _ts_node_prev_sibling_wasm, _ts_node_next_named_sibling_wasm, _ts_node_prev_named_sibling_wasm, _ts_node_descendant_count_wasm, _ts_node_parent_wasm, _ts_node_child_with_descendant_wasm, _ts_node_descendant_for_index_wasm, _ts_node_named_descendant_for_index_wasm, _ts_node_descendant_for_position_wasm, _ts_node_named_descendant_for_position_wasm, _ts_node_start_point_wasm, _ts_node_end_point_wasm, _ts_node_start_index_wasm, _ts_node_end_index_wasm, _ts_node_to_string_wasm, _ts_node_children_wasm, _ts_node_named_children_wasm, _ts_node_descendants_of_type_wasm, _ts_node_is_named_wasm, _ts_node_has_changes_wasm, _ts_node_has_error_wasm, _ts_node_is_error_wasm, _ts_node_is_missing_wasm, _ts_node_is_extra_wasm, _ts_node_parse_state_wasm, _ts_node_next_parse_state_wasm, _ts_query_matches_wasm, _ts_query_captures_wasm, _memset, _memcpy, _memmove, _iswalpha, _iswblank, _iswdigit, _iswlower, _iswpunct, _iswupper, _iswxdigit, _memchr, _strlen, _strcmp, _strncat, _strncpy, _towlower, _towupper, _setThrew, __emscripten_stack_restore, __emscripten_stack_alloc, _emscripten_stack_get_current, ___wasm_apply_data_relocs;
|
|
5212
5651
|
function assignWasmExports(wasmExports2) {
|
|
5213
5652
|
Module["_malloc"] = _malloc = wasmExports2["malloc"];
|
|
5214
5653
|
Module["_calloc"] = _calloc = wasmExports2["calloc"];
|
|
@@ -5242,6 +5681,7 @@ async function Module2(moduleArg = {}) {
|
|
|
5242
5681
|
Module["_ts_query_delete"] = _ts_query_delete = wasmExports2["ts_query_delete"];
|
|
5243
5682
|
Module["_iswspace"] = _iswspace = wasmExports2["iswspace"];
|
|
5244
5683
|
Module["_iswalnum"] = _iswalnum = wasmExports2["iswalnum"];
|
|
5684
|
+
Module["_ts_query_copy"] = _ts_query_copy = wasmExports2["ts_query_copy"];
|
|
5245
5685
|
Module["_ts_query_pattern_count"] = _ts_query_pattern_count = wasmExports2["ts_query_pattern_count"];
|
|
5246
5686
|
Module["_ts_query_capture_count"] = _ts_query_capture_count = wasmExports2["ts_query_capture_count"];
|
|
5247
5687
|
Module["_ts_query_string_count"] = _ts_query_string_count = wasmExports2["ts_query_string_count"];
|
|
@@ -5347,6 +5787,7 @@ async function Module2(moduleArg = {}) {
|
|
|
5347
5787
|
Module["_iswblank"] = _iswblank = wasmExports2["iswblank"];
|
|
5348
5788
|
Module["_iswdigit"] = _iswdigit = wasmExports2["iswdigit"];
|
|
5349
5789
|
Module["_iswlower"] = _iswlower = wasmExports2["iswlower"];
|
|
5790
|
+
Module["_iswpunct"] = _iswpunct = wasmExports2["iswpunct"];
|
|
5350
5791
|
Module["_iswupper"] = _iswupper = wasmExports2["iswupper"];
|
|
5351
5792
|
Module["_iswxdigit"] = _iswxdigit = wasmExports2["iswxdigit"];
|
|
5352
5793
|
Module["_memchr"] = _memchr = wasmExports2["memchr"];
|
|
@@ -5484,6 +5925,10 @@ __name(checkModule, "checkModule");
|
|
|
5484
5925
|
var TRANSFER_BUFFER;
|
|
5485
5926
|
var LANGUAGE_VERSION;
|
|
5486
5927
|
var MIN_COMPATIBLE_VERSION;
|
|
5928
|
+
var finalizer4 = newFinalizer((addresses) => {
|
|
5929
|
+
C._ts_parser_delete(addresses[0]);
|
|
5930
|
+
C._free(addresses[1]);
|
|
5931
|
+
});
|
|
5487
5932
|
var Parser = class {
|
|
5488
5933
|
static {
|
|
5489
5934
|
__name(this, "Parser");
|
|
@@ -5515,6 +5960,7 @@ var Parser = class {
|
|
|
5515
5960
|
*/
|
|
5516
5961
|
constructor() {
|
|
5517
5962
|
this.initialize();
|
|
5963
|
+
finalizer4?.register(this, [this[0], this[1]], this);
|
|
5518
5964
|
}
|
|
5519
5965
|
/** @internal */
|
|
5520
5966
|
initialize() {
|
|
@@ -5527,6 +5973,7 @@ var Parser = class {
|
|
|
5527
5973
|
}
|
|
5528
5974
|
/** Delete the parser, freeing its resources. */
|
|
5529
5975
|
delete() {
|
|
5976
|
+
finalizer4?.unregister(this);
|
|
5530
5977
|
C._ts_parser_delete(this[0]);
|
|
5531
5978
|
C._free(this[1]);
|
|
5532
5979
|
this[0] = 0;
|
|
@@ -5702,6 +6149,10 @@ var QueryError = class _QueryError extends Error {
|
|
|
5702
6149
|
this.length = length;
|
|
5703
6150
|
this.name = "QueryError";
|
|
5704
6151
|
}
|
|
6152
|
+
kind;
|
|
6153
|
+
info;
|
|
6154
|
+
index;
|
|
6155
|
+
length;
|
|
5705
6156
|
static {
|
|
5706
6157
|
__name(this, "QueryError");
|
|
5707
6158
|
}
|
|
@@ -5897,6 +6348,9 @@ function parsePattern(index, stepType, stepValueId, captureNames, stringValues,
|
|
|
5897
6348
|
}
|
|
5898
6349
|
}
|
|
5899
6350
|
__name(parsePattern, "parsePattern");
|
|
6351
|
+
var finalizer5 = newFinalizer((address) => {
|
|
6352
|
+
C._ts_query_delete(address);
|
|
6353
|
+
});
|
|
5900
6354
|
var Query = class {
|
|
5901
6355
|
static {
|
|
5902
6356
|
__name(this, "Query");
|
|
@@ -6051,9 +6505,11 @@ var Query = class {
|
|
|
6051
6505
|
this.assertedProperties = assertedProperties;
|
|
6052
6506
|
this.refutedProperties = refutedProperties;
|
|
6053
6507
|
this.exceededMatchLimit = false;
|
|
6508
|
+
finalizer5?.register(this, address, this);
|
|
6054
6509
|
}
|
|
6055
6510
|
/** Delete the query, freeing its resources. */
|
|
6056
6511
|
delete() {
|
|
6512
|
+
finalizer5?.unregister(this);
|
|
6057
6513
|
C._ts_query_delete(this[0]);
|
|
6058
6514
|
this[0] = 0;
|
|
6059
6515
|
}
|
|
@@ -6891,105 +7347,13 @@ import { readFile as readFile2, stat } from "node:fs/promises";
|
|
|
6891
7347
|
import { join as join6 } from "node:path";
|
|
6892
7348
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
6893
7349
|
|
|
6894
|
-
// node_modules/smol-toml/dist/date.js
|
|
6895
|
-
var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
|
|
6896
|
-
var TomlDate = class _TomlDate extends Date {
|
|
6897
|
-
#hasDate = false;
|
|
6898
|
-
#hasTime = false;
|
|
6899
|
-
#offset = null;
|
|
6900
|
-
constructor(date) {
|
|
6901
|
-
let hasDate = true;
|
|
6902
|
-
let hasTime = true;
|
|
6903
|
-
let offset = "Z";
|
|
6904
|
-
if (typeof date === "string") {
|
|
6905
|
-
let match = date.match(DATE_TIME_RE);
|
|
6906
|
-
if (match) {
|
|
6907
|
-
if (!match[1]) {
|
|
6908
|
-
hasDate = false;
|
|
6909
|
-
date = `0000-01-01T${date}`;
|
|
6910
|
-
}
|
|
6911
|
-
hasTime = !!match[2];
|
|
6912
|
-
hasTime && date[10] === " " && (date = date.replace(" ", "T"));
|
|
6913
|
-
if (match[2] && +match[2] > 23) {
|
|
6914
|
-
date = "";
|
|
6915
|
-
} else {
|
|
6916
|
-
offset = match[3] || null;
|
|
6917
|
-
date = date.toUpperCase();
|
|
6918
|
-
if (!offset && hasTime)
|
|
6919
|
-
date += "Z";
|
|
6920
|
-
}
|
|
6921
|
-
} else {
|
|
6922
|
-
date = "";
|
|
6923
|
-
}
|
|
6924
|
-
}
|
|
6925
|
-
super(date);
|
|
6926
|
-
if (!isNaN(this.getTime())) {
|
|
6927
|
-
this.#hasDate = hasDate;
|
|
6928
|
-
this.#hasTime = hasTime;
|
|
6929
|
-
this.#offset = offset;
|
|
6930
|
-
}
|
|
6931
|
-
}
|
|
6932
|
-
isDateTime() {
|
|
6933
|
-
return this.#hasDate && this.#hasTime;
|
|
6934
|
-
}
|
|
6935
|
-
isLocal() {
|
|
6936
|
-
return !this.#hasDate || !this.#hasTime || !this.#offset;
|
|
6937
|
-
}
|
|
6938
|
-
isDate() {
|
|
6939
|
-
return this.#hasDate && !this.#hasTime;
|
|
6940
|
-
}
|
|
6941
|
-
isTime() {
|
|
6942
|
-
return this.#hasTime && !this.#hasDate;
|
|
6943
|
-
}
|
|
6944
|
-
isValid() {
|
|
6945
|
-
return this.#hasDate || this.#hasTime;
|
|
6946
|
-
}
|
|
6947
|
-
toISOString() {
|
|
6948
|
-
let iso = super.toISOString();
|
|
6949
|
-
if (this.isDate())
|
|
6950
|
-
return iso.slice(0, 10);
|
|
6951
|
-
if (this.isTime())
|
|
6952
|
-
return iso.slice(11, 23);
|
|
6953
|
-
if (this.#offset === null)
|
|
6954
|
-
return iso.slice(0, -1);
|
|
6955
|
-
if (this.#offset === "Z")
|
|
6956
|
-
return iso;
|
|
6957
|
-
let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
|
|
6958
|
-
offset = this.#offset[0] === "-" ? offset : -offset;
|
|
6959
|
-
let offsetDate = new Date(this.getTime() - offset * 6e4);
|
|
6960
|
-
return offsetDate.toISOString().slice(0, -1) + this.#offset;
|
|
6961
|
-
}
|
|
6962
|
-
static wrapAsOffsetDateTime(jsDate, offset = "Z") {
|
|
6963
|
-
let date = new _TomlDate(jsDate);
|
|
6964
|
-
date.#offset = offset;
|
|
6965
|
-
return date;
|
|
6966
|
-
}
|
|
6967
|
-
static wrapAsLocalDateTime(jsDate) {
|
|
6968
|
-
let date = new _TomlDate(jsDate);
|
|
6969
|
-
date.#offset = null;
|
|
6970
|
-
return date;
|
|
6971
|
-
}
|
|
6972
|
-
static wrapAsLocalDate(jsDate) {
|
|
6973
|
-
let date = new _TomlDate(jsDate);
|
|
6974
|
-
date.#hasTime = false;
|
|
6975
|
-
date.#offset = null;
|
|
6976
|
-
return date;
|
|
6977
|
-
}
|
|
6978
|
-
static wrapAsLocalTime(jsDate) {
|
|
6979
|
-
let date = new _TomlDate(jsDate);
|
|
6980
|
-
date.#hasDate = false;
|
|
6981
|
-
date.#offset = null;
|
|
6982
|
-
return date;
|
|
6983
|
-
}
|
|
6984
|
-
};
|
|
6985
|
-
|
|
6986
7350
|
// node_modules/smol-toml/dist/error.js
|
|
6987
7351
|
function getLineColFromPtr(string, ptr) {
|
|
6988
|
-
let lines = string.slice(0, ptr).split(/\r
|
|
7352
|
+
let lines = string.slice(0, ptr).split(/\r?\n/);
|
|
6989
7353
|
return [lines.length, lines.pop().length + 1];
|
|
6990
7354
|
}
|
|
6991
7355
|
function makeCodeBlock(string, line, column) {
|
|
6992
|
-
let lines = string.split(/\r
|
|
7356
|
+
let lines = string.split(/\r?\n/);
|
|
6993
7357
|
let codeblock = "";
|
|
6994
7358
|
let numberLen = (Math.log10(line + 1) | 0) + 1;
|
|
6995
7359
|
for (let i2 = line - 1; i2 <= line + 1; i2++) {
|
|
@@ -7007,7 +7371,7 @@ function makeCodeBlock(string, line, column) {
|
|
|
7007
7371
|
}
|
|
7008
7372
|
return codeblock;
|
|
7009
7373
|
}
|
|
7010
|
-
var TomlError = class extends Error {
|
|
7374
|
+
var TomlError = class _TomlError extends Error {
|
|
7011
7375
|
line;
|
|
7012
7376
|
column;
|
|
7013
7377
|
codeblock;
|
|
@@ -7021,69 +7385,15 @@ ${codeblock}`, options);
|
|
|
7021
7385
|
this.column = column;
|
|
7022
7386
|
this.codeblock = codeblock;
|
|
7023
7387
|
}
|
|
7024
|
-
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
function indexOfNewline(str, start2 = 0) {
|
|
7028
|
-
let idx = str.indexOf("\n", start2);
|
|
7029
|
-
if (str.charCodeAt(idx - 1) === 13)
|
|
7030
|
-
idx--;
|
|
7031
|
-
return idx;
|
|
7032
|
-
}
|
|
7033
|
-
function skipComment(ctx) {
|
|
7034
|
-
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
7035
|
-
let c = ctx.s.charCodeAt(ctx.p);
|
|
7036
|
-
if (c === 10)
|
|
7037
|
-
break;
|
|
7038
|
-
if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
|
|
7039
|
-
ctx.p++;
|
|
7040
|
-
break;
|
|
7041
|
-
}
|
|
7042
|
-
if (c < 32 && c !== 9 || c === 127) {
|
|
7043
|
-
throw new TomlError("control characters are not allowed in comments", {
|
|
7044
|
-
toml: ctx.s,
|
|
7045
|
-
ptr: ctx.p
|
|
7046
|
-
});
|
|
7047
|
-
}
|
|
7048
|
-
}
|
|
7049
|
-
}
|
|
7050
|
-
function skipVoid(ctx, banNewLines, banComments) {
|
|
7051
|
-
let c;
|
|
7052
|
-
while (1) {
|
|
7053
|
-
while ((c = ctx.s.charCodeAt(ctx.p)) === 32 || c === 9 || !banNewLines && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10))
|
|
7054
|
-
ctx.p++;
|
|
7055
|
-
if (banComments || c !== 35)
|
|
7056
|
-
break;
|
|
7057
|
-
skipComment(ctx);
|
|
7058
|
-
}
|
|
7059
|
-
}
|
|
7060
|
-
function skipUntil(ctx, sep2, end) {
|
|
7061
|
-
let ptr = ctx.p;
|
|
7062
|
-
if (!end) {
|
|
7063
|
-
ptr = indexOfNewline(ctx.s, ptr);
|
|
7064
|
-
ctx.p = ptr < 0 ? ctx.s.length : ptr;
|
|
7065
|
-
return;
|
|
7066
|
-
}
|
|
7067
|
-
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
7068
|
-
let c = ctx.s.charCodeAt(ctx.p);
|
|
7069
|
-
if (c === 35) {
|
|
7070
|
-
skipComment(ctx);
|
|
7071
|
-
} else if (c === end || c === sep2) {
|
|
7072
|
-
return;
|
|
7073
|
-
}
|
|
7388
|
+
/** @internal */
|
|
7389
|
+
static x(message, ctx, ptr) {
|
|
7390
|
+
throw new _TomlError(message, { toml: ctx.s, ptr: ptr ?? ctx.p });
|
|
7074
7391
|
}
|
|
7075
|
-
|
|
7076
|
-
toml: ctx.s,
|
|
7077
|
-
ptr
|
|
7078
|
-
});
|
|
7079
|
-
}
|
|
7392
|
+
};
|
|
7080
7393
|
|
|
7081
7394
|
// node_modules/smol-toml/dist/primitive.js
|
|
7082
|
-
var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
|
|
7083
|
-
var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
|
|
7084
|
-
var LEADING_ZERO = /^[+-]?0[0-9_]/;
|
|
7085
7395
|
function parseString(ctx) {
|
|
7086
|
-
let
|
|
7396
|
+
let startPtr = ctx.p;
|
|
7087
7397
|
let c = ctx.s.charCodeAt(ctx.p++);
|
|
7088
7398
|
let first = c;
|
|
7089
7399
|
let isLiteral = c === 39;
|
|
@@ -7102,10 +7412,7 @@ function parseString(ctx) {
|
|
|
7102
7412
|
if (isMultiline && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) {
|
|
7103
7413
|
state = state && 3;
|
|
7104
7414
|
} else if (c < 32 && c !== 9 || c === 127) {
|
|
7105
|
-
|
|
7106
|
-
toml: ctx.s,
|
|
7107
|
-
ptr: ctx.p
|
|
7108
|
-
});
|
|
7415
|
+
TomlError.x("control characters are not allowed in strings", ctx);
|
|
7109
7416
|
} else if ((!state || state === 3) && c === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
|
|
7110
7417
|
if (isMultiline) {
|
|
7111
7418
|
if (ctx.s.charCodeAt(ctx.p + 3) === first)
|
|
@@ -7113,8 +7420,10 @@ function parseString(ctx) {
|
|
|
7113
7420
|
if (ctx.s.charCodeAt(ctx.p + 3) === first)
|
|
7114
7421
|
ctx.p++;
|
|
7115
7422
|
}
|
|
7116
|
-
if (!state)
|
|
7117
|
-
|
|
7423
|
+
if (!state) {
|
|
7424
|
+
let s = ctx.s.slice(sliceStart, ctx.p);
|
|
7425
|
+
parsed = parsed ? parsed + s : s;
|
|
7426
|
+
}
|
|
7118
7427
|
ctx.p += isMultiline ? 3 : 1;
|
|
7119
7428
|
return parsed;
|
|
7120
7429
|
} else if (!state) {
|
|
@@ -7124,10 +7433,11 @@ function parseString(ctx) {
|
|
|
7124
7433
|
}
|
|
7125
7434
|
} else if (state === 1) {
|
|
7126
7435
|
if (c === 120 || c === 117 || c === 85) {
|
|
7436
|
+
let errPtr = ctx.p++ - 1;
|
|
7127
7437
|
let value = 0;
|
|
7128
7438
|
let len = c === 120 ? 2 : c === 117 ? 4 : 8;
|
|
7129
7439
|
for (let j = 0; j < len; j++, ctx.p++) {
|
|
7130
|
-
let hex = ctx.s.charCodeAt(ctx.p
|
|
7440
|
+
let hex = ctx.s.charCodeAt(ctx.p);
|
|
7131
7441
|
let digit = (
|
|
7132
7442
|
/* 0-9 */
|
|
7133
7443
|
hex >= 48 && hex <= 57 ? hex - 48 : (
|
|
@@ -7139,16 +7449,16 @@ function parseString(ctx) {
|
|
|
7139
7449
|
)
|
|
7140
7450
|
);
|
|
7141
7451
|
if (digit < 0)
|
|
7142
|
-
|
|
7452
|
+
TomlError.x("invalid non-hex character in unicode escape", ctx);
|
|
7143
7453
|
value = value << 4 | digit;
|
|
7144
7454
|
}
|
|
7145
7455
|
if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) {
|
|
7146
|
-
|
|
7456
|
+
TomlError.x("invalid unicode escape", ctx, errPtr);
|
|
7147
7457
|
}
|
|
7148
7458
|
parsed += String.fromCodePoint(value);
|
|
7149
|
-
sliceStart = ctx.p
|
|
7459
|
+
sliceStart = ctx.p--;
|
|
7150
7460
|
state = 0;
|
|
7151
|
-
} else if (c === 32 || c === 9) {
|
|
7461
|
+
} else if (isMultiline && (c === 32 || c === 9)) {
|
|
7152
7462
|
state = 2;
|
|
7153
7463
|
} else {
|
|
7154
7464
|
if (c === 98)
|
|
@@ -7168,84 +7478,150 @@ function parseString(ctx) {
|
|
|
7168
7478
|
else if (c === 92)
|
|
7169
7479
|
parsed += "\\";
|
|
7170
7480
|
else
|
|
7171
|
-
|
|
7481
|
+
TomlError.x("unrecognised escape sequence", ctx);
|
|
7172
7482
|
sliceStart = ctx.p + 1;
|
|
7173
7483
|
state = 0;
|
|
7174
7484
|
}
|
|
7175
7485
|
} else if (c !== 32 && c !== 9) {
|
|
7176
|
-
if (state === 2)
|
|
7177
|
-
|
|
7178
|
-
toml: ctx.s,
|
|
7179
|
-
ptr: sliceStart
|
|
7180
|
-
});
|
|
7181
|
-
}
|
|
7486
|
+
if (state === 2)
|
|
7487
|
+
TomlError.x("invalid escape: only line-ending whitespace may be escaped", ctx, sliceStart);
|
|
7182
7488
|
state = !isLiteral && c === 92 ? 1 : 0;
|
|
7183
7489
|
sliceStart = ctx.p;
|
|
7184
7490
|
}
|
|
7185
7491
|
}
|
|
7186
|
-
|
|
7187
|
-
}
|
|
7188
|
-
function sliceAndTrimEndOf(ctx, start2, end) {
|
|
7189
|
-
let value = ctx.s.slice(start2, end);
|
|
7190
|
-
let commentIdx = value.indexOf("#");
|
|
7191
|
-
if (commentIdx > 0) {
|
|
7192
|
-
skipComment({ s: value, p: commentIdx, d: 0 });
|
|
7193
|
-
value = value.slice(0, commentIdx);
|
|
7194
|
-
}
|
|
7195
|
-
return value.trimEnd();
|
|
7196
|
-
}
|
|
7197
|
-
function parseValue(ctx, integersAsBigInt, end) {
|
|
7198
|
-
let ptr = ctx.p;
|
|
7199
|
-
let err2 = { toml: ctx.s, ptr };
|
|
7200
|
-
skipUntil(ctx, 44, end);
|
|
7201
|
-
let value = sliceAndTrimEndOf(ctx, ptr, ctx.p);
|
|
7202
|
-
if (!value)
|
|
7203
|
-
throw new TomlError("incomplete declaration: value expected", err2);
|
|
7204
|
-
if (value === "-inf")
|
|
7205
|
-
return -Infinity;
|
|
7206
|
-
if (value === "inf" || value === "+inf")
|
|
7207
|
-
return Infinity;
|
|
7208
|
-
if (value === "nan" || value === "+nan" || value === "-nan")
|
|
7209
|
-
return NaN;
|
|
7210
|
-
if (value === "-0")
|
|
7211
|
-
return integersAsBigInt ? 0n : 0;
|
|
7212
|
-
let isInt = INT_REGEX.test(value);
|
|
7213
|
-
if (isInt || FLOAT_REGEX.test(value)) {
|
|
7214
|
-
if (LEADING_ZERO.test(value)) {
|
|
7215
|
-
throw new TomlError("leading zeroes are not allowed", err2);
|
|
7216
|
-
}
|
|
7217
|
-
value = value.replace(/_/g, "");
|
|
7218
|
-
let numeric = +value;
|
|
7219
|
-
if (isNaN(numeric)) {
|
|
7220
|
-
throw new TomlError("invalid number", err2);
|
|
7221
|
-
}
|
|
7222
|
-
if (isInt) {
|
|
7223
|
-
if ((isInt = !Number.isSafeInteger(numeric)) && !integersAsBigInt) {
|
|
7224
|
-
throw new TomlError("integer value cannot be represented losslessly", err2);
|
|
7225
|
-
}
|
|
7226
|
-
if (isInt || integersAsBigInt === true)
|
|
7227
|
-
numeric = BigInt(value);
|
|
7228
|
-
}
|
|
7229
|
-
return numeric;
|
|
7230
|
-
}
|
|
7231
|
-
const date = new TomlDate(value);
|
|
7232
|
-
if (!date.isValid())
|
|
7233
|
-
throw new TomlError("invalid value", err2);
|
|
7234
|
-
return date;
|
|
7492
|
+
TomlError.x("unfinished string", ctx, startPtr);
|
|
7235
7493
|
}
|
|
7236
7494
|
|
|
7495
|
+
// node_modules/smol-toml/dist/date.js
|
|
7496
|
+
var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[Tt ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|z|[-+]\d{2}:\d{2})?$/i;
|
|
7497
|
+
var TomlDate = class _TomlDate extends Date {
|
|
7498
|
+
#hasDate = false;
|
|
7499
|
+
#hasTime = false;
|
|
7500
|
+
#offset = null;
|
|
7501
|
+
constructor(date, fasttype, unsafeDelim) {
|
|
7502
|
+
let hasDate = true;
|
|
7503
|
+
let hasTime = true;
|
|
7504
|
+
let offset = "Z";
|
|
7505
|
+
let c;
|
|
7506
|
+
if (typeof date === "string") {
|
|
7507
|
+
if (fasttype)
|
|
7508
|
+
prep: {
|
|
7509
|
+
if (fasttype < 3) {
|
|
7510
|
+
if (+date.slice(11, 13) > 23) {
|
|
7511
|
+
date = "";
|
|
7512
|
+
break prep;
|
|
7513
|
+
}
|
|
7514
|
+
if (fasttype === 2) {
|
|
7515
|
+
offset = null;
|
|
7516
|
+
date += "Z";
|
|
7517
|
+
} else if ((c = date.charCodeAt(date.length - 1)) !== 90 && c !== 122) {
|
|
7518
|
+
offset = date.slice(date.length - 6);
|
|
7519
|
+
}
|
|
7520
|
+
if (unsafeDelim)
|
|
7521
|
+
date = date.slice(0, 10) + "T" + date.slice(11);
|
|
7522
|
+
} else if (fasttype === 4) {
|
|
7523
|
+
date = +date.slice(0, 2) > 23 ? "" : `0000-01-01T${date}Z`;
|
|
7524
|
+
}
|
|
7525
|
+
hasDate = fasttype !== 4;
|
|
7526
|
+
hasTime = fasttype !== 3;
|
|
7527
|
+
}
|
|
7528
|
+
else {
|
|
7529
|
+
let match = date.match(DATE_TIME_RE);
|
|
7530
|
+
if (match) {
|
|
7531
|
+
if (!match[1]) {
|
|
7532
|
+
hasDate = false;
|
|
7533
|
+
date = `0000-01-01T${date}`;
|
|
7534
|
+
}
|
|
7535
|
+
hasTime = !!match[2];
|
|
7536
|
+
hasTime && date[10] === " " && (date = date.replace(" ", "T"));
|
|
7537
|
+
if (match[2] && +match[2] > 23) {
|
|
7538
|
+
date = "";
|
|
7539
|
+
} else {
|
|
7540
|
+
offset = match[3] || null;
|
|
7541
|
+
if (!offset && hasTime)
|
|
7542
|
+
date += "Z";
|
|
7543
|
+
}
|
|
7544
|
+
} else {
|
|
7545
|
+
date = "";
|
|
7546
|
+
}
|
|
7547
|
+
}
|
|
7548
|
+
}
|
|
7549
|
+
super(date);
|
|
7550
|
+
if (!isNaN(this.getTime())) {
|
|
7551
|
+
this.#hasDate = hasDate;
|
|
7552
|
+
this.#hasTime = hasTime;
|
|
7553
|
+
this.#offset = offset;
|
|
7554
|
+
}
|
|
7555
|
+
}
|
|
7556
|
+
isDateTime() {
|
|
7557
|
+
return this.#hasDate && this.#hasTime;
|
|
7558
|
+
}
|
|
7559
|
+
isLocal() {
|
|
7560
|
+
return !this.#hasDate || !this.#hasTime || !this.#offset;
|
|
7561
|
+
}
|
|
7562
|
+
isDate() {
|
|
7563
|
+
return this.#hasDate && !this.#hasTime;
|
|
7564
|
+
}
|
|
7565
|
+
isTime() {
|
|
7566
|
+
return this.#hasTime && !this.#hasDate;
|
|
7567
|
+
}
|
|
7568
|
+
isValid() {
|
|
7569
|
+
return this.#hasDate || this.#hasTime;
|
|
7570
|
+
}
|
|
7571
|
+
toISOString() {
|
|
7572
|
+
let iso = super.toISOString();
|
|
7573
|
+
if (this.isDate())
|
|
7574
|
+
return iso.slice(0, 10);
|
|
7575
|
+
if (this.isTime())
|
|
7576
|
+
return iso.slice(11, 23);
|
|
7577
|
+
if (this.#offset === null)
|
|
7578
|
+
return iso.slice(0, -1);
|
|
7579
|
+
if (this.#offset === "Z" || this.#offset === "z")
|
|
7580
|
+
return iso;
|
|
7581
|
+
let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
|
|
7582
|
+
offset = this.#offset[0] === "-" ? offset : -offset;
|
|
7583
|
+
let offsetDate = new Date(this.getTime() - offset * 6e4);
|
|
7584
|
+
return offsetDate.toISOString().slice(0, -1) + this.#offset;
|
|
7585
|
+
}
|
|
7586
|
+
static wrapAsOffsetDateTime(jsDate, offset = "Z") {
|
|
7587
|
+
let date = new _TomlDate(jsDate);
|
|
7588
|
+
date.#offset = offset;
|
|
7589
|
+
return date;
|
|
7590
|
+
}
|
|
7591
|
+
static wrapAsLocalDateTime(jsDate) {
|
|
7592
|
+
let date = new _TomlDate(jsDate);
|
|
7593
|
+
date.#offset = null;
|
|
7594
|
+
return date;
|
|
7595
|
+
}
|
|
7596
|
+
static wrapAsLocalDate(jsDate) {
|
|
7597
|
+
let date = new _TomlDate(jsDate);
|
|
7598
|
+
date.#hasTime = false;
|
|
7599
|
+
date.#offset = null;
|
|
7600
|
+
return date;
|
|
7601
|
+
}
|
|
7602
|
+
static wrapAsLocalTime(jsDate) {
|
|
7603
|
+
let date = new _TomlDate(jsDate);
|
|
7604
|
+
date.#hasDate = false;
|
|
7605
|
+
date.#offset = null;
|
|
7606
|
+
return date;
|
|
7607
|
+
}
|
|
7608
|
+
};
|
|
7609
|
+
|
|
7237
7610
|
// node_modules/smol-toml/dist/extract.js
|
|
7238
|
-
function
|
|
7239
|
-
|
|
7240
|
-
|
|
7611
|
+
function isDigit(char, base = 10) {
|
|
7612
|
+
return base === 16 ? char > 47 && char < 58 || char > 64 && char < 71 || char > 96 && char < 103 : char > 47 && char < 48 + base;
|
|
7613
|
+
}
|
|
7614
|
+
function isEndOfValue(char, delim) {
|
|
7615
|
+
return char === 32 || char === 9 || char === 10 || char === 13 || // Structure end or next value delimiter
|
|
7616
|
+
delim && (char === delim || char === 44) || // Comment
|
|
7617
|
+
char === 35;
|
|
7618
|
+
}
|
|
7619
|
+
function extractValue(ctx, end) {
|
|
7620
|
+
let errPtr = ctx.p;
|
|
7621
|
+
let c = ctx.s.charCodeAt(ctx.p);
|
|
7241
7622
|
if (c === 91 || c === 123) {
|
|
7242
|
-
|
|
7243
|
-
|
|
7244
|
-
toml: ctx.s,
|
|
7245
|
-
ptr
|
|
7246
|
-
});
|
|
7247
|
-
}
|
|
7248
|
-
let value = c === 91 ? parseArray(ctx, integersAsBigInt) : parseInlineTable(ctx, integersAsBigInt);
|
|
7623
|
+
ctx.d-- || TomlError.x("document contains excessively nested structures. aborting.", ctx);
|
|
7624
|
+
let value = c === 91 ? parseArray(ctx) : parseInlineTable(ctx);
|
|
7249
7625
|
ctx.d++;
|
|
7250
7626
|
return value;
|
|
7251
7627
|
}
|
|
@@ -7254,90 +7630,262 @@ function extractValue(ctx, end, integersAsBigInt) {
|
|
|
7254
7630
|
}
|
|
7255
7631
|
if (c === 116) {
|
|
7256
7632
|
if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101)
|
|
7257
|
-
|
|
7258
|
-
ctx.p
|
|
7259
|
-
return true;
|
|
7633
|
+
TomlError.x("invalid value", ctx, errPtr);
|
|
7634
|
+
return ctx.p++, true;
|
|
7260
7635
|
}
|
|
7261
7636
|
if (c === 102) {
|
|
7262
7637
|
if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 108 || ctx.s.charCodeAt(++ctx.p) !== 115 || ctx.s.charCodeAt(++ctx.p) !== 101)
|
|
7263
|
-
|
|
7264
|
-
ctx.p
|
|
7265
|
-
|
|
7638
|
+
TomlError.x("invalid value", ctx, errPtr);
|
|
7639
|
+
return ctx.p++, false;
|
|
7640
|
+
}
|
|
7641
|
+
if (c === 43 || c === 45) {
|
|
7642
|
+
return parseNumber(ctx, ctx.p, ctx.s.charCodeAt(++ctx.p), 44 - c, end);
|
|
7643
|
+
}
|
|
7644
|
+
if (ctx.s.charCodeAt(ctx.p + 4) === 45 && ctx.s.charCodeAt(ctx.p + 7) === 45) {
|
|
7645
|
+
return parseDate(ctx, c, end);
|
|
7646
|
+
}
|
|
7647
|
+
if (ctx.s.charCodeAt(ctx.p + 2) === 58) {
|
|
7648
|
+
return parseTime(ctx, c, end);
|
|
7649
|
+
}
|
|
7650
|
+
return parseNumber(ctx, ctx.p, c, 0, end);
|
|
7651
|
+
}
|
|
7652
|
+
function parseNumber(ctx, startPtr, startChr, sign, endChr) {
|
|
7653
|
+
let c = startChr;
|
|
7654
|
+
let state = 0;
|
|
7655
|
+
let hasUnderscores = false;
|
|
7656
|
+
if (c === 105) {
|
|
7657
|
+
if (ctx.s.charCodeAt(++ctx.p) !== 110 || ctx.s.charCodeAt(++ctx.p) !== 102)
|
|
7658
|
+
TomlError.x("invalid value", ctx, startPtr);
|
|
7659
|
+
return ctx.p++, (sign || 1) / 0;
|
|
7660
|
+
}
|
|
7661
|
+
if (c === 110) {
|
|
7662
|
+
if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 110)
|
|
7663
|
+
TomlError.x("invalid value", ctx, startPtr);
|
|
7664
|
+
return ctx.p++, NaN;
|
|
7665
|
+
}
|
|
7666
|
+
if (c === 48) {
|
|
7667
|
+
if (++ctx.p >= ctx.s.length || isEndOfValue(c = ctx.s.charCodeAt(ctx.p), endChr))
|
|
7668
|
+
return ctx.bi === true ? 0n : 0;
|
|
7669
|
+
if (!sign) {
|
|
7670
|
+
if (c === 120)
|
|
7671
|
+
return parseIntegerBaseN(ctx, startPtr, 16, endChr);
|
|
7672
|
+
else if (c === 98)
|
|
7673
|
+
return parseIntegerBaseN(ctx, startPtr, 2, endChr);
|
|
7674
|
+
else if (c === 111)
|
|
7675
|
+
return parseIntegerBaseN(ctx, startPtr, 8, endChr);
|
|
7676
|
+
}
|
|
7677
|
+
if (c === 46)
|
|
7678
|
+
state = 2;
|
|
7679
|
+
else if (c === 101 || c === 69)
|
|
7680
|
+
state = 4;
|
|
7681
|
+
else
|
|
7682
|
+
TomlError.x("illegal leading zero", ctx, startPtr);
|
|
7683
|
+
} else if (!isDigit(c))
|
|
7684
|
+
TomlError.x("invalid value", ctx, startPtr);
|
|
7685
|
+
while (++ctx.p < ctx.s.length && (c = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c, endChr))) {
|
|
7686
|
+
if (!state)
|
|
7687
|
+
state = 1;
|
|
7688
|
+
if (c === 95) {
|
|
7689
|
+
if (!(state & 1))
|
|
7690
|
+
TomlError.x("illegal underscore", ctx);
|
|
7691
|
+
state += 11;
|
|
7692
|
+
hasUnderscores = true;
|
|
7693
|
+
} else if (state === 1 && c === 46)
|
|
7694
|
+
state = 2;
|
|
7695
|
+
else if ((state === 1 || state === 3) && (c === 101 || c === 69))
|
|
7696
|
+
state = 4;
|
|
7697
|
+
else if (state === 4 && (c === 43 || c === 45)) {
|
|
7698
|
+
} else if (!isDigit(c))
|
|
7699
|
+
TomlError.x(`illegal character in numeric literal`, ctx);
|
|
7700
|
+
else if (state > 9)
|
|
7701
|
+
state -= 11;
|
|
7702
|
+
else if (!(state & 1))
|
|
7703
|
+
state++;
|
|
7704
|
+
}
|
|
7705
|
+
if (!state) {
|
|
7706
|
+
let val = (startChr - 48) * (sign || 1);
|
|
7707
|
+
return ctx.bi === true ? BigInt(val) : val;
|
|
7708
|
+
}
|
|
7709
|
+
if (!(state & 1))
|
|
7710
|
+
TomlError.x("unfinished numeric value", ctx, startPtr);
|
|
7711
|
+
let str = ctx.s.slice(startPtr, ctx.p);
|
|
7712
|
+
if (hasUnderscores)
|
|
7713
|
+
str = str.replaceAll("_", "");
|
|
7714
|
+
return state > 1 ? parseFloat(str) : parseInteger(ctx, str, 10, startPtr);
|
|
7715
|
+
}
|
|
7716
|
+
function parseIntegerBaseN(ctx, startPtr, base, endChr) {
|
|
7717
|
+
let c, underscore = 1;
|
|
7718
|
+
while (++ctx.p < ctx.s.length && (c = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c, endChr))) {
|
|
7719
|
+
if (c === 95) {
|
|
7720
|
+
if (underscore & 1)
|
|
7721
|
+
TomlError.x("illegal underscore", ctx);
|
|
7722
|
+
underscore = 3;
|
|
7723
|
+
} else if (!isDigit(c, base))
|
|
7724
|
+
TomlError.x(`illegal character in numeric literal`, ctx);
|
|
7725
|
+
else if (underscore & 1)
|
|
7726
|
+
underscore--;
|
|
7727
|
+
}
|
|
7728
|
+
if (underscore & 1)
|
|
7729
|
+
TomlError.x("unfinished numeric value", ctx);
|
|
7730
|
+
let str = ctx.s.slice(startPtr + 2, ctx.p);
|
|
7731
|
+
if (underscore)
|
|
7732
|
+
str = str.replaceAll("_", "");
|
|
7733
|
+
return parseInteger(ctx, str, base, startPtr);
|
|
7734
|
+
}
|
|
7735
|
+
function parseInteger(ctx, str, base, startPtr) {
|
|
7736
|
+
if (ctx.bi !== true)
|
|
7737
|
+
int: {
|
|
7738
|
+
let val = parseInt(str, base);
|
|
7739
|
+
if (!Number.isSafeInteger(val)) {
|
|
7740
|
+
if (ctx.bi)
|
|
7741
|
+
break int;
|
|
7742
|
+
TomlError.x("integer value cannot be represented losslessly", ctx, startPtr);
|
|
7743
|
+
}
|
|
7744
|
+
return val;
|
|
7745
|
+
}
|
|
7746
|
+
return base === 10 ? BigInt(str) : BigInt((base === 2 ? "0b" : base === 8 ? "0o" : "0x") + str);
|
|
7747
|
+
}
|
|
7748
|
+
function parseDate(ctx, c, endChr) {
|
|
7749
|
+
let startPtr = ctx.p++, unsafeSeparator;
|
|
7750
|
+
if (!isDigit(c) || !isDigit(ctx.s.charCodeAt(ctx.p++)) || !isDigit(ctx.s.charCodeAt(ctx.p++)) || !isDigit(ctx.s.charCodeAt(ctx.p++))) {
|
|
7751
|
+
return parseNumber(ctx, ctx.p = startPtr, c, 0, endChr);
|
|
7752
|
+
}
|
|
7753
|
+
ctx.p += 5;
|
|
7754
|
+
if (!isDigit(ctx.s.charCodeAt(ctx.p++)))
|
|
7755
|
+
TomlError.x("invalid date-time: date part is malformed", ctx, startPtr);
|
|
7756
|
+
if (ctx.p >= ctx.s.length || ((c = ctx.s.charCodeAt(ctx.p)) !== 32 || (unsafeSeparator = true, !isDigit(ctx.s.charCodeAt(ctx.p + 1)))) && c !== 84 && c !== 116) {
|
|
7757
|
+
let t2 = ctx.s.slice(startPtr, ctx.p);
|
|
7758
|
+
return readDate(ctx, t2, 3, false, startPtr);
|
|
7759
|
+
}
|
|
7760
|
+
if (ctx.s.charCodeAt(ctx.p += 3) !== 58)
|
|
7761
|
+
TomlError.x("invalid date-time: time part is malformed", ctx, startPtr);
|
|
7762
|
+
if (ctx.s.charCodeAt(ctx.p += 3) === 58)
|
|
7763
|
+
ctx.p += 3;
|
|
7764
|
+
if (ctx.s.charCodeAt(ctx.p) === 46)
|
|
7765
|
+
while (isDigit(ctx.s.charCodeAt(++ctx.p)))
|
|
7766
|
+
;
|
|
7767
|
+
if (c = ctx.s.charCodeAt(ctx.p)) {
|
|
7768
|
+
if (c === 90 || c === 122) {
|
|
7769
|
+
let t2 = ctx.s.slice(startPtr, ++ctx.p);
|
|
7770
|
+
return readDate(ctx, t2, 1, unsafeSeparator, startPtr, "[+00:00]");
|
|
7771
|
+
}
|
|
7772
|
+
if (c === 43 || c === 45) {
|
|
7773
|
+
let t2 = ctx.s.slice(startPtr, ctx.p += 6);
|
|
7774
|
+
return readDate(ctx, t2, 1, unsafeSeparator, startPtr, !ctx.ld && "[" + ctx.s.slice(ctx.p - 6, ctx.p) + "]");
|
|
7775
|
+
}
|
|
7776
|
+
}
|
|
7777
|
+
let t = ctx.s.slice(startPtr, ctx.p);
|
|
7778
|
+
return readDate(ctx, t, 2, unsafeSeparator, startPtr);
|
|
7779
|
+
}
|
|
7780
|
+
function parseTime(ctx, c, endChr) {
|
|
7781
|
+
let start2 = ctx.p;
|
|
7782
|
+
if (!isDigit(c) || !isDigit(ctx.s.charCodeAt(++ctx.p))) {
|
|
7783
|
+
return parseNumber(ctx, --ctx.p, c, 0, endChr);
|
|
7784
|
+
}
|
|
7785
|
+
if (ctx.s.charCodeAt(ctx.p += 4) === 58)
|
|
7786
|
+
ctx.p += 3;
|
|
7787
|
+
if (ctx.s.charCodeAt(ctx.p) === 46)
|
|
7788
|
+
while (isDigit(ctx.s.charCodeAt(++ctx.p)))
|
|
7789
|
+
;
|
|
7790
|
+
let t = ctx.s.slice(start2, ctx.p);
|
|
7791
|
+
return readDate(ctx, t, 4, false, start2);
|
|
7792
|
+
}
|
|
7793
|
+
function readDate(ctx, str, type, unsafeDelim, errPtr, temporalSuffix) {
|
|
7794
|
+
if (ctx.ld) {
|
|
7795
|
+
let date = new TomlDate(str, type, unsafeDelim);
|
|
7796
|
+
if (!date.isValid())
|
|
7797
|
+
TomlError.x("invalid date", ctx, errPtr);
|
|
7798
|
+
return date;
|
|
7799
|
+
}
|
|
7800
|
+
try {
|
|
7801
|
+
if (temporalSuffix)
|
|
7802
|
+
str += temporalSuffix;
|
|
7803
|
+
switch (type) {
|
|
7804
|
+
case 1:
|
|
7805
|
+
return Temporal.ZonedDateTime.from(str);
|
|
7806
|
+
case 2:
|
|
7807
|
+
return Temporal.PlainDateTime.from(str);
|
|
7808
|
+
case 3:
|
|
7809
|
+
return Temporal.PlainDate.from(str);
|
|
7810
|
+
case 4:
|
|
7811
|
+
return Temporal.PlainTime.from(str);
|
|
7812
|
+
}
|
|
7813
|
+
} catch (e) {
|
|
7814
|
+
TomlError.x(e instanceof Error ? e.message : "" + e, ctx, errPtr);
|
|
7815
|
+
}
|
|
7816
|
+
}
|
|
7817
|
+
|
|
7818
|
+
// node_modules/smol-toml/dist/util.js
|
|
7819
|
+
function skipComment(ctx) {
|
|
7820
|
+
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
7821
|
+
let c = ctx.s.charCodeAt(ctx.p);
|
|
7822
|
+
if (c === 10)
|
|
7823
|
+
break;
|
|
7824
|
+
if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
|
|
7825
|
+
ctx.p++;
|
|
7826
|
+
break;
|
|
7827
|
+
}
|
|
7828
|
+
if (c < 32 && c !== 9 || c === 127) {
|
|
7829
|
+
TomlError.x("control characters are not allowed in comments", ctx);
|
|
7830
|
+
}
|
|
7831
|
+
}
|
|
7832
|
+
}
|
|
7833
|
+
function skipVoid(ctx, banNewLines, banComments) {
|
|
7834
|
+
let c;
|
|
7835
|
+
while (ctx.p < ctx.s.length) {
|
|
7836
|
+
while (ctx.p < ctx.s.length && ((c = ctx.s.charCodeAt(ctx.p)) === 32 || c === 9 || !banNewLines && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)))
|
|
7837
|
+
ctx.p++;
|
|
7838
|
+
if (banComments || c !== 35)
|
|
7839
|
+
break;
|
|
7840
|
+
skipComment(ctx);
|
|
7266
7841
|
}
|
|
7267
|
-
return parseValue(ctx, integersAsBigInt, end);
|
|
7268
7842
|
}
|
|
7269
7843
|
|
|
7270
7844
|
// node_modules/smol-toml/dist/struct.js
|
|
7271
|
-
|
|
7272
|
-
|
|
7273
|
-
let
|
|
7274
|
-
let dot = start2 - 1;
|
|
7845
|
+
function parseKey(ctx, end = 61) {
|
|
7846
|
+
let startPtr;
|
|
7847
|
+
let state = 0;
|
|
7275
7848
|
let parsed = [];
|
|
7276
|
-
let
|
|
7277
|
-
|
|
7278
|
-
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
7279
|
-
toml: ctx.s,
|
|
7280
|
-
ptr: start2
|
|
7281
|
-
});
|
|
7282
|
-
}
|
|
7849
|
+
let sliceStart;
|
|
7850
|
+
let c = ctx.s.charCodeAt(startPtr = ctx.p);
|
|
7283
7851
|
do {
|
|
7284
|
-
|
|
7285
|
-
|
|
7286
|
-
|
|
7287
|
-
|
|
7288
|
-
|
|
7289
|
-
|
|
7290
|
-
|
|
7291
|
-
|
|
7292
|
-
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
|
|
7299
|
-
|
|
7300
|
-
|
|
7301
|
-
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
ptr: ctx.p
|
|
7307
|
-
});
|
|
7308
|
-
}
|
|
7309
|
-
if (endPtr < ctx.p) {
|
|
7310
|
-
endPtr = ctx.s.indexOf(end, ctx.p);
|
|
7311
|
-
if (endPtr < 0) {
|
|
7312
|
-
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
7313
|
-
toml: ctx.s,
|
|
7314
|
-
ptr: start2
|
|
7315
|
-
});
|
|
7316
|
-
}
|
|
7317
|
-
}
|
|
7318
|
-
parsed.push(part);
|
|
7319
|
-
} else {
|
|
7320
|
-
dot = ctx.s.indexOf(".", ctx.p);
|
|
7321
|
-
let part = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
7322
|
-
if (!KEY_PART_RE.test(part)) {
|
|
7323
|
-
throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
|
|
7324
|
-
toml: ctx.s,
|
|
7325
|
-
ptr: ctx.p
|
|
7326
|
-
});
|
|
7327
|
-
}
|
|
7328
|
-
parsed.push(part.trimEnd());
|
|
7852
|
+
if (c === end) {
|
|
7853
|
+
if (!state)
|
|
7854
|
+
TomlError.x("unexpected end of key", ctx);
|
|
7855
|
+
if (state === 1)
|
|
7856
|
+
parsed.push(ctx.s.slice(sliceStart, ctx.p));
|
|
7857
|
+
return ctx.p++, parsed;
|
|
7858
|
+
} else if (c === 46) {
|
|
7859
|
+
if (!state)
|
|
7860
|
+
TomlError.x("illegal empty bare key", ctx);
|
|
7861
|
+
if (state === 1)
|
|
7862
|
+
parsed.push(ctx.s.slice(sliceStart, ctx.p));
|
|
7863
|
+
state = 0;
|
|
7864
|
+
} else if (!state && (c === 34 || c === 39)) {
|
|
7865
|
+
if (c === ctx.s.charCodeAt(ctx.p + 1) && c === ctx.s.charCodeAt(ctx.p + 2))
|
|
7866
|
+
TomlError.x("illegal quoted key: multiline strings are not allowed", ctx);
|
|
7867
|
+
parsed.push(parseString(ctx));
|
|
7868
|
+
state = 2;
|
|
7869
|
+
ctx.p--;
|
|
7870
|
+
} else if (c === 32 || c === 9) {
|
|
7871
|
+
if (state === 1) {
|
|
7872
|
+
parsed.push(ctx.s.slice(sliceStart, ctx.p));
|
|
7873
|
+
state = 2;
|
|
7329
7874
|
}
|
|
7875
|
+
} else if (state === 2 || c < 48 && c !== 45 || c > 57 && c < 65 || c > 90 && c < 97 && c !== 95 || c > 122) {
|
|
7876
|
+
TomlError.x("illegal character in key", ctx);
|
|
7877
|
+
} else if (!state) {
|
|
7878
|
+
state = 1;
|
|
7879
|
+
sliceStart = ctx.p;
|
|
7330
7880
|
}
|
|
7331
|
-
} while (
|
|
7332
|
-
|
|
7333
|
-
skipVoid(ctx, true, true);
|
|
7334
|
-
return parsed;
|
|
7881
|
+
} while (c = ctx.s.charCodeAt(++ctx.p));
|
|
7882
|
+
TomlError.x("incomplete key-value: cannot find end of key", ctx, startPtr);
|
|
7335
7883
|
}
|
|
7336
|
-
function parseInlineTable(ctx
|
|
7337
|
-
let
|
|
7884
|
+
function parseInlineTable(ctx) {
|
|
7885
|
+
let startPtr = ctx.p++;
|
|
7886
|
+
let res = /* @__PURE__ */ Object.create(null);
|
|
7338
7887
|
let seen = /* @__PURE__ */ new Set();
|
|
7339
7888
|
let c;
|
|
7340
|
-
ctx.p++;
|
|
7341
7889
|
while (ctx.p < ctx.s.length) {
|
|
7342
7890
|
skipVoid(ctx);
|
|
7343
7891
|
if ((c = ctx.s.charCodeAt(ctx.p)) === 125) {
|
|
@@ -7347,70 +7895,71 @@ function parseInlineTable(ctx, integersAsBigInt) {
|
|
|
7347
7895
|
let k;
|
|
7348
7896
|
let t = res;
|
|
7349
7897
|
let hasOwn = false;
|
|
7350
|
-
let
|
|
7898
|
+
let errPtr = ctx.p;
|
|
7351
7899
|
let key = parseKey(ctx);
|
|
7352
7900
|
for (let i2 = 0; i2 < key.length; i2++) {
|
|
7353
7901
|
if (i2)
|
|
7354
|
-
t = hasOwn ? t[k] : t[k] =
|
|
7902
|
+
t = hasOwn ? t[k] : t[k] = /* @__PURE__ */ Object.create(null);
|
|
7355
7903
|
k = key[i2];
|
|
7356
7904
|
if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k]))) {
|
|
7357
|
-
|
|
7358
|
-
toml: ctx.s,
|
|
7359
|
-
ptr: p
|
|
7360
|
-
});
|
|
7905
|
+
TomlError.x("trying to redefine an already defined value", ctx, errPtr);
|
|
7361
7906
|
}
|
|
7362
|
-
|
|
7907
|
+
let unsafe = k === "__proto__";
|
|
7908
|
+
if (ctx.uk && (unsafe || k === "constructor")) {
|
|
7909
|
+
t = ctx.uk !== 1 && TomlError.x("document contains an unsafe property", ctx, errPtr);
|
|
7910
|
+
break;
|
|
7911
|
+
}
|
|
7912
|
+
if (!hasOwn && unsafe) {
|
|
7363
7913
|
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
7364
7914
|
}
|
|
7365
7915
|
}
|
|
7366
7916
|
if (hasOwn) {
|
|
7367
|
-
|
|
7368
|
-
toml: ctx.s,
|
|
7369
|
-
ptr: ctx.p
|
|
7370
|
-
});
|
|
7917
|
+
TomlError.x("trying to redefine an already defined value", ctx, errPtr);
|
|
7371
7918
|
}
|
|
7372
|
-
|
|
7373
|
-
|
|
7919
|
+
skipVoid(ctx, true, true);
|
|
7920
|
+
let value = extractValue(
|
|
7921
|
+
ctx,
|
|
7922
|
+
125
|
|
7923
|
+
/* } */
|
|
7924
|
+
);
|
|
7925
|
+
if (t && typeof (t[k] = value) === "object")
|
|
7926
|
+
seen.add(value);
|
|
7374
7927
|
skipVoid(ctx);
|
|
7375
7928
|
if ((c = ctx.s.charCodeAt(ctx.p++)) === 125) {
|
|
7376
7929
|
return res;
|
|
7377
7930
|
}
|
|
7378
|
-
if (c !== 44)
|
|
7379
|
-
|
|
7380
|
-
}
|
|
7931
|
+
if (c !== 44)
|
|
7932
|
+
TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
|
|
7381
7933
|
}
|
|
7382
|
-
|
|
7383
|
-
toml: ctx.s,
|
|
7384
|
-
ptr: ctx.p
|
|
7385
|
-
});
|
|
7934
|
+
TomlError.x("unfinished table", ctx, startPtr);
|
|
7386
7935
|
}
|
|
7387
|
-
function parseArray(ctx
|
|
7936
|
+
function parseArray(ctx) {
|
|
7937
|
+
let startPtr = ctx.p++;
|
|
7388
7938
|
let res = [];
|
|
7389
7939
|
let c;
|
|
7390
|
-
ctx.p++;
|
|
7391
7940
|
while (ctx.p < ctx.s.length) {
|
|
7392
7941
|
skipVoid(ctx);
|
|
7393
7942
|
if ((c = ctx.s.charCodeAt(ctx.p)) === 93) {
|
|
7394
7943
|
ctx.p++;
|
|
7395
7944
|
return res;
|
|
7396
7945
|
}
|
|
7397
|
-
res.push(extractValue(
|
|
7946
|
+
res.push(extractValue(
|
|
7947
|
+
ctx,
|
|
7948
|
+
93
|
|
7949
|
+
/* ] */
|
|
7950
|
+
));
|
|
7398
7951
|
skipVoid(ctx);
|
|
7399
7952
|
if ((c = ctx.s.charCodeAt(ctx.p++)) === 93) {
|
|
7400
7953
|
return res;
|
|
7401
7954
|
}
|
|
7402
|
-
if (c !== 44)
|
|
7403
|
-
|
|
7404
|
-
}
|
|
7955
|
+
if (c !== 44)
|
|
7956
|
+
TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
|
|
7405
7957
|
}
|
|
7406
|
-
|
|
7407
|
-
toml: ctx.s,
|
|
7408
|
-
ptr: ctx.p
|
|
7409
|
-
});
|
|
7958
|
+
TomlError.x("unfinished array", ctx, startPtr);
|
|
7410
7959
|
}
|
|
7411
7960
|
|
|
7412
7961
|
// node_modules/smol-toml/dist/parse.js
|
|
7413
|
-
function peekTable(key, table, meta, type) {
|
|
7962
|
+
function peekTable(ctx, key, table, meta, type) {
|
|
7414
7963
|
let t = table;
|
|
7415
7964
|
let m = meta;
|
|
7416
7965
|
let k;
|
|
@@ -7418,7 +7967,7 @@ function peekTable(key, table, meta, type) {
|
|
|
7418
7967
|
let state;
|
|
7419
7968
|
for (let i2 = 0; i2 < key.length; i2++) {
|
|
7420
7969
|
if (i2) {
|
|
7421
|
-
t = hasOwn ? t[k] : t[k] =
|
|
7970
|
+
t = hasOwn ? t[k] : t[k] = /* @__PURE__ */ Object.create(null);
|
|
7422
7971
|
m = (state = m[k]).c;
|
|
7423
7972
|
if (type === 0 && (state.t === 1 || state.t === 2)) {
|
|
7424
7973
|
return null;
|
|
@@ -7434,7 +7983,10 @@ function peekTable(key, table, meta, type) {
|
|
|
7434
7983
|
return null;
|
|
7435
7984
|
}
|
|
7436
7985
|
if (!hasOwn) {
|
|
7437
|
-
|
|
7986
|
+
let unsafe = k === "__proto__";
|
|
7987
|
+
if (ctx.uk && (unsafe || k === "constructor"))
|
|
7988
|
+
return false;
|
|
7989
|
+
if (unsafe) {
|
|
7438
7990
|
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
7439
7991
|
Object.defineProperty(m, k, { enumerable: true, configurable: true, writable: true });
|
|
7440
7992
|
}
|
|
@@ -7442,7 +7994,7 @@ function peekTable(key, table, meta, type) {
|
|
|
7442
7994
|
t: i2 < key.length - 1 && type === 2 ? 3 : type,
|
|
7443
7995
|
d: false,
|
|
7444
7996
|
i: 0,
|
|
7445
|
-
c:
|
|
7997
|
+
c: /* @__PURE__ */ Object.create(null)
|
|
7446
7998
|
};
|
|
7447
7999
|
}
|
|
7448
8000
|
}
|
|
@@ -7455,43 +8007,60 @@ function peekTable(key, table, meta, type) {
|
|
|
7455
8007
|
state.d = true;
|
|
7456
8008
|
t[k] = [];
|
|
7457
8009
|
}
|
|
7458
|
-
t[k].push(t =
|
|
7459
|
-
state.c[state.i++] = state = { t: 1, d: false, i: 0, c:
|
|
8010
|
+
t[k].push(t = /* @__PURE__ */ Object.create(null));
|
|
8011
|
+
state.c[state.i++] = state = { t: 1, d: false, i: 0, c: /* @__PURE__ */ Object.create(null) };
|
|
7460
8012
|
}
|
|
7461
8013
|
if (state.d) {
|
|
7462
8014
|
return null;
|
|
7463
8015
|
}
|
|
7464
8016
|
state.d = true;
|
|
7465
8017
|
if (type === 1) {
|
|
7466
|
-
t = hasOwn ? t[k] : t[k] =
|
|
8018
|
+
t = hasOwn ? t[k] : t[k] = /* @__PURE__ */ Object.create(null);
|
|
7467
8019
|
} else if (type === 0 && hasOwn) {
|
|
7468
8020
|
return null;
|
|
7469
8021
|
}
|
|
7470
8022
|
return [k, t, state.c];
|
|
7471
8023
|
}
|
|
7472
|
-
function
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
8024
|
+
function validateTablePeek(ctx, peek, ptr) {
|
|
8025
|
+
if (peek === null || ctx.uk === 2)
|
|
8026
|
+
TomlError.x(peek === null ? "trying to redefine an already defined table or value" : "document contains an unsafe property", ctx, ptr);
|
|
8027
|
+
}
|
|
8028
|
+
function parse(toml, options = {}) {
|
|
8029
|
+
let ctx = {
|
|
8030
|
+
s: toml,
|
|
8031
|
+
p: 0,
|
|
8032
|
+
d: options.maxDepth ?? 1e3,
|
|
8033
|
+
bi: options.integersAsBigInt ?? false,
|
|
8034
|
+
ld: options.useLegacyDate ?? true,
|
|
8035
|
+
uk: options.unsafeKeyBehaviour === "throw" ? 2 : options.unsafeKeyBehaviour === "drop" ? 1 : 0
|
|
8036
|
+
};
|
|
8037
|
+
let res = /* @__PURE__ */ Object.create(null);
|
|
8038
|
+
let meta = /* @__PURE__ */ Object.create(null);
|
|
7476
8039
|
let tmp;
|
|
8040
|
+
let skipping = false;
|
|
7477
8041
|
let tbl = res;
|
|
7478
8042
|
let m = meta;
|
|
8043
|
+
if (toml.charCodeAt(0) === 65279)
|
|
8044
|
+
ctx.p++;
|
|
7479
8045
|
skipVoid(ctx);
|
|
7480
8046
|
while (ctx.p < toml.length) {
|
|
7481
8047
|
if (toml.charCodeAt(ctx.p) === 91) {
|
|
7482
8048
|
let isTableArray = toml.charCodeAt(++ctx.p) === 91;
|
|
7483
8049
|
tmp = ctx.p += +isTableArray;
|
|
7484
|
-
|
|
8050
|
+
skipping = false;
|
|
8051
|
+
let k = parseKey(
|
|
8052
|
+
ctx,
|
|
8053
|
+
93
|
|
8054
|
+
/* ] */
|
|
8055
|
+
);
|
|
7485
8056
|
if (isTableArray) {
|
|
7486
|
-
if (toml.charCodeAt(ctx.p
|
|
7487
|
-
|
|
7488
|
-
toml,
|
|
7489
|
-
ptr: ctx.p - 1
|
|
7490
|
-
});
|
|
8057
|
+
if (toml.charCodeAt(ctx.p) !== 93) {
|
|
8058
|
+
TomlError.x("expected end of table array declaration", ctx);
|
|
7491
8059
|
}
|
|
7492
8060
|
ctx.p++;
|
|
7493
8061
|
}
|
|
7494
8062
|
let p = peekTable(
|
|
8063
|
+
ctx,
|
|
7495
8064
|
k,
|
|
7496
8065
|
res,
|
|
7497
8066
|
meta,
|
|
@@ -7499,43 +8068,42 @@ function parse(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
|
|
|
7499
8068
|
/* Type.EXPLICIT */
|
|
7500
8069
|
);
|
|
7501
8070
|
if (!p) {
|
|
7502
|
-
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
|
|
8071
|
+
validateTablePeek(ctx, p, tmp);
|
|
8072
|
+
skipping = true;
|
|
8073
|
+
} else {
|
|
8074
|
+
m = p[2];
|
|
8075
|
+
tbl = p[1];
|
|
7506
8076
|
}
|
|
7507
|
-
m = p[2];
|
|
7508
|
-
tbl = p[1];
|
|
7509
8077
|
} else {
|
|
7510
8078
|
tmp = ctx.p;
|
|
7511
8079
|
let k = parseKey(ctx);
|
|
7512
8080
|
let p = peekTable(
|
|
8081
|
+
ctx,
|
|
7513
8082
|
k,
|
|
7514
8083
|
tbl,
|
|
7515
8084
|
m,
|
|
7516
8085
|
0
|
|
7517
8086
|
/* Type.DOTTED */
|
|
7518
8087
|
);
|
|
7519
|
-
if (!p)
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
p[1][p[0]] = extractValue(ctx, void 0, integersAsBigInt);
|
|
8088
|
+
if (!p && !skipping)
|
|
8089
|
+
validateTablePeek(ctx, p, tmp);
|
|
8090
|
+
skipVoid(ctx, true, true);
|
|
8091
|
+
let v = extractValue(ctx, void 0);
|
|
8092
|
+
if (p && !skipping)
|
|
8093
|
+
p[1][p[0]] = v;
|
|
7526
8094
|
}
|
|
7527
8095
|
skipVoid(ctx, true);
|
|
7528
|
-
if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && tmp !== 13) {
|
|
7529
|
-
|
|
7530
|
-
toml,
|
|
7531
|
-
ptr: ctx.p
|
|
7532
|
-
});
|
|
8096
|
+
if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && (tmp !== 13 || toml.charCodeAt(ctx.p + 1) !== 10)) {
|
|
8097
|
+
TomlError.x("each key-value declaration must be followed by an end-of-line", ctx);
|
|
7533
8098
|
}
|
|
7534
8099
|
skipVoid(ctx);
|
|
7535
8100
|
}
|
|
7536
8101
|
return res;
|
|
7537
8102
|
}
|
|
7538
8103
|
|
|
8104
|
+
// node_modules/smol-toml/dist/stringify.js
|
|
8105
|
+
var HAS_WELLFORMED = !!"".isWellFormed;
|
|
8106
|
+
|
|
7539
8107
|
// packages/cli/src/status.ts
|
|
7540
8108
|
init_hookRuntime();
|
|
7541
8109
|
import { devReadiness, expectedScannerDisclosureVersion } from "./runtime/releaseSource.js";
|
|
@@ -8212,11 +8780,11 @@ export {
|
|
|
8212
8780
|
};
|
|
8213
8781
|
/*! Bundled license information:
|
|
8214
8782
|
|
|
8215
|
-
smol-toml/dist/date.js:
|
|
8216
8783
|
smol-toml/dist/error.js:
|
|
8217
|
-
smol-toml/dist/util.js:
|
|
8218
8784
|
smol-toml/dist/primitive.js:
|
|
8785
|
+
smol-toml/dist/date.js:
|
|
8219
8786
|
smol-toml/dist/extract.js:
|
|
8787
|
+
smol-toml/dist/util.js:
|
|
8220
8788
|
smol-toml/dist/struct.js:
|
|
8221
8789
|
smol-toml/dist/parse.js:
|
|
8222
8790
|
smol-toml/dist/stringify.js:
|