1 | import { createRequire as __prettierCreateRequire } from "module";
|
2 | import { fileURLToPath as __prettierFileUrlToPath } from "url";
|
3 | import { dirname as __prettierDirname } from "path";
|
4 | const require = __prettierCreateRequire(import.meta.url);
|
5 | const __filename = __prettierFileUrlToPath(import.meta.url);
|
6 | const __dirname = __prettierDirname(__filename);
|
7 |
|
8 | var __create = Object.create;
|
9 | var __defProp = Object.defineProperty;
|
10 | var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
11 | var __getOwnPropNames = Object.getOwnPropertyNames;
|
12 | var __getProtoOf = Object.getPrototypeOf;
|
13 | var __hasOwnProp = Object.prototype.hasOwnProperty;
|
14 | var __typeError = (msg) => {
|
15 | throw TypeError(msg);
|
16 | };
|
17 | var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
|
18 | var __require = ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
19 | get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
20 | }) : x)(function(x) {
|
21 | if (typeof require !== "undefined") return require.apply(this, arguments);
|
22 | throw Error('Dynamic require of "' + x + '" is not supported');
|
23 | });
|
24 | var __esm = (fn, res) => function __init() {
|
25 | return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
26 | };
|
27 | var __commonJS = (cb, mod) => function __require2() {
|
28 | return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
29 | };
|
30 | var __export = (target, all) => {
|
31 | for (var name in all)
|
32 | __defProp(target, name, { get: all[name], enumerable: true });
|
33 | };
|
34 | var __copyProps = (to, from, except, desc) => {
|
35 | if (from && typeof from === "object" || typeof from === "function") {
|
36 | for (let key2 of __getOwnPropNames(from))
|
37 | if (!__hasOwnProp.call(to, key2) && key2 !== except)
|
38 | __defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable });
|
39 | }
|
40 | return to;
|
41 | };
|
42 | var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
43 |
|
44 |
|
45 |
|
46 |
|
47 | isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
48 | mod
|
49 | ));
|
50 | var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
51 | var __publicField = (obj, key2, value) => __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
|
52 | var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
53 | var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
54 | var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
55 | var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
56 | var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
57 |
|
58 |
|
59 | var require_array = __commonJS({
|
60 | "node_modules/fast-glob/out/utils/array.js"(exports) {
|
61 | "use strict";
|
62 | Object.defineProperty(exports, "__esModule", { value: true });
|
63 | exports.splitWhen = exports.flatten = void 0;
|
64 | function flatten(items) {
|
65 | return items.reduce((collection, item) => [].concat(collection, item), []);
|
66 | }
|
67 | exports.flatten = flatten;
|
68 | function splitWhen(items, predicate) {
|
69 | const result = [[]];
|
70 | let groupIndex = 0;
|
71 | for (const item of items) {
|
72 | if (predicate(item)) {
|
73 | groupIndex++;
|
74 | result[groupIndex] = [];
|
75 | } else {
|
76 | result[groupIndex].push(item);
|
77 | }
|
78 | }
|
79 | return result;
|
80 | }
|
81 | exports.splitWhen = splitWhen;
|
82 | }
|
83 | });
|
84 |
|
85 |
|
86 | var require_errno = __commonJS({
|
87 | "node_modules/fast-glob/out/utils/errno.js"(exports) {
|
88 | "use strict";
|
89 | Object.defineProperty(exports, "__esModule", { value: true });
|
90 | exports.isEnoentCodeError = void 0;
|
91 | function isEnoentCodeError(error) {
|
92 | return error.code === "ENOENT";
|
93 | }
|
94 | exports.isEnoentCodeError = isEnoentCodeError;
|
95 | }
|
96 | });
|
97 |
|
98 |
|
99 | var require_fs = __commonJS({
|
100 | "node_modules/fast-glob/out/utils/fs.js"(exports) {
|
101 | "use strict";
|
102 | Object.defineProperty(exports, "__esModule", { value: true });
|
103 | exports.createDirentFromStats = void 0;
|
104 | var DirentFromStats = class {
|
105 | constructor(name, stats) {
|
106 | this.name = name;
|
107 | this.isBlockDevice = stats.isBlockDevice.bind(stats);
|
108 | this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
|
109 | this.isDirectory = stats.isDirectory.bind(stats);
|
110 | this.isFIFO = stats.isFIFO.bind(stats);
|
111 | this.isFile = stats.isFile.bind(stats);
|
112 | this.isSocket = stats.isSocket.bind(stats);
|
113 | this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
|
114 | }
|
115 | };
|
116 | function createDirentFromStats(name, stats) {
|
117 | return new DirentFromStats(name, stats);
|
118 | }
|
119 | exports.createDirentFromStats = createDirentFromStats;
|
120 | }
|
121 | });
|
122 |
|
123 |
|
124 | var require_path = __commonJS({
|
125 | "node_modules/fast-glob/out/utils/path.js"(exports) {
|
126 | "use strict";
|
127 | Object.defineProperty(exports, "__esModule", { value: true });
|
128 | exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = void 0;
|
129 | var os2 = __require("os");
|
130 | var path13 = __require("path");
|
131 | var IS_WINDOWS_PLATFORM = os2.platform() === "win32";
|
132 | var LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
|
133 | var POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
|
134 | var WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()[\]{}]|^!|[!+@](?=\())/g;
|
135 | var DOS_DEVICE_PATH_RE = /^\\\\([.?])/;
|
136 | var WINDOWS_BACKSLASHES_RE = /\\(?![!()+@[\]{}])/g;
|
137 | function unixify(filepath) {
|
138 | return filepath.replace(/\\/g, "/");
|
139 | }
|
140 | exports.unixify = unixify;
|
141 | function makeAbsolute(cwd, filepath) {
|
142 | return path13.resolve(cwd, filepath);
|
143 | }
|
144 | exports.makeAbsolute = makeAbsolute;
|
145 | function removeLeadingDotSegment(entry) {
|
146 | if (entry.charAt(0) === ".") {
|
147 | const secondCharactery = entry.charAt(1);
|
148 | if (secondCharactery === "/" || secondCharactery === "\\") {
|
149 | return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT);
|
150 | }
|
151 | }
|
152 | return entry;
|
153 | }
|
154 | exports.removeLeadingDotSegment = removeLeadingDotSegment;
|
155 | exports.escape = IS_WINDOWS_PLATFORM ? escapeWindowsPath : escapePosixPath;
|
156 | function escapeWindowsPath(pattern) {
|
157 | return pattern.replace(WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE, "\\$2");
|
158 | }
|
159 | exports.escapeWindowsPath = escapeWindowsPath;
|
160 | function escapePosixPath(pattern) {
|
161 | return pattern.replace(POSIX_UNESCAPED_GLOB_SYMBOLS_RE, "\\$2");
|
162 | }
|
163 | exports.escapePosixPath = escapePosixPath;
|
164 | exports.convertPathToPattern = IS_WINDOWS_PLATFORM ? convertWindowsPathToPattern : convertPosixPathToPattern;
|
165 | function convertWindowsPathToPattern(filepath) {
|
166 | return escapeWindowsPath(filepath).replace(DOS_DEVICE_PATH_RE, "//$1").replace(WINDOWS_BACKSLASHES_RE, "/");
|
167 | }
|
168 | exports.convertWindowsPathToPattern = convertWindowsPathToPattern;
|
169 | function convertPosixPathToPattern(filepath) {
|
170 | return escapePosixPath(filepath);
|
171 | }
|
172 | exports.convertPosixPathToPattern = convertPosixPathToPattern;
|
173 | }
|
174 | });
|
175 |
|
176 |
|
177 | var require_is_extglob = __commonJS({
|
178 | "node_modules/is-extglob/index.js"(exports, module) {
|
179 | module.exports = function isExtglob(str2) {
|
180 | if (typeof str2 !== "string" || str2 === "") {
|
181 | return false;
|
182 | }
|
183 | var match;
|
184 | while (match = /(\\).|([@?!+*]\(.*\))/g.exec(str2)) {
|
185 | if (match[2]) return true;
|
186 | str2 = str2.slice(match.index + match[0].length);
|
187 | }
|
188 | return false;
|
189 | };
|
190 | }
|
191 | });
|
192 |
|
193 |
|
194 | var require_is_glob = __commonJS({
|
195 | "node_modules/is-glob/index.js"(exports, module) {
|
196 | var isExtglob = require_is_extglob();
|
197 | var chars = { "{": "}", "(": ")", "[": "]" };
|
198 | var strictCheck = function(str2) {
|
199 | if (str2[0] === "!") {
|
200 | return true;
|
201 | }
|
202 | var index = 0;
|
203 | var pipeIndex = -2;
|
204 | var closeSquareIndex = -2;
|
205 | var closeCurlyIndex = -2;
|
206 | var closeParenIndex = -2;
|
207 | var backSlashIndex = -2;
|
208 | while (index < str2.length) {
|
209 | if (str2[index] === "*") {
|
210 | return true;
|
211 | }
|
212 | if (str2[index + 1] === "?" && /[\].+)]/.test(str2[index])) {
|
213 | return true;
|
214 | }
|
215 | if (closeSquareIndex !== -1 && str2[index] === "[" && str2[index + 1] !== "]") {
|
216 | if (closeSquareIndex < index) {
|
217 | closeSquareIndex = str2.indexOf("]", index);
|
218 | }
|
219 | if (closeSquareIndex > index) {
|
220 | if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) {
|
221 | return true;
|
222 | }
|
223 | backSlashIndex = str2.indexOf("\\", index);
|
224 | if (backSlashIndex === -1 || backSlashIndex > closeSquareIndex) {
|
225 | return true;
|
226 | }
|
227 | }
|
228 | }
|
229 | if (closeCurlyIndex !== -1 && str2[index] === "{" && str2[index + 1] !== "}") {
|
230 | closeCurlyIndex = str2.indexOf("}", index);
|
231 | if (closeCurlyIndex > index) {
|
232 | backSlashIndex = str2.indexOf("\\", index);
|
233 | if (backSlashIndex === -1 || backSlashIndex > closeCurlyIndex) {
|
234 | return true;
|
235 | }
|
236 | }
|
237 | }
|
238 | if (closeParenIndex !== -1 && str2[index] === "(" && str2[index + 1] === "?" && /[:!=]/.test(str2[index + 2]) && str2[index + 3] !== ")") {
|
239 | closeParenIndex = str2.indexOf(")", index);
|
240 | if (closeParenIndex > index) {
|
241 | backSlashIndex = str2.indexOf("\\", index);
|
242 | if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) {
|
243 | return true;
|
244 | }
|
245 | }
|
246 | }
|
247 | if (pipeIndex !== -1 && str2[index] === "(" && str2[index + 1] !== "|") {
|
248 | if (pipeIndex < index) {
|
249 | pipeIndex = str2.indexOf("|", index);
|
250 | }
|
251 | if (pipeIndex !== -1 && str2[pipeIndex + 1] !== ")") {
|
252 | closeParenIndex = str2.indexOf(")", pipeIndex);
|
253 | if (closeParenIndex > pipeIndex) {
|
254 | backSlashIndex = str2.indexOf("\\", pipeIndex);
|
255 | if (backSlashIndex === -1 || backSlashIndex > closeParenIndex) {
|
256 | return true;
|
257 | }
|
258 | }
|
259 | }
|
260 | }
|
261 | if (str2[index] === "\\") {
|
262 | var open = str2[index + 1];
|
263 | index += 2;
|
264 | var close = chars[open];
|
265 | if (close) {
|
266 | var n = str2.indexOf(close, index);
|
267 | if (n !== -1) {
|
268 | index = n + 1;
|
269 | }
|
270 | }
|
271 | if (str2[index] === "!") {
|
272 | return true;
|
273 | }
|
274 | } else {
|
275 | index++;
|
276 | }
|
277 | }
|
278 | return false;
|
279 | };
|
280 | var relaxedCheck = function(str2) {
|
281 | if (str2[0] === "!") {
|
282 | return true;
|
283 | }
|
284 | var index = 0;
|
285 | while (index < str2.length) {
|
286 | if (/[*?{}()[\]]/.test(str2[index])) {
|
287 | return true;
|
288 | }
|
289 | if (str2[index] === "\\") {
|
290 | var open = str2[index + 1];
|
291 | index += 2;
|
292 | var close = chars[open];
|
293 | if (close) {
|
294 | var n = str2.indexOf(close, index);
|
295 | if (n !== -1) {
|
296 | index = n + 1;
|
297 | }
|
298 | }
|
299 | if (str2[index] === "!") {
|
300 | return true;
|
301 | }
|
302 | } else {
|
303 | index++;
|
304 | }
|
305 | }
|
306 | return false;
|
307 | };
|
308 | module.exports = function isGlob(str2, options8) {
|
309 | if (typeof str2 !== "string" || str2 === "") {
|
310 | return false;
|
311 | }
|
312 | if (isExtglob(str2)) {
|
313 | return true;
|
314 | }
|
315 | var check2 = strictCheck;
|
316 | if (options8 && options8.strict === false) {
|
317 | check2 = relaxedCheck;
|
318 | }
|
319 | return check2(str2);
|
320 | };
|
321 | }
|
322 | });
|
323 |
|
324 |
|
325 | var require_glob_parent = __commonJS({
|
326 | "node_modules/glob-parent/index.js"(exports, module) {
|
327 | "use strict";
|
328 | var isGlob = require_is_glob();
|
329 | var pathPosixDirname = __require("path").posix.dirname;
|
330 | var isWin32 = __require("os").platform() === "win32";
|
331 | var slash2 = "/";
|
332 | var backslash = /\\/g;
|
333 | var enclosure = /[\{\[].*[\}\]]$/;
|
334 | var globby = /(^|[^\\])([\{\[]|\([^\)]+$)/;
|
335 | var escaped = /\\([\!\*\?\|\[\]\(\)\{\}])/g;
|
336 | module.exports = function globParent(str2, opts) {
|
337 | var options8 = Object.assign({ flipBackslashes: true }, opts);
|
338 | if (options8.flipBackslashes && isWin32 && str2.indexOf(slash2) < 0) {
|
339 | str2 = str2.replace(backslash, slash2);
|
340 | }
|
341 | if (enclosure.test(str2)) {
|
342 | str2 += slash2;
|
343 | }
|
344 | str2 += "a";
|
345 | do {
|
346 | str2 = pathPosixDirname(str2);
|
347 | } while (isGlob(str2) || globby.test(str2));
|
348 | return str2.replace(escaped, "$1");
|
349 | };
|
350 | }
|
351 | });
|
352 |
|
353 |
|
354 | var require_utils = __commonJS({
|
355 | "node_modules/braces/lib/utils.js"(exports) {
|
356 | "use strict";
|
357 | exports.isInteger = (num) => {
|
358 | if (typeof num === "number") {
|
359 | return Number.isInteger(num);
|
360 | }
|
361 | if (typeof num === "string" && num.trim() !== "") {
|
362 | return Number.isInteger(Number(num));
|
363 | }
|
364 | return false;
|
365 | };
|
366 | exports.find = (node, type2) => node.nodes.find((node2) => node2.type === type2);
|
367 | exports.exceedsLimit = (min, max, step = 1, limit) => {
|
368 | if (limit === false) return false;
|
369 | if (!exports.isInteger(min) || !exports.isInteger(max)) return false;
|
370 | return (Number(max) - Number(min)) / Number(step) >= limit;
|
371 | };
|
372 | exports.escapeNode = (block, n = 0, type2) => {
|
373 | const node = block.nodes[n];
|
374 | if (!node) return;
|
375 | if (type2 && node.type === type2 || node.type === "open" || node.type === "close") {
|
376 | if (node.escaped !== true) {
|
377 | node.value = "\\" + node.value;
|
378 | node.escaped = true;
|
379 | }
|
380 | }
|
381 | };
|
382 | exports.encloseBrace = (node) => {
|
383 | if (node.type !== "brace") return false;
|
384 | if (node.commas >> 0 + node.ranges >> 0 === 0) {
|
385 | node.invalid = true;
|
386 | return true;
|
387 | }
|
388 | return false;
|
389 | };
|
390 | exports.isInvalidBrace = (block) => {
|
391 | if (block.type !== "brace") return false;
|
392 | if (block.invalid === true || block.dollar) return true;
|
393 | if (block.commas >> 0 + block.ranges >> 0 === 0) {
|
394 | block.invalid = true;
|
395 | return true;
|
396 | }
|
397 | if (block.open !== true || block.close !== true) {
|
398 | block.invalid = true;
|
399 | return true;
|
400 | }
|
401 | return false;
|
402 | };
|
403 | exports.isOpenOrClose = (node) => {
|
404 | if (node.type === "open" || node.type === "close") {
|
405 | return true;
|
406 | }
|
407 | return node.open === true || node.close === true;
|
408 | };
|
409 | exports.reduce = (nodes) => nodes.reduce((acc, node) => {
|
410 | if (node.type === "text") acc.push(node.value);
|
411 | if (node.type === "range") node.type = "text";
|
412 | return acc;
|
413 | }, []);
|
414 | exports.flatten = (...args) => {
|
415 | const result = [];
|
416 | const flat = (arr) => {
|
417 | for (let i = 0; i < arr.length; i++) {
|
418 | const ele = arr[i];
|
419 | if (Array.isArray(ele)) {
|
420 | flat(ele);
|
421 | continue;
|
422 | }
|
423 | if (ele !== void 0) {
|
424 | result.push(ele);
|
425 | }
|
426 | }
|
427 | return result;
|
428 | };
|
429 | flat(args);
|
430 | return result;
|
431 | };
|
432 | }
|
433 | });
|
434 |
|
435 |
|
436 | var require_stringify = __commonJS({
|
437 | "node_modules/braces/lib/stringify.js"(exports, module) {
|
438 | "use strict";
|
439 | var utils = require_utils();
|
440 | module.exports = (ast, options8 = {}) => {
|
441 | const stringify = (node, parent = {}) => {
|
442 | const invalidBlock = options8.escapeInvalid && utils.isInvalidBrace(parent);
|
443 | const invalidNode = node.invalid === true && options8.escapeInvalid === true;
|
444 | let output = "";
|
445 | if (node.value) {
|
446 | if ((invalidBlock || invalidNode) && utils.isOpenOrClose(node)) {
|
447 | return "\\" + node.value;
|
448 | }
|
449 | return node.value;
|
450 | }
|
451 | if (node.value) {
|
452 | return node.value;
|
453 | }
|
454 | if (node.nodes) {
|
455 | for (const child of node.nodes) {
|
456 | output += stringify(child);
|
457 | }
|
458 | }
|
459 | return output;
|
460 | };
|
461 | return stringify(ast);
|
462 | };
|
463 | }
|
464 | });
|
465 |
|
466 |
|
467 | var require_is_number = __commonJS({
|
468 | "node_modules/is-number/index.js"(exports, module) {
|
469 | "use strict";
|
470 | module.exports = function(num) {
|
471 | if (typeof num === "number") {
|
472 | return num - num === 0;
|
473 | }
|
474 | if (typeof num === "string" && num.trim() !== "") {
|
475 | return Number.isFinite ? Number.isFinite(+num) : isFinite(+num);
|
476 | }
|
477 | return false;
|
478 | };
|
479 | }
|
480 | });
|
481 |
|
482 |
|
483 | var require_to_regex_range = __commonJS({
|
484 | "node_modules/to-regex-range/index.js"(exports, module) {
|
485 | "use strict";
|
486 | var isNumber = require_is_number();
|
487 | var toRegexRange = (min, max, options8) => {
|
488 | if (isNumber(min) === false) {
|
489 | throw new TypeError("toRegexRange: expected the first argument to be a number");
|
490 | }
|
491 | if (max === void 0 || min === max) {
|
492 | return String(min);
|
493 | }
|
494 | if (isNumber(max) === false) {
|
495 | throw new TypeError("toRegexRange: expected the second argument to be a number.");
|
496 | }
|
497 | let opts = { relaxZeros: true, ...options8 };
|
498 | if (typeof opts.strictZeros === "boolean") {
|
499 | opts.relaxZeros = opts.strictZeros === false;
|
500 | }
|
501 | let relax = String(opts.relaxZeros);
|
502 | let shorthand = String(opts.shorthand);
|
503 | let capture = String(opts.capture);
|
504 | let wrap = String(opts.wrap);
|
505 | let cacheKey = min + ":" + max + "=" + relax + shorthand + capture + wrap;
|
506 | if (toRegexRange.cache.hasOwnProperty(cacheKey)) {
|
507 | return toRegexRange.cache[cacheKey].result;
|
508 | }
|
509 | let a = Math.min(min, max);
|
510 | let b = Math.max(min, max);
|
511 | if (Math.abs(a - b) === 1) {
|
512 | let result = min + "|" + max;
|
513 | if (opts.capture) {
|
514 | return `(${result})`;
|
515 | }
|
516 | if (opts.wrap === false) {
|
517 | return result;
|
518 | }
|
519 | return `(?:${result})`;
|
520 | }
|
521 | let isPadded = hasPadding(min) || hasPadding(max);
|
522 | let state = { min, max, a, b };
|
523 | let positives = [];
|
524 | let negatives = [];
|
525 | if (isPadded) {
|
526 | state.isPadded = isPadded;
|
527 | state.maxLen = String(state.max).length;
|
528 | }
|
529 | if (a < 0) {
|
530 | let newMin = b < 0 ? Math.abs(b) : 1;
|
531 | negatives = splitToPatterns(newMin, Math.abs(a), state, opts);
|
532 | a = state.a = 0;
|
533 | }
|
534 | if (b >= 0) {
|
535 | positives = splitToPatterns(a, b, state, opts);
|
536 | }
|
537 | state.negatives = negatives;
|
538 | state.positives = positives;
|
539 | state.result = collatePatterns(negatives, positives, opts);
|
540 | if (opts.capture === true) {
|
541 | state.result = `(${state.result})`;
|
542 | } else if (opts.wrap !== false && positives.length + negatives.length > 1) {
|
543 | state.result = `(?:${state.result})`;
|
544 | }
|
545 | toRegexRange.cache[cacheKey] = state;
|
546 | return state.result;
|
547 | };
|
548 | function collatePatterns(neg, pos2, options8) {
|
549 | let onlyNegative = filterPatterns(neg, pos2, "-", false, options8) || [];
|
550 | let onlyPositive = filterPatterns(pos2, neg, "", false, options8) || [];
|
551 | let intersected = filterPatterns(neg, pos2, "-?", true, options8) || [];
|
552 | let subpatterns = onlyNegative.concat(intersected).concat(onlyPositive);
|
553 | return subpatterns.join("|");
|
554 | }
|
555 | function splitToRanges(min, max) {
|
556 | let nines = 1;
|
557 | let zeros = 1;
|
558 | let stop = countNines(min, nines);
|
559 | let stops = new Set([max]);
|
560 | while (min <= stop && stop <= max) {
|
561 | stops.add(stop);
|
562 | nines += 1;
|
563 | stop = countNines(min, nines);
|
564 | }
|
565 | stop = countZeros(max + 1, zeros) - 1;
|
566 | while (min < stop && stop <= max) {
|
567 | stops.add(stop);
|
568 | zeros += 1;
|
569 | stop = countZeros(max + 1, zeros) - 1;
|
570 | }
|
571 | stops = [...stops];
|
572 | stops.sort(compare);
|
573 | return stops;
|
574 | }
|
575 | function rangeToPattern(start, stop, options8) {
|
576 | if (start === stop) {
|
577 | return { pattern: start, count: [], digits: 0 };
|
578 | }
|
579 | let zipped = zip(start, stop);
|
580 | let digits = zipped.length;
|
581 | let pattern = "";
|
582 | let count = 0;
|
583 | for (let i = 0; i < digits; i++) {
|
584 | let [startDigit, stopDigit] = zipped[i];
|
585 | if (startDigit === stopDigit) {
|
586 | pattern += startDigit;
|
587 | } else if (startDigit !== "0" || stopDigit !== "9") {
|
588 | pattern += toCharacterClass(startDigit, stopDigit, options8);
|
589 | } else {
|
590 | count++;
|
591 | }
|
592 | }
|
593 | if (count) {
|
594 | pattern += options8.shorthand === true ? "\\d" : "[0-9]";
|
595 | }
|
596 | return { pattern, count: [count], digits };
|
597 | }
|
598 | function splitToPatterns(min, max, tok, options8) {
|
599 | let ranges = splitToRanges(min, max);
|
600 | let tokens = [];
|
601 | let start = min;
|
602 | let prev;
|
603 | for (let i = 0; i < ranges.length; i++) {
|
604 | let max2 = ranges[i];
|
605 | let obj = rangeToPattern(String(start), String(max2), options8);
|
606 | let zeros = "";
|
607 | if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
|
608 | if (prev.count.length > 1) {
|
609 | prev.count.pop();
|
610 | }
|
611 | prev.count.push(obj.count[0]);
|
612 | prev.string = prev.pattern + toQuantifier(prev.count);
|
613 | start = max2 + 1;
|
614 | continue;
|
615 | }
|
616 | if (tok.isPadded) {
|
617 | zeros = padZeros(max2, tok, options8);
|
618 | }
|
619 | obj.string = zeros + obj.pattern + toQuantifier(obj.count);
|
620 | tokens.push(obj);
|
621 | start = max2 + 1;
|
622 | prev = obj;
|
623 | }
|
624 | return tokens;
|
625 | }
|
626 | function filterPatterns(arr, comparison, prefix, intersection, options8) {
|
627 | let result = [];
|
628 | for (let ele of arr) {
|
629 | let { string } = ele;
|
630 | if (!intersection && !contains(comparison, "string", string)) {
|
631 | result.push(prefix + string);
|
632 | }
|
633 | if (intersection && contains(comparison, "string", string)) {
|
634 | result.push(prefix + string);
|
635 | }
|
636 | }
|
637 | return result;
|
638 | }
|
639 | function zip(a, b) {
|
640 | let arr = [];
|
641 | for (let i = 0; i < a.length; i++) arr.push([a[i], b[i]]);
|
642 | return arr;
|
643 | }
|
644 | function compare(a, b) {
|
645 | return a > b ? 1 : b > a ? -1 : 0;
|
646 | }
|
647 | function contains(arr, key2, val) {
|
648 | return arr.some((ele) => ele[key2] === val);
|
649 | }
|
650 | function countNines(min, len) {
|
651 | return Number(String(min).slice(0, -len) + "9".repeat(len));
|
652 | }
|
653 | function countZeros(integer, zeros) {
|
654 | return integer - integer % Math.pow(10, zeros);
|
655 | }
|
656 | function toQuantifier(digits) {
|
657 | let [start = 0, stop = ""] = digits;
|
658 | if (stop || start > 1) {
|
659 | return `{${start + (stop ? "," + stop : "")}}`;
|
660 | }
|
661 | return "";
|
662 | }
|
663 | function toCharacterClass(a, b, options8) {
|
664 | return `[${a}${b - a === 1 ? "" : "-"}${b}]`;
|
665 | }
|
666 | function hasPadding(str2) {
|
667 | return /^-?(0+)\d/.test(str2);
|
668 | }
|
669 | function padZeros(value, tok, options8) {
|
670 | if (!tok.isPadded) {
|
671 | return value;
|
672 | }
|
673 | let diff2 = Math.abs(tok.maxLen - String(value).length);
|
674 | let relax = options8.relaxZeros !== false;
|
675 | switch (diff2) {
|
676 | case 0:
|
677 | return "";
|
678 | case 1:
|
679 | return relax ? "0?" : "0";
|
680 | case 2:
|
681 | return relax ? "0{0,2}" : "00";
|
682 | default: {
|
683 | return relax ? `0{0,${diff2}}` : `0{${diff2}}`;
|
684 | }
|
685 | }
|
686 | }
|
687 | toRegexRange.cache = {};
|
688 | toRegexRange.clearCache = () => toRegexRange.cache = {};
|
689 | module.exports = toRegexRange;
|
690 | }
|
691 | });
|
692 |
|
693 |
|
694 | var require_fill_range = __commonJS({
|
695 | "node_modules/fill-range/index.js"(exports, module) {
|
696 | "use strict";
|
697 | var util2 = __require("util");
|
698 | var toRegexRange = require_to_regex_range();
|
699 | var isObject3 = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
700 | var transform = (toNumber) => {
|
701 | return (value) => toNumber === true ? Number(value) : String(value);
|
702 | };
|
703 | var isValidValue = (value) => {
|
704 | return typeof value === "number" || typeof value === "string" && value !== "";
|
705 | };
|
706 | var isNumber = (num) => Number.isInteger(+num);
|
707 | var zeros = (input) => {
|
708 | let value = `${input}`;
|
709 | let index = -1;
|
710 | if (value[0] === "-") value = value.slice(1);
|
711 | if (value === "0") return false;
|
712 | while (value[++index] === "0") ;
|
713 | return index > 0;
|
714 | };
|
715 | var stringify = (start, end, options8) => {
|
716 | if (typeof start === "string" || typeof end === "string") {
|
717 | return true;
|
718 | }
|
719 | return options8.stringify === true;
|
720 | };
|
721 | var pad = (input, maxLength, toNumber) => {
|
722 | if (maxLength > 0) {
|
723 | let dash = input[0] === "-" ? "-" : "";
|
724 | if (dash) input = input.slice(1);
|
725 | input = dash + input.padStart(dash ? maxLength - 1 : maxLength, "0");
|
726 | }
|
727 | if (toNumber === false) {
|
728 | return String(input);
|
729 | }
|
730 | return input;
|
731 | };
|
732 | var toMaxLen = (input, maxLength) => {
|
733 | let negative = input[0] === "-" ? "-" : "";
|
734 | if (negative) {
|
735 | input = input.slice(1);
|
736 | maxLength--;
|
737 | }
|
738 | while (input.length < maxLength) input = "0" + input;
|
739 | return negative ? "-" + input : input;
|
740 | };
|
741 | var toSequence = (parts, options8, maxLen) => {
|
742 | parts.negatives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
743 | parts.positives.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
744 | let prefix = options8.capture ? "" : "?:";
|
745 | let positives = "";
|
746 | let negatives = "";
|
747 | let result;
|
748 | if (parts.positives.length) {
|
749 | positives = parts.positives.map((v) => toMaxLen(String(v), maxLen)).join("|");
|
750 | }
|
751 | if (parts.negatives.length) {
|
752 | negatives = `-(${prefix}${parts.negatives.map((v) => toMaxLen(String(v), maxLen)).join("|")})`;
|
753 | }
|
754 | if (positives && negatives) {
|
755 | result = `${positives}|${negatives}`;
|
756 | } else {
|
757 | result = positives || negatives;
|
758 | }
|
759 | if (options8.wrap) {
|
760 | return `(${prefix}${result})`;
|
761 | }
|
762 | return result;
|
763 | };
|
764 | var toRange = (a, b, isNumbers, options8) => {
|
765 | if (isNumbers) {
|
766 | return toRegexRange(a, b, { wrap: false, ...options8 });
|
767 | }
|
768 | let start = String.fromCharCode(a);
|
769 | if (a === b) return start;
|
770 | let stop = String.fromCharCode(b);
|
771 | return `[${start}-${stop}]`;
|
772 | };
|
773 | var toRegex = (start, end, options8) => {
|
774 | if (Array.isArray(start)) {
|
775 | let wrap = options8.wrap === true;
|
776 | let prefix = options8.capture ? "" : "?:";
|
777 | return wrap ? `(${prefix}${start.join("|")})` : start.join("|");
|
778 | }
|
779 | return toRegexRange(start, end, options8);
|
780 | };
|
781 | var rangeError = (...args) => {
|
782 | return new RangeError("Invalid range arguments: " + util2.inspect(...args));
|
783 | };
|
784 | var invalidRange = (start, end, options8) => {
|
785 | if (options8.strictRanges === true) throw rangeError([start, end]);
|
786 | return [];
|
787 | };
|
788 | var invalidStep = (step, options8) => {
|
789 | if (options8.strictRanges === true) {
|
790 | throw new TypeError(`Expected step "${step}" to be a number`);
|
791 | }
|
792 | return [];
|
793 | };
|
794 | var fillNumbers = (start, end, step = 1, options8 = {}) => {
|
795 | let a = Number(start);
|
796 | let b = Number(end);
|
797 | if (!Number.isInteger(a) || !Number.isInteger(b)) {
|
798 | if (options8.strictRanges === true) throw rangeError([start, end]);
|
799 | return [];
|
800 | }
|
801 | if (a === 0) a = 0;
|
802 | if (b === 0) b = 0;
|
803 | let descending = a > b;
|
804 | let startString = String(start);
|
805 | let endString = String(end);
|
806 | let stepString = String(step);
|
807 | step = Math.max(Math.abs(step), 1);
|
808 | let padded = zeros(startString) || zeros(endString) || zeros(stepString);
|
809 | let maxLen = padded ? Math.max(startString.length, endString.length, stepString.length) : 0;
|
810 | let toNumber = padded === false && stringify(start, end, options8) === false;
|
811 | let format3 = options8.transform || transform(toNumber);
|
812 | if (options8.toRegex && step === 1) {
|
813 | return toRange(toMaxLen(start, maxLen), toMaxLen(end, maxLen), true, options8);
|
814 | }
|
815 | let parts = { negatives: [], positives: [] };
|
816 | let push2 = (num) => parts[num < 0 ? "negatives" : "positives"].push(Math.abs(num));
|
817 | let range = [];
|
818 | let index = 0;
|
819 | while (descending ? a >= b : a <= b) {
|
820 | if (options8.toRegex === true && step > 1) {
|
821 | push2(a);
|
822 | } else {
|
823 | range.push(pad(format3(a, index), maxLen, toNumber));
|
824 | }
|
825 | a = descending ? a - step : a + step;
|
826 | index++;
|
827 | }
|
828 | if (options8.toRegex === true) {
|
829 | return step > 1 ? toSequence(parts, options8, maxLen) : toRegex(range, null, { wrap: false, ...options8 });
|
830 | }
|
831 | return range;
|
832 | };
|
833 | var fillLetters = (start, end, step = 1, options8 = {}) => {
|
834 | if (!isNumber(start) && start.length > 1 || !isNumber(end) && end.length > 1) {
|
835 | return invalidRange(start, end, options8);
|
836 | }
|
837 | let format3 = options8.transform || ((val) => String.fromCharCode(val));
|
838 | let a = `${start}`.charCodeAt(0);
|
839 | let b = `${end}`.charCodeAt(0);
|
840 | let descending = a > b;
|
841 | let min = Math.min(a, b);
|
842 | let max = Math.max(a, b);
|
843 | if (options8.toRegex && step === 1) {
|
844 | return toRange(min, max, false, options8);
|
845 | }
|
846 | let range = [];
|
847 | let index = 0;
|
848 | while (descending ? a >= b : a <= b) {
|
849 | range.push(format3(a, index));
|
850 | a = descending ? a - step : a + step;
|
851 | index++;
|
852 | }
|
853 | if (options8.toRegex === true) {
|
854 | return toRegex(range, null, { wrap: false, options: options8 });
|
855 | }
|
856 | return range;
|
857 | };
|
858 | var fill2 = (start, end, step, options8 = {}) => {
|
859 | if (end == null && isValidValue(start)) {
|
860 | return [start];
|
861 | }
|
862 | if (!isValidValue(start) || !isValidValue(end)) {
|
863 | return invalidRange(start, end, options8);
|
864 | }
|
865 | if (typeof step === "function") {
|
866 | return fill2(start, end, 1, { transform: step });
|
867 | }
|
868 | if (isObject3(step)) {
|
869 | return fill2(start, end, 0, step);
|
870 | }
|
871 | let opts = { ...options8 };
|
872 | if (opts.capture === true) opts.wrap = true;
|
873 | step = step || opts.step || 1;
|
874 | if (!isNumber(step)) {
|
875 | if (step != null && !isObject3(step)) return invalidStep(step, opts);
|
876 | return fill2(start, end, 1, step);
|
877 | }
|
878 | if (isNumber(start) && isNumber(end)) {
|
879 | return fillNumbers(start, end, step, opts);
|
880 | }
|
881 | return fillLetters(start, end, Math.max(Math.abs(step), 1), opts);
|
882 | };
|
883 | module.exports = fill2;
|
884 | }
|
885 | });
|
886 |
|
887 |
|
888 | var require_compile = __commonJS({
|
889 | "node_modules/braces/lib/compile.js"(exports, module) {
|
890 | "use strict";
|
891 | var fill2 = require_fill_range();
|
892 | var utils = require_utils();
|
893 | var compile = (ast, options8 = {}) => {
|
894 | const walk = (node, parent = {}) => {
|
895 | const invalidBlock = utils.isInvalidBrace(parent);
|
896 | const invalidNode = node.invalid === true && options8.escapeInvalid === true;
|
897 | const invalid = invalidBlock === true || invalidNode === true;
|
898 | const prefix = options8.escapeInvalid === true ? "\\" : "";
|
899 | let output = "";
|
900 | if (node.isOpen === true) {
|
901 | return prefix + node.value;
|
902 | }
|
903 | if (node.isClose === true) {
|
904 | console.log("node.isClose", prefix, node.value);
|
905 | return prefix + node.value;
|
906 | }
|
907 | if (node.type === "open") {
|
908 | return invalid ? prefix + node.value : "(";
|
909 | }
|
910 | if (node.type === "close") {
|
911 | return invalid ? prefix + node.value : ")";
|
912 | }
|
913 | if (node.type === "comma") {
|
914 | return node.prev.type === "comma" ? "" : invalid ? node.value : "|";
|
915 | }
|
916 | if (node.value) {
|
917 | return node.value;
|
918 | }
|
919 | if (node.nodes && node.ranges > 0) {
|
920 | const args = utils.reduce(node.nodes);
|
921 | const range = fill2(...args, { ...options8, wrap: false, toRegex: true, strictZeros: true });
|
922 | if (range.length !== 0) {
|
923 | return args.length > 1 && range.length > 1 ? `(${range})` : range;
|
924 | }
|
925 | }
|
926 | if (node.nodes) {
|
927 | for (const child of node.nodes) {
|
928 | output += walk(child, node);
|
929 | }
|
930 | }
|
931 | return output;
|
932 | };
|
933 | return walk(ast);
|
934 | };
|
935 | module.exports = compile;
|
936 | }
|
937 | });
|
938 |
|
939 |
|
940 | var require_expand = __commonJS({
|
941 | "node_modules/braces/lib/expand.js"(exports, module) {
|
942 | "use strict";
|
943 | var fill2 = require_fill_range();
|
944 | var stringify = require_stringify();
|
945 | var utils = require_utils();
|
946 | var append = (queue = "", stash = "", enclose = false) => {
|
947 | const result = [];
|
948 | queue = [].concat(queue);
|
949 | stash = [].concat(stash);
|
950 | if (!stash.length) return queue;
|
951 | if (!queue.length) {
|
952 | return enclose ? utils.flatten(stash).map((ele) => `{${ele}}`) : stash;
|
953 | }
|
954 | for (const item of queue) {
|
955 | if (Array.isArray(item)) {
|
956 | for (const value of item) {
|
957 | result.push(append(value, stash, enclose));
|
958 | }
|
959 | } else {
|
960 | for (let ele of stash) {
|
961 | if (enclose === true && typeof ele === "string") ele = `{${ele}}`;
|
962 | result.push(Array.isArray(ele) ? append(item, ele, enclose) : item + ele);
|
963 | }
|
964 | }
|
965 | }
|
966 | return utils.flatten(result);
|
967 | };
|
968 | var expand = (ast, options8 = {}) => {
|
969 | const rangeLimit = options8.rangeLimit === void 0 ? 1e3 : options8.rangeLimit;
|
970 | const walk = (node, parent = {}) => {
|
971 | node.queue = [];
|
972 | let p = parent;
|
973 | let q = parent.queue;
|
974 | while (p.type !== "brace" && p.type !== "root" && p.parent) {
|
975 | p = p.parent;
|
976 | q = p.queue;
|
977 | }
|
978 | if (node.invalid || node.dollar) {
|
979 | q.push(append(q.pop(), stringify(node, options8)));
|
980 | return;
|
981 | }
|
982 | if (node.type === "brace" && node.invalid !== true && node.nodes.length === 2) {
|
983 | q.push(append(q.pop(), ["{}"]));
|
984 | return;
|
985 | }
|
986 | if (node.nodes && node.ranges > 0) {
|
987 | const args = utils.reduce(node.nodes);
|
988 | if (utils.exceedsLimit(...args, options8.step, rangeLimit)) {
|
989 | throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");
|
990 | }
|
991 | let range = fill2(...args, options8);
|
992 | if (range.length === 0) {
|
993 | range = stringify(node, options8);
|
994 | }
|
995 | q.push(append(q.pop(), range));
|
996 | node.nodes = [];
|
997 | return;
|
998 | }
|
999 | const enclose = utils.encloseBrace(node);
|
1000 | let queue = node.queue;
|
1001 | let block = node;
|
1002 | while (block.type !== "brace" && block.type !== "root" && block.parent) {
|
1003 | block = block.parent;
|
1004 | queue = block.queue;
|
1005 | }
|
1006 | for (let i = 0; i < node.nodes.length; i++) {
|
1007 | const child = node.nodes[i];
|
1008 | if (child.type === "comma" && node.type === "brace") {
|
1009 | if (i === 1) queue.push("");
|
1010 | queue.push("");
|
1011 | continue;
|
1012 | }
|
1013 | if (child.type === "close") {
|
1014 | q.push(append(q.pop(), queue, enclose));
|
1015 | continue;
|
1016 | }
|
1017 | if (child.value && child.type !== "open") {
|
1018 | queue.push(append(queue.pop(), child.value));
|
1019 | continue;
|
1020 | }
|
1021 | if (child.nodes) {
|
1022 | walk(child, node);
|
1023 | }
|
1024 | }
|
1025 | return queue;
|
1026 | };
|
1027 | return utils.flatten(walk(ast));
|
1028 | };
|
1029 | module.exports = expand;
|
1030 | }
|
1031 | });
|
1032 |
|
1033 |
|
1034 | var require_constants = __commonJS({
|
1035 | "node_modules/braces/lib/constants.js"(exports, module) {
|
1036 | "use strict";
|
1037 | module.exports = {
|
1038 | MAX_LENGTH: 1e4,
|
1039 |
|
1040 | CHAR_0: "0",
|
1041 |
|
1042 | CHAR_9: "9",
|
1043 |
|
1044 |
|
1045 | CHAR_UPPERCASE_A: "A",
|
1046 |
|
1047 | CHAR_LOWERCASE_A: "a",
|
1048 |
|
1049 | CHAR_UPPERCASE_Z: "Z",
|
1050 |
|
1051 | CHAR_LOWERCASE_Z: "z",
|
1052 |
|
1053 | CHAR_LEFT_PARENTHESES: "(",
|
1054 |
|
1055 | CHAR_RIGHT_PARENTHESES: ")",
|
1056 |
|
1057 | CHAR_ASTERISK: "*",
|
1058 |
|
1059 |
|
1060 | CHAR_AMPERSAND: "&",
|
1061 |
|
1062 | CHAR_AT: "@",
|
1063 |
|
1064 | CHAR_BACKSLASH: "\\",
|
1065 |
|
1066 | CHAR_BACKTICK: "`",
|
1067 |
|
1068 | CHAR_CARRIAGE_RETURN: "\r",
|
1069 |
|
1070 | CHAR_CIRCUMFLEX_ACCENT: "^",
|
1071 |
|
1072 | CHAR_COLON: ":",
|
1073 |
|
1074 | CHAR_COMMA: ",",
|
1075 |
|
1076 | CHAR_DOLLAR: "$",
|
1077 |
|
1078 | CHAR_DOT: ".",
|
1079 |
|
1080 | CHAR_DOUBLE_QUOTE: '"',
|
1081 |
|
1082 | CHAR_EQUAL: "=",
|
1083 |
|
1084 | CHAR_EXCLAMATION_MARK: "!",
|
1085 |
|
1086 | CHAR_FORM_FEED: "\f",
|
1087 |
|
1088 | CHAR_FORWARD_SLASH: "/",
|
1089 |
|
1090 | CHAR_HASH: "#",
|
1091 |
|
1092 | CHAR_HYPHEN_MINUS: "-",
|
1093 |
|
1094 | CHAR_LEFT_ANGLE_BRACKET: "<",
|
1095 |
|
1096 | CHAR_LEFT_CURLY_BRACE: "{",
|
1097 |
|
1098 | CHAR_LEFT_SQUARE_BRACKET: "[",
|
1099 |
|
1100 | CHAR_LINE_FEED: "\n",
|
1101 |
|
1102 | CHAR_NO_BREAK_SPACE: "\xA0",
|
1103 |
|
1104 | CHAR_PERCENT: "%",
|
1105 |
|
1106 | CHAR_PLUS: "+",
|
1107 |
|
1108 | CHAR_QUESTION_MARK: "?",
|
1109 |
|
1110 | CHAR_RIGHT_ANGLE_BRACKET: ">",
|
1111 |
|
1112 | CHAR_RIGHT_CURLY_BRACE: "}",
|
1113 |
|
1114 | CHAR_RIGHT_SQUARE_BRACKET: "]",
|
1115 |
|
1116 | CHAR_SEMICOLON: ";",
|
1117 |
|
1118 | CHAR_SINGLE_QUOTE: "'",
|
1119 |
|
1120 | CHAR_SPACE: " ",
|
1121 |
|
1122 | CHAR_TAB: " ",
|
1123 |
|
1124 | CHAR_UNDERSCORE: "_",
|
1125 |
|
1126 | CHAR_VERTICAL_LINE: "|",
|
1127 |
|
1128 | CHAR_ZERO_WIDTH_NOBREAK_SPACE: "\uFEFF"
|
1129 |
|
1130 | };
|
1131 | }
|
1132 | });
|
1133 |
|
1134 |
|
1135 | var require_parse = __commonJS({
|
1136 | "node_modules/braces/lib/parse.js"(exports, module) {
|
1137 | "use strict";
|
1138 | var stringify = require_stringify();
|
1139 | var {
|
1140 | MAX_LENGTH,
|
1141 | CHAR_BACKSLASH,
|
1142 |
|
1143 | CHAR_BACKTICK,
|
1144 |
|
1145 | CHAR_COMMA,
|
1146 |
|
1147 | CHAR_DOT,
|
1148 |
|
1149 | CHAR_LEFT_PARENTHESES,
|
1150 |
|
1151 | CHAR_RIGHT_PARENTHESES,
|
1152 |
|
1153 | CHAR_LEFT_CURLY_BRACE,
|
1154 |
|
1155 | CHAR_RIGHT_CURLY_BRACE,
|
1156 |
|
1157 | CHAR_LEFT_SQUARE_BRACKET,
|
1158 |
|
1159 | CHAR_RIGHT_SQUARE_BRACKET,
|
1160 |
|
1161 | CHAR_DOUBLE_QUOTE,
|
1162 |
|
1163 | CHAR_SINGLE_QUOTE,
|
1164 |
|
1165 | CHAR_NO_BREAK_SPACE,
|
1166 | CHAR_ZERO_WIDTH_NOBREAK_SPACE
|
1167 | } = require_constants();
|
1168 | var parse6 = (input, options8 = {}) => {
|
1169 | if (typeof input !== "string") {
|
1170 | throw new TypeError("Expected a string");
|
1171 | }
|
1172 | const opts = options8 || {};
|
1173 | const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
1174 | if (input.length > max) {
|
1175 | throw new SyntaxError(`Input length (${input.length}), exceeds max characters (${max})`);
|
1176 | }
|
1177 | const ast = { type: "root", input, nodes: [] };
|
1178 | const stack2 = [ast];
|
1179 | let block = ast;
|
1180 | let prev = ast;
|
1181 | let brackets = 0;
|
1182 | const length = input.length;
|
1183 | let index = 0;
|
1184 | let depth = 0;
|
1185 | let value;
|
1186 | const advance = () => input[index++];
|
1187 | const push2 = (node) => {
|
1188 | if (node.type === "text" && prev.type === "dot") {
|
1189 | prev.type = "text";
|
1190 | }
|
1191 | if (prev && prev.type === "text" && node.type === "text") {
|
1192 | prev.value += node.value;
|
1193 | return;
|
1194 | }
|
1195 | block.nodes.push(node);
|
1196 | node.parent = block;
|
1197 | node.prev = prev;
|
1198 | prev = node;
|
1199 | return node;
|
1200 | };
|
1201 | push2({ type: "bos" });
|
1202 | while (index < length) {
|
1203 | block = stack2[stack2.length - 1];
|
1204 | value = advance();
|
1205 | if (value === CHAR_ZERO_WIDTH_NOBREAK_SPACE || value === CHAR_NO_BREAK_SPACE) {
|
1206 | continue;
|
1207 | }
|
1208 | if (value === CHAR_BACKSLASH) {
|
1209 | push2({ type: "text", value: (options8.keepEscaping ? value : "") + advance() });
|
1210 | continue;
|
1211 | }
|
1212 | if (value === CHAR_RIGHT_SQUARE_BRACKET) {
|
1213 | push2({ type: "text", value: "\\" + value });
|
1214 | continue;
|
1215 | }
|
1216 | if (value === CHAR_LEFT_SQUARE_BRACKET) {
|
1217 | brackets++;
|
1218 | let next;
|
1219 | while (index < length && (next = advance())) {
|
1220 | value += next;
|
1221 | if (next === CHAR_LEFT_SQUARE_BRACKET) {
|
1222 | brackets++;
|
1223 | continue;
|
1224 | }
|
1225 | if (next === CHAR_BACKSLASH) {
|
1226 | value += advance();
|
1227 | continue;
|
1228 | }
|
1229 | if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
1230 | brackets--;
|
1231 | if (brackets === 0) {
|
1232 | break;
|
1233 | }
|
1234 | }
|
1235 | }
|
1236 | push2({ type: "text", value });
|
1237 | continue;
|
1238 | }
|
1239 | if (value === CHAR_LEFT_PARENTHESES) {
|
1240 | block = push2({ type: "paren", nodes: [] });
|
1241 | stack2.push(block);
|
1242 | push2({ type: "text", value });
|
1243 | continue;
|
1244 | }
|
1245 | if (value === CHAR_RIGHT_PARENTHESES) {
|
1246 | if (block.type !== "paren") {
|
1247 | push2({ type: "text", value });
|
1248 | continue;
|
1249 | }
|
1250 | block = stack2.pop();
|
1251 | push2({ type: "text", value });
|
1252 | block = stack2[stack2.length - 1];
|
1253 | continue;
|
1254 | }
|
1255 | if (value === CHAR_DOUBLE_QUOTE || value === CHAR_SINGLE_QUOTE || value === CHAR_BACKTICK) {
|
1256 | const open = value;
|
1257 | let next;
|
1258 | if (options8.keepQuotes !== true) {
|
1259 | value = "";
|
1260 | }
|
1261 | while (index < length && (next = advance())) {
|
1262 | if (next === CHAR_BACKSLASH) {
|
1263 | value += next + advance();
|
1264 | continue;
|
1265 | }
|
1266 | if (next === open) {
|
1267 | if (options8.keepQuotes === true) value += next;
|
1268 | break;
|
1269 | }
|
1270 | value += next;
|
1271 | }
|
1272 | push2({ type: "text", value });
|
1273 | continue;
|
1274 | }
|
1275 | if (value === CHAR_LEFT_CURLY_BRACE) {
|
1276 | depth++;
|
1277 | const dollar = prev.value && prev.value.slice(-1) === "$" || block.dollar === true;
|
1278 | const brace = {
|
1279 | type: "brace",
|
1280 | open: true,
|
1281 | close: false,
|
1282 | dollar,
|
1283 | depth,
|
1284 | commas: 0,
|
1285 | ranges: 0,
|
1286 | nodes: []
|
1287 | };
|
1288 | block = push2(brace);
|
1289 | stack2.push(block);
|
1290 | push2({ type: "open", value });
|
1291 | continue;
|
1292 | }
|
1293 | if (value === CHAR_RIGHT_CURLY_BRACE) {
|
1294 | if (block.type !== "brace") {
|
1295 | push2({ type: "text", value });
|
1296 | continue;
|
1297 | }
|
1298 | const type2 = "close";
|
1299 | block = stack2.pop();
|
1300 | block.close = true;
|
1301 | push2({ type: type2, value });
|
1302 | depth--;
|
1303 | block = stack2[stack2.length - 1];
|
1304 | continue;
|
1305 | }
|
1306 | if (value === CHAR_COMMA && depth > 0) {
|
1307 | if (block.ranges > 0) {
|
1308 | block.ranges = 0;
|
1309 | const open = block.nodes.shift();
|
1310 | block.nodes = [open, { type: "text", value: stringify(block) }];
|
1311 | }
|
1312 | push2({ type: "comma", value });
|
1313 | block.commas++;
|
1314 | continue;
|
1315 | }
|
1316 | if (value === CHAR_DOT && depth > 0 && block.commas === 0) {
|
1317 | const siblings = block.nodes;
|
1318 | if (depth === 0 || siblings.length === 0) {
|
1319 | push2({ type: "text", value });
|
1320 | continue;
|
1321 | }
|
1322 | if (prev.type === "dot") {
|
1323 | block.range = [];
|
1324 | prev.value += value;
|
1325 | prev.type = "range";
|
1326 | if (block.nodes.length !== 3 && block.nodes.length !== 5) {
|
1327 | block.invalid = true;
|
1328 | block.ranges = 0;
|
1329 | prev.type = "text";
|
1330 | continue;
|
1331 | }
|
1332 | block.ranges++;
|
1333 | block.args = [];
|
1334 | continue;
|
1335 | }
|
1336 | if (prev.type === "range") {
|
1337 | siblings.pop();
|
1338 | const before = siblings[siblings.length - 1];
|
1339 | before.value += prev.value + value;
|
1340 | prev = before;
|
1341 | block.ranges--;
|
1342 | continue;
|
1343 | }
|
1344 | push2({ type: "dot", value });
|
1345 | continue;
|
1346 | }
|
1347 | push2({ type: "text", value });
|
1348 | }
|
1349 | do {
|
1350 | block = stack2.pop();
|
1351 | if (block.type !== "root") {
|
1352 | block.nodes.forEach((node) => {
|
1353 | if (!node.nodes) {
|
1354 | if (node.type === "open") node.isOpen = true;
|
1355 | if (node.type === "close") node.isClose = true;
|
1356 | if (!node.nodes) node.type = "text";
|
1357 | node.invalid = true;
|
1358 | }
|
1359 | });
|
1360 | const parent = stack2[stack2.length - 1];
|
1361 | const index2 = parent.nodes.indexOf(block);
|
1362 | parent.nodes.splice(index2, 1, ...block.nodes);
|
1363 | }
|
1364 | } while (stack2.length > 0);
|
1365 | push2({ type: "eos" });
|
1366 | return ast;
|
1367 | };
|
1368 | module.exports = parse6;
|
1369 | }
|
1370 | });
|
1371 |
|
1372 |
|
1373 | var require_braces = __commonJS({
|
1374 | "node_modules/braces/index.js"(exports, module) {
|
1375 | "use strict";
|
1376 | var stringify = require_stringify();
|
1377 | var compile = require_compile();
|
1378 | var expand = require_expand();
|
1379 | var parse6 = require_parse();
|
1380 | var braces = (input, options8 = {}) => {
|
1381 | let output = [];
|
1382 | if (Array.isArray(input)) {
|
1383 | for (const pattern of input) {
|
1384 | const result = braces.create(pattern, options8);
|
1385 | if (Array.isArray(result)) {
|
1386 | output.push(...result);
|
1387 | } else {
|
1388 | output.push(result);
|
1389 | }
|
1390 | }
|
1391 | } else {
|
1392 | output = [].concat(braces.create(input, options8));
|
1393 | }
|
1394 | if (options8 && options8.expand === true && options8.nodupes === true) {
|
1395 | output = [...new Set(output)];
|
1396 | }
|
1397 | return output;
|
1398 | };
|
1399 | braces.parse = (input, options8 = {}) => parse6(input, options8);
|
1400 | braces.stringify = (input, options8 = {}) => {
|
1401 | if (typeof input === "string") {
|
1402 | return stringify(braces.parse(input, options8), options8);
|
1403 | }
|
1404 | return stringify(input, options8);
|
1405 | };
|
1406 | braces.compile = (input, options8 = {}) => {
|
1407 | if (typeof input === "string") {
|
1408 | input = braces.parse(input, options8);
|
1409 | }
|
1410 | return compile(input, options8);
|
1411 | };
|
1412 | braces.expand = (input, options8 = {}) => {
|
1413 | if (typeof input === "string") {
|
1414 | input = braces.parse(input, options8);
|
1415 | }
|
1416 | let result = expand(input, options8);
|
1417 | if (options8.noempty === true) {
|
1418 | result = result.filter(Boolean);
|
1419 | }
|
1420 | if (options8.nodupes === true) {
|
1421 | result = [...new Set(result)];
|
1422 | }
|
1423 | return result;
|
1424 | };
|
1425 | braces.create = (input, options8 = {}) => {
|
1426 | if (input === "" || input.length < 3) {
|
1427 | return [input];
|
1428 | }
|
1429 | return options8.expand !== true ? braces.compile(input, options8) : braces.expand(input, options8);
|
1430 | };
|
1431 | module.exports = braces;
|
1432 | }
|
1433 | });
|
1434 |
|
1435 |
|
1436 | var require_constants2 = __commonJS({
|
1437 | "node_modules/picomatch/lib/constants.js"(exports, module) {
|
1438 | "use strict";
|
1439 | var path13 = __require("path");
|
1440 | var WIN_SLASH = "\\\\/";
|
1441 | var WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
1442 | var DOT_LITERAL = "\\.";
|
1443 | var PLUS_LITERAL = "\\+";
|
1444 | var QMARK_LITERAL = "\\?";
|
1445 | var SLASH_LITERAL = "\\/";
|
1446 | var ONE_CHAR = "(?=.)";
|
1447 | var QMARK = "[^/]";
|
1448 | var END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
|
1449 | var START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
|
1450 | var DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
|
1451 | var NO_DOT = `(?!${DOT_LITERAL})`;
|
1452 | var NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
|
1453 | var NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
|
1454 | var NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
|
1455 | var QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
|
1456 | var STAR = `${QMARK}*?`;
|
1457 | var POSIX_CHARS = {
|
1458 | DOT_LITERAL,
|
1459 | PLUS_LITERAL,
|
1460 | QMARK_LITERAL,
|
1461 | SLASH_LITERAL,
|
1462 | ONE_CHAR,
|
1463 | QMARK,
|
1464 | END_ANCHOR,
|
1465 | DOTS_SLASH,
|
1466 | NO_DOT,
|
1467 | NO_DOTS,
|
1468 | NO_DOT_SLASH,
|
1469 | NO_DOTS_SLASH,
|
1470 | QMARK_NO_DOT,
|
1471 | STAR,
|
1472 | START_ANCHOR
|
1473 | };
|
1474 | var WINDOWS_CHARS = {
|
1475 | ...POSIX_CHARS,
|
1476 | SLASH_LITERAL: `[${WIN_SLASH}]`,
|
1477 | QMARK: WIN_NO_SLASH,
|
1478 | STAR: `${WIN_NO_SLASH}*?`,
|
1479 | DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
|
1480 | NO_DOT: `(?!${DOT_LITERAL})`,
|
1481 | NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
1482 | NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
|
1483 | NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
|
1484 | QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
|
1485 | START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
|
1486 | END_ANCHOR: `(?:[${WIN_SLASH}]|$)`
|
1487 | };
|
1488 | var POSIX_REGEX_SOURCE = {
|
1489 | alnum: "a-zA-Z0-9",
|
1490 | alpha: "a-zA-Z",
|
1491 | ascii: "\\x00-\\x7F",
|
1492 | blank: " \\t",
|
1493 | cntrl: "\\x00-\\x1F\\x7F",
|
1494 | digit: "0-9",
|
1495 | graph: "\\x21-\\x7E",
|
1496 | lower: "a-z",
|
1497 | print: "\\x20-\\x7E ",
|
1498 | punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
|
1499 | space: " \\t\\r\\n\\v\\f",
|
1500 | upper: "A-Z",
|
1501 | word: "A-Za-z0-9_",
|
1502 | xdigit: "A-Fa-f0-9"
|
1503 | };
|
1504 | module.exports = {
|
1505 | MAX_LENGTH: 1024 * 64,
|
1506 | POSIX_REGEX_SOURCE,
|
1507 |
|
1508 | REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
1509 | REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
1510 | REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
1511 | REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
1512 | REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
1513 | REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
1514 |
|
1515 | REPLACEMENTS: {
|
1516 | "***": "*",
|
1517 | "**/**": "**",
|
1518 | "**/**/**": "**"
|
1519 | },
|
1520 |
|
1521 | CHAR_0: 48,
|
1522 |
|
1523 | CHAR_9: 57,
|
1524 |
|
1525 |
|
1526 | CHAR_UPPERCASE_A: 65,
|
1527 |
|
1528 | CHAR_LOWERCASE_A: 97,
|
1529 |
|
1530 | CHAR_UPPERCASE_Z: 90,
|
1531 |
|
1532 | CHAR_LOWERCASE_Z: 122,
|
1533 |
|
1534 | CHAR_LEFT_PARENTHESES: 40,
|
1535 |
|
1536 | CHAR_RIGHT_PARENTHESES: 41,
|
1537 |
|
1538 | CHAR_ASTERISK: 42,
|
1539 |
|
1540 |
|
1541 | CHAR_AMPERSAND: 38,
|
1542 |
|
1543 | CHAR_AT: 64,
|
1544 |
|
1545 | CHAR_BACKWARD_SLASH: 92,
|
1546 |
|
1547 | CHAR_CARRIAGE_RETURN: 13,
|
1548 |
|
1549 | CHAR_CIRCUMFLEX_ACCENT: 94,
|
1550 |
|
1551 | CHAR_COLON: 58,
|
1552 |
|
1553 | CHAR_COMMA: 44,
|
1554 |
|
1555 | CHAR_DOT: 46,
|
1556 |
|
1557 | CHAR_DOUBLE_QUOTE: 34,
|
1558 |
|
1559 | CHAR_EQUAL: 61,
|
1560 |
|
1561 | CHAR_EXCLAMATION_MARK: 33,
|
1562 |
|
1563 | CHAR_FORM_FEED: 12,
|
1564 |
|
1565 | CHAR_FORWARD_SLASH: 47,
|
1566 |
|
1567 | CHAR_GRAVE_ACCENT: 96,
|
1568 |
|
1569 | CHAR_HASH: 35,
|
1570 |
|
1571 | CHAR_HYPHEN_MINUS: 45,
|
1572 |
|
1573 | CHAR_LEFT_ANGLE_BRACKET: 60,
|
1574 |
|
1575 | CHAR_LEFT_CURLY_BRACE: 123,
|
1576 |
|
1577 | CHAR_LEFT_SQUARE_BRACKET: 91,
|
1578 |
|
1579 | CHAR_LINE_FEED: 10,
|
1580 |
|
1581 | CHAR_NO_BREAK_SPACE: 160,
|
1582 |
|
1583 | CHAR_PERCENT: 37,
|
1584 |
|
1585 | CHAR_PLUS: 43,
|
1586 |
|
1587 | CHAR_QUESTION_MARK: 63,
|
1588 |
|
1589 | CHAR_RIGHT_ANGLE_BRACKET: 62,
|
1590 |
|
1591 | CHAR_RIGHT_CURLY_BRACE: 125,
|
1592 |
|
1593 | CHAR_RIGHT_SQUARE_BRACKET: 93,
|
1594 |
|
1595 | CHAR_SEMICOLON: 59,
|
1596 |
|
1597 | CHAR_SINGLE_QUOTE: 39,
|
1598 |
|
1599 | CHAR_SPACE: 32,
|
1600 |
|
1601 | CHAR_TAB: 9,
|
1602 |
|
1603 | CHAR_UNDERSCORE: 95,
|
1604 |
|
1605 | CHAR_VERTICAL_LINE: 124,
|
1606 |
|
1607 | CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
1608 |
|
1609 | SEP: path13.sep,
|
1610 | |
1611 |
|
1612 |
|
1613 | extglobChars(chars) {
|
1614 | return {
|
1615 | "!": { type: "negate", open: "(?:(?!(?:", close: `))${chars.STAR})` },
|
1616 | "?": { type: "qmark", open: "(?:", close: ")?" },
|
1617 | "+": { type: "plus", open: "(?:", close: ")+" },
|
1618 | "*": { type: "star", open: "(?:", close: ")*" },
|
1619 | "@": { type: "at", open: "(?:", close: ")" }
|
1620 | };
|
1621 | },
|
1622 | |
1623 |
|
1624 |
|
1625 | globChars(win32) {
|
1626 | return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
|
1627 | }
|
1628 | };
|
1629 | }
|
1630 | });
|
1631 |
|
1632 |
|
1633 | var require_utils2 = __commonJS({
|
1634 | "node_modules/picomatch/lib/utils.js"(exports) {
|
1635 | "use strict";
|
1636 | var path13 = __require("path");
|
1637 | var win32 = process.platform === "win32";
|
1638 | var {
|
1639 | REGEX_BACKSLASH,
|
1640 | REGEX_REMOVE_BACKSLASH,
|
1641 | REGEX_SPECIAL_CHARS,
|
1642 | REGEX_SPECIAL_CHARS_GLOBAL
|
1643 | } = require_constants2();
|
1644 | exports.isObject = (val) => val !== null && typeof val === "object" && !Array.isArray(val);
|
1645 | exports.hasRegexChars = (str2) => REGEX_SPECIAL_CHARS.test(str2);
|
1646 | exports.isRegexChar = (str2) => str2.length === 1 && exports.hasRegexChars(str2);
|
1647 | exports.escapeRegex = (str2) => str2.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
|
1648 | exports.toPosixSlashes = (str2) => str2.replace(REGEX_BACKSLASH, "/");
|
1649 | exports.removeBackslashes = (str2) => {
|
1650 | return str2.replace(REGEX_REMOVE_BACKSLASH, (match) => {
|
1651 | return match === "\\" ? "" : match;
|
1652 | });
|
1653 | };
|
1654 | exports.supportsLookbehinds = () => {
|
1655 | const segs = process.version.slice(1).split(".").map(Number);
|
1656 | if (segs.length === 3 && segs[0] >= 9 || segs[0] === 8 && segs[1] >= 10) {
|
1657 | return true;
|
1658 | }
|
1659 | return false;
|
1660 | };
|
1661 | exports.isWindows = (options8) => {
|
1662 | if (options8 && typeof options8.windows === "boolean") {
|
1663 | return options8.windows;
|
1664 | }
|
1665 | return win32 === true || path13.sep === "\\";
|
1666 | };
|
1667 | exports.escapeLast = (input, char, lastIdx) => {
|
1668 | const idx = input.lastIndexOf(char, lastIdx);
|
1669 | if (idx === -1) return input;
|
1670 | if (input[idx - 1] === "\\") return exports.escapeLast(input, char, idx - 1);
|
1671 | return `${input.slice(0, idx)}\\${input.slice(idx)}`;
|
1672 | };
|
1673 | exports.removePrefix = (input, state = {}) => {
|
1674 | let output = input;
|
1675 | if (output.startsWith("./")) {
|
1676 | output = output.slice(2);
|
1677 | state.prefix = "./";
|
1678 | }
|
1679 | return output;
|
1680 | };
|
1681 | exports.wrapOutput = (input, state = {}, options8 = {}) => {
|
1682 | const prepend = options8.contains ? "" : "^";
|
1683 | const append = options8.contains ? "" : "$";
|
1684 | let output = `${prepend}(?:${input})${append}`;
|
1685 | if (state.negated === true) {
|
1686 | output = `(?:^(?!${output}).*$)`;
|
1687 | }
|
1688 | return output;
|
1689 | };
|
1690 | }
|
1691 | });
|
1692 |
|
1693 |
|
1694 | var require_scan = __commonJS({
|
1695 | "node_modules/picomatch/lib/scan.js"(exports, module) {
|
1696 | "use strict";
|
1697 | var utils = require_utils2();
|
1698 | var {
|
1699 | CHAR_ASTERISK,
|
1700 |
|
1701 | CHAR_AT,
|
1702 |
|
1703 | CHAR_BACKWARD_SLASH,
|
1704 |
|
1705 | CHAR_COMMA,
|
1706 |
|
1707 | CHAR_DOT,
|
1708 |
|
1709 | CHAR_EXCLAMATION_MARK,
|
1710 |
|
1711 | CHAR_FORWARD_SLASH,
|
1712 |
|
1713 | CHAR_LEFT_CURLY_BRACE,
|
1714 |
|
1715 | CHAR_LEFT_PARENTHESES,
|
1716 |
|
1717 | CHAR_LEFT_SQUARE_BRACKET,
|
1718 |
|
1719 | CHAR_PLUS,
|
1720 |
|
1721 | CHAR_QUESTION_MARK,
|
1722 |
|
1723 | CHAR_RIGHT_CURLY_BRACE,
|
1724 |
|
1725 | CHAR_RIGHT_PARENTHESES,
|
1726 |
|
1727 | CHAR_RIGHT_SQUARE_BRACKET
|
1728 |
|
1729 | } = require_constants2();
|
1730 | var isPathSeparator = (code) => {
|
1731 | return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
|
1732 | };
|
1733 | var depth = (token2) => {
|
1734 | if (token2.isPrefix !== true) {
|
1735 | token2.depth = token2.isGlobstar ? Infinity : 1;
|
1736 | }
|
1737 | };
|
1738 | var scan = (input, options8) => {
|
1739 | const opts = options8 || {};
|
1740 | const length = input.length - 1;
|
1741 | const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
1742 | const slashes = [];
|
1743 | const tokens = [];
|
1744 | const parts = [];
|
1745 | let str2 = input;
|
1746 | let index = -1;
|
1747 | let start = 0;
|
1748 | let lastIndex = 0;
|
1749 | let isBrace = false;
|
1750 | let isBracket = false;
|
1751 | let isGlob = false;
|
1752 | let isExtglob = false;
|
1753 | let isGlobstar = false;
|
1754 | let braceEscaped = false;
|
1755 | let backslashes = false;
|
1756 | let negated = false;
|
1757 | let negatedExtglob = false;
|
1758 | let finished = false;
|
1759 | let braces = 0;
|
1760 | let prev;
|
1761 | let code;
|
1762 | let token2 = { value: "", depth: 0, isGlob: false };
|
1763 | const eos = () => index >= length;
|
1764 | const peek2 = () => str2.charCodeAt(index + 1);
|
1765 | const advance = () => {
|
1766 | prev = code;
|
1767 | return str2.charCodeAt(++index);
|
1768 | };
|
1769 | while (index < length) {
|
1770 | code = advance();
|
1771 | let next;
|
1772 | if (code === CHAR_BACKWARD_SLASH) {
|
1773 | backslashes = token2.backslashes = true;
|
1774 | code = advance();
|
1775 | if (code === CHAR_LEFT_CURLY_BRACE) {
|
1776 | braceEscaped = true;
|
1777 | }
|
1778 | continue;
|
1779 | }
|
1780 | if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
|
1781 | braces++;
|
1782 | while (eos() !== true && (code = advance())) {
|
1783 | if (code === CHAR_BACKWARD_SLASH) {
|
1784 | backslashes = token2.backslashes = true;
|
1785 | advance();
|
1786 | continue;
|
1787 | }
|
1788 | if (code === CHAR_LEFT_CURLY_BRACE) {
|
1789 | braces++;
|
1790 | continue;
|
1791 | }
|
1792 | if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
|
1793 | isBrace = token2.isBrace = true;
|
1794 | isGlob = token2.isGlob = true;
|
1795 | finished = true;
|
1796 | if (scanToEnd === true) {
|
1797 | continue;
|
1798 | }
|
1799 | break;
|
1800 | }
|
1801 | if (braceEscaped !== true && code === CHAR_COMMA) {
|
1802 | isBrace = token2.isBrace = true;
|
1803 | isGlob = token2.isGlob = true;
|
1804 | finished = true;
|
1805 | if (scanToEnd === true) {
|
1806 | continue;
|
1807 | }
|
1808 | break;
|
1809 | }
|
1810 | if (code === CHAR_RIGHT_CURLY_BRACE) {
|
1811 | braces--;
|
1812 | if (braces === 0) {
|
1813 | braceEscaped = false;
|
1814 | isBrace = token2.isBrace = true;
|
1815 | finished = true;
|
1816 | break;
|
1817 | }
|
1818 | }
|
1819 | }
|
1820 | if (scanToEnd === true) {
|
1821 | continue;
|
1822 | }
|
1823 | break;
|
1824 | }
|
1825 | if (code === CHAR_FORWARD_SLASH) {
|
1826 | slashes.push(index);
|
1827 | tokens.push(token2);
|
1828 | token2 = { value: "", depth: 0, isGlob: false };
|
1829 | if (finished === true) continue;
|
1830 | if (prev === CHAR_DOT && index === start + 1) {
|
1831 | start += 2;
|
1832 | continue;
|
1833 | }
|
1834 | lastIndex = index + 1;
|
1835 | continue;
|
1836 | }
|
1837 | if (opts.noext !== true) {
|
1838 | const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
|
1839 | if (isExtglobChar === true && peek2() === CHAR_LEFT_PARENTHESES) {
|
1840 | isGlob = token2.isGlob = true;
|
1841 | isExtglob = token2.isExtglob = true;
|
1842 | finished = true;
|
1843 | if (code === CHAR_EXCLAMATION_MARK && index === start) {
|
1844 | negatedExtglob = true;
|
1845 | }
|
1846 | if (scanToEnd === true) {
|
1847 | while (eos() !== true && (code = advance())) {
|
1848 | if (code === CHAR_BACKWARD_SLASH) {
|
1849 | backslashes = token2.backslashes = true;
|
1850 | code = advance();
|
1851 | continue;
|
1852 | }
|
1853 | if (code === CHAR_RIGHT_PARENTHESES) {
|
1854 | isGlob = token2.isGlob = true;
|
1855 | finished = true;
|
1856 | break;
|
1857 | }
|
1858 | }
|
1859 | continue;
|
1860 | }
|
1861 | break;
|
1862 | }
|
1863 | }
|
1864 | if (code === CHAR_ASTERISK) {
|
1865 | if (prev === CHAR_ASTERISK) isGlobstar = token2.isGlobstar = true;
|
1866 | isGlob = token2.isGlob = true;
|
1867 | finished = true;
|
1868 | if (scanToEnd === true) {
|
1869 | continue;
|
1870 | }
|
1871 | break;
|
1872 | }
|
1873 | if (code === CHAR_QUESTION_MARK) {
|
1874 | isGlob = token2.isGlob = true;
|
1875 | finished = true;
|
1876 | if (scanToEnd === true) {
|
1877 | continue;
|
1878 | }
|
1879 | break;
|
1880 | }
|
1881 | if (code === CHAR_LEFT_SQUARE_BRACKET) {
|
1882 | while (eos() !== true && (next = advance())) {
|
1883 | if (next === CHAR_BACKWARD_SLASH) {
|
1884 | backslashes = token2.backslashes = true;
|
1885 | advance();
|
1886 | continue;
|
1887 | }
|
1888 | if (next === CHAR_RIGHT_SQUARE_BRACKET) {
|
1889 | isBracket = token2.isBracket = true;
|
1890 | isGlob = token2.isGlob = true;
|
1891 | finished = true;
|
1892 | break;
|
1893 | }
|
1894 | }
|
1895 | if (scanToEnd === true) {
|
1896 | continue;
|
1897 | }
|
1898 | break;
|
1899 | }
|
1900 | if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
|
1901 | negated = token2.negated = true;
|
1902 | start++;
|
1903 | continue;
|
1904 | }
|
1905 | if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
|
1906 | isGlob = token2.isGlob = true;
|
1907 | if (scanToEnd === true) {
|
1908 | while (eos() !== true && (code = advance())) {
|
1909 | if (code === CHAR_LEFT_PARENTHESES) {
|
1910 | backslashes = token2.backslashes = true;
|
1911 | code = advance();
|
1912 | continue;
|
1913 | }
|
1914 | if (code === CHAR_RIGHT_PARENTHESES) {
|
1915 | finished = true;
|
1916 | break;
|
1917 | }
|
1918 | }
|
1919 | continue;
|
1920 | }
|
1921 | break;
|
1922 | }
|
1923 | if (isGlob === true) {
|
1924 | finished = true;
|
1925 | if (scanToEnd === true) {
|
1926 | continue;
|
1927 | }
|
1928 | break;
|
1929 | }
|
1930 | }
|
1931 | if (opts.noext === true) {
|
1932 | isExtglob = false;
|
1933 | isGlob = false;
|
1934 | }
|
1935 | let base = str2;
|
1936 | let prefix = "";
|
1937 | let glob = "";
|
1938 | if (start > 0) {
|
1939 | prefix = str2.slice(0, start);
|
1940 | str2 = str2.slice(start);
|
1941 | lastIndex -= start;
|
1942 | }
|
1943 | if (base && isGlob === true && lastIndex > 0) {
|
1944 | base = str2.slice(0, lastIndex);
|
1945 | glob = str2.slice(lastIndex);
|
1946 | } else if (isGlob === true) {
|
1947 | base = "";
|
1948 | glob = str2;
|
1949 | } else {
|
1950 | base = str2;
|
1951 | }
|
1952 | if (base && base !== "" && base !== "/" && base !== str2) {
|
1953 | if (isPathSeparator(base.charCodeAt(base.length - 1))) {
|
1954 | base = base.slice(0, -1);
|
1955 | }
|
1956 | }
|
1957 | if (opts.unescape === true) {
|
1958 | if (glob) glob = utils.removeBackslashes(glob);
|
1959 | if (base && backslashes === true) {
|
1960 | base = utils.removeBackslashes(base);
|
1961 | }
|
1962 | }
|
1963 | const state = {
|
1964 | prefix,
|
1965 | input,
|
1966 | start,
|
1967 | base,
|
1968 | glob,
|
1969 | isBrace,
|
1970 | isBracket,
|
1971 | isGlob,
|
1972 | isExtglob,
|
1973 | isGlobstar,
|
1974 | negated,
|
1975 | negatedExtglob
|
1976 | };
|
1977 | if (opts.tokens === true) {
|
1978 | state.maxDepth = 0;
|
1979 | if (!isPathSeparator(code)) {
|
1980 | tokens.push(token2);
|
1981 | }
|
1982 | state.tokens = tokens;
|
1983 | }
|
1984 | if (opts.parts === true || opts.tokens === true) {
|
1985 | let prevIndex;
|
1986 | for (let idx = 0; idx < slashes.length; idx++) {
|
1987 | const n = prevIndex ? prevIndex + 1 : start;
|
1988 | const i = slashes[idx];
|
1989 | const value = input.slice(n, i);
|
1990 | if (opts.tokens) {
|
1991 | if (idx === 0 && start !== 0) {
|
1992 | tokens[idx].isPrefix = true;
|
1993 | tokens[idx].value = prefix;
|
1994 | } else {
|
1995 | tokens[idx].value = value;
|
1996 | }
|
1997 | depth(tokens[idx]);
|
1998 | state.maxDepth += tokens[idx].depth;
|
1999 | }
|
2000 | if (idx !== 0 || value !== "") {
|
2001 | parts.push(value);
|
2002 | }
|
2003 | prevIndex = i;
|
2004 | }
|
2005 | if (prevIndex && prevIndex + 1 < input.length) {
|
2006 | const value = input.slice(prevIndex + 1);
|
2007 | parts.push(value);
|
2008 | if (opts.tokens) {
|
2009 | tokens[tokens.length - 1].value = value;
|
2010 | depth(tokens[tokens.length - 1]);
|
2011 | state.maxDepth += tokens[tokens.length - 1].depth;
|
2012 | }
|
2013 | }
|
2014 | state.slashes = slashes;
|
2015 | state.parts = parts;
|
2016 | }
|
2017 | return state;
|
2018 | };
|
2019 | module.exports = scan;
|
2020 | }
|
2021 | });
|
2022 |
|
2023 |
|
2024 | var require_parse2 = __commonJS({
|
2025 | "node_modules/picomatch/lib/parse.js"(exports, module) {
|
2026 | "use strict";
|
2027 | var constants = require_constants2();
|
2028 | var utils = require_utils2();
|
2029 | var {
|
2030 | MAX_LENGTH,
|
2031 | POSIX_REGEX_SOURCE,
|
2032 | REGEX_NON_SPECIAL_CHARS,
|
2033 | REGEX_SPECIAL_CHARS_BACKREF,
|
2034 | REPLACEMENTS
|
2035 | } = constants;
|
2036 | var expandRange = (args, options8) => {
|
2037 | if (typeof options8.expandRange === "function") {
|
2038 | return options8.expandRange(...args, options8);
|
2039 | }
|
2040 | args.sort();
|
2041 | const value = `[${args.join("-")}]`;
|
2042 | try {
|
2043 | new RegExp(value);
|
2044 | } catch (ex) {
|
2045 | return args.map((v) => utils.escapeRegex(v)).join("..");
|
2046 | }
|
2047 | return value;
|
2048 | };
|
2049 | var syntaxError2 = (type2, char) => {
|
2050 | return `Missing ${type2}: "${char}" - use "\\\\${char}" to match literal characters`;
|
2051 | };
|
2052 | var parse6 = (input, options8) => {
|
2053 | if (typeof input !== "string") {
|
2054 | throw new TypeError("Expected a string");
|
2055 | }
|
2056 | input = REPLACEMENTS[input] || input;
|
2057 | const opts = { ...options8 };
|
2058 | const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
2059 | let len = input.length;
|
2060 | if (len > max) {
|
2061 | throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
2062 | }
|
2063 | const bos = { type: "bos", value: "", output: opts.prepend || "" };
|
2064 | const tokens = [bos];
|
2065 | const capture = opts.capture ? "" : "?:";
|
2066 | const win32 = utils.isWindows(options8);
|
2067 | const PLATFORM_CHARS = constants.globChars(win32);
|
2068 | const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
|
2069 | const {
|
2070 | DOT_LITERAL,
|
2071 | PLUS_LITERAL,
|
2072 | SLASH_LITERAL,
|
2073 | ONE_CHAR,
|
2074 | DOTS_SLASH,
|
2075 | NO_DOT,
|
2076 | NO_DOT_SLASH,
|
2077 | NO_DOTS_SLASH,
|
2078 | QMARK,
|
2079 | QMARK_NO_DOT,
|
2080 | STAR,
|
2081 | START_ANCHOR
|
2082 | } = PLATFORM_CHARS;
|
2083 | const globstar = (opts2) => {
|
2084 | return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
2085 | };
|
2086 | const nodot = opts.dot ? "" : NO_DOT;
|
2087 | const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
|
2088 | let star = opts.bash === true ? globstar(opts) : STAR;
|
2089 | if (opts.capture) {
|
2090 | star = `(${star})`;
|
2091 | }
|
2092 | if (typeof opts.noext === "boolean") {
|
2093 | opts.noextglob = opts.noext;
|
2094 | }
|
2095 | const state = {
|
2096 | input,
|
2097 | index: -1,
|
2098 | start: 0,
|
2099 | dot: opts.dot === true,
|
2100 | consumed: "",
|
2101 | output: "",
|
2102 | prefix: "",
|
2103 | backtrack: false,
|
2104 | negated: false,
|
2105 | brackets: 0,
|
2106 | braces: 0,
|
2107 | parens: 0,
|
2108 | quotes: 0,
|
2109 | globstar: false,
|
2110 | tokens
|
2111 | };
|
2112 | input = utils.removePrefix(input, state);
|
2113 | len = input.length;
|
2114 | const extglobs = [];
|
2115 | const braces = [];
|
2116 | const stack2 = [];
|
2117 | let prev = bos;
|
2118 | let value;
|
2119 | const eos = () => state.index === len - 1;
|
2120 | const peek2 = state.peek = (n = 1) => input[state.index + n];
|
2121 | const advance = state.advance = () => input[++state.index] || "";
|
2122 | const remaining = () => input.slice(state.index + 1);
|
2123 | const consume = (value2 = "", num = 0) => {
|
2124 | state.consumed += value2;
|
2125 | state.index += num;
|
2126 | };
|
2127 | const append = (token2) => {
|
2128 | state.output += token2.output != null ? token2.output : token2.value;
|
2129 | consume(token2.value);
|
2130 | };
|
2131 | const negate = () => {
|
2132 | let count = 1;
|
2133 | while (peek2() === "!" && (peek2(2) !== "(" || peek2(3) === "?")) {
|
2134 | advance();
|
2135 | state.start++;
|
2136 | count++;
|
2137 | }
|
2138 | if (count % 2 === 0) {
|
2139 | return false;
|
2140 | }
|
2141 | state.negated = true;
|
2142 | state.start++;
|
2143 | return true;
|
2144 | };
|
2145 | const increment = (type2) => {
|
2146 | state[type2]++;
|
2147 | stack2.push(type2);
|
2148 | };
|
2149 | const decrement = (type2) => {
|
2150 | state[type2]--;
|
2151 | stack2.pop();
|
2152 | };
|
2153 | const push2 = (tok) => {
|
2154 | if (prev.type === "globstar") {
|
2155 | const isBrace = state.braces > 0 && (tok.type === "comma" || tok.type === "brace");
|
2156 | const isExtglob = tok.extglob === true || extglobs.length && (tok.type === "pipe" || tok.type === "paren");
|
2157 | if (tok.type !== "slash" && tok.type !== "paren" && !isBrace && !isExtglob) {
|
2158 | state.output = state.output.slice(0, -prev.output.length);
|
2159 | prev.type = "star";
|
2160 | prev.value = "*";
|
2161 | prev.output = star;
|
2162 | state.output += prev.output;
|
2163 | }
|
2164 | }
|
2165 | if (extglobs.length && tok.type !== "paren") {
|
2166 | extglobs[extglobs.length - 1].inner += tok.value;
|
2167 | }
|
2168 | if (tok.value || tok.output) append(tok);
|
2169 | if (prev && prev.type === "text" && tok.type === "text") {
|
2170 | prev.value += tok.value;
|
2171 | prev.output = (prev.output || "") + tok.value;
|
2172 | return;
|
2173 | }
|
2174 | tok.prev = prev;
|
2175 | tokens.push(tok);
|
2176 | prev = tok;
|
2177 | };
|
2178 | const extglobOpen = (type2, value2) => {
|
2179 | const token2 = { ...EXTGLOB_CHARS[value2], conditions: 1, inner: "" };
|
2180 | token2.prev = prev;
|
2181 | token2.parens = state.parens;
|
2182 | token2.output = state.output;
|
2183 | const output = (opts.capture ? "(" : "") + token2.open;
|
2184 | increment("parens");
|
2185 | push2({ type: type2, value: value2, output: state.output ? "" : ONE_CHAR });
|
2186 | push2({ type: "paren", extglob: true, value: advance(), output });
|
2187 | extglobs.push(token2);
|
2188 | };
|
2189 | const extglobClose = (token2) => {
|
2190 | let output = token2.close + (opts.capture ? ")" : "");
|
2191 | let rest;
|
2192 | if (token2.type === "negate") {
|
2193 | let extglobStar = star;
|
2194 | if (token2.inner && token2.inner.length > 1 && token2.inner.includes("/")) {
|
2195 | extglobStar = globstar(opts);
|
2196 | }
|
2197 | if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
|
2198 | output = token2.close = `)$))${extglobStar}`;
|
2199 | }
|
2200 | if (token2.inner.includes("*") && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
|
2201 | const expression = parse6(rest, { ...options8, fastpaths: false }).output;
|
2202 | output = token2.close = `)${expression})${extglobStar})`;
|
2203 | }
|
2204 | if (token2.prev.type === "bos") {
|
2205 | state.negatedExtglob = true;
|
2206 | }
|
2207 | }
|
2208 | push2({ type: "paren", extglob: true, value, output });
|
2209 | decrement("parens");
|
2210 | };
|
2211 | if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
|
2212 | let backslashes = false;
|
2213 | let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
|
2214 | if (first === "\\") {
|
2215 | backslashes = true;
|
2216 | return m;
|
2217 | }
|
2218 | if (first === "?") {
|
2219 | if (esc) {
|
2220 | return esc + first + (rest ? QMARK.repeat(rest.length) : "");
|
2221 | }
|
2222 | if (index === 0) {
|
2223 | return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : "");
|
2224 | }
|
2225 | return QMARK.repeat(chars.length);
|
2226 | }
|
2227 | if (first === ".") {
|
2228 | return DOT_LITERAL.repeat(chars.length);
|
2229 | }
|
2230 | if (first === "*") {
|
2231 | if (esc) {
|
2232 | return esc + first + (rest ? star : "");
|
2233 | }
|
2234 | return star;
|
2235 | }
|
2236 | return esc ? m : `\\${m}`;
|
2237 | });
|
2238 | if (backslashes === true) {
|
2239 | if (opts.unescape === true) {
|
2240 | output = output.replace(/\\/g, "");
|
2241 | } else {
|
2242 | output = output.replace(/\\+/g, (m) => {
|
2243 | return m.length % 2 === 0 ? "\\\\" : m ? "\\" : "";
|
2244 | });
|
2245 | }
|
2246 | }
|
2247 | if (output === input && opts.contains === true) {
|
2248 | state.output = input;
|
2249 | return state;
|
2250 | }
|
2251 | state.output = utils.wrapOutput(output, state, options8);
|
2252 | return state;
|
2253 | }
|
2254 | while (!eos()) {
|
2255 | value = advance();
|
2256 | if (value === "\0") {
|
2257 | continue;
|
2258 | }
|
2259 | if (value === "\\") {
|
2260 | const next = peek2();
|
2261 | if (next === "/" && opts.bash !== true) {
|
2262 | continue;
|
2263 | }
|
2264 | if (next === "." || next === ";") {
|
2265 | continue;
|
2266 | }
|
2267 | if (!next) {
|
2268 | value += "\\";
|
2269 | push2({ type: "text", value });
|
2270 | continue;
|
2271 | }
|
2272 | const match = /^\\+/.exec(remaining());
|
2273 | let slashes = 0;
|
2274 | if (match && match[0].length > 2) {
|
2275 | slashes = match[0].length;
|
2276 | state.index += slashes;
|
2277 | if (slashes % 2 !== 0) {
|
2278 | value += "\\";
|
2279 | }
|
2280 | }
|
2281 | if (opts.unescape === true) {
|
2282 | value = advance();
|
2283 | } else {
|
2284 | value += advance();
|
2285 | }
|
2286 | if (state.brackets === 0) {
|
2287 | push2({ type: "text", value });
|
2288 | continue;
|
2289 | }
|
2290 | }
|
2291 | if (state.brackets > 0 && (value !== "]" || prev.value === "[" || prev.value === "[^")) {
|
2292 | if (opts.posix !== false && value === ":") {
|
2293 | const inner = prev.value.slice(1);
|
2294 | if (inner.includes("[")) {
|
2295 | prev.posix = true;
|
2296 | if (inner.includes(":")) {
|
2297 | const idx = prev.value.lastIndexOf("[");
|
2298 | const pre = prev.value.slice(0, idx);
|
2299 | const rest2 = prev.value.slice(idx + 2);
|
2300 | const posix = POSIX_REGEX_SOURCE[rest2];
|
2301 | if (posix) {
|
2302 | prev.value = pre + posix;
|
2303 | state.backtrack = true;
|
2304 | advance();
|
2305 | if (!bos.output && tokens.indexOf(prev) === 1) {
|
2306 | bos.output = ONE_CHAR;
|
2307 | }
|
2308 | continue;
|
2309 | }
|
2310 | }
|
2311 | }
|
2312 | }
|
2313 | if (value === "[" && peek2() !== ":" || value === "-" && peek2() === "]") {
|
2314 | value = `\\${value}`;
|
2315 | }
|
2316 | if (value === "]" && (prev.value === "[" || prev.value === "[^")) {
|
2317 | value = `\\${value}`;
|
2318 | }
|
2319 | if (opts.posix === true && value === "!" && prev.value === "[") {
|
2320 | value = "^";
|
2321 | }
|
2322 | prev.value += value;
|
2323 | append({ value });
|
2324 | continue;
|
2325 | }
|
2326 | if (state.quotes === 1 && value !== '"') {
|
2327 | value = utils.escapeRegex(value);
|
2328 | prev.value += value;
|
2329 | append({ value });
|
2330 | continue;
|
2331 | }
|
2332 | if (value === '"') {
|
2333 | state.quotes = state.quotes === 1 ? 0 : 1;
|
2334 | if (opts.keepQuotes === true) {
|
2335 | push2({ type: "text", value });
|
2336 | }
|
2337 | continue;
|
2338 | }
|
2339 | if (value === "(") {
|
2340 | increment("parens");
|
2341 | push2({ type: "paren", value });
|
2342 | continue;
|
2343 | }
|
2344 | if (value === ")") {
|
2345 | if (state.parens === 0 && opts.strictBrackets === true) {
|
2346 | throw new SyntaxError(syntaxError2("opening", "("));
|
2347 | }
|
2348 | const extglob = extglobs[extglobs.length - 1];
|
2349 | if (extglob && state.parens === extglob.parens + 1) {
|
2350 | extglobClose(extglobs.pop());
|
2351 | continue;
|
2352 | }
|
2353 | push2({ type: "paren", value, output: state.parens ? ")" : "\\)" });
|
2354 | decrement("parens");
|
2355 | continue;
|
2356 | }
|
2357 | if (value === "[") {
|
2358 | if (opts.nobracket === true || !remaining().includes("]")) {
|
2359 | if (opts.nobracket !== true && opts.strictBrackets === true) {
|
2360 | throw new SyntaxError(syntaxError2("closing", "]"));
|
2361 | }
|
2362 | value = `\\${value}`;
|
2363 | } else {
|
2364 | increment("brackets");
|
2365 | }
|
2366 | push2({ type: "bracket", value });
|
2367 | continue;
|
2368 | }
|
2369 | if (value === "]") {
|
2370 | if (opts.nobracket === true || prev && prev.type === "bracket" && prev.value.length === 1) {
|
2371 | push2({ type: "text", value, output: `\\${value}` });
|
2372 | continue;
|
2373 | }
|
2374 | if (state.brackets === 0) {
|
2375 | if (opts.strictBrackets === true) {
|
2376 | throw new SyntaxError(syntaxError2("opening", "["));
|
2377 | }
|
2378 | push2({ type: "text", value, output: `\\${value}` });
|
2379 | continue;
|
2380 | }
|
2381 | decrement("brackets");
|
2382 | const prevValue = prev.value.slice(1);
|
2383 | if (prev.posix !== true && prevValue[0] === "^" && !prevValue.includes("/")) {
|
2384 | value = `/${value}`;
|
2385 | }
|
2386 | prev.value += value;
|
2387 | append({ value });
|
2388 | if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
|
2389 | continue;
|
2390 | }
|
2391 | const escaped = utils.escapeRegex(prev.value);
|
2392 | state.output = state.output.slice(0, -prev.value.length);
|
2393 | if (opts.literalBrackets === true) {
|
2394 | state.output += escaped;
|
2395 | prev.value = escaped;
|
2396 | continue;
|
2397 | }
|
2398 | prev.value = `(${capture}${escaped}|${prev.value})`;
|
2399 | state.output += prev.value;
|
2400 | continue;
|
2401 | }
|
2402 | if (value === "{" && opts.nobrace !== true) {
|
2403 | increment("braces");
|
2404 | const open = {
|
2405 | type: "brace",
|
2406 | value,
|
2407 | output: "(",
|
2408 | outputIndex: state.output.length,
|
2409 | tokensIndex: state.tokens.length
|
2410 | };
|
2411 | braces.push(open);
|
2412 | push2(open);
|
2413 | continue;
|
2414 | }
|
2415 | if (value === "}") {
|
2416 | const brace = braces[braces.length - 1];
|
2417 | if (opts.nobrace === true || !brace) {
|
2418 | push2({ type: "text", value, output: value });
|
2419 | continue;
|
2420 | }
|
2421 | let output = ")";
|
2422 | if (brace.dots === true) {
|
2423 | const arr = tokens.slice();
|
2424 | const range = [];
|
2425 | for (let i = arr.length - 1; i >= 0; i--) {
|
2426 | tokens.pop();
|
2427 | if (arr[i].type === "brace") {
|
2428 | break;
|
2429 | }
|
2430 | if (arr[i].type !== "dots") {
|
2431 | range.unshift(arr[i].value);
|
2432 | }
|
2433 | }
|
2434 | output = expandRange(range, opts);
|
2435 | state.backtrack = true;
|
2436 | }
|
2437 | if (brace.comma !== true && brace.dots !== true) {
|
2438 | const out = state.output.slice(0, brace.outputIndex);
|
2439 | const toks = state.tokens.slice(brace.tokensIndex);
|
2440 | brace.value = brace.output = "\\{";
|
2441 | value = output = "\\}";
|
2442 | state.output = out;
|
2443 | for (const t of toks) {
|
2444 | state.output += t.output || t.value;
|
2445 | }
|
2446 | }
|
2447 | push2({ type: "brace", value, output });
|
2448 | decrement("braces");
|
2449 | braces.pop();
|
2450 | continue;
|
2451 | }
|
2452 | if (value === "|") {
|
2453 | if (extglobs.length > 0) {
|
2454 | extglobs[extglobs.length - 1].conditions++;
|
2455 | }
|
2456 | push2({ type: "text", value });
|
2457 | continue;
|
2458 | }
|
2459 | if (value === ",") {
|
2460 | let output = value;
|
2461 | const brace = braces[braces.length - 1];
|
2462 | if (brace && stack2[stack2.length - 1] === "braces") {
|
2463 | brace.comma = true;
|
2464 | output = "|";
|
2465 | }
|
2466 | push2({ type: "comma", value, output });
|
2467 | continue;
|
2468 | }
|
2469 | if (value === "/") {
|
2470 | if (prev.type === "dot" && state.index === state.start + 1) {
|
2471 | state.start = state.index + 1;
|
2472 | state.consumed = "";
|
2473 | state.output = "";
|
2474 | tokens.pop();
|
2475 | prev = bos;
|
2476 | continue;
|
2477 | }
|
2478 | push2({ type: "slash", value, output: SLASH_LITERAL });
|
2479 | continue;
|
2480 | }
|
2481 | if (value === ".") {
|
2482 | if (state.braces > 0 && prev.type === "dot") {
|
2483 | if (prev.value === ".") prev.output = DOT_LITERAL;
|
2484 | const brace = braces[braces.length - 1];
|
2485 | prev.type = "dots";
|
2486 | prev.output += value;
|
2487 | prev.value += value;
|
2488 | brace.dots = true;
|
2489 | continue;
|
2490 | }
|
2491 | if (state.braces + state.parens === 0 && prev.type !== "bos" && prev.type !== "slash") {
|
2492 | push2({ type: "text", value, output: DOT_LITERAL });
|
2493 | continue;
|
2494 | }
|
2495 | push2({ type: "dot", value, output: DOT_LITERAL });
|
2496 | continue;
|
2497 | }
|
2498 | if (value === "?") {
|
2499 | const isGroup = prev && prev.value === "(";
|
2500 | if (!isGroup && opts.noextglob !== true && peek2() === "(" && peek2(2) !== "?") {
|
2501 | extglobOpen("qmark", value);
|
2502 | continue;
|
2503 | }
|
2504 | if (prev && prev.type === "paren") {
|
2505 | const next = peek2();
|
2506 | let output = value;
|
2507 | if (next === "<" && !utils.supportsLookbehinds()) {
|
2508 | throw new Error("Node.js v10 or higher is required for regex lookbehinds");
|
2509 | }
|
2510 | if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
|
2511 | output = `\\${value}`;
|
2512 | }
|
2513 | push2({ type: "text", value, output });
|
2514 | continue;
|
2515 | }
|
2516 | if (opts.dot !== true && (prev.type === "slash" || prev.type === "bos")) {
|
2517 | push2({ type: "qmark", value, output: QMARK_NO_DOT });
|
2518 | continue;
|
2519 | }
|
2520 | push2({ type: "qmark", value, output: QMARK });
|
2521 | continue;
|
2522 | }
|
2523 | if (value === "!") {
|
2524 | if (opts.noextglob !== true && peek2() === "(") {
|
2525 | if (peek2(2) !== "?" || !/[!=<:]/.test(peek2(3))) {
|
2526 | extglobOpen("negate", value);
|
2527 | continue;
|
2528 | }
|
2529 | }
|
2530 | if (opts.nonegate !== true && state.index === 0) {
|
2531 | negate();
|
2532 | continue;
|
2533 | }
|
2534 | }
|
2535 | if (value === "+") {
|
2536 | if (opts.noextglob !== true && peek2() === "(" && peek2(2) !== "?") {
|
2537 | extglobOpen("plus", value);
|
2538 | continue;
|
2539 | }
|
2540 | if (prev && prev.value === "(" || opts.regex === false) {
|
2541 | push2({ type: "plus", value, output: PLUS_LITERAL });
|
2542 | continue;
|
2543 | }
|
2544 | if (prev && (prev.type === "bracket" || prev.type === "paren" || prev.type === "brace") || state.parens > 0) {
|
2545 | push2({ type: "plus", value });
|
2546 | continue;
|
2547 | }
|
2548 | push2({ type: "plus", value: PLUS_LITERAL });
|
2549 | continue;
|
2550 | }
|
2551 | if (value === "@") {
|
2552 | if (opts.noextglob !== true && peek2() === "(" && peek2(2) !== "?") {
|
2553 | push2({ type: "at", extglob: true, value, output: "" });
|
2554 | continue;
|
2555 | }
|
2556 | push2({ type: "text", value });
|
2557 | continue;
|
2558 | }
|
2559 | if (value !== "*") {
|
2560 | if (value === "$" || value === "^") {
|
2561 | value = `\\${value}`;
|
2562 | }
|
2563 | const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
|
2564 | if (match) {
|
2565 | value += match[0];
|
2566 | state.index += match[0].length;
|
2567 | }
|
2568 | push2({ type: "text", value });
|
2569 | continue;
|
2570 | }
|
2571 | if (prev && (prev.type === "globstar" || prev.star === true)) {
|
2572 | prev.type = "star";
|
2573 | prev.star = true;
|
2574 | prev.value += value;
|
2575 | prev.output = star;
|
2576 | state.backtrack = true;
|
2577 | state.globstar = true;
|
2578 | consume(value);
|
2579 | continue;
|
2580 | }
|
2581 | let rest = remaining();
|
2582 | if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
|
2583 | extglobOpen("star", value);
|
2584 | continue;
|
2585 | }
|
2586 | if (prev.type === "star") {
|
2587 | if (opts.noglobstar === true) {
|
2588 | consume(value);
|
2589 | continue;
|
2590 | }
|
2591 | const prior = prev.prev;
|
2592 | const before = prior.prev;
|
2593 | const isStart = prior.type === "slash" || prior.type === "bos";
|
2594 | const afterStar = before && (before.type === "star" || before.type === "globstar");
|
2595 | if (opts.bash === true && (!isStart || rest[0] && rest[0] !== "/")) {
|
2596 | push2({ type: "star", value, output: "" });
|
2597 | continue;
|
2598 | }
|
2599 | const isBrace = state.braces > 0 && (prior.type === "comma" || prior.type === "brace");
|
2600 | const isExtglob = extglobs.length && (prior.type === "pipe" || prior.type === "paren");
|
2601 | if (!isStart && prior.type !== "paren" && !isBrace && !isExtglob) {
|
2602 | push2({ type: "star", value, output: "" });
|
2603 | continue;
|
2604 | }
|
2605 | while (rest.slice(0, 3) === "/**") {
|
2606 | const after = input[state.index + 4];
|
2607 | if (after && after !== "/") {
|
2608 | break;
|
2609 | }
|
2610 | rest = rest.slice(3);
|
2611 | consume("/**", 3);
|
2612 | }
|
2613 | if (prior.type === "bos" && eos()) {
|
2614 | prev.type = "globstar";
|
2615 | prev.value += value;
|
2616 | prev.output = globstar(opts);
|
2617 | state.output = prev.output;
|
2618 | state.globstar = true;
|
2619 | consume(value);
|
2620 | continue;
|
2621 | }
|
2622 | if (prior.type === "slash" && prior.prev.type !== "bos" && !afterStar && eos()) {
|
2623 | state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
2624 | prior.output = `(?:${prior.output}`;
|
2625 | prev.type = "globstar";
|
2626 | prev.output = globstar(opts) + (opts.strictSlashes ? ")" : "|$)");
|
2627 | prev.value += value;
|
2628 | state.globstar = true;
|
2629 | state.output += prior.output + prev.output;
|
2630 | consume(value);
|
2631 | continue;
|
2632 | }
|
2633 | if (prior.type === "slash" && prior.prev.type !== "bos" && rest[0] === "/") {
|
2634 | const end = rest[1] !== void 0 ? "|$" : "";
|
2635 | state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
2636 | prior.output = `(?:${prior.output}`;
|
2637 | prev.type = "globstar";
|
2638 | prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
|
2639 | prev.value += value;
|
2640 | state.output += prior.output + prev.output;
|
2641 | state.globstar = true;
|
2642 | consume(value + advance());
|
2643 | push2({ type: "slash", value: "/", output: "" });
|
2644 | continue;
|
2645 | }
|
2646 | if (prior.type === "bos" && rest[0] === "/") {
|
2647 | prev.type = "globstar";
|
2648 | prev.value += value;
|
2649 | prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
|
2650 | state.output = prev.output;
|
2651 | state.globstar = true;
|
2652 | consume(value + advance());
|
2653 | push2({ type: "slash", value: "/", output: "" });
|
2654 | continue;
|
2655 | }
|
2656 | state.output = state.output.slice(0, -prev.output.length);
|
2657 | prev.type = "globstar";
|
2658 | prev.output = globstar(opts);
|
2659 | prev.value += value;
|
2660 | state.output += prev.output;
|
2661 | state.globstar = true;
|
2662 | consume(value);
|
2663 | continue;
|
2664 | }
|
2665 | const token2 = { type: "star", value, output: star };
|
2666 | if (opts.bash === true) {
|
2667 | token2.output = ".*?";
|
2668 | if (prev.type === "bos" || prev.type === "slash") {
|
2669 | token2.output = nodot + token2.output;
|
2670 | }
|
2671 | push2(token2);
|
2672 | continue;
|
2673 | }
|
2674 | if (prev && (prev.type === "bracket" || prev.type === "paren") && opts.regex === true) {
|
2675 | token2.output = value;
|
2676 | push2(token2);
|
2677 | continue;
|
2678 | }
|
2679 | if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
|
2680 | if (prev.type === "dot") {
|
2681 | state.output += NO_DOT_SLASH;
|
2682 | prev.output += NO_DOT_SLASH;
|
2683 | } else if (opts.dot === true) {
|
2684 | state.output += NO_DOTS_SLASH;
|
2685 | prev.output += NO_DOTS_SLASH;
|
2686 | } else {
|
2687 | state.output += nodot;
|
2688 | prev.output += nodot;
|
2689 | }
|
2690 | if (peek2() !== "*") {
|
2691 | state.output += ONE_CHAR;
|
2692 | prev.output += ONE_CHAR;
|
2693 | }
|
2694 | }
|
2695 | push2(token2);
|
2696 | }
|
2697 | while (state.brackets > 0) {
|
2698 | if (opts.strictBrackets === true) throw new SyntaxError(syntaxError2("closing", "]"));
|
2699 | state.output = utils.escapeLast(state.output, "[");
|
2700 | decrement("brackets");
|
2701 | }
|
2702 | while (state.parens > 0) {
|
2703 | if (opts.strictBrackets === true) throw new SyntaxError(syntaxError2("closing", ")"));
|
2704 | state.output = utils.escapeLast(state.output, "(");
|
2705 | decrement("parens");
|
2706 | }
|
2707 | while (state.braces > 0) {
|
2708 | if (opts.strictBrackets === true) throw new SyntaxError(syntaxError2("closing", "}"));
|
2709 | state.output = utils.escapeLast(state.output, "{");
|
2710 | decrement("braces");
|
2711 | }
|
2712 | if (opts.strictSlashes !== true && (prev.type === "star" || prev.type === "bracket")) {
|
2713 | push2({ type: "maybe_slash", value: "", output: `${SLASH_LITERAL}?` });
|
2714 | }
|
2715 | if (state.backtrack === true) {
|
2716 | state.output = "";
|
2717 | for (const token2 of state.tokens) {
|
2718 | state.output += token2.output != null ? token2.output : token2.value;
|
2719 | if (token2.suffix) {
|
2720 | state.output += token2.suffix;
|
2721 | }
|
2722 | }
|
2723 | }
|
2724 | return state;
|
2725 | };
|
2726 | parse6.fastpaths = (input, options8) => {
|
2727 | const opts = { ...options8 };
|
2728 | const max = typeof opts.maxLength === "number" ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
|
2729 | const len = input.length;
|
2730 | if (len > max) {
|
2731 | throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
|
2732 | }
|
2733 | input = REPLACEMENTS[input] || input;
|
2734 | const win32 = utils.isWindows(options8);
|
2735 | const {
|
2736 | DOT_LITERAL,
|
2737 | SLASH_LITERAL,
|
2738 | ONE_CHAR,
|
2739 | DOTS_SLASH,
|
2740 | NO_DOT,
|
2741 | NO_DOTS,
|
2742 | NO_DOTS_SLASH,
|
2743 | STAR,
|
2744 | START_ANCHOR
|
2745 | } = constants.globChars(win32);
|
2746 | const nodot = opts.dot ? NO_DOTS : NO_DOT;
|
2747 | const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
|
2748 | const capture = opts.capture ? "" : "?:";
|
2749 | const state = { negated: false, prefix: "" };
|
2750 | let star = opts.bash === true ? ".*?" : STAR;
|
2751 | if (opts.capture) {
|
2752 | star = `(${star})`;
|
2753 | }
|
2754 | const globstar = (opts2) => {
|
2755 | if (opts2.noglobstar === true) return star;
|
2756 | return `(${capture}(?:(?!${START_ANCHOR}${opts2.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
|
2757 | };
|
2758 | const create = (str2) => {
|
2759 | switch (str2) {
|
2760 | case "*":
|
2761 | return `${nodot}${ONE_CHAR}${star}`;
|
2762 | case ".*":
|
2763 | return `${DOT_LITERAL}${ONE_CHAR}${star}`;
|
2764 | case "*.*":
|
2765 | return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
2766 | case "*/*":
|
2767 | return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
|
2768 | case "**":
|
2769 | return nodot + globstar(opts);
|
2770 | case "**/*":
|
2771 | return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
|
2772 | case "**/*.*":
|
2773 | return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
|
2774 | case "**/.*":
|
2775 | return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
|
2776 | default: {
|
2777 | const match = /^(.*?)\.(\w+)$/.exec(str2);
|
2778 | if (!match) return;
|
2779 | const source3 = create(match[1]);
|
2780 | if (!source3) return;
|
2781 | return source3 + DOT_LITERAL + match[2];
|
2782 | }
|
2783 | }
|
2784 | };
|
2785 | const output = utils.removePrefix(input, state);
|
2786 | let source2 = create(output);
|
2787 | if (source2 && opts.strictSlashes !== true) {
|
2788 | source2 += `${SLASH_LITERAL}?`;
|
2789 | }
|
2790 | return source2;
|
2791 | };
|
2792 | module.exports = parse6;
|
2793 | }
|
2794 | });
|
2795 |
|
2796 |
|
2797 | var require_picomatch = __commonJS({
|
2798 | "node_modules/picomatch/lib/picomatch.js"(exports, module) {
|
2799 | "use strict";
|
2800 | var path13 = __require("path");
|
2801 | var scan = require_scan();
|
2802 | var parse6 = require_parse2();
|
2803 | var utils = require_utils2();
|
2804 | var constants = require_constants2();
|
2805 | var isObject3 = (val) => val && typeof val === "object" && !Array.isArray(val);
|
2806 | var picomatch = (glob, options8, returnState = false) => {
|
2807 | if (Array.isArray(glob)) {
|
2808 | const fns = glob.map((input) => picomatch(input, options8, returnState));
|
2809 | const arrayMatcher = (str2) => {
|
2810 | for (const isMatch of fns) {
|
2811 | const state2 = isMatch(str2);
|
2812 | if (state2) return state2;
|
2813 | }
|
2814 | return false;
|
2815 | };
|
2816 | return arrayMatcher;
|
2817 | }
|
2818 | const isState = isObject3(glob) && glob.tokens && glob.input;
|
2819 | if (glob === "" || typeof glob !== "string" && !isState) {
|
2820 | throw new TypeError("Expected pattern to be a non-empty string");
|
2821 | }
|
2822 | const opts = options8 || {};
|
2823 | const posix = utils.isWindows(options8);
|
2824 | const regex = isState ? picomatch.compileRe(glob, options8) : picomatch.makeRe(glob, options8, false, true);
|
2825 | const state = regex.state;
|
2826 | delete regex.state;
|
2827 | let isIgnored2 = () => false;
|
2828 | if (opts.ignore) {
|
2829 | const ignoreOpts = { ...options8, ignore: null, onMatch: null, onResult: null };
|
2830 | isIgnored2 = picomatch(opts.ignore, ignoreOpts, returnState);
|
2831 | }
|
2832 | const matcher = (input, returnObject = false) => {
|
2833 | const { isMatch, match, output } = picomatch.test(input, regex, options8, { glob, posix });
|
2834 | const result = { glob, state, regex, posix, input, output, match, isMatch };
|
2835 | if (typeof opts.onResult === "function") {
|
2836 | opts.onResult(result);
|
2837 | }
|
2838 | if (isMatch === false) {
|
2839 | result.isMatch = false;
|
2840 | return returnObject ? result : false;
|
2841 | }
|
2842 | if (isIgnored2(input)) {
|
2843 | if (typeof opts.onIgnore === "function") {
|
2844 | opts.onIgnore(result);
|
2845 | }
|
2846 | result.isMatch = false;
|
2847 | return returnObject ? result : false;
|
2848 | }
|
2849 | if (typeof opts.onMatch === "function") {
|
2850 | opts.onMatch(result);
|
2851 | }
|
2852 | return returnObject ? result : true;
|
2853 | };
|
2854 | if (returnState) {
|
2855 | matcher.state = state;
|
2856 | }
|
2857 | return matcher;
|
2858 | };
|
2859 | picomatch.test = (input, regex, options8, { glob, posix } = {}) => {
|
2860 | if (typeof input !== "string") {
|
2861 | throw new TypeError("Expected input to be a string");
|
2862 | }
|
2863 | if (input === "") {
|
2864 | return { isMatch: false, output: "" };
|
2865 | }
|
2866 | const opts = options8 || {};
|
2867 | const format3 = opts.format || (posix ? utils.toPosixSlashes : null);
|
2868 | let match = input === glob;
|
2869 | let output = match && format3 ? format3(input) : input;
|
2870 | if (match === false) {
|
2871 | output = format3 ? format3(input) : input;
|
2872 | match = output === glob;
|
2873 | }
|
2874 | if (match === false || opts.capture === true) {
|
2875 | if (opts.matchBase === true || opts.basename === true) {
|
2876 | match = picomatch.matchBase(input, regex, options8, posix);
|
2877 | } else {
|
2878 | match = regex.exec(output);
|
2879 | }
|
2880 | }
|
2881 | return { isMatch: Boolean(match), match, output };
|
2882 | };
|
2883 | picomatch.matchBase = (input, glob, options8, posix = utils.isWindows(options8)) => {
|
2884 | const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options8);
|
2885 | return regex.test(path13.basename(input));
|
2886 | };
|
2887 | picomatch.isMatch = (str2, patterns, options8) => picomatch(patterns, options8)(str2);
|
2888 | picomatch.parse = (pattern, options8) => {
|
2889 | if (Array.isArray(pattern)) return pattern.map((p) => picomatch.parse(p, options8));
|
2890 | return parse6(pattern, { ...options8, fastpaths: false });
|
2891 | };
|
2892 | picomatch.scan = (input, options8) => scan(input, options8);
|
2893 | picomatch.compileRe = (state, options8, returnOutput = false, returnState = false) => {
|
2894 | if (returnOutput === true) {
|
2895 | return state.output;
|
2896 | }
|
2897 | const opts = options8 || {};
|
2898 | const prepend = opts.contains ? "" : "^";
|
2899 | const append = opts.contains ? "" : "$";
|
2900 | let source2 = `${prepend}(?:${state.output})${append}`;
|
2901 | if (state && state.negated === true) {
|
2902 | source2 = `^(?!${source2}).*$`;
|
2903 | }
|
2904 | const regex = picomatch.toRegex(source2, options8);
|
2905 | if (returnState === true) {
|
2906 | regex.state = state;
|
2907 | }
|
2908 | return regex;
|
2909 | };
|
2910 | picomatch.makeRe = (input, options8 = {}, returnOutput = false, returnState = false) => {
|
2911 | if (!input || typeof input !== "string") {
|
2912 | throw new TypeError("Expected a non-empty string");
|
2913 | }
|
2914 | let parsed = { negated: false, fastpaths: true };
|
2915 | if (options8.fastpaths !== false && (input[0] === "." || input[0] === "*")) {
|
2916 | parsed.output = parse6.fastpaths(input, options8);
|
2917 | }
|
2918 | if (!parsed.output) {
|
2919 | parsed = parse6(input, options8);
|
2920 | }
|
2921 | return picomatch.compileRe(parsed, options8, returnOutput, returnState);
|
2922 | };
|
2923 | picomatch.toRegex = (source2, options8) => {
|
2924 | try {
|
2925 | const opts = options8 || {};
|
2926 | return new RegExp(source2, opts.flags || (opts.nocase ? "i" : ""));
|
2927 | } catch (err) {
|
2928 | if (options8 && options8.debug === true) throw err;
|
2929 | return /$^/;
|
2930 | }
|
2931 | };
|
2932 | picomatch.constants = constants;
|
2933 | module.exports = picomatch;
|
2934 | }
|
2935 | });
|
2936 |
|
2937 |
|
2938 | var require_picomatch2 = __commonJS({
|
2939 | "node_modules/picomatch/index.js"(exports, module) {
|
2940 | "use strict";
|
2941 | module.exports = require_picomatch();
|
2942 | }
|
2943 | });
|
2944 |
|
2945 |
|
2946 | var require_micromatch = __commonJS({
|
2947 | "node_modules/micromatch/index.js"(exports, module) {
|
2948 | "use strict";
|
2949 | var util2 = __require("util");
|
2950 | var braces = require_braces();
|
2951 | var picomatch = require_picomatch2();
|
2952 | var utils = require_utils2();
|
2953 | var isEmptyString = (val) => val === "" || val === "./";
|
2954 | var micromatch2 = (list, patterns, options8) => {
|
2955 | patterns = [].concat(patterns);
|
2956 | list = [].concat(list);
|
2957 | let omit2 = new Set();
|
2958 | let keep = new Set();
|
2959 | let items = new Set();
|
2960 | let negatives = 0;
|
2961 | let onResult = (state) => {
|
2962 | items.add(state.output);
|
2963 | if (options8 && options8.onResult) {
|
2964 | options8.onResult(state);
|
2965 | }
|
2966 | };
|
2967 | for (let i = 0; i < patterns.length; i++) {
|
2968 | let isMatch = picomatch(String(patterns[i]), { ...options8, onResult }, true);
|
2969 | let negated = isMatch.state.negated || isMatch.state.negatedExtglob;
|
2970 | if (negated) negatives++;
|
2971 | for (let item of list) {
|
2972 | let matched = isMatch(item, true);
|
2973 | let match = negated ? !matched.isMatch : matched.isMatch;
|
2974 | if (!match) continue;
|
2975 | if (negated) {
|
2976 | omit2.add(matched.output);
|
2977 | } else {
|
2978 | omit2.delete(matched.output);
|
2979 | keep.add(matched.output);
|
2980 | }
|
2981 | }
|
2982 | }
|
2983 | let result = negatives === patterns.length ? [...items] : [...keep];
|
2984 | let matches = result.filter((item) => !omit2.has(item));
|
2985 | if (options8 && matches.length === 0) {
|
2986 | if (options8.failglob === true) {
|
2987 | throw new Error(`No matches found for "${patterns.join(", ")}"`);
|
2988 | }
|
2989 | if (options8.nonull === true || options8.nullglob === true) {
|
2990 | return options8.unescape ? patterns.map((p) => p.replace(/\\/g, "")) : patterns;
|
2991 | }
|
2992 | }
|
2993 | return matches;
|
2994 | };
|
2995 | micromatch2.match = micromatch2;
|
2996 | micromatch2.matcher = (pattern, options8) => picomatch(pattern, options8);
|
2997 | micromatch2.isMatch = (str2, patterns, options8) => picomatch(patterns, options8)(str2);
|
2998 | micromatch2.any = micromatch2.isMatch;
|
2999 | micromatch2.not = (list, patterns, options8 = {}) => {
|
3000 | patterns = [].concat(patterns).map(String);
|
3001 | let result = new Set();
|
3002 | let items = [];
|
3003 | let onResult = (state) => {
|
3004 | if (options8.onResult) options8.onResult(state);
|
3005 | items.push(state.output);
|
3006 | };
|
3007 | let matches = new Set(micromatch2(list, patterns, { ...options8, onResult }));
|
3008 | for (let item of items) {
|
3009 | if (!matches.has(item)) {
|
3010 | result.add(item);
|
3011 | }
|
3012 | }
|
3013 | return [...result];
|
3014 | };
|
3015 | micromatch2.contains = (str2, pattern, options8) => {
|
3016 | if (typeof str2 !== "string") {
|
3017 | throw new TypeError(`Expected a string: "${util2.inspect(str2)}"`);
|
3018 | }
|
3019 | if (Array.isArray(pattern)) {
|
3020 | return pattern.some((p) => micromatch2.contains(str2, p, options8));
|
3021 | }
|
3022 | if (typeof pattern === "string") {
|
3023 | if (isEmptyString(str2) || isEmptyString(pattern)) {
|
3024 | return false;
|
3025 | }
|
3026 | if (str2.includes(pattern) || str2.startsWith("./") && str2.slice(2).includes(pattern)) {
|
3027 | return true;
|
3028 | }
|
3029 | }
|
3030 | return micromatch2.isMatch(str2, pattern, { ...options8, contains: true });
|
3031 | };
|
3032 | micromatch2.matchKeys = (obj, patterns, options8) => {
|
3033 | if (!utils.isObject(obj)) {
|
3034 | throw new TypeError("Expected the first argument to be an object");
|
3035 | }
|
3036 | let keys = micromatch2(Object.keys(obj), patterns, options8);
|
3037 | let res = {};
|
3038 | for (let key2 of keys) res[key2] = obj[key2];
|
3039 | return res;
|
3040 | };
|
3041 | micromatch2.some = (list, patterns, options8) => {
|
3042 | let items = [].concat(list);
|
3043 | for (let pattern of [].concat(patterns)) {
|
3044 | let isMatch = picomatch(String(pattern), options8);
|
3045 | if (items.some((item) => isMatch(item))) {
|
3046 | return true;
|
3047 | }
|
3048 | }
|
3049 | return false;
|
3050 | };
|
3051 | micromatch2.every = (list, patterns, options8) => {
|
3052 | let items = [].concat(list);
|
3053 | for (let pattern of [].concat(patterns)) {
|
3054 | let isMatch = picomatch(String(pattern), options8);
|
3055 | if (!items.every((item) => isMatch(item))) {
|
3056 | return false;
|
3057 | }
|
3058 | }
|
3059 | return true;
|
3060 | };
|
3061 | micromatch2.all = (str2, patterns, options8) => {
|
3062 | if (typeof str2 !== "string") {
|
3063 | throw new TypeError(`Expected a string: "${util2.inspect(str2)}"`);
|
3064 | }
|
3065 | return [].concat(patterns).every((p) => picomatch(p, options8)(str2));
|
3066 | };
|
3067 | micromatch2.capture = (glob, input, options8) => {
|
3068 | let posix = utils.isWindows(options8);
|
3069 | let regex = picomatch.makeRe(String(glob), { ...options8, capture: true });
|
3070 | let match = regex.exec(posix ? utils.toPosixSlashes(input) : input);
|
3071 | if (match) {
|
3072 | return match.slice(1).map((v) => v === void 0 ? "" : v);
|
3073 | }
|
3074 | };
|
3075 | micromatch2.makeRe = (...args) => picomatch.makeRe(...args);
|
3076 | micromatch2.scan = (...args) => picomatch.scan(...args);
|
3077 | micromatch2.parse = (patterns, options8) => {
|
3078 | let res = [];
|
3079 | for (let pattern of [].concat(patterns || [])) {
|
3080 | for (let str2 of braces(String(pattern), options8)) {
|
3081 | res.push(picomatch.parse(str2, options8));
|
3082 | }
|
3083 | }
|
3084 | return res;
|
3085 | };
|
3086 | micromatch2.braces = (pattern, options8) => {
|
3087 | if (typeof pattern !== "string") throw new TypeError("Expected a string");
|
3088 | if (options8 && options8.nobrace === true || !/\{.*\}/.test(pattern)) {
|
3089 | return [pattern];
|
3090 | }
|
3091 | return braces(pattern, options8);
|
3092 | };
|
3093 | micromatch2.braceExpand = (pattern, options8) => {
|
3094 | if (typeof pattern !== "string") throw new TypeError("Expected a string");
|
3095 | return micromatch2.braces(pattern, { ...options8, expand: true });
|
3096 | };
|
3097 | module.exports = micromatch2;
|
3098 | }
|
3099 | });
|
3100 |
|
3101 |
|
3102 | var require_pattern = __commonJS({
|
3103 | "node_modules/fast-glob/out/utils/pattern.js"(exports) {
|
3104 | "use strict";
|
3105 | Object.defineProperty(exports, "__esModule", { value: true });
|
3106 | exports.removeDuplicateSlashes = exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.isPatternRelatedToParentDirectory = exports.getPatternsOutsideCurrentDirectory = exports.getPatternsInsideCurrentDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = void 0;
|
3107 | var path13 = __require("path");
|
3108 | var globParent = require_glob_parent();
|
3109 | var micromatch2 = require_micromatch();
|
3110 | var GLOBSTAR = "**";
|
3111 | var ESCAPE_SYMBOL = "\\";
|
3112 | var COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/;
|
3113 | var REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[[^[]*]/;
|
3114 | var REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\([^(]*\|[^|]*\)/;
|
3115 | var GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\([^(]*\)/;
|
3116 | var BRACE_EXPANSION_SEPARATORS_RE = /,|\.\./;
|
3117 | var DOUBLE_SLASH_RE = /(?!^)\/{2,}/g;
|
3118 | function isStaticPattern(pattern, options8 = {}) {
|
3119 | return !isDynamicPattern(pattern, options8);
|
3120 | }
|
3121 | exports.isStaticPattern = isStaticPattern;
|
3122 | function isDynamicPattern(pattern, options8 = {}) {
|
3123 | if (pattern === "") {
|
3124 | return false;
|
3125 | }
|
3126 | if (options8.caseSensitiveMatch === false || pattern.includes(ESCAPE_SYMBOL)) {
|
3127 | return true;
|
3128 | }
|
3129 | if (COMMON_GLOB_SYMBOLS_RE.test(pattern) || REGEX_CHARACTER_CLASS_SYMBOLS_RE.test(pattern) || REGEX_GROUP_SYMBOLS_RE.test(pattern)) {
|
3130 | return true;
|
3131 | }
|
3132 | if (options8.extglob !== false && GLOB_EXTENSION_SYMBOLS_RE.test(pattern)) {
|
3133 | return true;
|
3134 | }
|
3135 | if (options8.braceExpansion !== false && hasBraceExpansion(pattern)) {
|
3136 | return true;
|
3137 | }
|
3138 | return false;
|
3139 | }
|
3140 | exports.isDynamicPattern = isDynamicPattern;
|
3141 | function hasBraceExpansion(pattern) {
|
3142 | const openingBraceIndex = pattern.indexOf("{");
|
3143 | if (openingBraceIndex === -1) {
|
3144 | return false;
|
3145 | }
|
3146 | const closingBraceIndex = pattern.indexOf("}", openingBraceIndex + 1);
|
3147 | if (closingBraceIndex === -1) {
|
3148 | return false;
|
3149 | }
|
3150 | const braceContent = pattern.slice(openingBraceIndex, closingBraceIndex);
|
3151 | return BRACE_EXPANSION_SEPARATORS_RE.test(braceContent);
|
3152 | }
|
3153 | function convertToPositivePattern(pattern) {
|
3154 | return isNegativePattern(pattern) ? pattern.slice(1) : pattern;
|
3155 | }
|
3156 | exports.convertToPositivePattern = convertToPositivePattern;
|
3157 | function convertToNegativePattern(pattern) {
|
3158 | return "!" + pattern;
|
3159 | }
|
3160 | exports.convertToNegativePattern = convertToNegativePattern;
|
3161 | function isNegativePattern(pattern) {
|
3162 | return pattern.startsWith("!") && pattern[1] !== "(";
|
3163 | }
|
3164 | exports.isNegativePattern = isNegativePattern;
|
3165 | function isPositivePattern(pattern) {
|
3166 | return !isNegativePattern(pattern);
|
3167 | }
|
3168 | exports.isPositivePattern = isPositivePattern;
|
3169 | function getNegativePatterns(patterns) {
|
3170 | return patterns.filter(isNegativePattern);
|
3171 | }
|
3172 | exports.getNegativePatterns = getNegativePatterns;
|
3173 | function getPositivePatterns(patterns) {
|
3174 | return patterns.filter(isPositivePattern);
|
3175 | }
|
3176 | exports.getPositivePatterns = getPositivePatterns;
|
3177 | function getPatternsInsideCurrentDirectory(patterns) {
|
3178 | return patterns.filter((pattern) => !isPatternRelatedToParentDirectory(pattern));
|
3179 | }
|
3180 | exports.getPatternsInsideCurrentDirectory = getPatternsInsideCurrentDirectory;
|
3181 | function getPatternsOutsideCurrentDirectory(patterns) {
|
3182 | return patterns.filter(isPatternRelatedToParentDirectory);
|
3183 | }
|
3184 | exports.getPatternsOutsideCurrentDirectory = getPatternsOutsideCurrentDirectory;
|
3185 | function isPatternRelatedToParentDirectory(pattern) {
|
3186 | return pattern.startsWith("..") || pattern.startsWith("./..");
|
3187 | }
|
3188 | exports.isPatternRelatedToParentDirectory = isPatternRelatedToParentDirectory;
|
3189 | function getBaseDirectory(pattern) {
|
3190 | return globParent(pattern, { flipBackslashes: false });
|
3191 | }
|
3192 | exports.getBaseDirectory = getBaseDirectory;
|
3193 | function hasGlobStar(pattern) {
|
3194 | return pattern.includes(GLOBSTAR);
|
3195 | }
|
3196 | exports.hasGlobStar = hasGlobStar;
|
3197 | function endsWithSlashGlobStar(pattern) {
|
3198 | return pattern.endsWith("/" + GLOBSTAR);
|
3199 | }
|
3200 | exports.endsWithSlashGlobStar = endsWithSlashGlobStar;
|
3201 | function isAffectDepthOfReadingPattern(pattern) {
|
3202 | const basename = path13.basename(pattern);
|
3203 | return endsWithSlashGlobStar(pattern) || isStaticPattern(basename);
|
3204 | }
|
3205 | exports.isAffectDepthOfReadingPattern = isAffectDepthOfReadingPattern;
|
3206 | function expandPatternsWithBraceExpansion(patterns) {
|
3207 | return patterns.reduce((collection, pattern) => {
|
3208 | return collection.concat(expandBraceExpansion(pattern));
|
3209 | }, []);
|
3210 | }
|
3211 | exports.expandPatternsWithBraceExpansion = expandPatternsWithBraceExpansion;
|
3212 | function expandBraceExpansion(pattern) {
|
3213 | const patterns = micromatch2.braces(pattern, { expand: true, nodupes: true, keepEscaping: true });
|
3214 | patterns.sort((a, b) => a.length - b.length);
|
3215 | return patterns.filter((pattern2) => pattern2 !== "");
|
3216 | }
|
3217 | exports.expandBraceExpansion = expandBraceExpansion;
|
3218 | function getPatternParts(pattern, options8) {
|
3219 | let { parts } = micromatch2.scan(pattern, Object.assign(Object.assign({}, options8), { parts: true }));
|
3220 | if (parts.length === 0) {
|
3221 | parts = [pattern];
|
3222 | }
|
3223 | if (parts[0].startsWith("/")) {
|
3224 | parts[0] = parts[0].slice(1);
|
3225 | parts.unshift("");
|
3226 | }
|
3227 | return parts;
|
3228 | }
|
3229 | exports.getPatternParts = getPatternParts;
|
3230 | function makeRe(pattern, options8) {
|
3231 | return micromatch2.makeRe(pattern, options8);
|
3232 | }
|
3233 | exports.makeRe = makeRe;
|
3234 | function convertPatternsToRe(patterns, options8) {
|
3235 | return patterns.map((pattern) => makeRe(pattern, options8));
|
3236 | }
|
3237 | exports.convertPatternsToRe = convertPatternsToRe;
|
3238 | function matchAny(entry, patternsRe) {
|
3239 | return patternsRe.some((patternRe) => patternRe.test(entry));
|
3240 | }
|
3241 | exports.matchAny = matchAny;
|
3242 | function removeDuplicateSlashes(pattern) {
|
3243 | return pattern.replace(DOUBLE_SLASH_RE, "/");
|
3244 | }
|
3245 | exports.removeDuplicateSlashes = removeDuplicateSlashes;
|
3246 | }
|
3247 | });
|
3248 |
|
3249 |
|
3250 | var require_merge2 = __commonJS({
|
3251 | "node_modules/merge2/index.js"(exports, module) {
|
3252 | "use strict";
|
3253 | var Stream = __require("stream");
|
3254 | var PassThrough = Stream.PassThrough;
|
3255 | var slice = Array.prototype.slice;
|
3256 | module.exports = merge2;
|
3257 | function merge2() {
|
3258 | const streamsQueue = [];
|
3259 | const args = slice.call(arguments);
|
3260 | let merging = false;
|
3261 | let options8 = args[args.length - 1];
|
3262 | if (options8 && !Array.isArray(options8) && options8.pipe == null) {
|
3263 | args.pop();
|
3264 | } else {
|
3265 | options8 = {};
|
3266 | }
|
3267 | const doEnd = options8.end !== false;
|
3268 | const doPipeError = options8.pipeError === true;
|
3269 | if (options8.objectMode == null) {
|
3270 | options8.objectMode = true;
|
3271 | }
|
3272 | if (options8.highWaterMark == null) {
|
3273 | options8.highWaterMark = 64 * 1024;
|
3274 | }
|
3275 | const mergedStream = PassThrough(options8);
|
3276 | function addStream() {
|
3277 | for (let i = 0, len = arguments.length; i < len; i++) {
|
3278 | streamsQueue.push(pauseStreams(arguments[i], options8));
|
3279 | }
|
3280 | mergeStream();
|
3281 | return this;
|
3282 | }
|
3283 | function mergeStream() {
|
3284 | if (merging) {
|
3285 | return;
|
3286 | }
|
3287 | merging = true;
|
3288 | let streams = streamsQueue.shift();
|
3289 | if (!streams) {
|
3290 | process.nextTick(endStream);
|
3291 | return;
|
3292 | }
|
3293 | if (!Array.isArray(streams)) {
|
3294 | streams = [streams];
|
3295 | }
|
3296 | let pipesCount = streams.length + 1;
|
3297 | function next() {
|
3298 | if (--pipesCount > 0) {
|
3299 | return;
|
3300 | }
|
3301 | merging = false;
|
3302 | mergeStream();
|
3303 | }
|
3304 | function pipe(stream) {
|
3305 | function onend() {
|
3306 | stream.removeListener("merge2UnpipeEnd", onend);
|
3307 | stream.removeListener("end", onend);
|
3308 | if (doPipeError) {
|
3309 | stream.removeListener("error", onerror);
|
3310 | }
|
3311 | next();
|
3312 | }
|
3313 | function onerror(err) {
|
3314 | mergedStream.emit("error", err);
|
3315 | }
|
3316 | if (stream._readableState.endEmitted) {
|
3317 | return next();
|
3318 | }
|
3319 | stream.on("merge2UnpipeEnd", onend);
|
3320 | stream.on("end", onend);
|
3321 | if (doPipeError) {
|
3322 | stream.on("error", onerror);
|
3323 | }
|
3324 | stream.pipe(mergedStream, { end: false });
|
3325 | stream.resume();
|
3326 | }
|
3327 | for (let i = 0; i < streams.length; i++) {
|
3328 | pipe(streams[i]);
|
3329 | }
|
3330 | next();
|
3331 | }
|
3332 | function endStream() {
|
3333 | merging = false;
|
3334 | mergedStream.emit("queueDrain");
|
3335 | if (doEnd) {
|
3336 | mergedStream.end();
|
3337 | }
|
3338 | }
|
3339 | mergedStream.setMaxListeners(0);
|
3340 | mergedStream.add = addStream;
|
3341 | mergedStream.on("unpipe", function(stream) {
|
3342 | stream.emit("merge2UnpipeEnd");
|
3343 | });
|
3344 | if (args.length) {
|
3345 | addStream.apply(null, args);
|
3346 | }
|
3347 | return mergedStream;
|
3348 | }
|
3349 | function pauseStreams(streams, options8) {
|
3350 | if (!Array.isArray(streams)) {
|
3351 | if (!streams._readableState && streams.pipe) {
|
3352 | streams = streams.pipe(PassThrough(options8));
|
3353 | }
|
3354 | if (!streams._readableState || !streams.pause || !streams.pipe) {
|
3355 | throw new Error("Only readable stream can be merged.");
|
3356 | }
|
3357 | streams.pause();
|
3358 | } else {
|
3359 | for (let i = 0, len = streams.length; i < len; i++) {
|
3360 | streams[i] = pauseStreams(streams[i], options8);
|
3361 | }
|
3362 | }
|
3363 | return streams;
|
3364 | }
|
3365 | }
|
3366 | });
|
3367 |
|
3368 |
|
3369 | var require_stream = __commonJS({
|
3370 | "node_modules/fast-glob/out/utils/stream.js"(exports) {
|
3371 | "use strict";
|
3372 | Object.defineProperty(exports, "__esModule", { value: true });
|
3373 | exports.merge = void 0;
|
3374 | var merge2 = require_merge2();
|
3375 | function merge3(streams) {
|
3376 | const mergedStream = merge2(streams);
|
3377 | streams.forEach((stream) => {
|
3378 | stream.once("error", (error) => mergedStream.emit("error", error));
|
3379 | });
|
3380 | mergedStream.once("close", () => propagateCloseEventToSources(streams));
|
3381 | mergedStream.once("end", () => propagateCloseEventToSources(streams));
|
3382 | return mergedStream;
|
3383 | }
|
3384 | exports.merge = merge3;
|
3385 | function propagateCloseEventToSources(streams) {
|
3386 | streams.forEach((stream) => stream.emit("close"));
|
3387 | }
|
3388 | }
|
3389 | });
|
3390 |
|
3391 |
|
3392 | var require_string = __commonJS({
|
3393 | "node_modules/fast-glob/out/utils/string.js"(exports) {
|
3394 | "use strict";
|
3395 | Object.defineProperty(exports, "__esModule", { value: true });
|
3396 | exports.isEmpty = exports.isString = void 0;
|
3397 | function isString(input) {
|
3398 | return typeof input === "string";
|
3399 | }
|
3400 | exports.isString = isString;
|
3401 | function isEmpty(input) {
|
3402 | return input === "";
|
3403 | }
|
3404 | exports.isEmpty = isEmpty;
|
3405 | }
|
3406 | });
|
3407 |
|
3408 |
|
3409 | var require_utils3 = __commonJS({
|
3410 | "node_modules/fast-glob/out/utils/index.js"(exports) {
|
3411 | "use strict";
|
3412 | Object.defineProperty(exports, "__esModule", { value: true });
|
3413 | exports.string = exports.stream = exports.pattern = exports.path = exports.fs = exports.errno = exports.array = void 0;
|
3414 | var array2 = require_array();
|
3415 | exports.array = array2;
|
3416 | var errno = require_errno();
|
3417 | exports.errno = errno;
|
3418 | var fs7 = require_fs();
|
3419 | exports.fs = fs7;
|
3420 | var path13 = require_path();
|
3421 | exports.path = path13;
|
3422 | var pattern = require_pattern();
|
3423 | exports.pattern = pattern;
|
3424 | var stream = require_stream();
|
3425 | exports.stream = stream;
|
3426 | var string = require_string();
|
3427 | exports.string = string;
|
3428 | }
|
3429 | });
|
3430 |
|
3431 |
|
3432 | var require_tasks = __commonJS({
|
3433 | "node_modules/fast-glob/out/managers/tasks.js"(exports) {
|
3434 | "use strict";
|
3435 | Object.defineProperty(exports, "__esModule", { value: true });
|
3436 | exports.convertPatternGroupToTask = exports.convertPatternGroupsToTasks = exports.groupPatternsByBaseDirectory = exports.getNegativePatternsAsPositive = exports.getPositivePatterns = exports.convertPatternsToTasks = exports.generate = void 0;
|
3437 | var utils = require_utils3();
|
3438 | function generate(input, settings) {
|
3439 | const patterns = processPatterns(input, settings);
|
3440 | const ignore = processPatterns(settings.ignore, settings);
|
3441 | const positivePatterns = getPositivePatterns(patterns);
|
3442 | const negativePatterns = getNegativePatternsAsPositive(patterns, ignore);
|
3443 | const staticPatterns = positivePatterns.filter((pattern) => utils.pattern.isStaticPattern(pattern, settings));
|
3444 | const dynamicPatterns = positivePatterns.filter((pattern) => utils.pattern.isDynamicPattern(pattern, settings));
|
3445 | const staticTasks = convertPatternsToTasks(
|
3446 | staticPatterns,
|
3447 | negativePatterns,
|
3448 |
|
3449 | false
|
3450 | );
|
3451 | const dynamicTasks = convertPatternsToTasks(
|
3452 | dynamicPatterns,
|
3453 | negativePatterns,
|
3454 |
|
3455 | true
|
3456 | );
|
3457 | return staticTasks.concat(dynamicTasks);
|
3458 | }
|
3459 | exports.generate = generate;
|
3460 | function processPatterns(input, settings) {
|
3461 | let patterns = input;
|
3462 | if (settings.braceExpansion) {
|
3463 | patterns = utils.pattern.expandPatternsWithBraceExpansion(patterns);
|
3464 | }
|
3465 | if (settings.baseNameMatch) {
|
3466 | patterns = patterns.map((pattern) => pattern.includes("/") ? pattern : `**/${pattern}`);
|
3467 | }
|
3468 | return patterns.map((pattern) => utils.pattern.removeDuplicateSlashes(pattern));
|
3469 | }
|
3470 | function convertPatternsToTasks(positive, negative, dynamic) {
|
3471 | const tasks = [];
|
3472 | const patternsOutsideCurrentDirectory = utils.pattern.getPatternsOutsideCurrentDirectory(positive);
|
3473 | const patternsInsideCurrentDirectory = utils.pattern.getPatternsInsideCurrentDirectory(positive);
|
3474 | const outsideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsOutsideCurrentDirectory);
|
3475 | const insideCurrentDirectoryGroup = groupPatternsByBaseDirectory(patternsInsideCurrentDirectory);
|
3476 | tasks.push(...convertPatternGroupsToTasks(outsideCurrentDirectoryGroup, negative, dynamic));
|
3477 | if ("." in insideCurrentDirectoryGroup) {
|
3478 | tasks.push(convertPatternGroupToTask(".", patternsInsideCurrentDirectory, negative, dynamic));
|
3479 | } else {
|
3480 | tasks.push(...convertPatternGroupsToTasks(insideCurrentDirectoryGroup, negative, dynamic));
|
3481 | }
|
3482 | return tasks;
|
3483 | }
|
3484 | exports.convertPatternsToTasks = convertPatternsToTasks;
|
3485 | function getPositivePatterns(patterns) {
|
3486 | return utils.pattern.getPositivePatterns(patterns);
|
3487 | }
|
3488 | exports.getPositivePatterns = getPositivePatterns;
|
3489 | function getNegativePatternsAsPositive(patterns, ignore) {
|
3490 | const negative = utils.pattern.getNegativePatterns(patterns).concat(ignore);
|
3491 | const positive = negative.map(utils.pattern.convertToPositivePattern);
|
3492 | return positive;
|
3493 | }
|
3494 | exports.getNegativePatternsAsPositive = getNegativePatternsAsPositive;
|
3495 | function groupPatternsByBaseDirectory(patterns) {
|
3496 | const group = {};
|
3497 | return patterns.reduce((collection, pattern) => {
|
3498 | const base = utils.pattern.getBaseDirectory(pattern);
|
3499 | if (base in collection) {
|
3500 | collection[base].push(pattern);
|
3501 | } else {
|
3502 | collection[base] = [pattern];
|
3503 | }
|
3504 | return collection;
|
3505 | }, group);
|
3506 | }
|
3507 | exports.groupPatternsByBaseDirectory = groupPatternsByBaseDirectory;
|
3508 | function convertPatternGroupsToTasks(positive, negative, dynamic) {
|
3509 | return Object.keys(positive).map((base) => {
|
3510 | return convertPatternGroupToTask(base, positive[base], negative, dynamic);
|
3511 | });
|
3512 | }
|
3513 | exports.convertPatternGroupsToTasks = convertPatternGroupsToTasks;
|
3514 | function convertPatternGroupToTask(base, positive, negative, dynamic) {
|
3515 | return {
|
3516 | dynamic,
|
3517 | positive,
|
3518 | negative,
|
3519 | base,
|
3520 | patterns: [].concat(positive, negative.map(utils.pattern.convertToNegativePattern))
|
3521 | };
|
3522 | }
|
3523 | exports.convertPatternGroupToTask = convertPatternGroupToTask;
|
3524 | }
|
3525 | });
|
3526 |
|
3527 |
|
3528 | var require_async = __commonJS({
|
3529 | "node_modules/@nodelib/fs.stat/out/providers/async.js"(exports) {
|
3530 | "use strict";
|
3531 | Object.defineProperty(exports, "__esModule", { value: true });
|
3532 | exports.read = void 0;
|
3533 | function read3(path13, settings, callback) {
|
3534 | settings.fs.lstat(path13, (lstatError, lstat) => {
|
3535 | if (lstatError !== null) {
|
3536 | callFailureCallback(callback, lstatError);
|
3537 | return;
|
3538 | }
|
3539 | if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
|
3540 | callSuccessCallback(callback, lstat);
|
3541 | return;
|
3542 | }
|
3543 | settings.fs.stat(path13, (statError, stat) => {
|
3544 | if (statError !== null) {
|
3545 | if (settings.throwErrorOnBrokenSymbolicLink) {
|
3546 | callFailureCallback(callback, statError);
|
3547 | return;
|
3548 | }
|
3549 | callSuccessCallback(callback, lstat);
|
3550 | return;
|
3551 | }
|
3552 | if (settings.markSymbolicLink) {
|
3553 | stat.isSymbolicLink = () => true;
|
3554 | }
|
3555 | callSuccessCallback(callback, stat);
|
3556 | });
|
3557 | });
|
3558 | }
|
3559 | exports.read = read3;
|
3560 | function callFailureCallback(callback, error) {
|
3561 | callback(error);
|
3562 | }
|
3563 | function callSuccessCallback(callback, result) {
|
3564 | callback(null, result);
|
3565 | }
|
3566 | }
|
3567 | });
|
3568 |
|
3569 |
|
3570 | var require_sync = __commonJS({
|
3571 | "node_modules/@nodelib/fs.stat/out/providers/sync.js"(exports) {
|
3572 | "use strict";
|
3573 | Object.defineProperty(exports, "__esModule", { value: true });
|
3574 | exports.read = void 0;
|
3575 | function read3(path13, settings) {
|
3576 | const lstat = settings.fs.lstatSync(path13);
|
3577 | if (!lstat.isSymbolicLink() || !settings.followSymbolicLink) {
|
3578 | return lstat;
|
3579 | }
|
3580 | try {
|
3581 | const stat = settings.fs.statSync(path13);
|
3582 | if (settings.markSymbolicLink) {
|
3583 | stat.isSymbolicLink = () => true;
|
3584 | }
|
3585 | return stat;
|
3586 | } catch (error) {
|
3587 | if (!settings.throwErrorOnBrokenSymbolicLink) {
|
3588 | return lstat;
|
3589 | }
|
3590 | throw error;
|
3591 | }
|
3592 | }
|
3593 | exports.read = read3;
|
3594 | }
|
3595 | });
|
3596 |
|
3597 |
|
3598 | var require_fs2 = __commonJS({
|
3599 | "node_modules/@nodelib/fs.stat/out/adapters/fs.js"(exports) {
|
3600 | "use strict";
|
3601 | Object.defineProperty(exports, "__esModule", { value: true });
|
3602 | exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
3603 | var fs7 = __require("fs");
|
3604 | exports.FILE_SYSTEM_ADAPTER = {
|
3605 | lstat: fs7.lstat,
|
3606 | stat: fs7.stat,
|
3607 | lstatSync: fs7.lstatSync,
|
3608 | statSync: fs7.statSync
|
3609 | };
|
3610 | function createFileSystemAdapter(fsMethods) {
|
3611 | if (fsMethods === void 0) {
|
3612 | return exports.FILE_SYSTEM_ADAPTER;
|
3613 | }
|
3614 | return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
|
3615 | }
|
3616 | exports.createFileSystemAdapter = createFileSystemAdapter;
|
3617 | }
|
3618 | });
|
3619 |
|
3620 |
|
3621 | var require_settings = __commonJS({
|
3622 | "node_modules/@nodelib/fs.stat/out/settings.js"(exports) {
|
3623 | "use strict";
|
3624 | Object.defineProperty(exports, "__esModule", { value: true });
|
3625 | var fs7 = require_fs2();
|
3626 | var Settings = class {
|
3627 | constructor(_options = {}) {
|
3628 | this._options = _options;
|
3629 | this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
|
3630 | this.fs = fs7.createFileSystemAdapter(this._options.fs);
|
3631 | this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
|
3632 | this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
3633 | }
|
3634 | _getValue(option, value) {
|
3635 | return option !== null && option !== void 0 ? option : value;
|
3636 | }
|
3637 | };
|
3638 | exports.default = Settings;
|
3639 | }
|
3640 | });
|
3641 |
|
3642 |
|
3643 | var require_out = __commonJS({
|
3644 | "node_modules/@nodelib/fs.stat/out/index.js"(exports) {
|
3645 | "use strict";
|
3646 | Object.defineProperty(exports, "__esModule", { value: true });
|
3647 | exports.statSync = exports.stat = exports.Settings = void 0;
|
3648 | var async = require_async();
|
3649 | var sync = require_sync();
|
3650 | var settings_1 = require_settings();
|
3651 | exports.Settings = settings_1.default;
|
3652 | function stat(path13, optionsOrSettingsOrCallback, callback) {
|
3653 | if (typeof optionsOrSettingsOrCallback === "function") {
|
3654 | async.read(path13, getSettings(), optionsOrSettingsOrCallback);
|
3655 | return;
|
3656 | }
|
3657 | async.read(path13, getSettings(optionsOrSettingsOrCallback), callback);
|
3658 | }
|
3659 | exports.stat = stat;
|
3660 | function statSync2(path13, optionsOrSettings) {
|
3661 | const settings = getSettings(optionsOrSettings);
|
3662 | return sync.read(path13, settings);
|
3663 | }
|
3664 | exports.statSync = statSync2;
|
3665 | function getSettings(settingsOrOptions = {}) {
|
3666 | if (settingsOrOptions instanceof settings_1.default) {
|
3667 | return settingsOrOptions;
|
3668 | }
|
3669 | return new settings_1.default(settingsOrOptions);
|
3670 | }
|
3671 | }
|
3672 | });
|
3673 |
|
3674 |
|
3675 | var require_queue_microtask = __commonJS({
|
3676 | "node_modules/queue-microtask/index.js"(exports, module) {
|
3677 | var promise;
|
3678 | module.exports = typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : global) : (cb) => (promise || (promise = Promise.resolve())).then(cb).catch((err) => setTimeout(() => {
|
3679 | throw err;
|
3680 | }, 0));
|
3681 | }
|
3682 | });
|
3683 |
|
3684 |
|
3685 | var require_run_parallel = __commonJS({
|
3686 | "node_modules/run-parallel/index.js"(exports, module) {
|
3687 | module.exports = runParallel;
|
3688 | var queueMicrotask2 = require_queue_microtask();
|
3689 | function runParallel(tasks, cb) {
|
3690 | let results, pending, keys;
|
3691 | let isSync = true;
|
3692 | if (Array.isArray(tasks)) {
|
3693 | results = [];
|
3694 | pending = tasks.length;
|
3695 | } else {
|
3696 | keys = Object.keys(tasks);
|
3697 | results = {};
|
3698 | pending = keys.length;
|
3699 | }
|
3700 | function done(err) {
|
3701 | function end() {
|
3702 | if (cb) cb(err, results);
|
3703 | cb = null;
|
3704 | }
|
3705 | if (isSync) queueMicrotask2(end);
|
3706 | else end();
|
3707 | }
|
3708 | function each(i, err, result) {
|
3709 | results[i] = result;
|
3710 | if (--pending === 0 || err) {
|
3711 | done(err);
|
3712 | }
|
3713 | }
|
3714 | if (!pending) {
|
3715 | done(null);
|
3716 | } else if (keys) {
|
3717 | keys.forEach(function(key2) {
|
3718 | tasks[key2](function(err, result) {
|
3719 | each(key2, err, result);
|
3720 | });
|
3721 | });
|
3722 | } else {
|
3723 | tasks.forEach(function(task, i) {
|
3724 | task(function(err, result) {
|
3725 | each(i, err, result);
|
3726 | });
|
3727 | });
|
3728 | }
|
3729 | isSync = false;
|
3730 | }
|
3731 | }
|
3732 | });
|
3733 |
|
3734 |
|
3735 | var require_constants3 = __commonJS({
|
3736 | "node_modules/@nodelib/fs.scandir/out/constants.js"(exports) {
|
3737 | "use strict";
|
3738 | Object.defineProperty(exports, "__esModule", { value: true });
|
3739 | exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = void 0;
|
3740 | var NODE_PROCESS_VERSION_PARTS = process.versions.node.split(".");
|
3741 | if (NODE_PROCESS_VERSION_PARTS[0] === void 0 || NODE_PROCESS_VERSION_PARTS[1] === void 0) {
|
3742 | throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);
|
3743 | }
|
3744 | var MAJOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[0], 10);
|
3745 | var MINOR_VERSION = Number.parseInt(NODE_PROCESS_VERSION_PARTS[1], 10);
|
3746 | var SUPPORTED_MAJOR_VERSION = 10;
|
3747 | var SUPPORTED_MINOR_VERSION = 10;
|
3748 | var IS_MATCHED_BY_MAJOR = MAJOR_VERSION > SUPPORTED_MAJOR_VERSION;
|
3749 | var IS_MATCHED_BY_MAJOR_AND_MINOR = MAJOR_VERSION === SUPPORTED_MAJOR_VERSION && MINOR_VERSION >= SUPPORTED_MINOR_VERSION;
|
3750 | exports.IS_SUPPORT_READDIR_WITH_FILE_TYPES = IS_MATCHED_BY_MAJOR || IS_MATCHED_BY_MAJOR_AND_MINOR;
|
3751 | }
|
3752 | });
|
3753 |
|
3754 |
|
3755 | var require_fs3 = __commonJS({
|
3756 | "node_modules/@nodelib/fs.scandir/out/utils/fs.js"(exports) {
|
3757 | "use strict";
|
3758 | Object.defineProperty(exports, "__esModule", { value: true });
|
3759 | exports.createDirentFromStats = void 0;
|
3760 | var DirentFromStats = class {
|
3761 | constructor(name, stats) {
|
3762 | this.name = name;
|
3763 | this.isBlockDevice = stats.isBlockDevice.bind(stats);
|
3764 | this.isCharacterDevice = stats.isCharacterDevice.bind(stats);
|
3765 | this.isDirectory = stats.isDirectory.bind(stats);
|
3766 | this.isFIFO = stats.isFIFO.bind(stats);
|
3767 | this.isFile = stats.isFile.bind(stats);
|
3768 | this.isSocket = stats.isSocket.bind(stats);
|
3769 | this.isSymbolicLink = stats.isSymbolicLink.bind(stats);
|
3770 | }
|
3771 | };
|
3772 | function createDirentFromStats(name, stats) {
|
3773 | return new DirentFromStats(name, stats);
|
3774 | }
|
3775 | exports.createDirentFromStats = createDirentFromStats;
|
3776 | }
|
3777 | });
|
3778 |
|
3779 |
|
3780 | var require_utils4 = __commonJS({
|
3781 | "node_modules/@nodelib/fs.scandir/out/utils/index.js"(exports) {
|
3782 | "use strict";
|
3783 | Object.defineProperty(exports, "__esModule", { value: true });
|
3784 | exports.fs = void 0;
|
3785 | var fs7 = require_fs3();
|
3786 | exports.fs = fs7;
|
3787 | }
|
3788 | });
|
3789 |
|
3790 |
|
3791 | var require_common = __commonJS({
|
3792 | "node_modules/@nodelib/fs.scandir/out/providers/common.js"(exports) {
|
3793 | "use strict";
|
3794 | Object.defineProperty(exports, "__esModule", { value: true });
|
3795 | exports.joinPathSegments = void 0;
|
3796 | function joinPathSegments(a, b, separator) {
|
3797 | if (a.endsWith(separator)) {
|
3798 | return a + b;
|
3799 | }
|
3800 | return a + separator + b;
|
3801 | }
|
3802 | exports.joinPathSegments = joinPathSegments;
|
3803 | }
|
3804 | });
|
3805 |
|
3806 |
|
3807 | var require_async2 = __commonJS({
|
3808 | "node_modules/@nodelib/fs.scandir/out/providers/async.js"(exports) {
|
3809 | "use strict";
|
3810 | Object.defineProperty(exports, "__esModule", { value: true });
|
3811 | exports.readdir = exports.readdirWithFileTypes = exports.read = void 0;
|
3812 | var fsStat = require_out();
|
3813 | var rpl = require_run_parallel();
|
3814 | var constants_1 = require_constants3();
|
3815 | var utils = require_utils4();
|
3816 | var common2 = require_common();
|
3817 | function read3(directory, settings, callback) {
|
3818 | if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
3819 | readdirWithFileTypes(directory, settings, callback);
|
3820 | return;
|
3821 | }
|
3822 | readdir(directory, settings, callback);
|
3823 | }
|
3824 | exports.read = read3;
|
3825 | function readdirWithFileTypes(directory, settings, callback) {
|
3826 | settings.fs.readdir(directory, { withFileTypes: true }, (readdirError, dirents) => {
|
3827 | if (readdirError !== null) {
|
3828 | callFailureCallback(callback, readdirError);
|
3829 | return;
|
3830 | }
|
3831 | const entries = dirents.map((dirent) => ({
|
3832 | dirent,
|
3833 | name: dirent.name,
|
3834 | path: common2.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
|
3835 | }));
|
3836 | if (!settings.followSymbolicLinks) {
|
3837 | callSuccessCallback(callback, entries);
|
3838 | return;
|
3839 | }
|
3840 | const tasks = entries.map((entry) => makeRplTaskEntry(entry, settings));
|
3841 | rpl(tasks, (rplError, rplEntries) => {
|
3842 | if (rplError !== null) {
|
3843 | callFailureCallback(callback, rplError);
|
3844 | return;
|
3845 | }
|
3846 | callSuccessCallback(callback, rplEntries);
|
3847 | });
|
3848 | });
|
3849 | }
|
3850 | exports.readdirWithFileTypes = readdirWithFileTypes;
|
3851 | function makeRplTaskEntry(entry, settings) {
|
3852 | return (done) => {
|
3853 | if (!entry.dirent.isSymbolicLink()) {
|
3854 | done(null, entry);
|
3855 | return;
|
3856 | }
|
3857 | settings.fs.stat(entry.path, (statError, stats) => {
|
3858 | if (statError !== null) {
|
3859 | if (settings.throwErrorOnBrokenSymbolicLink) {
|
3860 | done(statError);
|
3861 | return;
|
3862 | }
|
3863 | done(null, entry);
|
3864 | return;
|
3865 | }
|
3866 | entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
|
3867 | done(null, entry);
|
3868 | });
|
3869 | };
|
3870 | }
|
3871 | function readdir(directory, settings, callback) {
|
3872 | settings.fs.readdir(directory, (readdirError, names) => {
|
3873 | if (readdirError !== null) {
|
3874 | callFailureCallback(callback, readdirError);
|
3875 | return;
|
3876 | }
|
3877 | const tasks = names.map((name) => {
|
3878 | const path13 = common2.joinPathSegments(directory, name, settings.pathSegmentSeparator);
|
3879 | return (done) => {
|
3880 | fsStat.stat(path13, settings.fsStatSettings, (error, stats) => {
|
3881 | if (error !== null) {
|
3882 | done(error);
|
3883 | return;
|
3884 | }
|
3885 | const entry = {
|
3886 | name,
|
3887 | path: path13,
|
3888 | dirent: utils.fs.createDirentFromStats(name, stats)
|
3889 | };
|
3890 | if (settings.stats) {
|
3891 | entry.stats = stats;
|
3892 | }
|
3893 | done(null, entry);
|
3894 | });
|
3895 | };
|
3896 | });
|
3897 | rpl(tasks, (rplError, entries) => {
|
3898 | if (rplError !== null) {
|
3899 | callFailureCallback(callback, rplError);
|
3900 | return;
|
3901 | }
|
3902 | callSuccessCallback(callback, entries);
|
3903 | });
|
3904 | });
|
3905 | }
|
3906 | exports.readdir = readdir;
|
3907 | function callFailureCallback(callback, error) {
|
3908 | callback(error);
|
3909 | }
|
3910 | function callSuccessCallback(callback, result) {
|
3911 | callback(null, result);
|
3912 | }
|
3913 | }
|
3914 | });
|
3915 |
|
3916 |
|
3917 | var require_sync2 = __commonJS({
|
3918 | "node_modules/@nodelib/fs.scandir/out/providers/sync.js"(exports) {
|
3919 | "use strict";
|
3920 | Object.defineProperty(exports, "__esModule", { value: true });
|
3921 | exports.readdir = exports.readdirWithFileTypes = exports.read = void 0;
|
3922 | var fsStat = require_out();
|
3923 | var constants_1 = require_constants3();
|
3924 | var utils = require_utils4();
|
3925 | var common2 = require_common();
|
3926 | function read3(directory, settings) {
|
3927 | if (!settings.stats && constants_1.IS_SUPPORT_READDIR_WITH_FILE_TYPES) {
|
3928 | return readdirWithFileTypes(directory, settings);
|
3929 | }
|
3930 | return readdir(directory, settings);
|
3931 | }
|
3932 | exports.read = read3;
|
3933 | function readdirWithFileTypes(directory, settings) {
|
3934 | const dirents = settings.fs.readdirSync(directory, { withFileTypes: true });
|
3935 | return dirents.map((dirent) => {
|
3936 | const entry = {
|
3937 | dirent,
|
3938 | name: dirent.name,
|
3939 | path: common2.joinPathSegments(directory, dirent.name, settings.pathSegmentSeparator)
|
3940 | };
|
3941 | if (entry.dirent.isSymbolicLink() && settings.followSymbolicLinks) {
|
3942 | try {
|
3943 | const stats = settings.fs.statSync(entry.path);
|
3944 | entry.dirent = utils.fs.createDirentFromStats(entry.name, stats);
|
3945 | } catch (error) {
|
3946 | if (settings.throwErrorOnBrokenSymbolicLink) {
|
3947 | throw error;
|
3948 | }
|
3949 | }
|
3950 | }
|
3951 | return entry;
|
3952 | });
|
3953 | }
|
3954 | exports.readdirWithFileTypes = readdirWithFileTypes;
|
3955 | function readdir(directory, settings) {
|
3956 | const names = settings.fs.readdirSync(directory);
|
3957 | return names.map((name) => {
|
3958 | const entryPath = common2.joinPathSegments(directory, name, settings.pathSegmentSeparator);
|
3959 | const stats = fsStat.statSync(entryPath, settings.fsStatSettings);
|
3960 | const entry = {
|
3961 | name,
|
3962 | path: entryPath,
|
3963 | dirent: utils.fs.createDirentFromStats(name, stats)
|
3964 | };
|
3965 | if (settings.stats) {
|
3966 | entry.stats = stats;
|
3967 | }
|
3968 | return entry;
|
3969 | });
|
3970 | }
|
3971 | exports.readdir = readdir;
|
3972 | }
|
3973 | });
|
3974 |
|
3975 |
|
3976 | var require_fs4 = __commonJS({
|
3977 | "node_modules/@nodelib/fs.scandir/out/adapters/fs.js"(exports) {
|
3978 | "use strict";
|
3979 | Object.defineProperty(exports, "__esModule", { value: true });
|
3980 | exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
3981 | var fs7 = __require("fs");
|
3982 | exports.FILE_SYSTEM_ADAPTER = {
|
3983 | lstat: fs7.lstat,
|
3984 | stat: fs7.stat,
|
3985 | lstatSync: fs7.lstatSync,
|
3986 | statSync: fs7.statSync,
|
3987 | readdir: fs7.readdir,
|
3988 | readdirSync: fs7.readdirSync
|
3989 | };
|
3990 | function createFileSystemAdapter(fsMethods) {
|
3991 | if (fsMethods === void 0) {
|
3992 | return exports.FILE_SYSTEM_ADAPTER;
|
3993 | }
|
3994 | return Object.assign(Object.assign({}, exports.FILE_SYSTEM_ADAPTER), fsMethods);
|
3995 | }
|
3996 | exports.createFileSystemAdapter = createFileSystemAdapter;
|
3997 | }
|
3998 | });
|
3999 |
|
4000 |
|
4001 | var require_settings2 = __commonJS({
|
4002 | "node_modules/@nodelib/fs.scandir/out/settings.js"(exports) {
|
4003 | "use strict";
|
4004 | Object.defineProperty(exports, "__esModule", { value: true });
|
4005 | var path13 = __require("path");
|
4006 | var fsStat = require_out();
|
4007 | var fs7 = require_fs4();
|
4008 | var Settings = class {
|
4009 | constructor(_options = {}) {
|
4010 | this._options = _options;
|
4011 | this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
4012 | this.fs = fs7.createFileSystemAdapter(this._options.fs);
|
4013 | this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path13.sep);
|
4014 | this.stats = this._getValue(this._options.stats, false);
|
4015 | this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
4016 | this.fsStatSettings = new fsStat.Settings({
|
4017 | followSymbolicLink: this.followSymbolicLinks,
|
4018 | fs: this.fs,
|
4019 | throwErrorOnBrokenSymbolicLink: this.throwErrorOnBrokenSymbolicLink
|
4020 | });
|
4021 | }
|
4022 | _getValue(option, value) {
|
4023 | return option !== null && option !== void 0 ? option : value;
|
4024 | }
|
4025 | };
|
4026 | exports.default = Settings;
|
4027 | }
|
4028 | });
|
4029 |
|
4030 |
|
4031 | var require_out2 = __commonJS({
|
4032 | "node_modules/@nodelib/fs.scandir/out/index.js"(exports) {
|
4033 | "use strict";
|
4034 | Object.defineProperty(exports, "__esModule", { value: true });
|
4035 | exports.Settings = exports.scandirSync = exports.scandir = void 0;
|
4036 | var async = require_async2();
|
4037 | var sync = require_sync2();
|
4038 | var settings_1 = require_settings2();
|
4039 | exports.Settings = settings_1.default;
|
4040 | function scandir(path13, optionsOrSettingsOrCallback, callback) {
|
4041 | if (typeof optionsOrSettingsOrCallback === "function") {
|
4042 | async.read(path13, getSettings(), optionsOrSettingsOrCallback);
|
4043 | return;
|
4044 | }
|
4045 | async.read(path13, getSettings(optionsOrSettingsOrCallback), callback);
|
4046 | }
|
4047 | exports.scandir = scandir;
|
4048 | function scandirSync(path13, optionsOrSettings) {
|
4049 | const settings = getSettings(optionsOrSettings);
|
4050 | return sync.read(path13, settings);
|
4051 | }
|
4052 | exports.scandirSync = scandirSync;
|
4053 | function getSettings(settingsOrOptions = {}) {
|
4054 | if (settingsOrOptions instanceof settings_1.default) {
|
4055 | return settingsOrOptions;
|
4056 | }
|
4057 | return new settings_1.default(settingsOrOptions);
|
4058 | }
|
4059 | }
|
4060 | });
|
4061 |
|
4062 |
|
4063 | var require_reusify = __commonJS({
|
4064 | "node_modules/reusify/reusify.js"(exports, module) {
|
4065 | "use strict";
|
4066 | function reusify(Constructor) {
|
4067 | var head = new Constructor();
|
4068 | var tail = head;
|
4069 | function get() {
|
4070 | var current = head;
|
4071 | if (current.next) {
|
4072 | head = current.next;
|
4073 | } else {
|
4074 | head = new Constructor();
|
4075 | tail = head;
|
4076 | }
|
4077 | current.next = null;
|
4078 | return current;
|
4079 | }
|
4080 | function release(obj) {
|
4081 | tail.next = obj;
|
4082 | tail = obj;
|
4083 | }
|
4084 | return {
|
4085 | get,
|
4086 | release
|
4087 | };
|
4088 | }
|
4089 | module.exports = reusify;
|
4090 | }
|
4091 | });
|
4092 |
|
4093 | // node_modules/fastq/queue.js
|
4094 | var require_queue = __commonJS({
|
4095 | "node_modules/fastq/queue.js"(exports, module) {
|
4096 | "use strict";
|
4097 | var reusify = require_reusify();
|
4098 | function fastqueue(context, worker, _concurrency) {
|
4099 | if (typeof context === "function") {
|
4100 | _concurrency = worker;
|
4101 | worker = context;
|
4102 | context = null;
|
4103 | }
|
4104 | if (!(_concurrency >= 1)) {
|
4105 | throw new Error("fastqueue concurrency must be equal to or greater than 1");
|
4106 | }
|
4107 | var cache3 = reusify(Task);
|
4108 | var queueHead = null;
|
4109 | var queueTail = null;
|
4110 | var _running = 0;
|
4111 | var errorHandler = null;
|
4112 | var self = {
|
4113 | push: push2,
|
4114 | drain: noop2,
|
4115 | saturated: noop2,
|
4116 | pause,
|
4117 | paused: false,
|
4118 | get concurrency() {
|
4119 | return _concurrency;
|
4120 | },
|
4121 | set concurrency(value) {
|
4122 | if (!(value >= 1)) {
|
4123 | throw new Error("fastqueue concurrency must be equal to or greater than 1");
|
4124 | }
|
4125 | _concurrency = value;
|
4126 | if (self.paused) return;
|
4127 | for (; queueHead && _running < _concurrency; ) {
|
4128 | _running++;
|
4129 | release();
|
4130 | }
|
4131 | },
|
4132 | running,
|
4133 | resume,
|
4134 | idle,
|
4135 | length,
|
4136 | getQueue,
|
4137 | unshift,
|
4138 | empty: noop2,
|
4139 | kill,
|
4140 | killAndDrain,
|
4141 | error
|
4142 | };
|
4143 | return self;
|
4144 | function running() {
|
4145 | return _running;
|
4146 | }
|
4147 | function pause() {
|
4148 | self.paused = true;
|
4149 | }
|
4150 | function length() {
|
4151 | var current = queueHead;
|
4152 | var counter = 0;
|
4153 | while (current) {
|
4154 | current = current.next;
|
4155 | counter++;
|
4156 | }
|
4157 | return counter;
|
4158 | }
|
4159 | function getQueue() {
|
4160 | var current = queueHead;
|
4161 | var tasks = [];
|
4162 | while (current) {
|
4163 | tasks.push(current.value);
|
4164 | current = current.next;
|
4165 | }
|
4166 | return tasks;
|
4167 | }
|
4168 | function resume() {
|
4169 | if (!self.paused) return;
|
4170 | self.paused = false;
|
4171 | if (queueHead === null) {
|
4172 | _running++;
|
4173 | release();
|
4174 | return;
|
4175 | }
|
4176 | for (; queueHead && _running < _concurrency; ) {
|
4177 | _running++;
|
4178 | release();
|
4179 | }
|
4180 | }
|
4181 | function idle() {
|
4182 | return _running === 0 && self.length() === 0;
|
4183 | }
|
4184 | function push2(value, done) {
|
4185 | var current = cache3.get();
|
4186 | current.context = context;
|
4187 | current.release = release;
|
4188 | current.value = value;
|
4189 | current.callback = done || noop2;
|
4190 | current.errorHandler = errorHandler;
|
4191 | if (_running >= _concurrency || self.paused) {
|
4192 | if (queueTail) {
|
4193 | queueTail.next = current;
|
4194 | queueTail = current;
|
4195 | } else {
|
4196 | queueHead = current;
|
4197 | queueTail = current;
|
4198 | self.saturated();
|
4199 | }
|
4200 | } else {
|
4201 | _running++;
|
4202 | worker.call(context, current.value, current.worked);
|
4203 | }
|
4204 | }
|
4205 | function unshift(value, done) {
|
4206 | var current = cache3.get();
|
4207 | current.context = context;
|
4208 | current.release = release;
|
4209 | current.value = value;
|
4210 | current.callback = done || noop2;
|
4211 | current.errorHandler = errorHandler;
|
4212 | if (_running >= _concurrency || self.paused) {
|
4213 | if (queueHead) {
|
4214 | current.next = queueHead;
|
4215 | queueHead = current;
|
4216 | } else {
|
4217 | queueHead = current;
|
4218 | queueTail = current;
|
4219 | self.saturated();
|
4220 | }
|
4221 | } else {
|
4222 | _running++;
|
4223 | worker.call(context, current.value, current.worked);
|
4224 | }
|
4225 | }
|
4226 | function release(holder) {
|
4227 | if (holder) {
|
4228 | cache3.release(holder);
|
4229 | }
|
4230 | var next = queueHead;
|
4231 | if (next && _running <= _concurrency) {
|
4232 | if (!self.paused) {
|
4233 | if (queueTail === queueHead) {
|
4234 | queueTail = null;
|
4235 | }
|
4236 | queueHead = next.next;
|
4237 | next.next = null;
|
4238 | worker.call(context, next.value, next.worked);
|
4239 | if (queueTail === null) {
|
4240 | self.empty();
|
4241 | }
|
4242 | } else {
|
4243 | _running--;
|
4244 | }
|
4245 | } else if (--_running === 0) {
|
4246 | self.drain();
|
4247 | }
|
4248 | }
|
4249 | function kill() {
|
4250 | queueHead = null;
|
4251 | queueTail = null;
|
4252 | self.drain = noop2;
|
4253 | }
|
4254 | function killAndDrain() {
|
4255 | queueHead = null;
|
4256 | queueTail = null;
|
4257 | self.drain();
|
4258 | self.drain = noop2;
|
4259 | }
|
4260 | function error(handler) {
|
4261 | errorHandler = handler;
|
4262 | }
|
4263 | }
|
4264 | function noop2() {
|
4265 | }
|
4266 | function Task() {
|
4267 | this.value = null;
|
4268 | this.callback = noop2;
|
4269 | this.next = null;
|
4270 | this.release = noop2;
|
4271 | this.context = null;
|
4272 | this.errorHandler = null;
|
4273 | var self = this;
|
4274 | this.worked = function worked(err, result) {
|
4275 | var callback = self.callback;
|
4276 | var errorHandler = self.errorHandler;
|
4277 | var val = self.value;
|
4278 | self.value = null;
|
4279 | self.callback = noop2;
|
4280 | if (self.errorHandler) {
|
4281 | errorHandler(err, val);
|
4282 | }
|
4283 | callback.call(self.context, err, result);
|
4284 | self.release(self);
|
4285 | };
|
4286 | }
|
4287 | function queueAsPromised(context, worker, _concurrency) {
|
4288 | if (typeof context === "function") {
|
4289 | _concurrency = worker;
|
4290 | worker = context;
|
4291 | context = null;
|
4292 | }
|
4293 | function asyncWrapper(arg, cb) {
|
4294 | worker.call(this, arg).then(function(res) {
|
4295 | cb(null, res);
|
4296 | }, cb);
|
4297 | }
|
4298 | var queue = fastqueue(context, asyncWrapper, _concurrency);
|
4299 | var pushCb = queue.push;
|
4300 | var unshiftCb = queue.unshift;
|
4301 | queue.push = push2;
|
4302 | queue.unshift = unshift;
|
4303 | queue.drained = drained;
|
4304 | return queue;
|
4305 | function push2(value) {
|
4306 | var p = new Promise(function(resolve3, reject) {
|
4307 | pushCb(value, function(err, result) {
|
4308 | if (err) {
|
4309 | reject(err);
|
4310 | return;
|
4311 | }
|
4312 | resolve3(result);
|
4313 | });
|
4314 | });
|
4315 | p.catch(noop2);
|
4316 | return p;
|
4317 | }
|
4318 | function unshift(value) {
|
4319 | var p = new Promise(function(resolve3, reject) {
|
4320 | unshiftCb(value, function(err, result) {
|
4321 | if (err) {
|
4322 | reject(err);
|
4323 | return;
|
4324 | }
|
4325 | resolve3(result);
|
4326 | });
|
4327 | });
|
4328 | p.catch(noop2);
|
4329 | return p;
|
4330 | }
|
4331 | function drained() {
|
4332 | if (queue.idle()) {
|
4333 | return new Promise(function(resolve3) {
|
4334 | resolve3();
|
4335 | });
|
4336 | }
|
4337 | var previousDrain = queue.drain;
|
4338 | var p = new Promise(function(resolve3) {
|
4339 | queue.drain = function() {
|
4340 | previousDrain();
|
4341 | resolve3();
|
4342 | };
|
4343 | });
|
4344 | return p;
|
4345 | }
|
4346 | }
|
4347 | module.exports = fastqueue;
|
4348 | module.exports.promise = queueAsPromised;
|
4349 | }
|
4350 | });
|
4351 |
|
4352 |
|
4353 | var require_common2 = __commonJS({
|
4354 | "node_modules/@nodelib/fs.walk/out/readers/common.js"(exports) {
|
4355 | "use strict";
|
4356 | Object.defineProperty(exports, "__esModule", { value: true });
|
4357 | exports.joinPathSegments = exports.replacePathSegmentSeparator = exports.isAppliedFilter = exports.isFatalError = void 0;
|
4358 | function isFatalError(settings, error) {
|
4359 | if (settings.errorFilter === null) {
|
4360 | return true;
|
4361 | }
|
4362 | return !settings.errorFilter(error);
|
4363 | }
|
4364 | exports.isFatalError = isFatalError;
|
4365 | function isAppliedFilter(filter2, value) {
|
4366 | return filter2 === null || filter2(value);
|
4367 | }
|
4368 | exports.isAppliedFilter = isAppliedFilter;
|
4369 | function replacePathSegmentSeparator(filepath, separator) {
|
4370 | return filepath.split(/[/\\]/).join(separator);
|
4371 | }
|
4372 | exports.replacePathSegmentSeparator = replacePathSegmentSeparator;
|
4373 | function joinPathSegments(a, b, separator) {
|
4374 | if (a === "") {
|
4375 | return b;
|
4376 | }
|
4377 | if (a.endsWith(separator)) {
|
4378 | return a + b;
|
4379 | }
|
4380 | return a + separator + b;
|
4381 | }
|
4382 | exports.joinPathSegments = joinPathSegments;
|
4383 | }
|
4384 | });
|
4385 |
|
4386 |
|
4387 | var require_reader = __commonJS({
|
4388 | "node_modules/@nodelib/fs.walk/out/readers/reader.js"(exports) {
|
4389 | "use strict";
|
4390 | Object.defineProperty(exports, "__esModule", { value: true });
|
4391 | var common2 = require_common2();
|
4392 | var Reader = class {
|
4393 | constructor(_root, _settings) {
|
4394 | this._root = _root;
|
4395 | this._settings = _settings;
|
4396 | this._root = common2.replacePathSegmentSeparator(_root, _settings.pathSegmentSeparator);
|
4397 | }
|
4398 | };
|
4399 | exports.default = Reader;
|
4400 | }
|
4401 | });
|
4402 |
|
4403 |
|
4404 | var require_async3 = __commonJS({
|
4405 | "node_modules/@nodelib/fs.walk/out/readers/async.js"(exports) {
|
4406 | "use strict";
|
4407 | Object.defineProperty(exports, "__esModule", { value: true });
|
4408 | var events_1 = __require("events");
|
4409 | var fsScandir = require_out2();
|
4410 | var fastq = require_queue();
|
4411 | var common2 = require_common2();
|
4412 | var reader_1 = require_reader();
|
4413 | var AsyncReader = class extends reader_1.default {
|
4414 | constructor(_root, _settings) {
|
4415 | super(_root, _settings);
|
4416 | this._settings = _settings;
|
4417 | this._scandir = fsScandir.scandir;
|
4418 | this._emitter = new events_1.EventEmitter();
|
4419 | this._queue = fastq(this._worker.bind(this), this._settings.concurrency);
|
4420 | this._isFatalError = false;
|
4421 | this._isDestroyed = false;
|
4422 | this._queue.drain = () => {
|
4423 | if (!this._isFatalError) {
|
4424 | this._emitter.emit("end");
|
4425 | }
|
4426 | };
|
4427 | }
|
4428 | read() {
|
4429 | this._isFatalError = false;
|
4430 | this._isDestroyed = false;
|
4431 | setImmediate(() => {
|
4432 | this._pushToQueue(this._root, this._settings.basePath);
|
4433 | });
|
4434 | return this._emitter;
|
4435 | }
|
4436 | get isDestroyed() {
|
4437 | return this._isDestroyed;
|
4438 | }
|
4439 | destroy() {
|
4440 | if (this._isDestroyed) {
|
4441 | throw new Error("The reader is already destroyed");
|
4442 | }
|
4443 | this._isDestroyed = true;
|
4444 | this._queue.killAndDrain();
|
4445 | }
|
4446 | onEntry(callback) {
|
4447 | this._emitter.on("entry", callback);
|
4448 | }
|
4449 | onError(callback) {
|
4450 | this._emitter.once("error", callback);
|
4451 | }
|
4452 | onEnd(callback) {
|
4453 | this._emitter.once("end", callback);
|
4454 | }
|
4455 | _pushToQueue(directory, base) {
|
4456 | const queueItem = { directory, base };
|
4457 | this._queue.push(queueItem, (error) => {
|
4458 | if (error !== null) {
|
4459 | this._handleError(error);
|
4460 | }
|
4461 | });
|
4462 | }
|
4463 | _worker(item, done) {
|
4464 | this._scandir(item.directory, this._settings.fsScandirSettings, (error, entries) => {
|
4465 | if (error !== null) {
|
4466 | done(error, void 0);
|
4467 | return;
|
4468 | }
|
4469 | for (const entry of entries) {
|
4470 | this._handleEntry(entry, item.base);
|
4471 | }
|
4472 | done(null, void 0);
|
4473 | });
|
4474 | }
|
4475 | _handleError(error) {
|
4476 | if (this._isDestroyed || !common2.isFatalError(this._settings, error)) {
|
4477 | return;
|
4478 | }
|
4479 | this._isFatalError = true;
|
4480 | this._isDestroyed = true;
|
4481 | this._emitter.emit("error", error);
|
4482 | }
|
4483 | _handleEntry(entry, base) {
|
4484 | if (this._isDestroyed || this._isFatalError) {
|
4485 | return;
|
4486 | }
|
4487 | const fullpath = entry.path;
|
4488 | if (base !== void 0) {
|
4489 | entry.path = common2.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
|
4490 | }
|
4491 | if (common2.isAppliedFilter(this._settings.entryFilter, entry)) {
|
4492 | this._emitEntry(entry);
|
4493 | }
|
4494 | if (entry.dirent.isDirectory() && common2.isAppliedFilter(this._settings.deepFilter, entry)) {
|
4495 | this._pushToQueue(fullpath, base === void 0 ? void 0 : entry.path);
|
4496 | }
|
4497 | }
|
4498 | _emitEntry(entry) {
|
4499 | this._emitter.emit("entry", entry);
|
4500 | }
|
4501 | };
|
4502 | exports.default = AsyncReader;
|
4503 | }
|
4504 | });
|
4505 |
|
4506 |
|
4507 | var require_async4 = __commonJS({
|
4508 | "node_modules/@nodelib/fs.walk/out/providers/async.js"(exports) {
|
4509 | "use strict";
|
4510 | Object.defineProperty(exports, "__esModule", { value: true });
|
4511 | var async_1 = require_async3();
|
4512 | var AsyncProvider = class {
|
4513 | constructor(_root, _settings) {
|
4514 | this._root = _root;
|
4515 | this._settings = _settings;
|
4516 | this._reader = new async_1.default(this._root, this._settings);
|
4517 | this._storage = [];
|
4518 | }
|
4519 | read(callback) {
|
4520 | this._reader.onError((error) => {
|
4521 | callFailureCallback(callback, error);
|
4522 | });
|
4523 | this._reader.onEntry((entry) => {
|
4524 | this._storage.push(entry);
|
4525 | });
|
4526 | this._reader.onEnd(() => {
|
4527 | callSuccessCallback(callback, this._storage);
|
4528 | });
|
4529 | this._reader.read();
|
4530 | }
|
4531 | };
|
4532 | exports.default = AsyncProvider;
|
4533 | function callFailureCallback(callback, error) {
|
4534 | callback(error);
|
4535 | }
|
4536 | function callSuccessCallback(callback, entries) {
|
4537 | callback(null, entries);
|
4538 | }
|
4539 | }
|
4540 | });
|
4541 |
|
4542 |
|
4543 | var require_stream2 = __commonJS({
|
4544 | "node_modules/@nodelib/fs.walk/out/providers/stream.js"(exports) {
|
4545 | "use strict";
|
4546 | Object.defineProperty(exports, "__esModule", { value: true });
|
4547 | var stream_1 = __require("stream");
|
4548 | var async_1 = require_async3();
|
4549 | var StreamProvider = class {
|
4550 | constructor(_root, _settings) {
|
4551 | this._root = _root;
|
4552 | this._settings = _settings;
|
4553 | this._reader = new async_1.default(this._root, this._settings);
|
4554 | this._stream = new stream_1.Readable({
|
4555 | objectMode: true,
|
4556 | read: () => {
|
4557 | },
|
4558 | destroy: () => {
|
4559 | if (!this._reader.isDestroyed) {
|
4560 | this._reader.destroy();
|
4561 | }
|
4562 | }
|
4563 | });
|
4564 | }
|
4565 | read() {
|
4566 | this._reader.onError((error) => {
|
4567 | this._stream.emit("error", error);
|
4568 | });
|
4569 | this._reader.onEntry((entry) => {
|
4570 | this._stream.push(entry);
|
4571 | });
|
4572 | this._reader.onEnd(() => {
|
4573 | this._stream.push(null);
|
4574 | });
|
4575 | this._reader.read();
|
4576 | return this._stream;
|
4577 | }
|
4578 | };
|
4579 | exports.default = StreamProvider;
|
4580 | }
|
4581 | });
|
4582 |
|
4583 |
|
4584 | var require_sync3 = __commonJS({
|
4585 | "node_modules/@nodelib/fs.walk/out/readers/sync.js"(exports) {
|
4586 | "use strict";
|
4587 | Object.defineProperty(exports, "__esModule", { value: true });
|
4588 | var fsScandir = require_out2();
|
4589 | var common2 = require_common2();
|
4590 | var reader_1 = require_reader();
|
4591 | var SyncReader = class extends reader_1.default {
|
4592 | constructor() {
|
4593 | super(...arguments);
|
4594 | this._scandir = fsScandir.scandirSync;
|
4595 | this._storage = [];
|
4596 | this._queue = new Set();
|
4597 | }
|
4598 | read() {
|
4599 | this._pushToQueue(this._root, this._settings.basePath);
|
4600 | this._handleQueue();
|
4601 | return this._storage;
|
4602 | }
|
4603 | _pushToQueue(directory, base) {
|
4604 | this._queue.add({ directory, base });
|
4605 | }
|
4606 | _handleQueue() {
|
4607 | for (const item of this._queue.values()) {
|
4608 | this._handleDirectory(item.directory, item.base);
|
4609 | }
|
4610 | }
|
4611 | _handleDirectory(directory, base) {
|
4612 | try {
|
4613 | const entries = this._scandir(directory, this._settings.fsScandirSettings);
|
4614 | for (const entry of entries) {
|
4615 | this._handleEntry(entry, base);
|
4616 | }
|
4617 | } catch (error) {
|
4618 | this._handleError(error);
|
4619 | }
|
4620 | }
|
4621 | _handleError(error) {
|
4622 | if (!common2.isFatalError(this._settings, error)) {
|
4623 | return;
|
4624 | }
|
4625 | throw error;
|
4626 | }
|
4627 | _handleEntry(entry, base) {
|
4628 | const fullpath = entry.path;
|
4629 | if (base !== void 0) {
|
4630 | entry.path = common2.joinPathSegments(base, entry.name, this._settings.pathSegmentSeparator);
|
4631 | }
|
4632 | if (common2.isAppliedFilter(this._settings.entryFilter, entry)) {
|
4633 | this._pushToStorage(entry);
|
4634 | }
|
4635 | if (entry.dirent.isDirectory() && common2.isAppliedFilter(this._settings.deepFilter, entry)) {
|
4636 | this._pushToQueue(fullpath, base === void 0 ? void 0 : entry.path);
|
4637 | }
|
4638 | }
|
4639 | _pushToStorage(entry) {
|
4640 | this._storage.push(entry);
|
4641 | }
|
4642 | };
|
4643 | exports.default = SyncReader;
|
4644 | }
|
4645 | });
|
4646 |
|
4647 |
|
4648 | var require_sync4 = __commonJS({
|
4649 | "node_modules/@nodelib/fs.walk/out/providers/sync.js"(exports) {
|
4650 | "use strict";
|
4651 | Object.defineProperty(exports, "__esModule", { value: true });
|
4652 | var sync_1 = require_sync3();
|
4653 | var SyncProvider = class {
|
4654 | constructor(_root, _settings) {
|
4655 | this._root = _root;
|
4656 | this._settings = _settings;
|
4657 | this._reader = new sync_1.default(this._root, this._settings);
|
4658 | }
|
4659 | read() {
|
4660 | return this._reader.read();
|
4661 | }
|
4662 | };
|
4663 | exports.default = SyncProvider;
|
4664 | }
|
4665 | });
|
4666 |
|
4667 |
|
4668 | var require_settings3 = __commonJS({
|
4669 | "node_modules/@nodelib/fs.walk/out/settings.js"(exports) {
|
4670 | "use strict";
|
4671 | Object.defineProperty(exports, "__esModule", { value: true });
|
4672 | var path13 = __require("path");
|
4673 | var fsScandir = require_out2();
|
4674 | var Settings = class {
|
4675 | constructor(_options = {}) {
|
4676 | this._options = _options;
|
4677 | this.basePath = this._getValue(this._options.basePath, void 0);
|
4678 | this.concurrency = this._getValue(this._options.concurrency, Number.POSITIVE_INFINITY);
|
4679 | this.deepFilter = this._getValue(this._options.deepFilter, null);
|
4680 | this.entryFilter = this._getValue(this._options.entryFilter, null);
|
4681 | this.errorFilter = this._getValue(this._options.errorFilter, null);
|
4682 | this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path13.sep);
|
4683 | this.fsScandirSettings = new fsScandir.Settings({
|
4684 | followSymbolicLinks: this._options.followSymbolicLinks,
|
4685 | fs: this._options.fs,
|
4686 | pathSegmentSeparator: this._options.pathSegmentSeparator,
|
4687 | stats: this._options.stats,
|
4688 | throwErrorOnBrokenSymbolicLink: this._options.throwErrorOnBrokenSymbolicLink
|
4689 | });
|
4690 | }
|
4691 | _getValue(option, value) {
|
4692 | return option !== null && option !== void 0 ? option : value;
|
4693 | }
|
4694 | };
|
4695 | exports.default = Settings;
|
4696 | }
|
4697 | });
|
4698 |
|
4699 |
|
4700 | var require_out3 = __commonJS({
|
4701 | "node_modules/@nodelib/fs.walk/out/index.js"(exports) {
|
4702 | "use strict";
|
4703 | Object.defineProperty(exports, "__esModule", { value: true });
|
4704 | exports.Settings = exports.walkStream = exports.walkSync = exports.walk = void 0;
|
4705 | var async_1 = require_async4();
|
4706 | var stream_1 = require_stream2();
|
4707 | var sync_1 = require_sync4();
|
4708 | var settings_1 = require_settings3();
|
4709 | exports.Settings = settings_1.default;
|
4710 | function walk(directory, optionsOrSettingsOrCallback, callback) {
|
4711 | if (typeof optionsOrSettingsOrCallback === "function") {
|
4712 | new async_1.default(directory, getSettings()).read(optionsOrSettingsOrCallback);
|
4713 | return;
|
4714 | }
|
4715 | new async_1.default(directory, getSettings(optionsOrSettingsOrCallback)).read(callback);
|
4716 | }
|
4717 | exports.walk = walk;
|
4718 | function walkSync(directory, optionsOrSettings) {
|
4719 | const settings = getSettings(optionsOrSettings);
|
4720 | const provider = new sync_1.default(directory, settings);
|
4721 | return provider.read();
|
4722 | }
|
4723 | exports.walkSync = walkSync;
|
4724 | function walkStream(directory, optionsOrSettings) {
|
4725 | const settings = getSettings(optionsOrSettings);
|
4726 | const provider = new stream_1.default(directory, settings);
|
4727 | return provider.read();
|
4728 | }
|
4729 | exports.walkStream = walkStream;
|
4730 | function getSettings(settingsOrOptions = {}) {
|
4731 | if (settingsOrOptions instanceof settings_1.default) {
|
4732 | return settingsOrOptions;
|
4733 | }
|
4734 | return new settings_1.default(settingsOrOptions);
|
4735 | }
|
4736 | }
|
4737 | });
|
4738 |
|
4739 |
|
4740 | var require_reader2 = __commonJS({
|
4741 | "node_modules/fast-glob/out/readers/reader.js"(exports) {
|
4742 | "use strict";
|
4743 | Object.defineProperty(exports, "__esModule", { value: true });
|
4744 | var path13 = __require("path");
|
4745 | var fsStat = require_out();
|
4746 | var utils = require_utils3();
|
4747 | var Reader = class {
|
4748 | constructor(_settings) {
|
4749 | this._settings = _settings;
|
4750 | this._fsStatSettings = new fsStat.Settings({
|
4751 | followSymbolicLink: this._settings.followSymbolicLinks,
|
4752 | fs: this._settings.fs,
|
4753 | throwErrorOnBrokenSymbolicLink: this._settings.followSymbolicLinks
|
4754 | });
|
4755 | }
|
4756 | _getFullEntryPath(filepath) {
|
4757 | return path13.resolve(this._settings.cwd, filepath);
|
4758 | }
|
4759 | _makeEntry(stats, pattern) {
|
4760 | const entry = {
|
4761 | name: pattern,
|
4762 | path: pattern,
|
4763 | dirent: utils.fs.createDirentFromStats(pattern, stats)
|
4764 | };
|
4765 | if (this._settings.stats) {
|
4766 | entry.stats = stats;
|
4767 | }
|
4768 | return entry;
|
4769 | }
|
4770 | _isFatalError(error) {
|
4771 | return !utils.errno.isEnoentCodeError(error) && !this._settings.suppressErrors;
|
4772 | }
|
4773 | };
|
4774 | exports.default = Reader;
|
4775 | }
|
4776 | });
|
4777 |
|
4778 |
|
4779 | var require_stream3 = __commonJS({
|
4780 | "node_modules/fast-glob/out/readers/stream.js"(exports) {
|
4781 | "use strict";
|
4782 | Object.defineProperty(exports, "__esModule", { value: true });
|
4783 | var stream_1 = __require("stream");
|
4784 | var fsStat = require_out();
|
4785 | var fsWalk = require_out3();
|
4786 | var reader_1 = require_reader2();
|
4787 | var ReaderStream = class extends reader_1.default {
|
4788 | constructor() {
|
4789 | super(...arguments);
|
4790 | this._walkStream = fsWalk.walkStream;
|
4791 | this._stat = fsStat.stat;
|
4792 | }
|
4793 | dynamic(root2, options8) {
|
4794 | return this._walkStream(root2, options8);
|
4795 | }
|
4796 | static(patterns, options8) {
|
4797 | const filepaths = patterns.map(this._getFullEntryPath, this);
|
4798 | const stream = new stream_1.PassThrough({ objectMode: true });
|
4799 | stream._write = (index, _enc, done) => {
|
4800 | return this._getEntry(filepaths[index], patterns[index], options8).then((entry) => {
|
4801 | if (entry !== null && options8.entryFilter(entry)) {
|
4802 | stream.push(entry);
|
4803 | }
|
4804 | if (index === filepaths.length - 1) {
|
4805 | stream.end();
|
4806 | }
|
4807 | done();
|
4808 | }).catch(done);
|
4809 | };
|
4810 | for (let i = 0; i < filepaths.length; i++) {
|
4811 | stream.write(i);
|
4812 | }
|
4813 | return stream;
|
4814 | }
|
4815 | _getEntry(filepath, pattern, options8) {
|
4816 | return this._getStat(filepath).then((stats) => this._makeEntry(stats, pattern)).catch((error) => {
|
4817 | if (options8.errorFilter(error)) {
|
4818 | return null;
|
4819 | }
|
4820 | throw error;
|
4821 | });
|
4822 | }
|
4823 | _getStat(filepath) {
|
4824 | return new Promise((resolve3, reject) => {
|
4825 | this._stat(filepath, this._fsStatSettings, (error, stats) => {
|
4826 | return error === null ? resolve3(stats) : reject(error);
|
4827 | });
|
4828 | });
|
4829 | }
|
4830 | };
|
4831 | exports.default = ReaderStream;
|
4832 | }
|
4833 | });
|
4834 |
|
4835 |
|
4836 | var require_async5 = __commonJS({
|
4837 | "node_modules/fast-glob/out/readers/async.js"(exports) {
|
4838 | "use strict";
|
4839 | Object.defineProperty(exports, "__esModule", { value: true });
|
4840 | var fsWalk = require_out3();
|
4841 | var reader_1 = require_reader2();
|
4842 | var stream_1 = require_stream3();
|
4843 | var ReaderAsync = class extends reader_1.default {
|
4844 | constructor() {
|
4845 | super(...arguments);
|
4846 | this._walkAsync = fsWalk.walk;
|
4847 | this._readerStream = new stream_1.default(this._settings);
|
4848 | }
|
4849 | dynamic(root2, options8) {
|
4850 | return new Promise((resolve3, reject) => {
|
4851 | this._walkAsync(root2, options8, (error, entries) => {
|
4852 | if (error === null) {
|
4853 | resolve3(entries);
|
4854 | } else {
|
4855 | reject(error);
|
4856 | }
|
4857 | });
|
4858 | });
|
4859 | }
|
4860 | async static(patterns, options8) {
|
4861 | const entries = [];
|
4862 | const stream = this._readerStream.static(patterns, options8);
|
4863 | return new Promise((resolve3, reject) => {
|
4864 | stream.once("error", reject);
|
4865 | stream.on("data", (entry) => entries.push(entry));
|
4866 | stream.once("end", () => resolve3(entries));
|
4867 | });
|
4868 | }
|
4869 | };
|
4870 | exports.default = ReaderAsync;
|
4871 | }
|
4872 | });
|
4873 |
|
4874 |
|
4875 | var require_matcher = __commonJS({
|
4876 | "node_modules/fast-glob/out/providers/matchers/matcher.js"(exports) {
|
4877 | "use strict";
|
4878 | Object.defineProperty(exports, "__esModule", { value: true });
|
4879 | var utils = require_utils3();
|
4880 | var Matcher = class {
|
4881 | constructor(_patterns, _settings, _micromatchOptions) {
|
4882 | this._patterns = _patterns;
|
4883 | this._settings = _settings;
|
4884 | this._micromatchOptions = _micromatchOptions;
|
4885 | this._storage = [];
|
4886 | this._fillStorage();
|
4887 | }
|
4888 | _fillStorage() {
|
4889 | for (const pattern of this._patterns) {
|
4890 | const segments = this._getPatternSegments(pattern);
|
4891 | const sections = this._splitSegmentsIntoSections(segments);
|
4892 | this._storage.push({
|
4893 | complete: sections.length <= 1,
|
4894 | pattern,
|
4895 | segments,
|
4896 | sections
|
4897 | });
|
4898 | }
|
4899 | }
|
4900 | _getPatternSegments(pattern) {
|
4901 | const parts = utils.pattern.getPatternParts(pattern, this._micromatchOptions);
|
4902 | return parts.map((part) => {
|
4903 | const dynamic = utils.pattern.isDynamicPattern(part, this._settings);
|
4904 | if (!dynamic) {
|
4905 | return {
|
4906 | dynamic: false,
|
4907 | pattern: part
|
4908 | };
|
4909 | }
|
4910 | return {
|
4911 | dynamic: true,
|
4912 | pattern: part,
|
4913 | patternRe: utils.pattern.makeRe(part, this._micromatchOptions)
|
4914 | };
|
4915 | });
|
4916 | }
|
4917 | _splitSegmentsIntoSections(segments) {
|
4918 | return utils.array.splitWhen(segments, (segment) => segment.dynamic && utils.pattern.hasGlobStar(segment.pattern));
|
4919 | }
|
4920 | };
|
4921 | exports.default = Matcher;
|
4922 | }
|
4923 | });
|
4924 |
|
4925 |
|
4926 | var require_partial = __commonJS({
|
4927 | "node_modules/fast-glob/out/providers/matchers/partial.js"(exports) {
|
4928 | "use strict";
|
4929 | Object.defineProperty(exports, "__esModule", { value: true });
|
4930 | var matcher_1 = require_matcher();
|
4931 | var PartialMatcher = class extends matcher_1.default {
|
4932 | match(filepath) {
|
4933 | const parts = filepath.split("/");
|
4934 | const levels = parts.length;
|
4935 | const patterns = this._storage.filter((info) => !info.complete || info.segments.length > levels);
|
4936 | for (const pattern of patterns) {
|
4937 | const section = pattern.sections[0];
|
4938 | if (!pattern.complete && levels > section.length) {
|
4939 | return true;
|
4940 | }
|
4941 | const match = parts.every((part, index) => {
|
4942 | const segment = pattern.segments[index];
|
4943 | if (segment.dynamic && segment.patternRe.test(part)) {
|
4944 | return true;
|
4945 | }
|
4946 | if (!segment.dynamic && segment.pattern === part) {
|
4947 | return true;
|
4948 | }
|
4949 | return false;
|
4950 | });
|
4951 | if (match) {
|
4952 | return true;
|
4953 | }
|
4954 | }
|
4955 | return false;
|
4956 | }
|
4957 | };
|
4958 | exports.default = PartialMatcher;
|
4959 | }
|
4960 | });
|
4961 |
|
4962 |
|
4963 | var require_deep = __commonJS({
|
4964 | "node_modules/fast-glob/out/providers/filters/deep.js"(exports) {
|
4965 | "use strict";
|
4966 | Object.defineProperty(exports, "__esModule", { value: true });
|
4967 | var utils = require_utils3();
|
4968 | var partial_1 = require_partial();
|
4969 | var DeepFilter = class {
|
4970 | constructor(_settings, _micromatchOptions) {
|
4971 | this._settings = _settings;
|
4972 | this._micromatchOptions = _micromatchOptions;
|
4973 | }
|
4974 | getFilter(basePath, positive, negative) {
|
4975 | const matcher = this._getMatcher(positive);
|
4976 | const negativeRe = this._getNegativePatternsRe(negative);
|
4977 | return (entry) => this._filter(basePath, entry, matcher, negativeRe);
|
4978 | }
|
4979 | _getMatcher(patterns) {
|
4980 | return new partial_1.default(patterns, this._settings, this._micromatchOptions);
|
4981 | }
|
4982 | _getNegativePatternsRe(patterns) {
|
4983 | const affectDepthOfReadingPatterns = patterns.filter(utils.pattern.isAffectDepthOfReadingPattern);
|
4984 | return utils.pattern.convertPatternsToRe(affectDepthOfReadingPatterns, this._micromatchOptions);
|
4985 | }
|
4986 | _filter(basePath, entry, matcher, negativeRe) {
|
4987 | if (this._isSkippedByDeep(basePath, entry.path)) {
|
4988 | return false;
|
4989 | }
|
4990 | if (this._isSkippedSymbolicLink(entry)) {
|
4991 | return false;
|
4992 | }
|
4993 | const filepath = utils.path.removeLeadingDotSegment(entry.path);
|
4994 | if (this._isSkippedByPositivePatterns(filepath, matcher)) {
|
4995 | return false;
|
4996 | }
|
4997 | return this._isSkippedByNegativePatterns(filepath, negativeRe);
|
4998 | }
|
4999 | _isSkippedByDeep(basePath, entryPath) {
|
5000 | if (this._settings.deep === Infinity) {
|
5001 | return false;
|
5002 | }
|
5003 | return this._getEntryLevel(basePath, entryPath) >= this._settings.deep;
|
5004 | }
|
5005 | _getEntryLevel(basePath, entryPath) {
|
5006 | const entryPathDepth = entryPath.split("/").length;
|
5007 | if (basePath === "") {
|
5008 | return entryPathDepth;
|
5009 | }
|
5010 | const basePathDepth = basePath.split("/").length;
|
5011 | return entryPathDepth - basePathDepth;
|
5012 | }
|
5013 | _isSkippedSymbolicLink(entry) {
|
5014 | return !this._settings.followSymbolicLinks && entry.dirent.isSymbolicLink();
|
5015 | }
|
5016 | _isSkippedByPositivePatterns(entryPath, matcher) {
|
5017 | return !this._settings.baseNameMatch && !matcher.match(entryPath);
|
5018 | }
|
5019 | _isSkippedByNegativePatterns(entryPath, patternsRe) {
|
5020 | return !utils.pattern.matchAny(entryPath, patternsRe);
|
5021 | }
|
5022 | };
|
5023 | exports.default = DeepFilter;
|
5024 | }
|
5025 | });
|
5026 |
|
5027 |
|
5028 | var require_entry = __commonJS({
|
5029 | "node_modules/fast-glob/out/providers/filters/entry.js"(exports) {
|
5030 | "use strict";
|
5031 | Object.defineProperty(exports, "__esModule", { value: true });
|
5032 | var utils = require_utils3();
|
5033 | var EntryFilter = class {
|
5034 | constructor(_settings, _micromatchOptions) {
|
5035 | this._settings = _settings;
|
5036 | this._micromatchOptions = _micromatchOptions;
|
5037 | this.index = new Map();
|
5038 | }
|
5039 | getFilter(positive, negative) {
|
5040 | const positiveRe = utils.pattern.convertPatternsToRe(positive, this._micromatchOptions);
|
5041 | const negativeRe = utils.pattern.convertPatternsToRe(negative, Object.assign(Object.assign({}, this._micromatchOptions), { dot: true }));
|
5042 | return (entry) => this._filter(entry, positiveRe, negativeRe);
|
5043 | }
|
5044 | _filter(entry, positiveRe, negativeRe) {
|
5045 | const filepath = utils.path.removeLeadingDotSegment(entry.path);
|
5046 | if (this._settings.unique && this._isDuplicateEntry(filepath)) {
|
5047 | return false;
|
5048 | }
|
5049 | if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) {
|
5050 | return false;
|
5051 | }
|
5052 | if (this._isSkippedByAbsoluteNegativePatterns(filepath, negativeRe)) {
|
5053 | return false;
|
5054 | }
|
5055 | const isDirectory2 = entry.dirent.isDirectory();
|
5056 | const isMatched = this._isMatchToPatterns(filepath, positiveRe, isDirectory2) && !this._isMatchToPatterns(filepath, negativeRe, isDirectory2);
|
5057 | if (this._settings.unique && isMatched) {
|
5058 | this._createIndexRecord(filepath);
|
5059 | }
|
5060 | return isMatched;
|
5061 | }
|
5062 | _isDuplicateEntry(filepath) {
|
5063 | return this.index.has(filepath);
|
5064 | }
|
5065 | _createIndexRecord(filepath) {
|
5066 | this.index.set(filepath, void 0);
|
5067 | }
|
5068 | _onlyFileFilter(entry) {
|
5069 | return this._settings.onlyFiles && !entry.dirent.isFile();
|
5070 | }
|
5071 | _onlyDirectoryFilter(entry) {
|
5072 | return this._settings.onlyDirectories && !entry.dirent.isDirectory();
|
5073 | }
|
5074 | _isSkippedByAbsoluteNegativePatterns(entryPath, patternsRe) {
|
5075 | if (!this._settings.absolute) {
|
5076 | return false;
|
5077 | }
|
5078 | const fullpath = utils.path.makeAbsolute(this._settings.cwd, entryPath);
|
5079 | return utils.pattern.matchAny(fullpath, patternsRe);
|
5080 | }
|
5081 | _isMatchToPatterns(filepath, patternsRe, isDirectory2) {
|
5082 | const isMatched = utils.pattern.matchAny(filepath, patternsRe);
|
5083 | if (!isMatched && isDirectory2) {
|
5084 | return utils.pattern.matchAny(filepath + "/", patternsRe);
|
5085 | }
|
5086 | return isMatched;
|
5087 | }
|
5088 | };
|
5089 | exports.default = EntryFilter;
|
5090 | }
|
5091 | });
|
5092 |
|
5093 |
|
5094 | var require_error = __commonJS({
|
5095 | "node_modules/fast-glob/out/providers/filters/error.js"(exports) {
|
5096 | "use strict";
|
5097 | Object.defineProperty(exports, "__esModule", { value: true });
|
5098 | var utils = require_utils3();
|
5099 | var ErrorFilter = class {
|
5100 | constructor(_settings) {
|
5101 | this._settings = _settings;
|
5102 | }
|
5103 | getFilter() {
|
5104 | return (error) => this._isNonFatalError(error);
|
5105 | }
|
5106 | _isNonFatalError(error) {
|
5107 | return utils.errno.isEnoentCodeError(error) || this._settings.suppressErrors;
|
5108 | }
|
5109 | };
|
5110 | exports.default = ErrorFilter;
|
5111 | }
|
5112 | });
|
5113 |
|
5114 |
|
5115 | var require_entry2 = __commonJS({
|
5116 | "node_modules/fast-glob/out/providers/transformers/entry.js"(exports) {
|
5117 | "use strict";
|
5118 | Object.defineProperty(exports, "__esModule", { value: true });
|
5119 | var utils = require_utils3();
|
5120 | var EntryTransformer = class {
|
5121 | constructor(_settings) {
|
5122 | this._settings = _settings;
|
5123 | }
|
5124 | getTransformer() {
|
5125 | return (entry) => this._transform(entry);
|
5126 | }
|
5127 | _transform(entry) {
|
5128 | let filepath = entry.path;
|
5129 | if (this._settings.absolute) {
|
5130 | filepath = utils.path.makeAbsolute(this._settings.cwd, filepath);
|
5131 | filepath = utils.path.unixify(filepath);
|
5132 | }
|
5133 | if (this._settings.markDirectories && entry.dirent.isDirectory()) {
|
5134 | filepath += "/";
|
5135 | }
|
5136 | if (!this._settings.objectMode) {
|
5137 | return filepath;
|
5138 | }
|
5139 | return Object.assign(Object.assign({}, entry), { path: filepath });
|
5140 | }
|
5141 | };
|
5142 | exports.default = EntryTransformer;
|
5143 | }
|
5144 | });
|
5145 |
|
5146 |
|
5147 | var require_provider = __commonJS({
|
5148 | "node_modules/fast-glob/out/providers/provider.js"(exports) {
|
5149 | "use strict";
|
5150 | Object.defineProperty(exports, "__esModule", { value: true });
|
5151 | var path13 = __require("path");
|
5152 | var deep_1 = require_deep();
|
5153 | var entry_1 = require_entry();
|
5154 | var error_1 = require_error();
|
5155 | var entry_2 = require_entry2();
|
5156 | var Provider = class {
|
5157 | constructor(_settings) {
|
5158 | this._settings = _settings;
|
5159 | this.errorFilter = new error_1.default(this._settings);
|
5160 | this.entryFilter = new entry_1.default(this._settings, this._getMicromatchOptions());
|
5161 | this.deepFilter = new deep_1.default(this._settings, this._getMicromatchOptions());
|
5162 | this.entryTransformer = new entry_2.default(this._settings);
|
5163 | }
|
5164 | _getRootDirectory(task) {
|
5165 | return path13.resolve(this._settings.cwd, task.base);
|
5166 | }
|
5167 | _getReaderOptions(task) {
|
5168 | const basePath = task.base === "." ? "" : task.base;
|
5169 | return {
|
5170 | basePath,
|
5171 | pathSegmentSeparator: "/",
|
5172 | concurrency: this._settings.concurrency,
|
5173 | deepFilter: this.deepFilter.getFilter(basePath, task.positive, task.negative),
|
5174 | entryFilter: this.entryFilter.getFilter(task.positive, task.negative),
|
5175 | errorFilter: this.errorFilter.getFilter(),
|
5176 | followSymbolicLinks: this._settings.followSymbolicLinks,
|
5177 | fs: this._settings.fs,
|
5178 | stats: this._settings.stats,
|
5179 | throwErrorOnBrokenSymbolicLink: this._settings.throwErrorOnBrokenSymbolicLink,
|
5180 | transform: this.entryTransformer.getTransformer()
|
5181 | };
|
5182 | }
|
5183 | _getMicromatchOptions() {
|
5184 | return {
|
5185 | dot: this._settings.dot,
|
5186 | matchBase: this._settings.baseNameMatch,
|
5187 | nobrace: !this._settings.braceExpansion,
|
5188 | nocase: !this._settings.caseSensitiveMatch,
|
5189 | noext: !this._settings.extglob,
|
5190 | noglobstar: !this._settings.globstar,
|
5191 | posix: true,
|
5192 | strictSlashes: false
|
5193 | };
|
5194 | }
|
5195 | };
|
5196 | exports.default = Provider;
|
5197 | }
|
5198 | });
|
5199 |
|
5200 |
|
5201 | var require_async6 = __commonJS({
|
5202 | "node_modules/fast-glob/out/providers/async.js"(exports) {
|
5203 | "use strict";
|
5204 | Object.defineProperty(exports, "__esModule", { value: true });
|
5205 | var async_1 = require_async5();
|
5206 | var provider_1 = require_provider();
|
5207 | var ProviderAsync = class extends provider_1.default {
|
5208 | constructor() {
|
5209 | super(...arguments);
|
5210 | this._reader = new async_1.default(this._settings);
|
5211 | }
|
5212 | async read(task) {
|
5213 | const root2 = this._getRootDirectory(task);
|
5214 | const options8 = this._getReaderOptions(task);
|
5215 | const entries = await this.api(root2, task, options8);
|
5216 | return entries.map((entry) => options8.transform(entry));
|
5217 | }
|
5218 | api(root2, task, options8) {
|
5219 | if (task.dynamic) {
|
5220 | return this._reader.dynamic(root2, options8);
|
5221 | }
|
5222 | return this._reader.static(task.patterns, options8);
|
5223 | }
|
5224 | };
|
5225 | exports.default = ProviderAsync;
|
5226 | }
|
5227 | });
|
5228 |
|
5229 |
|
5230 | var require_stream4 = __commonJS({
|
5231 | "node_modules/fast-glob/out/providers/stream.js"(exports) {
|
5232 | "use strict";
|
5233 | Object.defineProperty(exports, "__esModule", { value: true });
|
5234 | var stream_1 = __require("stream");
|
5235 | var stream_2 = require_stream3();
|
5236 | var provider_1 = require_provider();
|
5237 | var ProviderStream = class extends provider_1.default {
|
5238 | constructor() {
|
5239 | super(...arguments);
|
5240 | this._reader = new stream_2.default(this._settings);
|
5241 | }
|
5242 | read(task) {
|
5243 | const root2 = this._getRootDirectory(task);
|
5244 | const options8 = this._getReaderOptions(task);
|
5245 | const source2 = this.api(root2, task, options8);
|
5246 | const destination = new stream_1.Readable({ objectMode: true, read: () => {
|
5247 | } });
|
5248 | source2.once("error", (error) => destination.emit("error", error)).on("data", (entry) => destination.emit("data", options8.transform(entry))).once("end", () => destination.emit("end"));
|
5249 | destination.once("close", () => source2.destroy());
|
5250 | return destination;
|
5251 | }
|
5252 | api(root2, task, options8) {
|
5253 | if (task.dynamic) {
|
5254 | return this._reader.dynamic(root2, options8);
|
5255 | }
|
5256 | return this._reader.static(task.patterns, options8);
|
5257 | }
|
5258 | };
|
5259 | exports.default = ProviderStream;
|
5260 | }
|
5261 | });
|
5262 |
|
5263 |
|
5264 | var require_sync5 = __commonJS({
|
5265 | "node_modules/fast-glob/out/readers/sync.js"(exports) {
|
5266 | "use strict";
|
5267 | Object.defineProperty(exports, "__esModule", { value: true });
|
5268 | var fsStat = require_out();
|
5269 | var fsWalk = require_out3();
|
5270 | var reader_1 = require_reader2();
|
5271 | var ReaderSync = class extends reader_1.default {
|
5272 | constructor() {
|
5273 | super(...arguments);
|
5274 | this._walkSync = fsWalk.walkSync;
|
5275 | this._statSync = fsStat.statSync;
|
5276 | }
|
5277 | dynamic(root2, options8) {
|
5278 | return this._walkSync(root2, options8);
|
5279 | }
|
5280 | static(patterns, options8) {
|
5281 | const entries = [];
|
5282 | for (const pattern of patterns) {
|
5283 | const filepath = this._getFullEntryPath(pattern);
|
5284 | const entry = this._getEntry(filepath, pattern, options8);
|
5285 | if (entry === null || !options8.entryFilter(entry)) {
|
5286 | continue;
|
5287 | }
|
5288 | entries.push(entry);
|
5289 | }
|
5290 | return entries;
|
5291 | }
|
5292 | _getEntry(filepath, pattern, options8) {
|
5293 | try {
|
5294 | const stats = this._getStat(filepath);
|
5295 | return this._makeEntry(stats, pattern);
|
5296 | } catch (error) {
|
5297 | if (options8.errorFilter(error)) {
|
5298 | return null;
|
5299 | }
|
5300 | throw error;
|
5301 | }
|
5302 | }
|
5303 | _getStat(filepath) {
|
5304 | return this._statSync(filepath, this._fsStatSettings);
|
5305 | }
|
5306 | };
|
5307 | exports.default = ReaderSync;
|
5308 | }
|
5309 | });
|
5310 |
|
5311 |
|
5312 | var require_sync6 = __commonJS({
|
5313 | "node_modules/fast-glob/out/providers/sync.js"(exports) {
|
5314 | "use strict";
|
5315 | Object.defineProperty(exports, "__esModule", { value: true });
|
5316 | var sync_1 = require_sync5();
|
5317 | var provider_1 = require_provider();
|
5318 | var ProviderSync = class extends provider_1.default {
|
5319 | constructor() {
|
5320 | super(...arguments);
|
5321 | this._reader = new sync_1.default(this._settings);
|
5322 | }
|
5323 | read(task) {
|
5324 | const root2 = this._getRootDirectory(task);
|
5325 | const options8 = this._getReaderOptions(task);
|
5326 | const entries = this.api(root2, task, options8);
|
5327 | return entries.map(options8.transform);
|
5328 | }
|
5329 | api(root2, task, options8) {
|
5330 | if (task.dynamic) {
|
5331 | return this._reader.dynamic(root2, options8);
|
5332 | }
|
5333 | return this._reader.static(task.patterns, options8);
|
5334 | }
|
5335 | };
|
5336 | exports.default = ProviderSync;
|
5337 | }
|
5338 | });
|
5339 |
|
5340 |
|
5341 | var require_settings4 = __commonJS({
|
5342 | "node_modules/fast-glob/out/settings.js"(exports) {
|
5343 | "use strict";
|
5344 | Object.defineProperty(exports, "__esModule", { value: true });
|
5345 | exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
|
5346 | var fs7 = __require("fs");
|
5347 | var os2 = __require("os");
|
5348 | var CPU_COUNT = Math.max(os2.cpus().length, 1);
|
5349 | exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
|
5350 | lstat: fs7.lstat,
|
5351 | lstatSync: fs7.lstatSync,
|
5352 | stat: fs7.stat,
|
5353 | statSync: fs7.statSync,
|
5354 | readdir: fs7.readdir,
|
5355 | readdirSync: fs7.readdirSync
|
5356 | };
|
5357 | var Settings = class {
|
5358 | constructor(_options = {}) {
|
5359 | this._options = _options;
|
5360 | this.absolute = this._getValue(this._options.absolute, false);
|
5361 | this.baseNameMatch = this._getValue(this._options.baseNameMatch, false);
|
5362 | this.braceExpansion = this._getValue(this._options.braceExpansion, true);
|
5363 | this.caseSensitiveMatch = this._getValue(this._options.caseSensitiveMatch, true);
|
5364 | this.concurrency = this._getValue(this._options.concurrency, CPU_COUNT);
|
5365 | this.cwd = this._getValue(this._options.cwd, process.cwd());
|
5366 | this.deep = this._getValue(this._options.deep, Infinity);
|
5367 | this.dot = this._getValue(this._options.dot, false);
|
5368 | this.extglob = this._getValue(this._options.extglob, true);
|
5369 | this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, true);
|
5370 | this.fs = this._getFileSystemMethods(this._options.fs);
|
5371 | this.globstar = this._getValue(this._options.globstar, true);
|
5372 | this.ignore = this._getValue(this._options.ignore, []);
|
5373 | this.markDirectories = this._getValue(this._options.markDirectories, false);
|
5374 | this.objectMode = this._getValue(this._options.objectMode, false);
|
5375 | this.onlyDirectories = this._getValue(this._options.onlyDirectories, false);
|
5376 | this.onlyFiles = this._getValue(this._options.onlyFiles, true);
|
5377 | this.stats = this._getValue(this._options.stats, false);
|
5378 | this.suppressErrors = this._getValue(this._options.suppressErrors, false);
|
5379 | this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, false);
|
5380 | this.unique = this._getValue(this._options.unique, true);
|
5381 | if (this.onlyDirectories) {
|
5382 | this.onlyFiles = false;
|
5383 | }
|
5384 | if (this.stats) {
|
5385 | this.objectMode = true;
|
5386 | }
|
5387 | this.ignore = [].concat(this.ignore);
|
5388 | }
|
5389 | _getValue(option, value) {
|
5390 | return option === void 0 ? value : option;
|
5391 | }
|
5392 | _getFileSystemMethods(methods = {}) {
|
5393 | return Object.assign(Object.assign({}, exports.DEFAULT_FILE_SYSTEM_ADAPTER), methods);
|
5394 | }
|
5395 | };
|
5396 | exports.default = Settings;
|
5397 | }
|
5398 | });
|
5399 |
|
5400 |
|
5401 | var require_out4 = __commonJS({
|
5402 | "node_modules/fast-glob/out/index.js"(exports, module) {
|
5403 | "use strict";
|
5404 | var taskManager = require_tasks();
|
5405 | var async_1 = require_async6();
|
5406 | var stream_1 = require_stream4();
|
5407 | var sync_1 = require_sync6();
|
5408 | var settings_1 = require_settings4();
|
5409 | var utils = require_utils3();
|
5410 | async function FastGlob(source2, options8) {
|
5411 | assertPatternsInput(source2);
|
5412 | const works = getWorks(source2, async_1.default, options8);
|
5413 | const result = await Promise.all(works);
|
5414 | return utils.array.flatten(result);
|
5415 | }
|
5416 | (function(FastGlob2) {
|
5417 | FastGlob2.glob = FastGlob2;
|
5418 | FastGlob2.globSync = sync;
|
5419 | FastGlob2.globStream = stream;
|
5420 | FastGlob2.async = FastGlob2;
|
5421 | function sync(source2, options8) {
|
5422 | assertPatternsInput(source2);
|
5423 | const works = getWorks(source2, sync_1.default, options8);
|
5424 | return utils.array.flatten(works);
|
5425 | }
|
5426 | FastGlob2.sync = sync;
|
5427 | function stream(source2, options8) {
|
5428 | assertPatternsInput(source2);
|
5429 | const works = getWorks(source2, stream_1.default, options8);
|
5430 | return utils.stream.merge(works);
|
5431 | }
|
5432 | FastGlob2.stream = stream;
|
5433 | function generateTasks(source2, options8) {
|
5434 | assertPatternsInput(source2);
|
5435 | const patterns = [].concat(source2);
|
5436 | const settings = new settings_1.default(options8);
|
5437 | return taskManager.generate(patterns, settings);
|
5438 | }
|
5439 | FastGlob2.generateTasks = generateTasks;
|
5440 | function isDynamicPattern(source2, options8) {
|
5441 | assertPatternsInput(source2);
|
5442 | const settings = new settings_1.default(options8);
|
5443 | return utils.pattern.isDynamicPattern(source2, settings);
|
5444 | }
|
5445 | FastGlob2.isDynamicPattern = isDynamicPattern;
|
5446 | function escapePath(source2) {
|
5447 | assertPatternsInput(source2);
|
5448 | return utils.path.escape(source2);
|
5449 | }
|
5450 | FastGlob2.escapePath = escapePath;
|
5451 | function convertPathToPattern(source2) {
|
5452 | assertPatternsInput(source2);
|
5453 | return utils.path.convertPathToPattern(source2);
|
5454 | }
|
5455 | FastGlob2.convertPathToPattern = convertPathToPattern;
|
5456 | let posix;
|
5457 | (function(posix2) {
|
5458 | function escapePath2(source2) {
|
5459 | assertPatternsInput(source2);
|
5460 | return utils.path.escapePosixPath(source2);
|
5461 | }
|
5462 | posix2.escapePath = escapePath2;
|
5463 | function convertPathToPattern2(source2) {
|
5464 | assertPatternsInput(source2);
|
5465 | return utils.path.convertPosixPathToPattern(source2);
|
5466 | }
|
5467 | posix2.convertPathToPattern = convertPathToPattern2;
|
5468 | })(posix = FastGlob2.posix || (FastGlob2.posix = {}));
|
5469 | let win32;
|
5470 | (function(win322) {
|
5471 | function escapePath2(source2) {
|
5472 | assertPatternsInput(source2);
|
5473 | return utils.path.escapeWindowsPath(source2);
|
5474 | }
|
5475 | win322.escapePath = escapePath2;
|
5476 | function convertPathToPattern2(source2) {
|
5477 | assertPatternsInput(source2);
|
5478 | return utils.path.convertWindowsPathToPattern(source2);
|
5479 | }
|
5480 | win322.convertPathToPattern = convertPathToPattern2;
|
5481 | })(win32 = FastGlob2.win32 || (FastGlob2.win32 = {}));
|
5482 | })(FastGlob || (FastGlob = {}));
|
5483 | function getWorks(source2, _Provider, options8) {
|
5484 | const patterns = [].concat(source2);
|
5485 | const settings = new settings_1.default(options8);
|
5486 | const tasks = taskManager.generate(patterns, settings);
|
5487 | const provider = new _Provider(settings);
|
5488 | return tasks.map(provider.read, provider);
|
5489 | }
|
5490 | function assertPatternsInput(input) {
|
5491 | const source2 = [].concat(input);
|
5492 | const isValidSource = source2.every((item) => utils.string.isString(item) && !utils.string.isEmpty(item));
|
5493 | if (!isValidSource) {
|
5494 | throw new TypeError("Patterns must be a string (non empty) or an array of strings");
|
5495 | }
|
5496 | }
|
5497 | module.exports = FastGlob;
|
5498 | }
|
5499 | });
|
5500 |
|
5501 |
|
5502 | function assembleStyles() {
|
5503 | const codes2 = new Map();
|
5504 | for (const [groupName, group] of Object.entries(styles)) {
|
5505 | for (const [styleName, style] of Object.entries(group)) {
|
5506 | styles[styleName] = {
|
5507 | open: `\x1B[${style[0]}m`,
|
5508 | close: `\x1B[${style[1]}m`
|
5509 | };
|
5510 | group[styleName] = styles[styleName];
|
5511 | codes2.set(style[0], style[1]);
|
5512 | }
|
5513 | Object.defineProperty(styles, groupName, {
|
5514 | value: group,
|
5515 | enumerable: false
|
5516 | });
|
5517 | }
|
5518 | Object.defineProperty(styles, "codes", {
|
5519 | value: codes2,
|
5520 | enumerable: false
|
5521 | });
|
5522 | styles.color.close = "\x1B[39m";
|
5523 | styles.bgColor.close = "\x1B[49m";
|
5524 | styles.color.ansi = wrapAnsi16();
|
5525 | styles.color.ansi256 = wrapAnsi256();
|
5526 | styles.color.ansi16m = wrapAnsi16m();
|
5527 | styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
5528 | styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
5529 | styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
5530 | Object.defineProperties(styles, {
|
5531 | rgbToAnsi256: {
|
5532 | value(red, green, blue) {
|
5533 | if (red === green && green === blue) {
|
5534 | if (red < 8) {
|
5535 | return 16;
|
5536 | }
|
5537 | if (red > 248) {
|
5538 | return 231;
|
5539 | }
|
5540 | return Math.round((red - 8) / 247 * 24) + 232;
|
5541 | }
|
5542 | return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
5543 | },
|
5544 | enumerable: false
|
5545 | },
|
5546 | hexToRgb: {
|
5547 | value(hex) {
|
5548 | const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
5549 | if (!matches) {
|
5550 | return [0, 0, 0];
|
5551 | }
|
5552 | let [colorString] = matches;
|
5553 | if (colorString.length === 3) {
|
5554 | colorString = [...colorString].map((character) => character + character).join("");
|
5555 | }
|
5556 | const integer = Number.parseInt(colorString, 16);
|
5557 | return [
|
5558 |
|
5559 | integer >> 16 & 255,
|
5560 | integer >> 8 & 255,
|
5561 | integer & 255
|
5562 |
|
5563 | ];
|
5564 | },
|
5565 | enumerable: false
|
5566 | },
|
5567 | hexToAnsi256: {
|
5568 | value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
5569 | enumerable: false
|
5570 | },
|
5571 | ansi256ToAnsi: {
|
5572 | value(code) {
|
5573 | if (code < 8) {
|
5574 | return 30 + code;
|
5575 | }
|
5576 | if (code < 16) {
|
5577 | return 90 + (code - 8);
|
5578 | }
|
5579 | let red;
|
5580 | let green;
|
5581 | let blue;
|
5582 | if (code >= 232) {
|
5583 | red = ((code - 232) * 10 + 8) / 255;
|
5584 | green = red;
|
5585 | blue = red;
|
5586 | } else {
|
5587 | code -= 16;
|
5588 | const remainder = code % 36;
|
5589 | red = Math.floor(code / 36) / 5;
|
5590 | green = Math.floor(remainder / 6) / 5;
|
5591 | blue = remainder % 6 / 5;
|
5592 | }
|
5593 | const value = Math.max(red, green, blue) * 2;
|
5594 | if (value === 0) {
|
5595 | return 30;
|
5596 | }
|
5597 | let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
5598 | if (value === 2) {
|
5599 | result += 60;
|
5600 | }
|
5601 | return result;
|
5602 | },
|
5603 | enumerable: false
|
5604 | },
|
5605 | rgbToAnsi: {
|
5606 | value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
5607 | enumerable: false
|
5608 | },
|
5609 | hexToAnsi: {
|
5610 | value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
5611 | enumerable: false
|
5612 | }
|
5613 | });
|
5614 | return styles;
|
5615 | }
|
5616 | var ANSI_BACKGROUND_OFFSET, wrapAnsi16, wrapAnsi256, wrapAnsi16m, styles, modifierNames, foregroundColorNames, backgroundColorNames, colorNames, ansiStyles, ansi_styles_default;
|
5617 | var init_ansi_styles = __esm({
|
5618 | "node_modules/chalk/source/vendor/ansi-styles/index.js"() {
|
5619 | ANSI_BACKGROUND_OFFSET = 10;
|
5620 | wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
5621 | wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
5622 | wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
5623 | styles = {
|
5624 | modifier: {
|
5625 | reset: [0, 0],
|
5626 |
|
5627 | bold: [1, 22],
|
5628 | dim: [2, 22],
|
5629 | italic: [3, 23],
|
5630 | underline: [4, 24],
|
5631 | overline: [53, 55],
|
5632 | inverse: [7, 27],
|
5633 | hidden: [8, 28],
|
5634 | strikethrough: [9, 29]
|
5635 | },
|
5636 | color: {
|
5637 | black: [30, 39],
|
5638 | red: [31, 39],
|
5639 | green: [32, 39],
|
5640 | yellow: [33, 39],
|
5641 | blue: [34, 39],
|
5642 | magenta: [35, 39],
|
5643 | cyan: [36, 39],
|
5644 | white: [37, 39],
|
5645 |
|
5646 | blackBright: [90, 39],
|
5647 | gray: [90, 39],
|
5648 |
|
5649 | grey: [90, 39],
|
5650 |
|
5651 | redBright: [91, 39],
|
5652 | greenBright: [92, 39],
|
5653 | yellowBright: [93, 39],
|
5654 | blueBright: [94, 39],
|
5655 | magentaBright: [95, 39],
|
5656 | cyanBright: [96, 39],
|
5657 | whiteBright: [97, 39]
|
5658 | },
|
5659 | bgColor: {
|
5660 | bgBlack: [40, 49],
|
5661 | bgRed: [41, 49],
|
5662 | bgGreen: [42, 49],
|
5663 | bgYellow: [43, 49],
|
5664 | bgBlue: [44, 49],
|
5665 | bgMagenta: [45, 49],
|
5666 | bgCyan: [46, 49],
|
5667 | bgWhite: [47, 49],
|
5668 |
|
5669 | bgBlackBright: [100, 49],
|
5670 | bgGray: [100, 49],
|
5671 |
|
5672 | bgGrey: [100, 49],
|
5673 |
|
5674 | bgRedBright: [101, 49],
|
5675 | bgGreenBright: [102, 49],
|
5676 | bgYellowBright: [103, 49],
|
5677 | bgBlueBright: [104, 49],
|
5678 | bgMagentaBright: [105, 49],
|
5679 | bgCyanBright: [106, 49],
|
5680 | bgWhiteBright: [107, 49]
|
5681 | }
|
5682 | };
|
5683 | modifierNames = Object.keys(styles.modifier);
|
5684 | foregroundColorNames = Object.keys(styles.color);
|
5685 | backgroundColorNames = Object.keys(styles.bgColor);
|
5686 | colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
5687 | ansiStyles = assembleStyles();
|
5688 | ansi_styles_default = ansiStyles;
|
5689 | }
|
5690 | });
|
5691 |
|
5692 |
|
5693 | import process2 from "process";
|
5694 | import os from "os";
|
5695 | import tty from "tty";
|
5696 | function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
|
5697 | const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
5698 | const position = argv.indexOf(prefix + flag);
|
5699 | const terminatorPosition = argv.indexOf("--");
|
5700 | return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
5701 | }
|
5702 | function envForceColor() {
|
5703 | if ("FORCE_COLOR" in env) {
|
5704 | if (env.FORCE_COLOR === "true") {
|
5705 | return 1;
|
5706 | }
|
5707 | if (env.FORCE_COLOR === "false") {
|
5708 | return 0;
|
5709 | }
|
5710 | return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
5711 | }
|
5712 | }
|
5713 | function translateLevel(level) {
|
5714 | if (level === 0) {
|
5715 | return false;
|
5716 | }
|
5717 | return {
|
5718 | level,
|
5719 | hasBasic: true,
|
5720 | has256: level >= 2,
|
5721 | has16m: level >= 3
|
5722 | };
|
5723 | }
|
5724 | function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
5725 | const noFlagForceColor = envForceColor();
|
5726 | if (noFlagForceColor !== void 0) {
|
5727 | flagForceColor = noFlagForceColor;
|
5728 | }
|
5729 | const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
5730 | if (forceColor === 0) {
|
5731 | return 0;
|
5732 | }
|
5733 | if (sniffFlags) {
|
5734 | if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
5735 | return 3;
|
5736 | }
|
5737 | if (hasFlag("color=256")) {
|
5738 | return 2;
|
5739 | }
|
5740 | }
|
5741 | if ("TF_BUILD" in env && "AGENT_NAME" in env) {
|
5742 | return 1;
|
5743 | }
|
5744 | if (haveStream && !streamIsTTY && forceColor === void 0) {
|
5745 | return 0;
|
5746 | }
|
5747 | const min = forceColor || 0;
|
5748 | if (env.TERM === "dumb") {
|
5749 | return min;
|
5750 | }
|
5751 | if (process2.platform === "win32") {
|
5752 | const osRelease = os.release().split(".");
|
5753 | if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
5754 | return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
5755 | }
|
5756 | return 1;
|
5757 | }
|
5758 | if ("CI" in env) {
|
5759 | if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) {
|
5760 | return 3;
|
5761 | }
|
5762 | if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign2) => sign2 in env) || env.CI_NAME === "codeship") {
|
5763 | return 1;
|
5764 | }
|
5765 | return min;
|
5766 | }
|
5767 | if ("TEAMCITY_VERSION" in env) {
|
5768 | return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
5769 | }
|
5770 | if (env.COLORTERM === "truecolor") {
|
5771 | return 3;
|
5772 | }
|
5773 | if (env.TERM === "xterm-kitty") {
|
5774 | return 3;
|
5775 | }
|
5776 | if ("TERM_PROGRAM" in env) {
|
5777 | const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
5778 | switch (env.TERM_PROGRAM) {
|
5779 | case "iTerm.app": {
|
5780 | return version >= 3 ? 3 : 2;
|
5781 | }
|
5782 | case "Apple_Terminal": {
|
5783 | return 2;
|
5784 | }
|
5785 | }
|
5786 | }
|
5787 | if (/-256(color)?$/i.test(env.TERM)) {
|
5788 | return 2;
|
5789 | }
|
5790 | if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
5791 | return 1;
|
5792 | }
|
5793 | if ("COLORTERM" in env) {
|
5794 | return 1;
|
5795 | }
|
5796 | return min;
|
5797 | }
|
5798 | function createSupportsColor(stream, options8 = {}) {
|
5799 | const level = _supportsColor(stream, {
|
5800 | streamIsTTY: stream && stream.isTTY,
|
5801 | ...options8
|
5802 | });
|
5803 | return translateLevel(level);
|
5804 | }
|
5805 | var env, flagForceColor, supportsColor, supports_color_default;
|
5806 | var init_supports_color = __esm({
|
5807 | "node_modules/chalk/source/vendor/supports-color/index.js"() {
|
5808 | ({ env } = process2);
|
5809 | if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
5810 | flagForceColor = 0;
|
5811 | } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
5812 | flagForceColor = 1;
|
5813 | }
|
5814 | supportsColor = {
|
5815 | stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
|
5816 | stderr: createSupportsColor({ isTTY: tty.isatty(2) })
|
5817 | };
|
5818 | supports_color_default = supportsColor;
|
5819 | }
|
5820 | });
|
5821 |
|
5822 |
|
5823 | function stringReplaceAll(string, substring, replacer) {
|
5824 | let index = string.indexOf(substring);
|
5825 | if (index === -1) {
|
5826 | return string;
|
5827 | }
|
5828 | const substringLength = substring.length;
|
5829 | let endIndex = 0;
|
5830 | let returnValue = "";
|
5831 | do {
|
5832 | returnValue += string.slice(endIndex, index) + substring + replacer;
|
5833 | endIndex = index + substringLength;
|
5834 | index = string.indexOf(substring, endIndex);
|
5835 | } while (index !== -1);
|
5836 | returnValue += string.slice(endIndex);
|
5837 | return returnValue;
|
5838 | }
|
5839 | function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
5840 | let endIndex = 0;
|
5841 | let returnValue = "";
|
5842 | do {
|
5843 | const gotCR = string[index - 1] === "\r";
|
5844 | returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
5845 | endIndex = index + 1;
|
5846 | index = string.indexOf("\n", endIndex);
|
5847 | } while (index !== -1);
|
5848 | returnValue += string.slice(endIndex);
|
5849 | return returnValue;
|
5850 | }
|
5851 | var init_utilities = __esm({
|
5852 | "node_modules/chalk/source/utilities.js"() {
|
5853 | }
|
5854 | });
|
5855 |
|
5856 |
|
5857 | var source_exports = {};
|
5858 | __export(source_exports, {
|
5859 | Chalk: () => Chalk,
|
5860 | backgroundColorNames: () => backgroundColorNames,
|
5861 | backgroundColors: () => backgroundColorNames,
|
5862 | chalkStderr: () => chalkStderr,
|
5863 | colorNames: () => colorNames,
|
5864 | colors: () => colorNames,
|
5865 | default: () => source_default,
|
5866 | foregroundColorNames: () => foregroundColorNames,
|
5867 | foregroundColors: () => foregroundColorNames,
|
5868 | modifierNames: () => modifierNames,
|
5869 | modifiers: () => modifierNames,
|
5870 | supportsColor: () => stdoutColor,
|
5871 | supportsColorStderr: () => stderrColor
|
5872 | });
|
5873 | function createChalk(options8) {
|
5874 | return chalkFactory(options8);
|
5875 | }
|
5876 | var stdoutColor, stderrColor, GENERATOR, STYLER, IS_EMPTY, levelMapping, styles2, applyOptions, Chalk, chalkFactory, getModelAnsi, usedModels, proto, createStyler, createBuilder, applyStyle, chalk, chalkStderr, source_default;
|
5877 | var init_source = __esm({
|
5878 | "node_modules/chalk/source/index.js"() {
|
5879 | init_ansi_styles();
|
5880 | init_supports_color();
|
5881 | init_utilities();
|
5882 | init_ansi_styles();
|
5883 | ({ stdout: stdoutColor, stderr: stderrColor } = supports_color_default);
|
5884 | GENERATOR = Symbol("GENERATOR");
|
5885 | STYLER = Symbol("STYLER");
|
5886 | IS_EMPTY = Symbol("IS_EMPTY");
|
5887 | levelMapping = [
|
5888 | "ansi",
|
5889 | "ansi",
|
5890 | "ansi256",
|
5891 | "ansi16m"
|
5892 | ];
|
5893 | styles2 = Object.create(null);
|
5894 | applyOptions = (object, options8 = {}) => {
|
5895 | if (options8.level && !(Number.isInteger(options8.level) && options8.level >= 0 && options8.level <= 3)) {
|
5896 | throw new Error("The `level` option should be an integer from 0 to 3");
|
5897 | }
|
5898 | const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
5899 | object.level = options8.level === void 0 ? colorLevel : options8.level;
|
5900 | };
|
5901 | Chalk = class {
|
5902 | constructor(options8) {
|
5903 | return chalkFactory(options8);
|
5904 | }
|
5905 | };
|
5906 | chalkFactory = (options8) => {
|
5907 | const chalk2 = (...strings) => strings.join(" ");
|
5908 | applyOptions(chalk2, options8);
|
5909 | Object.setPrototypeOf(chalk2, createChalk.prototype);
|
5910 | return chalk2;
|
5911 | };
|
5912 | Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
5913 | for (const [styleName, style] of Object.entries(ansi_styles_default)) {
|
5914 | styles2[styleName] = {
|
5915 | get() {
|
5916 | const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
5917 | Object.defineProperty(this, styleName, { value: builder });
|
5918 | return builder;
|
5919 | }
|
5920 | };
|
5921 | }
|
5922 | styles2.visible = {
|
5923 | get() {
|
5924 | const builder = createBuilder(this, this[STYLER], true);
|
5925 | Object.defineProperty(this, "visible", { value: builder });
|
5926 | return builder;
|
5927 | }
|
5928 | };
|
5929 | getModelAnsi = (model, level, type2, ...arguments_) => {
|
5930 | if (model === "rgb") {
|
5931 | if (level === "ansi16m") {
|
5932 | return ansi_styles_default[type2].ansi16m(...arguments_);
|
5933 | }
|
5934 | if (level === "ansi256") {
|
5935 | return ansi_styles_default[type2].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
|
5936 | }
|
5937 | return ansi_styles_default[type2].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
|
5938 | }
|
5939 | if (model === "hex") {
|
5940 | return getModelAnsi("rgb", level, type2, ...ansi_styles_default.hexToRgb(...arguments_));
|
5941 | }
|
5942 | return ansi_styles_default[type2][model](...arguments_);
|
5943 | };
|
5944 | usedModels = ["rgb", "hex", "ansi256"];
|
5945 | for (const model of usedModels) {
|
5946 | styles2[model] = {
|
5947 | get() {
|
5948 | const { level } = this;
|
5949 | return function(...arguments_) {
|
5950 | const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
|
5951 | return createBuilder(this, styler, this[IS_EMPTY]);
|
5952 | };
|
5953 | }
|
5954 | };
|
5955 | const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
5956 | styles2[bgModel] = {
|
5957 | get() {
|
5958 | const { level } = this;
|
5959 | return function(...arguments_) {
|
5960 | const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
|
5961 | return createBuilder(this, styler, this[IS_EMPTY]);
|
5962 | };
|
5963 | }
|
5964 | };
|
5965 | }
|
5966 | proto = Object.defineProperties(() => {
|
5967 | }, {
|
5968 | ...styles2,
|
5969 | level: {
|
5970 | enumerable: true,
|
5971 | get() {
|
5972 | return this[GENERATOR].level;
|
5973 | },
|
5974 | set(level) {
|
5975 | this[GENERATOR].level = level;
|
5976 | }
|
5977 | }
|
5978 | });
|
5979 | createStyler = (open, close, parent) => {
|
5980 | let openAll;
|
5981 | let closeAll;
|
5982 | if (parent === void 0) {
|
5983 | openAll = open;
|
5984 | closeAll = close;
|
5985 | } else {
|
5986 | openAll = parent.openAll + open;
|
5987 | closeAll = close + parent.closeAll;
|
5988 | }
|
5989 | return {
|
5990 | open,
|
5991 | close,
|
5992 | openAll,
|
5993 | closeAll,
|
5994 | parent
|
5995 | };
|
5996 | };
|
5997 | createBuilder = (self, _styler, _isEmpty) => {
|
5998 | const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
5999 | Object.setPrototypeOf(builder, proto);
|
6000 | builder[GENERATOR] = self;
|
6001 | builder[STYLER] = _styler;
|
6002 | builder[IS_EMPTY] = _isEmpty;
|
6003 | return builder;
|
6004 | };
|
6005 | applyStyle = (self, string) => {
|
6006 | if (self.level <= 0 || !string) {
|
6007 | return self[IS_EMPTY] ? "" : string;
|
6008 | }
|
6009 | let styler = self[STYLER];
|
6010 | if (styler === void 0) {
|
6011 | return string;
|
6012 | }
|
6013 | const { openAll, closeAll } = styler;
|
6014 | if (string.includes("\x1B")) {
|
6015 | while (styler !== void 0) {
|
6016 | string = stringReplaceAll(string, styler.close, styler.open);
|
6017 | styler = styler.parent;
|
6018 | }
|
6019 | }
|
6020 | const lfIndex = string.indexOf("\n");
|
6021 | if (lfIndex !== -1) {
|
6022 | string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
6023 | }
|
6024 | return openAll + string + closeAll;
|
6025 | };
|
6026 | Object.defineProperties(createChalk.prototype, styles2);
|
6027 | chalk = createChalk();
|
6028 | chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
6029 | source_default = chalk;
|
6030 | }
|
6031 | });
|
6032 |
|
6033 |
|
6034 | var require_debug = __commonJS({
|
6035 | "node_modules/semver/internal/debug.js"(exports, module) {
|
6036 | var debug = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {
|
6037 | };
|
6038 | module.exports = debug;
|
6039 | }
|
6040 | });
|
6041 |
|
6042 |
|
6043 | var require_constants4 = __commonJS({
|
6044 | "node_modules/semver/internal/constants.js"(exports, module) {
|
6045 | var SEMVER_SPEC_VERSION = "2.0.0";
|
6046 | var MAX_LENGTH = 256;
|
6047 | var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
|
6048 | 9007199254740991;
|
6049 | var MAX_SAFE_COMPONENT_LENGTH = 16;
|
6050 | var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
|
6051 | var RELEASE_TYPES = [
|
6052 | "major",
|
6053 | "premajor",
|
6054 | "minor",
|
6055 | "preminor",
|
6056 | "patch",
|
6057 | "prepatch",
|
6058 | "prerelease"
|
6059 | ];
|
6060 | module.exports = {
|
6061 | MAX_LENGTH,
|
6062 | MAX_SAFE_COMPONENT_LENGTH,
|
6063 | MAX_SAFE_BUILD_LENGTH,
|
6064 | MAX_SAFE_INTEGER,
|
6065 | RELEASE_TYPES,
|
6066 | SEMVER_SPEC_VERSION,
|
6067 | FLAG_INCLUDE_PRERELEASE: 1,
|
6068 | FLAG_LOOSE: 2
|
6069 | };
|
6070 | }
|
6071 | });
|
6072 |
|
6073 |
|
6074 | var require_re = __commonJS({
|
6075 | "node_modules/semver/internal/re.js"(exports, module) {
|
6076 | var {
|
6077 | MAX_SAFE_COMPONENT_LENGTH,
|
6078 | MAX_SAFE_BUILD_LENGTH,
|
6079 | MAX_LENGTH
|
6080 | } = require_constants4();
|
6081 | var debug = require_debug();
|
6082 | exports = module.exports = {};
|
6083 | var re = exports.re = [];
|
6084 | var safeRe = exports.safeRe = [];
|
6085 | var src = exports.src = [];
|
6086 | var t = exports.t = {};
|
6087 | var R = 0;
|
6088 | var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
6089 | var safeRegexReplacements = [
|
6090 | ["\\s", 1],
|
6091 | ["\\d", MAX_LENGTH],
|
6092 | [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH]
|
6093 | ];
|
6094 | var makeSafeRegex = (value) => {
|
6095 | for (const [token2, max] of safeRegexReplacements) {
|
6096 | value = value.split(`${token2}*`).join(`${token2}{0,${max}}`).split(`${token2}+`).join(`${token2}{1,${max}}`);
|
6097 | }
|
6098 | return value;
|
6099 | };
|
6100 | var createToken = (name, value, isGlobal) => {
|
6101 | const safe = makeSafeRegex(value);
|
6102 | const index = R++;
|
6103 | debug(name, index, value);
|
6104 | t[name] = index;
|
6105 | src[index] = value;
|
6106 | re[index] = new RegExp(value, isGlobal ? "g" : void 0);
|
6107 | safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
|
6108 | };
|
6109 | createToken("NUMERICIDENTIFIER", "0|[1-9]\\d*");
|
6110 | createToken("NUMERICIDENTIFIERLOOSE", "\\d+");
|
6111 | createToken("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
|
6112 | createToken("MAINVERSION", `(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})\\.(${src[t.NUMERICIDENTIFIER]})`);
|
6113 | createToken("MAINVERSIONLOOSE", `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})\\.(${src[t.NUMERICIDENTIFIERLOOSE]})`);
|
6114 | createToken("PRERELEASEIDENTIFIER", `(?:${src[t.NUMERICIDENTIFIER]}|${src[t.NONNUMERICIDENTIFIER]})`);
|
6115 | createToken("PRERELEASEIDENTIFIERLOOSE", `(?:${src[t.NUMERICIDENTIFIERLOOSE]}|${src[t.NONNUMERICIDENTIFIER]})`);
|
6116 | createToken("PRERELEASE", `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
|
6117 | createToken("PRERELEASELOOSE", `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
|
6118 | createToken("BUILDIDENTIFIER", `${LETTERDASHNUMBER}+`);
|
6119 | createToken("BUILD", `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
|
6120 | createToken("FULLPLAIN", `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`);
|
6121 | createToken("FULL", `^${src[t.FULLPLAIN]}$`);
|
6122 | createToken("LOOSEPLAIN", `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`);
|
6123 | createToken("LOOSE", `^${src[t.LOOSEPLAIN]}$`);
|
6124 | createToken("GTLT", "((?:<|>)?=?)");
|
6125 | createToken("XRANGEIDENTIFIERLOOSE", `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
|
6126 | createToken("XRANGEIDENTIFIER", `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
|
6127 | createToken("XRANGEPLAIN", `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:\\.(${src[t.XRANGEIDENTIFIER]})(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?)?)?`);
|
6128 | createToken("XRANGEPLAINLOOSE", `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?)?)?`);
|
6129 | createToken("XRANGE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
|
6130 | createToken("XRANGELOOSE", `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
|
6131 | createToken("COERCEPLAIN", `${"(^|[^\\d])(\\d{1,"}${MAX_SAFE_COMPONENT_LENGTH}})(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
|
6132 | createToken("COERCE", `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
|
6133 | createToken("COERCEFULL", src[t.COERCEPLAIN] + `(?:${src[t.PRERELEASE]})?(?:${src[t.BUILD]})?(?:$|[^\\d])`);
|
6134 | createToken("COERCERTL", src[t.COERCE], true);
|
6135 | createToken("COERCERTLFULL", src[t.COERCEFULL], true);
|
6136 | createToken("LONETILDE", "(?:~>?)");
|
6137 | createToken("TILDETRIM", `(\\s*)${src[t.LONETILDE]}\\s+`, true);
|
6138 | exports.tildeTrimReplace = "$1~";
|
6139 | createToken("TILDE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
|
6140 | createToken("TILDELOOSE", `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
|
6141 | createToken("LONECARET", "(?:\\^)");
|
6142 | createToken("CARETTRIM", `(\\s*)${src[t.LONECARET]}\\s+`, true);
|
6143 | exports.caretTrimReplace = "$1^";
|
6144 | createToken("CARET", `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
|
6145 | createToken("CARETLOOSE", `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
|
6146 | createToken("COMPARATORLOOSE", `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
|
6147 | createToken("COMPARATOR", `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
|
6148 | createToken("COMPARATORTRIM", `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
|
6149 | exports.comparatorTrimReplace = "$1$2$3";
|
6150 | createToken("HYPHENRANGE", `^\\s*(${src[t.XRANGEPLAIN]})\\s+-\\s+(${src[t.XRANGEPLAIN]})\\s*$`);
|
6151 | createToken("HYPHENRANGELOOSE", `^\\s*(${src[t.XRANGEPLAINLOOSE]})\\s+-\\s+(${src[t.XRANGEPLAINLOOSE]})\\s*$`);
|
6152 | createToken("STAR", "(<|>)?=?\\s*\\*");
|
6153 | createToken("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$");
|
6154 | createToken("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
|
6155 | }
|
6156 | });
|
6157 |
|
6158 |
|
6159 | var require_parse_options = __commonJS({
|
6160 | "node_modules/semver/internal/parse-options.js"(exports, module) {
|
6161 | var looseOption = Object.freeze({ loose: true });
|
6162 | var emptyOpts = Object.freeze({});
|
6163 | var parseOptions = (options8) => {
|
6164 | if (!options8) {
|
6165 | return emptyOpts;
|
6166 | }
|
6167 | if (typeof options8 !== "object") {
|
6168 | return looseOption;
|
6169 | }
|
6170 | return options8;
|
6171 | };
|
6172 | module.exports = parseOptions;
|
6173 | }
|
6174 | });
|
6175 |
|
6176 |
|
6177 | var require_identifiers = __commonJS({
|
6178 | "node_modules/semver/internal/identifiers.js"(exports, module) {
|
6179 | var numeric = /^[0-9]+$/;
|
6180 | var compareIdentifiers = (a, b) => {
|
6181 | const anum = numeric.test(a);
|
6182 | const bnum = numeric.test(b);
|
6183 | if (anum && bnum) {
|
6184 | a = +a;
|
6185 | b = +b;
|
6186 | }
|
6187 | return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1;
|
6188 | };
|
6189 | var rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
|
6190 | module.exports = {
|
6191 | compareIdentifiers,
|
6192 | rcompareIdentifiers
|
6193 | };
|
6194 | }
|
6195 | });
|
6196 |
|
6197 |
|
6198 | var require_semver = __commonJS({
|
6199 | "node_modules/semver/classes/semver.js"(exports, module) {
|
6200 | var debug = require_debug();
|
6201 | var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants4();
|
6202 | var { safeRe: re, t } = require_re();
|
6203 | var parseOptions = require_parse_options();
|
6204 | var { compareIdentifiers } = require_identifiers();
|
6205 | var SemVer = class _SemVer {
|
6206 | constructor(version, options8) {
|
6207 | options8 = parseOptions(options8);
|
6208 | if (version instanceof _SemVer) {
|
6209 | if (version.loose === !!options8.loose && version.includePrerelease === !!options8.includePrerelease) {
|
6210 | return version;
|
6211 | } else {
|
6212 | version = version.version;
|
6213 | }
|
6214 | } else if (typeof version !== "string") {
|
6215 | throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`);
|
6216 | }
|
6217 | if (version.length > MAX_LENGTH) {
|
6218 | throw new TypeError(
|
6219 | `version is longer than ${MAX_LENGTH} characters`
|
6220 | );
|
6221 | }
|
6222 | debug("SemVer", version, options8);
|
6223 | this.options = options8;
|
6224 | this.loose = !!options8.loose;
|
6225 | this.includePrerelease = !!options8.includePrerelease;
|
6226 | const m = version.trim().match(options8.loose ? re[t.LOOSE] : re[t.FULL]);
|
6227 | if (!m) {
|
6228 | throw new TypeError(`Invalid Version: ${version}`);
|
6229 | }
|
6230 | this.raw = version;
|
6231 | this.major = +m[1];
|
6232 | this.minor = +m[2];
|
6233 | this.patch = +m[3];
|
6234 | if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
|
6235 | throw new TypeError("Invalid major version");
|
6236 | }
|
6237 | if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
|
6238 | throw new TypeError("Invalid minor version");
|
6239 | }
|
6240 | if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
|
6241 | throw new TypeError("Invalid patch version");
|
6242 | }
|
6243 | if (!m[4]) {
|
6244 | this.prerelease = [];
|
6245 | } else {
|
6246 | this.prerelease = m[4].split(".").map((id) => {
|
6247 | if (/^[0-9]+$/.test(id)) {
|
6248 | const num = +id;
|
6249 | if (num >= 0 && num < MAX_SAFE_INTEGER) {
|
6250 | return num;
|
6251 | }
|
6252 | }
|
6253 | return id;
|
6254 | });
|
6255 | }
|
6256 | this.build = m[5] ? m[5].split(".") : [];
|
6257 | this.format();
|
6258 | }
|
6259 | format() {
|
6260 | this.version = `${this.major}.${this.minor}.${this.patch}`;
|
6261 | if (this.prerelease.length) {
|
6262 | this.version += `-${this.prerelease.join(".")}`;
|
6263 | }
|
6264 | return this.version;
|
6265 | }
|
6266 | toString() {
|
6267 | return this.version;
|
6268 | }
|
6269 | compare(other) {
|
6270 | debug("SemVer.compare", this.version, this.options, other);
|
6271 | if (!(other instanceof _SemVer)) {
|
6272 | if (typeof other === "string" && other === this.version) {
|
6273 | return 0;
|
6274 | }
|
6275 | other = new _SemVer(other, this.options);
|
6276 | }
|
6277 | if (other.version === this.version) {
|
6278 | return 0;
|
6279 | }
|
6280 | return this.compareMain(other) || this.comparePre(other);
|
6281 | }
|
6282 | compareMain(other) {
|
6283 | if (!(other instanceof _SemVer)) {
|
6284 | other = new _SemVer(other, this.options);
|
6285 | }
|
6286 | return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch);
|
6287 | }
|
6288 | comparePre(other) {
|
6289 | if (!(other instanceof _SemVer)) {
|
6290 | other = new _SemVer(other, this.options);
|
6291 | }
|
6292 | if (this.prerelease.length && !other.prerelease.length) {
|
6293 | return -1;
|
6294 | } else if (!this.prerelease.length && other.prerelease.length) {
|
6295 | return 1;
|
6296 | } else if (!this.prerelease.length && !other.prerelease.length) {
|
6297 | return 0;
|
6298 | }
|
6299 | let i = 0;
|
6300 | do {
|
6301 | const a = this.prerelease[i];
|
6302 | const b = other.prerelease[i];
|
6303 | debug("prerelease compare", i, a, b);
|
6304 | if (a === void 0 && b === void 0) {
|
6305 | return 0;
|
6306 | } else if (b === void 0) {
|
6307 | return 1;
|
6308 | } else if (a === void 0) {
|
6309 | return -1;
|
6310 | } else if (a === b) {
|
6311 | continue;
|
6312 | } else {
|
6313 | return compareIdentifiers(a, b);
|
6314 | }
|
6315 | } while (++i);
|
6316 | }
|
6317 | compareBuild(other) {
|
6318 | if (!(other instanceof _SemVer)) {
|
6319 | other = new _SemVer(other, this.options);
|
6320 | }
|
6321 | let i = 0;
|
6322 | do {
|
6323 | const a = this.build[i];
|
6324 | const b = other.build[i];
|
6325 | debug("build compare", i, a, b);
|
6326 | if (a === void 0 && b === void 0) {
|
6327 | return 0;
|
6328 | } else if (b === void 0) {
|
6329 | return 1;
|
6330 | } else if (a === void 0) {
|
6331 | return -1;
|
6332 | } else if (a === b) {
|
6333 | continue;
|
6334 | } else {
|
6335 | return compareIdentifiers(a, b);
|
6336 | }
|
6337 | } while (++i);
|
6338 | }
|
6339 |
|
6340 |
|
6341 | inc(release, identifier, identifierBase) {
|
6342 | switch (release) {
|
6343 | case "premajor":
|
6344 | this.prerelease.length = 0;
|
6345 | this.patch = 0;
|
6346 | this.minor = 0;
|
6347 | this.major++;
|
6348 | this.inc("pre", identifier, identifierBase);
|
6349 | break;
|
6350 | case "preminor":
|
6351 | this.prerelease.length = 0;
|
6352 | this.patch = 0;
|
6353 | this.minor++;
|
6354 | this.inc("pre", identifier, identifierBase);
|
6355 | break;
|
6356 | case "prepatch":
|
6357 | this.prerelease.length = 0;
|
6358 | this.inc("patch", identifier, identifierBase);
|
6359 | this.inc("pre", identifier, identifierBase);
|
6360 | break;
|
6361 | case "prerelease":
|
6362 | if (this.prerelease.length === 0) {
|
6363 | this.inc("patch", identifier, identifierBase);
|
6364 | }
|
6365 | this.inc("pre", identifier, identifierBase);
|
6366 | break;
|
6367 | case "major":
|
6368 | if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
6369 | this.major++;
|
6370 | }
|
6371 | this.minor = 0;
|
6372 | this.patch = 0;
|
6373 | this.prerelease = [];
|
6374 | break;
|
6375 | case "minor":
|
6376 | if (this.patch !== 0 || this.prerelease.length === 0) {
|
6377 | this.minor++;
|
6378 | }
|
6379 | this.patch = 0;
|
6380 | this.prerelease = [];
|
6381 | break;
|
6382 | case "patch":
|
6383 | if (this.prerelease.length === 0) {
|
6384 | this.patch++;
|
6385 | }
|
6386 | this.prerelease = [];
|
6387 | break;
|
6388 | case "pre": {
|
6389 | const base = Number(identifierBase) ? 1 : 0;
|
6390 | if (!identifier && identifierBase === false) {
|
6391 | throw new Error("invalid increment argument: identifier is empty");
|
6392 | }
|
6393 | if (this.prerelease.length === 0) {
|
6394 | this.prerelease = [base];
|
6395 | } else {
|
6396 | let i = this.prerelease.length;
|
6397 | while (--i >= 0) {
|
6398 | if (typeof this.prerelease[i] === "number") {
|
6399 | this.prerelease[i]++;
|
6400 | i = -2;
|
6401 | }
|
6402 | }
|
6403 | if (i === -1) {
|
6404 | if (identifier === this.prerelease.join(".") && identifierBase === false) {
|
6405 | throw new Error("invalid increment argument: identifier already exists");
|
6406 | }
|
6407 | this.prerelease.push(base);
|
6408 | }
|
6409 | }
|
6410 | if (identifier) {
|
6411 | let prerelease = [identifier, base];
|
6412 | if (identifierBase === false) {
|
6413 | prerelease = [identifier];
|
6414 | }
|
6415 | if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
|
6416 | if (isNaN(this.prerelease[1])) {
|
6417 | this.prerelease = prerelease;
|
6418 | }
|
6419 | } else {
|
6420 | this.prerelease = prerelease;
|
6421 | }
|
6422 | }
|
6423 | break;
|
6424 | }
|
6425 | default:
|
6426 | throw new Error(`invalid increment argument: ${release}`);
|
6427 | }
|
6428 | this.raw = this.format();
|
6429 | if (this.build.length) {
|
6430 | this.raw += `+${this.build.join(".")}`;
|
6431 | }
|
6432 | return this;
|
6433 | }
|
6434 | };
|
6435 | module.exports = SemVer;
|
6436 | }
|
6437 | });
|
6438 |
|
6439 |
|
6440 | var require_compare = __commonJS({
|
6441 | "node_modules/semver/functions/compare.js"(exports, module) {
|
6442 | var SemVer = require_semver();
|
6443 | var compare = (a, b, loose) => new SemVer(a, loose).compare(new SemVer(b, loose));
|
6444 | module.exports = compare;
|
6445 | }
|
6446 | });
|
6447 |
|
6448 |
|
6449 | var require_gte = __commonJS({
|
6450 | "node_modules/semver/functions/gte.js"(exports, module) {
|
6451 | var compare = require_compare();
|
6452 | var gte = (a, b, loose) => compare(a, b, loose) >= 0;
|
6453 | module.exports = gte;
|
6454 | }
|
6455 | });
|
6456 |
|
6457 |
|
6458 | var require_pseudomap = __commonJS({
|
6459 | "node_modules/pseudomap/pseudomap.js"(exports, module) {
|
6460 | var hasOwnProperty3 = Object.prototype.hasOwnProperty;
|
6461 | module.exports = PseudoMap;
|
6462 | function PseudoMap(set3) {
|
6463 | if (!(this instanceof PseudoMap))
|
6464 | throw new TypeError("Constructor PseudoMap requires 'new'");
|
6465 | this.clear();
|
6466 | if (set3) {
|
6467 | if (set3 instanceof PseudoMap || typeof Map === "function" && set3 instanceof Map)
|
6468 | set3.forEach(function(value, key2) {
|
6469 | this.set(key2, value);
|
6470 | }, this);
|
6471 | else if (Array.isArray(set3))
|
6472 | set3.forEach(function(kv) {
|
6473 | this.set(kv[0], kv[1]);
|
6474 | }, this);
|
6475 | else
|
6476 | throw new TypeError("invalid argument");
|
6477 | }
|
6478 | }
|
6479 | PseudoMap.prototype.forEach = function(fn, thisp) {
|
6480 | thisp = thisp || this;
|
6481 | Object.keys(this._data).forEach(function(k) {
|
6482 | if (k !== "size")
|
6483 | fn.call(thisp, this._data[k].value, this._data[k].key);
|
6484 | }, this);
|
6485 | };
|
6486 | PseudoMap.prototype.has = function(k) {
|
6487 | return !!find(this._data, k);
|
6488 | };
|
6489 | PseudoMap.prototype.get = function(k) {
|
6490 | var res = find(this._data, k);
|
6491 | return res && res.value;
|
6492 | };
|
6493 | PseudoMap.prototype.set = function(k, v) {
|
6494 | set2(this._data, k, v);
|
6495 | };
|
6496 | PseudoMap.prototype.delete = function(k) {
|
6497 | var res = find(this._data, k);
|
6498 | if (res) {
|
6499 | delete this._data[res._index];
|
6500 | this._data.size--;
|
6501 | }
|
6502 | };
|
6503 | PseudoMap.prototype.clear = function() {
|
6504 | var data = Object.create(null);
|
6505 | data.size = 0;
|
6506 | Object.defineProperty(this, "_data", {
|
6507 | value: data,
|
6508 | enumerable: false,
|
6509 | configurable: true,
|
6510 | writable: false
|
6511 | });
|
6512 | };
|
6513 | Object.defineProperty(PseudoMap.prototype, "size", {
|
6514 | get: function() {
|
6515 | return this._data.size;
|
6516 | },
|
6517 | set: function(n) {
|
6518 | },
|
6519 | enumerable: true,
|
6520 | configurable: true
|
6521 | });
|
6522 | PseudoMap.prototype.values = PseudoMap.prototype.keys = PseudoMap.prototype.entries = function() {
|
6523 | throw new Error("iterators are not implemented in this version");
|
6524 | };
|
6525 | function same(a, b) {
|
6526 | return a === b || a !== a && b !== b;
|
6527 | }
|
6528 | function Entry(k, v, i) {
|
6529 | this.key = k;
|
6530 | this.value = v;
|
6531 | this._index = i;
|
6532 | }
|
6533 | function find(data, k) {
|
6534 | for (var i = 0, s = "_" + k, key2 = s; hasOwnProperty3.call(data, key2); key2 = s + i++) {
|
6535 | if (same(data[key2].key, k))
|
6536 | return data[key2];
|
6537 | }
|
6538 | }
|
6539 | function set2(data, k, v) {
|
6540 | for (var i = 0, s = "_" + k, key2 = s; hasOwnProperty3.call(data, key2); key2 = s + i++) {
|
6541 | if (same(data[key2].key, k)) {
|
6542 | data[key2].value = v;
|
6543 | return;
|
6544 | }
|
6545 | }
|
6546 | data.size++;
|
6547 | data[key2] = new Entry(k, v, key2);
|
6548 | }
|
6549 | }
|
6550 | });
|
6551 |
|
6552 |
|
6553 | var require_map = __commonJS({
|
6554 | "node_modules/pseudomap/map.js"(exports, module) {
|
6555 | if (process.env.npm_package_name === "pseudomap" && process.env.npm_lifecycle_script === "test")
|
6556 | process.env.TEST_PSEUDOMAP = "true";
|
6557 | if (typeof Map === "function" && !process.env.TEST_PSEUDOMAP) {
|
6558 | module.exports = Map;
|
6559 | } else {
|
6560 | module.exports = require_pseudomap();
|
6561 | }
|
6562 | }
|
6563 | });
|
6564 |
|
6565 |
|
6566 | var require_yallist = __commonJS({
|
6567 | "node_modules/yallist/yallist.js"(exports, module) {
|
6568 | module.exports = Yallist;
|
6569 | Yallist.Node = Node;
|
6570 | Yallist.create = Yallist;
|
6571 | function Yallist(list) {
|
6572 | var self = this;
|
6573 | if (!(self instanceof Yallist)) {
|
6574 | self = new Yallist();
|
6575 | }
|
6576 | self.tail = null;
|
6577 | self.head = null;
|
6578 | self.length = 0;
|
6579 | if (list && typeof list.forEach === "function") {
|
6580 | list.forEach(function(item) {
|
6581 | self.push(item);
|
6582 | });
|
6583 | } else if (arguments.length > 0) {
|
6584 | for (var i = 0, l = arguments.length; i < l; i++) {
|
6585 | self.push(arguments[i]);
|
6586 | }
|
6587 | }
|
6588 | return self;
|
6589 | }
|
6590 | Yallist.prototype.removeNode = function(node) {
|
6591 | if (node.list !== this) {
|
6592 | throw new Error("removing node which does not belong to this list");
|
6593 | }
|
6594 | var next = node.next;
|
6595 | var prev = node.prev;
|
6596 | if (next) {
|
6597 | next.prev = prev;
|
6598 | }
|
6599 | if (prev) {
|
6600 | prev.next = next;
|
6601 | }
|
6602 | if (node === this.head) {
|
6603 | this.head = next;
|
6604 | }
|
6605 | if (node === this.tail) {
|
6606 | this.tail = prev;
|
6607 | }
|
6608 | node.list.length--;
|
6609 | node.next = null;
|
6610 | node.prev = null;
|
6611 | node.list = null;
|
6612 | };
|
6613 | Yallist.prototype.unshiftNode = function(node) {
|
6614 | if (node === this.head) {
|
6615 | return;
|
6616 | }
|
6617 | if (node.list) {
|
6618 | node.list.removeNode(node);
|
6619 | }
|
6620 | var head = this.head;
|
6621 | node.list = this;
|
6622 | node.next = head;
|
6623 | if (head) {
|
6624 | head.prev = node;
|
6625 | }
|
6626 | this.head = node;
|
6627 | if (!this.tail) {
|
6628 | this.tail = node;
|
6629 | }
|
6630 | this.length++;
|
6631 | };
|
6632 | Yallist.prototype.pushNode = function(node) {
|
6633 | if (node === this.tail) {
|
6634 | return;
|
6635 | }
|
6636 | if (node.list) {
|
6637 | node.list.removeNode(node);
|
6638 | }
|
6639 | var tail = this.tail;
|
6640 | node.list = this;
|
6641 | node.prev = tail;
|
6642 | if (tail) {
|
6643 | tail.next = node;
|
6644 | }
|
6645 | this.tail = node;
|
6646 | if (!this.head) {
|
6647 | this.head = node;
|
6648 | }
|
6649 | this.length++;
|
6650 | };
|
6651 | Yallist.prototype.push = function() {
|
6652 | for (var i = 0, l = arguments.length; i < l; i++) {
|
6653 | push2(this, arguments[i]);
|
6654 | }
|
6655 | return this.length;
|
6656 | };
|
6657 | Yallist.prototype.unshift = function() {
|
6658 | for (var i = 0, l = arguments.length; i < l; i++) {
|
6659 | unshift(this, arguments[i]);
|
6660 | }
|
6661 | return this.length;
|
6662 | };
|
6663 | Yallist.prototype.pop = function() {
|
6664 | if (!this.tail) {
|
6665 | return void 0;
|
6666 | }
|
6667 | var res = this.tail.value;
|
6668 | this.tail = this.tail.prev;
|
6669 | if (this.tail) {
|
6670 | this.tail.next = null;
|
6671 | } else {
|
6672 | this.head = null;
|
6673 | }
|
6674 | this.length--;
|
6675 | return res;
|
6676 | };
|
6677 | Yallist.prototype.shift = function() {
|
6678 | if (!this.head) {
|
6679 | return void 0;
|
6680 | }
|
6681 | var res = this.head.value;
|
6682 | this.head = this.head.next;
|
6683 | if (this.head) {
|
6684 | this.head.prev = null;
|
6685 | } else {
|
6686 | this.tail = null;
|
6687 | }
|
6688 | this.length--;
|
6689 | return res;
|
6690 | };
|
6691 | Yallist.prototype.forEach = function(fn, thisp) {
|
6692 | thisp = thisp || this;
|
6693 | for (var walker = this.head, i = 0; walker !== null; i++) {
|
6694 | fn.call(thisp, walker.value, i, this);
|
6695 | walker = walker.next;
|
6696 | }
|
6697 | };
|
6698 | Yallist.prototype.forEachReverse = function(fn, thisp) {
|
6699 | thisp = thisp || this;
|
6700 | for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
|
6701 | fn.call(thisp, walker.value, i, this);
|
6702 | walker = walker.prev;
|
6703 | }
|
6704 | };
|
6705 | Yallist.prototype.get = function(n) {
|
6706 | for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
|
6707 | walker = walker.next;
|
6708 | }
|
6709 | if (i === n && walker !== null) {
|
6710 | return walker.value;
|
6711 | }
|
6712 | };
|
6713 | Yallist.prototype.getReverse = function(n) {
|
6714 | for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
|
6715 | walker = walker.prev;
|
6716 | }
|
6717 | if (i === n && walker !== null) {
|
6718 | return walker.value;
|
6719 | }
|
6720 | };
|
6721 | Yallist.prototype.map = function(fn, thisp) {
|
6722 | thisp = thisp || this;
|
6723 | var res = new Yallist();
|
6724 | for (var walker = this.head; walker !== null; ) {
|
6725 | res.push(fn.call(thisp, walker.value, this));
|
6726 | walker = walker.next;
|
6727 | }
|
6728 | return res;
|
6729 | };
|
6730 | Yallist.prototype.mapReverse = function(fn, thisp) {
|
6731 | thisp = thisp || this;
|
6732 | var res = new Yallist();
|
6733 | for (var walker = this.tail; walker !== null; ) {
|
6734 | res.push(fn.call(thisp, walker.value, this));
|
6735 | walker = walker.prev;
|
6736 | }
|
6737 | return res;
|
6738 | };
|
6739 | Yallist.prototype.reduce = function(fn, initial) {
|
6740 | var acc;
|
6741 | var walker = this.head;
|
6742 | if (arguments.length > 1) {
|
6743 | acc = initial;
|
6744 | } else if (this.head) {
|
6745 | walker = this.head.next;
|
6746 | acc = this.head.value;
|
6747 | } else {
|
6748 | throw new TypeError("Reduce of empty list with no initial value");
|
6749 | }
|
6750 | for (var i = 0; walker !== null; i++) {
|
6751 | acc = fn(acc, walker.value, i);
|
6752 | walker = walker.next;
|
6753 | }
|
6754 | return acc;
|
6755 | };
|
6756 | Yallist.prototype.reduceReverse = function(fn, initial) {
|
6757 | var acc;
|
6758 | var walker = this.tail;
|
6759 | if (arguments.length > 1) {
|
6760 | acc = initial;
|
6761 | } else if (this.tail) {
|
6762 | walker = this.tail.prev;
|
6763 | acc = this.tail.value;
|
6764 | } else {
|
6765 | throw new TypeError("Reduce of empty list with no initial value");
|
6766 | }
|
6767 | for (var i = this.length - 1; walker !== null; i--) {
|
6768 | acc = fn(acc, walker.value, i);
|
6769 | walker = walker.prev;
|
6770 | }
|
6771 | return acc;
|
6772 | };
|
6773 | Yallist.prototype.toArray = function() {
|
6774 | var arr = new Array(this.length);
|
6775 | for (var i = 0, walker = this.head; walker !== null; i++) {
|
6776 | arr[i] = walker.value;
|
6777 | walker = walker.next;
|
6778 | }
|
6779 | return arr;
|
6780 | };
|
6781 | Yallist.prototype.toArrayReverse = function() {
|
6782 | var arr = new Array(this.length);
|
6783 | for (var i = 0, walker = this.tail; walker !== null; i++) {
|
6784 | arr[i] = walker.value;
|
6785 | walker = walker.prev;
|
6786 | }
|
6787 | return arr;
|
6788 | };
|
6789 | Yallist.prototype.slice = function(from, to) {
|
6790 | to = to || this.length;
|
6791 | if (to < 0) {
|
6792 | to += this.length;
|
6793 | }
|
6794 | from = from || 0;
|
6795 | if (from < 0) {
|
6796 | from += this.length;
|
6797 | }
|
6798 | var ret = new Yallist();
|
6799 | if (to < from || to < 0) {
|
6800 | return ret;
|
6801 | }
|
6802 | if (from < 0) {
|
6803 | from = 0;
|
6804 | }
|
6805 | if (to > this.length) {
|
6806 | to = this.length;
|
6807 | }
|
6808 | for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
|
6809 | walker = walker.next;
|
6810 | }
|
6811 | for (; walker !== null && i < to; i++, walker = walker.next) {
|
6812 | ret.push(walker.value);
|
6813 | }
|
6814 | return ret;
|
6815 | };
|
6816 | Yallist.prototype.sliceReverse = function(from, to) {
|
6817 | to = to || this.length;
|
6818 | if (to < 0) {
|
6819 | to += this.length;
|
6820 | }
|
6821 | from = from || 0;
|
6822 | if (from < 0) {
|
6823 | from += this.length;
|
6824 | }
|
6825 | var ret = new Yallist();
|
6826 | if (to < from || to < 0) {
|
6827 | return ret;
|
6828 | }
|
6829 | if (from < 0) {
|
6830 | from = 0;
|
6831 | }
|
6832 | if (to > this.length) {
|
6833 | to = this.length;
|
6834 | }
|
6835 | for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
|
6836 | walker = walker.prev;
|
6837 | }
|
6838 | for (; walker !== null && i > from; i--, walker = walker.prev) {
|
6839 | ret.push(walker.value);
|
6840 | }
|
6841 | return ret;
|
6842 | };
|
6843 | Yallist.prototype.reverse = function() {
|
6844 | var head = this.head;
|
6845 | var tail = this.tail;
|
6846 | for (var walker = head; walker !== null; walker = walker.prev) {
|
6847 | var p = walker.prev;
|
6848 | walker.prev = walker.next;
|
6849 | walker.next = p;
|
6850 | }
|
6851 | this.head = tail;
|
6852 | this.tail = head;
|
6853 | return this;
|
6854 | };
|
6855 | function push2(self, item) {
|
6856 | self.tail = new Node(item, self.tail, null, self);
|
6857 | if (!self.head) {
|
6858 | self.head = self.tail;
|
6859 | }
|
6860 | self.length++;
|
6861 | }
|
6862 | function unshift(self, item) {
|
6863 | self.head = new Node(item, null, self.head, self);
|
6864 | if (!self.tail) {
|
6865 | self.tail = self.head;
|
6866 | }
|
6867 | self.length++;
|
6868 | }
|
6869 | function Node(value, prev, next, list) {
|
6870 | if (!(this instanceof Node)) {
|
6871 | return new Node(value, prev, next, list);
|
6872 | }
|
6873 | this.list = list;
|
6874 | this.value = value;
|
6875 | if (prev) {
|
6876 | prev.next = this;
|
6877 | this.prev = prev;
|
6878 | } else {
|
6879 | this.prev = null;
|
6880 | }
|
6881 | if (next) {
|
6882 | next.prev = this;
|
6883 | this.next = next;
|
6884 | } else {
|
6885 | this.next = null;
|
6886 | }
|
6887 | }
|
6888 | }
|
6889 | });
|
6890 |
|
6891 |
|
6892 | var require_lru_cache = __commonJS({
|
6893 | "node_modules/lru-cache/index.js"(exports, module) {
|
6894 | "use strict";
|
6895 | module.exports = LRUCache;
|
6896 | var Map2 = require_map();
|
6897 | var util2 = __require("util");
|
6898 | var Yallist = require_yallist();
|
6899 | var hasSymbol = typeof Symbol === "function" && process.env._nodeLRUCacheForceNoSymbol !== "1";
|
6900 | var makeSymbol;
|
6901 | if (hasSymbol) {
|
6902 | makeSymbol = function(key2) {
|
6903 | return Symbol(key2);
|
6904 | };
|
6905 | } else {
|
6906 | makeSymbol = function(key2) {
|
6907 | return "_" + key2;
|
6908 | };
|
6909 | }
|
6910 | var MAX = makeSymbol("max");
|
6911 | var LENGTH = makeSymbol("length");
|
6912 | var LENGTH_CALCULATOR = makeSymbol("lengthCalculator");
|
6913 | var ALLOW_STALE = makeSymbol("allowStale");
|
6914 | var MAX_AGE = makeSymbol("maxAge");
|
6915 | var DISPOSE = makeSymbol("dispose");
|
6916 | var NO_DISPOSE_ON_SET = makeSymbol("noDisposeOnSet");
|
6917 | var LRU_LIST = makeSymbol("lruList");
|
6918 | var CACHE = makeSymbol("cache");
|
6919 | function naiveLength() {
|
6920 | return 1;
|
6921 | }
|
6922 | function LRUCache(options8) {
|
6923 | if (!(this instanceof LRUCache)) {
|
6924 | return new LRUCache(options8);
|
6925 | }
|
6926 | if (typeof options8 === "number") {
|
6927 | options8 = { max: options8 };
|
6928 | }
|
6929 | if (!options8) {
|
6930 | options8 = {};
|
6931 | }
|
6932 | var max = this[MAX] = options8.max;
|
6933 | if (!max || !(typeof max === "number") || max <= 0) {
|
6934 | this[MAX] = Infinity;
|
6935 | }
|
6936 | var lc = options8.length || naiveLength;
|
6937 | if (typeof lc !== "function") {
|
6938 | lc = naiveLength;
|
6939 | }
|
6940 | this[LENGTH_CALCULATOR] = lc;
|
6941 | this[ALLOW_STALE] = options8.stale || false;
|
6942 | this[MAX_AGE] = options8.maxAge || 0;
|
6943 | this[DISPOSE] = options8.dispose;
|
6944 | this[NO_DISPOSE_ON_SET] = options8.noDisposeOnSet || false;
|
6945 | this.reset();
|
6946 | }
|
6947 | Object.defineProperty(LRUCache.prototype, "max", {
|
6948 | set: function(mL) {
|
6949 | if (!mL || !(typeof mL === "number") || mL <= 0) {
|
6950 | mL = Infinity;
|
6951 | }
|
6952 | this[MAX] = mL;
|
6953 | trim2(this);
|
6954 | },
|
6955 | get: function() {
|
6956 | return this[MAX];
|
6957 | },
|
6958 | enumerable: true
|
6959 | });
|
6960 | Object.defineProperty(LRUCache.prototype, "allowStale", {
|
6961 | set: function(allowStale) {
|
6962 | this[ALLOW_STALE] = !!allowStale;
|
6963 | },
|
6964 | get: function() {
|
6965 | return this[ALLOW_STALE];
|
6966 | },
|
6967 | enumerable: true
|
6968 | });
|
6969 | Object.defineProperty(LRUCache.prototype, "maxAge", {
|
6970 | set: function(mA) {
|
6971 | if (!mA || !(typeof mA === "number") || mA < 0) {
|
6972 | mA = 0;
|
6973 | }
|
6974 | this[MAX_AGE] = mA;
|
6975 | trim2(this);
|
6976 | },
|
6977 | get: function() {
|
6978 | return this[MAX_AGE];
|
6979 | },
|
6980 | enumerable: true
|
6981 | });
|
6982 | Object.defineProperty(LRUCache.prototype, "lengthCalculator", {
|
6983 | set: function(lC) {
|
6984 | if (typeof lC !== "function") {
|
6985 | lC = naiveLength;
|
6986 | }
|
6987 | if (lC !== this[LENGTH_CALCULATOR]) {
|
6988 | this[LENGTH_CALCULATOR] = lC;
|
6989 | this[LENGTH] = 0;
|
6990 | this[LRU_LIST].forEach(function(hit) {
|
6991 | hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
|
6992 | this[LENGTH] += hit.length;
|
6993 | }, this);
|
6994 | }
|
6995 | trim2(this);
|
6996 | },
|
6997 | get: function() {
|
6998 | return this[LENGTH_CALCULATOR];
|
6999 | },
|
7000 | enumerable: true
|
7001 | });
|
7002 | Object.defineProperty(LRUCache.prototype, "length", {
|
7003 | get: function() {
|
7004 | return this[LENGTH];
|
7005 | },
|
7006 | enumerable: true
|
7007 | });
|
7008 | Object.defineProperty(LRUCache.prototype, "itemCount", {
|
7009 | get: function() {
|
7010 | return this[LRU_LIST].length;
|
7011 | },
|
7012 | enumerable: true
|
7013 | });
|
7014 | LRUCache.prototype.rforEach = function(fn, thisp) {
|
7015 | thisp = thisp || this;
|
7016 | for (var walker = this[LRU_LIST].tail; walker !== null; ) {
|
7017 | var prev = walker.prev;
|
7018 | forEachStep(this, fn, walker, thisp);
|
7019 | walker = prev;
|
7020 | }
|
7021 | };
|
7022 | function forEachStep(self, fn, node, thisp) {
|
7023 | var hit = node.value;
|
7024 | if (isStale(self, hit)) {
|
7025 | del(self, node);
|
7026 | if (!self[ALLOW_STALE]) {
|
7027 | hit = void 0;
|
7028 | }
|
7029 | }
|
7030 | if (hit) {
|
7031 | fn.call(thisp, hit.value, hit.key, self);
|
7032 | }
|
7033 | }
|
7034 | LRUCache.prototype.forEach = function(fn, thisp) {
|
7035 | thisp = thisp || this;
|
7036 | for (var walker = this[LRU_LIST].head; walker !== null; ) {
|
7037 | var next = walker.next;
|
7038 | forEachStep(this, fn, walker, thisp);
|
7039 | walker = next;
|
7040 | }
|
7041 | };
|
7042 | LRUCache.prototype.keys = function() {
|
7043 | return this[LRU_LIST].toArray().map(function(k) {
|
7044 | return k.key;
|
7045 | }, this);
|
7046 | };
|
7047 | LRUCache.prototype.values = function() {
|
7048 | return this[LRU_LIST].toArray().map(function(k) {
|
7049 | return k.value;
|
7050 | }, this);
|
7051 | };
|
7052 | LRUCache.prototype.reset = function() {
|
7053 | if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) {
|
7054 | this[LRU_LIST].forEach(function(hit) {
|
7055 | this[DISPOSE](hit.key, hit.value);
|
7056 | }, this);
|
7057 | }
|
7058 | this[CACHE] = new Map2();
|
7059 | this[LRU_LIST] = new Yallist();
|
7060 | this[LENGTH] = 0;
|
7061 | };
|
7062 | LRUCache.prototype.dump = function() {
|
7063 | return this[LRU_LIST].map(function(hit) {
|
7064 | if (!isStale(this, hit)) {
|
7065 | return {
|
7066 | k: hit.key,
|
7067 | v: hit.value,
|
7068 | e: hit.now + (hit.maxAge || 0)
|
7069 | };
|
7070 | }
|
7071 | }, this).toArray().filter(function(h) {
|
7072 | return h;
|
7073 | });
|
7074 | };
|
7075 | LRUCache.prototype.dumpLru = function() {
|
7076 | return this[LRU_LIST];
|
7077 | };
|
7078 | LRUCache.prototype.inspect = function(n, opts) {
|
7079 | var str2 = "LRUCache {";
|
7080 | var extras = false;
|
7081 | var as = this[ALLOW_STALE];
|
7082 | if (as) {
|
7083 | str2 += "\n allowStale: true";
|
7084 | extras = true;
|
7085 | }
|
7086 | var max = this[MAX];
|
7087 | if (max && max !== Infinity) {
|
7088 | if (extras) {
|
7089 | str2 += ",";
|
7090 | }
|
7091 | str2 += "\n max: " + util2.inspect(max, opts);
|
7092 | extras = true;
|
7093 | }
|
7094 | var maxAge = this[MAX_AGE];
|
7095 | if (maxAge) {
|
7096 | if (extras) {
|
7097 | str2 += ",";
|
7098 | }
|
7099 | str2 += "\n maxAge: " + util2.inspect(maxAge, opts);
|
7100 | extras = true;
|
7101 | }
|
7102 | var lc = this[LENGTH_CALCULATOR];
|
7103 | if (lc && lc !== naiveLength) {
|
7104 | if (extras) {
|
7105 | str2 += ",";
|
7106 | }
|
7107 | str2 += "\n length: " + util2.inspect(this[LENGTH], opts);
|
7108 | extras = true;
|
7109 | }
|
7110 | var didFirst = false;
|
7111 | this[LRU_LIST].forEach(function(item) {
|
7112 | if (didFirst) {
|
7113 | str2 += ",\n ";
|
7114 | } else {
|
7115 | if (extras) {
|
7116 | str2 += ",\n";
|
7117 | }
|
7118 | didFirst = true;
|
7119 | str2 += "\n ";
|
7120 | }
|
7121 | var key2 = util2.inspect(item.key).split("\n").join("\n ");
|
7122 | var val = { value: item.value };
|
7123 | if (item.maxAge !== maxAge) {
|
7124 | val.maxAge = item.maxAge;
|
7125 | }
|
7126 | if (lc !== naiveLength) {
|
7127 | val.length = item.length;
|
7128 | }
|
7129 | if (isStale(this, item)) {
|
7130 | val.stale = true;
|
7131 | }
|
7132 | val = util2.inspect(val, opts).split("\n").join("\n ");
|
7133 | str2 += key2 + " => " + val;
|
7134 | });
|
7135 | if (didFirst || extras) {
|
7136 | str2 += "\n";
|
7137 | }
|
7138 | str2 += "}";
|
7139 | return str2;
|
7140 | };
|
7141 | LRUCache.prototype.set = function(key2, value, maxAge) {
|
7142 | maxAge = maxAge || this[MAX_AGE];
|
7143 | var now = maxAge ? Date.now() : 0;
|
7144 | var len = this[LENGTH_CALCULATOR](value, key2);
|
7145 | if (this[CACHE].has(key2)) {
|
7146 | if (len > this[MAX]) {
|
7147 | del(this, this[CACHE].get(key2));
|
7148 | return false;
|
7149 | }
|
7150 | var node = this[CACHE].get(key2);
|
7151 | var item = node.value;
|
7152 | if (this[DISPOSE]) {
|
7153 | if (!this[NO_DISPOSE_ON_SET]) {
|
7154 | this[DISPOSE](key2, item.value);
|
7155 | }
|
7156 | }
|
7157 | item.now = now;
|
7158 | item.maxAge = maxAge;
|
7159 | item.value = value;
|
7160 | this[LENGTH] += len - item.length;
|
7161 | item.length = len;
|
7162 | this.get(key2);
|
7163 | trim2(this);
|
7164 | return true;
|
7165 | }
|
7166 | var hit = new Entry(key2, value, len, now, maxAge);
|
7167 | if (hit.length > this[MAX]) {
|
7168 | if (this[DISPOSE]) {
|
7169 | this[DISPOSE](key2, value);
|
7170 | }
|
7171 | return false;
|
7172 | }
|
7173 | this[LENGTH] += hit.length;
|
7174 | this[LRU_LIST].unshift(hit);
|
7175 | this[CACHE].set(key2, this[LRU_LIST].head);
|
7176 | trim2(this);
|
7177 | return true;
|
7178 | };
|
7179 | LRUCache.prototype.has = function(key2) {
|
7180 | if (!this[CACHE].has(key2)) return false;
|
7181 | var hit = this[CACHE].get(key2).value;
|
7182 | if (isStale(this, hit)) {
|
7183 | return false;
|
7184 | }
|
7185 | return true;
|
7186 | };
|
7187 | LRUCache.prototype.get = function(key2) {
|
7188 | return get(this, key2, true);
|
7189 | };
|
7190 | LRUCache.prototype.peek = function(key2) {
|
7191 | return get(this, key2, false);
|
7192 | };
|
7193 | LRUCache.prototype.pop = function() {
|
7194 | var node = this[LRU_LIST].tail;
|
7195 | if (!node) return null;
|
7196 | del(this, node);
|
7197 | return node.value;
|
7198 | };
|
7199 | LRUCache.prototype.del = function(key2) {
|
7200 | del(this, this[CACHE].get(key2));
|
7201 | };
|
7202 | LRUCache.prototype.load = function(arr) {
|
7203 | this.reset();
|
7204 | var now = Date.now();
|
7205 | for (var l = arr.length - 1; l >= 0; l--) {
|
7206 | var hit = arr[l];
|
7207 | var expiresAt = hit.e || 0;
|
7208 | if (expiresAt === 0) {
|
7209 | this.set(hit.k, hit.v);
|
7210 | } else {
|
7211 | var maxAge = expiresAt - now;
|
7212 | if (maxAge > 0) {
|
7213 | this.set(hit.k, hit.v, maxAge);
|
7214 | }
|
7215 | }
|
7216 | }
|
7217 | };
|
7218 | LRUCache.prototype.prune = function() {
|
7219 | var self = this;
|
7220 | this[CACHE].forEach(function(value, key2) {
|
7221 | get(self, key2, false);
|
7222 | });
|
7223 | };
|
7224 | function get(self, key2, doUse) {
|
7225 | var node = self[CACHE].get(key2);
|
7226 | if (node) {
|
7227 | var hit = node.value;
|
7228 | if (isStale(self, hit)) {
|
7229 | del(self, node);
|
7230 | if (!self[ALLOW_STALE]) hit = void 0;
|
7231 | } else {
|
7232 | if (doUse) {
|
7233 | self[LRU_LIST].unshiftNode(node);
|
7234 | }
|
7235 | }
|
7236 | if (hit) hit = hit.value;
|
7237 | }
|
7238 | return hit;
|
7239 | }
|
7240 | function isStale(self, hit) {
|
7241 | if (!hit || !hit.maxAge && !self[MAX_AGE]) {
|
7242 | return false;
|
7243 | }
|
7244 | var stale = false;
|
7245 | var diff2 = Date.now() - hit.now;
|
7246 | if (hit.maxAge) {
|
7247 | stale = diff2 > hit.maxAge;
|
7248 | } else {
|
7249 | stale = self[MAX_AGE] && diff2 > self[MAX_AGE];
|
7250 | }
|
7251 | return stale;
|
7252 | }
|
7253 | function trim2(self) {
|
7254 | if (self[LENGTH] > self[MAX]) {
|
7255 | for (var walker = self[LRU_LIST].tail; self[LENGTH] > self[MAX] && walker !== null; ) {
|
7256 | var prev = walker.prev;
|
7257 | del(self, walker);
|
7258 | walker = prev;
|
7259 | }
|
7260 | }
|
7261 | }
|
7262 | function del(self, node) {
|
7263 | if (node) {
|
7264 | var hit = node.value;
|
7265 | if (self[DISPOSE]) {
|
7266 | self[DISPOSE](hit.key, hit.value);
|
7267 | }
|
7268 | self[LENGTH] -= hit.length;
|
7269 | self[CACHE].delete(hit.key);
|
7270 | self[LRU_LIST].removeNode(node);
|
7271 | }
|
7272 | }
|
7273 | function Entry(key2, value, length, now, maxAge) {
|
7274 | this.key = key2;
|
7275 | this.value = value;
|
7276 | this.length = length;
|
7277 | this.now = now;
|
7278 | this.maxAge = maxAge || 0;
|
7279 | }
|
7280 | }
|
7281 | });
|
7282 |
|
7283 |
|
7284 | var require_sigmund = __commonJS({
|
7285 | "node_modules/sigmund/sigmund.js"(exports, module) {
|
7286 | module.exports = sigmund;
|
7287 | function sigmund(subject, maxSessions) {
|
7288 | maxSessions = maxSessions || 10;
|
7289 | var notes = [];
|
7290 | var analysis = "";
|
7291 | var RE = RegExp;
|
7292 | function psychoAnalyze(subject2, session) {
|
7293 | if (session > maxSessions) return;
|
7294 | if (typeof subject2 === "function" || typeof subject2 === "undefined") {
|
7295 | return;
|
7296 | }
|
7297 | if (typeof subject2 !== "object" || !subject2 || subject2 instanceof RE) {
|
7298 | analysis += subject2;
|
7299 | return;
|
7300 | }
|
7301 | if (notes.indexOf(subject2) !== -1 || session === maxSessions) return;
|
7302 | notes.push(subject2);
|
7303 | analysis += "{";
|
7304 | Object.keys(subject2).forEach(function(issue, _, __) {
|
7305 | if (issue.charAt(0) === "_") return;
|
7306 | var to = typeof subject2[issue];
|
7307 | if (to === "function" || to === "undefined") return;
|
7308 | analysis += issue;
|
7309 | psychoAnalyze(subject2[issue], session + 1);
|
7310 | });
|
7311 | }
|
7312 | psychoAnalyze(subject, 0);
|
7313 | return analysis;
|
7314 | }
|
7315 | }
|
7316 | });
|
7317 |
|
7318 |
|
7319 | var require_fnmatch = __commonJS({
|
7320 | "node_modules/editorconfig/src/lib/fnmatch.js"(exports, module) {
|
7321 | var platform = typeof process === "object" ? process.platform : "win32";
|
7322 | if (module) module.exports = minimatch;
|
7323 | else exports.minimatch = minimatch;
|
7324 | minimatch.Minimatch = Minimatch;
|
7325 | var LRU = require_lru_cache();
|
7326 | var cache3 = minimatch.cache = new LRU({ max: 100 });
|
7327 | var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {};
|
7328 | var sigmund = require_sigmund();
|
7329 | var path13 = __require("path");
|
7330 | var qmark = "[^/]";
|
7331 | var star = qmark + "*?";
|
7332 | var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
|
7333 | var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
|
7334 | var reSpecials = charSet("().*{}+?[]^$\\!");
|
7335 | function charSet(s) {
|
7336 | return s.split("").reduce(function(set2, c2) {
|
7337 | set2[c2] = true;
|
7338 | return set2;
|
7339 | }, {});
|
7340 | }
|
7341 | var slashSplit = /\/+/;
|
7342 | minimatch.monkeyPatch = monkeyPatch;
|
7343 | function monkeyPatch() {
|
7344 | var desc = Object.getOwnPropertyDescriptor(String.prototype, "match");
|
7345 | var orig = desc.value;
|
7346 | desc.value = function(p) {
|
7347 | if (p instanceof Minimatch) return p.match(this);
|
7348 | return orig.call(this, p);
|
7349 | };
|
7350 | Object.defineProperty(String.prototype, desc);
|
7351 | }
|
7352 | minimatch.filter = filter2;
|
7353 | function filter2(pattern, options8) {
|
7354 | options8 = options8 || {};
|
7355 | return function(p, i, list) {
|
7356 | return minimatch(p, pattern, options8);
|
7357 | };
|
7358 | }
|
7359 | function ext(a, b) {
|
7360 | a = a || {};
|
7361 | b = b || {};
|
7362 | var t = {};
|
7363 | Object.keys(b).forEach(function(k) {
|
7364 | t[k] = b[k];
|
7365 | });
|
7366 | Object.keys(a).forEach(function(k) {
|
7367 | t[k] = a[k];
|
7368 | });
|
7369 | return t;
|
7370 | }
|
7371 | minimatch.defaults = function(def) {
|
7372 | if (!def || !Object.keys(def).length) return minimatch;
|
7373 | var orig = minimatch;
|
7374 | var m = function minimatch2(p, pattern, options8) {
|
7375 | return orig.minimatch(p, pattern, ext(def, options8));
|
7376 | };
|
7377 | m.Minimatch = function Minimatch2(pattern, options8) {
|
7378 | return new orig.Minimatch(pattern, ext(def, options8));
|
7379 | };
|
7380 | return m;
|
7381 | };
|
7382 | Minimatch.defaults = function(def) {
|
7383 | if (!def || !Object.keys(def).length) return Minimatch;
|
7384 | return minimatch.defaults(def).Minimatch;
|
7385 | };
|
7386 | function minimatch(p, pattern, options8) {
|
7387 | if (typeof pattern !== "string") {
|
7388 | throw new TypeError("glob pattern string required");
|
7389 | }
|
7390 | if (!options8) options8 = {};
|
7391 | if (!options8.nocomment && pattern.charAt(0) === "#") {
|
7392 | return false;
|
7393 | }
|
7394 | if (pattern.trim() === "") return p === "";
|
7395 | return new Minimatch(pattern, options8).match(p);
|
7396 | }
|
7397 | function Minimatch(pattern, options8) {
|
7398 | if (!(this instanceof Minimatch)) {
|
7399 | return new Minimatch(pattern, options8, cache3);
|
7400 | }
|
7401 | if (typeof pattern !== "string") {
|
7402 | throw new TypeError("glob pattern string required");
|
7403 | }
|
7404 | if (!options8) options8 = {};
|
7405 | if (platform === "win32") {
|
7406 | pattern = pattern.split("\\").join("/");
|
7407 | }
|
7408 | var cacheKey = pattern + "\n" + sigmund(options8);
|
7409 | var cached = minimatch.cache.get(cacheKey);
|
7410 | if (cached) return cached;
|
7411 | minimatch.cache.set(cacheKey, this);
|
7412 | this.options = options8;
|
7413 | this.set = [];
|
7414 | this.pattern = pattern;
|
7415 | this.regexp = null;
|
7416 | this.negate = false;
|
7417 | this.comment = false;
|
7418 | this.empty = false;
|
7419 | this.make();
|
7420 | }
|
7421 | Minimatch.prototype.make = make;
|
7422 | function make() {
|
7423 | if (this._made) return;
|
7424 | var pattern = this.pattern;
|
7425 | var options8 = this.options;
|
7426 | if (!options8.nocomment && pattern.charAt(0) === "#") {
|
7427 | this.comment = true;
|
7428 | return;
|
7429 | }
|
7430 | if (!pattern) {
|
7431 | this.empty = true;
|
7432 | return;
|
7433 | }
|
7434 | this.parseNegate();
|
7435 | var set2 = this.globSet = this.braceExpand();
|
7436 | if (options8.debug) console.error(this.pattern, set2);
|
7437 | set2 = this.globParts = set2.map(function(s) {
|
7438 | return s.split(slashSplit);
|
7439 | });
|
7440 | if (options8.debug) console.error(this.pattern, set2);
|
7441 | set2 = set2.map(function(s, si, set3) {
|
7442 | return s.map(this.parse, this);
|
7443 | }, this);
|
7444 | if (options8.debug) console.error(this.pattern, set2);
|
7445 | set2 = set2.filter(function(s) {
|
7446 | return -1 === s.indexOf(false);
|
7447 | });
|
7448 | if (options8.debug) console.error(this.pattern, set2);
|
7449 | this.set = set2;
|
7450 | }
|
7451 | Minimatch.prototype.parseNegate = parseNegate;
|
7452 | function parseNegate() {
|
7453 | var pattern = this.pattern, negate = false, options8 = this.options, negateOffset = 0;
|
7454 | if (options8.nonegate) return;
|
7455 | for (var i = 0, l = pattern.length; i < l && pattern.charAt(i) === "!"; i++) {
|
7456 | negate = !negate;
|
7457 | negateOffset++;
|
7458 | }
|
7459 | if (negateOffset) this.pattern = pattern.substr(negateOffset);
|
7460 | this.negate = negate;
|
7461 | }
|
7462 | minimatch.braceExpand = function(pattern, options8) {
|
7463 | return new Minimatch(pattern, options8).braceExpand();
|
7464 | };
|
7465 | Minimatch.prototype.braceExpand = braceExpand;
|
7466 | function braceExpand(pattern, options8) {
|
7467 | options8 = options8 || this.options;
|
7468 | pattern = typeof pattern === "undefined" ? this.pattern : pattern;
|
7469 | if (typeof pattern === "undefined") {
|
7470 | throw new Error("undefined pattern");
|
7471 | }
|
7472 | if (options8.nobrace || !pattern.match(/\{.*\}/)) {
|
7473 | return [pattern];
|
7474 | }
|
7475 | var escaping = false;
|
7476 | if (pattern.charAt(0) !== "{") {
|
7477 | var prefix = null;
|
7478 | for (var i = 0, l = pattern.length; i < l; i++) {
|
7479 | var c2 = pattern.charAt(i);
|
7480 | if (c2 === "\\") {
|
7481 | escaping = !escaping;
|
7482 | } else if (c2 === "{" && !escaping) {
|
7483 | prefix = pattern.substr(0, i);
|
7484 | break;
|
7485 | }
|
7486 | }
|
7487 | if (prefix === null) {
|
7488 | return [pattern];
|
7489 | }
|
7490 | var tail = braceExpand(pattern.substr(i), options8);
|
7491 | return tail.map(function(t) {
|
7492 | return prefix + t;
|
7493 | });
|
7494 | }
|
7495 | var numset = pattern.match(/^\{(-?[0-9]+)\.\.(-?[0-9]+)\}/);
|
7496 | if (numset) {
|
7497 | var suf = braceExpand(pattern.substr(numset[0].length), options8), start = +numset[1], end = +numset[2], inc = start > end ? -1 : 1, set2 = [];
|
7498 | for (var i = start; i != end + inc; i += inc) {
|
7499 | for (var ii = 0, ll = suf.length; ii < ll; ii++) {
|
7500 | set2.push(i + suf[ii]);
|
7501 | }
|
7502 | }
|
7503 | return set2;
|
7504 | }
|
7505 | var i = 1, depth = 1, set2 = [], member = "", sawEnd = false, escaping = false;
|
7506 | function addMember() {
|
7507 | set2.push(member);
|
7508 | member = "";
|
7509 | }
|
7510 | FOR: for (i = 1, l = pattern.length; i < l; i++) {
|
7511 | var c2 = pattern.charAt(i);
|
7512 | if (escaping) {
|
7513 | escaping = false;
|
7514 | member += "\\" + c2;
|
7515 | } else {
|
7516 | switch (c2) {
|
7517 | case "\\":
|
7518 | escaping = true;
|
7519 | continue;
|
7520 | case "{":
|
7521 | depth++;
|
7522 | member += "{";
|
7523 | continue;
|
7524 | case "}":
|
7525 | depth--;
|
7526 | if (depth === 0) {
|
7527 | addMember();
|
7528 | i++;
|
7529 | break FOR;
|
7530 | } else {
|
7531 | member += c2;
|
7532 | continue;
|
7533 | }
|
7534 | case ",":
|
7535 | if (depth === 1) {
|
7536 | addMember();
|
7537 | } else {
|
7538 | member += c2;
|
7539 | }
|
7540 | continue;
|
7541 | default:
|
7542 | member += c2;
|
7543 | continue;
|
7544 | }
|
7545 | }
|
7546 | }
|
7547 | if (depth !== 0) {
|
7548 | return braceExpand("\\" + pattern, options8);
|
7549 | }
|
7550 | var suf = braceExpand(pattern.substr(i), options8);
|
7551 | var addBraces = set2.length === 1;
|
7552 | set2 = set2.map(function(p) {
|
7553 | return braceExpand(p, options8);
|
7554 | });
|
7555 | set2 = set2.reduce(function(l2, r) {
|
7556 | return l2.concat(r);
|
7557 | });
|
7558 | if (addBraces) {
|
7559 | set2 = set2.map(function(s) {
|
7560 | return "{" + s + "}";
|
7561 | });
|
7562 | }
|
7563 | var ret = [];
|
7564 | for (var i = 0, l = set2.length; i < l; i++) {
|
7565 | for (var ii = 0, ll = suf.length; ii < ll; ii++) {
|
7566 | ret.push(set2[i] + suf[ii]);
|
7567 | }
|
7568 | }
|
7569 | return ret;
|
7570 | }
|
7571 | Minimatch.prototype.parse = parse6;
|
7572 | var SUBPARSE = {};
|
7573 | function parse6(pattern, isSub) {
|
7574 | var options8 = this.options;
|
7575 | if (!options8.noglobstar && pattern === "**") return GLOBSTAR;
|
7576 | if (pattern === "") return "";
|
7577 | var re = "", hasMagic = !!options8.nocase, escaping = false, patternListStack = [], plType, stateChar, inClass = false, reClassStart = -1, classStart = -1, patternStart = pattern.charAt(0) === "." ? "" : options8.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
|
7578 | function clearStateChar() {
|
7579 | if (stateChar) {
|
7580 | switch (stateChar) {
|
7581 | case "*":
|
7582 | re += star;
|
7583 | hasMagic = true;
|
7584 | break;
|
7585 | case "?":
|
7586 | re += qmark;
|
7587 | hasMagic = true;
|
7588 | break;
|
7589 | default:
|
7590 | re += "\\" + stateChar;
|
7591 | break;
|
7592 | }
|
7593 | stateChar = false;
|
7594 | }
|
7595 | }
|
7596 | for (var i = 0, len = pattern.length, c2; i < len && (c2 = pattern.charAt(i)); i++) {
|
7597 | if (options8.debug) {
|
7598 | console.error("%s %s %s %j", pattern, i, re, c2);
|
7599 | }
|
7600 | if (escaping && reSpecials[c2]) {
|
7601 | re += "\\" + c2;
|
7602 | escaping = false;
|
7603 | continue;
|
7604 | }
|
7605 | SWITCH: switch (c2) {
|
7606 | case "/":
|
7607 | return false;
|
7608 | case "\\":
|
7609 | clearStateChar();
|
7610 | escaping = true;
|
7611 | continue;
|
7612 | case "?":
|
7613 | case "*":
|
7614 | case "+":
|
7615 | case "@":
|
7616 | case "!":
|
7617 | if (options8.debug) {
|
7618 | console.error("%s %s %s %j <-- stateChar", pattern, i, re, c2);
|
7619 | }
|
7620 | if (inClass) {
|
7621 | if (c2 === "!" && i === classStart + 1) c2 = "^";
|
7622 | re += c2;
|
7623 | continue;
|
7624 | }
|
7625 | clearStateChar();
|
7626 | stateChar = c2;
|
7627 | if (options8.noext) clearStateChar();
|
7628 | continue;
|
7629 | case "(":
|
7630 | if (inClass) {
|
7631 | re += "(";
|
7632 | continue;
|
7633 | }
|
7634 | if (!stateChar) {
|
7635 | re += "\\(";
|
7636 | continue;
|
7637 | }
|
7638 | plType = stateChar;
|
7639 | patternListStack.push({
|
7640 | type: plType,
|
7641 | start: i - 1,
|
7642 | reStart: re.length
|
7643 | });
|
7644 | re += stateChar === "!" ? "(?:(?!" : "(?:";
|
7645 | stateChar = false;
|
7646 | continue;
|
7647 | case ")":
|
7648 | if (inClass || !patternListStack.length) {
|
7649 | re += "\\)";
|
7650 | continue;
|
7651 | }
|
7652 | hasMagic = true;
|
7653 | re += ")";
|
7654 | plType = patternListStack.pop().type;
|
7655 | switch (plType) {
|
7656 | case "!":
|
7657 | re += "[^/]*?)";
|
7658 | break;
|
7659 | case "?":
|
7660 | case "+":
|
7661 | case "*":
|
7662 | re += plType;
|
7663 | case "@":
|
7664 | break;
|
7665 | }
|
7666 | continue;
|
7667 | case "|":
|
7668 | if (inClass || !patternListStack.length || escaping) {
|
7669 | re += "\\|";
|
7670 | escaping = false;
|
7671 | continue;
|
7672 | }
|
7673 | re += "|";
|
7674 | continue;
|
7675 | case "[":
|
7676 | clearStateChar();
|
7677 | if (inClass) {
|
7678 | re += "\\" + c2;
|
7679 | continue;
|
7680 | }
|
7681 | inClass = true;
|
7682 | classStart = i;
|
7683 | reClassStart = re.length;
|
7684 | re += c2;
|
7685 | continue;
|
7686 | case "]":
|
7687 | if (i === classStart + 1 || !inClass) {
|
7688 | re += "\\" + c2;
|
7689 | escaping = false;
|
7690 | continue;
|
7691 | }
|
7692 | hasMagic = true;
|
7693 | inClass = false;
|
7694 | re += c2;
|
7695 | continue;
|
7696 | default:
|
7697 | clearStateChar();
|
7698 | if (escaping) {
|
7699 | escaping = false;
|
7700 | } else if (reSpecials[c2] && !(c2 === "^" && inClass)) {
|
7701 | re += "\\";
|
7702 | }
|
7703 | re += c2;
|
7704 | }
|
7705 | }
|
7706 | if (inClass) {
|
7707 | var cs = pattern.substr(classStart + 1), sp = this.parse(cs, SUBPARSE);
|
7708 | re = re.substr(0, reClassStart) + "\\[" + sp[0];
|
7709 | hasMagic = hasMagic || sp[1];
|
7710 | }
|
7711 | var pl;
|
7712 | while (pl = patternListStack.pop()) {
|
7713 | var tail = re.slice(pl.reStart + 3);
|
7714 | tail = tail.replace(/((?:\\{2})*)(\\?)\|/g, function(_, $1, $2) {
|
7715 | if (!$2) {
|
7716 | $2 = "\\";
|
7717 | }
|
7718 | return $1 + $1 + $2 + "|";
|
7719 | });
|
7720 | var t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
|
7721 | hasMagic = true;
|
7722 | re = re.slice(0, pl.reStart) + t + "\\(" + tail;
|
7723 | }
|
7724 | clearStateChar();
|
7725 | if (escaping) {
|
7726 | re += "\\\\";
|
7727 | }
|
7728 | var addPatternStart = false;
|
7729 | switch (re.charAt(0)) {
|
7730 | case ".":
|
7731 | case "[":
|
7732 | case "(":
|
7733 | addPatternStart = true;
|
7734 | }
|
7735 | if (re !== "" && hasMagic) re = "(?=.)" + re;
|
7736 | if (addPatternStart) re = patternStart + re;
|
7737 | if (isSub === SUBPARSE) {
|
7738 | return [re, hasMagic];
|
7739 | }
|
7740 | if (!hasMagic) {
|
7741 | return globUnescape(pattern);
|
7742 | }
|
7743 | var flags = options8.nocase ? "i" : "", regExp = new RegExp("^" + re + "$", flags);
|
7744 | regExp._glob = pattern;
|
7745 | regExp._src = re;
|
7746 | return regExp;
|
7747 | }
|
7748 | minimatch.makeRe = function(pattern, options8) {
|
7749 | return new Minimatch(pattern, options8 || {}).makeRe();
|
7750 | };
|
7751 | Minimatch.prototype.makeRe = makeRe;
|
7752 | function makeRe() {
|
7753 | if (this.regexp || this.regexp === false) return this.regexp;
|
7754 | var set2 = this.set;
|
7755 | if (!set2.length) return this.regexp = false;
|
7756 | var options8 = this.options;
|
7757 | var twoStar = options8.noglobstar ? star : options8.dot ? twoStarDot : twoStarNoDot, flags = options8.nocase ? "i" : "";
|
7758 | var re = set2.map(function(pattern) {
|
7759 | return pattern.map(function(p) {
|
7760 | return p === GLOBSTAR ? twoStar : typeof p === "string" ? regExpEscape(p) : p._src;
|
7761 | }).join("\\/");
|
7762 | }).join("|");
|
7763 | re = "^(?:" + re + ")$";
|
7764 | if (this.negate) re = "^(?!" + re + ").*$";
|
7765 | try {
|
7766 | return this.regexp = new RegExp(re, flags);
|
7767 | } catch (ex) {
|
7768 | return this.regexp = false;
|
7769 | }
|
7770 | }
|
7771 | minimatch.match = function(list, pattern, options8) {
|
7772 | var mm = new Minimatch(pattern, options8);
|
7773 | list = list.filter(function(f) {
|
7774 | return mm.match(f);
|
7775 | });
|
7776 | if (options8.nonull && !list.length) {
|
7777 | list.push(pattern);
|
7778 | }
|
7779 | return list;
|
7780 | };
|
7781 | Minimatch.prototype.match = match;
|
7782 | function match(f, partial) {
|
7783 | if (this.comment) return false;
|
7784 | if (this.empty) return f === "";
|
7785 | if (f === "/" && partial) return true;
|
7786 | var options8 = this.options;
|
7787 | if (platform === "win32") {
|
7788 | f = f.split("\\").join("/");
|
7789 | }
|
7790 | f = f.split(slashSplit);
|
7791 | if (options8.debug) {
|
7792 | console.error(this.pattern, "split", f);
|
7793 | }
|
7794 | var set2 = this.set;
|
7795 | for (var i = 0, l = set2.length; i < l; i++) {
|
7796 | var pattern = set2[i];
|
7797 | var hit = this.matchOne(f, pattern, partial);
|
7798 | if (hit) {
|
7799 | if (options8.flipNegate) return true;
|
7800 | return !this.negate;
|
7801 | }
|
7802 | }
|
7803 | if (options8.flipNegate) return false;
|
7804 | return this.negate;
|
7805 | }
|
7806 | Minimatch.prototype.matchOne = function(file, pattern, partial) {
|
7807 | var options8 = this.options;
|
7808 | if (options8.debug) {
|
7809 | console.error(
|
7810 | "matchOne",
|
7811 | {
|
7812 | "this": this,
|
7813 | file,
|
7814 | pattern
|
7815 | }
|
7816 | );
|
7817 | }
|
7818 | if (options8.matchBase && pattern.length === 1) {
|
7819 | file = path13.basename(file.join("/")).split("/");
|
7820 | }
|
7821 | if (options8.debug) {
|
7822 | console.error("matchOne", file.length, pattern.length);
|
7823 | }
|
7824 | for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
|
7825 | if (options8.debug) {
|
7826 | console.error("matchOne loop");
|
7827 | }
|
7828 | var p = pattern[pi], f = file[fi];
|
7829 | if (options8.debug) {
|
7830 | console.error(pattern, p, f);
|
7831 | }
|
7832 | if (p === false) return false;
|
7833 | if (p === GLOBSTAR) {
|
7834 | if (options8.debug)
|
7835 | console.error("GLOBSTAR", [pattern, p, f]);
|
7836 | var fr = fi, pr = pi + 1;
|
7837 | if (pr === pl) {
|
7838 | if (options8.debug)
|
7839 | console.error("** at the end");
|
7840 | for (; fi < fl; fi++) {
|
7841 | if (file[fi] === "." || file[fi] === ".." || !options8.dot && file[fi].charAt(0) === ".") return false;
|
7842 | }
|
7843 | return true;
|
7844 | }
|
7845 | WHILE: while (fr < fl) {
|
7846 | var swallowee = file[fr];
|
7847 | if (options8.debug) {
|
7848 | console.error(
|
7849 | "\nglobstar while",
|
7850 | file,
|
7851 | fr,
|
7852 | pattern,
|
7853 | pr,
|
7854 | swallowee
|
7855 | );
|
7856 | }
|
7857 | if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
|
7858 | if (options8.debug)
|
7859 | console.error("globstar found match!", fr, fl, swallowee);
|
7860 | return true;
|
7861 | } else {
|
7862 | if (swallowee === "." || swallowee === ".." || !options8.dot && swallowee.charAt(0) === ".") {
|
7863 | if (options8.debug)
|
7864 | console.error("dot detected!", file, fr, pattern, pr);
|
7865 | break WHILE;
|
7866 | }
|
7867 | if (options8.debug)
|
7868 | console.error("globstar swallow a segment, and continue");
|
7869 | fr++;
|
7870 | }
|
7871 | }
|
7872 | if (partial) {
|
7873 | if (fr === fl) return true;
|
7874 | }
|
7875 | return false;
|
7876 | }
|
7877 | var hit;
|
7878 | if (typeof p === "string") {
|
7879 | if (options8.nocase) {
|
7880 | hit = f.toLowerCase() === p.toLowerCase();
|
7881 | } else {
|
7882 | hit = f === p;
|
7883 | }
|
7884 | if (options8.debug) {
|
7885 | console.error("string match", p, f, hit);
|
7886 | }
|
7887 | } else {
|
7888 | hit = f.match(p);
|
7889 | if (options8.debug) {
|
7890 | console.error("pattern match", p, f, hit);
|
7891 | }
|
7892 | }
|
7893 | if (!hit) return false;
|
7894 | }
|
7895 | if (fi === fl && pi === pl) {
|
7896 | return true;
|
7897 | } else if (fi === fl) {
|
7898 | return partial;
|
7899 | } else if (pi === pl) {
|
7900 | var emptyFileEnd = fi === fl - 1 && file[fi] === "";
|
7901 | return emptyFileEnd;
|
7902 | }
|
7903 | throw new Error("wtf?");
|
7904 | };
|
7905 | function globUnescape(s) {
|
7906 | return s.replace(/\\(.)/g, "$1");
|
7907 | }
|
7908 | function regExpEscape(s) {
|
7909 | return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
7910 | }
|
7911 | }
|
7912 | });
|
7913 |
|
7914 |
|
7915 | var require_ini = __commonJS({
|
7916 | "node_modules/editorconfig/src/lib/ini.js"(exports) {
|
7917 | "use strict";
|
7918 | var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
7919 | return new (P || (P = Promise))(function(resolve3, reject) {
|
7920 | function fulfilled(value) {
|
7921 | try {
|
7922 | step(generator.next(value));
|
7923 | } catch (e) {
|
7924 | reject(e);
|
7925 | }
|
7926 | }
|
7927 | function rejected(value) {
|
7928 | try {
|
7929 | step(generator["throw"](value));
|
7930 | } catch (e) {
|
7931 | reject(e);
|
7932 | }
|
7933 | }
|
7934 | function step(result) {
|
7935 | result.done ? resolve3(result.value) : new P(function(resolve4) {
|
7936 | resolve4(result.value);
|
7937 | }).then(fulfilled, rejected);
|
7938 | }
|
7939 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
7940 | });
|
7941 | };
|
7942 | var __generator = exports && exports.__generator || function(thisArg, body) {
|
7943 | var _ = { label: 0, sent: function() {
|
7944 | if (t[0] & 1) throw t[1];
|
7945 | return t[1];
|
7946 | }, trys: [], ops: [] }, f, y, t, g;
|
7947 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
7948 | return this;
|
7949 | }), g;
|
7950 | function verb(n) {
|
7951 | return function(v) {
|
7952 | return step([n, v]);
|
7953 | };
|
7954 | }
|
7955 | function step(op) {
|
7956 | if (f) throw new TypeError("Generator is already executing.");
|
7957 | while (_) try {
|
7958 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
7959 | if (y = 0, t) op = [op[0] & 2, t.value];
|
7960 | switch (op[0]) {
|
7961 | case 0:
|
7962 | case 1:
|
7963 | t = op;
|
7964 | break;
|
7965 | case 4:
|
7966 | _.label++;
|
7967 | return { value: op[1], done: false };
|
7968 | case 5:
|
7969 | _.label++;
|
7970 | y = op[1];
|
7971 | op = [0];
|
7972 | continue;
|
7973 | case 7:
|
7974 | op = _.ops.pop();
|
7975 | _.trys.pop();
|
7976 | continue;
|
7977 | default:
|
7978 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
7979 | _ = 0;
|
7980 | continue;
|
7981 | }
|
7982 | if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
7983 | _.label = op[1];
|
7984 | break;
|
7985 | }
|
7986 | if (op[0] === 6 && _.label < t[1]) {
|
7987 | _.label = t[1];
|
7988 | t = op;
|
7989 | break;
|
7990 | }
|
7991 | if (t && _.label < t[2]) {
|
7992 | _.label = t[2];
|
7993 | _.ops.push(op);
|
7994 | break;
|
7995 | }
|
7996 | if (t[2]) _.ops.pop();
|
7997 | _.trys.pop();
|
7998 | continue;
|
7999 | }
|
8000 | op = body.call(thisArg, _);
|
8001 | } catch (e) {
|
8002 | op = [6, e];
|
8003 | y = 0;
|
8004 | } finally {
|
8005 | f = t = 0;
|
8006 | }
|
8007 | if (op[0] & 5) throw op[1];
|
8008 | return { value: op[0] ? op[1] : void 0, done: true };
|
8009 | }
|
8010 | };
|
8011 | var __importStar = exports && exports.__importStar || function(mod) {
|
8012 | if (mod && mod.__esModule) return mod;
|
8013 | var result = {};
|
8014 | if (mod != null) {
|
8015 | for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
8016 | }
|
8017 | result["default"] = mod;
|
8018 | return result;
|
8019 | };
|
8020 | Object.defineProperty(exports, "__esModule", { value: true });
|
8021 | var fs7 = __importStar(__require("fs"));
|
8022 | var regex = {
|
8023 | section: /^\s*\[(([^#;]|\\#|\\;)+)\]\s*([#;].*)?$/,
|
8024 | param: /^\s*([\w\.\-\_]+)\s*[=:]\s*(.*?)\s*([#;].*)?$/,
|
8025 | comment: /^\s*[#;].*$/
|
8026 | };
|
8027 | function parse6(file) {
|
8028 | return __awaiter(this, void 0, void 0, function() {
|
8029 | return __generator(this, function(_a) {
|
8030 | return [2, new Promise(function(resolve3, reject) {
|
8031 | fs7.readFile(file, "utf8", function(err, data) {
|
8032 | if (err) {
|
8033 | reject(err);
|
8034 | return;
|
8035 | }
|
8036 | resolve3(parseString(data));
|
8037 | });
|
8038 | })];
|
8039 | });
|
8040 | });
|
8041 | }
|
8042 | exports.parse = parse6;
|
8043 | function parseSync(file) {
|
8044 | return parseString(fs7.readFileSync(file, "utf8"));
|
8045 | }
|
8046 | exports.parseSync = parseSync;
|
8047 | function parseString(data) {
|
8048 | var sectionBody = {};
|
8049 | var sectionName = null;
|
8050 | var value = [[sectionName, sectionBody]];
|
8051 | var lines = data.split(/\r\n|\r|\n/);
|
8052 | lines.forEach(function(line3) {
|
8053 | var match;
|
8054 | if (regex.comment.test(line3)) {
|
8055 | return;
|
8056 | }
|
8057 | if (regex.param.test(line3)) {
|
8058 | match = line3.match(regex.param);
|
8059 | sectionBody[match[1]] = match[2];
|
8060 | } else if (regex.section.test(line3)) {
|
8061 | match = line3.match(regex.section);
|
8062 | sectionName = match[1];
|
8063 | sectionBody = {};
|
8064 | value.push([sectionName, sectionBody]);
|
8065 | }
|
8066 | });
|
8067 | return value;
|
8068 | }
|
8069 | exports.parseString = parseString;
|
8070 | }
|
8071 | });
|
8072 |
|
8073 |
|
8074 | var require_package = __commonJS({
|
8075 | "node_modules/editorconfig/package.json"(exports, module) {
|
8076 | module.exports = {
|
8077 | name: "editorconfig",
|
8078 | version: "0.15.3",
|
8079 | description: "EditorConfig File Locator and Interpreter for Node.js",
|
8080 | keywords: [
|
8081 | "editorconfig",
|
8082 | "core"
|
8083 | ],
|
8084 | main: "src/index.js",
|
8085 | contributors: [
|
8086 | "Hong Xu (topbug.net)",
|
8087 | "Jed Mao (https://github.com/jedmao/)",
|
8088 | "Trey Hunner (http://treyhunner.com)"
|
8089 | ],
|
8090 | directories: {
|
8091 | bin: "./bin",
|
8092 | lib: "./lib"
|
8093 | },
|
8094 | scripts: {
|
8095 | clean: "rimraf dist",
|
8096 | prebuild: "npm run clean",
|
8097 | build: "tsc",
|
8098 | pretest: "npm run lint && npm run build && npm run copy && cmake .",
|
8099 | test: "ctest .",
|
8100 | "pretest:ci": "npm run pretest",
|
8101 | "test:ci": "ctest -VV --output-on-failure .",
|
8102 | lint: "npm run eclint && npm run tslint",
|
8103 | eclint: 'eclint check --indent_size ignore "src/**"',
|
8104 | tslint: "tslint --project tsconfig.json --exclude package.json",
|
8105 | copy: "cpy .npmignore LICENSE README.md CHANGELOG.md dist && cpy bin/* dist/bin && cpy src/lib/fnmatch*.* dist/src/lib",
|
8106 | prepub: "npm run lint && npm run build && npm run copy",
|
8107 | pub: "npm publish ./dist"
|
8108 | },
|
8109 | repository: {
|
8110 | type: "git",
|
8111 | url: "git://github.com/editorconfig/editorconfig-core-js.git"
|
8112 | },
|
8113 | bugs: "https://github.com/editorconfig/editorconfig-core-js/issues",
|
8114 | author: "EditorConfig Team",
|
8115 | license: "MIT",
|
8116 | dependencies: {
|
8117 | commander: "^2.19.0",
|
8118 | "lru-cache": "^4.1.5",
|
8119 | semver: "^5.6.0",
|
8120 | sigmund: "^1.0.1"
|
8121 | },
|
8122 | devDependencies: {
|
8123 | "@types/mocha": "^5.2.6",
|
8124 | "@types/node": "^10.12.29",
|
8125 | "@types/semver": "^5.5.0",
|
8126 | "cpy-cli": "^2.0.0",
|
8127 | eclint: "^2.8.1",
|
8128 | mocha: "^5.2.0",
|
8129 | rimraf: "^2.6.3",
|
8130 | should: "^13.2.3",
|
8131 | tslint: "^5.13.1",
|
8132 | typescript: "^3.3.3333"
|
8133 | }
|
8134 | };
|
8135 | }
|
8136 | });
|
8137 |
|
8138 |
|
8139 | var require_src = __commonJS({
|
8140 | "node_modules/editorconfig/src/index.js"(exports) {
|
8141 | "use strict";
|
8142 | var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
8143 | return new (P || (P = Promise))(function(resolve3, reject) {
|
8144 | function fulfilled(value) {
|
8145 | try {
|
8146 | step(generator.next(value));
|
8147 | } catch (e) {
|
8148 | reject(e);
|
8149 | }
|
8150 | }
|
8151 | function rejected(value) {
|
8152 | try {
|
8153 | step(generator["throw"](value));
|
8154 | } catch (e) {
|
8155 | reject(e);
|
8156 | }
|
8157 | }
|
8158 | function step(result) {
|
8159 | result.done ? resolve3(result.value) : new P(function(resolve4) {
|
8160 | resolve4(result.value);
|
8161 | }).then(fulfilled, rejected);
|
8162 | }
|
8163 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8164 | });
|
8165 | };
|
8166 | var __generator = exports && exports.__generator || function(thisArg, body) {
|
8167 | var _ = { label: 0, sent: function() {
|
8168 | if (t[0] & 1) throw t[1];
|
8169 | return t[1];
|
8170 | }, trys: [], ops: [] }, f, y, t, g;
|
8171 | return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
8172 | return this;
|
8173 | }), g;
|
8174 | function verb(n) {
|
8175 | return function(v) {
|
8176 | return step([n, v]);
|
8177 | };
|
8178 | }
|
8179 | function step(op) {
|
8180 | if (f) throw new TypeError("Generator is already executing.");
|
8181 | while (_) try {
|
8182 | if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
8183 | if (y = 0, t) op = [op[0] & 2, t.value];
|
8184 | switch (op[0]) {
|
8185 | case 0:
|
8186 | case 1:
|
8187 | t = op;
|
8188 | break;
|
8189 | case 4:
|
8190 | _.label++;
|
8191 | return { value: op[1], done: false };
|
8192 | case 5:
|
8193 | _.label++;
|
8194 | y = op[1];
|
8195 | op = [0];
|
8196 | continue;
|
8197 | case 7:
|
8198 | op = _.ops.pop();
|
8199 | _.trys.pop();
|
8200 | continue;
|
8201 | default:
|
8202 | if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
8203 | _ = 0;
|
8204 | continue;
|
8205 | }
|
8206 | if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
8207 | _.label = op[1];
|
8208 | break;
|
8209 | }
|
8210 | if (op[0] === 6 && _.label < t[1]) {
|
8211 | _.label = t[1];
|
8212 | t = op;
|
8213 | break;
|
8214 | }
|
8215 | if (t && _.label < t[2]) {
|
8216 | _.label = t[2];
|
8217 | _.ops.push(op);
|
8218 | break;
|
8219 | }
|
8220 | if (t[2]) _.ops.pop();
|
8221 | _.trys.pop();
|
8222 | continue;
|
8223 | }
|
8224 | op = body.call(thisArg, _);
|
8225 | } catch (e) {
|
8226 | op = [6, e];
|
8227 | y = 0;
|
8228 | } finally {
|
8229 | f = t = 0;
|
8230 | }
|
8231 | if (op[0] & 5) throw op[1];
|
8232 | return { value: op[0] ? op[1] : void 0, done: true };
|
8233 | }
|
8234 | };
|
8235 | var __importStar = exports && exports.__importStar || function(mod) {
|
8236 | if (mod && mod.__esModule) return mod;
|
8237 | var result = {};
|
8238 | if (mod != null) {
|
8239 | for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
8240 | }
|
8241 | result["default"] = mod;
|
8242 | return result;
|
8243 | };
|
8244 | var __importDefault = exports && exports.__importDefault || function(mod) {
|
8245 | return mod && mod.__esModule ? mod : { "default": mod };
|
8246 | };
|
8247 | Object.defineProperty(exports, "__esModule", { value: true });
|
8248 | var fs7 = __importStar(__require("fs"));
|
8249 | var path13 = __importStar(__require("path"));
|
8250 | var semver = {
|
8251 | gte: require_gte()
|
8252 | };
|
8253 | var fnmatch_1 = __importDefault(require_fnmatch());
|
8254 | var ini_1 = require_ini();
|
8255 | exports.parseString = ini_1.parseString;
|
8256 | var package_json_1 = __importDefault(require_package());
|
8257 | var knownProps = {
|
8258 | end_of_line: true,
|
8259 | indent_style: true,
|
8260 | indent_size: true,
|
8261 | insert_final_newline: true,
|
8262 | trim_trailing_whitespace: true,
|
8263 | charset: true
|
8264 | };
|
8265 | function fnmatch(filepath, glob) {
|
8266 | var matchOptions = { matchBase: true, dot: true, noext: true };
|
8267 | glob = glob.replace(/\*\*/g, "{*,**/**/**}");
|
8268 | return fnmatch_1.default(filepath, glob, matchOptions);
|
8269 | }
|
8270 | function getConfigFileNames(filepath, options8) {
|
8271 | var paths = [];
|
8272 | do {
|
8273 | filepath = path13.dirname(filepath);
|
8274 | paths.push(path13.join(filepath, options8.config));
|
8275 | } while (filepath !== options8.root);
|
8276 | return paths;
|
8277 | }
|
8278 | function processMatches(matches, version) {
|
8279 | if ("indent_style" in matches && matches.indent_style === "tab" && !("indent_size" in matches) && semver.gte(version, "0.10.0")) {
|
8280 | matches.indent_size = "tab";
|
8281 | }
|
8282 | if ("indent_size" in matches && !("tab_width" in matches) && matches.indent_size !== "tab") {
|
8283 | matches.tab_width = matches.indent_size;
|
8284 | }
|
8285 | if ("indent_size" in matches && "tab_width" in matches && matches.indent_size === "tab") {
|
8286 | matches.indent_size = matches.tab_width;
|
8287 | }
|
8288 | return matches;
|
8289 | }
|
8290 | function processOptions(options8, filepath) {
|
8291 | if (options8 === void 0) {
|
8292 | options8 = {};
|
8293 | }
|
8294 | return {
|
8295 | config: options8.config || ".editorconfig",
|
8296 | version: options8.version || package_json_1.default.version,
|
8297 | root: path13.resolve(options8.root || path13.parse(filepath).root)
|
8298 | };
|
8299 | }
|
8300 | function buildFullGlob(pathPrefix, glob) {
|
8301 | switch (glob.indexOf("/")) {
|
8302 | case -1:
|
8303 | glob = "**/" + glob;
|
8304 | break;
|
8305 | case 0:
|
8306 | glob = glob.substring(1);
|
8307 | break;
|
8308 | default:
|
8309 | break;
|
8310 | }
|
8311 | return path13.join(pathPrefix, glob);
|
8312 | }
|
8313 | function extendProps(props, options8) {
|
8314 | if (props === void 0) {
|
8315 | props = {};
|
8316 | }
|
8317 | if (options8 === void 0) {
|
8318 | options8 = {};
|
8319 | }
|
8320 | for (var key2 in options8) {
|
8321 | if (options8.hasOwnProperty(key2)) {
|
8322 | var value = options8[key2];
|
8323 | var key22 = key2.toLowerCase();
|
8324 | var value2 = value;
|
8325 | if (knownProps[key22]) {
|
8326 | value2 = value.toLowerCase();
|
8327 | }
|
8328 | try {
|
8329 | value2 = JSON.parse(value);
|
8330 | } catch (e) {
|
8331 | }
|
8332 | if (typeof value === "undefined" || value === null) {
|
8333 | value2 = String(value);
|
8334 | }
|
8335 | props[key22] = value2;
|
8336 | }
|
8337 | }
|
8338 | return props;
|
8339 | }
|
8340 | function parseFromConfigs(configs, filepath, options8) {
|
8341 | return processMatches(configs.reverse().reduce(function(matches, file) {
|
8342 | var pathPrefix = path13.dirname(file.name);
|
8343 | file.contents.forEach(function(section) {
|
8344 | var glob = section[0];
|
8345 | var options22 = section[1];
|
8346 | if (!glob) {
|
8347 | return;
|
8348 | }
|
8349 | var fullGlob = buildFullGlob(pathPrefix, glob);
|
8350 | if (!fnmatch(filepath, fullGlob)) {
|
8351 | return;
|
8352 | }
|
8353 | matches = extendProps(matches, options22);
|
8354 | });
|
8355 | return matches;
|
8356 | }, {}), options8.version);
|
8357 | }
|
8358 | function getConfigsForFiles(files) {
|
8359 | var configs = [];
|
8360 | for (var i in files) {
|
8361 | if (files.hasOwnProperty(i)) {
|
8362 | var file = files[i];
|
8363 | var contents = ini_1.parseString(file.contents);
|
8364 | configs.push({
|
8365 | name: file.name,
|
8366 | contents
|
8367 | });
|
8368 | if ((contents[0][1].root || "").toLowerCase() === "true") {
|
8369 | break;
|
8370 | }
|
8371 | }
|
8372 | }
|
8373 | return configs;
|
8374 | }
|
8375 | function readConfigFiles(filepaths) {
|
8376 | return __awaiter(this, void 0, void 0, function() {
|
8377 | return __generator(this, function(_a) {
|
8378 | return [2, Promise.all(filepaths.map(function(name) {
|
8379 | return new Promise(function(resolve3) {
|
8380 | fs7.readFile(name, "utf8", function(err, data) {
|
8381 | resolve3({
|
8382 | name,
|
8383 | contents: err ? "" : data
|
8384 | });
|
8385 | });
|
8386 | });
|
8387 | }))];
|
8388 | });
|
8389 | });
|
8390 | }
|
8391 | function readConfigFilesSync(filepaths) {
|
8392 | var files = [];
|
8393 | var file;
|
8394 | filepaths.forEach(function(filepath) {
|
8395 | try {
|
8396 | file = fs7.readFileSync(filepath, "utf8");
|
8397 | } catch (e) {
|
8398 | file = "";
|
8399 | }
|
8400 | files.push({
|
8401 | name: filepath,
|
8402 | contents: file
|
8403 | });
|
8404 | });
|
8405 | return files;
|
8406 | }
|
8407 | function opts(filepath, options8) {
|
8408 | if (options8 === void 0) {
|
8409 | options8 = {};
|
8410 | }
|
8411 | var resolvedFilePath = path13.resolve(filepath);
|
8412 | return [
|
8413 | resolvedFilePath,
|
8414 | processOptions(options8, resolvedFilePath)
|
8415 | ];
|
8416 | }
|
8417 | function parseFromFiles(filepath, files, options8) {
|
8418 | if (options8 === void 0) {
|
8419 | options8 = {};
|
8420 | }
|
8421 | return __awaiter(this, void 0, void 0, function() {
|
8422 | var _a, resolvedFilePath, processedOptions;
|
8423 | return __generator(this, function(_b) {
|
8424 | _a = opts(filepath, options8), resolvedFilePath = _a[0], processedOptions = _a[1];
|
8425 | return [2, files.then(getConfigsForFiles).then(function(configs) {
|
8426 | return parseFromConfigs(configs, resolvedFilePath, processedOptions);
|
8427 | })];
|
8428 | });
|
8429 | });
|
8430 | }
|
8431 | exports.parseFromFiles = parseFromFiles;
|
8432 | function parseFromFilesSync(filepath, files, options8) {
|
8433 | if (options8 === void 0) {
|
8434 | options8 = {};
|
8435 | }
|
8436 | var _a = opts(filepath, options8), resolvedFilePath = _a[0], processedOptions = _a[1];
|
8437 | return parseFromConfigs(getConfigsForFiles(files), resolvedFilePath, processedOptions);
|
8438 | }
|
8439 | exports.parseFromFilesSync = parseFromFilesSync;
|
8440 | function parse6(_filepath, _options) {
|
8441 | if (_options === void 0) {
|
8442 | _options = {};
|
8443 | }
|
8444 | return __awaiter(this, void 0, void 0, function() {
|
8445 | var _a, resolvedFilePath, processedOptions, filepaths;
|
8446 | return __generator(this, function(_b) {
|
8447 | _a = opts(_filepath, _options), resolvedFilePath = _a[0], processedOptions = _a[1];
|
8448 | filepaths = getConfigFileNames(resolvedFilePath, processedOptions);
|
8449 | return [2, readConfigFiles(filepaths).then(getConfigsForFiles).then(function(configs) {
|
8450 | return parseFromConfigs(configs, resolvedFilePath, processedOptions);
|
8451 | })];
|
8452 | });
|
8453 | });
|
8454 | }
|
8455 | exports.parse = parse6;
|
8456 | function parseSync(_filepath, _options) {
|
8457 | if (_options === void 0) {
|
8458 | _options = {};
|
8459 | }
|
8460 | var _a = opts(_filepath, _options), resolvedFilePath = _a[0], processedOptions = _a[1];
|
8461 | var filepaths = getConfigFileNames(resolvedFilePath, processedOptions);
|
8462 | var files = readConfigFilesSync(filepaths);
|
8463 | return parseFromConfigs(getConfigsForFiles(files), resolvedFilePath, processedOptions);
|
8464 | }
|
8465 | exports.parseSync = parseSync;
|
8466 | }
|
8467 | });
|
8468 |
|
8469 |
|
8470 | var require_vendors = __commonJS({
|
8471 | "node_modules/ci-info/vendors.json"(exports, module) {
|
8472 | module.exports = [
|
8473 | {
|
8474 | name: "Agola CI",
|
8475 | constant: "AGOLA",
|
8476 | env: "AGOLA_GIT_REF",
|
8477 | pr: "AGOLA_PULL_REQUEST_ID"
|
8478 | },
|
8479 | {
|
8480 | name: "Appcircle",
|
8481 | constant: "APPCIRCLE",
|
8482 | env: "AC_APPCIRCLE"
|
8483 | },
|
8484 | {
|
8485 | name: "AppVeyor",
|
8486 | constant: "APPVEYOR",
|
8487 | env: "APPVEYOR",
|
8488 | pr: "APPVEYOR_PULL_REQUEST_NUMBER"
|
8489 | },
|
8490 | {
|
8491 | name: "AWS CodeBuild",
|
8492 | constant: "CODEBUILD",
|
8493 | env: "CODEBUILD_BUILD_ARN"
|
8494 | },
|
8495 | {
|
8496 | name: "Azure Pipelines",
|
8497 | constant: "AZURE_PIPELINES",
|
8498 | env: "TF_BUILD",
|
8499 | pr: {
|
8500 | BUILD_REASON: "PullRequest"
|
8501 | }
|
8502 | },
|
8503 | {
|
8504 | name: "Bamboo",
|
8505 | constant: "BAMBOO",
|
8506 | env: "bamboo_planKey"
|
8507 | },
|
8508 | {
|
8509 | name: "Bitbucket Pipelines",
|
8510 | constant: "BITBUCKET",
|
8511 | env: "BITBUCKET_COMMIT",
|
8512 | pr: "BITBUCKET_PR_ID"
|
8513 | },
|
8514 | {
|
8515 | name: "Bitrise",
|
8516 | constant: "BITRISE",
|
8517 | env: "BITRISE_IO",
|
8518 | pr: "BITRISE_PULL_REQUEST"
|
8519 | },
|
8520 | {
|
8521 | name: "Buddy",
|
8522 | constant: "BUDDY",
|
8523 | env: "BUDDY_WORKSPACE_ID",
|
8524 | pr: "BUDDY_EXECUTION_PULL_REQUEST_ID"
|
8525 | },
|
8526 | {
|
8527 | name: "Buildkite",
|
8528 | constant: "BUILDKITE",
|
8529 | env: "BUILDKITE",
|
8530 | pr: {
|
8531 | env: "BUILDKITE_PULL_REQUEST",
|
8532 | ne: "false"
|
8533 | }
|
8534 | },
|
8535 | {
|
8536 | name: "CircleCI",
|
8537 | constant: "CIRCLE",
|
8538 | env: "CIRCLECI",
|
8539 | pr: "CIRCLE_PULL_REQUEST"
|
8540 | },
|
8541 | {
|
8542 | name: "Cirrus CI",
|
8543 | constant: "CIRRUS",
|
8544 | env: "CIRRUS_CI",
|
8545 | pr: "CIRRUS_PR"
|
8546 | },
|
8547 | {
|
8548 | name: "Codefresh",
|
8549 | constant: "CODEFRESH",
|
8550 | env: "CF_BUILD_ID",
|
8551 | pr: {
|
8552 | any: [
|
8553 | "CF_PULL_REQUEST_NUMBER",
|
8554 | "CF_PULL_REQUEST_ID"
|
8555 | ]
|
8556 | }
|
8557 | },
|
8558 | {
|
8559 | name: "Codemagic",
|
8560 | constant: "CODEMAGIC",
|
8561 | env: "CM_BUILD_ID",
|
8562 | pr: "CM_PULL_REQUEST"
|
8563 | },
|
8564 | {
|
8565 | name: "Codeship",
|
8566 | constant: "CODESHIP",
|
8567 | env: {
|
8568 | CI_NAME: "codeship"
|
8569 | }
|
8570 | },
|
8571 | {
|
8572 | name: "Drone",
|
8573 | constant: "DRONE",
|
8574 | env: "DRONE",
|
8575 | pr: {
|
8576 | DRONE_BUILD_EVENT: "pull_request"
|
8577 | }
|
8578 | },
|
8579 | {
|
8580 | name: "dsari",
|
8581 | constant: "DSARI",
|
8582 | env: "DSARI"
|
8583 | },
|
8584 | {
|
8585 | name: "Earthly",
|
8586 | constant: "EARTHLY",
|
8587 | env: "EARTHLY_CI"
|
8588 | },
|
8589 | {
|
8590 | name: "Expo Application Services",
|
8591 | constant: "EAS",
|
8592 | env: "EAS_BUILD"
|
8593 | },
|
8594 | {
|
8595 | name: "Gerrit",
|
8596 | constant: "GERRIT",
|
8597 | env: "GERRIT_PROJECT"
|
8598 | },
|
8599 | {
|
8600 | name: "Gitea Actions",
|
8601 | constant: "GITEA_ACTIONS",
|
8602 | env: "GITEA_ACTIONS"
|
8603 | },
|
8604 | {
|
8605 | name: "GitHub Actions",
|
8606 | constant: "GITHUB_ACTIONS",
|
8607 | env: "GITHUB_ACTIONS",
|
8608 | pr: {
|
8609 | GITHUB_EVENT_NAME: "pull_request"
|
8610 | }
|
8611 | },
|
8612 | {
|
8613 | name: "GitLab CI",
|
8614 | constant: "GITLAB",
|
8615 | env: "GITLAB_CI",
|
8616 | pr: "CI_MERGE_REQUEST_ID"
|
8617 | },
|
8618 | {
|
8619 | name: "GoCD",
|
8620 | constant: "GOCD",
|
8621 | env: "GO_PIPELINE_LABEL"
|
8622 | },
|
8623 | {
|
8624 | name: "Google Cloud Build",
|
8625 | constant: "GOOGLE_CLOUD_BUILD",
|
8626 | env: "BUILDER_OUTPUT"
|
8627 | },
|
8628 | {
|
8629 | name: "Harness CI",
|
8630 | constant: "HARNESS",
|
8631 | env: "HARNESS_BUILD_ID"
|
8632 | },
|
8633 | {
|
8634 | name: "Heroku",
|
8635 | constant: "HEROKU",
|
8636 | env: {
|
8637 | env: "NODE",
|
8638 | includes: "/app/.heroku/node/bin/node"
|
8639 | }
|
8640 | },
|
8641 | {
|
8642 | name: "Hudson",
|
8643 | constant: "HUDSON",
|
8644 | env: "HUDSON_URL"
|
8645 | },
|
8646 | {
|
8647 | name: "Jenkins",
|
8648 | constant: "JENKINS",
|
8649 | env: [
|
8650 | "JENKINS_URL",
|
8651 | "BUILD_ID"
|
8652 | ],
|
8653 | pr: {
|
8654 | any: [
|
8655 | "ghprbPullId",
|
8656 | "CHANGE_ID"
|
8657 | ]
|
8658 | }
|
8659 | },
|
8660 | {
|
8661 | name: "LayerCI",
|
8662 | constant: "LAYERCI",
|
8663 | env: "LAYERCI",
|
8664 | pr: "LAYERCI_PULL_REQUEST"
|
8665 | },
|
8666 | {
|
8667 | name: "Magnum CI",
|
8668 | constant: "MAGNUM",
|
8669 | env: "MAGNUM"
|
8670 | },
|
8671 | {
|
8672 | name: "Netlify CI",
|
8673 | constant: "NETLIFY",
|
8674 | env: "NETLIFY",
|
8675 | pr: {
|
8676 | env: "PULL_REQUEST",
|
8677 | ne: "false"
|
8678 | }
|
8679 | },
|
8680 | {
|
8681 | name: "Nevercode",
|
8682 | constant: "NEVERCODE",
|
8683 | env: "NEVERCODE",
|
8684 | pr: {
|
8685 | env: "NEVERCODE_PULL_REQUEST",
|
8686 | ne: "false"
|
8687 | }
|
8688 | },
|
8689 | {
|
8690 | name: "Prow",
|
8691 | constant: "PROW",
|
8692 | env: "PROW_JOB_ID"
|
8693 | },
|
8694 | {
|
8695 | name: "ReleaseHub",
|
8696 | constant: "RELEASEHUB",
|
8697 | env: "RELEASE_BUILD_ID"
|
8698 | },
|
8699 | {
|
8700 | name: "Render",
|
8701 | constant: "RENDER",
|
8702 | env: "RENDER",
|
8703 | pr: {
|
8704 | IS_PULL_REQUEST: "true"
|
8705 | }
|
8706 | },
|
8707 | {
|
8708 | name: "Sail CI",
|
8709 | constant: "SAIL",
|
8710 | env: "SAILCI",
|
8711 | pr: "SAIL_PULL_REQUEST_NUMBER"
|
8712 | },
|
8713 | {
|
8714 | name: "Screwdriver",
|
8715 | constant: "SCREWDRIVER",
|
8716 | env: "SCREWDRIVER",
|
8717 | pr: {
|
8718 | env: "SD_PULL_REQUEST",
|
8719 | ne: "false"
|
8720 | }
|
8721 | },
|
8722 | {
|
8723 | name: "Semaphore",
|
8724 | constant: "SEMAPHORE",
|
8725 | env: "SEMAPHORE",
|
8726 | pr: "PULL_REQUEST_NUMBER"
|
8727 | },
|
8728 | {
|
8729 | name: "Sourcehut",
|
8730 | constant: "SOURCEHUT",
|
8731 | env: {
|
8732 | CI_NAME: "sourcehut"
|
8733 | }
|
8734 | },
|
8735 | {
|
8736 | name: "Strider CD",
|
8737 | constant: "STRIDER",
|
8738 | env: "STRIDER"
|
8739 | },
|
8740 | {
|
8741 | name: "TaskCluster",
|
8742 | constant: "TASKCLUSTER",
|
8743 | env: [
|
8744 | "TASK_ID",
|
8745 | "RUN_ID"
|
8746 | ]
|
8747 | },
|
8748 | {
|
8749 | name: "TeamCity",
|
8750 | constant: "TEAMCITY",
|
8751 | env: "TEAMCITY_VERSION"
|
8752 | },
|
8753 | {
|
8754 | name: "Travis CI",
|
8755 | constant: "TRAVIS",
|
8756 | env: "TRAVIS",
|
8757 | pr: {
|
8758 | env: "TRAVIS_PULL_REQUEST",
|
8759 | ne: "false"
|
8760 | }
|
8761 | },
|
8762 | {
|
8763 | name: "Vela",
|
8764 | constant: "VELA",
|
8765 | env: "VELA",
|
8766 | pr: {
|
8767 | VELA_PULL_REQUEST: "1"
|
8768 | }
|
8769 | },
|
8770 | {
|
8771 | name: "Vercel",
|
8772 | constant: "VERCEL",
|
8773 | env: {
|
8774 | any: [
|
8775 | "NOW_BUILDER",
|
8776 | "VERCEL"
|
8777 | ]
|
8778 | },
|
8779 | pr: "VERCEL_GIT_PULL_REQUEST_ID"
|
8780 | },
|
8781 | {
|
8782 | name: "Visual Studio App Center",
|
8783 | constant: "APPCENTER",
|
8784 | env: "APPCENTER_BUILD_ID"
|
8785 | },
|
8786 | {
|
8787 | name: "Woodpecker",
|
8788 | constant: "WOODPECKER",
|
8789 | env: {
|
8790 | CI: "woodpecker"
|
8791 | },
|
8792 | pr: {
|
8793 | CI_BUILD_EVENT: "pull_request"
|
8794 | }
|
8795 | },
|
8796 | {
|
8797 | name: "Xcode Cloud",
|
8798 | constant: "XCODE_CLOUD",
|
8799 | env: "CI_XCODE_PROJECT",
|
8800 | pr: "CI_PULL_REQUEST_NUMBER"
|
8801 | },
|
8802 | {
|
8803 | name: "Xcode Server",
|
8804 | constant: "XCODE_SERVER",
|
8805 | env: "XCS"
|
8806 | }
|
8807 | ];
|
8808 | }
|
8809 | });
|
8810 |
|
8811 |
|
8812 | var require_ci_info = __commonJS({
|
8813 | "node_modules/ci-info/index.js"(exports) {
|
8814 | "use strict";
|
8815 | var vendors = require_vendors();
|
8816 | var env2 = process.env;
|
8817 | Object.defineProperty(exports, "_vendors", {
|
8818 | value: vendors.map(function(v) {
|
8819 | return v.constant;
|
8820 | })
|
8821 | });
|
8822 | exports.name = null;
|
8823 | exports.isPR = null;
|
8824 | vendors.forEach(function(vendor) {
|
8825 | const envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env];
|
8826 | const isCI2 = envs.every(function(obj) {
|
8827 | return checkEnv(obj);
|
8828 | });
|
8829 | exports[vendor.constant] = isCI2;
|
8830 | if (!isCI2) {
|
8831 | return;
|
8832 | }
|
8833 | exports.name = vendor.name;
|
8834 | switch (typeof vendor.pr) {
|
8835 | case "string":
|
8836 | exports.isPR = !!env2[vendor.pr];
|
8837 | break;
|
8838 | case "object":
|
8839 | if ("env" in vendor.pr) {
|
8840 | exports.isPR = vendor.pr.env in env2 && env2[vendor.pr.env] !== vendor.pr.ne;
|
8841 | } else if ("any" in vendor.pr) {
|
8842 | exports.isPR = vendor.pr.any.some(function(key2) {
|
8843 | return !!env2[key2];
|
8844 | });
|
8845 | } else {
|
8846 | exports.isPR = checkEnv(vendor.pr);
|
8847 | }
|
8848 | break;
|
8849 | default:
|
8850 | exports.isPR = null;
|
8851 | }
|
8852 | });
|
8853 | exports.isCI = !!(env2.CI !== "false" &&
|
8854 | (env2.BUILD_ID ||
|
8855 | env2.BUILD_NUMBER ||
|
8856 | env2.CI ||
|
8857 | env2.CI_APP_ID ||
|
8858 | env2.CI_BUILD_ID ||
|
8859 | env2.CI_BUILD_NUMBER ||
|
8860 | env2.CI_NAME ||
|
8861 | env2.CONTINUOUS_INTEGRATION ||
|
8862 | env2.RUN_ID ||
|
8863 | exports.name || false));
|
8864 | function checkEnv(obj) {
|
8865 | if (typeof obj === "string") return !!env2[obj];
|
8866 | if ("env" in obj) {
|
8867 | return env2[obj.env] && env2[obj.env].includes(obj.includes);
|
8868 | }
|
8869 | if ("any" in obj) {
|
8870 | return obj.any.some(function(k) {
|
8871 | return !!env2[k];
|
8872 | });
|
8873 | }
|
8874 | return Object.keys(obj).every(function(k) {
|
8875 | return env2[k] === obj[k];
|
8876 | });
|
8877 | }
|
8878 | }
|
8879 | });
|
8880 |
|
8881 |
|
8882 | var require_parser = __commonJS({
|
8883 | "node_modules/@iarna/toml/lib/parser.js"(exports, module) {
|
8884 | "use strict";
|
8885 | var ParserEND = 1114112;
|
8886 | var ParserError = class _ParserError extends Error {
|
8887 |
|
8888 | constructor(msg, filename, linenumber) {
|
8889 | super("[ParserError] " + msg, filename, linenumber);
|
8890 | this.name = "ParserError";
|
8891 | this.code = "ParserError";
|
8892 | if (Error.captureStackTrace) Error.captureStackTrace(this, _ParserError);
|
8893 | }
|
8894 | };
|
8895 | var State = class {
|
8896 | constructor(parser) {
|
8897 | this.parser = parser;
|
8898 | this.buf = "";
|
8899 | this.returned = null;
|
8900 | this.result = null;
|
8901 | this.resultTable = null;
|
8902 | this.resultArr = null;
|
8903 | }
|
8904 | };
|
8905 | var Parser = class {
|
8906 | constructor() {
|
8907 | this.pos = 0;
|
8908 | this.col = 0;
|
8909 | this.line = 0;
|
8910 | this.obj = {};
|
8911 | this.ctx = this.obj;
|
8912 | this.stack = [];
|
8913 | this._buf = "";
|
8914 | this.char = null;
|
8915 | this.ii = 0;
|
8916 | this.state = new State(this.parseStart);
|
8917 | }
|
8918 | parse(str2) {
|
8919 | if (str2.length === 0 || str2.length == null) return;
|
8920 | this._buf = String(str2);
|
8921 | this.ii = -1;
|
8922 | this.char = -1;
|
8923 | let getNext;
|
8924 | while (getNext === false || this.nextChar()) {
|
8925 | getNext = this.runOne();
|
8926 | }
|
8927 | this._buf = null;
|
8928 | }
|
8929 | nextChar() {
|
8930 | if (this.char === 10) {
|
8931 | ++this.line;
|
8932 | this.col = -1;
|
8933 | }
|
8934 | ++this.ii;
|
8935 | this.char = this._buf.codePointAt(this.ii);
|
8936 | ++this.pos;
|
8937 | ++this.col;
|
8938 | return this.haveBuffer();
|
8939 | }
|
8940 | haveBuffer() {
|
8941 | return this.ii < this._buf.length;
|
8942 | }
|
8943 | runOne() {
|
8944 | return this.state.parser.call(this, this.state.returned);
|
8945 | }
|
8946 | finish() {
|
8947 | this.char = ParserEND;
|
8948 | let last;
|
8949 | do {
|
8950 | last = this.state.parser;
|
8951 | this.runOne();
|
8952 | } while (this.state.parser !== last);
|
8953 | this.ctx = null;
|
8954 | this.state = null;
|
8955 | this._buf = null;
|
8956 | return this.obj;
|
8957 | }
|
8958 | next(fn) {
|
8959 | if (typeof fn !== "function") throw new ParserError("Tried to set state to non-existent state: " + JSON.stringify(fn));
|
8960 | this.state.parser = fn;
|
8961 | }
|
8962 | goto(fn) {
|
8963 | this.next(fn);
|
8964 | return this.runOne();
|
8965 | }
|
8966 | call(fn, returnWith) {
|
8967 | if (returnWith) this.next(returnWith);
|
8968 | this.stack.push(this.state);
|
8969 | this.state = new State(fn);
|
8970 | }
|
8971 | callNow(fn, returnWith) {
|
8972 | this.call(fn, returnWith);
|
8973 | return this.runOne();
|
8974 | }
|
8975 | return(value) {
|
8976 | if (this.stack.length === 0) throw this.error(new ParserError("Stack underflow"));
|
8977 | if (value === void 0) value = this.state.buf;
|
8978 | this.state = this.stack.pop();
|
8979 | this.state.returned = value;
|
8980 | }
|
8981 | returnNow(value) {
|
8982 | this.return(value);
|
8983 | return this.runOne();
|
8984 | }
|
8985 | consume() {
|
8986 | if (this.char === ParserEND) throw this.error(new ParserError("Unexpected end-of-buffer"));
|
8987 | this.state.buf += this._buf[this.ii];
|
8988 | }
|
8989 | error(err) {
|
8990 | err.line = this.line;
|
8991 | err.col = this.col;
|
8992 | err.pos = this.pos;
|
8993 | return err;
|
8994 | }
|
8995 |
|
8996 | parseStart() {
|
8997 | throw new ParserError("Must declare a parseStart method");
|
8998 | }
|
8999 | };
|
9000 | Parser.END = ParserEND;
|
9001 | Parser.Error = ParserError;
|
9002 | module.exports = Parser;
|
9003 | }
|
9004 | });
|
9005 |
|
9006 |
|
9007 | var require_create_datetime = __commonJS({
|
9008 | "node_modules/@iarna/toml/lib/create-datetime.js"(exports, module) {
|
9009 | "use strict";
|
9010 | module.exports = (value) => {
|
9011 | const date = new Date(value);
|
9012 | if (isNaN(date)) {
|
9013 | throw new TypeError("Invalid Datetime");
|
9014 | } else {
|
9015 | return date;
|
9016 | }
|
9017 | };
|
9018 | }
|
9019 | });
|
9020 |
|
9021 |
|
9022 | var require_format_num = __commonJS({
|
9023 | "node_modules/@iarna/toml/lib/format-num.js"(exports, module) {
|
9024 | "use strict";
|
9025 | module.exports = (d, num) => {
|
9026 | num = String(num);
|
9027 | while (num.length < d) num = "0" + num;
|
9028 | return num;
|
9029 | };
|
9030 | }
|
9031 | });
|
9032 |
|
9033 |
|
9034 | var require_create_datetime_float = __commonJS({
|
9035 | "node_modules/@iarna/toml/lib/create-datetime-float.js"(exports, module) {
|
9036 | "use strict";
|
9037 | var f = require_format_num();
|
9038 | var FloatingDateTime = class extends Date {
|
9039 | constructor(value) {
|
9040 | super(value + "Z");
|
9041 | this.isFloating = true;
|
9042 | }
|
9043 | toISOString() {
|
9044 | const date = `${this.getUTCFullYear()}-${f(2, this.getUTCMonth() + 1)}-${f(2, this.getUTCDate())}`;
|
9045 | const time = `${f(2, this.getUTCHours())}:${f(2, this.getUTCMinutes())}:${f(2, this.getUTCSeconds())}.${f(3, this.getUTCMilliseconds())}`;
|
9046 | return `${date}T${time}`;
|
9047 | }
|
9048 | };
|
9049 | module.exports = (value) => {
|
9050 | const date = new FloatingDateTime(value);
|
9051 | if (isNaN(date)) {
|
9052 | throw new TypeError("Invalid Datetime");
|
9053 | } else {
|
9054 | return date;
|
9055 | }
|
9056 | };
|
9057 | }
|
9058 | });
|
9059 |
|
9060 |
|
9061 | var require_create_date = __commonJS({
|
9062 | "node_modules/@iarna/toml/lib/create-date.js"(exports, module) {
|
9063 | "use strict";
|
9064 | var f = require_format_num();
|
9065 | var DateTime = global.Date;
|
9066 | var Date2 = class extends DateTime {
|
9067 | constructor(value) {
|
9068 | super(value);
|
9069 | this.isDate = true;
|
9070 | }
|
9071 | toISOString() {
|
9072 | return `${this.getUTCFullYear()}-${f(2, this.getUTCMonth() + 1)}-${f(2, this.getUTCDate())}`;
|
9073 | }
|
9074 | };
|
9075 | module.exports = (value) => {
|
9076 | const date = new Date2(value);
|
9077 | if (isNaN(date)) {
|
9078 | throw new TypeError("Invalid Datetime");
|
9079 | } else {
|
9080 | return date;
|
9081 | }
|
9082 | };
|
9083 | }
|
9084 | });
|
9085 |
|
9086 |
|
9087 | var require_create_time = __commonJS({
|
9088 | "node_modules/@iarna/toml/lib/create-time.js"(exports, module) {
|
9089 | "use strict";
|
9090 | var f = require_format_num();
|
9091 | var Time = class extends Date {
|
9092 | constructor(value) {
|
9093 | super(`0000-01-01T${value}Z`);
|
9094 | this.isTime = true;
|
9095 | }
|
9096 | toISOString() {
|
9097 | return `${f(2, this.getUTCHours())}:${f(2, this.getUTCMinutes())}:${f(2, this.getUTCSeconds())}.${f(3, this.getUTCMilliseconds())}`;
|
9098 | }
|
9099 | };
|
9100 | module.exports = (value) => {
|
9101 | const date = new Time(value);
|
9102 | if (isNaN(date)) {
|
9103 | throw new TypeError("Invalid Datetime");
|
9104 | } else {
|
9105 | return date;
|
9106 | }
|
9107 | };
|
9108 | }
|
9109 | });
|
9110 |
|
9111 |
|
9112 | var require_toml_parser = __commonJS({
|
9113 | "node_modules/@iarna/toml/lib/toml-parser.js"(exports, module) {
|
9114 | "use strict";
|
9115 | module.exports = makeParserClass(require_parser());
|
9116 | module.exports.makeParserClass = makeParserClass;
|
9117 | var TomlError = class _TomlError extends Error {
|
9118 | constructor(msg) {
|
9119 | super(msg);
|
9120 | this.name = "TomlError";
|
9121 | if (Error.captureStackTrace) Error.captureStackTrace(this, _TomlError);
|
9122 | this.fromTOML = true;
|
9123 | this.wrapped = null;
|
9124 | }
|
9125 | };
|
9126 | TomlError.wrap = (err) => {
|
9127 | const terr = new TomlError(err.message);
|
9128 | terr.code = err.code;
|
9129 | terr.wrapped = err;
|
9130 | return terr;
|
9131 | };
|
9132 | module.exports.TomlError = TomlError;
|
9133 | var createDateTime = require_create_datetime();
|
9134 | var createDateTimeFloat = require_create_datetime_float();
|
9135 | var createDate = require_create_date();
|
9136 | var createTime = require_create_time();
|
9137 | var CTRL_I = 9;
|
9138 | var CTRL_J = 10;
|
9139 | var CTRL_M = 13;
|
9140 | var CTRL_CHAR_BOUNDARY = 31;
|
9141 | var CHAR_SP = 32;
|
9142 | var CHAR_QUOT = 34;
|
9143 | var CHAR_NUM = 35;
|
9144 | var CHAR_APOS = 39;
|
9145 | var CHAR_PLUS = 43;
|
9146 | var CHAR_COMMA = 44;
|
9147 | var CHAR_HYPHEN = 45;
|
9148 | var CHAR_PERIOD = 46;
|
9149 | var CHAR_0 = 48;
|
9150 | var CHAR_1 = 49;
|
9151 | var CHAR_7 = 55;
|
9152 | var CHAR_9 = 57;
|
9153 | var CHAR_COLON = 58;
|
9154 | var CHAR_EQUALS = 61;
|
9155 | var CHAR_A = 65;
|
9156 | var CHAR_E = 69;
|
9157 | var CHAR_F = 70;
|
9158 | var CHAR_T = 84;
|
9159 | var CHAR_U = 85;
|
9160 | var CHAR_Z = 90;
|
9161 | var CHAR_LOWBAR = 95;
|
9162 | var CHAR_a = 97;
|
9163 | var CHAR_b = 98;
|
9164 | var CHAR_e = 101;
|
9165 | var CHAR_f = 102;
|
9166 | var CHAR_i = 105;
|
9167 | var CHAR_l = 108;
|
9168 | var CHAR_n = 110;
|
9169 | var CHAR_o = 111;
|
9170 | var CHAR_r = 114;
|
9171 | var CHAR_s = 115;
|
9172 | var CHAR_t = 116;
|
9173 | var CHAR_u = 117;
|
9174 | var CHAR_x = 120;
|
9175 | var CHAR_z = 122;
|
9176 | var CHAR_LCUB = 123;
|
9177 | var CHAR_RCUB = 125;
|
9178 | var CHAR_LSQB = 91;
|
9179 | var CHAR_BSOL = 92;
|
9180 | var CHAR_RSQB = 93;
|
9181 | var CHAR_DEL = 127;
|
9182 | var SURROGATE_FIRST = 55296;
|
9183 | var SURROGATE_LAST = 57343;
|
9184 | var escapes = {
|
9185 | [CHAR_b]: "\b",
|
9186 | [CHAR_t]: " ",
|
9187 | [CHAR_n]: "\n",
|
9188 | [CHAR_f]: "\f",
|
9189 | [CHAR_r]: "\r",
|
9190 | [CHAR_QUOT]: '"',
|
9191 | [CHAR_BSOL]: "\\"
|
9192 | };
|
9193 | function isDigit(cp) {
|
9194 | return cp >= CHAR_0 && cp <= CHAR_9;
|
9195 | }
|
9196 | function isHexit(cp) {
|
9197 | return cp >= CHAR_A && cp <= CHAR_F || cp >= CHAR_a && cp <= CHAR_f || cp >= CHAR_0 && cp <= CHAR_9;
|
9198 | }
|
9199 | function isBit(cp) {
|
9200 | return cp === CHAR_1 || cp === CHAR_0;
|
9201 | }
|
9202 | function isOctit(cp) {
|
9203 | return cp >= CHAR_0 && cp <= CHAR_7;
|
9204 | }
|
9205 | function isAlphaNumQuoteHyphen(cp) {
|
9206 | return cp >= CHAR_A && cp <= CHAR_Z || cp >= CHAR_a && cp <= CHAR_z || cp >= CHAR_0 && cp <= CHAR_9 || cp === CHAR_APOS || cp === CHAR_QUOT || cp === CHAR_LOWBAR || cp === CHAR_HYPHEN;
|
9207 | }
|
9208 | function isAlphaNumHyphen(cp) {
|
9209 | return cp >= CHAR_A && cp <= CHAR_Z || cp >= CHAR_a && cp <= CHAR_z || cp >= CHAR_0 && cp <= CHAR_9 || cp === CHAR_LOWBAR || cp === CHAR_HYPHEN;
|
9210 | }
|
9211 | var _type = Symbol("type");
|
9212 | var _declared = Symbol("declared");
|
9213 | var hasOwnProperty3 = Object.prototype.hasOwnProperty;
|
9214 | var defineProperty = Object.defineProperty;
|
9215 | var descriptor = { configurable: true, enumerable: true, writable: true, value: void 0 };
|
9216 | function hasKey(obj, key2) {
|
9217 | if (hasOwnProperty3.call(obj, key2)) return true;
|
9218 | if (key2 === "__proto__") defineProperty(obj, "__proto__", descriptor);
|
9219 | return false;
|
9220 | }
|
9221 | var INLINE_TABLE = Symbol("inline-table");
|
9222 | function InlineTable() {
|
9223 | return Object.defineProperties({}, {
|
9224 | [_type]: { value: INLINE_TABLE }
|
9225 | });
|
9226 | }
|
9227 | function isInlineTable(obj) {
|
9228 | if (obj === null || typeof obj !== "object") return false;
|
9229 | return obj[_type] === INLINE_TABLE;
|
9230 | }
|
9231 | var TABLE = Symbol("table");
|
9232 | function Table() {
|
9233 | return Object.defineProperties({}, {
|
9234 | [_type]: { value: TABLE },
|
9235 | [_declared]: { value: false, writable: true }
|
9236 | });
|
9237 | }
|
9238 | function isTable(obj) {
|
9239 | if (obj === null || typeof obj !== "object") return false;
|
9240 | return obj[_type] === TABLE;
|
9241 | }
|
9242 | var _contentType = Symbol("content-type");
|
9243 | var INLINE_LIST = Symbol("inline-list");
|
9244 | function InlineList(type2) {
|
9245 | return Object.defineProperties([], {
|
9246 | [_type]: { value: INLINE_LIST },
|
9247 | [_contentType]: { value: type2 }
|
9248 | });
|
9249 | }
|
9250 | function isInlineList(obj) {
|
9251 | if (obj === null || typeof obj !== "object") return false;
|
9252 | return obj[_type] === INLINE_LIST;
|
9253 | }
|
9254 | var LIST = Symbol("list");
|
9255 | function List() {
|
9256 | return Object.defineProperties([], {
|
9257 | [_type]: { value: LIST }
|
9258 | });
|
9259 | }
|
9260 | function isList(obj) {
|
9261 | if (obj === null || typeof obj !== "object") return false;
|
9262 | return obj[_type] === LIST;
|
9263 | }
|
9264 | var _custom;
|
9265 | try {
|
9266 | const utilInspect = __require("util").inspect;
|
9267 | _custom = utilInspect.custom;
|
9268 | } catch (_) {
|
9269 | }
|
9270 | var _inspect = _custom || "inspect";
|
9271 | var BoxedBigInt = class {
|
9272 | constructor(value) {
|
9273 | try {
|
9274 | this.value = global.BigInt.asIntN(64, value);
|
9275 | } catch (_) {
|
9276 | this.value = null;
|
9277 | }
|
9278 | Object.defineProperty(this, _type, { value: INTEGER });
|
9279 | }
|
9280 | isNaN() {
|
9281 | return this.value === null;
|
9282 | }
|
9283 |
|
9284 | toString() {
|
9285 | return String(this.value);
|
9286 | }
|
9287 |
|
9288 | [_inspect]() {
|
9289 | return `[BigInt: ${this.toString()}]}`;
|
9290 | }
|
9291 | valueOf() {
|
9292 | return this.value;
|
9293 | }
|
9294 | };
|
9295 | var INTEGER = Symbol("integer");
|
9296 | function Integer(value) {
|
9297 | let num = Number(value);
|
9298 | if (Object.is(num, -0)) num = 0;
|
9299 | if (global.BigInt && !Number.isSafeInteger(num)) {
|
9300 | return new BoxedBigInt(value);
|
9301 | } else {
|
9302 | return Object.defineProperties(new Number(num), {
|
9303 | isNaN: { value: function() {
|
9304 | return isNaN(this);
|
9305 | } },
|
9306 | [_type]: { value: INTEGER },
|
9307 | [_inspect]: { value: () => `[Integer: ${value}]` }
|
9308 | });
|
9309 | }
|
9310 | }
|
9311 | function isInteger2(obj) {
|
9312 | if (obj === null || typeof obj !== "object") return false;
|
9313 | return obj[_type] === INTEGER;
|
9314 | }
|
9315 | var FLOAT = Symbol("float");
|
9316 | function Float(value) {
|
9317 | return Object.defineProperties(new Number(value), {
|
9318 | [_type]: { value: FLOAT },
|
9319 | [_inspect]: { value: () => `[Float: ${value}]` }
|
9320 | });
|
9321 | }
|
9322 | function isFloat2(obj) {
|
9323 | if (obj === null || typeof obj !== "object") return false;
|
9324 | return obj[_type] === FLOAT;
|
9325 | }
|
9326 | function tomlType(value) {
|
9327 | const type2 = typeof value;
|
9328 | if (type2 === "object") {
|
9329 | if (value === null) return "null";
|
9330 | if (value instanceof Date) return "datetime";
|
9331 | if (_type in value) {
|
9332 | switch (value[_type]) {
|
9333 | case INLINE_TABLE:
|
9334 | return "inline-table";
|
9335 | case INLINE_LIST:
|
9336 | return "inline-list";
|
9337 | case TABLE:
|
9338 | return "table";
|
9339 | case LIST:
|
9340 | return "list";
|
9341 | case FLOAT:
|
9342 | return "float";
|
9343 | case INTEGER:
|
9344 | return "integer";
|
9345 | }
|
9346 | }
|
9347 | }
|
9348 | return type2;
|
9349 | }
|
9350 | function makeParserClass(Parser) {
|
9351 | class TOMLParser extends Parser {
|
9352 | constructor() {
|
9353 | super();
|
9354 | this.ctx = this.obj = Table();
|
9355 | }
|
9356 |
|
9357 | atEndOfWord() {
|
9358 | return this.char === CHAR_NUM || this.char === CTRL_I || this.char === CHAR_SP || this.atEndOfLine();
|
9359 | }
|
9360 | atEndOfLine() {
|
9361 | return this.char === Parser.END || this.char === CTRL_J || this.char === CTRL_M;
|
9362 | }
|
9363 | parseStart() {
|
9364 | if (this.char === Parser.END) {
|
9365 | return null;
|
9366 | } else if (this.char === CHAR_LSQB) {
|
9367 | return this.call(this.parseTableOrList);
|
9368 | } else if (this.char === CHAR_NUM) {
|
9369 | return this.call(this.parseComment);
|
9370 | } else if (this.char === CTRL_J || this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) {
|
9371 | return null;
|
9372 | } else if (isAlphaNumQuoteHyphen(this.char)) {
|
9373 | return this.callNow(this.parseAssignStatement);
|
9374 | } else {
|
9375 | throw this.error(new TomlError(`Unknown character "${this.char}"`));
|
9376 | }
|
9377 | }
|
9378 |
|
9379 |
|
9380 | parseWhitespaceToEOL() {
|
9381 | if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) {
|
9382 | return null;
|
9383 | } else if (this.char === CHAR_NUM) {
|
9384 | return this.goto(this.parseComment);
|
9385 | } else if (this.char === Parser.END || this.char === CTRL_J) {
|
9386 | return this.return();
|
9387 | } else {
|
9388 | throw this.error(new TomlError("Unexpected character, expected only whitespace or comments till end of line"));
|
9389 | }
|
9390 | }
|
9391 |
|
9392 | parseAssignStatement() {
|
9393 | return this.callNow(this.parseAssign, this.recordAssignStatement);
|
9394 | }
|
9395 | recordAssignStatement(kv) {
|
9396 | let target = this.ctx;
|
9397 | let finalKey = kv.key.pop();
|
9398 | for (let kw of kv.key) {
|
9399 | if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) {
|
9400 | throw this.error(new TomlError("Can't redefine existing key"));
|
9401 | }
|
9402 | target = target[kw] = target[kw] || Table();
|
9403 | }
|
9404 | if (hasKey(target, finalKey)) {
|
9405 | throw this.error(new TomlError("Can't redefine existing key"));
|
9406 | }
|
9407 | if (isInteger2(kv.value) || isFloat2(kv.value)) {
|
9408 | target[finalKey] = kv.value.valueOf();
|
9409 | } else {
|
9410 | target[finalKey] = kv.value;
|
9411 | }
|
9412 | return this.goto(this.parseWhitespaceToEOL);
|
9413 | }
|
9414 |
|
9415 | parseAssign() {
|
9416 | return this.callNow(this.parseKeyword, this.recordAssignKeyword);
|
9417 | }
|
9418 | recordAssignKeyword(key2) {
|
9419 | if (this.state.resultTable) {
|
9420 | this.state.resultTable.push(key2);
|
9421 | } else {
|
9422 | this.state.resultTable = [key2];
|
9423 | }
|
9424 | return this.goto(this.parseAssignKeywordPreDot);
|
9425 | }
|
9426 | parseAssignKeywordPreDot() {
|
9427 | if (this.char === CHAR_PERIOD) {
|
9428 | return this.next(this.parseAssignKeywordPostDot);
|
9429 | } else if (this.char !== CHAR_SP && this.char !== CTRL_I) {
|
9430 | return this.goto(this.parseAssignEqual);
|
9431 | }
|
9432 | }
|
9433 | parseAssignKeywordPostDot() {
|
9434 | if (this.char !== CHAR_SP && this.char !== CTRL_I) {
|
9435 | return this.callNow(this.parseKeyword, this.recordAssignKeyword);
|
9436 | }
|
9437 | }
|
9438 | parseAssignEqual() {
|
9439 | if (this.char === CHAR_EQUALS) {
|
9440 | return this.next(this.parseAssignPreValue);
|
9441 | } else {
|
9442 | throw this.error(new TomlError('Invalid character, expected "="'));
|
9443 | }
|
9444 | }
|
9445 | parseAssignPreValue() {
|
9446 | if (this.char === CHAR_SP || this.char === CTRL_I) {
|
9447 | return null;
|
9448 | } else {
|
9449 | return this.callNow(this.parseValue, this.recordAssignValue);
|
9450 | }
|
9451 | }
|
9452 | recordAssignValue(value) {
|
9453 | return this.returnNow({ key: this.state.resultTable, value });
|
9454 | }
|
9455 |
|
9456 | parseComment() {
|
9457 | do {
|
9458 | if (this.char === Parser.END || this.char === CTRL_J) {
|
9459 | return this.return();
|
9460 | }
|
9461 | } while (this.nextChar());
|
9462 | }
|
9463 |
|
9464 | parseTableOrList() {
|
9465 | if (this.char === CHAR_LSQB) {
|
9466 | this.next(this.parseList);
|
9467 | } else {
|
9468 | return this.goto(this.parseTable);
|
9469 | }
|
9470 | }
|
9471 |
|
9472 | parseTable() {
|
9473 | this.ctx = this.obj;
|
9474 | return this.goto(this.parseTableNext);
|
9475 | }
|
9476 | parseTableNext() {
|
9477 | if (this.char === CHAR_SP || this.char === CTRL_I) {
|
9478 | return null;
|
9479 | } else {
|
9480 | return this.callNow(this.parseKeyword, this.parseTableMore);
|
9481 | }
|
9482 | }
|
9483 | parseTableMore(keyword) {
|
9484 | if (this.char === CHAR_SP || this.char === CTRL_I) {
|
9485 | return null;
|
9486 | } else if (this.char === CHAR_RSQB) {
|
9487 | if (hasKey(this.ctx, keyword) && (!isTable(this.ctx[keyword]) || this.ctx[keyword][_declared])) {
|
9488 | throw this.error(new TomlError("Can't redefine existing key"));
|
9489 | } else {
|
9490 | this.ctx = this.ctx[keyword] = this.ctx[keyword] || Table();
|
9491 | this.ctx[_declared] = true;
|
9492 | }
|
9493 | return this.next(this.parseWhitespaceToEOL);
|
9494 | } else if (this.char === CHAR_PERIOD) {
|
9495 | if (!hasKey(this.ctx, keyword)) {
|
9496 | this.ctx = this.ctx[keyword] = Table();
|
9497 | } else if (isTable(this.ctx[keyword])) {
|
9498 | this.ctx = this.ctx[keyword];
|
9499 | } else if (isList(this.ctx[keyword])) {
|
9500 | this.ctx = this.ctx[keyword][this.ctx[keyword].length - 1];
|
9501 | } else {
|
9502 | throw this.error(new TomlError("Can't redefine existing key"));
|
9503 | }
|
9504 | return this.next(this.parseTableNext);
|
9505 | } else {
|
9506 | throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
|
9507 | }
|
9508 | }
|
9509 |
|
9510 | parseList() {
|
9511 | this.ctx = this.obj;
|
9512 | return this.goto(this.parseListNext);
|
9513 | }
|
9514 | parseListNext() {
|
9515 | if (this.char === CHAR_SP || this.char === CTRL_I) {
|
9516 | return null;
|
9517 | } else {
|
9518 | return this.callNow(this.parseKeyword, this.parseListMore);
|
9519 | }
|
9520 | }
|
9521 | parseListMore(keyword) {
|
9522 | if (this.char === CHAR_SP || this.char === CTRL_I) {
|
9523 | return null;
|
9524 | } else if (this.char === CHAR_RSQB) {
|
9525 | if (!hasKey(this.ctx, keyword)) {
|
9526 | this.ctx[keyword] = List();
|
9527 | }
|
9528 | if (isInlineList(this.ctx[keyword])) {
|
9529 | throw this.error(new TomlError("Can't extend an inline array"));
|
9530 | } else if (isList(this.ctx[keyword])) {
|
9531 | const next = Table();
|
9532 | this.ctx[keyword].push(next);
|
9533 | this.ctx = next;
|
9534 | } else {
|
9535 | throw this.error(new TomlError("Can't redefine an existing key"));
|
9536 | }
|
9537 | return this.next(this.parseListEnd);
|
9538 | } else if (this.char === CHAR_PERIOD) {
|
9539 | if (!hasKey(this.ctx, keyword)) {
|
9540 | this.ctx = this.ctx[keyword] = Table();
|
9541 | } else if (isInlineList(this.ctx[keyword])) {
|
9542 | throw this.error(new TomlError("Can't extend an inline array"));
|
9543 | } else if (isInlineTable(this.ctx[keyword])) {
|
9544 | throw this.error(new TomlError("Can't extend an inline table"));
|
9545 | } else if (isList(this.ctx[keyword])) {
|
9546 | this.ctx = this.ctx[keyword][this.ctx[keyword].length - 1];
|
9547 | } else if (isTable(this.ctx[keyword])) {
|
9548 | this.ctx = this.ctx[keyword];
|
9549 | } else {
|
9550 | throw this.error(new TomlError("Can't redefine an existing key"));
|
9551 | }
|
9552 | return this.next(this.parseListNext);
|
9553 | } else {
|
9554 | throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
|
9555 | }
|
9556 | }
|
9557 | parseListEnd(keyword) {
|
9558 | if (this.char === CHAR_RSQB) {
|
9559 | return this.next(this.parseWhitespaceToEOL);
|
9560 | } else {
|
9561 | throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
|
9562 | }
|
9563 | }
|
9564 |
|
9565 | parseValue() {
|
9566 | if (this.char === Parser.END) {
|
9567 | throw this.error(new TomlError("Key without value"));
|
9568 | } else if (this.char === CHAR_QUOT) {
|
9569 | return this.next(this.parseDoubleString);
|
9570 | }
|
9571 | if (this.char === CHAR_APOS) {
|
9572 | return this.next(this.parseSingleString);
|
9573 | } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
|
9574 | return this.goto(this.parseNumberSign);
|
9575 | } else if (this.char === CHAR_i) {
|
9576 | return this.next(this.parseInf);
|
9577 | } else if (this.char === CHAR_n) {
|
9578 | return this.next(this.parseNan);
|
9579 | } else if (isDigit(this.char)) {
|
9580 | return this.goto(this.parseNumberOrDateTime);
|
9581 | } else if (this.char === CHAR_t || this.char === CHAR_f) {
|
9582 | return this.goto(this.parseBoolean);
|
9583 | } else if (this.char === CHAR_LSQB) {
|
9584 | return this.call(this.parseInlineList, this.recordValue);
|
9585 | } else if (this.char === CHAR_LCUB) {
|
9586 | return this.call(this.parseInlineTable, this.recordValue);
|
9587 | } else {
|
9588 | throw this.error(new TomlError("Unexpected character, expecting string, number, datetime, boolean, inline array or inline table"));
|
9589 | }
|
9590 | }
|
9591 | recordValue(value) {
|
9592 | return this.returnNow(value);
|
9593 | }
|
9594 | parseInf() {
|
9595 | if (this.char === CHAR_n) {
|
9596 | return this.next(this.parseInf2);
|
9597 | } else {
|
9598 | throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'));
|
9599 | }
|
9600 | }
|
9601 | parseInf2() {
|
9602 | if (this.char === CHAR_f) {
|
9603 | if (this.state.buf === "-") {
|
9604 | return this.return(-Infinity);
|
9605 | } else {
|
9606 | return this.return(Infinity);
|
9607 | }
|
9608 | } else {
|
9609 | throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'));
|
9610 | }
|
9611 | }
|
9612 | parseNan() {
|
9613 | if (this.char === CHAR_a) {
|
9614 | return this.next(this.parseNan2);
|
9615 | } else {
|
9616 | throw this.error(new TomlError('Unexpected character, expected "nan"'));
|
9617 | }
|
9618 | }
|
9619 | parseNan2() {
|
9620 | if (this.char === CHAR_n) {
|
9621 | return this.return(NaN);
|
9622 | } else {
|
9623 | throw this.error(new TomlError('Unexpected character, expected "nan"'));
|
9624 | }
|
9625 | }
|
9626 |
|
9627 | parseKeyword() {
|
9628 | if (this.char === CHAR_QUOT) {
|
9629 | return this.next(this.parseBasicString);
|
9630 | } else if (this.char === CHAR_APOS) {
|
9631 | return this.next(this.parseLiteralString);
|
9632 | } else {
|
9633 | return this.goto(this.parseBareKey);
|
9634 | }
|
9635 | }
|
9636 |
|
9637 | parseBareKey() {
|
9638 | do {
|
9639 | if (this.char === Parser.END) {
|
9640 | throw this.error(new TomlError("Key ended without value"));
|
9641 | } else if (isAlphaNumHyphen(this.char)) {
|
9642 | this.consume();
|
9643 | } else if (this.state.buf.length === 0) {
|
9644 | throw this.error(new TomlError("Empty bare keys are not allowed"));
|
9645 | } else {
|
9646 | return this.returnNow();
|
9647 | }
|
9648 | } while (this.nextChar());
|
9649 | }
|
9650 |
|
9651 | parseSingleString() {
|
9652 | if (this.char === CHAR_APOS) {
|
9653 | return this.next(this.parseLiteralMultiStringMaybe);
|
9654 | } else {
|
9655 | return this.goto(this.parseLiteralString);
|
9656 | }
|
9657 | }
|
9658 | parseLiteralString() {
|
9659 | do {
|
9660 | if (this.char === CHAR_APOS) {
|
9661 | return this.return();
|
9662 | } else if (this.atEndOfLine()) {
|
9663 | throw this.error(new TomlError("Unterminated string"));
|
9664 | } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I) {
|
9665 | throw this.errorControlCharInString();
|
9666 | } else {
|
9667 | this.consume();
|
9668 | }
|
9669 | } while (this.nextChar());
|
9670 | }
|
9671 | parseLiteralMultiStringMaybe() {
|
9672 | if (this.char === CHAR_APOS) {
|
9673 | return this.next(this.parseLiteralMultiString);
|
9674 | } else {
|
9675 | return this.returnNow();
|
9676 | }
|
9677 | }
|
9678 | parseLiteralMultiString() {
|
9679 | if (this.char === CTRL_M) {
|
9680 | return null;
|
9681 | } else if (this.char === CTRL_J) {
|
9682 | return this.next(this.parseLiteralMultiStringContent);
|
9683 | } else {
|
9684 | return this.goto(this.parseLiteralMultiStringContent);
|
9685 | }
|
9686 | }
|
9687 | parseLiteralMultiStringContent() {
|
9688 | do {
|
9689 | if (this.char === CHAR_APOS) {
|
9690 | return this.next(this.parseLiteralMultiEnd);
|
9691 | } else if (this.char === Parser.END) {
|
9692 | throw this.error(new TomlError("Unterminated multi-line string"));
|
9693 | } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M) {
|
9694 | throw this.errorControlCharInString();
|
9695 | } else {
|
9696 | this.consume();
|
9697 | }
|
9698 | } while (this.nextChar());
|
9699 | }
|
9700 | parseLiteralMultiEnd() {
|
9701 | if (this.char === CHAR_APOS) {
|
9702 | return this.next(this.parseLiteralMultiEnd2);
|
9703 | } else {
|
9704 | this.state.buf += "'";
|
9705 | return this.goto(this.parseLiteralMultiStringContent);
|
9706 | }
|
9707 | }
|
9708 | parseLiteralMultiEnd2() {
|
9709 | if (this.char === CHAR_APOS) {
|
9710 | return this.return();
|
9711 | } else {
|
9712 | this.state.buf += "''";
|
9713 | return this.goto(this.parseLiteralMultiStringContent);
|
9714 | }
|
9715 | }
|
9716 |
|
9717 | parseDoubleString() {
|
9718 | if (this.char === CHAR_QUOT) {
|
9719 | return this.next(this.parseMultiStringMaybe);
|
9720 | } else {
|
9721 | return this.goto(this.parseBasicString);
|
9722 | }
|
9723 | }
|
9724 | parseBasicString() {
|
9725 | do {
|
9726 | if (this.char === CHAR_BSOL) {
|
9727 | return this.call(this.parseEscape, this.recordEscapeReplacement);
|
9728 | } else if (this.char === CHAR_QUOT) {
|
9729 | return this.return();
|
9730 | } else if (this.atEndOfLine()) {
|
9731 | throw this.error(new TomlError("Unterminated string"));
|
9732 | } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I) {
|
9733 | throw this.errorControlCharInString();
|
9734 | } else {
|
9735 | this.consume();
|
9736 | }
|
9737 | } while (this.nextChar());
|
9738 | }
|
9739 | recordEscapeReplacement(replacement) {
|
9740 | this.state.buf += replacement;
|
9741 | return this.goto(this.parseBasicString);
|
9742 | }
|
9743 | parseMultiStringMaybe() {
|
9744 | if (this.char === CHAR_QUOT) {
|
9745 | return this.next(this.parseMultiString);
|
9746 | } else {
|
9747 | return this.returnNow();
|
9748 | }
|
9749 | }
|
9750 | parseMultiString() {
|
9751 | if (this.char === CTRL_M) {
|
9752 | return null;
|
9753 | } else if (this.char === CTRL_J) {
|
9754 | return this.next(this.parseMultiStringContent);
|
9755 | } else {
|
9756 | return this.goto(this.parseMultiStringContent);
|
9757 | }
|
9758 | }
|
9759 | parseMultiStringContent() {
|
9760 | do {
|
9761 | if (this.char === CHAR_BSOL) {
|
9762 | return this.call(this.parseMultiEscape, this.recordMultiEscapeReplacement);
|
9763 | } else if (this.char === CHAR_QUOT) {
|
9764 | return this.next(this.parseMultiEnd);
|
9765 | } else if (this.char === Parser.END) {
|
9766 | throw this.error(new TomlError("Unterminated multi-line string"));
|
9767 | } else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M) {
|
9768 | throw this.errorControlCharInString();
|
9769 | } else {
|
9770 | this.consume();
|
9771 | }
|
9772 | } while (this.nextChar());
|
9773 | }
|
9774 | errorControlCharInString() {
|
9775 | let displayCode = "\\u00";
|
9776 | if (this.char < 16) {
|
9777 | displayCode += "0";
|
9778 | }
|
9779 | displayCode += this.char.toString(16);
|
9780 | return this.error(new TomlError(`Control characters (codes < 0x1f and 0x7f) are not allowed in strings, use ${displayCode} instead`));
|
9781 | }
|
9782 | recordMultiEscapeReplacement(replacement) {
|
9783 | this.state.buf += replacement;
|
9784 | return this.goto(this.parseMultiStringContent);
|
9785 | }
|
9786 | parseMultiEnd() {
|
9787 | if (this.char === CHAR_QUOT) {
|
9788 | return this.next(this.parseMultiEnd2);
|
9789 | } else {
|
9790 | this.state.buf += '"';
|
9791 | return this.goto(this.parseMultiStringContent);
|
9792 | }
|
9793 | }
|
9794 | parseMultiEnd2() {
|
9795 | if (this.char === CHAR_QUOT) {
|
9796 | return this.return();
|
9797 | } else {
|
9798 | this.state.buf += '""';
|
9799 | return this.goto(this.parseMultiStringContent);
|
9800 | }
|
9801 | }
|
9802 | parseMultiEscape() {
|
9803 | if (this.char === CTRL_M || this.char === CTRL_J) {
|
9804 | return this.next(this.parseMultiTrim);
|
9805 | } else if (this.char === CHAR_SP || this.char === CTRL_I) {
|
9806 | return this.next(this.parsePreMultiTrim);
|
9807 | } else {
|
9808 | return this.goto(this.parseEscape);
|
9809 | }
|
9810 | }
|
9811 | parsePreMultiTrim() {
|
9812 | if (this.char === CHAR_SP || this.char === CTRL_I) {
|
9813 | return null;
|
9814 | } else if (this.char === CTRL_M || this.char === CTRL_J) {
|
9815 | return this.next(this.parseMultiTrim);
|
9816 | } else {
|
9817 | throw this.error(new TomlError("Can't escape whitespace"));
|
9818 | }
|
9819 | }
|
9820 | parseMultiTrim() {
|
9821 | if (this.char === CTRL_J || this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) {
|
9822 | return null;
|
9823 | } else {
|
9824 | return this.returnNow();
|
9825 | }
|
9826 | }
|
9827 | parseEscape() {
|
9828 | if (this.char in escapes) {
|
9829 | return this.return(escapes[this.char]);
|
9830 | } else if (this.char === CHAR_u) {
|
9831 | return this.call(this.parseSmallUnicode, this.parseUnicodeReturn);
|
9832 | } else if (this.char === CHAR_U) {
|
9833 | return this.call(this.parseLargeUnicode, this.parseUnicodeReturn);
|
9834 | } else {
|
9835 | throw this.error(new TomlError("Unknown escape character: " + this.char));
|
9836 | }
|
9837 | }
|
9838 | parseUnicodeReturn(char) {
|
9839 | try {
|
9840 | const codePoint = parseInt(char, 16);
|
9841 | if (codePoint >= SURROGATE_FIRST && codePoint <= SURROGATE_LAST) {
|
9842 | throw this.error(new TomlError("Invalid unicode, character in range 0xD800 - 0xDFFF is reserved"));
|
9843 | }
|
9844 | return this.returnNow(String.fromCodePoint(codePoint));
|
9845 | } catch (err) {
|
9846 | throw this.error(TomlError.wrap(err));
|
9847 | }
|
9848 | }
|
9849 | parseSmallUnicode() {
|
9850 | if (!isHexit(this.char)) {
|
9851 | throw this.error(new TomlError("Invalid character in unicode sequence, expected hex"));
|
9852 | } else {
|
9853 | this.consume();
|
9854 | if (this.state.buf.length >= 4) return this.return();
|
9855 | }
|
9856 | }
|
9857 | parseLargeUnicode() {
|
9858 | if (!isHexit(this.char)) {
|
9859 | throw this.error(new TomlError("Invalid character in unicode sequence, expected hex"));
|
9860 | } else {
|
9861 | this.consume();
|
9862 | if (this.state.buf.length >= 8) return this.return();
|
9863 | }
|
9864 | }
|
9865 |
|
9866 | parseNumberSign() {
|
9867 | this.consume();
|
9868 | return this.next(this.parseMaybeSignedInfOrNan);
|
9869 | }
|
9870 | parseMaybeSignedInfOrNan() {
|
9871 | if (this.char === CHAR_i) {
|
9872 | return this.next(this.parseInf);
|
9873 | } else if (this.char === CHAR_n) {
|
9874 | return this.next(this.parseNan);
|
9875 | } else {
|
9876 | return this.callNow(this.parseNoUnder, this.parseNumberIntegerStart);
|
9877 | }
|
9878 | }
|
9879 | parseNumberIntegerStart() {
|
9880 | if (this.char === CHAR_0) {
|
9881 | this.consume();
|
9882 | return this.next(this.parseNumberIntegerExponentOrDecimal);
|
9883 | } else {
|
9884 | return this.goto(this.parseNumberInteger);
|
9885 | }
|
9886 | }
|
9887 | parseNumberIntegerExponentOrDecimal() {
|
9888 | if (this.char === CHAR_PERIOD) {
|
9889 | this.consume();
|
9890 | return this.call(this.parseNoUnder, this.parseNumberFloat);
|
9891 | } else if (this.char === CHAR_E || this.char === CHAR_e) {
|
9892 | this.consume();
|
9893 | return this.next(this.parseNumberExponentSign);
|
9894 | } else {
|
9895 | return this.returnNow(Integer(this.state.buf));
|
9896 | }
|
9897 | }
|
9898 | parseNumberInteger() {
|
9899 | if (isDigit(this.char)) {
|
9900 | this.consume();
|
9901 | } else if (this.char === CHAR_LOWBAR) {
|
9902 | return this.call(this.parseNoUnder);
|
9903 | } else if (this.char === CHAR_E || this.char === CHAR_e) {
|
9904 | this.consume();
|
9905 | return this.next(this.parseNumberExponentSign);
|
9906 | } else if (this.char === CHAR_PERIOD) {
|
9907 | this.consume();
|
9908 | return this.call(this.parseNoUnder, this.parseNumberFloat);
|
9909 | } else {
|
9910 | const result = Integer(this.state.buf);
|
9911 | if (result.isNaN()) {
|
9912 | throw this.error(new TomlError("Invalid number"));
|
9913 | } else {
|
9914 | return this.returnNow(result);
|
9915 | }
|
9916 | }
|
9917 | }
|
9918 | parseNoUnder() {
|
9919 | if (this.char === CHAR_LOWBAR || this.char === CHAR_PERIOD || this.char === CHAR_E || this.char === CHAR_e) {
|
9920 | throw this.error(new TomlError("Unexpected character, expected digit"));
|
9921 | } else if (this.atEndOfWord()) {
|
9922 | throw this.error(new TomlError("Incomplete number"));
|
9923 | }
|
9924 | return this.returnNow();
|
9925 | }
|
9926 | parseNoUnderHexOctBinLiteral() {
|
9927 | if (this.char === CHAR_LOWBAR || this.char === CHAR_PERIOD) {
|
9928 | throw this.error(new TomlError("Unexpected character, expected digit"));
|
9929 | } else if (this.atEndOfWord()) {
|
9930 | throw this.error(new TomlError("Incomplete number"));
|
9931 | }
|
9932 | return this.returnNow();
|
9933 | }
|
9934 | parseNumberFloat() {
|
9935 | if (this.char === CHAR_LOWBAR) {
|
9936 | return this.call(this.parseNoUnder, this.parseNumberFloat);
|
9937 | } else if (isDigit(this.char)) {
|
9938 | this.consume();
|
9939 | } else if (this.char === CHAR_E || this.char === CHAR_e) {
|
9940 | this.consume();
|
9941 | return this.next(this.parseNumberExponentSign);
|
9942 | } else {
|
9943 | return this.returnNow(Float(this.state.buf));
|
9944 | }
|
9945 | }
|
9946 | parseNumberExponentSign() {
|
9947 | if (isDigit(this.char)) {
|
9948 | return this.goto(this.parseNumberExponent);
|
9949 | } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
|
9950 | this.consume();
|
9951 | this.call(this.parseNoUnder, this.parseNumberExponent);
|
9952 | } else {
|
9953 | throw this.error(new TomlError("Unexpected character, expected -, + or digit"));
|
9954 | }
|
9955 | }
|
9956 | parseNumberExponent() {
|
9957 | if (isDigit(this.char)) {
|
9958 | this.consume();
|
9959 | } else if (this.char === CHAR_LOWBAR) {
|
9960 | return this.call(this.parseNoUnder);
|
9961 | } else {
|
9962 | return this.returnNow(Float(this.state.buf));
|
9963 | }
|
9964 | }
|
9965 |
|
9966 | parseNumberOrDateTime() {
|
9967 | if (this.char === CHAR_0) {
|
9968 | this.consume();
|
9969 | return this.next(this.parseNumberBaseOrDateTime);
|
9970 | } else {
|
9971 | return this.goto(this.parseNumberOrDateTimeOnly);
|
9972 | }
|
9973 | }
|
9974 | parseNumberOrDateTimeOnly() {
|
9975 | if (this.char === CHAR_LOWBAR) {
|
9976 | return this.call(this.parseNoUnder, this.parseNumberInteger);
|
9977 | } else if (isDigit(this.char)) {
|
9978 | this.consume();
|
9979 | if (this.state.buf.length > 4) this.next(this.parseNumberInteger);
|
9980 | } else if (this.char === CHAR_E || this.char === CHAR_e) {
|
9981 | this.consume();
|
9982 | return this.next(this.parseNumberExponentSign);
|
9983 | } else if (this.char === CHAR_PERIOD) {
|
9984 | this.consume();
|
9985 | return this.call(this.parseNoUnder, this.parseNumberFloat);
|
9986 | } else if (this.char === CHAR_HYPHEN) {
|
9987 | return this.goto(this.parseDateTime);
|
9988 | } else if (this.char === CHAR_COLON) {
|
9989 | return this.goto(this.parseOnlyTimeHour);
|
9990 | } else {
|
9991 | return this.returnNow(Integer(this.state.buf));
|
9992 | }
|
9993 | }
|
9994 | parseDateTimeOnly() {
|
9995 | if (this.state.buf.length < 4) {
|
9996 | if (isDigit(this.char)) {
|
9997 | return this.consume();
|
9998 | } else if (this.char === CHAR_COLON) {
|
9999 | return this.goto(this.parseOnlyTimeHour);
|
10000 | } else {
|
10001 | throw this.error(new TomlError("Expected digit while parsing year part of a date"));
|
10002 | }
|
10003 | } else {
|
10004 | if (this.char === CHAR_HYPHEN) {
|
10005 | return this.goto(this.parseDateTime);
|
10006 | } else {
|
10007 | throw this.error(new TomlError("Expected hyphen (-) while parsing year part of date"));
|
10008 | }
|
10009 | }
|
10010 | }
|
10011 | parseNumberBaseOrDateTime() {
|
10012 | if (this.char === CHAR_b) {
|
10013 | this.consume();
|
10014 | return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerBin);
|
10015 | } else if (this.char === CHAR_o) {
|
10016 | this.consume();
|
10017 | return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerOct);
|
10018 | } else if (this.char === CHAR_x) {
|
10019 | this.consume();
|
10020 | return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerHex);
|
10021 | } else if (this.char === CHAR_PERIOD) {
|
10022 | return this.goto(this.parseNumberInteger);
|
10023 | } else if (isDigit(this.char)) {
|
10024 | return this.goto(this.parseDateTimeOnly);
|
10025 | } else {
|
10026 | return this.returnNow(Integer(this.state.buf));
|
10027 | }
|
10028 | }
|
10029 | parseIntegerHex() {
|
10030 | if (isHexit(this.char)) {
|
10031 | this.consume();
|
10032 | } else if (this.char === CHAR_LOWBAR) {
|
10033 | return this.call(this.parseNoUnderHexOctBinLiteral);
|
10034 | } else {
|
10035 | const result = Integer(this.state.buf);
|
10036 | if (result.isNaN()) {
|
10037 | throw this.error(new TomlError("Invalid number"));
|
10038 | } else {
|
10039 | return this.returnNow(result);
|
10040 | }
|
10041 | }
|
10042 | }
|
10043 | parseIntegerOct() {
|
10044 | if (isOctit(this.char)) {
|
10045 | this.consume();
|
10046 | } else if (this.char === CHAR_LOWBAR) {
|
10047 | return this.call(this.parseNoUnderHexOctBinLiteral);
|
10048 | } else {
|
10049 | const result = Integer(this.state.buf);
|
10050 | if (result.isNaN()) {
|
10051 | throw this.error(new TomlError("Invalid number"));
|
10052 | } else {
|
10053 | return this.returnNow(result);
|
10054 | }
|
10055 | }
|
10056 | }
|
10057 | parseIntegerBin() {
|
10058 | if (isBit(this.char)) {
|
10059 | this.consume();
|
10060 | } else if (this.char === CHAR_LOWBAR) {
|
10061 | return this.call(this.parseNoUnderHexOctBinLiteral);
|
10062 | } else {
|
10063 | const result = Integer(this.state.buf);
|
10064 | if (result.isNaN()) {
|
10065 | throw this.error(new TomlError("Invalid number"));
|
10066 | } else {
|
10067 | return this.returnNow(result);
|
10068 | }
|
10069 | }
|
10070 | }
|
10071 |
|
10072 | parseDateTime() {
|
10073 | if (this.state.buf.length < 4) {
|
10074 | throw this.error(new TomlError("Years less than 1000 must be zero padded to four characters"));
|
10075 | }
|
10076 | this.state.result = this.state.buf;
|
10077 | this.state.buf = "";
|
10078 | return this.next(this.parseDateMonth);
|
10079 | }
|
10080 | parseDateMonth() {
|
10081 | if (this.char === CHAR_HYPHEN) {
|
10082 | if (this.state.buf.length < 2) {
|
10083 | throw this.error(new TomlError("Months less than 10 must be zero padded to two characters"));
|
10084 | }
|
10085 | this.state.result += "-" + this.state.buf;
|
10086 | this.state.buf = "";
|
10087 | return this.next(this.parseDateDay);
|
10088 | } else if (isDigit(this.char)) {
|
10089 | this.consume();
|
10090 | } else {
|
10091 | throw this.error(new TomlError("Incomplete datetime"));
|
10092 | }
|
10093 | }
|
10094 | parseDateDay() {
|
10095 | if (this.char === CHAR_T || this.char === CHAR_SP) {
|
10096 | if (this.state.buf.length < 2) {
|
10097 | throw this.error(new TomlError("Days less than 10 must be zero padded to two characters"));
|
10098 | }
|
10099 | this.state.result += "-" + this.state.buf;
|
10100 | this.state.buf = "";
|
10101 | return this.next(this.parseStartTimeHour);
|
10102 | } else if (this.atEndOfWord()) {
|
10103 | return this.returnNow(createDate(this.state.result + "-" + this.state.buf));
|
10104 | } else if (isDigit(this.char)) {
|
10105 | this.consume();
|
10106 | } else {
|
10107 | throw this.error(new TomlError("Incomplete datetime"));
|
10108 | }
|
10109 | }
|
10110 | parseStartTimeHour() {
|
10111 | if (this.atEndOfWord()) {
|
10112 | return this.returnNow(createDate(this.state.result));
|
10113 | } else {
|
10114 | return this.goto(this.parseTimeHour);
|
10115 | }
|
10116 | }
|
10117 | parseTimeHour() {
|
10118 | if (this.char === CHAR_COLON) {
|
10119 | if (this.state.buf.length < 2) {
|
10120 | throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters"));
|
10121 | }
|
10122 | this.state.result += "T" + this.state.buf;
|
10123 | this.state.buf = "";
|
10124 | return this.next(this.parseTimeMin);
|
10125 | } else if (isDigit(this.char)) {
|
10126 | this.consume();
|
10127 | } else {
|
10128 | throw this.error(new TomlError("Incomplete datetime"));
|
10129 | }
|
10130 | }
|
10131 | parseTimeMin() {
|
10132 | if (this.state.buf.length < 2 && isDigit(this.char)) {
|
10133 | this.consume();
|
10134 | } else if (this.state.buf.length === 2 && this.char === CHAR_COLON) {
|
10135 | this.state.result += ":" + this.state.buf;
|
10136 | this.state.buf = "";
|
10137 | return this.next(this.parseTimeSec);
|
10138 | } else {
|
10139 | throw this.error(new TomlError("Incomplete datetime"));
|
10140 | }
|
10141 | }
|
10142 | parseTimeSec() {
|
10143 | if (isDigit(this.char)) {
|
10144 | this.consume();
|
10145 | if (this.state.buf.length === 2) {
|
10146 | this.state.result += ":" + this.state.buf;
|
10147 | this.state.buf = "";
|
10148 | return this.next(this.parseTimeZoneOrFraction);
|
10149 | }
|
10150 | } else {
|
10151 | throw this.error(new TomlError("Incomplete datetime"));
|
10152 | }
|
10153 | }
|
10154 | parseOnlyTimeHour() {
|
10155 | if (this.char === CHAR_COLON) {
|
10156 | if (this.state.buf.length < 2) {
|
10157 | throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters"));
|
10158 | }
|
10159 | this.state.result = this.state.buf;
|
10160 | this.state.buf = "";
|
10161 | return this.next(this.parseOnlyTimeMin);
|
10162 | } else {
|
10163 | throw this.error(new TomlError("Incomplete time"));
|
10164 | }
|
10165 | }
|
10166 | parseOnlyTimeMin() {
|
10167 | if (this.state.buf.length < 2 && isDigit(this.char)) {
|
10168 | this.consume();
|
10169 | } else if (this.state.buf.length === 2 && this.char === CHAR_COLON) {
|
10170 | this.state.result += ":" + this.state.buf;
|
10171 | this.state.buf = "";
|
10172 | return this.next(this.parseOnlyTimeSec);
|
10173 | } else {
|
10174 | throw this.error(new TomlError("Incomplete time"));
|
10175 | }
|
10176 | }
|
10177 | parseOnlyTimeSec() {
|
10178 | if (isDigit(this.char)) {
|
10179 | this.consume();
|
10180 | if (this.state.buf.length === 2) {
|
10181 | return this.next(this.parseOnlyTimeFractionMaybe);
|
10182 | }
|
10183 | } else {
|
10184 | throw this.error(new TomlError("Incomplete time"));
|
10185 | }
|
10186 | }
|
10187 | parseOnlyTimeFractionMaybe() {
|
10188 | this.state.result += ":" + this.state.buf;
|
10189 | if (this.char === CHAR_PERIOD) {
|
10190 | this.state.buf = "";
|
10191 | this.next(this.parseOnlyTimeFraction);
|
10192 | } else {
|
10193 | return this.return(createTime(this.state.result));
|
10194 | }
|
10195 | }
|
10196 | parseOnlyTimeFraction() {
|
10197 | if (isDigit(this.char)) {
|
10198 | this.consume();
|
10199 | } else if (this.atEndOfWord()) {
|
10200 | if (this.state.buf.length === 0) throw this.error(new TomlError("Expected digit in milliseconds"));
|
10201 | return this.returnNow(createTime(this.state.result + "." + this.state.buf));
|
10202 | } else {
|
10203 | throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"));
|
10204 | }
|
10205 | }
|
10206 | parseTimeZoneOrFraction() {
|
10207 | if (this.char === CHAR_PERIOD) {
|
10208 | this.consume();
|
10209 | this.next(this.parseDateTimeFraction);
|
10210 | } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
|
10211 | this.consume();
|
10212 | this.next(this.parseTimeZoneHour);
|
10213 | } else if (this.char === CHAR_Z) {
|
10214 | this.consume();
|
10215 | return this.return(createDateTime(this.state.result + this.state.buf));
|
10216 | } else if (this.atEndOfWord()) {
|
10217 | return this.returnNow(createDateTimeFloat(this.state.result + this.state.buf));
|
10218 | } else {
|
10219 | throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"));
|
10220 | }
|
10221 | }
|
10222 | parseDateTimeFraction() {
|
10223 | if (isDigit(this.char)) {
|
10224 | this.consume();
|
10225 | } else if (this.state.buf.length === 1) {
|
10226 | throw this.error(new TomlError("Expected digit in milliseconds"));
|
10227 | } else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
|
10228 | this.consume();
|
10229 | this.next(this.parseTimeZoneHour);
|
10230 | } else if (this.char === CHAR_Z) {
|
10231 | this.consume();
|
10232 | return this.return(createDateTime(this.state.result + this.state.buf));
|
10233 | } else if (this.atEndOfWord()) {
|
10234 | return this.returnNow(createDateTimeFloat(this.state.result + this.state.buf));
|
10235 | } else {
|
10236 | throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"));
|
10237 | }
|
10238 | }
|
10239 | parseTimeZoneHour() {
|
10240 | if (isDigit(this.char)) {
|
10241 | this.consume();
|
10242 | if (/\d\d$/.test(this.state.buf)) return this.next(this.parseTimeZoneSep);
|
10243 | } else {
|
10244 | throw this.error(new TomlError("Unexpected character in datetime, expected digit"));
|
10245 | }
|
10246 | }
|
10247 | parseTimeZoneSep() {
|
10248 | if (this.char === CHAR_COLON) {
|
10249 | this.consume();
|
10250 | this.next(this.parseTimeZoneMin);
|
10251 | } else {
|
10252 | throw this.error(new TomlError("Unexpected character in datetime, expected colon"));
|
10253 | }
|
10254 | }
|
10255 | parseTimeZoneMin() {
|
10256 | if (isDigit(this.char)) {
|
10257 | this.consume();
|
10258 | if (/\d\d$/.test(this.state.buf)) return this.return(createDateTime(this.state.result + this.state.buf));
|
10259 | } else {
|
10260 | throw this.error(new TomlError("Unexpected character in datetime, expected digit"));
|
10261 | }
|
10262 | }
|
10263 |
|
10264 | parseBoolean() {
|
10265 | if (this.char === CHAR_t) {
|
10266 | this.consume();
|
10267 | return this.next(this.parseTrue_r);
|
10268 | } else if (this.char === CHAR_f) {
|
10269 | this.consume();
|
10270 | return this.next(this.parseFalse_a);
|
10271 | }
|
10272 | }
|
10273 | parseTrue_r() {
|
10274 | if (this.char === CHAR_r) {
|
10275 | this.consume();
|
10276 | return this.next(this.parseTrue_u);
|
10277 | } else {
|
10278 | throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
10279 | }
|
10280 | }
|
10281 | parseTrue_u() {
|
10282 | if (this.char === CHAR_u) {
|
10283 | this.consume();
|
10284 | return this.next(this.parseTrue_e);
|
10285 | } else {
|
10286 | throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
10287 | }
|
10288 | }
|
10289 | parseTrue_e() {
|
10290 | if (this.char === CHAR_e) {
|
10291 | return this.return(true);
|
10292 | } else {
|
10293 | throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
10294 | }
|
10295 | }
|
10296 | parseFalse_a() {
|
10297 | if (this.char === CHAR_a) {
|
10298 | this.consume();
|
10299 | return this.next(this.parseFalse_l);
|
10300 | } else {
|
10301 | throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
10302 | }
|
10303 | }
|
10304 | parseFalse_l() {
|
10305 | if (this.char === CHAR_l) {
|
10306 | this.consume();
|
10307 | return this.next(this.parseFalse_s);
|
10308 | } else {
|
10309 | throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
10310 | }
|
10311 | }
|
10312 | parseFalse_s() {
|
10313 | if (this.char === CHAR_s) {
|
10314 | this.consume();
|
10315 | return this.next(this.parseFalse_e);
|
10316 | } else {
|
10317 | throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
10318 | }
|
10319 | }
|
10320 | parseFalse_e() {
|
10321 | if (this.char === CHAR_e) {
|
10322 | return this.return(false);
|
10323 | } else {
|
10324 | throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
10325 | }
|
10326 | }
|
10327 |
|
10328 | parseInlineList() {
|
10329 | if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M || this.char === CTRL_J) {
|
10330 | return null;
|
10331 | } else if (this.char === Parser.END) {
|
10332 | throw this.error(new TomlError("Unterminated inline array"));
|
10333 | } else if (this.char === CHAR_NUM) {
|
10334 | return this.call(this.parseComment);
|
10335 | } else if (this.char === CHAR_RSQB) {
|
10336 | return this.return(this.state.resultArr || InlineList());
|
10337 | } else {
|
10338 | return this.callNow(this.parseValue, this.recordInlineListValue);
|
10339 | }
|
10340 | }
|
10341 | recordInlineListValue(value) {
|
10342 | if (this.state.resultArr) {
|
10343 | const listType = this.state.resultArr[_contentType];
|
10344 | const valueType = tomlType(value);
|
10345 | if (listType !== valueType) {
|
10346 | throw this.error(new TomlError(`Inline lists must be a single type, not a mix of ${listType} and ${valueType}`));
|
10347 | }
|
10348 | } else {
|
10349 | this.state.resultArr = InlineList(tomlType(value));
|
10350 | }
|
10351 | if (isFloat2(value) || isInteger2(value)) {
|
10352 | this.state.resultArr.push(value.valueOf());
|
10353 | } else {
|
10354 | this.state.resultArr.push(value);
|
10355 | }
|
10356 | return this.goto(this.parseInlineListNext);
|
10357 | }
|
10358 | parseInlineListNext() {
|
10359 | if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M || this.char === CTRL_J) {
|
10360 | return null;
|
10361 | } else if (this.char === CHAR_NUM) {
|
10362 | return this.call(this.parseComment);
|
10363 | } else if (this.char === CHAR_COMMA) {
|
10364 | return this.next(this.parseInlineList);
|
10365 | } else if (this.char === CHAR_RSQB) {
|
10366 | return this.goto(this.parseInlineList);
|
10367 | } else {
|
10368 | throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"));
|
10369 | }
|
10370 | }
|
10371 |
|
10372 | parseInlineTable() {
|
10373 | if (this.char === CHAR_SP || this.char === CTRL_I) {
|
10374 | return null;
|
10375 | } else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) {
|
10376 | throw this.error(new TomlError("Unterminated inline array"));
|
10377 | } else if (this.char === CHAR_RCUB) {
|
10378 | return this.return(this.state.resultTable || InlineTable());
|
10379 | } else {
|
10380 | if (!this.state.resultTable) this.state.resultTable = InlineTable();
|
10381 | return this.callNow(this.parseAssign, this.recordInlineTableValue);
|
10382 | }
|
10383 | }
|
10384 | recordInlineTableValue(kv) {
|
10385 | let target = this.state.resultTable;
|
10386 | let finalKey = kv.key.pop();
|
10387 | for (let kw of kv.key) {
|
10388 | if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) {
|
10389 | throw this.error(new TomlError("Can't redefine existing key"));
|
10390 | }
|
10391 | target = target[kw] = target[kw] || Table();
|
10392 | }
|
10393 | if (hasKey(target, finalKey)) {
|
10394 | throw this.error(new TomlError("Can't redefine existing key"));
|
10395 | }
|
10396 | if (isInteger2(kv.value) || isFloat2(kv.value)) {
|
10397 | target[finalKey] = kv.value.valueOf();
|
10398 | } else {
|
10399 | target[finalKey] = kv.value;
|
10400 | }
|
10401 | return this.goto(this.parseInlineTableNext);
|
10402 | }
|
10403 | parseInlineTableNext() {
|
10404 | if (this.char === CHAR_SP || this.char === CTRL_I) {
|
10405 | return null;
|
10406 | } else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) {
|
10407 | throw this.error(new TomlError("Unterminated inline array"));
|
10408 | } else if (this.char === CHAR_COMMA) {
|
10409 | return this.next(this.parseInlineTable);
|
10410 | } else if (this.char === CHAR_RCUB) {
|
10411 | return this.goto(this.parseInlineTable);
|
10412 | } else {
|
10413 | throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"));
|
10414 | }
|
10415 | }
|
10416 | }
|
10417 | return TOMLParser;
|
10418 | }
|
10419 | }
|
10420 | });
|
10421 |
|
10422 |
|
10423 | var require_parse_pretty_error = __commonJS({
|
10424 | "node_modules/@iarna/toml/parse-pretty-error.js"(exports, module) {
|
10425 | "use strict";
|
10426 | module.exports = prettyError;
|
10427 | function prettyError(err, buf) {
|
10428 | if (err.pos == null || err.line == null) return err;
|
10429 | let msg = err.message;
|
10430 | msg += ` at row ${err.line + 1}, col ${err.col + 1}, pos ${err.pos}:
|
10431 | `;
|
10432 | if (buf && buf.split) {
|
10433 | const lines = buf.split(/\n/);
|
10434 | const lineNumWidth = String(Math.min(lines.length, err.line + 3)).length;
|
10435 | let linePadding = " ";
|
10436 | while (linePadding.length < lineNumWidth) linePadding += " ";
|
10437 | for (let ii = Math.max(0, err.line - 1); ii < Math.min(lines.length, err.line + 2); ++ii) {
|
10438 | let lineNum = String(ii + 1);
|
10439 | if (lineNum.length < lineNumWidth) lineNum = " " + lineNum;
|
10440 | if (err.line === ii) {
|
10441 | msg += lineNum + "> " + lines[ii] + "\n";
|
10442 | msg += linePadding + " ";
|
10443 | for (let hh = 0; hh < err.col; ++hh) {
|
10444 | msg += " ";
|
10445 | }
|
10446 | msg += "^\n";
|
10447 | } else {
|
10448 | msg += lineNum + ": " + lines[ii] + "\n";
|
10449 | }
|
10450 | }
|
10451 | }
|
10452 | err.message = msg + "\n";
|
10453 | return err;
|
10454 | }
|
10455 | }
|
10456 | });
|
10457 |
|
10458 |
|
10459 | var require_parse_async = __commonJS({
|
10460 | "node_modules/@iarna/toml/parse-async.js"(exports, module) {
|
10461 | "use strict";
|
10462 | module.exports = parseAsync;
|
10463 | var TOMLParser = require_toml_parser();
|
10464 | var prettyError = require_parse_pretty_error();
|
10465 | function parseAsync(str2, opts) {
|
10466 | if (!opts) opts = {};
|
10467 | const index = 0;
|
10468 | const blocksize = opts.blocksize || 40960;
|
10469 | const parser = new TOMLParser();
|
10470 | return new Promise((resolve3, reject) => {
|
10471 | setImmediate(parseAsyncNext, index, blocksize, resolve3, reject);
|
10472 | });
|
10473 | function parseAsyncNext(index2, blocksize2, resolve3, reject) {
|
10474 | if (index2 >= str2.length) {
|
10475 | try {
|
10476 | return resolve3(parser.finish());
|
10477 | } catch (err) {
|
10478 | return reject(prettyError(err, str2));
|
10479 | }
|
10480 | }
|
10481 | try {
|
10482 | parser.parse(str2.slice(index2, index2 + blocksize2));
|
10483 | setImmediate(parseAsyncNext, index2 + blocksize2, blocksize2, resolve3, reject);
|
10484 | } catch (err) {
|
10485 | reject(prettyError(err, str2));
|
10486 | }
|
10487 | }
|
10488 | }
|
10489 | }
|
10490 | });
|
10491 |
|
10492 |
|
10493 | var require_js_tokens = __commonJS({
|
10494 | "node_modules/js-tokens/index.js"(exports) {
|
10495 | Object.defineProperty(exports, "__esModule", {
|
10496 | value: true
|
10497 | });
|
10498 | exports.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g;
|
10499 | exports.matchToToken = function(match) {
|
10500 | var token2 = { type: "invalid", value: match[0], closed: void 0 };
|
10501 | if (match[1]) token2.type = "string", token2.closed = !!(match[3] || match[4]);
|
10502 | else if (match[5]) token2.type = "comment";
|
10503 | else if (match[6]) token2.type = "comment", token2.closed = !!match[7];
|
10504 | else if (match[8]) token2.type = "regex";
|
10505 | else if (match[9]) token2.type = "number";
|
10506 | else if (match[10]) token2.type = "name";
|
10507 | else if (match[11]) token2.type = "punctuator";
|
10508 | else if (match[12]) token2.type = "whitespace";
|
10509 | return token2;
|
10510 | };
|
10511 | }
|
10512 | });
|
10513 |
|
10514 |
|
10515 | var require_identifier = __commonJS({
|
10516 | "node_modules/@babel/helper-validator-identifier/lib/identifier.js"(exports) {
|
10517 | "use strict";
|
10518 | Object.defineProperty(exports, "__esModule", {
|
10519 | value: true
|
10520 | });
|
10521 | exports.isIdentifierChar = isIdentifierChar;
|
10522 | exports.isIdentifierName = isIdentifierName;
|
10523 | exports.isIdentifierStart = isIdentifierStart;
|
10524 | var nonASCIIidentifierStartChars = "\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BF\u31F0-\u31FF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC";
|
10525 | var nonASCIIidentifierChars = "\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u0898-\u089F\u08CA-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B55-\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C04\u0C3C\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0CF3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D81-\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EBC\u0EC8-\u0ECE\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u180F-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1ABF-\u1ACE\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DFF\u200C\u200D\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\u30FB\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA82C\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA8FF-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F\uFF65";
|
10526 | var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
10527 | var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
10528 | nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
|
10529 | var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 68, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 349, 41, 7, 1, 79, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 264, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 4026, 582, 8634, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 689, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 43, 8, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 757, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 4191];
|
10530 | var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 370, 1, 81, 2, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 406, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 9, 5351, 0, 7, 14, 13835, 9, 87, 9, 39, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4706, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 983, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
|
10531 | function isInAstralSet(code, set2) {
|
10532 | let pos2 = 65536;
|
10533 | for (let i = 0, length = set2.length; i < length; i += 2) {
|
10534 | pos2 += set2[i];
|
10535 | if (pos2 > code) return false;
|
10536 | pos2 += set2[i + 1];
|
10537 | if (pos2 >= code) return true;
|
10538 | }
|
10539 | return false;
|
10540 | }
|
10541 | function isIdentifierStart(code) {
|
10542 | if (code < 65) return code === 36;
|
10543 | if (code <= 90) return true;
|
10544 | if (code < 97) return code === 95;
|
10545 | if (code <= 122) return true;
|
10546 | if (code <= 65535) {
|
10547 | return code >= 170 && nonASCIIidentifierStart.test(String.fromCharCode(code));
|
10548 | }
|
10549 | return isInAstralSet(code, astralIdentifierStartCodes);
|
10550 | }
|
10551 | function isIdentifierChar(code) {
|
10552 | if (code < 48) return code === 36;
|
10553 | if (code < 58) return true;
|
10554 | if (code < 65) return false;
|
10555 | if (code <= 90) return true;
|
10556 | if (code < 97) return code === 95;
|
10557 | if (code <= 122) return true;
|
10558 | if (code <= 65535) {
|
10559 | return code >= 170 && nonASCIIidentifier.test(String.fromCharCode(code));
|
10560 | }
|
10561 | return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
|
10562 | }
|
10563 | function isIdentifierName(name) {
|
10564 | let isFirst = true;
|
10565 | for (let i = 0; i < name.length; i++) {
|
10566 | let cp = name.charCodeAt(i);
|
10567 | if ((cp & 64512) === 55296 && i + 1 < name.length) {
|
10568 | const trail = name.charCodeAt(++i);
|
10569 | if ((trail & 64512) === 56320) {
|
10570 | cp = 65536 + ((cp & 1023) << 10) + (trail & 1023);
|
10571 | }
|
10572 | }
|
10573 | if (isFirst) {
|
10574 | isFirst = false;
|
10575 | if (!isIdentifierStart(cp)) {
|
10576 | return false;
|
10577 | }
|
10578 | } else if (!isIdentifierChar(cp)) {
|
10579 | return false;
|
10580 | }
|
10581 | }
|
10582 | return !isFirst;
|
10583 | }
|
10584 | }
|
10585 | });
|
10586 |
|
10587 |
|
10588 | var require_keyword = __commonJS({
|
10589 | "node_modules/@babel/helper-validator-identifier/lib/keyword.js"(exports) {
|
10590 | "use strict";
|
10591 | Object.defineProperty(exports, "__esModule", {
|
10592 | value: true
|
10593 | });
|
10594 | exports.isKeyword = isKeyword;
|
10595 | exports.isReservedWord = isReservedWord;
|
10596 | exports.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord;
|
10597 | exports.isStrictBindReservedWord = isStrictBindReservedWord;
|
10598 | exports.isStrictReservedWord = isStrictReservedWord;
|
10599 | var reservedWords = {
|
10600 | keyword: ["break", "case", "catch", "continue", "debugger", "default", "do", "else", "finally", "for", "function", "if", "return", "switch", "throw", "try", "var", "const", "while", "with", "new", "this", "super", "class", "extends", "export", "import", "null", "true", "false", "in", "instanceof", "typeof", "void", "delete"],
|
10601 | strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
|
10602 | strictBind: ["eval", "arguments"]
|
10603 | };
|
10604 | var keywords = new Set(reservedWords.keyword);
|
10605 | var reservedWordsStrictSet = new Set(reservedWords.strict);
|
10606 | var reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
|
10607 | function isReservedWord(word, inModule) {
|
10608 | return inModule && word === "await" || word === "enum";
|
10609 | }
|
10610 | function isStrictReservedWord(word, inModule) {
|
10611 | return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
|
10612 | }
|
10613 | function isStrictBindOnlyReservedWord(word) {
|
10614 | return reservedWordsStrictBindSet.has(word);
|
10615 | }
|
10616 | function isStrictBindReservedWord(word, inModule) {
|
10617 | return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
|
10618 | }
|
10619 | function isKeyword(word) {
|
10620 | return keywords.has(word);
|
10621 | }
|
10622 | }
|
10623 | });
|
10624 |
|
10625 |
|
10626 | var require_lib = __commonJS({
|
10627 | "node_modules/@babel/helper-validator-identifier/lib/index.js"(exports) {
|
10628 | "use strict";
|
10629 | Object.defineProperty(exports, "__esModule", {
|
10630 | value: true
|
10631 | });
|
10632 | Object.defineProperty(exports, "isIdentifierChar", {
|
10633 | enumerable: true,
|
10634 | get: function() {
|
10635 | return _identifier.isIdentifierChar;
|
10636 | }
|
10637 | });
|
10638 | Object.defineProperty(exports, "isIdentifierName", {
|
10639 | enumerable: true,
|
10640 | get: function() {
|
10641 | return _identifier.isIdentifierName;
|
10642 | }
|
10643 | });
|
10644 | Object.defineProperty(exports, "isIdentifierStart", {
|
10645 | enumerable: true,
|
10646 | get: function() {
|
10647 | return _identifier.isIdentifierStart;
|
10648 | }
|
10649 | });
|
10650 | Object.defineProperty(exports, "isKeyword", {
|
10651 | enumerable: true,
|
10652 | get: function() {
|
10653 | return _keyword.isKeyword;
|
10654 | }
|
10655 | });
|
10656 | Object.defineProperty(exports, "isReservedWord", {
|
10657 | enumerable: true,
|
10658 | get: function() {
|
10659 | return _keyword.isReservedWord;
|
10660 | }
|
10661 | });
|
10662 | Object.defineProperty(exports, "isStrictBindOnlyReservedWord", {
|
10663 | enumerable: true,
|
10664 | get: function() {
|
10665 | return _keyword.isStrictBindOnlyReservedWord;
|
10666 | }
|
10667 | });
|
10668 | Object.defineProperty(exports, "isStrictBindReservedWord", {
|
10669 | enumerable: true,
|
10670 | get: function() {
|
10671 | return _keyword.isStrictBindReservedWord;
|
10672 | }
|
10673 | });
|
10674 | Object.defineProperty(exports, "isStrictReservedWord", {
|
10675 | enumerable: true,
|
10676 | get: function() {
|
10677 | return _keyword.isStrictReservedWord;
|
10678 | }
|
10679 | });
|
10680 | var _identifier = require_identifier();
|
10681 | var _keyword = require_keyword();
|
10682 | }
|
10683 | });
|
10684 |
|
10685 |
|
10686 | var require_picocolors = __commonJS({
|
10687 | "node_modules/picocolors/picocolors.js"(exports, module) {
|
10688 | var argv = process.argv || [];
|
10689 | var env2 = process.env;
|
10690 | var isColorSupported = !("NO_COLOR" in env2 || argv.includes("--no-color")) && ("FORCE_COLOR" in env2 || argv.includes("--color") || process.platform === "win32" || __require != null && __require("tty").isatty(1) && env2.TERM !== "dumb" || "CI" in env2);
|
10691 | var formatter = (open, close, replace = open) => (input) => {
|
10692 | let string = "" + input;
|
10693 | let index = string.indexOf(close, open.length);
|
10694 | return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
10695 | };
|
10696 | var replaceClose = (string, close, replace, index) => {
|
10697 | let result = "";
|
10698 | let cursor2 = 0;
|
10699 | do {
|
10700 | result += string.substring(cursor2, index) + replace;
|
10701 | cursor2 = index + close.length;
|
10702 | index = string.indexOf(close, cursor2);
|
10703 | } while (~index);
|
10704 | return result + string.substring(cursor2);
|
10705 | };
|
10706 | var createColors = (enabled = isColorSupported) => {
|
10707 | let init = enabled ? formatter : () => String;
|
10708 | return {
|
10709 | isColorSupported: enabled,
|
10710 | reset: init("\x1B[0m", "\x1B[0m"),
|
10711 | bold: init("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
10712 | dim: init("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
10713 | italic: init("\x1B[3m", "\x1B[23m"),
|
10714 | underline: init("\x1B[4m", "\x1B[24m"),
|
10715 | inverse: init("\x1B[7m", "\x1B[27m"),
|
10716 | hidden: init("\x1B[8m", "\x1B[28m"),
|
10717 | strikethrough: init("\x1B[9m", "\x1B[29m"),
|
10718 | black: init("\x1B[30m", "\x1B[39m"),
|
10719 | red: init("\x1B[31m", "\x1B[39m"),
|
10720 | green: init("\x1B[32m", "\x1B[39m"),
|
10721 | yellow: init("\x1B[33m", "\x1B[39m"),
|
10722 | blue: init("\x1B[34m", "\x1B[39m"),
|
10723 | magenta: init("\x1B[35m", "\x1B[39m"),
|
10724 | cyan: init("\x1B[36m", "\x1B[39m"),
|
10725 | white: init("\x1B[37m", "\x1B[39m"),
|
10726 | gray: init("\x1B[90m", "\x1B[39m"),
|
10727 | bgBlack: init("\x1B[40m", "\x1B[49m"),
|
10728 | bgRed: init("\x1B[41m", "\x1B[49m"),
|
10729 | bgGreen: init("\x1B[42m", "\x1B[49m"),
|
10730 | bgYellow: init("\x1B[43m", "\x1B[49m"),
|
10731 | bgBlue: init("\x1B[44m", "\x1B[49m"),
|
10732 | bgMagenta: init("\x1B[45m", "\x1B[49m"),
|
10733 | bgCyan: init("\x1B[46m", "\x1B[49m"),
|
10734 | bgWhite: init("\x1B[47m", "\x1B[49m")
|
10735 | };
|
10736 | };
|
10737 | module.exports = createColors();
|
10738 | module.exports.createColors = createColors;
|
10739 | }
|
10740 | });
|
10741 |
|
10742 |
|
10743 | var require_lib2 = __commonJS({
|
10744 | "node_modules/@babel/highlight/lib/index.js"(exports) {
|
10745 | "use strict";
|
10746 | Object.defineProperty(exports, "__esModule", {
|
10747 | value: true
|
10748 | });
|
10749 | exports.default = highlight;
|
10750 | exports.shouldHighlight = shouldHighlight;
|
10751 | var _jsTokens = require_js_tokens();
|
10752 | var _helperValidatorIdentifier = require_lib();
|
10753 | var _picocolors = _interopRequireWildcard(require_picocolors(), true);
|
10754 | function _getRequireWildcardCache(e) {
|
10755 | if ("function" != typeof WeakMap) return null;
|
10756 | var r = new WeakMap(), t = new WeakMap();
|
10757 | return (_getRequireWildcardCache = function(e2) {
|
10758 | return e2 ? t : r;
|
10759 | })(e);
|
10760 | }
|
10761 | function _interopRequireWildcard(e, r) {
|
10762 | if (!r && e && e.__esModule) return e;
|
10763 | if (null === e || "object" != typeof e && "function" != typeof e) return { default: e };
|
10764 | var t = _getRequireWildcardCache(r);
|
10765 | if (t && t.has(e)) return t.get(e);
|
10766 | var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
10767 | for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
|
10768 | var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
|
10769 | i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
|
10770 | }
|
10771 | return n.default = e, t && t.set(e, n), n;
|
10772 | }
|
10773 | var colors = typeof process === "object" && (process.env.FORCE_COLOR === "0" || process.env.FORCE_COLOR === "false") ? (0, _picocolors.createColors)(false) : _picocolors.default;
|
10774 | var compose = (f, g) => (v) => f(g(v));
|
10775 | var sometimesKeywords = new Set(["as", "async", "from", "get", "of", "set"]);
|
10776 | function getDefs(colors2) {
|
10777 | return {
|
10778 | keyword: colors2.cyan,
|
10779 | capitalized: colors2.yellow,
|
10780 | jsxIdentifier: colors2.yellow,
|
10781 | punctuator: colors2.yellow,
|
10782 | number: colors2.magenta,
|
10783 | string: colors2.green,
|
10784 | regex: colors2.magenta,
|
10785 | comment: colors2.gray,
|
10786 | invalid: compose(compose(colors2.white, colors2.bgRed), colors2.bold)
|
10787 | };
|
10788 | }
|
10789 | var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
10790 | var BRACKET = /^[()[\]{}]$/;
|
10791 | var tokenize2;
|
10792 | {
|
10793 | const JSX_TAG = /^[a-z][\w-]*$/i;
|
10794 | const getTokenType = function(token2, offset, text) {
|
10795 | if (token2.type === "name") {
|
10796 | if ((0, _helperValidatorIdentifier.isKeyword)(token2.value) || (0, _helperValidatorIdentifier.isStrictReservedWord)(token2.value, true) || sometimesKeywords.has(token2.value)) {
|
10797 | return "keyword";
|
10798 | }
|
10799 | if (JSX_TAG.test(token2.value) && (text[offset - 1] === "<" || text.slice(offset - 2, offset) === "</")) {
|
10800 | return "jsxIdentifier";
|
10801 | }
|
10802 | if (token2.value[0] !== token2.value[0].toLowerCase()) {
|
10803 | return "capitalized";
|
10804 | }
|
10805 | }
|
10806 | if (token2.type === "punctuator" && BRACKET.test(token2.value)) {
|
10807 | return "bracket";
|
10808 | }
|
10809 | if (token2.type === "invalid" && (token2.value === "@" || token2.value === "#")) {
|
10810 | return "punctuator";
|
10811 | }
|
10812 | return token2.type;
|
10813 | };
|
10814 | tokenize2 = function* (text) {
|
10815 | let match;
|
10816 | while (match = _jsTokens.default.exec(text)) {
|
10817 | const token2 = _jsTokens.matchToToken(match);
|
10818 | yield {
|
10819 | type: getTokenType(token2, match.index, text),
|
10820 | value: token2.value
|
10821 | };
|
10822 | }
|
10823 | };
|
10824 | }
|
10825 | function highlightTokens(defs, text) {
|
10826 | let highlighted = "";
|
10827 | for (const {
|
10828 | type: type2,
|
10829 | value
|
10830 | } of tokenize2(text)) {
|
10831 | const colorize = defs[type2];
|
10832 | if (colorize) {
|
10833 | highlighted += value.split(NEWLINE).map((str2) => colorize(str2)).join("\n");
|
10834 | } else {
|
10835 | highlighted += value;
|
10836 | }
|
10837 | }
|
10838 | return highlighted;
|
10839 | }
|
10840 | function shouldHighlight(options8) {
|
10841 | return colors.isColorSupported || options8.forceColor;
|
10842 | }
|
10843 | var pcWithForcedColor = void 0;
|
10844 | function getColors(forceColor) {
|
10845 | if (forceColor) {
|
10846 | var _pcWithForcedColor;
|
10847 | (_pcWithForcedColor = pcWithForcedColor) != null ? _pcWithForcedColor : pcWithForcedColor = (0, _picocolors.createColors)(true);
|
10848 | return pcWithForcedColor;
|
10849 | }
|
10850 | return colors;
|
10851 | }
|
10852 | function highlight(code, options8 = {}) {
|
10853 | if (code !== "" && shouldHighlight(options8)) {
|
10854 | const defs = getDefs(getColors(options8.forceColor));
|
10855 | return highlightTokens(defs, code);
|
10856 | } else {
|
10857 | return code;
|
10858 | }
|
10859 | }
|
10860 | {
|
10861 | let chalk2, chalkWithForcedColor;
|
10862 | exports.getChalk = ({
|
10863 | forceColor
|
10864 | }) => {
|
10865 | var _chalk;
|
10866 | (_chalk = chalk2) != null ? _chalk : chalk2 = (init_source(), __toCommonJS(source_exports));
|
10867 | if (forceColor) {
|
10868 | var _chalkWithForcedColor;
|
10869 | (_chalkWithForcedColor = chalkWithForcedColor) != null ? _chalkWithForcedColor : chalkWithForcedColor = new chalk2.constructor({
|
10870 | enabled: true,
|
10871 | level: 1
|
10872 | });
|
10873 | return chalkWithForcedColor;
|
10874 | }
|
10875 | return chalk2;
|
10876 | };
|
10877 | }
|
10878 | }
|
10879 | });
|
10880 |
|
10881 |
|
10882 | var require_lib3 = __commonJS({
|
10883 | "node_modules/@babel/code-frame/lib/index.js"(exports) {
|
10884 | "use strict";
|
10885 | Object.defineProperty(exports, "__esModule", {
|
10886 | value: true
|
10887 | });
|
10888 | exports.codeFrameColumns = codeFrameColumns3;
|
10889 | exports.default = _default2;
|
10890 | var _highlight = require_lib2();
|
10891 | var _picocolors = _interopRequireWildcard(require_picocolors(), true);
|
10892 | function _getRequireWildcardCache(e) {
|
10893 | if ("function" != typeof WeakMap) return null;
|
10894 | var r = new WeakMap(), t = new WeakMap();
|
10895 | return (_getRequireWildcardCache = function(e2) {
|
10896 | return e2 ? t : r;
|
10897 | })(e);
|
10898 | }
|
10899 | function _interopRequireWildcard(e, r) {
|
10900 | if (!r && e && e.__esModule) return e;
|
10901 | if (null === e || "object" != typeof e && "function" != typeof e) return { default: e };
|
10902 | var t = _getRequireWildcardCache(r);
|
10903 | if (t && t.has(e)) return t.get(e);
|
10904 | var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
10905 | for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
|
10906 | var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
|
10907 | i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
|
10908 | }
|
10909 | return n.default = e, t && t.set(e, n), n;
|
10910 | }
|
10911 | var colors = typeof process === "object" && (process.env.FORCE_COLOR === "0" || process.env.FORCE_COLOR === "false") ? (0, _picocolors.createColors)(false) : _picocolors.default;
|
10912 | var compose = (f, g) => (v) => f(g(v));
|
10913 | var pcWithForcedColor = void 0;
|
10914 | function getColors(forceColor) {
|
10915 | if (forceColor) {
|
10916 | var _pcWithForcedColor;
|
10917 | (_pcWithForcedColor = pcWithForcedColor) != null ? _pcWithForcedColor : pcWithForcedColor = (0, _picocolors.createColors)(true);
|
10918 | return pcWithForcedColor;
|
10919 | }
|
10920 | return colors;
|
10921 | }
|
10922 | var deprecationWarningShown = false;
|
10923 | function getDefs(colors2) {
|
10924 | return {
|
10925 | gutter: colors2.gray,
|
10926 | marker: compose(colors2.red, colors2.bold),
|
10927 | message: compose(colors2.red, colors2.bold)
|
10928 | };
|
10929 | }
|
10930 | var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
10931 | function getMarkerLines(loc, source2, opts) {
|
10932 | const startLoc = Object.assign({
|
10933 | column: 0,
|
10934 | line: -1
|
10935 | }, loc.start);
|
10936 | const endLoc = Object.assign({}, startLoc, loc.end);
|
10937 | const {
|
10938 | linesAbove = 2,
|
10939 | linesBelow = 3
|
10940 | } = opts || {};
|
10941 | const startLine = startLoc.line;
|
10942 | const startColumn = startLoc.column;
|
10943 | const endLine = endLoc.line;
|
10944 | const endColumn = endLoc.column;
|
10945 | let start = Math.max(startLine - (linesAbove + 1), 0);
|
10946 | let end = Math.min(source2.length, endLine + linesBelow);
|
10947 | if (startLine === -1) {
|
10948 | start = 0;
|
10949 | }
|
10950 | if (endLine === -1) {
|
10951 | end = source2.length;
|
10952 | }
|
10953 | const lineDiff2 = endLine - startLine;
|
10954 | const markerLines = {};
|
10955 | if (lineDiff2) {
|
10956 | for (let i = 0; i <= lineDiff2; i++) {
|
10957 | const lineNumber = i + startLine;
|
10958 | if (!startColumn) {
|
10959 | markerLines[lineNumber] = true;
|
10960 | } else if (i === 0) {
|
10961 | const sourceLength = source2[lineNumber - 1].length;
|
10962 | markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
|
10963 | } else if (i === lineDiff2) {
|
10964 | markerLines[lineNumber] = [0, endColumn];
|
10965 | } else {
|
10966 | const sourceLength = source2[lineNumber - i].length;
|
10967 | markerLines[lineNumber] = [0, sourceLength];
|
10968 | }
|
10969 | }
|
10970 | } else {
|
10971 | if (startColumn === endColumn) {
|
10972 | if (startColumn) {
|
10973 | markerLines[startLine] = [startColumn, 0];
|
10974 | } else {
|
10975 | markerLines[startLine] = true;
|
10976 | }
|
10977 | } else {
|
10978 | markerLines[startLine] = [startColumn, endColumn - startColumn];
|
10979 | }
|
10980 | }
|
10981 | return {
|
10982 | start,
|
10983 | end,
|
10984 | markerLines
|
10985 | };
|
10986 | }
|
10987 | function codeFrameColumns3(rawLines, loc, opts = {}) {
|
10988 | const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts);
|
10989 | const colors2 = getColors(opts.forceColor);
|
10990 | const defs = getDefs(colors2);
|
10991 | const maybeHighlight = (fmt, string) => {
|
10992 | return highlighted ? fmt(string) : string;
|
10993 | };
|
10994 | const lines = rawLines.split(NEWLINE);
|
10995 | const {
|
10996 | start,
|
10997 | end,
|
10998 | markerLines
|
10999 | } = getMarkerLines(loc, lines, opts);
|
11000 | const hasColumns = loc.start && typeof loc.start.column === "number";
|
11001 | const numberMaxWidth = String(end).length;
|
11002 | const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines;
|
11003 | let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line3, index) => {
|
11004 | const number = start + 1 + index;
|
11005 | const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
|
11006 | const gutter = ` ${paddedNumber} |`;
|
11007 | const hasMarker = markerLines[number];
|
11008 | const lastMarkerLine = !markerLines[number + 1];
|
11009 | if (hasMarker) {
|
11010 | let markerLine = "";
|
11011 | if (Array.isArray(hasMarker)) {
|
11012 | const markerSpacing = line3.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
|
11013 | const numberOfMarkers = hasMarker[1] || 1;
|
11014 | markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), " ", markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
|
11015 | if (lastMarkerLine && opts.message) {
|
11016 | markerLine += " " + maybeHighlight(defs.message, opts.message);
|
11017 | }
|
11018 | }
|
11019 | return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line3.length > 0 ? ` ${line3}` : "", markerLine].join("");
|
11020 | } else {
|
11021 | return ` ${maybeHighlight(defs.gutter, gutter)}${line3.length > 0 ? ` ${line3}` : ""}`;
|
11022 | }
|
11023 | }).join("\n");
|
11024 | if (opts.message && !hasColumns) {
|
11025 | frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}
|
11026 | ${frame}`;
|
11027 | }
|
11028 | if (highlighted) {
|
11029 | return colors2.reset(frame);
|
11030 | } else {
|
11031 | return frame;
|
11032 | }
|
11033 | }
|
11034 | function _default2(rawLines, lineNumber, colNumber, opts = {}) {
|
11035 | if (!deprecationWarningShown) {
|
11036 | deprecationWarningShown = true;
|
11037 | const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
|
11038 | if (process.emitWarning) {
|
11039 | process.emitWarning(message, "DeprecationWarning");
|
11040 | } else {
|
11041 | const deprecationError = new Error(message);
|
11042 | deprecationError.name = "DeprecationWarning";
|
11043 | console.warn(new Error(message));
|
11044 | }
|
11045 | }
|
11046 | colNumber = Math.max(colNumber, 0);
|
11047 | const location = {
|
11048 | start: {
|
11049 | column: colNumber,
|
11050 | line: lineNumber
|
11051 | }
|
11052 | };
|
11053 | return codeFrameColumns3(rawLines, location, opts);
|
11054 | }
|
11055 | }
|
11056 | });
|
11057 |
|
11058 |
|
11059 | var require_ignore = __commonJS({
|
11060 | "node_modules/ignore/index.js"(exports, module) {
|
11061 | function makeArray(subject) {
|
11062 | return Array.isArray(subject) ? subject : [subject];
|
11063 | }
|
11064 | var EMPTY = "";
|
11065 | var SPACE = " ";
|
11066 | var ESCAPE = "\\";
|
11067 | var REGEX_TEST_BLANK_LINE = /^\s+$/;
|
11068 | var REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/;
|
11069 | var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
|
11070 | var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
|
11071 | var REGEX_SPLITALL_CRLF = /\r?\n/g;
|
11072 | var REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/;
|
11073 | var SLASH = "/";
|
11074 | var TMP_KEY_IGNORE = "node-ignore";
|
11075 | if (typeof Symbol !== "undefined") {
|
11076 | TMP_KEY_IGNORE = Symbol.for("node-ignore");
|
11077 | }
|
11078 | var KEY_IGNORE = TMP_KEY_IGNORE;
|
11079 | var define = (object, key2, value) => Object.defineProperty(object, key2, { value });
|
11080 | var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
|
11081 | var RETURN_FALSE = () => false;
|
11082 | var sanitizeRange = (range) => range.replace(
|
11083 | REGEX_REGEXP_RANGE,
|
11084 | (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match : EMPTY
|
11085 | );
|
11086 | var cleanRangeBackSlash = (slashes) => {
|
11087 | const { length } = slashes;
|
11088 | return slashes.slice(0, length - length % 2);
|
11089 | };
|
11090 | var REPLACERS = [
|
11091 | [
|
11092 |
|
11093 |
|
11094 |
|
11095 | /^\uFEFF/,
|
11096 | () => EMPTY
|
11097 | ],
|
11098 |
|
11099 | [
|
11100 |
|
11101 |
|
11102 |
|
11103 | /\\?\s+$/,
|
11104 | (match) => match.indexOf("\\") === 0 ? SPACE : EMPTY
|
11105 | ],
|
11106 |
|
11107 | [
|
11108 | /\\\s/g,
|
11109 | () => SPACE
|
11110 | ],
|
11111 |
|
11112 |
|
11113 |
|
11114 |
|
11115 |
|
11116 |
|
11117 |
|
11118 |
|
11119 |
|
11120 |
|
11121 |
|
11122 |
|
11123 |
|
11124 |
|
11125 |
|
11126 |
|
11127 | [
|
11128 | /[\\$.|*+(){^]/g,
|
11129 | (match) => `\\${match}`
|
11130 | ],
|
11131 | [
|
11132 |
|
11133 | /(?!\\)\?/g,
|
11134 | () => "[^/]"
|
11135 | ],
|
11136 |
|
11137 | [
|
11138 |
|
11139 |
|
11140 |
|
11141 | /^\
|
11142 | () => "^"
|
11143 | ],
|
11144 |
|
11145 | [
|
11146 | /\
|
11147 | () => "\\/"
|
11148 | ],
|
11149 | [
|
11150 |
|
11151 |
|
11152 |
|
11153 |
|
11154 |
|
11155 |
|
11156 | /^\^*\\\*\\\*\\\
|
11157 |
|
11158 | () => "^(?:.*\\/)?"
|
11159 | ],
|
11160 |
|
11161 | [
|
11162 |
|
11163 |
|
11164 |
|
11165 | /^(?=[^^])/,
|
11166 | function startingReplacer() {
|
11167 | return !/\/(?!$)/.test(this) ? "(?:^|\\/)" : "^";
|
11168 | }
|
11169 | ],
|
11170 |
|
11171 | [
|
11172 |
|
11173 | /\\\/\\\*\\\*(?=\\\/|$)/g,
|
11174 |
|
11175 |
|
11176 |
|
11177 | (_, index, str2) => index + 6 < str2.length ? "(?:\\/[^\\/]+)*" : "\\/.+"
|
11178 | ],
|
11179 |
|
11180 | [
|
11181 |
|
11182 |
|
11183 |
|
11184 |
|
11185 |
|
11186 | /(^|[^\\]+)(\\\*)+(?=.+)/g,
|
11187 |
|
11188 |
|
11189 | (_, p1, p2) => {
|
11190 | const unescaped = p2.replace(/\\\*/g, "[^\\/]*");
|
11191 | return p1 + unescaped;
|
11192 | }
|
11193 | ],
|
11194 | [
|
11195 |
|
11196 |
|
11197 |
|
11198 | /\\\\\\(?=[$.|*+(){^])/g,
|
11199 | () => ESCAPE
|
11200 | ],
|
11201 | [
|
11202 |
|
11203 | /\\\\/g,
|
11204 | () => ESCAPE
|
11205 | ],
|
11206 | [
|
11207 |
|
11208 |
|
11209 |
|
11210 | /(\\)?\[([^\]/]*?)(\\*)($|\])/g,
|
11211 | (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}` : close === "]" ? endEscape.length % 2 === 0 ? `[${sanitizeRange(range)}${endEscape}]` : "[]" : "[]"
|
11212 | ],
|
11213 |
|
11214 | [
|
11215 |
|
11216 |
|
11217 | /(?:[^*])$/,
|
11218 |
|
11219 |
|
11220 |
|
11221 |
|
11222 |
|
11223 |
|
11224 |
|
11225 |
|
11226 |
|
11227 |
|
11228 | (match) => /\/$/.test(match) ? `${match}$` : `${match}(?=$|\\/$)`
|
11229 | ],
|
11230 |
|
11231 | [
|
11232 | /(\^|\\\/)?\\\*$/,
|
11233 | (_, p1) => {
|
11234 | const prefix = p1 ? `${p1}[^/]+` : "[^/]*";
|
11235 | return `${prefix}(?=$|\\/$)`;
|
11236 | }
|
11237 | ]
|
11238 | ];
|
11239 | var regexCache = Object.create(null);
|
11240 | var makeRegex = (pattern, ignoreCase) => {
|
11241 | let source2 = regexCache[pattern];
|
11242 | if (!source2) {
|
11243 | source2 = REPLACERS.reduce(
|
11244 | (prev, current) => prev.replace(current[0], current[1].bind(pattern)),
|
11245 | pattern
|
11246 | );
|
11247 | regexCache[pattern] = source2;
|
11248 | }
|
11249 | return ignoreCase ? new RegExp(source2, "i") : new RegExp(source2);
|
11250 | };
|
11251 | var isString = (subject) => typeof subject === "string";
|
11252 | var checkPattern = (pattern) => pattern && isString(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern) && pattern.indexOf("#") !== 0;
|
11253 | var splitPattern = (pattern) => pattern.split(REGEX_SPLITALL_CRLF);
|
11254 | var IgnoreRule = class {
|
11255 | constructor(origin, pattern, negative, regex) {
|
11256 | this.origin = origin;
|
11257 | this.pattern = pattern;
|
11258 | this.negative = negative;
|
11259 | this.regex = regex;
|
11260 | }
|
11261 | };
|
11262 | var createRule = (pattern, ignoreCase) => {
|
11263 | const origin = pattern;
|
11264 | let negative = false;
|
11265 | if (pattern.indexOf("!") === 0) {
|
11266 | negative = true;
|
11267 | pattern = pattern.substr(1);
|
11268 | }
|
11269 | pattern = pattern.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
|
11270 | const regex = makeRegex(pattern, ignoreCase);
|
11271 | return new IgnoreRule(
|
11272 | origin,
|
11273 | pattern,
|
11274 | negative,
|
11275 | regex
|
11276 | );
|
11277 | };
|
11278 | var throwError2 = (message, Ctor) => {
|
11279 | throw new Ctor(message);
|
11280 | };
|
11281 | var checkPath = (path13, originalPath, doThrow) => {
|
11282 | if (!isString(path13)) {
|
11283 | return doThrow(
|
11284 | `path must be a string, but got \`${originalPath}\``,
|
11285 | TypeError
|
11286 | );
|
11287 | }
|
11288 | if (!path13) {
|
11289 | return doThrow(`path must not be empty`, TypeError);
|
11290 | }
|
11291 | if (checkPath.isNotRelative(path13)) {
|
11292 | const r = "`path.relative()`d";
|
11293 | return doThrow(
|
11294 | `path should be a ${r} string, but got "${originalPath}"`,
|
11295 | RangeError
|
11296 | );
|
11297 | }
|
11298 | return true;
|
11299 | };
|
11300 | var isNotRelative = (path13) => REGEX_TEST_INVALID_PATH.test(path13);
|
11301 | checkPath.isNotRelative = isNotRelative;
|
11302 | checkPath.convert = (p) => p;
|
11303 | var Ignore = class {
|
11304 | constructor({
|
11305 | ignorecase = true,
|
11306 | ignoreCase = ignorecase,
|
11307 | allowRelativePaths = false
|
11308 | } = {}) {
|
11309 | define(this, KEY_IGNORE, true);
|
11310 | this._rules = [];
|
11311 | this._ignoreCase = ignoreCase;
|
11312 | this._allowRelativePaths = allowRelativePaths;
|
11313 | this._initCache();
|
11314 | }
|
11315 | _initCache() {
|
11316 | this._ignoreCache = Object.create(null);
|
11317 | this._testCache = Object.create(null);
|
11318 | }
|
11319 | _addPattern(pattern) {
|
11320 | if (pattern && pattern[KEY_IGNORE]) {
|
11321 | this._rules = this._rules.concat(pattern._rules);
|
11322 | this._added = true;
|
11323 | return;
|
11324 | }
|
11325 | if (checkPattern(pattern)) {
|
11326 | const rule = createRule(pattern, this._ignoreCase);
|
11327 | this._added = true;
|
11328 | this._rules.push(rule);
|
11329 | }
|
11330 | }
|
11331 |
|
11332 | add(pattern) {
|
11333 | this._added = false;
|
11334 | makeArray(
|
11335 | isString(pattern) ? splitPattern(pattern) : pattern
|
11336 | ).forEach(this._addPattern, this);
|
11337 | if (this._added) {
|
11338 | this._initCache();
|
11339 | }
|
11340 | return this;
|
11341 | }
|
11342 |
|
11343 | addPattern(pattern) {
|
11344 | return this.add(pattern);
|
11345 | }
|
11346 |
|
11347 |
|
11348 |
|
11349 |
|
11350 |
|
11351 |
|
11352 |
|
11353 |
|
11354 |
|
11355 |
|
11356 |
|
11357 |
|
11358 |
|
11359 | _testOne(path13, checkUnignored) {
|
11360 | let ignored = false;
|
11361 | let unignored = false;
|
11362 | this._rules.forEach((rule) => {
|
11363 | const { negative } = rule;
|
11364 | if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
|
11365 | return;
|
11366 | }
|
11367 | const matched = rule.regex.test(path13);
|
11368 | if (matched) {
|
11369 | ignored = !negative;
|
11370 | unignored = negative;
|
11371 | }
|
11372 | });
|
11373 | return {
|
11374 | ignored,
|
11375 | unignored
|
11376 | };
|
11377 | }
|
11378 |
|
11379 | _test(originalPath, cache3, checkUnignored, slices) {
|
11380 | const path13 = originalPath && checkPath.convert(originalPath);
|
11381 | checkPath(
|
11382 | path13,
|
11383 | originalPath,
|
11384 | this._allowRelativePaths ? RETURN_FALSE : throwError2
|
11385 | );
|
11386 | return this._t(path13, cache3, checkUnignored, slices);
|
11387 | }
|
11388 | _t(path13, cache3, checkUnignored, slices) {
|
11389 | if (path13 in cache3) {
|
11390 | return cache3[path13];
|
11391 | }
|
11392 | if (!slices) {
|
11393 | slices = path13.split(SLASH);
|
11394 | }
|
11395 | slices.pop();
|
11396 | if (!slices.length) {
|
11397 | return cache3[path13] = this._testOne(path13, checkUnignored);
|
11398 | }
|
11399 | const parent = this._t(
|
11400 | slices.join(SLASH) + SLASH,
|
11401 | cache3,
|
11402 | checkUnignored,
|
11403 | slices
|
11404 | );
|
11405 | return cache3[path13] = parent.ignored ? parent : this._testOne(path13, checkUnignored);
|
11406 | }
|
11407 | ignores(path13) {
|
11408 | return this._test(path13, this._ignoreCache, false).ignored;
|
11409 | }
|
11410 | createFilter() {
|
11411 | return (path13) => !this.ignores(path13);
|
11412 | }
|
11413 | filter(paths) {
|
11414 | return makeArray(paths).filter(this.createFilter());
|
11415 | }
|
11416 |
|
11417 | test(path13) {
|
11418 | return this._test(path13, this._testCache, true);
|
11419 | }
|
11420 | };
|
11421 | var factory = (options8) => new Ignore(options8);
|
11422 | var isPathValid = (path13) => checkPath(path13 && checkPath.convert(path13), path13, RETURN_FALSE);
|
11423 | factory.isPathValid = isPathValid;
|
11424 | factory.default = factory;
|
11425 | module.exports = factory;
|
11426 | if (
|
11427 |
|
11428 | typeof process !== "undefined" && (process.env && process.env.IGNORE_TEST_WIN32 || process.platform === "win32")
|
11429 | ) {
|
11430 | const makePosix = (str2) => /^\\\\\?\\/.test(str2) || /["<>|\u0000-\u001F]+/u.test(str2) ? str2 : str2.replace(/\\/g, "/");
|
11431 | checkPath.convert = makePosix;
|
11432 | const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
|
11433 | checkPath.isNotRelative = (path13) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path13) || isNotRelative(path13);
|
11434 | }
|
11435 | }
|
11436 | });
|
11437 |
|
11438 |
|
11439 | var require_readlines = __commonJS({
|
11440 | "node_modules/n-readlines/readlines.js"(exports, module) {
|
11441 | "use strict";
|
11442 | var fs7 = __require("fs");
|
11443 | var LineByLine = class {
|
11444 | constructor(file, options8) {
|
11445 | options8 = options8 || {};
|
11446 | if (!options8.readChunk) options8.readChunk = 1024;
|
11447 | if (!options8.newLineCharacter) {
|
11448 | options8.newLineCharacter = 10;
|
11449 | } else {
|
11450 | options8.newLineCharacter = options8.newLineCharacter.charCodeAt(0);
|
11451 | }
|
11452 | if (typeof file === "number") {
|
11453 | this.fd = file;
|
11454 | } else {
|
11455 | this.fd = fs7.openSync(file, "r");
|
11456 | }
|
11457 | this.options = options8;
|
11458 | this.newLineCharacter = options8.newLineCharacter;
|
11459 | this.reset();
|
11460 | }
|
11461 | _searchInBuffer(buffer2, hexNeedle) {
|
11462 | let found = -1;
|
11463 | for (let i = 0; i <= buffer2.length; i++) {
|
11464 | let b_byte = buffer2[i];
|
11465 | if (b_byte === hexNeedle) {
|
11466 | found = i;
|
11467 | break;
|
11468 | }
|
11469 | }
|
11470 | return found;
|
11471 | }
|
11472 | reset() {
|
11473 | this.eofReached = false;
|
11474 | this.linesCache = [];
|
11475 | this.fdPosition = 0;
|
11476 | }
|
11477 | close() {
|
11478 | fs7.closeSync(this.fd);
|
11479 | this.fd = null;
|
11480 | }
|
11481 | _extractLines(buffer2) {
|
11482 | let line3;
|
11483 | const lines = [];
|
11484 | let bufferPosition = 0;
|
11485 | let lastNewLineBufferPosition = 0;
|
11486 | while (true) {
|
11487 | let bufferPositionValue = buffer2[bufferPosition++];
|
11488 | if (bufferPositionValue === this.newLineCharacter) {
|
11489 | line3 = buffer2.slice(lastNewLineBufferPosition, bufferPosition);
|
11490 | lines.push(line3);
|
11491 | lastNewLineBufferPosition = bufferPosition;
|
11492 | } else if (bufferPositionValue === void 0) {
|
11493 | break;
|
11494 | }
|
11495 | }
|
11496 | let leftovers = buffer2.slice(lastNewLineBufferPosition, bufferPosition);
|
11497 | if (leftovers.length) {
|
11498 | lines.push(leftovers);
|
11499 | }
|
11500 | return lines;
|
11501 | }
|
11502 | _readChunk(lineLeftovers) {
|
11503 | let totalBytesRead = 0;
|
11504 | let bytesRead;
|
11505 | const buffers = [];
|
11506 | do {
|
11507 | const readBuffer = Buffer.alloc(this.options.readChunk);
|
11508 | bytesRead = fs7.readSync(this.fd, readBuffer, 0, this.options.readChunk, this.fdPosition);
|
11509 | totalBytesRead = totalBytesRead + bytesRead;
|
11510 | this.fdPosition = this.fdPosition + bytesRead;
|
11511 | buffers.push(readBuffer);
|
11512 | } while (bytesRead && this._searchInBuffer(buffers[buffers.length - 1], this.options.newLineCharacter) === -1);
|
11513 | let bufferData = Buffer.concat(buffers);
|
11514 | if (bytesRead < this.options.readChunk) {
|
11515 | this.eofReached = true;
|
11516 | bufferData = bufferData.slice(0, totalBytesRead);
|
11517 | }
|
11518 | if (totalBytesRead) {
|
11519 | this.linesCache = this._extractLines(bufferData);
|
11520 | if (lineLeftovers) {
|
11521 | this.linesCache[0] = Buffer.concat([lineLeftovers, this.linesCache[0]]);
|
11522 | }
|
11523 | }
|
11524 | return totalBytesRead;
|
11525 | }
|
11526 | next() {
|
11527 | if (!this.fd) return false;
|
11528 | let line3 = false;
|
11529 | if (this.eofReached && this.linesCache.length === 0) {
|
11530 | return line3;
|
11531 | }
|
11532 | let bytesRead;
|
11533 | if (!this.linesCache.length) {
|
11534 | bytesRead = this._readChunk();
|
11535 | }
|
11536 | if (this.linesCache.length) {
|
11537 | line3 = this.linesCache.shift();
|
11538 | const lastLineCharacter = line3[line3.length - 1];
|
11539 | if (lastLineCharacter !== this.newLineCharacter) {
|
11540 | bytesRead = this._readChunk(line3);
|
11541 | if (bytesRead) {
|
11542 | line3 = this.linesCache.shift();
|
11543 | }
|
11544 | }
|
11545 | }
|
11546 | if (this.eofReached && this.linesCache.length === 0) {
|
11547 | this.close();
|
11548 | }
|
11549 | if (line3 && line3[line3.length - 1] === this.newLineCharacter) {
|
11550 | line3 = line3.slice(0, line3.length - 1);
|
11551 | }
|
11552 | return line3;
|
11553 | }
|
11554 | };
|
11555 | module.exports = LineByLine;
|
11556 | }
|
11557 | });
|
11558 |
|
11559 |
|
11560 | var src_exports = {};
|
11561 | __export(src_exports, {
|
11562 | __debug: () => debugApis,
|
11563 | __internal: () => sharedWithCli,
|
11564 | check: () => check,
|
11565 | clearConfigCache: () => clearCache3,
|
11566 | doc: () => doc,
|
11567 | format: () => format2,
|
11568 | formatWithCursor: () => formatWithCursor2,
|
11569 | getFileInfo: () => getFileInfo2,
|
11570 | getSupportInfo: () => getSupportInfo2,
|
11571 | resolveConfig: () => resolveConfig,
|
11572 | resolveConfigFile: () => resolveConfigFile,
|
11573 | util: () => public_exports,
|
11574 | version: () => version_evaluate_default
|
11575 | });
|
11576 |
|
11577 |
|
11578 | function Diff() {
|
11579 | }
|
11580 | Diff.prototype = {
|
11581 | diff: function diff(oldString, newString) {
|
11582 | var _options$timeout;
|
11583 | var options8 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
11584 | var callback = options8.callback;
|
11585 | if (typeof options8 === "function") {
|
11586 | callback = options8;
|
11587 | options8 = {};
|
11588 | }
|
11589 | this.options = options8;
|
11590 | var self = this;
|
11591 | function done(value) {
|
11592 | if (callback) {
|
11593 | setTimeout(function() {
|
11594 | callback(void 0, value);
|
11595 | }, 0);
|
11596 | return true;
|
11597 | } else {
|
11598 | return value;
|
11599 | }
|
11600 | }
|
11601 | oldString = this.castInput(oldString);
|
11602 | newString = this.castInput(newString);
|
11603 | oldString = this.removeEmpty(this.tokenize(oldString));
|
11604 | newString = this.removeEmpty(this.tokenize(newString));
|
11605 | var newLen = newString.length, oldLen = oldString.length;
|
11606 | var editLength = 1;
|
11607 | var maxEditLength = newLen + oldLen;
|
11608 | if (options8.maxEditLength) {
|
11609 | maxEditLength = Math.min(maxEditLength, options8.maxEditLength);
|
11610 | }
|
11611 | var maxExecutionTime = (_options$timeout = options8.timeout) !== null && _options$timeout !== void 0 ? _options$timeout : Infinity;
|
11612 | var abortAfterTimestamp = Date.now() + maxExecutionTime;
|
11613 | var bestPath = [{
|
11614 | oldPos: -1,
|
11615 | lastComponent: void 0
|
11616 | }];
|
11617 | var newPos = this.extractCommon(bestPath[0], newString, oldString, 0);
|
11618 | if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
11619 | return done([{
|
11620 | value: this.join(newString),
|
11621 | count: newString.length
|
11622 | }]);
|
11623 | }
|
11624 | var minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
|
11625 | function execEditLength() {
|
11626 | for (var diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
|
11627 | var basePath = void 0;
|
11628 | var removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
|
11629 | if (removePath) {
|
11630 | bestPath[diagonalPath - 1] = void 0;
|
11631 | }
|
11632 | var canAdd = false;
|
11633 | if (addPath) {
|
11634 | var addPathNewPos = addPath.oldPos - diagonalPath;
|
11635 | canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
|
11636 | }
|
11637 | var canRemove = removePath && removePath.oldPos + 1 < oldLen;
|
11638 | if (!canAdd && !canRemove) {
|
11639 | bestPath[diagonalPath] = void 0;
|
11640 | continue;
|
11641 | }
|
11642 | if (!canRemove || canAdd && removePath.oldPos + 1 < addPath.oldPos) {
|
11643 | basePath = self.addToPath(addPath, true, void 0, 0);
|
11644 | } else {
|
11645 | basePath = self.addToPath(removePath, void 0, true, 1);
|
11646 | }
|
11647 | newPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
|
11648 | if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
11649 | return done(buildValues(self, basePath.lastComponent, newString, oldString, self.useLongestToken));
|
11650 | } else {
|
11651 | bestPath[diagonalPath] = basePath;
|
11652 | if (basePath.oldPos + 1 >= oldLen) {
|
11653 | maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
|
11654 | }
|
11655 | if (newPos + 1 >= newLen) {
|
11656 | minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
|
11657 | }
|
11658 | }
|
11659 | }
|
11660 | editLength++;
|
11661 | }
|
11662 | if (callback) {
|
11663 | (function exec() {
|
11664 | setTimeout(function() {
|
11665 | if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
|
11666 | return callback();
|
11667 | }
|
11668 | if (!execEditLength()) {
|
11669 | exec();
|
11670 | }
|
11671 | }, 0);
|
11672 | })();
|
11673 | } else {
|
11674 | while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
|
11675 | var ret = execEditLength();
|
11676 | if (ret) {
|
11677 | return ret;
|
11678 | }
|
11679 | }
|
11680 | }
|
11681 | },
|
11682 | addToPath: function addToPath(path13, added, removed, oldPosInc) {
|
11683 | var last = path13.lastComponent;
|
11684 | if (last && last.added === added && last.removed === removed) {
|
11685 | return {
|
11686 | oldPos: path13.oldPos + oldPosInc,
|
11687 | lastComponent: {
|
11688 | count: last.count + 1,
|
11689 | added,
|
11690 | removed,
|
11691 | previousComponent: last.previousComponent
|
11692 | }
|
11693 | };
|
11694 | } else {
|
11695 | return {
|
11696 | oldPos: path13.oldPos + oldPosInc,
|
11697 | lastComponent: {
|
11698 | count: 1,
|
11699 | added,
|
11700 | removed,
|
11701 | previousComponent: last
|
11702 | }
|
11703 | };
|
11704 | }
|
11705 | },
|
11706 | extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
|
11707 | var newLen = newString.length, oldLen = oldString.length, oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
|
11708 | while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
|
11709 | newPos++;
|
11710 | oldPos++;
|
11711 | commonCount++;
|
11712 | }
|
11713 | if (commonCount) {
|
11714 | basePath.lastComponent = {
|
11715 | count: commonCount,
|
11716 | previousComponent: basePath.lastComponent
|
11717 | };
|
11718 | }
|
11719 | basePath.oldPos = oldPos;
|
11720 | return newPos;
|
11721 | },
|
11722 | equals: function equals(left, right) {
|
11723 | if (this.options.comparator) {
|
11724 | return this.options.comparator(left, right);
|
11725 | } else {
|
11726 | return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
|
11727 | }
|
11728 | },
|
11729 | removeEmpty: function removeEmpty(array2) {
|
11730 | var ret = [];
|
11731 | for (var i = 0; i < array2.length; i++) {
|
11732 | if (array2[i]) {
|
11733 | ret.push(array2[i]);
|
11734 | }
|
11735 | }
|
11736 | return ret;
|
11737 | },
|
11738 | castInput: function castInput(value) {
|
11739 | return value;
|
11740 | },
|
11741 | tokenize: function tokenize(value) {
|
11742 | return value.split("");
|
11743 | },
|
11744 | join: function join(chars) {
|
11745 | return chars.join("");
|
11746 | }
|
11747 | };
|
11748 | function buildValues(diff2, lastComponent, newString, oldString, useLongestToken) {
|
11749 | var components = [];
|
11750 | var nextComponent;
|
11751 | while (lastComponent) {
|
11752 | components.push(lastComponent);
|
11753 | nextComponent = lastComponent.previousComponent;
|
11754 | delete lastComponent.previousComponent;
|
11755 | lastComponent = nextComponent;
|
11756 | }
|
11757 | components.reverse();
|
11758 | var componentPos = 0, componentLen = components.length, newPos = 0, oldPos = 0;
|
11759 | for (; componentPos < componentLen; componentPos++) {
|
11760 | var component = components[componentPos];
|
11761 | if (!component.removed) {
|
11762 | if (!component.added && useLongestToken) {
|
11763 | var value = newString.slice(newPos, newPos + component.count);
|
11764 | value = value.map(function(value2, i) {
|
11765 | var oldValue = oldString[oldPos + i];
|
11766 | return oldValue.length > value2.length ? oldValue : value2;
|
11767 | });
|
11768 | component.value = diff2.join(value);
|
11769 | } else {
|
11770 | component.value = diff2.join(newString.slice(newPos, newPos + component.count));
|
11771 | }
|
11772 | newPos += component.count;
|
11773 | if (!component.added) {
|
11774 | oldPos += component.count;
|
11775 | }
|
11776 | } else {
|
11777 | component.value = diff2.join(oldString.slice(oldPos, oldPos + component.count));
|
11778 | oldPos += component.count;
|
11779 | if (componentPos && components[componentPos - 1].added) {
|
11780 | var tmp = components[componentPos - 1];
|
11781 | components[componentPos - 1] = components[componentPos];
|
11782 | components[componentPos] = tmp;
|
11783 | }
|
11784 | }
|
11785 | }
|
11786 | var finalComponent = components[componentLen - 1];
|
11787 | if (componentLen > 1 && typeof finalComponent.value === "string" && (finalComponent.added || finalComponent.removed) && diff2.equals("", finalComponent.value)) {
|
11788 | components[componentLen - 2].value += finalComponent.value;
|
11789 | components.pop();
|
11790 | }
|
11791 | return components;
|
11792 | }
|
11793 | var characterDiff = new Diff();
|
11794 | var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/;
|
11795 | var reWhitespace = /\S/;
|
11796 | var wordDiff = new Diff();
|
11797 | wordDiff.equals = function(left, right) {
|
11798 | if (this.options.ignoreCase) {
|
11799 | left = left.toLowerCase();
|
11800 | right = right.toLowerCase();
|
11801 | }
|
11802 | return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right);
|
11803 | };
|
11804 | wordDiff.tokenize = function(value) {
|
11805 | var tokens = value.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/);
|
11806 | for (var i = 0; i < tokens.length - 1; i++) {
|
11807 | if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) {
|
11808 | tokens[i] += tokens[i + 2];
|
11809 | tokens.splice(i + 1, 2);
|
11810 | i--;
|
11811 | }
|
11812 | }
|
11813 | return tokens;
|
11814 | };
|
11815 | var lineDiff = new Diff();
|
11816 | lineDiff.tokenize = function(value) {
|
11817 | if (this.options.stripTrailingCr) {
|
11818 | value = value.replace(/\r\n/g, "\n");
|
11819 | }
|
11820 | var retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/);
|
11821 | if (!linesAndNewlines[linesAndNewlines.length - 1]) {
|
11822 | linesAndNewlines.pop();
|
11823 | }
|
11824 | for (var i = 0; i < linesAndNewlines.length; i++) {
|
11825 | var line3 = linesAndNewlines[i];
|
11826 | if (i % 2 && !this.options.newlineIsToken) {
|
11827 | retLines[retLines.length - 1] += line3;
|
11828 | } else {
|
11829 | if (this.options.ignoreWhitespace) {
|
11830 | line3 = line3.trim();
|
11831 | }
|
11832 | retLines.push(line3);
|
11833 | }
|
11834 | }
|
11835 | return retLines;
|
11836 | };
|
11837 | function diffLines(oldStr, newStr, callback) {
|
11838 | return lineDiff.diff(oldStr, newStr, callback);
|
11839 | }
|
11840 | var sentenceDiff = new Diff();
|
11841 | sentenceDiff.tokenize = function(value) {
|
11842 | return value.split(/(\S.+?[.!?])(?=\s+|$)/);
|
11843 | };
|
11844 | var cssDiff = new Diff();
|
11845 | cssDiff.tokenize = function(value) {
|
11846 | return value.split(/([{}:;,]|\s+)/);
|
11847 | };
|
11848 | function _typeof(obj) {
|
11849 | "@babel/helpers - typeof";
|
11850 | if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
11851 | _typeof = function(obj2) {
|
11852 | return typeof obj2;
|
11853 | };
|
11854 | } else {
|
11855 | _typeof = function(obj2) {
|
11856 | return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
11857 | };
|
11858 | }
|
11859 | return _typeof(obj);
|
11860 | }
|
11861 | function _toConsumableArray(arr) {
|
11862 | return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
11863 | }
|
11864 | function _arrayWithoutHoles(arr) {
|
11865 | if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
11866 | }
|
11867 | function _iterableToArray(iter) {
|
11868 | if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
|
11869 | }
|
11870 | function _unsupportedIterableToArray(o, minLen) {
|
11871 | if (!o) return;
|
11872 | if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
11873 | var n = Object.prototype.toString.call(o).slice(8, -1);
|
11874 | if (n === "Object" && o.constructor) n = o.constructor.name;
|
11875 | if (n === "Map" || n === "Set") return Array.from(o);
|
11876 | if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
11877 | }
|
11878 | function _arrayLikeToArray(arr, len) {
|
11879 | if (len == null || len > arr.length) len = arr.length;
|
11880 | for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
11881 | return arr2;
|
11882 | }
|
11883 | function _nonIterableSpread() {
|
11884 | throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
11885 | }
|
11886 | var objectPrototypeToString = Object.prototype.toString;
|
11887 | var jsonDiff = new Diff();
|
11888 | jsonDiff.useLongestToken = true;
|
11889 | jsonDiff.tokenize = lineDiff.tokenize;
|
11890 | jsonDiff.castInput = function(value) {
|
11891 | var _this$options = this.options, undefinedReplacement = _this$options.undefinedReplacement, _this$options$stringi = _this$options.stringifyReplacer, stringifyReplacer = _this$options$stringi === void 0 ? function(k, v) {
|
11892 | return typeof v === "undefined" ? undefinedReplacement : v;
|
11893 | } : _this$options$stringi;
|
11894 | return typeof value === "string" ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, " ");
|
11895 | };
|
11896 | jsonDiff.equals = function(left, right) {
|
11897 | return Diff.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, "$1"), right.replace(/,([\r\n])/g, "$1"));
|
11898 | };
|
11899 | function canonicalize(obj, stack2, replacementStack, replacer, key2) {
|
11900 | stack2 = stack2 || [];
|
11901 | replacementStack = replacementStack || [];
|
11902 | if (replacer) {
|
11903 | obj = replacer(key2, obj);
|
11904 | }
|
11905 | var i;
|
11906 | for (i = 0; i < stack2.length; i += 1) {
|
11907 | if (stack2[i] === obj) {
|
11908 | return replacementStack[i];
|
11909 | }
|
11910 | }
|
11911 | var canonicalizedObj;
|
11912 | if ("[object Array]" === objectPrototypeToString.call(obj)) {
|
11913 | stack2.push(obj);
|
11914 | canonicalizedObj = new Array(obj.length);
|
11915 | replacementStack.push(canonicalizedObj);
|
11916 | for (i = 0; i < obj.length; i += 1) {
|
11917 | canonicalizedObj[i] = canonicalize(obj[i], stack2, replacementStack, replacer, key2);
|
11918 | }
|
11919 | stack2.pop();
|
11920 | replacementStack.pop();
|
11921 | return canonicalizedObj;
|
11922 | }
|
11923 | if (obj && obj.toJSON) {
|
11924 | obj = obj.toJSON();
|
11925 | }
|
11926 | if (_typeof(obj) === "object" && obj !== null) {
|
11927 | stack2.push(obj);
|
11928 | canonicalizedObj = {};
|
11929 | replacementStack.push(canonicalizedObj);
|
11930 | var sortedKeys = [], _key;
|
11931 | for (_key in obj) {
|
11932 | if (obj.hasOwnProperty(_key)) {
|
11933 | sortedKeys.push(_key);
|
11934 | }
|
11935 | }
|
11936 | sortedKeys.sort();
|
11937 | for (i = 0; i < sortedKeys.length; i += 1) {
|
11938 | _key = sortedKeys[i];
|
11939 | canonicalizedObj[_key] = canonicalize(obj[_key], stack2, replacementStack, replacer, _key);
|
11940 | }
|
11941 | stack2.pop();
|
11942 | replacementStack.pop();
|
11943 | } else {
|
11944 | canonicalizedObj = obj;
|
11945 | }
|
11946 | return canonicalizedObj;
|
11947 | }
|
11948 | var arrayDiff = new Diff();
|
11949 | arrayDiff.tokenize = function(value) {
|
11950 | return value.slice();
|
11951 | };
|
11952 | arrayDiff.join = arrayDiff.removeEmpty = function(value) {
|
11953 | return value;
|
11954 | };
|
11955 | function diffArrays(oldArr, newArr, callback) {
|
11956 | return arrayDiff.diff(oldArr, newArr, callback);
|
11957 | }
|
11958 | function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options8) {
|
11959 | if (!options8) {
|
11960 | options8 = {};
|
11961 | }
|
11962 | if (typeof options8.context === "undefined") {
|
11963 | options8.context = 4;
|
11964 | }
|
11965 | var diff2 = diffLines(oldStr, newStr, options8);
|
11966 | if (!diff2) {
|
11967 | return;
|
11968 | }
|
11969 | diff2.push({
|
11970 | value: "",
|
11971 | lines: []
|
11972 | });
|
11973 | function contextLines(lines) {
|
11974 | return lines.map(function(entry) {
|
11975 | return " " + entry;
|
11976 | });
|
11977 | }
|
11978 | var hunks = [];
|
11979 | var oldRangeStart = 0, newRangeStart = 0, curRange = [], oldLine = 1, newLine = 1;
|
11980 | var _loop = function _loop2(i2) {
|
11981 | var current = diff2[i2], lines = current.lines || current.value.replace(/\n$/, "").split("\n");
|
11982 | current.lines = lines;
|
11983 | if (current.added || current.removed) {
|
11984 | var _curRange;
|
11985 | if (!oldRangeStart) {
|
11986 | var prev = diff2[i2 - 1];
|
11987 | oldRangeStart = oldLine;
|
11988 | newRangeStart = newLine;
|
11989 | if (prev) {
|
11990 | curRange = options8.context > 0 ? contextLines(prev.lines.slice(-options8.context)) : [];
|
11991 | oldRangeStart -= curRange.length;
|
11992 | newRangeStart -= curRange.length;
|
11993 | }
|
11994 | }
|
11995 | (_curRange = curRange).push.apply(_curRange, _toConsumableArray(lines.map(function(entry) {
|
11996 | return (current.added ? "+" : "-") + entry;
|
11997 | })));
|
11998 | if (current.added) {
|
11999 | newLine += lines.length;
|
12000 | } else {
|
12001 | oldLine += lines.length;
|
12002 | }
|
12003 | } else {
|
12004 | if (oldRangeStart) {
|
12005 | if (lines.length <= options8.context * 2 && i2 < diff2.length - 2) {
|
12006 | var _curRange2;
|
12007 | (_curRange2 = curRange).push.apply(_curRange2, _toConsumableArray(contextLines(lines)));
|
12008 | } else {
|
12009 | var _curRange3;
|
12010 | var contextSize = Math.min(lines.length, options8.context);
|
12011 | (_curRange3 = curRange).push.apply(_curRange3, _toConsumableArray(contextLines(lines.slice(0, contextSize))));
|
12012 | var hunk = {
|
12013 | oldStart: oldRangeStart,
|
12014 | oldLines: oldLine - oldRangeStart + contextSize,
|
12015 | newStart: newRangeStart,
|
12016 | newLines: newLine - newRangeStart + contextSize,
|
12017 | lines: curRange
|
12018 | };
|
12019 | if (i2 >= diff2.length - 2 && lines.length <= options8.context) {
|
12020 | var oldEOFNewline = /\n$/.test(oldStr);
|
12021 | var newEOFNewline = /\n$/.test(newStr);
|
12022 | var noNlBeforeAdds = lines.length == 0 && curRange.length > hunk.oldLines;
|
12023 | if (!oldEOFNewline && noNlBeforeAdds && oldStr.length > 0) {
|
12024 | curRange.splice(hunk.oldLines, 0, "\\ No newline at end of file");
|
12025 | }
|
12026 | if (!oldEOFNewline && !noNlBeforeAdds || !newEOFNewline) {
|
12027 | curRange.push("\\ No newline at end of file");
|
12028 | }
|
12029 | }
|
12030 | hunks.push(hunk);
|
12031 | oldRangeStart = 0;
|
12032 | newRangeStart = 0;
|
12033 | curRange = [];
|
12034 | }
|
12035 | }
|
12036 | oldLine += lines.length;
|
12037 | newLine += lines.length;
|
12038 | }
|
12039 | };
|
12040 | for (var i = 0; i < diff2.length; i++) {
|
12041 | _loop(i);
|
12042 | }
|
12043 | return {
|
12044 | oldFileName,
|
12045 | newFileName,
|
12046 | oldHeader,
|
12047 | newHeader,
|
12048 | hunks
|
12049 | };
|
12050 | }
|
12051 | function formatPatch(diff2) {
|
12052 | if (Array.isArray(diff2)) {
|
12053 | return diff2.map(formatPatch).join("\n");
|
12054 | }
|
12055 | var ret = [];
|
12056 | if (diff2.oldFileName == diff2.newFileName) {
|
12057 | ret.push("Index: " + diff2.oldFileName);
|
12058 | }
|
12059 | ret.push("===================================================================");
|
12060 | ret.push("--- " + diff2.oldFileName + (typeof diff2.oldHeader === "undefined" ? "" : " " + diff2.oldHeader));
|
12061 | ret.push("+++ " + diff2.newFileName + (typeof diff2.newHeader === "undefined" ? "" : " " + diff2.newHeader));
|
12062 | for (var i = 0; i < diff2.hunks.length; i++) {
|
12063 | var hunk = diff2.hunks[i];
|
12064 | if (hunk.oldLines === 0) {
|
12065 | hunk.oldStart -= 1;
|
12066 | }
|
12067 | if (hunk.newLines === 0) {
|
12068 | hunk.newStart -= 1;
|
12069 | }
|
12070 | ret.push("@@ -" + hunk.oldStart + "," + hunk.oldLines + " +" + hunk.newStart + "," + hunk.newLines + " @@");
|
12071 | ret.push.apply(ret, hunk.lines);
|
12072 | }
|
12073 | return ret.join("\n") + "\n";
|
12074 | }
|
12075 | function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options8) {
|
12076 | return formatPatch(structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options8));
|
12077 | }
|
12078 |
|
12079 |
|
12080 | var import_fast_glob = __toESM(require_out4(), 1);
|
12081 |
|
12082 |
|
12083 | var apiDescriptor = {
|
12084 | key: (key2) => /^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(key2) ? key2 : JSON.stringify(key2),
|
12085 | value(value) {
|
12086 | if (value === null || typeof value !== "object") {
|
12087 | return JSON.stringify(value);
|
12088 | }
|
12089 | if (Array.isArray(value)) {
|
12090 | return `[${value.map((subValue) => apiDescriptor.value(subValue)).join(", ")}]`;
|
12091 | }
|
12092 | const keys = Object.keys(value);
|
12093 | return keys.length === 0 ? "{}" : `{ ${keys.map((key2) => `${apiDescriptor.key(key2)}: ${apiDescriptor.value(value[key2])}`).join(", ")} }`;
|
12094 | },
|
12095 | pair: ({ key: key2, value }) => apiDescriptor.value({ [key2]: value })
|
12096 | };
|
12097 |
|
12098 |
|
12099 | init_source();
|
12100 | var commonDeprecatedHandler = (keyOrPair, redirectTo, { descriptor }) => {
|
12101 | const messages2 = [
|
12102 | `${source_default.yellow(typeof keyOrPair === "string" ? descriptor.key(keyOrPair) : descriptor.pair(keyOrPair))} is deprecated`
|
12103 | ];
|
12104 | if (redirectTo) {
|
12105 | messages2.push(`we now treat it as ${source_default.blue(typeof redirectTo === "string" ? descriptor.key(redirectTo) : descriptor.pair(redirectTo))}`);
|
12106 | }
|
12107 | return messages2.join("; ") + ".";
|
12108 | };
|
12109 |
|
12110 |
|
12111 | init_source();
|
12112 |
|
12113 |
|
12114 | var VALUE_NOT_EXIST = Symbol.for("vnopts.VALUE_NOT_EXIST");
|
12115 | var VALUE_UNCHANGED = Symbol.for("vnopts.VALUE_UNCHANGED");
|
12116 |
|
12117 |
|
12118 | var INDENTATION = " ".repeat(2);
|
12119 | var commonInvalidHandler = (key2, value, utils) => {
|
12120 | const { text, list } = utils.normalizeExpectedResult(utils.schemas[key2].expected(utils));
|
12121 | const descriptions = [];
|
12122 | if (text) {
|
12123 | descriptions.push(getDescription(key2, value, text, utils.descriptor));
|
12124 | }
|
12125 | if (list) {
|
12126 | descriptions.push([getDescription(key2, value, list.title, utils.descriptor)].concat(list.values.map((valueDescription) => getListDescription(valueDescription, utils.loggerPrintWidth))).join("\n"));
|
12127 | }
|
12128 | return chooseDescription(descriptions, utils.loggerPrintWidth);
|
12129 | };
|
12130 | function getDescription(key2, value, expected, descriptor) {
|
12131 | return [
|
12132 | `Invalid ${source_default.red(descriptor.key(key2))} value.`,
|
12133 | `Expected ${source_default.blue(expected)},`,
|
12134 | `but received ${value === VALUE_NOT_EXIST ? source_default.gray("nothing") : source_default.red(descriptor.value(value))}.`
|
12135 | ].join(" ");
|
12136 | }
|
12137 | function getListDescription({ text, list }, printWidth) {
|
12138 | const descriptions = [];
|
12139 | if (text) {
|
12140 | descriptions.push(`- ${source_default.blue(text)}`);
|
12141 | }
|
12142 | if (list) {
|
12143 | descriptions.push([`- ${source_default.blue(list.title)}:`].concat(list.values.map((valueDescription) => getListDescription(valueDescription, printWidth - INDENTATION.length).replace(/^|\n/g, `$&${INDENTATION}`))).join("\n"));
|
12144 | }
|
12145 | return chooseDescription(descriptions, printWidth);
|
12146 | }
|
12147 | function chooseDescription(descriptions, printWidth) {
|
12148 | if (descriptions.length === 1) {
|
12149 | return descriptions[0];
|
12150 | }
|
12151 | const [firstDescription, secondDescription] = descriptions;
|
12152 | const [firstWidth, secondWidth] = descriptions.map((description) => description.split("\n", 1)[0].length);
|
12153 | return firstWidth > printWidth && firstWidth > secondWidth ? secondDescription : firstDescription;
|
12154 | }
|
12155 |
|
12156 |
|
12157 | init_source();
|
12158 |
|
12159 |
|
12160 | var array = [];
|
12161 | var characterCodeCache = [];
|
12162 | function leven(first, second) {
|
12163 | if (first === second) {
|
12164 | return 0;
|
12165 | }
|
12166 | const swap = first;
|
12167 | if (first.length > second.length) {
|
12168 | first = second;
|
12169 | second = swap;
|
12170 | }
|
12171 | let firstLength = first.length;
|
12172 | let secondLength = second.length;
|
12173 | while (firstLength > 0 && first.charCodeAt(~-firstLength) === second.charCodeAt(~-secondLength)) {
|
12174 | firstLength--;
|
12175 | secondLength--;
|
12176 | }
|
12177 | let start = 0;
|
12178 | while (start < firstLength && first.charCodeAt(start) === second.charCodeAt(start)) {
|
12179 | start++;
|
12180 | }
|
12181 | firstLength -= start;
|
12182 | secondLength -= start;
|
12183 | if (firstLength === 0) {
|
12184 | return secondLength;
|
12185 | }
|
12186 | let bCharacterCode;
|
12187 | let result;
|
12188 | let temporary;
|
12189 | let temporary2;
|
12190 | let index = 0;
|
12191 | let index2 = 0;
|
12192 | while (index < firstLength) {
|
12193 | characterCodeCache[index] = first.charCodeAt(start + index);
|
12194 | array[index] = ++index;
|
12195 | }
|
12196 | while (index2 < secondLength) {
|
12197 | bCharacterCode = second.charCodeAt(start + index2);
|
12198 | temporary = index2++;
|
12199 | result = index2;
|
12200 | for (index = 0; index < firstLength; index++) {
|
12201 | temporary2 = bCharacterCode === characterCodeCache[index] ? temporary : temporary + 1;
|
12202 | temporary = array[index];
|
12203 | result = array[index] = temporary > result ? temporary2 > result ? result + 1 : temporary2 : temporary2 > temporary ? temporary + 1 : temporary2;
|
12204 | }
|
12205 | }
|
12206 | return result;
|
12207 | }
|
12208 |
|
12209 |
|
12210 | var levenUnknownHandler = (key2, value, { descriptor, logger, schemas }) => {
|
12211 | const messages2 = [
|
12212 | `Ignored unknown option ${source_default.yellow(descriptor.pair({ key: key2, value }))}.`
|
12213 | ];
|
12214 | const suggestion = Object.keys(schemas).sort().find((knownKey) => leven(key2, knownKey) < 3);
|
12215 | if (suggestion) {
|
12216 | messages2.push(`Did you mean ${source_default.blue(descriptor.key(suggestion))}?`);
|
12217 | }
|
12218 | logger.warn(messages2.join(" "));
|
12219 | };
|
12220 |
|
12221 |
|
12222 | var HANDLER_KEYS = [
|
12223 | "default",
|
12224 | "expected",
|
12225 | "validate",
|
12226 | "deprecated",
|
12227 | "forward",
|
12228 | "redirect",
|
12229 | "overlap",
|
12230 | "preprocess",
|
12231 | "postprocess"
|
12232 | ];
|
12233 | function createSchema(SchemaConstructor, parameters) {
|
12234 | const schema2 = new SchemaConstructor(parameters);
|
12235 | const subSchema = Object.create(schema2);
|
12236 | for (const handlerKey of HANDLER_KEYS) {
|
12237 | if (handlerKey in parameters) {
|
12238 | subSchema[handlerKey] = normalizeHandler(parameters[handlerKey], schema2, Schema.prototype[handlerKey].length);
|
12239 | }
|
12240 | }
|
12241 | return subSchema;
|
12242 | }
|
12243 | var Schema = class {
|
12244 | static create(parameters) {
|
12245 | return createSchema(this, parameters);
|
12246 | }
|
12247 | constructor(parameters) {
|
12248 | this.name = parameters.name;
|
12249 | }
|
12250 | default(_utils) {
|
12251 | return void 0;
|
12252 | }
|
12253 |
|
12254 |
|
12255 | expected(_utils) {
|
12256 | return "nothing";
|
12257 | }
|
12258 |
|
12259 |
|
12260 |
|
12261 | validate(_value, _utils) {
|
12262 | return false;
|
12263 | }
|
12264 |
|
12265 | deprecated(_value, _utils) {
|
12266 | return false;
|
12267 | }
|
12268 | forward(_value, _utils) {
|
12269 | return void 0;
|
12270 | }
|
12271 | redirect(_value, _utils) {
|
12272 | return void 0;
|
12273 | }
|
12274 | overlap(currentValue, _newValue, _utils) {
|
12275 | return currentValue;
|
12276 | }
|
12277 | preprocess(value, _utils) {
|
12278 | return value;
|
12279 | }
|
12280 | postprocess(_value, _utils) {
|
12281 | return VALUE_UNCHANGED;
|
12282 | }
|
12283 | };
|
12284 | function normalizeHandler(handler, superSchema, handlerArgumentsLength) {
|
12285 | return typeof handler === "function" ? (...args) => handler(...args.slice(0, handlerArgumentsLength - 1), superSchema, ...args.slice(handlerArgumentsLength - 1)) : () => handler;
|
12286 | }
|
12287 |
|
12288 |
|
12289 | var AliasSchema = class extends Schema {
|
12290 | constructor(parameters) {
|
12291 | super(parameters);
|
12292 | this._sourceName = parameters.sourceName;
|
12293 | }
|
12294 | expected(utils) {
|
12295 | return utils.schemas[this._sourceName].expected(utils);
|
12296 | }
|
12297 | validate(value, utils) {
|
12298 | return utils.schemas[this._sourceName].validate(value, utils);
|
12299 | }
|
12300 | redirect(_value, _utils) {
|
12301 | return this._sourceName;
|
12302 | }
|
12303 | };
|
12304 |
|
12305 |
|
12306 | var AnySchema = class extends Schema {
|
12307 | expected() {
|
12308 | return "anything";
|
12309 | }
|
12310 | validate() {
|
12311 | return true;
|
12312 | }
|
12313 | };
|
12314 |
|
12315 |
|
12316 | var ArraySchema = class extends Schema {
|
12317 | constructor({ valueSchema, name = valueSchema.name, ...handlers }) {
|
12318 | super({ ...handlers, name });
|
12319 | this._valueSchema = valueSchema;
|
12320 | }
|
12321 | expected(utils) {
|
12322 | const { text, list } = utils.normalizeExpectedResult(this._valueSchema.expected(utils));
|
12323 | return {
|
12324 | text: text && `an array of ${text}`,
|
12325 | list: list && {
|
12326 | title: `an array of the following values`,
|
12327 | values: [{ list }]
|
12328 | }
|
12329 | };
|
12330 | }
|
12331 | validate(value, utils) {
|
12332 | if (!Array.isArray(value)) {
|
12333 | return false;
|
12334 | }
|
12335 | const invalidValues = [];
|
12336 | for (const subValue of value) {
|
12337 | const subValidateResult = utils.normalizeValidateResult(this._valueSchema.validate(subValue, utils), subValue);
|
12338 | if (subValidateResult !== true) {
|
12339 | invalidValues.push(subValidateResult.value);
|
12340 | }
|
12341 | }
|
12342 | return invalidValues.length === 0 ? true : { value: invalidValues };
|
12343 | }
|
12344 | deprecated(value, utils) {
|
12345 | const deprecatedResult = [];
|
12346 | for (const subValue of value) {
|
12347 | const subDeprecatedResult = utils.normalizeDeprecatedResult(this._valueSchema.deprecated(subValue, utils), subValue);
|
12348 | if (subDeprecatedResult !== false) {
|
12349 | deprecatedResult.push(...subDeprecatedResult.map(({ value: deprecatedValue }) => ({
|
12350 | value: [deprecatedValue]
|
12351 | })));
|
12352 | }
|
12353 | }
|
12354 | return deprecatedResult;
|
12355 | }
|
12356 | forward(value, utils) {
|
12357 | const forwardResult = [];
|
12358 | for (const subValue of value) {
|
12359 | const subForwardResult = utils.normalizeForwardResult(this._valueSchema.forward(subValue, utils), subValue);
|
12360 | forwardResult.push(...subForwardResult.map(wrapTransferResult));
|
12361 | }
|
12362 | return forwardResult;
|
12363 | }
|
12364 | redirect(value, utils) {
|
12365 | const remain = [];
|
12366 | const redirect = [];
|
12367 | for (const subValue of value) {
|
12368 | const subRedirectResult = utils.normalizeRedirectResult(this._valueSchema.redirect(subValue, utils), subValue);
|
12369 | if ("remain" in subRedirectResult) {
|
12370 | remain.push(subRedirectResult.remain);
|
12371 | }
|
12372 | redirect.push(...subRedirectResult.redirect.map(wrapTransferResult));
|
12373 | }
|
12374 | return remain.length === 0 ? { redirect } : { redirect, remain };
|
12375 | }
|
12376 | overlap(currentValue, newValue) {
|
12377 | return currentValue.concat(newValue);
|
12378 | }
|
12379 | };
|
12380 | function wrapTransferResult({ from, to }) {
|
12381 | return { from: [from], to };
|
12382 | }
|
12383 |
|
12384 |
|
12385 | var BooleanSchema = class extends Schema {
|
12386 | expected() {
|
12387 | return "true or false";
|
12388 | }
|
12389 | validate(value) {
|
12390 | return typeof value === "boolean";
|
12391 | }
|
12392 | };
|
12393 |
|
12394 |
|
12395 | function recordFromArray(array2, mainKey) {
|
12396 | const record = Object.create(null);
|
12397 | for (const value of array2) {
|
12398 | const key2 = value[mainKey];
|
12399 | if (record[key2]) {
|
12400 | throw new Error(`Duplicate ${mainKey} ${JSON.stringify(key2)}`);
|
12401 | }
|
12402 | record[key2] = value;
|
12403 | }
|
12404 | return record;
|
12405 | }
|
12406 | function mapFromArray(array2, mainKey) {
|
12407 | const map2 = new Map();
|
12408 | for (const value of array2) {
|
12409 | const key2 = value[mainKey];
|
12410 | if (map2.has(key2)) {
|
12411 | throw new Error(`Duplicate ${mainKey} ${JSON.stringify(key2)}`);
|
12412 | }
|
12413 | map2.set(key2, value);
|
12414 | }
|
12415 | return map2;
|
12416 | }
|
12417 | function createAutoChecklist() {
|
12418 | const map2 = Object.create(null);
|
12419 | return (id) => {
|
12420 | const idString = JSON.stringify(id);
|
12421 | if (map2[idString]) {
|
12422 | return true;
|
12423 | }
|
12424 | map2[idString] = true;
|
12425 | return false;
|
12426 | };
|
12427 | }
|
12428 | function partition(array2, predicate) {
|
12429 | const trueArray = [];
|
12430 | const falseArray = [];
|
12431 | for (const value of array2) {
|
12432 | if (predicate(value)) {
|
12433 | trueArray.push(value);
|
12434 | } else {
|
12435 | falseArray.push(value);
|
12436 | }
|
12437 | }
|
12438 | return [trueArray, falseArray];
|
12439 | }
|
12440 | function isInt(value) {
|
12441 | return value === Math.floor(value);
|
12442 | }
|
12443 | function comparePrimitive(a, b) {
|
12444 | if (a === b) {
|
12445 | return 0;
|
12446 | }
|
12447 | const typeofA = typeof a;
|
12448 | const typeofB = typeof b;
|
12449 | const orders = [
|
12450 | "undefined",
|
12451 | "object",
|
12452 | "boolean",
|
12453 | "number",
|
12454 | "string"
|
12455 | ];
|
12456 | if (typeofA !== typeofB) {
|
12457 | return orders.indexOf(typeofA) - orders.indexOf(typeofB);
|
12458 | }
|
12459 | if (typeofA !== "string") {
|
12460 | return Number(a) - Number(b);
|
12461 | }
|
12462 | return a.localeCompare(b);
|
12463 | }
|
12464 | function normalizeInvalidHandler(invalidHandler) {
|
12465 | return (...args) => {
|
12466 | const errorMessageOrError = invalidHandler(...args);
|
12467 | return typeof errorMessageOrError === "string" ? new Error(errorMessageOrError) : errorMessageOrError;
|
12468 | };
|
12469 | }
|
12470 | function normalizeDefaultResult(result) {
|
12471 | return result === void 0 ? {} : result;
|
12472 | }
|
12473 | function normalizeExpectedResult(result) {
|
12474 | if (typeof result === "string") {
|
12475 | return { text: result };
|
12476 | }
|
12477 | const { text, list } = result;
|
12478 | assert((text || list) !== void 0, "Unexpected `expected` result, there should be at least one field.");
|
12479 | if (!list) {
|
12480 | return { text };
|
12481 | }
|
12482 | return {
|
12483 | text,
|
12484 | list: {
|
12485 | title: list.title,
|
12486 | values: list.values.map(normalizeExpectedResult)
|
12487 | }
|
12488 | };
|
12489 | }
|
12490 | function normalizeValidateResult(result, value) {
|
12491 | return result === true ? true : result === false ? { value } : result;
|
12492 | }
|
12493 | function normalizeDeprecatedResult(result, value, doNotNormalizeTrue = false) {
|
12494 | return result === false ? false : result === true ? doNotNormalizeTrue ? true : [{ value }] : "value" in result ? [result] : result.length === 0 ? false : result;
|
12495 | }
|
12496 | function normalizeTransferResult(result, value) {
|
12497 | return typeof result === "string" || "key" in result ? { from: value, to: result } : "from" in result ? { from: result.from, to: result.to } : { from: value, to: result.to };
|
12498 | }
|
12499 | function normalizeForwardResult(result, value) {
|
12500 | return result === void 0 ? [] : Array.isArray(result) ? result.map((transferResult) => normalizeTransferResult(transferResult, value)) : [normalizeTransferResult(result, value)];
|
12501 | }
|
12502 | function normalizeRedirectResult(result, value) {
|
12503 | const redirect = normalizeForwardResult(typeof result === "object" && "redirect" in result ? result.redirect : result, value);
|
12504 | return redirect.length === 0 ? { remain: value, redirect } : typeof result === "object" && "remain" in result ? { remain: result.remain, redirect } : { redirect };
|
12505 | }
|
12506 | function assert(isValid, message) {
|
12507 | if (!isValid) {
|
12508 | throw new Error(message);
|
12509 | }
|
12510 | }
|
12511 |
|
12512 |
|
12513 | var ChoiceSchema = class extends Schema {
|
12514 | constructor(parameters) {
|
12515 | super(parameters);
|
12516 | this._choices = mapFromArray(parameters.choices.map((choice) => choice && typeof choice === "object" ? choice : { value: choice }), "value");
|
12517 | }
|
12518 | expected({ descriptor }) {
|
12519 | const choiceDescriptions = Array.from(this._choices.keys()).map((value) => this._choices.get(value)).filter(({ hidden }) => !hidden).map((choiceInfo) => choiceInfo.value).sort(comparePrimitive).map(descriptor.value);
|
12520 | const head = choiceDescriptions.slice(0, -2);
|
12521 | const tail = choiceDescriptions.slice(-2);
|
12522 | const message = head.concat(tail.join(" or ")).join(", ");
|
12523 | return {
|
12524 | text: message,
|
12525 | list: {
|
12526 | title: "one of the following values",
|
12527 | values: choiceDescriptions
|
12528 | }
|
12529 | };
|
12530 | }
|
12531 | validate(value) {
|
12532 | return this._choices.has(value);
|
12533 | }
|
12534 | deprecated(value) {
|
12535 | const choiceInfo = this._choices.get(value);
|
12536 | return choiceInfo && choiceInfo.deprecated ? { value } : false;
|
12537 | }
|
12538 | forward(value) {
|
12539 | const choiceInfo = this._choices.get(value);
|
12540 | return choiceInfo ? choiceInfo.forward : void 0;
|
12541 | }
|
12542 | redirect(value) {
|
12543 | const choiceInfo = this._choices.get(value);
|
12544 | return choiceInfo ? choiceInfo.redirect : void 0;
|
12545 | }
|
12546 | };
|
12547 |
|
12548 |
|
12549 | var NumberSchema = class extends Schema {
|
12550 | expected() {
|
12551 | return "a number";
|
12552 | }
|
12553 | validate(value, _utils) {
|
12554 | return typeof value === "number";
|
12555 | }
|
12556 | };
|
12557 |
|
12558 |
|
12559 | var IntegerSchema = class extends NumberSchema {
|
12560 | expected() {
|
12561 | return "an integer";
|
12562 | }
|
12563 | validate(value, utils) {
|
12564 | return utils.normalizeValidateResult(super.validate(value, utils), value) === true && isInt(value);
|
12565 | }
|
12566 | };
|
12567 |
|
12568 |
|
12569 | var StringSchema = class extends Schema {
|
12570 | expected() {
|
12571 | return "a string";
|
12572 | }
|
12573 | validate(value) {
|
12574 | return typeof value === "string";
|
12575 | }
|
12576 | };
|
12577 |
|
12578 |
|
12579 | var defaultDescriptor = apiDescriptor;
|
12580 | var defaultUnknownHandler = levenUnknownHandler;
|
12581 | var defaultInvalidHandler = commonInvalidHandler;
|
12582 | var defaultDeprecatedHandler = commonDeprecatedHandler;
|
12583 |
|
12584 |
|
12585 | var Normalizer = class {
|
12586 | constructor(schemas, opts) {
|
12587 | const { logger = console, loggerPrintWidth = 80, descriptor = defaultDescriptor, unknown = defaultUnknownHandler, invalid = defaultInvalidHandler, deprecated = defaultDeprecatedHandler, missing = () => false, required = () => false, preprocess = (x) => x, postprocess = () => VALUE_UNCHANGED } = opts || {};
|
12588 | this._utils = {
|
12589 | descriptor,
|
12590 | logger: (
|
12591 |
|
12592 | logger || { warn: () => {
|
12593 | } }
|
12594 | ),
|
12595 | loggerPrintWidth,
|
12596 | schemas: recordFromArray(schemas, "name"),
|
12597 | normalizeDefaultResult,
|
12598 | normalizeExpectedResult,
|
12599 | normalizeDeprecatedResult,
|
12600 | normalizeForwardResult,
|
12601 | normalizeRedirectResult,
|
12602 | normalizeValidateResult
|
12603 | };
|
12604 | this._unknownHandler = unknown;
|
12605 | this._invalidHandler = normalizeInvalidHandler(invalid);
|
12606 | this._deprecatedHandler = deprecated;
|
12607 | this._identifyMissing = (k, o) => !(k in o) || missing(k, o);
|
12608 | this._identifyRequired = required;
|
12609 | this._preprocess = preprocess;
|
12610 | this._postprocess = postprocess;
|
12611 | this.cleanHistory();
|
12612 | }
|
12613 | cleanHistory() {
|
12614 | this._hasDeprecationWarned = createAutoChecklist();
|
12615 | }
|
12616 | normalize(options8) {
|
12617 | const newOptions = {};
|
12618 | const preprocessed = this._preprocess(options8, this._utils);
|
12619 | const restOptionsArray = [preprocessed];
|
12620 | const applyNormalization = () => {
|
12621 | while (restOptionsArray.length !== 0) {
|
12622 | const currentOptions = restOptionsArray.shift();
|
12623 | const transferredOptionsArray = this._applyNormalization(currentOptions, newOptions);
|
12624 | restOptionsArray.push(...transferredOptionsArray);
|
12625 | }
|
12626 | };
|
12627 | applyNormalization();
|
12628 | for (const key2 of Object.keys(this._utils.schemas)) {
|
12629 | const schema2 = this._utils.schemas[key2];
|
12630 | if (!(key2 in newOptions)) {
|
12631 | const defaultResult = normalizeDefaultResult(schema2.default(this._utils));
|
12632 | if ("value" in defaultResult) {
|
12633 | restOptionsArray.push({ [key2]: defaultResult.value });
|
12634 | }
|
12635 | }
|
12636 | }
|
12637 | applyNormalization();
|
12638 | for (const key2 of Object.keys(this._utils.schemas)) {
|
12639 | if (!(key2 in newOptions)) {
|
12640 | continue;
|
12641 | }
|
12642 | const schema2 = this._utils.schemas[key2];
|
12643 | const value = newOptions[key2];
|
12644 | const newValue = schema2.postprocess(value, this._utils);
|
12645 | if (newValue === VALUE_UNCHANGED) {
|
12646 | continue;
|
12647 | }
|
12648 | this._applyValidation(newValue, key2, schema2);
|
12649 | newOptions[key2] = newValue;
|
12650 | }
|
12651 | this._applyPostprocess(newOptions);
|
12652 | this._applyRequiredCheck(newOptions);
|
12653 | return newOptions;
|
12654 | }
|
12655 | _applyNormalization(options8, newOptions) {
|
12656 | const transferredOptionsArray = [];
|
12657 | const { knownKeys, unknownKeys } = this._partitionOptionKeys(options8);
|
12658 | for (const key2 of knownKeys) {
|
12659 | const schema2 = this._utils.schemas[key2];
|
12660 | const value = schema2.preprocess(options8[key2], this._utils);
|
12661 | this._applyValidation(value, key2, schema2);
|
12662 | const appendTransferredOptions = ({ from, to }) => {
|
12663 | transferredOptionsArray.push(typeof to === "string" ? { [to]: from } : { [to.key]: to.value });
|
12664 | };
|
12665 | const warnDeprecated = ({ value: currentValue, redirectTo }) => {
|
12666 | const deprecatedResult = normalizeDeprecatedResult(
|
12667 | schema2.deprecated(currentValue, this._utils),
|
12668 | value,
|
12669 |
|
12670 | true
|
12671 | );
|
12672 | if (deprecatedResult === false) {
|
12673 | return;
|
12674 | }
|
12675 | if (deprecatedResult === true) {
|
12676 | if (!this._hasDeprecationWarned(key2)) {
|
12677 | this._utils.logger.warn(this._deprecatedHandler(key2, redirectTo, this._utils));
|
12678 | }
|
12679 | } else {
|
12680 | for (const { value: deprecatedValue } of deprecatedResult) {
|
12681 | const pair = { key: key2, value: deprecatedValue };
|
12682 | if (!this._hasDeprecationWarned(pair)) {
|
12683 | const redirectToPair = typeof redirectTo === "string" ? { key: redirectTo, value: deprecatedValue } : redirectTo;
|
12684 | this._utils.logger.warn(this._deprecatedHandler(pair, redirectToPair, this._utils));
|
12685 | }
|
12686 | }
|
12687 | }
|
12688 | };
|
12689 | const forwardResult = normalizeForwardResult(schema2.forward(value, this._utils), value);
|
12690 | forwardResult.forEach(appendTransferredOptions);
|
12691 | const redirectResult = normalizeRedirectResult(schema2.redirect(value, this._utils), value);
|
12692 | redirectResult.redirect.forEach(appendTransferredOptions);
|
12693 | if ("remain" in redirectResult) {
|
12694 | const remainingValue = redirectResult.remain;
|
12695 | newOptions[key2] = key2 in newOptions ? schema2.overlap(newOptions[key2], remainingValue, this._utils) : remainingValue;
|
12696 | warnDeprecated({ value: remainingValue });
|
12697 | }
|
12698 | for (const { from, to } of redirectResult.redirect) {
|
12699 | warnDeprecated({ value: from, redirectTo: to });
|
12700 | }
|
12701 | }
|
12702 | for (const key2 of unknownKeys) {
|
12703 | const value = options8[key2];
|
12704 | this._applyUnknownHandler(key2, value, newOptions, (knownResultKey, knownResultValue) => {
|
12705 | transferredOptionsArray.push({ [knownResultKey]: knownResultValue });
|
12706 | });
|
12707 | }
|
12708 | return transferredOptionsArray;
|
12709 | }
|
12710 | _applyRequiredCheck(options8) {
|
12711 | for (const key2 of Object.keys(this._utils.schemas)) {
|
12712 | if (this._identifyMissing(key2, options8)) {
|
12713 | if (this._identifyRequired(key2)) {
|
12714 | throw this._invalidHandler(key2, VALUE_NOT_EXIST, this._utils);
|
12715 | }
|
12716 | }
|
12717 | }
|
12718 | }
|
12719 | _partitionOptionKeys(options8) {
|
12720 | const [knownKeys, unknownKeys] = partition(Object.keys(options8).filter((key2) => !this._identifyMissing(key2, options8)), (key2) => key2 in this._utils.schemas);
|
12721 | return { knownKeys, unknownKeys };
|
12722 | }
|
12723 | _applyValidation(value, key2, schema2) {
|
12724 | const validateResult = normalizeValidateResult(schema2.validate(value, this._utils), value);
|
12725 | if (validateResult !== true) {
|
12726 | throw this._invalidHandler(key2, validateResult.value, this._utils);
|
12727 | }
|
12728 | }
|
12729 | _applyUnknownHandler(key2, value, newOptions, knownResultHandler) {
|
12730 | const unknownResult = this._unknownHandler(key2, value, this._utils);
|
12731 | if (!unknownResult) {
|
12732 | return;
|
12733 | }
|
12734 | for (const resultKey of Object.keys(unknownResult)) {
|
12735 | if (this._identifyMissing(resultKey, unknownResult)) {
|
12736 | continue;
|
12737 | }
|
12738 | const resultValue = unknownResult[resultKey];
|
12739 | if (resultKey in this._utils.schemas) {
|
12740 | knownResultHandler(resultKey, resultValue);
|
12741 | } else {
|
12742 | newOptions[resultKey] = resultValue;
|
12743 | }
|
12744 | }
|
12745 | }
|
12746 | _applyPostprocess(options8) {
|
12747 | const postprocessed = this._postprocess(options8, this._utils);
|
12748 | if (postprocessed === VALUE_UNCHANGED) {
|
12749 | return;
|
12750 | }
|
12751 | if (postprocessed.delete) {
|
12752 | for (const deleteKey of postprocessed.delete) {
|
12753 | delete options8[deleteKey];
|
12754 | }
|
12755 | }
|
12756 | if (postprocessed.override) {
|
12757 | const { knownKeys, unknownKeys } = this._partitionOptionKeys(postprocessed.override);
|
12758 | for (const key2 of knownKeys) {
|
12759 | const value = postprocessed.override[key2];
|
12760 | this._applyValidation(value, key2, this._utils.schemas[key2]);
|
12761 | options8[key2] = value;
|
12762 | }
|
12763 | for (const key2 of unknownKeys) {
|
12764 | const value = postprocessed.override[key2];
|
12765 | this._applyUnknownHandler(key2, value, options8, (knownResultKey, knownResultValue) => {
|
12766 | const schema2 = this._utils.schemas[knownResultKey];
|
12767 | this._applyValidation(knownResultValue, knownResultKey, schema2);
|
12768 | options8[knownResultKey] = knownResultValue;
|
12769 | });
|
12770 | }
|
12771 | }
|
12772 | }
|
12773 | };
|
12774 |
|
12775 |
|
12776 | var errors_exports = {};
|
12777 | __export(errors_exports, {
|
12778 | ArgExpansionBailout: () => ArgExpansionBailout,
|
12779 | ConfigError: () => ConfigError,
|
12780 | UndefinedParserError: () => UndefinedParserError
|
12781 | });
|
12782 | var ConfigError = class extends Error {
|
12783 | name = "ConfigError";
|
12784 | };
|
12785 | var UndefinedParserError = class extends Error {
|
12786 | name = "UndefinedParserError";
|
12787 | };
|
12788 | var ArgExpansionBailout = class extends Error {
|
12789 | name = "ArgExpansionBailout";
|
12790 | };
|
12791 |
|
12792 |
|
12793 | var import_micromatch = __toESM(require_micromatch(), 1);
|
12794 | import path9 from "path";
|
12795 |
|
12796 |
|
12797 | import { fileURLToPath, pathToFileURL } from "url";
|
12798 | var isUrlInstance = (value) => value instanceof URL;
|
12799 | var isUrlString = (value) => typeof value === "string" && value.startsWith("file://");
|
12800 | var isUrl = (urlOrPath) => isUrlInstance(urlOrPath) || isUrlString(urlOrPath);
|
12801 | var toPath = (urlOrPath) => isUrl(urlOrPath) ? fileURLToPath(urlOrPath) : urlOrPath;
|
12802 |
|
12803 |
|
12804 | function partition2(array2, predicate) {
|
12805 | const result = [[], []];
|
12806 | for (const value of array2) {
|
12807 | result[predicate(value) ? 0 : 1].push(value);
|
12808 | }
|
12809 | return result;
|
12810 | }
|
12811 | var partition_default = partition2;
|
12812 |
|
12813 |
|
12814 | var import_editorconfig = __toESM(require_src(), 1);
|
12815 | import path4 from "path";
|
12816 |
|
12817 |
|
12818 | import * as path3 from "path";
|
12819 |
|
12820 |
|
12821 | import fs from "fs/promises";
|
12822 | async function isDirectory(directory, options8) {
|
12823 | const allowSymlinks = (options8 == null ? void 0 : options8.allowSymlinks) ?? true;
|
12824 | let stats;
|
12825 | try {
|
12826 | stats = await (allowSymlinks ? fs.stat : fs.lstat)(toPath(directory));
|
12827 | } catch {
|
12828 | return false;
|
12829 | }
|
12830 | return stats.isDirectory();
|
12831 | }
|
12832 | var is_directory_default = isDirectory;
|
12833 |
|
12834 |
|
12835 | import path2 from "path";
|
12836 |
|
12837 |
|
12838 | import * as path from "path";
|
12839 | var toAbsolutePath = (value) => path.resolve(toPath(value));
|
12840 | function* iterateDirectoryUp(from, to) {
|
12841 | from = toAbsolutePath(from);
|
12842 | const { root: root2 } = path.parse(from);
|
12843 | to = to ? toAbsolutePath(to) : root2;
|
12844 | if (from !== to && !from.startsWith(to)) {
|
12845 | return;
|
12846 | }
|
12847 | for (let directory = from; directory !== to; directory = path.dirname(directory)) {
|
12848 | yield directory;
|
12849 | }
|
12850 | yield to;
|
12851 | }
|
12852 | var iterate_directory_up_default = iterateDirectoryUp;
|
12853 |
|
12854 |
|
12855 | var _names, _filter, _stopDirectory, _cache, _Searcher_instances, searchInDirectory_fn;
|
12856 | var Searcher = class {
|
12857 | |
12858 |
|
12859 |
|
12860 |
|
12861 |
|
12862 |
|
12863 |
|
12864 | constructor({ names, filter: filter2, stopDirectory }) {
|
12865 | __privateAdd(this, _Searcher_instances);
|
12866 | __privateAdd(this, _names);
|
12867 | __privateAdd(this, _filter);
|
12868 | __privateAdd(this, _stopDirectory);
|
12869 | __privateAdd(this, _cache, new Map());
|
12870 | __privateSet(this, _names, names);
|
12871 | __privateSet(this, _filter, filter2);
|
12872 | __privateSet(this, _stopDirectory, stopDirectory);
|
12873 | }
|
12874 | async search(startDirectory, { shouldCache }) {
|
12875 | const cache3 = __privateGet(this, _cache);
|
12876 | if (shouldCache && cache3.has(startDirectory)) {
|
12877 | return cache3.get(startDirectory);
|
12878 | }
|
12879 | const searchedDirectories = [];
|
12880 | let result;
|
12881 | for (const directory of iterate_directory_up_default(
|
12882 | startDirectory,
|
12883 | __privateGet(this, _stopDirectory)
|
12884 | )) {
|
12885 | searchedDirectories.push(directory);
|
12886 | result = await __privateMethod(this, _Searcher_instances, searchInDirectory_fn).call(this, directory, shouldCache);
|
12887 | if (result) {
|
12888 | break;
|
12889 | }
|
12890 | }
|
12891 | for (const directory of searchedDirectories) {
|
12892 | cache3.set(directory, result);
|
12893 | }
|
12894 | return result;
|
12895 | }
|
12896 | clearCache() {
|
12897 | __privateGet(this, _cache).clear();
|
12898 | }
|
12899 | };
|
12900 | _names = new WeakMap();
|
12901 | _filter = new WeakMap();
|
12902 | _stopDirectory = new WeakMap();
|
12903 | _cache = new WeakMap();
|
12904 | _Searcher_instances = new WeakSet();
|
12905 | searchInDirectory_fn = async function(directory, shouldCache) {
|
12906 | const cache3 = __privateGet(this, _cache);
|
12907 | if (shouldCache && cache3.has(directory)) {
|
12908 | return cache3.get(directory);
|
12909 | }
|
12910 | for (const name of __privateGet(this, _names)) {
|
12911 | const fileOrDirectory = path2.join(directory, name);
|
12912 | if (await __privateGet(this, _filter).call(this, { name, path: fileOrDirectory })) {
|
12913 | return fileOrDirectory;
|
12914 | }
|
12915 | }
|
12916 | };
|
12917 | var searcher_default = Searcher;
|
12918 |
|
12919 |
|
12920 | var MARKERS = [".git", ".hg"];
|
12921 | var searcher;
|
12922 | var searchOptions = {
|
12923 | names: MARKERS,
|
12924 | filter: ({ path: directory }) => is_directory_default(directory, { allowSymlinks: false })
|
12925 | };
|
12926 | async function findProjectRoot(startDirectory, options8) {
|
12927 | searcher ?? (searcher = new searcher_default(searchOptions));
|
12928 | const mark = await searcher.search(startDirectory, options8);
|
12929 | return mark ? path3.dirname(mark) : void 0;
|
12930 | }
|
12931 | function clearFindProjectRootCache() {
|
12932 | searcher == null ? void 0 : searcher.clearCache();
|
12933 | }
|
12934 |
|
12935 |
|
12936 | function removeUnset(editorConfig) {
|
12937 | const result = {};
|
12938 | const keys = Object.keys(editorConfig);
|
12939 | for (let i = 0; i < keys.length; i++) {
|
12940 | const key2 = keys[i];
|
12941 | if (editorConfig[key2] === "unset") {
|
12942 | continue;
|
12943 | }
|
12944 | result[key2] = editorConfig[key2];
|
12945 | }
|
12946 | return result;
|
12947 | }
|
12948 | function editorConfigToPrettier(editorConfig) {
|
12949 | if (!editorConfig) {
|
12950 | return null;
|
12951 | }
|
12952 | editorConfig = removeUnset(editorConfig);
|
12953 | if (Object.keys(editorConfig).length === 0) {
|
12954 | return null;
|
12955 | }
|
12956 | const result = {};
|
12957 | if (editorConfig.indent_style) {
|
12958 | result.useTabs = editorConfig.indent_style === "tab";
|
12959 | }
|
12960 | if (editorConfig.indent_size === "tab") {
|
12961 | result.useTabs = true;
|
12962 | }
|
12963 | if (result.useTabs && editorConfig.tab_width) {
|
12964 | result.tabWidth = editorConfig.tab_width;
|
12965 | } else if (editorConfig.indent_style === "space" && editorConfig.indent_size && editorConfig.indent_size !== "tab") {
|
12966 | result.tabWidth = editorConfig.indent_size;
|
12967 | } else if (editorConfig.tab_width !== void 0) {
|
12968 | result.tabWidth = editorConfig.tab_width;
|
12969 | }
|
12970 | if (editorConfig.max_line_length) {
|
12971 | if (editorConfig.max_line_length === "off") {
|
12972 | result.printWidth = Number.POSITIVE_INFINITY;
|
12973 | } else {
|
12974 | result.printWidth = editorConfig.max_line_length;
|
12975 | }
|
12976 | }
|
12977 | if (editorConfig.quote_type === "single") {
|
12978 | result.singleQuote = true;
|
12979 | } else if (editorConfig.quote_type === "double") {
|
12980 | result.singleQuote = false;
|
12981 | }
|
12982 | if (["cr", "crlf", "lf"].includes(editorConfig.end_of_line)) {
|
12983 | result.endOfLine = editorConfig.end_of_line;
|
12984 | }
|
12985 | return result;
|
12986 | }
|
12987 | var editorconfig_to_prettier_default = editorConfigToPrettier;
|
12988 |
|
12989 |
|
12990 | var editorconfigCache = new Map();
|
12991 | function clearEditorconfigCache() {
|
12992 | clearFindProjectRootCache();
|
12993 | editorconfigCache.clear();
|
12994 | }
|
12995 | async function loadEditorconfigInternal(file, { shouldCache }) {
|
12996 | const directory = path4.dirname(file);
|
12997 | const root2 = await findProjectRoot(directory, { shouldCache });
|
12998 | const editorConfig = await import_editorconfig.default.parse(file, { root: root2 });
|
12999 | const config = editorconfig_to_prettier_default(editorConfig);
|
13000 | return config;
|
13001 | }
|
13002 | function loadEditorconfig(file, { shouldCache }) {
|
13003 | file = path4.resolve(file);
|
13004 | if (!shouldCache || !editorconfigCache.has(file)) {
|
13005 | editorconfigCache.set(
|
13006 | file,
|
13007 | loadEditorconfigInternal(file, { shouldCache })
|
13008 | );
|
13009 | }
|
13010 | return editorconfigCache.get(file);
|
13011 | }
|
13012 |
|
13013 |
|
13014 | import path8 from "path";
|
13015 |
|
13016 |
|
13017 | var import_ci_info = __toESM(require_ci_info(), 1);
|
13018 | import fs2 from "fs/promises";
|
13019 |
|
13020 |
|
13021 | var { stdin } = process;
|
13022 | async function getStdin() {
|
13023 | let result = "";
|
13024 | if (stdin.isTTY) {
|
13025 | return result;
|
13026 | }
|
13027 | stdin.setEncoding("utf8");
|
13028 | for await (const chunk of stdin) {
|
13029 | result += chunk;
|
13030 | }
|
13031 | return result;
|
13032 | }
|
13033 | getStdin.buffer = async () => {
|
13034 | const result = [];
|
13035 | let length = 0;
|
13036 | if (stdin.isTTY) {
|
13037 | return Buffer.concat([]);
|
13038 | }
|
13039 | for await (const chunk of stdin) {
|
13040 | result.push(chunk);
|
13041 | length += chunk.length;
|
13042 | }
|
13043 | return Buffer.concat(result, length);
|
13044 | };
|
13045 |
|
13046 |
|
13047 | function writeFormattedFile(file, data) {
|
13048 | return fs2.writeFile(file, data);
|
13049 | }
|
13050 | var mockable = {
|
13051 | getPrettierConfigSearchStopDirectory: () => void 0,
|
13052 | getStdin,
|
13053 | isCI: () => import_ci_info.isCI,
|
13054 | writeFormattedFile
|
13055 | };
|
13056 | var mockable_default = mockable;
|
13057 |
|
13058 |
|
13059 | import fs3 from "fs/promises";
|
13060 | async function isFile(file, options8) {
|
13061 | const allowSymlinks = (options8 == null ? void 0 : options8.allowSymlinks) ?? true;
|
13062 | let stats;
|
13063 | try {
|
13064 | stats = await (allowSymlinks ? fs3.stat : fs3.lstat)(toPath(file));
|
13065 | } catch {
|
13066 | return false;
|
13067 | }
|
13068 | return stats.isFile();
|
13069 | }
|
13070 | var is_file_default = isFile;
|
13071 |
|
13072 |
|
13073 | var import_parse_async = __toESM(require_parse_async(), 1);
|
13074 | import { pathToFileURL as pathToFileURL2 } from "url";
|
13075 |
|
13076 |
|
13077 | function isNothing(subject) {
|
13078 | return typeof subject === "undefined" || subject === null;
|
13079 | }
|
13080 | function isObject(subject) {
|
13081 | return typeof subject === "object" && subject !== null;
|
13082 | }
|
13083 | function toArray(sequence) {
|
13084 | if (Array.isArray(sequence)) return sequence;
|
13085 | else if (isNothing(sequence)) return [];
|
13086 | return [sequence];
|
13087 | }
|
13088 | function extend(target, source2) {
|
13089 | var index, length, key2, sourceKeys;
|
13090 | if (source2) {
|
13091 | sourceKeys = Object.keys(source2);
|
13092 | for (index = 0, length = sourceKeys.length; index < length; index += 1) {
|
13093 | key2 = sourceKeys[index];
|
13094 | target[key2] = source2[key2];
|
13095 | }
|
13096 | }
|
13097 | return target;
|
13098 | }
|
13099 | function repeat(string, count) {
|
13100 | var result = "", cycle;
|
13101 | for (cycle = 0; cycle < count; cycle += 1) {
|
13102 | result += string;
|
13103 | }
|
13104 | return result;
|
13105 | }
|
13106 | function isNegativeZero(number) {
|
13107 | return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
|
13108 | }
|
13109 | var isNothing_1 = isNothing;
|
13110 | var isObject_1 = isObject;
|
13111 | var toArray_1 = toArray;
|
13112 | var repeat_1 = repeat;
|
13113 | var isNegativeZero_1 = isNegativeZero;
|
13114 | var extend_1 = extend;
|
13115 | var common = {
|
13116 | isNothing: isNothing_1,
|
13117 | isObject: isObject_1,
|
13118 | toArray: toArray_1,
|
13119 | repeat: repeat_1,
|
13120 | isNegativeZero: isNegativeZero_1,
|
13121 | extend: extend_1
|
13122 | };
|
13123 | function formatError(exception2, compact) {
|
13124 | var where = "", message = exception2.reason || "(unknown reason)";
|
13125 | if (!exception2.mark) return message;
|
13126 | if (exception2.mark.name) {
|
13127 | where += 'in "' + exception2.mark.name + '" ';
|
13128 | }
|
13129 | where += "(" + (exception2.mark.line + 1) + ":" + (exception2.mark.column + 1) + ")";
|
13130 | if (!compact && exception2.mark.snippet) {
|
13131 | where += "\n\n" + exception2.mark.snippet;
|
13132 | }
|
13133 | return message + " " + where;
|
13134 | }
|
13135 | function YAMLException$1(reason, mark) {
|
13136 | Error.call(this);
|
13137 | this.name = "YAMLException";
|
13138 | this.reason = reason;
|
13139 | this.mark = mark;
|
13140 | this.message = formatError(this, false);
|
13141 | if (Error.captureStackTrace) {
|
13142 | Error.captureStackTrace(this, this.constructor);
|
13143 | } else {
|
13144 | this.stack = new Error().stack || "";
|
13145 | }
|
13146 | }
|
13147 | YAMLException$1.prototype = Object.create(Error.prototype);
|
13148 | YAMLException$1.prototype.constructor = YAMLException$1;
|
13149 | YAMLException$1.prototype.toString = function toString(compact) {
|
13150 | return this.name + ": " + formatError(this, compact);
|
13151 | };
|
13152 | var exception = YAMLException$1;
|
13153 | function getLine(buffer2, lineStart, lineEnd, position, maxLineLength) {
|
13154 | var head = "";
|
13155 | var tail = "";
|
13156 | var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
|
13157 | if (position - lineStart > maxHalfLength) {
|
13158 | head = " ... ";
|
13159 | lineStart = position - maxHalfLength + head.length;
|
13160 | }
|
13161 | if (lineEnd - position > maxHalfLength) {
|
13162 | tail = " ...";
|
13163 | lineEnd = position + maxHalfLength - tail.length;
|
13164 | }
|
13165 | return {
|
13166 | str: head + buffer2.slice(lineStart, lineEnd).replace(/\t/g, "\u2192") + tail,
|
13167 | pos: position - lineStart + head.length
|
13168 |
|
13169 | };
|
13170 | }
|
13171 | function padStart(string, max) {
|
13172 | return common.repeat(" ", max - string.length) + string;
|
13173 | }
|
13174 | function makeSnippet(mark, options8) {
|
13175 | options8 = Object.create(options8 || null);
|
13176 | if (!mark.buffer) return null;
|
13177 | if (!options8.maxLength) options8.maxLength = 79;
|
13178 | if (typeof options8.indent !== "number") options8.indent = 1;
|
13179 | if (typeof options8.linesBefore !== "number") options8.linesBefore = 3;
|
13180 | if (typeof options8.linesAfter !== "number") options8.linesAfter = 2;
|
13181 | var re = /\r?\n|\r|\0/g;
|
13182 | var lineStarts = [0];
|
13183 | var lineEnds = [];
|
13184 | var match;
|
13185 | var foundLineNo = -1;
|
13186 | while (match = re.exec(mark.buffer)) {
|
13187 | lineEnds.push(match.index);
|
13188 | lineStarts.push(match.index + match[0].length);
|
13189 | if (mark.position <= match.index && foundLineNo < 0) {
|
13190 | foundLineNo = lineStarts.length - 2;
|
13191 | }
|
13192 | }
|
13193 | if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
|
13194 | var result = "", i, line3;
|
13195 | var lineNoLength = Math.min(mark.line + options8.linesAfter, lineEnds.length).toString().length;
|
13196 | var maxLineLength = options8.maxLength - (options8.indent + lineNoLength + 3);
|
13197 | for (i = 1; i <= options8.linesBefore; i++) {
|
13198 | if (foundLineNo - i < 0) break;
|
13199 | line3 = getLine(
|
13200 | mark.buffer,
|
13201 | lineStarts[foundLineNo - i],
|
13202 | lineEnds[foundLineNo - i],
|
13203 | mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),
|
13204 | maxLineLength
|
13205 | );
|
13206 | result = common.repeat(" ", options8.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line3.str + "\n" + result;
|
13207 | }
|
13208 | line3 = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
|
13209 | result += common.repeat(" ", options8.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line3.str + "\n";
|
13210 | result += common.repeat("-", options8.indent + lineNoLength + 3 + line3.pos) + "^\n";
|
13211 | for (i = 1; i <= options8.linesAfter; i++) {
|
13212 | if (foundLineNo + i >= lineEnds.length) break;
|
13213 | line3 = getLine(
|
13214 | mark.buffer,
|
13215 | lineStarts[foundLineNo + i],
|
13216 | lineEnds[foundLineNo + i],
|
13217 | mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),
|
13218 | maxLineLength
|
13219 | );
|
13220 | result += common.repeat(" ", options8.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line3.str + "\n";
|
13221 | }
|
13222 | return result.replace(/\n$/, "");
|
13223 | }
|
13224 | var snippet = makeSnippet;
|
13225 | var TYPE_CONSTRUCTOR_OPTIONS = [
|
13226 | "kind",
|
13227 | "multi",
|
13228 | "resolve",
|
13229 | "construct",
|
13230 | "instanceOf",
|
13231 | "predicate",
|
13232 | "represent",
|
13233 | "representName",
|
13234 | "defaultStyle",
|
13235 | "styleAliases"
|
13236 | ];
|
13237 | var YAML_NODE_KINDS = [
|
13238 | "scalar",
|
13239 | "sequence",
|
13240 | "mapping"
|
13241 | ];
|
13242 | function compileStyleAliases(map2) {
|
13243 | var result = {};
|
13244 | if (map2 !== null) {
|
13245 | Object.keys(map2).forEach(function(style) {
|
13246 | map2[style].forEach(function(alias) {
|
13247 | result[String(alias)] = style;
|
13248 | });
|
13249 | });
|
13250 | }
|
13251 | return result;
|
13252 | }
|
13253 | function Type$1(tag, options8) {
|
13254 | options8 = options8 || {};
|
13255 | Object.keys(options8).forEach(function(name) {
|
13256 | if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
|
13257 | throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
13258 | }
|
13259 | });
|
13260 | this.options = options8;
|
13261 | this.tag = tag;
|
13262 | this.kind = options8["kind"] || null;
|
13263 | this.resolve = options8["resolve"] || function() {
|
13264 | return true;
|
13265 | };
|
13266 | this.construct = options8["construct"] || function(data) {
|
13267 | return data;
|
13268 | };
|
13269 | this.instanceOf = options8["instanceOf"] || null;
|
13270 | this.predicate = options8["predicate"] || null;
|
13271 | this.represent = options8["represent"] || null;
|
13272 | this.representName = options8["representName"] || null;
|
13273 | this.defaultStyle = options8["defaultStyle"] || null;
|
13274 | this.multi = options8["multi"] || false;
|
13275 | this.styleAliases = compileStyleAliases(options8["styleAliases"] || null);
|
13276 | if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
|
13277 | throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
13278 | }
|
13279 | }
|
13280 | var type = Type$1;
|
13281 | function compileList(schema2, name) {
|
13282 | var result = [];
|
13283 | schema2[name].forEach(function(currentType) {
|
13284 | var newIndex = result.length;
|
13285 | result.forEach(function(previousType, previousIndex) {
|
13286 | if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
|
13287 | newIndex = previousIndex;
|
13288 | }
|
13289 | });
|
13290 | result[newIndex] = currentType;
|
13291 | });
|
13292 | return result;
|
13293 | }
|
13294 | function compileMap() {
|
13295 | var result = {
|
13296 | scalar: {},
|
13297 | sequence: {},
|
13298 | mapping: {},
|
13299 | fallback: {},
|
13300 | multi: {
|
13301 | scalar: [],
|
13302 | sequence: [],
|
13303 | mapping: [],
|
13304 | fallback: []
|
13305 | }
|
13306 | }, index, length;
|
13307 | function collectType(type2) {
|
13308 | if (type2.multi) {
|
13309 | result.multi[type2.kind].push(type2);
|
13310 | result.multi["fallback"].push(type2);
|
13311 | } else {
|
13312 | result[type2.kind][type2.tag] = result["fallback"][type2.tag] = type2;
|
13313 | }
|
13314 | }
|
13315 | for (index = 0, length = arguments.length; index < length; index += 1) {
|
13316 | arguments[index].forEach(collectType);
|
13317 | }
|
13318 | return result;
|
13319 | }
|
13320 | function Schema$1(definition) {
|
13321 | return this.extend(definition);
|
13322 | }
|
13323 | Schema$1.prototype.extend = function extend2(definition) {
|
13324 | var implicit = [];
|
13325 | var explicit = [];
|
13326 | if (definition instanceof type) {
|
13327 | explicit.push(definition);
|
13328 | } else if (Array.isArray(definition)) {
|
13329 | explicit = explicit.concat(definition);
|
13330 | } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
|
13331 | if (definition.implicit) implicit = implicit.concat(definition.implicit);
|
13332 | if (definition.explicit) explicit = explicit.concat(definition.explicit);
|
13333 | } else {
|
13334 | throw new exception("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
|
13335 | }
|
13336 | implicit.forEach(function(type$1) {
|
13337 | if (!(type$1 instanceof type)) {
|
13338 | throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
13339 | }
|
13340 | if (type$1.loadKind && type$1.loadKind !== "scalar") {
|
13341 | throw new exception("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
|
13342 | }
|
13343 | if (type$1.multi) {
|
13344 | throw new exception("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
|
13345 | }
|
13346 | });
|
13347 | explicit.forEach(function(type$1) {
|
13348 | if (!(type$1 instanceof type)) {
|
13349 | throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
13350 | }
|
13351 | });
|
13352 | var result = Object.create(Schema$1.prototype);
|
13353 | result.implicit = (this.implicit || []).concat(implicit);
|
13354 | result.explicit = (this.explicit || []).concat(explicit);
|
13355 | result.compiledImplicit = compileList(result, "implicit");
|
13356 | result.compiledExplicit = compileList(result, "explicit");
|
13357 | result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
|
13358 | return result;
|
13359 | };
|
13360 | var schema = Schema$1;
|
13361 | var str = new type("tag:yaml.org,2002:str", {
|
13362 | kind: "scalar",
|
13363 | construct: function(data) {
|
13364 | return data !== null ? data : "";
|
13365 | }
|
13366 | });
|
13367 | var seq = new type("tag:yaml.org,2002:seq", {
|
13368 | kind: "sequence",
|
13369 | construct: function(data) {
|
13370 | return data !== null ? data : [];
|
13371 | }
|
13372 | });
|
13373 | var map = new type("tag:yaml.org,2002:map", {
|
13374 | kind: "mapping",
|
13375 | construct: function(data) {
|
13376 | return data !== null ? data : {};
|
13377 | }
|
13378 | });
|
13379 | var failsafe = new schema({
|
13380 | explicit: [
|
13381 | str,
|
13382 | seq,
|
13383 | map
|
13384 | ]
|
13385 | });
|
13386 | function resolveYamlNull(data) {
|
13387 | if (data === null) return true;
|
13388 | var max = data.length;
|
13389 | return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
|
13390 | }
|
13391 | function constructYamlNull() {
|
13392 | return null;
|
13393 | }
|
13394 | function isNull(object) {
|
13395 | return object === null;
|
13396 | }
|
13397 | var _null = new type("tag:yaml.org,2002:null", {
|
13398 | kind: "scalar",
|
13399 | resolve: resolveYamlNull,
|
13400 | construct: constructYamlNull,
|
13401 | predicate: isNull,
|
13402 | represent: {
|
13403 | canonical: function() {
|
13404 | return "~";
|
13405 | },
|
13406 | lowercase: function() {
|
13407 | return "null";
|
13408 | },
|
13409 | uppercase: function() {
|
13410 | return "NULL";
|
13411 | },
|
13412 | camelcase: function() {
|
13413 | return "Null";
|
13414 | },
|
13415 | empty: function() {
|
13416 | return "";
|
13417 | }
|
13418 | },
|
13419 | defaultStyle: "lowercase"
|
13420 | });
|
13421 | function resolveYamlBoolean(data) {
|
13422 | if (data === null) return false;
|
13423 | var max = data.length;
|
13424 | return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
|
13425 | }
|
13426 | function constructYamlBoolean(data) {
|
13427 | return data === "true" || data === "True" || data === "TRUE";
|
13428 | }
|
13429 | function isBoolean(object) {
|
13430 | return Object.prototype.toString.call(object) === "[object Boolean]";
|
13431 | }
|
13432 | var bool = new type("tag:yaml.org,2002:bool", {
|
13433 | kind: "scalar",
|
13434 | resolve: resolveYamlBoolean,
|
13435 | construct: constructYamlBoolean,
|
13436 | predicate: isBoolean,
|
13437 | represent: {
|
13438 | lowercase: function(object) {
|
13439 | return object ? "true" : "false";
|
13440 | },
|
13441 | uppercase: function(object) {
|
13442 | return object ? "TRUE" : "FALSE";
|
13443 | },
|
13444 | camelcase: function(object) {
|
13445 | return object ? "True" : "False";
|
13446 | }
|
13447 | },
|
13448 | defaultStyle: "lowercase"
|
13449 | });
|
13450 | function isHexCode(c2) {
|
13451 | return 48 <= c2 && c2 <= 57 || 65 <= c2 && c2 <= 70 || 97 <= c2 && c2 <= 102;
|
13452 | }
|
13453 | function isOctCode(c2) {
|
13454 | return 48 <= c2 && c2 <= 55;
|
13455 | }
|
13456 | function isDecCode(c2) {
|
13457 | return 48 <= c2 && c2 <= 57;
|
13458 | }
|
13459 | function resolveYamlInteger(data) {
|
13460 | if (data === null) return false;
|
13461 | var max = data.length, index = 0, hasDigits = false, ch;
|
13462 | if (!max) return false;
|
13463 | ch = data[index];
|
13464 | if (ch === "-" || ch === "+") {
|
13465 | ch = data[++index];
|
13466 | }
|
13467 | if (ch === "0") {
|
13468 | if (index + 1 === max) return true;
|
13469 | ch = data[++index];
|
13470 | if (ch === "b") {
|
13471 | index++;
|
13472 | for (; index < max; index++) {
|
13473 | ch = data[index];
|
13474 | if (ch === "_") continue;
|
13475 | if (ch !== "0" && ch !== "1") return false;
|
13476 | hasDigits = true;
|
13477 | }
|
13478 | return hasDigits && ch !== "_";
|
13479 | }
|
13480 | if (ch === "x") {
|
13481 | index++;
|
13482 | for (; index < max; index++) {
|
13483 | ch = data[index];
|
13484 | if (ch === "_") continue;
|
13485 | if (!isHexCode(data.charCodeAt(index))) return false;
|
13486 | hasDigits = true;
|
13487 | }
|
13488 | return hasDigits && ch !== "_";
|
13489 | }
|
13490 | if (ch === "o") {
|
13491 | index++;
|
13492 | for (; index < max; index++) {
|
13493 | ch = data[index];
|
13494 | if (ch === "_") continue;
|
13495 | if (!isOctCode(data.charCodeAt(index))) return false;
|
13496 | hasDigits = true;
|
13497 | }
|
13498 | return hasDigits && ch !== "_";
|
13499 | }
|
13500 | }
|
13501 | if (ch === "_") return false;
|
13502 | for (; index < max; index++) {
|
13503 | ch = data[index];
|
13504 | if (ch === "_") continue;
|
13505 | if (!isDecCode(data.charCodeAt(index))) {
|
13506 | return false;
|
13507 | }
|
13508 | hasDigits = true;
|
13509 | }
|
13510 | if (!hasDigits || ch === "_") return false;
|
13511 | return true;
|
13512 | }
|
13513 | function constructYamlInteger(data) {
|
13514 | var value = data, sign2 = 1, ch;
|
13515 | if (value.indexOf("_") !== -1) {
|
13516 | value = value.replace(/_/g, "");
|
13517 | }
|
13518 | ch = value[0];
|
13519 | if (ch === "-" || ch === "+") {
|
13520 | if (ch === "-") sign2 = -1;
|
13521 | value = value.slice(1);
|
13522 | ch = value[0];
|
13523 | }
|
13524 | if (value === "0") return 0;
|
13525 | if (ch === "0") {
|
13526 | if (value[1] === "b") return sign2 * parseInt(value.slice(2), 2);
|
13527 | if (value[1] === "x") return sign2 * parseInt(value.slice(2), 16);
|
13528 | if (value[1] === "o") return sign2 * parseInt(value.slice(2), 8);
|
13529 | }
|
13530 | return sign2 * parseInt(value, 10);
|
13531 | }
|
13532 | function isInteger(object) {
|
13533 | return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
|
13534 | }
|
13535 | var int = new type("tag:yaml.org,2002:int", {
|
13536 | kind: "scalar",
|
13537 | resolve: resolveYamlInteger,
|
13538 | construct: constructYamlInteger,
|
13539 | predicate: isInteger,
|
13540 | represent: {
|
13541 | binary: function(obj) {
|
13542 | return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
|
13543 | },
|
13544 | octal: function(obj) {
|
13545 | return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
|
13546 | },
|
13547 | decimal: function(obj) {
|
13548 | return obj.toString(10);
|
13549 | },
|
13550 |
|
13551 | hexadecimal: function(obj) {
|
13552 | return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
|
13553 | }
|
13554 | },
|
13555 | defaultStyle: "decimal",
|
13556 | styleAliases: {
|
13557 | binary: [2, "bin"],
|
13558 | octal: [8, "oct"],
|
13559 | decimal: [10, "dec"],
|
13560 | hexadecimal: [16, "hex"]
|
13561 | }
|
13562 | });
|
13563 | var YAML_FLOAT_PATTERN = new RegExp(
|
13564 |
|
13565 | "^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
|
13566 | );
|
13567 | function resolveYamlFloat(data) {
|
13568 | if (data === null) return false;
|
13569 | if (!YAML_FLOAT_PATTERN.test(data) ||
|
13570 |
|
13571 | data[data.length - 1] === "_") {
|
13572 | return false;
|
13573 | }
|
13574 | return true;
|
13575 | }
|
13576 | function constructYamlFloat(data) {
|
13577 | var value, sign2;
|
13578 | value = data.replace(/_/g, "").toLowerCase();
|
13579 | sign2 = value[0] === "-" ? -1 : 1;
|
13580 | if ("+-".indexOf(value[0]) >= 0) {
|
13581 | value = value.slice(1);
|
13582 | }
|
13583 | if (value === ".inf") {
|
13584 | return sign2 === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
13585 | } else if (value === ".nan") {
|
13586 | return NaN;
|
13587 | }
|
13588 | return sign2 * parseFloat(value, 10);
|
13589 | }
|
13590 | var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
|
13591 | function representYamlFloat(object, style) {
|
13592 | var res;
|
13593 | if (isNaN(object)) {
|
13594 | switch (style) {
|
13595 | case "lowercase":
|
13596 | return ".nan";
|
13597 | case "uppercase":
|
13598 | return ".NAN";
|
13599 | case "camelcase":
|
13600 | return ".NaN";
|
13601 | }
|
13602 | } else if (Number.POSITIVE_INFINITY === object) {
|
13603 | switch (style) {
|
13604 | case "lowercase":
|
13605 | return ".inf";
|
13606 | case "uppercase":
|
13607 | return ".INF";
|
13608 | case "camelcase":
|
13609 | return ".Inf";
|
13610 | }
|
13611 | } else if (Number.NEGATIVE_INFINITY === object) {
|
13612 | switch (style) {
|
13613 | case "lowercase":
|
13614 | return "-.inf";
|
13615 | case "uppercase":
|
13616 | return "-.INF";
|
13617 | case "camelcase":
|
13618 | return "-.Inf";
|
13619 | }
|
13620 | } else if (common.isNegativeZero(object)) {
|
13621 | return "-0.0";
|
13622 | }
|
13623 | res = object.toString(10);
|
13624 | return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
|
13625 | }
|
13626 | function isFloat(object) {
|
13627 | return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
|
13628 | }
|
13629 | var float = new type("tag:yaml.org,2002:float", {
|
13630 | kind: "scalar",
|
13631 | resolve: resolveYamlFloat,
|
13632 | construct: constructYamlFloat,
|
13633 | predicate: isFloat,
|
13634 | represent: representYamlFloat,
|
13635 | defaultStyle: "lowercase"
|
13636 | });
|
13637 | var json = failsafe.extend({
|
13638 | implicit: [
|
13639 | _null,
|
13640 | bool,
|
13641 | int,
|
13642 | float
|
13643 | ]
|
13644 | });
|
13645 | var core = json;
|
13646 | var YAML_DATE_REGEXP = new RegExp(
|
13647 | "^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
|
13648 | );
|
13649 | var YAML_TIMESTAMP_REGEXP = new RegExp(
|
13650 | "^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"
|
13651 | );
|
13652 | function resolveYamlTimestamp(data) {
|
13653 | if (data === null) return false;
|
13654 | if (YAML_DATE_REGEXP.exec(data) !== null) return true;
|
13655 | if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
|
13656 | return false;
|
13657 | }
|
13658 | function constructYamlTimestamp(data) {
|
13659 | var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
|
13660 | match = YAML_DATE_REGEXP.exec(data);
|
13661 | if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
|
13662 | if (match === null) throw new Error("Date resolve error");
|
13663 | year = +match[1];
|
13664 | month = +match[2] - 1;
|
13665 | day = +match[3];
|
13666 | if (!match[4]) {
|
13667 | return new Date(Date.UTC(year, month, day));
|
13668 | }
|
13669 | hour = +match[4];
|
13670 | minute = +match[5];
|
13671 | second = +match[6];
|
13672 | if (match[7]) {
|
13673 | fraction = match[7].slice(0, 3);
|
13674 | while (fraction.length < 3) {
|
13675 | fraction += "0";
|
13676 | }
|
13677 | fraction = +fraction;
|
13678 | }
|
13679 | if (match[9]) {
|
13680 | tz_hour = +match[10];
|
13681 | tz_minute = +(match[11] || 0);
|
13682 | delta = (tz_hour * 60 + tz_minute) * 6e4;
|
13683 | if (match[9] === "-") delta = -delta;
|
13684 | }
|
13685 | date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
13686 | if (delta) date.setTime(date.getTime() - delta);
|
13687 | return date;
|
13688 | }
|
13689 | function representYamlTimestamp(object) {
|
13690 | return object.toISOString();
|
13691 | }
|
13692 | var timestamp = new type("tag:yaml.org,2002:timestamp", {
|
13693 | kind: "scalar",
|
13694 | resolve: resolveYamlTimestamp,
|
13695 | construct: constructYamlTimestamp,
|
13696 | instanceOf: Date,
|
13697 | represent: representYamlTimestamp
|
13698 | });
|
13699 | function resolveYamlMerge(data) {
|
13700 | return data === "<<" || data === null;
|
13701 | }
|
13702 | var merge = new type("tag:yaml.org,2002:merge", {
|
13703 | kind: "scalar",
|
13704 | resolve: resolveYamlMerge
|
13705 | });
|
13706 | var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
|
13707 | function resolveYamlBinary(data) {
|
13708 | if (data === null) return false;
|
13709 | var code, idx, bitlen = 0, max = data.length, map2 = BASE64_MAP;
|
13710 | for (idx = 0; idx < max; idx++) {
|
13711 | code = map2.indexOf(data.charAt(idx));
|
13712 | if (code > 64) continue;
|
13713 | if (code < 0) return false;
|
13714 | bitlen += 6;
|
13715 | }
|
13716 | return bitlen % 8 === 0;
|
13717 | }
|
13718 | function constructYamlBinary(data) {
|
13719 | var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map2 = BASE64_MAP, bits = 0, result = [];
|
13720 | for (idx = 0; idx < max; idx++) {
|
13721 | if (idx % 4 === 0 && idx) {
|
13722 | result.push(bits >> 16 & 255);
|
13723 | result.push(bits >> 8 & 255);
|
13724 | result.push(bits & 255);
|
13725 | }
|
13726 | bits = bits << 6 | map2.indexOf(input.charAt(idx));
|
13727 | }
|
13728 | tailbits = max % 4 * 6;
|
13729 | if (tailbits === 0) {
|
13730 | result.push(bits >> 16 & 255);
|
13731 | result.push(bits >> 8 & 255);
|
13732 | result.push(bits & 255);
|
13733 | } else if (tailbits === 18) {
|
13734 | result.push(bits >> 10 & 255);
|
13735 | result.push(bits >> 2 & 255);
|
13736 | } else if (tailbits === 12) {
|
13737 | result.push(bits >> 4 & 255);
|
13738 | }
|
13739 | return new Uint8Array(result);
|
13740 | }
|
13741 | function representYamlBinary(object) {
|
13742 | var result = "", bits = 0, idx, tail, max = object.length, map2 = BASE64_MAP;
|
13743 | for (idx = 0; idx < max; idx++) {
|
13744 | if (idx % 3 === 0 && idx) {
|
13745 | result += map2[bits >> 18 & 63];
|
13746 | result += map2[bits >> 12 & 63];
|
13747 | result += map2[bits >> 6 & 63];
|
13748 | result += map2[bits & 63];
|
13749 | }
|
13750 | bits = (bits << 8) + object[idx];
|
13751 | }
|
13752 | tail = max % 3;
|
13753 | if (tail === 0) {
|
13754 | result += map2[bits >> 18 & 63];
|
13755 | result += map2[bits >> 12 & 63];
|
13756 | result += map2[bits >> 6 & 63];
|
13757 | result += map2[bits & 63];
|
13758 | } else if (tail === 2) {
|
13759 | result += map2[bits >> 10 & 63];
|
13760 | result += map2[bits >> 4 & 63];
|
13761 | result += map2[bits << 2 & 63];
|
13762 | result += map2[64];
|
13763 | } else if (tail === 1) {
|
13764 | result += map2[bits >> 2 & 63];
|
13765 | result += map2[bits << 4 & 63];
|
13766 | result += map2[64];
|
13767 | result += map2[64];
|
13768 | }
|
13769 | return result;
|
13770 | }
|
13771 | function isBinary(obj) {
|
13772 | return Object.prototype.toString.call(obj) === "[object Uint8Array]";
|
13773 | }
|
13774 | var binary = new type("tag:yaml.org,2002:binary", {
|
13775 | kind: "scalar",
|
13776 | resolve: resolveYamlBinary,
|
13777 | construct: constructYamlBinary,
|
13778 | predicate: isBinary,
|
13779 | represent: representYamlBinary
|
13780 | });
|
13781 | var _hasOwnProperty$3 = Object.prototype.hasOwnProperty;
|
13782 | var _toString$2 = Object.prototype.toString;
|
13783 | function resolveYamlOmap(data) {
|
13784 | if (data === null) return true;
|
13785 | var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data;
|
13786 | for (index = 0, length = object.length; index < length; index += 1) {
|
13787 | pair = object[index];
|
13788 | pairHasKey = false;
|
13789 | if (_toString$2.call(pair) !== "[object Object]") return false;
|
13790 | for (pairKey in pair) {
|
13791 | if (_hasOwnProperty$3.call(pair, pairKey)) {
|
13792 | if (!pairHasKey) pairHasKey = true;
|
13793 | else return false;
|
13794 | }
|
13795 | }
|
13796 | if (!pairHasKey) return false;
|
13797 | if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
|
13798 | else return false;
|
13799 | }
|
13800 | return true;
|
13801 | }
|
13802 | function constructYamlOmap(data) {
|
13803 | return data !== null ? data : [];
|
13804 | }
|
13805 | var omap = new type("tag:yaml.org,2002:omap", {
|
13806 | kind: "sequence",
|
13807 | resolve: resolveYamlOmap,
|
13808 | construct: constructYamlOmap
|
13809 | });
|
13810 | var _toString$1 = Object.prototype.toString;
|
13811 | function resolveYamlPairs(data) {
|
13812 | if (data === null) return true;
|
13813 | var index, length, pair, keys, result, object = data;
|
13814 | result = new Array(object.length);
|
13815 | for (index = 0, length = object.length; index < length; index += 1) {
|
13816 | pair = object[index];
|
13817 | if (_toString$1.call(pair) !== "[object Object]") return false;
|
13818 | keys = Object.keys(pair);
|
13819 | if (keys.length !== 1) return false;
|
13820 | result[index] = [keys[0], pair[keys[0]]];
|
13821 | }
|
13822 | return true;
|
13823 | }
|
13824 | function constructYamlPairs(data) {
|
13825 | if (data === null) return [];
|
13826 | var index, length, pair, keys, result, object = data;
|
13827 | result = new Array(object.length);
|
13828 | for (index = 0, length = object.length; index < length; index += 1) {
|
13829 | pair = object[index];
|
13830 | keys = Object.keys(pair);
|
13831 | result[index] = [keys[0], pair[keys[0]]];
|
13832 | }
|
13833 | return result;
|
13834 | }
|
13835 | var pairs = new type("tag:yaml.org,2002:pairs", {
|
13836 | kind: "sequence",
|
13837 | resolve: resolveYamlPairs,
|
13838 | construct: constructYamlPairs
|
13839 | });
|
13840 | var _hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
13841 | function resolveYamlSet(data) {
|
13842 | if (data === null) return true;
|
13843 | var key2, object = data;
|
13844 | for (key2 in object) {
|
13845 | if (_hasOwnProperty$2.call(object, key2)) {
|
13846 | if (object[key2] !== null) return false;
|
13847 | }
|
13848 | }
|
13849 | return true;
|
13850 | }
|
13851 | function constructYamlSet(data) {
|
13852 | return data !== null ? data : {};
|
13853 | }
|
13854 | var set = new type("tag:yaml.org,2002:set", {
|
13855 | kind: "mapping",
|
13856 | resolve: resolveYamlSet,
|
13857 | construct: constructYamlSet
|
13858 | });
|
13859 | var _default = core.extend({
|
13860 | implicit: [
|
13861 | timestamp,
|
13862 | merge
|
13863 | ],
|
13864 | explicit: [
|
13865 | binary,
|
13866 | omap,
|
13867 | pairs,
|
13868 | set
|
13869 | ]
|
13870 | });
|
13871 | var _hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
13872 | var CONTEXT_FLOW_IN = 1;
|
13873 | var CONTEXT_FLOW_OUT = 2;
|
13874 | var CONTEXT_BLOCK_IN = 3;
|
13875 | var CONTEXT_BLOCK_OUT = 4;
|
13876 | var CHOMPING_CLIP = 1;
|
13877 | var CHOMPING_STRIP = 2;
|
13878 | var CHOMPING_KEEP = 3;
|
13879 | var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
13880 | var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
|
13881 | var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
|
13882 | var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
|
13883 | var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
|
13884 | function _class(obj) {
|
13885 | return Object.prototype.toString.call(obj);
|
13886 | }
|
13887 | function is_EOL(c2) {
|
13888 | return c2 === 10 || c2 === 13;
|
13889 | }
|
13890 | function is_WHITE_SPACE(c2) {
|
13891 | return c2 === 9 || c2 === 32;
|
13892 | }
|
13893 | function is_WS_OR_EOL(c2) {
|
13894 | return c2 === 9 || c2 === 32 || c2 === 10 || c2 === 13;
|
13895 | }
|
13896 | function is_FLOW_INDICATOR(c2) {
|
13897 | return c2 === 44 || c2 === 91 || c2 === 93 || c2 === 123 || c2 === 125;
|
13898 | }
|
13899 | function fromHexCode(c2) {
|
13900 | var lc;
|
13901 | if (48 <= c2 && c2 <= 57) {
|
13902 | return c2 - 48;
|
13903 | }
|
13904 | lc = c2 | 32;
|
13905 | if (97 <= lc && lc <= 102) {
|
13906 | return lc - 97 + 10;
|
13907 | }
|
13908 | return -1;
|
13909 | }
|
13910 | function escapedHexLen(c2) {
|
13911 | if (c2 === 120) {
|
13912 | return 2;
|
13913 | }
|
13914 | if (c2 === 117) {
|
13915 | return 4;
|
13916 | }
|
13917 | if (c2 === 85) {
|
13918 | return 8;
|
13919 | }
|
13920 | return 0;
|
13921 | }
|
13922 | function fromDecimalCode(c2) {
|
13923 | if (48 <= c2 && c2 <= 57) {
|
13924 | return c2 - 48;
|
13925 | }
|
13926 | return -1;
|
13927 | }
|
13928 | function simpleEscapeSequence(c2) {
|
13929 | return c2 === 48 ? "\0" : c2 === 97 ? "\x07" : c2 === 98 ? "\b" : c2 === 116 ? " " : c2 === 9 ? " " : c2 === 110 ? "\n" : c2 === 118 ? "\v" : c2 === 102 ? "\f" : c2 === 114 ? "\r" : c2 === 101 ? "\x1B" : c2 === 32 ? " " : c2 === 34 ? '"' : c2 === 47 ? "/" : c2 === 92 ? "\\" : c2 === 78 ? "\x85" : c2 === 95 ? "\xA0" : c2 === 76 ? "\u2028" : c2 === 80 ? "\u2029" : "";
|
13930 | }
|
13931 | function charFromCodepoint(c2) {
|
13932 | if (c2 <= 65535) {
|
13933 | return String.fromCharCode(c2);
|
13934 | }
|
13935 | return String.fromCharCode(
|
13936 | (c2 - 65536 >> 10) + 55296,
|
13937 | (c2 - 65536 & 1023) + 56320
|
13938 | );
|
13939 | }
|
13940 | var simpleEscapeCheck = new Array(256);
|
13941 | var simpleEscapeMap = new Array(256);
|
13942 | for (i = 0; i < 256; i++) {
|
13943 | simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
|
13944 | simpleEscapeMap[i] = simpleEscapeSequence(i);
|
13945 | }
|
13946 | var i;
|
13947 | function State$1(input, options8) {
|
13948 | this.input = input;
|
13949 | this.filename = options8["filename"] || null;
|
13950 | this.schema = options8["schema"] || _default;
|
13951 | this.onWarning = options8["onWarning"] || null;
|
13952 | this.legacy = options8["legacy"] || false;
|
13953 | this.json = options8["json"] || false;
|
13954 | this.listener = options8["listener"] || null;
|
13955 | this.implicitTypes = this.schema.compiledImplicit;
|
13956 | this.typeMap = this.schema.compiledTypeMap;
|
13957 | this.length = input.length;
|
13958 | this.position = 0;
|
13959 | this.line = 0;
|
13960 | this.lineStart = 0;
|
13961 | this.lineIndent = 0;
|
13962 | this.firstTabInLine = -1;
|
13963 | this.documents = [];
|
13964 | }
|
13965 | function generateError(state, message) {
|
13966 | var mark = {
|
13967 | name: state.filename,
|
13968 | buffer: state.input.slice(0, -1),
|
13969 |
|
13970 | position: state.position,
|
13971 | line: state.line,
|
13972 | column: state.position - state.lineStart
|
13973 | };
|
13974 | mark.snippet = snippet(mark);
|
13975 | return new exception(message, mark);
|
13976 | }
|
13977 | function throwError(state, message) {
|
13978 | throw generateError(state, message);
|
13979 | }
|
13980 | function throwWarning(state, message) {
|
13981 | if (state.onWarning) {
|
13982 | state.onWarning.call(null, generateError(state, message));
|
13983 | }
|
13984 | }
|
13985 | var directiveHandlers = {
|
13986 | YAML: function handleYamlDirective(state, name, args) {
|
13987 | var match, major, minor;
|
13988 | if (state.version !== null) {
|
13989 | throwError(state, "duplication of %YAML directive");
|
13990 | }
|
13991 | if (args.length !== 1) {
|
13992 | throwError(state, "YAML directive accepts exactly one argument");
|
13993 | }
|
13994 | match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
13995 | if (match === null) {
|
13996 | throwError(state, "ill-formed argument of the YAML directive");
|
13997 | }
|
13998 | major = parseInt(match[1], 10);
|
13999 | minor = parseInt(match[2], 10);
|
14000 | if (major !== 1) {
|
14001 | throwError(state, "unacceptable YAML version of the document");
|
14002 | }
|
14003 | state.version = args[0];
|
14004 | state.checkLineBreaks = minor < 2;
|
14005 | if (minor !== 1 && minor !== 2) {
|
14006 | throwWarning(state, "unsupported YAML version of the document");
|
14007 | }
|
14008 | },
|
14009 | TAG: function handleTagDirective(state, name, args) {
|
14010 | var handle, prefix;
|
14011 | if (args.length !== 2) {
|
14012 | throwError(state, "TAG directive accepts exactly two arguments");
|
14013 | }
|
14014 | handle = args[0];
|
14015 | prefix = args[1];
|
14016 | if (!PATTERN_TAG_HANDLE.test(handle)) {
|
14017 | throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
|
14018 | }
|
14019 | if (_hasOwnProperty$1.call(state.tagMap, handle)) {
|
14020 | throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
14021 | }
|
14022 | if (!PATTERN_TAG_URI.test(prefix)) {
|
14023 | throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
|
14024 | }
|
14025 | try {
|
14026 | prefix = decodeURIComponent(prefix);
|
14027 | } catch (err) {
|
14028 | throwError(state, "tag prefix is malformed: " + prefix);
|
14029 | }
|
14030 | state.tagMap[handle] = prefix;
|
14031 | }
|
14032 | };
|
14033 | function captureSegment(state, start, end, checkJson) {
|
14034 | var _position, _length, _character, _result;
|
14035 | if (start < end) {
|
14036 | _result = state.input.slice(start, end);
|
14037 | if (checkJson) {
|
14038 | for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
|
14039 | _character = _result.charCodeAt(_position);
|
14040 | if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
|
14041 | throwError(state, "expected valid JSON character");
|
14042 | }
|
14043 | }
|
14044 | } else if (PATTERN_NON_PRINTABLE.test(_result)) {
|
14045 | throwError(state, "the stream contains non-printable characters");
|
14046 | }
|
14047 | state.result += _result;
|
14048 | }
|
14049 | }
|
14050 | function mergeMappings(state, destination, source2, overridableKeys) {
|
14051 | var sourceKeys, key2, index, quantity;
|
14052 | if (!common.isObject(source2)) {
|
14053 | throwError(state, "cannot merge mappings; the provided source object is unacceptable");
|
14054 | }
|
14055 | sourceKeys = Object.keys(source2);
|
14056 | for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
|
14057 | key2 = sourceKeys[index];
|
14058 | if (!_hasOwnProperty$1.call(destination, key2)) {
|
14059 | destination[key2] = source2[key2];
|
14060 | overridableKeys[key2] = true;
|
14061 | }
|
14062 | }
|
14063 | }
|
14064 | function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
|
14065 | var index, quantity;
|
14066 | if (Array.isArray(keyNode)) {
|
14067 | keyNode = Array.prototype.slice.call(keyNode);
|
14068 | for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
|
14069 | if (Array.isArray(keyNode[index])) {
|
14070 | throwError(state, "nested arrays are not supported inside keys");
|
14071 | }
|
14072 | if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
|
14073 | keyNode[index] = "[object Object]";
|
14074 | }
|
14075 | }
|
14076 | }
|
14077 | if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
|
14078 | keyNode = "[object Object]";
|
14079 | }
|
14080 | keyNode = String(keyNode);
|
14081 | if (_result === null) {
|
14082 | _result = {};
|
14083 | }
|
14084 | if (keyTag === "tag:yaml.org,2002:merge") {
|
14085 | if (Array.isArray(valueNode)) {
|
14086 | for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
|
14087 | mergeMappings(state, _result, valueNode[index], overridableKeys);
|
14088 | }
|
14089 | } else {
|
14090 | mergeMappings(state, _result, valueNode, overridableKeys);
|
14091 | }
|
14092 | } else {
|
14093 | if (!state.json && !_hasOwnProperty$1.call(overridableKeys, keyNode) && _hasOwnProperty$1.call(_result, keyNode)) {
|
14094 | state.line = startLine || state.line;
|
14095 | state.lineStart = startLineStart || state.lineStart;
|
14096 | state.position = startPos || state.position;
|
14097 | throwError(state, "duplicated mapping key");
|
14098 | }
|
14099 | if (keyNode === "__proto__") {
|
14100 | Object.defineProperty(_result, keyNode, {
|
14101 | configurable: true,
|
14102 | enumerable: true,
|
14103 | writable: true,
|
14104 | value: valueNode
|
14105 | });
|
14106 | } else {
|
14107 | _result[keyNode] = valueNode;
|
14108 | }
|
14109 | delete overridableKeys[keyNode];
|
14110 | }
|
14111 | return _result;
|
14112 | }
|
14113 | function readLineBreak(state) {
|
14114 | var ch;
|
14115 | ch = state.input.charCodeAt(state.position);
|
14116 | if (ch === 10) {
|
14117 | state.position++;
|
14118 | } else if (ch === 13) {
|
14119 | state.position++;
|
14120 | if (state.input.charCodeAt(state.position) === 10) {
|
14121 | state.position++;
|
14122 | }
|
14123 | } else {
|
14124 | throwError(state, "a line break is expected");
|
14125 | }
|
14126 | state.line += 1;
|
14127 | state.lineStart = state.position;
|
14128 | state.firstTabInLine = -1;
|
14129 | }
|
14130 | function skipSeparationSpace(state, allowComments, checkIndent) {
|
14131 | var lineBreaks = 0, ch = state.input.charCodeAt(state.position);
|
14132 | while (ch !== 0) {
|
14133 | while (is_WHITE_SPACE(ch)) {
|
14134 | if (ch === 9 && state.firstTabInLine === -1) {
|
14135 | state.firstTabInLine = state.position;
|
14136 | }
|
14137 | ch = state.input.charCodeAt(++state.position);
|
14138 | }
|
14139 | if (allowComments && ch === 35) {
|
14140 | do {
|
14141 | ch = state.input.charCodeAt(++state.position);
|
14142 | } while (ch !== 10 && ch !== 13 && ch !== 0);
|
14143 | }
|
14144 | if (is_EOL(ch)) {
|
14145 | readLineBreak(state);
|
14146 | ch = state.input.charCodeAt(state.position);
|
14147 | lineBreaks++;
|
14148 | state.lineIndent = 0;
|
14149 | while (ch === 32) {
|
14150 | state.lineIndent++;
|
14151 | ch = state.input.charCodeAt(++state.position);
|
14152 | }
|
14153 | } else {
|
14154 | break;
|
14155 | }
|
14156 | }
|
14157 | if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
|
14158 | throwWarning(state, "deficient indentation");
|
14159 | }
|
14160 | return lineBreaks;
|
14161 | }
|
14162 | function testDocumentSeparator(state) {
|
14163 | var _position = state.position, ch;
|
14164 | ch = state.input.charCodeAt(_position);
|
14165 | if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
|
14166 | _position += 3;
|
14167 | ch = state.input.charCodeAt(_position);
|
14168 | if (ch === 0 || is_WS_OR_EOL(ch)) {
|
14169 | return true;
|
14170 | }
|
14171 | }
|
14172 | return false;
|
14173 | }
|
14174 | function writeFoldedLines(state, count) {
|
14175 | if (count === 1) {
|
14176 | state.result += " ";
|
14177 | } else if (count > 1) {
|
14178 | state.result += common.repeat("\n", count - 1);
|
14179 | }
|
14180 | }
|
14181 | function readPlainScalar(state, nodeIndent, withinFlowCollection) {
|
14182 | var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch;
|
14183 | ch = state.input.charCodeAt(state.position);
|
14184 | if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) {
|
14185 | return false;
|
14186 | }
|
14187 | if (ch === 63 || ch === 45) {
|
14188 | following = state.input.charCodeAt(state.position + 1);
|
14189 | if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
14190 | return false;
|
14191 | }
|
14192 | }
|
14193 | state.kind = "scalar";
|
14194 | state.result = "";
|
14195 | captureStart = captureEnd = state.position;
|
14196 | hasPendingContent = false;
|
14197 | while (ch !== 0) {
|
14198 | if (ch === 58) {
|
14199 | following = state.input.charCodeAt(state.position + 1);
|
14200 | if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
14201 | break;
|
14202 | }
|
14203 | } else if (ch === 35) {
|
14204 | preceding = state.input.charCodeAt(state.position - 1);
|
14205 | if (is_WS_OR_EOL(preceding)) {
|
14206 | break;
|
14207 | }
|
14208 | } else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
|
14209 | break;
|
14210 | } else if (is_EOL(ch)) {
|
14211 | _line = state.line;
|
14212 | _lineStart = state.lineStart;
|
14213 | _lineIndent = state.lineIndent;
|
14214 | skipSeparationSpace(state, false, -1);
|
14215 | if (state.lineIndent >= nodeIndent) {
|
14216 | hasPendingContent = true;
|
14217 | ch = state.input.charCodeAt(state.position);
|
14218 | continue;
|
14219 | } else {
|
14220 | state.position = captureEnd;
|
14221 | state.line = _line;
|
14222 | state.lineStart = _lineStart;
|
14223 | state.lineIndent = _lineIndent;
|
14224 | break;
|
14225 | }
|
14226 | }
|
14227 | if (hasPendingContent) {
|
14228 | captureSegment(state, captureStart, captureEnd, false);
|
14229 | writeFoldedLines(state, state.line - _line);
|
14230 | captureStart = captureEnd = state.position;
|
14231 | hasPendingContent = false;
|
14232 | }
|
14233 | if (!is_WHITE_SPACE(ch)) {
|
14234 | captureEnd = state.position + 1;
|
14235 | }
|
14236 | ch = state.input.charCodeAt(++state.position);
|
14237 | }
|
14238 | captureSegment(state, captureStart, captureEnd, false);
|
14239 | if (state.result) {
|
14240 | return true;
|
14241 | }
|
14242 | state.kind = _kind;
|
14243 | state.result = _result;
|
14244 | return false;
|
14245 | }
|
14246 | function readSingleQuotedScalar(state, nodeIndent) {
|
14247 | var ch, captureStart, captureEnd;
|
14248 | ch = state.input.charCodeAt(state.position);
|
14249 | if (ch !== 39) {
|
14250 | return false;
|
14251 | }
|
14252 | state.kind = "scalar";
|
14253 | state.result = "";
|
14254 | state.position++;
|
14255 | captureStart = captureEnd = state.position;
|
14256 | while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
14257 | if (ch === 39) {
|
14258 | captureSegment(state, captureStart, state.position, true);
|
14259 | ch = state.input.charCodeAt(++state.position);
|
14260 | if (ch === 39) {
|
14261 | captureStart = state.position;
|
14262 | state.position++;
|
14263 | captureEnd = state.position;
|
14264 | } else {
|
14265 | return true;
|
14266 | }
|
14267 | } else if (is_EOL(ch)) {
|
14268 | captureSegment(state, captureStart, captureEnd, true);
|
14269 | writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
14270 | captureStart = captureEnd = state.position;
|
14271 | } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
14272 | throwError(state, "unexpected end of the document within a single quoted scalar");
|
14273 | } else {
|
14274 | state.position++;
|
14275 | captureEnd = state.position;
|
14276 | }
|
14277 | }
|
14278 | throwError(state, "unexpected end of the stream within a single quoted scalar");
|
14279 | }
|
14280 | function readDoubleQuotedScalar(state, nodeIndent) {
|
14281 | var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
|
14282 | ch = state.input.charCodeAt(state.position);
|
14283 | if (ch !== 34) {
|
14284 | return false;
|
14285 | }
|
14286 | state.kind = "scalar";
|
14287 | state.result = "";
|
14288 | state.position++;
|
14289 | captureStart = captureEnd = state.position;
|
14290 | while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
14291 | if (ch === 34) {
|
14292 | captureSegment(state, captureStart, state.position, true);
|
14293 | state.position++;
|
14294 | return true;
|
14295 | } else if (ch === 92) {
|
14296 | captureSegment(state, captureStart, state.position, true);
|
14297 | ch = state.input.charCodeAt(++state.position);
|
14298 | if (is_EOL(ch)) {
|
14299 | skipSeparationSpace(state, false, nodeIndent);
|
14300 | } else if (ch < 256 && simpleEscapeCheck[ch]) {
|
14301 | state.result += simpleEscapeMap[ch];
|
14302 | state.position++;
|
14303 | } else if ((tmp = escapedHexLen(ch)) > 0) {
|
14304 | hexLength = tmp;
|
14305 | hexResult = 0;
|
14306 | for (; hexLength > 0; hexLength--) {
|
14307 | ch = state.input.charCodeAt(++state.position);
|
14308 | if ((tmp = fromHexCode(ch)) >= 0) {
|
14309 | hexResult = (hexResult << 4) + tmp;
|
14310 | } else {
|
14311 | throwError(state, "expected hexadecimal character");
|
14312 | }
|
14313 | }
|
14314 | state.result += charFromCodepoint(hexResult);
|
14315 | state.position++;
|
14316 | } else {
|
14317 | throwError(state, "unknown escape sequence");
|
14318 | }
|
14319 | captureStart = captureEnd = state.position;
|
14320 | } else if (is_EOL(ch)) {
|
14321 | captureSegment(state, captureStart, captureEnd, true);
|
14322 | writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
14323 | captureStart = captureEnd = state.position;
|
14324 | } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
14325 | throwError(state, "unexpected end of the document within a double quoted scalar");
|
14326 | } else {
|
14327 | state.position++;
|
14328 | captureEnd = state.position;
|
14329 | }
|
14330 | }
|
14331 | throwError(state, "unexpected end of the stream within a double quoted scalar");
|
14332 | }
|
14333 | function readFlowCollection(state, nodeIndent) {
|
14334 | var readNext = true, _line, _lineStart, _pos, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = Object.create(null), keyNode, keyTag, valueNode, ch;
|
14335 | ch = state.input.charCodeAt(state.position);
|
14336 | if (ch === 91) {
|
14337 | terminator = 93;
|
14338 | isMapping = false;
|
14339 | _result = [];
|
14340 | } else if (ch === 123) {
|
14341 | terminator = 125;
|
14342 | isMapping = true;
|
14343 | _result = {};
|
14344 | } else {
|
14345 | return false;
|
14346 | }
|
14347 | if (state.anchor !== null) {
|
14348 | state.anchorMap[state.anchor] = _result;
|
14349 | }
|
14350 | ch = state.input.charCodeAt(++state.position);
|
14351 | while (ch !== 0) {
|
14352 | skipSeparationSpace(state, true, nodeIndent);
|
14353 | ch = state.input.charCodeAt(state.position);
|
14354 | if (ch === terminator) {
|
14355 | state.position++;
|
14356 | state.tag = _tag;
|
14357 | state.anchor = _anchor;
|
14358 | state.kind = isMapping ? "mapping" : "sequence";
|
14359 | state.result = _result;
|
14360 | return true;
|
14361 | } else if (!readNext) {
|
14362 | throwError(state, "missed comma between flow collection entries");
|
14363 | } else if (ch === 44) {
|
14364 | throwError(state, "expected the node content, but found ','");
|
14365 | }
|
14366 | keyTag = keyNode = valueNode = null;
|
14367 | isPair = isExplicitPair = false;
|
14368 | if (ch === 63) {
|
14369 | following = state.input.charCodeAt(state.position + 1);
|
14370 | if (is_WS_OR_EOL(following)) {
|
14371 | isPair = isExplicitPair = true;
|
14372 | state.position++;
|
14373 | skipSeparationSpace(state, true, nodeIndent);
|
14374 | }
|
14375 | }
|
14376 | _line = state.line;
|
14377 | _lineStart = state.lineStart;
|
14378 | _pos = state.position;
|
14379 | composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
14380 | keyTag = state.tag;
|
14381 | keyNode = state.result;
|
14382 | skipSeparationSpace(state, true, nodeIndent);
|
14383 | ch = state.input.charCodeAt(state.position);
|
14384 | if ((isExplicitPair || state.line === _line) && ch === 58) {
|
14385 | isPair = true;
|
14386 | ch = state.input.charCodeAt(++state.position);
|
14387 | skipSeparationSpace(state, true, nodeIndent);
|
14388 | composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
14389 | valueNode = state.result;
|
14390 | }
|
14391 | if (isMapping) {
|
14392 | storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
|
14393 | } else if (isPair) {
|
14394 | _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
|
14395 | } else {
|
14396 | _result.push(keyNode);
|
14397 | }
|
14398 | skipSeparationSpace(state, true, nodeIndent);
|
14399 | ch = state.input.charCodeAt(state.position);
|
14400 | if (ch === 44) {
|
14401 | readNext = true;
|
14402 | ch = state.input.charCodeAt(++state.position);
|
14403 | } else {
|
14404 | readNext = false;
|
14405 | }
|
14406 | }
|
14407 | throwError(state, "unexpected end of the stream within a flow collection");
|
14408 | }
|
14409 | function readBlockScalar(state, nodeIndent) {
|
14410 | var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
|
14411 | ch = state.input.charCodeAt(state.position);
|
14412 | if (ch === 124) {
|
14413 | folding = false;
|
14414 | } else if (ch === 62) {
|
14415 | folding = true;
|
14416 | } else {
|
14417 | return false;
|
14418 | }
|
14419 | state.kind = "scalar";
|
14420 | state.result = "";
|
14421 | while (ch !== 0) {
|
14422 | ch = state.input.charCodeAt(++state.position);
|
14423 | if (ch === 43 || ch === 45) {
|
14424 | if (CHOMPING_CLIP === chomping) {
|
14425 | chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
|
14426 | } else {
|
14427 | throwError(state, "repeat of a chomping mode identifier");
|
14428 | }
|
14429 | } else if ((tmp = fromDecimalCode(ch)) >= 0) {
|
14430 | if (tmp === 0) {
|
14431 | throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
14432 | } else if (!detectedIndent) {
|
14433 | textIndent = nodeIndent + tmp - 1;
|
14434 | detectedIndent = true;
|
14435 | } else {
|
14436 | throwError(state, "repeat of an indentation width identifier");
|
14437 | }
|
14438 | } else {
|
14439 | break;
|
14440 | }
|
14441 | }
|
14442 | if (is_WHITE_SPACE(ch)) {
|
14443 | do {
|
14444 | ch = state.input.charCodeAt(++state.position);
|
14445 | } while (is_WHITE_SPACE(ch));
|
14446 | if (ch === 35) {
|
14447 | do {
|
14448 | ch = state.input.charCodeAt(++state.position);
|
14449 | } while (!is_EOL(ch) && ch !== 0);
|
14450 | }
|
14451 | }
|
14452 | while (ch !== 0) {
|
14453 | readLineBreak(state);
|
14454 | state.lineIndent = 0;
|
14455 | ch = state.input.charCodeAt(state.position);
|
14456 | while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
|
14457 | state.lineIndent++;
|
14458 | ch = state.input.charCodeAt(++state.position);
|
14459 | }
|
14460 | if (!detectedIndent && state.lineIndent > textIndent) {
|
14461 | textIndent = state.lineIndent;
|
14462 | }
|
14463 | if (is_EOL(ch)) {
|
14464 | emptyLines++;
|
14465 | continue;
|
14466 | }
|
14467 | if (state.lineIndent < textIndent) {
|
14468 | if (chomping === CHOMPING_KEEP) {
|
14469 | state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
14470 | } else if (chomping === CHOMPING_CLIP) {
|
14471 | if (didReadContent) {
|
14472 | state.result += "\n";
|
14473 | }
|
14474 | }
|
14475 | break;
|
14476 | }
|
14477 | if (folding) {
|
14478 | if (is_WHITE_SPACE(ch)) {
|
14479 | atMoreIndented = true;
|
14480 | state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
14481 | } else if (atMoreIndented) {
|
14482 | atMoreIndented = false;
|
14483 | state.result += common.repeat("\n", emptyLines + 1);
|
14484 | } else if (emptyLines === 0) {
|
14485 | if (didReadContent) {
|
14486 | state.result += " ";
|
14487 | }
|
14488 | } else {
|
14489 | state.result += common.repeat("\n", emptyLines);
|
14490 | }
|
14491 | } else {
|
14492 | state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
|
14493 | }
|
14494 | didReadContent = true;
|
14495 | detectedIndent = true;
|
14496 | emptyLines = 0;
|
14497 | captureStart = state.position;
|
14498 | while (!is_EOL(ch) && ch !== 0) {
|
14499 | ch = state.input.charCodeAt(++state.position);
|
14500 | }
|
14501 | captureSegment(state, captureStart, state.position, false);
|
14502 | }
|
14503 | return true;
|
14504 | }
|
14505 | function readBlockSequence(state, nodeIndent) {
|
14506 | var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch;
|
14507 | if (state.firstTabInLine !== -1) return false;
|
14508 | if (state.anchor !== null) {
|
14509 | state.anchorMap[state.anchor] = _result;
|
14510 | }
|
14511 | ch = state.input.charCodeAt(state.position);
|
14512 | while (ch !== 0) {
|
14513 | if (state.firstTabInLine !== -1) {
|
14514 | state.position = state.firstTabInLine;
|
14515 | throwError(state, "tab characters must not be used in indentation");
|
14516 | }
|
14517 | if (ch !== 45) {
|
14518 | break;
|
14519 | }
|
14520 | following = state.input.charCodeAt(state.position + 1);
|
14521 | if (!is_WS_OR_EOL(following)) {
|
14522 | break;
|
14523 | }
|
14524 | detected = true;
|
14525 | state.position++;
|
14526 | if (skipSeparationSpace(state, true, -1)) {
|
14527 | if (state.lineIndent <= nodeIndent) {
|
14528 | _result.push(null);
|
14529 | ch = state.input.charCodeAt(state.position);
|
14530 | continue;
|
14531 | }
|
14532 | }
|
14533 | _line = state.line;
|
14534 | composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
|
14535 | _result.push(state.result);
|
14536 | skipSeparationSpace(state, true, -1);
|
14537 | ch = state.input.charCodeAt(state.position);
|
14538 | if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
14539 | throwError(state, "bad indentation of a sequence entry");
|
14540 | } else if (state.lineIndent < nodeIndent) {
|
14541 | break;
|
14542 | }
|
14543 | }
|
14544 | if (detected) {
|
14545 | state.tag = _tag;
|
14546 | state.anchor = _anchor;
|
14547 | state.kind = "sequence";
|
14548 | state.result = _result;
|
14549 | return true;
|
14550 | }
|
14551 | return false;
|
14552 | }
|
14553 | function readBlockMapping(state, nodeIndent, flowIndent) {
|
14554 | var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag = state.tag, _anchor = state.anchor, _result = {}, overridableKeys = Object.create(null), keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
|
14555 | if (state.firstTabInLine !== -1) return false;
|
14556 | if (state.anchor !== null) {
|
14557 | state.anchorMap[state.anchor] = _result;
|
14558 | }
|
14559 | ch = state.input.charCodeAt(state.position);
|
14560 | while (ch !== 0) {
|
14561 | if (!atExplicitKey && state.firstTabInLine !== -1) {
|
14562 | state.position = state.firstTabInLine;
|
14563 | throwError(state, "tab characters must not be used in indentation");
|
14564 | }
|
14565 | following = state.input.charCodeAt(state.position + 1);
|
14566 | _line = state.line;
|
14567 | if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
|
14568 | if (ch === 63) {
|
14569 | if (atExplicitKey) {
|
14570 | storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
14571 | keyTag = keyNode = valueNode = null;
|
14572 | }
|
14573 | detected = true;
|
14574 | atExplicitKey = true;
|
14575 | allowCompact = true;
|
14576 | } else if (atExplicitKey) {
|
14577 | atExplicitKey = false;
|
14578 | allowCompact = true;
|
14579 | } else {
|
14580 | throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
|
14581 | }
|
14582 | state.position += 1;
|
14583 | ch = following;
|
14584 | } else {
|
14585 | _keyLine = state.line;
|
14586 | _keyLineStart = state.lineStart;
|
14587 | _keyPos = state.position;
|
14588 | if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
|
14589 | break;
|
14590 | }
|
14591 | if (state.line === _line) {
|
14592 | ch = state.input.charCodeAt(state.position);
|
14593 | while (is_WHITE_SPACE(ch)) {
|
14594 | ch = state.input.charCodeAt(++state.position);
|
14595 | }
|
14596 | if (ch === 58) {
|
14597 | ch = state.input.charCodeAt(++state.position);
|
14598 | if (!is_WS_OR_EOL(ch)) {
|
14599 | throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
|
14600 | }
|
14601 | if (atExplicitKey) {
|
14602 | storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
14603 | keyTag = keyNode = valueNode = null;
|
14604 | }
|
14605 | detected = true;
|
14606 | atExplicitKey = false;
|
14607 | allowCompact = false;
|
14608 | keyTag = state.tag;
|
14609 | keyNode = state.result;
|
14610 | } else if (detected) {
|
14611 | throwError(state, "can not read an implicit mapping pair; a colon is missed");
|
14612 | } else {
|
14613 | state.tag = _tag;
|
14614 | state.anchor = _anchor;
|
14615 | return true;
|
14616 | }
|
14617 | } else if (detected) {
|
14618 | throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
14619 | } else {
|
14620 | state.tag = _tag;
|
14621 | state.anchor = _anchor;
|
14622 | return true;
|
14623 | }
|
14624 | }
|
14625 | if (state.line === _line || state.lineIndent > nodeIndent) {
|
14626 | if (atExplicitKey) {
|
14627 | _keyLine = state.line;
|
14628 | _keyLineStart = state.lineStart;
|
14629 | _keyPos = state.position;
|
14630 | }
|
14631 | if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
|
14632 | if (atExplicitKey) {
|
14633 | keyNode = state.result;
|
14634 | } else {
|
14635 | valueNode = state.result;
|
14636 | }
|
14637 | }
|
14638 | if (!atExplicitKey) {
|
14639 | storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
|
14640 | keyTag = keyNode = valueNode = null;
|
14641 | }
|
14642 | skipSeparationSpace(state, true, -1);
|
14643 | ch = state.input.charCodeAt(state.position);
|
14644 | }
|
14645 | if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
14646 | throwError(state, "bad indentation of a mapping entry");
|
14647 | } else if (state.lineIndent < nodeIndent) {
|
14648 | break;
|
14649 | }
|
14650 | }
|
14651 | if (atExplicitKey) {
|
14652 | storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
14653 | }
|
14654 | if (detected) {
|
14655 | state.tag = _tag;
|
14656 | state.anchor = _anchor;
|
14657 | state.kind = "mapping";
|
14658 | state.result = _result;
|
14659 | }
|
14660 | return detected;
|
14661 | }
|
14662 | function readTagProperty(state) {
|
14663 | var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
|
14664 | ch = state.input.charCodeAt(state.position);
|
14665 | if (ch !== 33) return false;
|
14666 | if (state.tag !== null) {
|
14667 | throwError(state, "duplication of a tag property");
|
14668 | }
|
14669 | ch = state.input.charCodeAt(++state.position);
|
14670 | if (ch === 60) {
|
14671 | isVerbatim = true;
|
14672 | ch = state.input.charCodeAt(++state.position);
|
14673 | } else if (ch === 33) {
|
14674 | isNamed = true;
|
14675 | tagHandle = "!!";
|
14676 | ch = state.input.charCodeAt(++state.position);
|
14677 | } else {
|
14678 | tagHandle = "!";
|
14679 | }
|
14680 | _position = state.position;
|
14681 | if (isVerbatim) {
|
14682 | do {
|
14683 | ch = state.input.charCodeAt(++state.position);
|
14684 | } while (ch !== 0 && ch !== 62);
|
14685 | if (state.position < state.length) {
|
14686 | tagName = state.input.slice(_position, state.position);
|
14687 | ch = state.input.charCodeAt(++state.position);
|
14688 | } else {
|
14689 | throwError(state, "unexpected end of the stream within a verbatim tag");
|
14690 | }
|
14691 | } else {
|
14692 | while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
14693 | if (ch === 33) {
|
14694 | if (!isNamed) {
|
14695 | tagHandle = state.input.slice(_position - 1, state.position + 1);
|
14696 | if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
|
14697 | throwError(state, "named tag handle cannot contain such characters");
|
14698 | }
|
14699 | isNamed = true;
|
14700 | _position = state.position + 1;
|
14701 | } else {
|
14702 | throwError(state, "tag suffix cannot contain exclamation marks");
|
14703 | }
|
14704 | }
|
14705 | ch = state.input.charCodeAt(++state.position);
|
14706 | }
|
14707 | tagName = state.input.slice(_position, state.position);
|
14708 | if (PATTERN_FLOW_INDICATORS.test(tagName)) {
|
14709 | throwError(state, "tag suffix cannot contain flow indicator characters");
|
14710 | }
|
14711 | }
|
14712 | if (tagName && !PATTERN_TAG_URI.test(tagName)) {
|
14713 | throwError(state, "tag name cannot contain such characters: " + tagName);
|
14714 | }
|
14715 | try {
|
14716 | tagName = decodeURIComponent(tagName);
|
14717 | } catch (err) {
|
14718 | throwError(state, "tag name is malformed: " + tagName);
|
14719 | }
|
14720 | if (isVerbatim) {
|
14721 | state.tag = tagName;
|
14722 | } else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) {
|
14723 | state.tag = state.tagMap[tagHandle] + tagName;
|
14724 | } else if (tagHandle === "!") {
|
14725 | state.tag = "!" + tagName;
|
14726 | } else if (tagHandle === "!!") {
|
14727 | state.tag = "tag:yaml.org,2002:" + tagName;
|
14728 | } else {
|
14729 | throwError(state, 'undeclared tag handle "' + tagHandle + '"');
|
14730 | }
|
14731 | return true;
|
14732 | }
|
14733 | function readAnchorProperty(state) {
|
14734 | var _position, ch;
|
14735 | ch = state.input.charCodeAt(state.position);
|
14736 | if (ch !== 38) return false;
|
14737 | if (state.anchor !== null) {
|
14738 | throwError(state, "duplication of an anchor property");
|
14739 | }
|
14740 | ch = state.input.charCodeAt(++state.position);
|
14741 | _position = state.position;
|
14742 | while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
14743 | ch = state.input.charCodeAt(++state.position);
|
14744 | }
|
14745 | if (state.position === _position) {
|
14746 | throwError(state, "name of an anchor node must contain at least one character");
|
14747 | }
|
14748 | state.anchor = state.input.slice(_position, state.position);
|
14749 | return true;
|
14750 | }
|
14751 | function readAlias(state) {
|
14752 | var _position, alias, ch;
|
14753 | ch = state.input.charCodeAt(state.position);
|
14754 | if (ch !== 42) return false;
|
14755 | ch = state.input.charCodeAt(++state.position);
|
14756 | _position = state.position;
|
14757 | while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
14758 | ch = state.input.charCodeAt(++state.position);
|
14759 | }
|
14760 | if (state.position === _position) {
|
14761 | throwError(state, "name of an alias node must contain at least one character");
|
14762 | }
|
14763 | alias = state.input.slice(_position, state.position);
|
14764 | if (!_hasOwnProperty$1.call(state.anchorMap, alias)) {
|
14765 | throwError(state, 'unidentified alias "' + alias + '"');
|
14766 | }
|
14767 | state.result = state.anchorMap[alias];
|
14768 | skipSeparationSpace(state, true, -1);
|
14769 | return true;
|
14770 | }
|
14771 | function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
|
14772 | var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, typeList, type2, flowIndent, blockIndent;
|
14773 | if (state.listener !== null) {
|
14774 | state.listener("open", state);
|
14775 | }
|
14776 | state.tag = null;
|
14777 | state.anchor = null;
|
14778 | state.kind = null;
|
14779 | state.result = null;
|
14780 | allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
|
14781 | if (allowToSeek) {
|
14782 | if (skipSeparationSpace(state, true, -1)) {
|
14783 | atNewLine = true;
|
14784 | if (state.lineIndent > parentIndent) {
|
14785 | indentStatus = 1;
|
14786 | } else if (state.lineIndent === parentIndent) {
|
14787 | indentStatus = 0;
|
14788 | } else if (state.lineIndent < parentIndent) {
|
14789 | indentStatus = -1;
|
14790 | }
|
14791 | }
|
14792 | }
|
14793 | if (indentStatus === 1) {
|
14794 | while (readTagProperty(state) || readAnchorProperty(state)) {
|
14795 | if (skipSeparationSpace(state, true, -1)) {
|
14796 | atNewLine = true;
|
14797 | allowBlockCollections = allowBlockStyles;
|
14798 | if (state.lineIndent > parentIndent) {
|
14799 | indentStatus = 1;
|
14800 | } else if (state.lineIndent === parentIndent) {
|
14801 | indentStatus = 0;
|
14802 | } else if (state.lineIndent < parentIndent) {
|
14803 | indentStatus = -1;
|
14804 | }
|
14805 | } else {
|
14806 | allowBlockCollections = false;
|
14807 | }
|
14808 | }
|
14809 | }
|
14810 | if (allowBlockCollections) {
|
14811 | allowBlockCollections = atNewLine || allowCompact;
|
14812 | }
|
14813 | if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
|
14814 | if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
|
14815 | flowIndent = parentIndent;
|
14816 | } else {
|
14817 | flowIndent = parentIndent + 1;
|
14818 | }
|
14819 | blockIndent = state.position - state.lineStart;
|
14820 | if (indentStatus === 1) {
|
14821 | if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) {
|
14822 | hasContent = true;
|
14823 | } else {
|
14824 | if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) {
|
14825 | hasContent = true;
|
14826 | } else if (readAlias(state)) {
|
14827 | hasContent = true;
|
14828 | if (state.tag !== null || state.anchor !== null) {
|
14829 | throwError(state, "alias node should not have any properties");
|
14830 | }
|
14831 | } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
|
14832 | hasContent = true;
|
14833 | if (state.tag === null) {
|
14834 | state.tag = "?";
|
14835 | }
|
14836 | }
|
14837 | if (state.anchor !== null) {
|
14838 | state.anchorMap[state.anchor] = state.result;
|
14839 | }
|
14840 | }
|
14841 | } else if (indentStatus === 0) {
|
14842 | hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
|
14843 | }
|
14844 | }
|
14845 | if (state.tag === null) {
|
14846 | if (state.anchor !== null) {
|
14847 | state.anchorMap[state.anchor] = state.result;
|
14848 | }
|
14849 | } else if (state.tag === "?") {
|
14850 | if (state.result !== null && state.kind !== "scalar") {
|
14851 | throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
|
14852 | }
|
14853 | for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
|
14854 | type2 = state.implicitTypes[typeIndex];
|
14855 | if (type2.resolve(state.result)) {
|
14856 | state.result = type2.construct(state.result);
|
14857 | state.tag = type2.tag;
|
14858 | if (state.anchor !== null) {
|
14859 | state.anchorMap[state.anchor] = state.result;
|
14860 | }
|
14861 | break;
|
14862 | }
|
14863 | }
|
14864 | } else if (state.tag !== "!") {
|
14865 | if (_hasOwnProperty$1.call(state.typeMap[state.kind || "fallback"], state.tag)) {
|
14866 | type2 = state.typeMap[state.kind || "fallback"][state.tag];
|
14867 | } else {
|
14868 | type2 = null;
|
14869 | typeList = state.typeMap.multi[state.kind || "fallback"];
|
14870 | for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
|
14871 | if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
|
14872 | type2 = typeList[typeIndex];
|
14873 | break;
|
14874 | }
|
14875 | }
|
14876 | }
|
14877 | if (!type2) {
|
14878 | throwError(state, "unknown tag !<" + state.tag + ">");
|
14879 | }
|
14880 | if (state.result !== null && type2.kind !== state.kind) {
|
14881 | throwError(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type2.kind + '", not "' + state.kind + '"');
|
14882 | }
|
14883 | if (!type2.resolve(state.result, state.tag)) {
|
14884 | throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
|
14885 | } else {
|
14886 | state.result = type2.construct(state.result, state.tag);
|
14887 | if (state.anchor !== null) {
|
14888 | state.anchorMap[state.anchor] = state.result;
|
14889 | }
|
14890 | }
|
14891 | }
|
14892 | if (state.listener !== null) {
|
14893 | state.listener("close", state);
|
14894 | }
|
14895 | return state.tag !== null || state.anchor !== null || hasContent;
|
14896 | }
|
14897 | function readDocument(state) {
|
14898 | var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
|
14899 | state.version = null;
|
14900 | state.checkLineBreaks = state.legacy;
|
14901 | state.tagMap = Object.create(null);
|
14902 | state.anchorMap = Object.create(null);
|
14903 | while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
14904 | skipSeparationSpace(state, true, -1);
|
14905 | ch = state.input.charCodeAt(state.position);
|
14906 | if (state.lineIndent > 0 || ch !== 37) {
|
14907 | break;
|
14908 | }
|
14909 | hasDirectives = true;
|
14910 | ch = state.input.charCodeAt(++state.position);
|
14911 | _position = state.position;
|
14912 | while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
14913 | ch = state.input.charCodeAt(++state.position);
|
14914 | }
|
14915 | directiveName = state.input.slice(_position, state.position);
|
14916 | directiveArgs = [];
|
14917 | if (directiveName.length < 1) {
|
14918 | throwError(state, "directive name must not be less than one character in length");
|
14919 | }
|
14920 | while (ch !== 0) {
|
14921 | while (is_WHITE_SPACE(ch)) {
|
14922 | ch = state.input.charCodeAt(++state.position);
|
14923 | }
|
14924 | if (ch === 35) {
|
14925 | do {
|
14926 | ch = state.input.charCodeAt(++state.position);
|
14927 | } while (ch !== 0 && !is_EOL(ch));
|
14928 | break;
|
14929 | }
|
14930 | if (is_EOL(ch)) break;
|
14931 | _position = state.position;
|
14932 | while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
14933 | ch = state.input.charCodeAt(++state.position);
|
14934 | }
|
14935 | directiveArgs.push(state.input.slice(_position, state.position));
|
14936 | }
|
14937 | if (ch !== 0) readLineBreak(state);
|
14938 | if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) {
|
14939 | directiveHandlers[directiveName](state, directiveName, directiveArgs);
|
14940 | } else {
|
14941 | throwWarning(state, 'unknown document directive "' + directiveName + '"');
|
14942 | }
|
14943 | }
|
14944 | skipSeparationSpace(state, true, -1);
|
14945 | if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
|
14946 | state.position += 3;
|
14947 | skipSeparationSpace(state, true, -1);
|
14948 | } else if (hasDirectives) {
|
14949 | throwError(state, "directives end mark is expected");
|
14950 | }
|
14951 | composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
|
14952 | skipSeparationSpace(state, true, -1);
|
14953 | if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
|
14954 | throwWarning(state, "non-ASCII line breaks are interpreted as content");
|
14955 | }
|
14956 | state.documents.push(state.result);
|
14957 | if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
14958 | if (state.input.charCodeAt(state.position) === 46) {
|
14959 | state.position += 3;
|
14960 | skipSeparationSpace(state, true, -1);
|
14961 | }
|
14962 | return;
|
14963 | }
|
14964 | if (state.position < state.length - 1) {
|
14965 | throwError(state, "end of the stream or a document separator is expected");
|
14966 | } else {
|
14967 | return;
|
14968 | }
|
14969 | }
|
14970 | function loadDocuments(input, options8) {
|
14971 | input = String(input);
|
14972 | options8 = options8 || {};
|
14973 | if (input.length !== 0) {
|
14974 | if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
|
14975 | input += "\n";
|
14976 | }
|
14977 | if (input.charCodeAt(0) === 65279) {
|
14978 | input = input.slice(1);
|
14979 | }
|
14980 | }
|
14981 | var state = new State$1(input, options8);
|
14982 | var nullpos = input.indexOf("\0");
|
14983 | if (nullpos !== -1) {
|
14984 | state.position = nullpos;
|
14985 | throwError(state, "null byte is not allowed in input");
|
14986 | }
|
14987 | state.input += "\0";
|
14988 | while (state.input.charCodeAt(state.position) === 32) {
|
14989 | state.lineIndent += 1;
|
14990 | state.position += 1;
|
14991 | }
|
14992 | while (state.position < state.length - 1) {
|
14993 | readDocument(state);
|
14994 | }
|
14995 | return state.documents;
|
14996 | }
|
14997 | function loadAll$1(input, iterator, options8) {
|
14998 | if (iterator !== null && typeof iterator === "object" && typeof options8 === "undefined") {
|
14999 | options8 = iterator;
|
15000 | iterator = null;
|
15001 | }
|
15002 | var documents = loadDocuments(input, options8);
|
15003 | if (typeof iterator !== "function") {
|
15004 | return documents;
|
15005 | }
|
15006 | for (var index = 0, length = documents.length; index < length; index += 1) {
|
15007 | iterator(documents[index]);
|
15008 | }
|
15009 | }
|
15010 | function load$1(input, options8) {
|
15011 | var documents = loadDocuments(input, options8);
|
15012 | if (documents.length === 0) {
|
15013 | return void 0;
|
15014 | } else if (documents.length === 1) {
|
15015 | return documents[0];
|
15016 | }
|
15017 | throw new exception("expected a single document in the stream, but found more");
|
15018 | }
|
15019 | var loadAll_1 = loadAll$1;
|
15020 | var load_1 = load$1;
|
15021 | var loader = {
|
15022 | loadAll: loadAll_1,
|
15023 | load: load_1
|
15024 | };
|
15025 | var ESCAPE_SEQUENCES = {};
|
15026 | ESCAPE_SEQUENCES[0] = "\\0";
|
15027 | ESCAPE_SEQUENCES[7] = "\\a";
|
15028 | ESCAPE_SEQUENCES[8] = "\\b";
|
15029 | ESCAPE_SEQUENCES[9] = "\\t";
|
15030 | ESCAPE_SEQUENCES[10] = "\\n";
|
15031 | ESCAPE_SEQUENCES[11] = "\\v";
|
15032 | ESCAPE_SEQUENCES[12] = "\\f";
|
15033 | ESCAPE_SEQUENCES[13] = "\\r";
|
15034 | ESCAPE_SEQUENCES[27] = "\\e";
|
15035 | ESCAPE_SEQUENCES[34] = '\\"';
|
15036 | ESCAPE_SEQUENCES[92] = "\\\\";
|
15037 | ESCAPE_SEQUENCES[133] = "\\N";
|
15038 | ESCAPE_SEQUENCES[160] = "\\_";
|
15039 | ESCAPE_SEQUENCES[8232] = "\\L";
|
15040 | ESCAPE_SEQUENCES[8233] = "\\P";
|
15041 | function renamed(from, to) {
|
15042 | return function() {
|
15043 | throw new Error("Function yaml." + from + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
|
15044 | };
|
15045 | }
|
15046 | var load = loader.load;
|
15047 | var loadAll = loader.loadAll;
|
15048 | var safeLoad = renamed("safeLoad", "load");
|
15049 | var safeLoadAll = renamed("safeLoadAll", "loadAll");
|
15050 | var safeDump = renamed("safeDump", "dump");
|
15051 |
|
15052 |
|
15053 | var Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
|
15054 | var ID_Start = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/;
|
15055 | var ID_Continue = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/;
|
15056 | var unicode = {
|
15057 | Space_Separator,
|
15058 | ID_Start,
|
15059 | ID_Continue
|
15060 | };
|
15061 | var util = {
|
15062 | isSpaceSeparator(c2) {
|
15063 | return typeof c2 === "string" && unicode.Space_Separator.test(c2);
|
15064 | },
|
15065 | isIdStartChar(c2) {
|
15066 | return typeof c2 === "string" && (c2 >= "a" && c2 <= "z" || c2 >= "A" && c2 <= "Z" || c2 === "$" || c2 === "_" || unicode.ID_Start.test(c2));
|
15067 | },
|
15068 | isIdContinueChar(c2) {
|
15069 | return typeof c2 === "string" && (c2 >= "a" && c2 <= "z" || c2 >= "A" && c2 <= "Z" || c2 >= "0" && c2 <= "9" || c2 === "$" || c2 === "_" || c2 === "\u200C" || c2 === "\u200D" || unicode.ID_Continue.test(c2));
|
15070 | },
|
15071 | isDigit(c2) {
|
15072 | return typeof c2 === "string" && /[0-9]/.test(c2);
|
15073 | },
|
15074 | isHexDigit(c2) {
|
15075 | return typeof c2 === "string" && /[0-9A-Fa-f]/.test(c2);
|
15076 | }
|
15077 | };
|
15078 | var source;
|
15079 | var parseState;
|
15080 | var stack;
|
15081 | var pos;
|
15082 | var line;
|
15083 | var column;
|
15084 | var token;
|
15085 | var key;
|
15086 | var root;
|
15087 | var parse2 = function parse3(text, reviver) {
|
15088 | source = String(text);
|
15089 | parseState = "start";
|
15090 | stack = [];
|
15091 | pos = 0;
|
15092 | line = 1;
|
15093 | column = 0;
|
15094 | token = void 0;
|
15095 | key = void 0;
|
15096 | root = void 0;
|
15097 | do {
|
15098 | token = lex();
|
15099 | parseStates[parseState]();
|
15100 | } while (token.type !== "eof");
|
15101 | if (typeof reviver === "function") {
|
15102 | return internalize({ "": root }, "", reviver);
|
15103 | }
|
15104 | return root;
|
15105 | };
|
15106 | function internalize(holder, name, reviver) {
|
15107 | const value = holder[name];
|
15108 | if (value != null && typeof value === "object") {
|
15109 | if (Array.isArray(value)) {
|
15110 | for (let i = 0; i < value.length; i++) {
|
15111 | const key2 = String(i);
|
15112 | const replacement = internalize(value, key2, reviver);
|
15113 | if (replacement === void 0) {
|
15114 | delete value[key2];
|
15115 | } else {
|
15116 | Object.defineProperty(value, key2, {
|
15117 | value: replacement,
|
15118 | writable: true,
|
15119 | enumerable: true,
|
15120 | configurable: true
|
15121 | });
|
15122 | }
|
15123 | }
|
15124 | } else {
|
15125 | for (const key2 in value) {
|
15126 | const replacement = internalize(value, key2, reviver);
|
15127 | if (replacement === void 0) {
|
15128 | delete value[key2];
|
15129 | } else {
|
15130 | Object.defineProperty(value, key2, {
|
15131 | value: replacement,
|
15132 | writable: true,
|
15133 | enumerable: true,
|
15134 | configurable: true
|
15135 | });
|
15136 | }
|
15137 | }
|
15138 | }
|
15139 | }
|
15140 | return reviver.call(holder, name, value);
|
15141 | }
|
15142 | var lexState;
|
15143 | var buffer;
|
15144 | var doubleQuote;
|
15145 | var sign;
|
15146 | var c;
|
15147 | function lex() {
|
15148 | lexState = "default";
|
15149 | buffer = "";
|
15150 | doubleQuote = false;
|
15151 | sign = 1;
|
15152 | for (; ; ) {
|
15153 | c = peek();
|
15154 | const token2 = lexStates[lexState]();
|
15155 | if (token2) {
|
15156 | return token2;
|
15157 | }
|
15158 | }
|
15159 | }
|
15160 | function peek() {
|
15161 | if (source[pos]) {
|
15162 | return String.fromCodePoint(source.codePointAt(pos));
|
15163 | }
|
15164 | }
|
15165 | function read() {
|
15166 | const c2 = peek();
|
15167 | if (c2 === "\n") {
|
15168 | line++;
|
15169 | column = 0;
|
15170 | } else if (c2) {
|
15171 | column += c2.length;
|
15172 | } else {
|
15173 | column++;
|
15174 | }
|
15175 | if (c2) {
|
15176 | pos += c2.length;
|
15177 | }
|
15178 | return c2;
|
15179 | }
|
15180 | var lexStates = {
|
15181 | default() {
|
15182 | switch (c) {
|
15183 | case " ":
|
15184 | case "\v":
|
15185 | case "\f":
|
15186 | case " ":
|
15187 | case "\xA0":
|
15188 | case "\uFEFF":
|
15189 | case "\n":
|
15190 | case "\r":
|
15191 | case "\u2028":
|
15192 | case "\u2029":
|
15193 | read();
|
15194 | return;
|
15195 | case "/":
|
15196 | read();
|
15197 | lexState = "comment";
|
15198 | return;
|
15199 | case void 0:
|
15200 | read();
|
15201 | return newToken("eof");
|
15202 | }
|
15203 | if (util.isSpaceSeparator(c)) {
|
15204 | read();
|
15205 | return;
|
15206 | }
|
15207 | return lexStates[parseState]();
|
15208 | },
|
15209 | comment() {
|
15210 | switch (c) {
|
15211 | case "*":
|
15212 | read();
|
15213 | lexState = "multiLineComment";
|
15214 | return;
|
15215 | case "/":
|
15216 | read();
|
15217 | lexState = "singleLineComment";
|
15218 | return;
|
15219 | }
|
15220 | throw invalidChar(read());
|
15221 | },
|
15222 | multiLineComment() {
|
15223 | switch (c) {
|
15224 | case "*":
|
15225 | read();
|
15226 | lexState = "multiLineCommentAsterisk";
|
15227 | return;
|
15228 | case void 0:
|
15229 | throw invalidChar(read());
|
15230 | }
|
15231 | read();
|
15232 | },
|
15233 | multiLineCommentAsterisk() {
|
15234 | switch (c) {
|
15235 | case "*":
|
15236 | read();
|
15237 | return;
|
15238 | case "/":
|
15239 | read();
|
15240 | lexState = "default";
|
15241 | return;
|
15242 | case void 0:
|
15243 | throw invalidChar(read());
|
15244 | }
|
15245 | read();
|
15246 | lexState = "multiLineComment";
|
15247 | },
|
15248 | singleLineComment() {
|
15249 | switch (c) {
|
15250 | case "\n":
|
15251 | case "\r":
|
15252 | case "\u2028":
|
15253 | case "\u2029":
|
15254 | read();
|
15255 | lexState = "default";
|
15256 | return;
|
15257 | case void 0:
|
15258 | read();
|
15259 | return newToken("eof");
|
15260 | }
|
15261 | read();
|
15262 | },
|
15263 | value() {
|
15264 | switch (c) {
|
15265 | case "{":
|
15266 | case "[":
|
15267 | return newToken("punctuator", read());
|
15268 | case "n":
|
15269 | read();
|
15270 | literal("ull");
|
15271 | return newToken("null", null);
|
15272 | case "t":
|
15273 | read();
|
15274 | literal("rue");
|
15275 | return newToken("boolean", true);
|
15276 | case "f":
|
15277 | read();
|
15278 | literal("alse");
|
15279 | return newToken("boolean", false);
|
15280 | case "-":
|
15281 | case "+":
|
15282 | if (read() === "-") {
|
15283 | sign = -1;
|
15284 | }
|
15285 | lexState = "sign";
|
15286 | return;
|
15287 | case ".":
|
15288 | buffer = read();
|
15289 | lexState = "decimalPointLeading";
|
15290 | return;
|
15291 | case "0":
|
15292 | buffer = read();
|
15293 | lexState = "zero";
|
15294 | return;
|
15295 | case "1":
|
15296 | case "2":
|
15297 | case "3":
|
15298 | case "4":
|
15299 | case "5":
|
15300 | case "6":
|
15301 | case "7":
|
15302 | case "8":
|
15303 | case "9":
|
15304 | buffer = read();
|
15305 | lexState = "decimalInteger";
|
15306 | return;
|
15307 | case "I":
|
15308 | read();
|
15309 | literal("nfinity");
|
15310 | return newToken("numeric", Infinity);
|
15311 | case "N":
|
15312 | read();
|
15313 | literal("aN");
|
15314 | return newToken("numeric", NaN);
|
15315 | case '"':
|
15316 | case "'":
|
15317 | doubleQuote = read() === '"';
|
15318 | buffer = "";
|
15319 | lexState = "string";
|
15320 | return;
|
15321 | }
|
15322 | throw invalidChar(read());
|
15323 | },
|
15324 | identifierNameStartEscape() {
|
15325 | if (c !== "u") {
|
15326 | throw invalidChar(read());
|
15327 | }
|
15328 | read();
|
15329 | const u = unicodeEscape();
|
15330 | switch (u) {
|
15331 | case "$":
|
15332 | case "_":
|
15333 | break;
|
15334 | default:
|
15335 | if (!util.isIdStartChar(u)) {
|
15336 | throw invalidIdentifier();
|
15337 | }
|
15338 | break;
|
15339 | }
|
15340 | buffer += u;
|
15341 | lexState = "identifierName";
|
15342 | },
|
15343 | identifierName() {
|
15344 | switch (c) {
|
15345 | case "$":
|
15346 | case "_":
|
15347 | case "\u200C":
|
15348 | case "\u200D":
|
15349 | buffer += read();
|
15350 | return;
|
15351 | case "\\":
|
15352 | read();
|
15353 | lexState = "identifierNameEscape";
|
15354 | return;
|
15355 | }
|
15356 | if (util.isIdContinueChar(c)) {
|
15357 | buffer += read();
|
15358 | return;
|
15359 | }
|
15360 | return newToken("identifier", buffer);
|
15361 | },
|
15362 | identifierNameEscape() {
|
15363 | if (c !== "u") {
|
15364 | throw invalidChar(read());
|
15365 | }
|
15366 | read();
|
15367 | const u = unicodeEscape();
|
15368 | switch (u) {
|
15369 | case "$":
|
15370 | case "_":
|
15371 | case "\u200C":
|
15372 | case "\u200D":
|
15373 | break;
|
15374 | default:
|
15375 | if (!util.isIdContinueChar(u)) {
|
15376 | throw invalidIdentifier();
|
15377 | }
|
15378 | break;
|
15379 | }
|
15380 | buffer += u;
|
15381 | lexState = "identifierName";
|
15382 | },
|
15383 | sign() {
|
15384 | switch (c) {
|
15385 | case ".":
|
15386 | buffer = read();
|
15387 | lexState = "decimalPointLeading";
|
15388 | return;
|
15389 | case "0":
|
15390 | buffer = read();
|
15391 | lexState = "zero";
|
15392 | return;
|
15393 | case "1":
|
15394 | case "2":
|
15395 | case "3":
|
15396 | case "4":
|
15397 | case "5":
|
15398 | case "6":
|
15399 | case "7":
|
15400 | case "8":
|
15401 | case "9":
|
15402 | buffer = read();
|
15403 | lexState = "decimalInteger";
|
15404 | return;
|
15405 | case "I":
|
15406 | read();
|
15407 | literal("nfinity");
|
15408 | return newToken("numeric", sign * Infinity);
|
15409 | case "N":
|
15410 | read();
|
15411 | literal("aN");
|
15412 | return newToken("numeric", NaN);
|
15413 | }
|
15414 | throw invalidChar(read());
|
15415 | },
|
15416 | zero() {
|
15417 | switch (c) {
|
15418 | case ".":
|
15419 | buffer += read();
|
15420 | lexState = "decimalPoint";
|
15421 | return;
|
15422 | case "e":
|
15423 | case "E":
|
15424 | buffer += read();
|
15425 | lexState = "decimalExponent";
|
15426 | return;
|
15427 | case "x":
|
15428 | case "X":
|
15429 | buffer += read();
|
15430 | lexState = "hexadecimal";
|
15431 | return;
|
15432 | }
|
15433 | return newToken("numeric", sign * 0);
|
15434 | },
|
15435 | decimalInteger() {
|
15436 | switch (c) {
|
15437 | case ".":
|
15438 | buffer += read();
|
15439 | lexState = "decimalPoint";
|
15440 | return;
|
15441 | case "e":
|
15442 | case "E":
|
15443 | buffer += read();
|
15444 | lexState = "decimalExponent";
|
15445 | return;
|
15446 | }
|
15447 | if (util.isDigit(c)) {
|
15448 | buffer += read();
|
15449 | return;
|
15450 | }
|
15451 | return newToken("numeric", sign * Number(buffer));
|
15452 | },
|
15453 | decimalPointLeading() {
|
15454 | if (util.isDigit(c)) {
|
15455 | buffer += read();
|
15456 | lexState = "decimalFraction";
|
15457 | return;
|
15458 | }
|
15459 | throw invalidChar(read());
|
15460 | },
|
15461 | decimalPoint() {
|
15462 | switch (c) {
|
15463 | case "e":
|
15464 | case "E":
|
15465 | buffer += read();
|
15466 | lexState = "decimalExponent";
|
15467 | return;
|
15468 | }
|
15469 | if (util.isDigit(c)) {
|
15470 | buffer += read();
|
15471 | lexState = "decimalFraction";
|
15472 | return;
|
15473 | }
|
15474 | return newToken("numeric", sign * Number(buffer));
|
15475 | },
|
15476 | decimalFraction() {
|
15477 | switch (c) {
|
15478 | case "e":
|
15479 | case "E":
|
15480 | buffer += read();
|
15481 | lexState = "decimalExponent";
|
15482 | return;
|
15483 | }
|
15484 | if (util.isDigit(c)) {
|
15485 | buffer += read();
|
15486 | return;
|
15487 | }
|
15488 | return newToken("numeric", sign * Number(buffer));
|
15489 | },
|
15490 | decimalExponent() {
|
15491 | switch (c) {
|
15492 | case "+":
|
15493 | case "-":
|
15494 | buffer += read();
|
15495 | lexState = "decimalExponentSign";
|
15496 | return;
|
15497 | }
|
15498 | if (util.isDigit(c)) {
|
15499 | buffer += read();
|
15500 | lexState = "decimalExponentInteger";
|
15501 | return;
|
15502 | }
|
15503 | throw invalidChar(read());
|
15504 | },
|
15505 | decimalExponentSign() {
|
15506 | if (util.isDigit(c)) {
|
15507 | buffer += read();
|
15508 | lexState = "decimalExponentInteger";
|
15509 | return;
|
15510 | }
|
15511 | throw invalidChar(read());
|
15512 | },
|
15513 | decimalExponentInteger() {
|
15514 | if (util.isDigit(c)) {
|
15515 | buffer += read();
|
15516 | return;
|
15517 | }
|
15518 | return newToken("numeric", sign * Number(buffer));
|
15519 | },
|
15520 | hexadecimal() {
|
15521 | if (util.isHexDigit(c)) {
|
15522 | buffer += read();
|
15523 | lexState = "hexadecimalInteger";
|
15524 | return;
|
15525 | }
|
15526 | throw invalidChar(read());
|
15527 | },
|
15528 | hexadecimalInteger() {
|
15529 | if (util.isHexDigit(c)) {
|
15530 | buffer += read();
|
15531 | return;
|
15532 | }
|
15533 | return newToken("numeric", sign * Number(buffer));
|
15534 | },
|
15535 | string() {
|
15536 | switch (c) {
|
15537 | case "\\":
|
15538 | read();
|
15539 | buffer += escape();
|
15540 | return;
|
15541 | case '"':
|
15542 | if (doubleQuote) {
|
15543 | read();
|
15544 | return newToken("string", buffer);
|
15545 | }
|
15546 | buffer += read();
|
15547 | return;
|
15548 | case "'":
|
15549 | if (!doubleQuote) {
|
15550 | read();
|
15551 | return newToken("string", buffer);
|
15552 | }
|
15553 | buffer += read();
|
15554 | return;
|
15555 | case "\n":
|
15556 | case "\r":
|
15557 | throw invalidChar(read());
|
15558 | case "\u2028":
|
15559 | case "\u2029":
|
15560 | separatorChar(c);
|
15561 | break;
|
15562 | case void 0:
|
15563 | throw invalidChar(read());
|
15564 | }
|
15565 | buffer += read();
|
15566 | },
|
15567 | start() {
|
15568 | switch (c) {
|
15569 | case "{":
|
15570 | case "[":
|
15571 | return newToken("punctuator", read());
|
15572 | }
|
15573 | lexState = "value";
|
15574 | },
|
15575 | beforePropertyName() {
|
15576 | switch (c) {
|
15577 | case "$":
|
15578 | case "_":
|
15579 | buffer = read();
|
15580 | lexState = "identifierName";
|
15581 | return;
|
15582 | case "\\":
|
15583 | read();
|
15584 | lexState = "identifierNameStartEscape";
|
15585 | return;
|
15586 | case "}":
|
15587 | return newToken("punctuator", read());
|
15588 | case '"':
|
15589 | case "'":
|
15590 | doubleQuote = read() === '"';
|
15591 | lexState = "string";
|
15592 | return;
|
15593 | }
|
15594 | if (util.isIdStartChar(c)) {
|
15595 | buffer += read();
|
15596 | lexState = "identifierName";
|
15597 | return;
|
15598 | }
|
15599 | throw invalidChar(read());
|
15600 | },
|
15601 | afterPropertyName() {
|
15602 | if (c === ":") {
|
15603 | return newToken("punctuator", read());
|
15604 | }
|
15605 | throw invalidChar(read());
|
15606 | },
|
15607 | beforePropertyValue() {
|
15608 | lexState = "value";
|
15609 | },
|
15610 | afterPropertyValue() {
|
15611 | switch (c) {
|
15612 | case ",":
|
15613 | case "}":
|
15614 | return newToken("punctuator", read());
|
15615 | }
|
15616 | throw invalidChar(read());
|
15617 | },
|
15618 | beforeArrayValue() {
|
15619 | if (c === "]") {
|
15620 | return newToken("punctuator", read());
|
15621 | }
|
15622 | lexState = "value";
|
15623 | },
|
15624 | afterArrayValue() {
|
15625 | switch (c) {
|
15626 | case ",":
|
15627 | case "]":
|
15628 | return newToken("punctuator", read());
|
15629 | }
|
15630 | throw invalidChar(read());
|
15631 | },
|
15632 | end() {
|
15633 | throw invalidChar(read());
|
15634 | }
|
15635 | };
|
15636 | function newToken(type2, value) {
|
15637 | return {
|
15638 | type: type2,
|
15639 | value,
|
15640 | line,
|
15641 | column
|
15642 | };
|
15643 | }
|
15644 | function literal(s) {
|
15645 | for (const c2 of s) {
|
15646 | const p = peek();
|
15647 | if (p !== c2) {
|
15648 | throw invalidChar(read());
|
15649 | }
|
15650 | read();
|
15651 | }
|
15652 | }
|
15653 | function escape() {
|
15654 | const c2 = peek();
|
15655 | switch (c2) {
|
15656 | case "b":
|
15657 | read();
|
15658 | return "\b";
|
15659 | case "f":
|
15660 | read();
|
15661 | return "\f";
|
15662 | case "n":
|
15663 | read();
|
15664 | return "\n";
|
15665 | case "r":
|
15666 | read();
|
15667 | return "\r";
|
15668 | case "t":
|
15669 | read();
|
15670 | return " ";
|
15671 | case "v":
|
15672 | read();
|
15673 | return "\v";
|
15674 | case "0":
|
15675 | read();
|
15676 | if (util.isDigit(peek())) {
|
15677 | throw invalidChar(read());
|
15678 | }
|
15679 | return "\0";
|
15680 | case "x":
|
15681 | read();
|
15682 | return hexEscape();
|
15683 | case "u":
|
15684 | read();
|
15685 | return unicodeEscape();
|
15686 | case "\n":
|
15687 | case "\u2028":
|
15688 | case "\u2029":
|
15689 | read();
|
15690 | return "";
|
15691 | case "\r":
|
15692 | read();
|
15693 | if (peek() === "\n") {
|
15694 | read();
|
15695 | }
|
15696 | return "";
|
15697 | case "1":
|
15698 | case "2":
|
15699 | case "3":
|
15700 | case "4":
|
15701 | case "5":
|
15702 | case "6":
|
15703 | case "7":
|
15704 | case "8":
|
15705 | case "9":
|
15706 | throw invalidChar(read());
|
15707 | case void 0:
|
15708 | throw invalidChar(read());
|
15709 | }
|
15710 | return read();
|
15711 | }
|
15712 | function hexEscape() {
|
15713 | let buffer2 = "";
|
15714 | let c2 = peek();
|
15715 | if (!util.isHexDigit(c2)) {
|
15716 | throw invalidChar(read());
|
15717 | }
|
15718 | buffer2 += read();
|
15719 | c2 = peek();
|
15720 | if (!util.isHexDigit(c2)) {
|
15721 | throw invalidChar(read());
|
15722 | }
|
15723 | buffer2 += read();
|
15724 | return String.fromCodePoint(parseInt(buffer2, 16));
|
15725 | }
|
15726 | function unicodeEscape() {
|
15727 | let buffer2 = "";
|
15728 | let count = 4;
|
15729 | while (count-- > 0) {
|
15730 | const c2 = peek();
|
15731 | if (!util.isHexDigit(c2)) {
|
15732 | throw invalidChar(read());
|
15733 | }
|
15734 | buffer2 += read();
|
15735 | }
|
15736 | return String.fromCodePoint(parseInt(buffer2, 16));
|
15737 | }
|
15738 | var parseStates = {
|
15739 | start() {
|
15740 | if (token.type === "eof") {
|
15741 | throw invalidEOF();
|
15742 | }
|
15743 | push();
|
15744 | },
|
15745 | beforePropertyName() {
|
15746 | switch (token.type) {
|
15747 | case "identifier":
|
15748 | case "string":
|
15749 | key = token.value;
|
15750 | parseState = "afterPropertyName";
|
15751 | return;
|
15752 | case "punctuator":
|
15753 | pop();
|
15754 | return;
|
15755 | case "eof":
|
15756 | throw invalidEOF();
|
15757 | }
|
15758 | },
|
15759 | afterPropertyName() {
|
15760 | if (token.type === "eof") {
|
15761 | throw invalidEOF();
|
15762 | }
|
15763 | parseState = "beforePropertyValue";
|
15764 | },
|
15765 | beforePropertyValue() {
|
15766 | if (token.type === "eof") {
|
15767 | throw invalidEOF();
|
15768 | }
|
15769 | push();
|
15770 | },
|
15771 | beforeArrayValue() {
|
15772 | if (token.type === "eof") {
|
15773 | throw invalidEOF();
|
15774 | }
|
15775 | if (token.type === "punctuator" && token.value === "]") {
|
15776 | pop();
|
15777 | return;
|
15778 | }
|
15779 | push();
|
15780 | },
|
15781 | afterPropertyValue() {
|
15782 | if (token.type === "eof") {
|
15783 | throw invalidEOF();
|
15784 | }
|
15785 | switch (token.value) {
|
15786 | case ",":
|
15787 | parseState = "beforePropertyName";
|
15788 | return;
|
15789 | case "}":
|
15790 | pop();
|
15791 | }
|
15792 | },
|
15793 | afterArrayValue() {
|
15794 | if (token.type === "eof") {
|
15795 | throw invalidEOF();
|
15796 | }
|
15797 | switch (token.value) {
|
15798 | case ",":
|
15799 | parseState = "beforeArrayValue";
|
15800 | return;
|
15801 | case "]":
|
15802 | pop();
|
15803 | }
|
15804 | },
|
15805 | end() {
|
15806 | }
|
15807 | };
|
15808 | function push() {
|
15809 | let value;
|
15810 | switch (token.type) {
|
15811 | case "punctuator":
|
15812 | switch (token.value) {
|
15813 | case "{":
|
15814 | value = {};
|
15815 | break;
|
15816 | case "[":
|
15817 | value = [];
|
15818 | break;
|
15819 | }
|
15820 | break;
|
15821 | case "null":
|
15822 | case "boolean":
|
15823 | case "numeric":
|
15824 | case "string":
|
15825 | value = token.value;
|
15826 | break;
|
15827 | }
|
15828 | if (root === void 0) {
|
15829 | root = value;
|
15830 | } else {
|
15831 | const parent = stack[stack.length - 1];
|
15832 | if (Array.isArray(parent)) {
|
15833 | parent.push(value);
|
15834 | } else {
|
15835 | Object.defineProperty(parent, key, {
|
15836 | value,
|
15837 | writable: true,
|
15838 | enumerable: true,
|
15839 | configurable: true
|
15840 | });
|
15841 | }
|
15842 | }
|
15843 | if (value !== null && typeof value === "object") {
|
15844 | stack.push(value);
|
15845 | if (Array.isArray(value)) {
|
15846 | parseState = "beforeArrayValue";
|
15847 | } else {
|
15848 | parseState = "beforePropertyName";
|
15849 | }
|
15850 | } else {
|
15851 | const current = stack[stack.length - 1];
|
15852 | if (current == null) {
|
15853 | parseState = "end";
|
15854 | } else if (Array.isArray(current)) {
|
15855 | parseState = "afterArrayValue";
|
15856 | } else {
|
15857 | parseState = "afterPropertyValue";
|
15858 | }
|
15859 | }
|
15860 | }
|
15861 | function pop() {
|
15862 | stack.pop();
|
15863 | const current = stack[stack.length - 1];
|
15864 | if (current == null) {
|
15865 | parseState = "end";
|
15866 | } else if (Array.isArray(current)) {
|
15867 | parseState = "afterArrayValue";
|
15868 | } else {
|
15869 | parseState = "afterPropertyValue";
|
15870 | }
|
15871 | }
|
15872 | function invalidChar(c2) {
|
15873 | if (c2 === void 0) {
|
15874 | return syntaxError(`JSON5: invalid end of input at ${line}:${column}`);
|
15875 | }
|
15876 | return syntaxError(`JSON5: invalid character '${formatChar(c2)}' at ${line}:${column}`);
|
15877 | }
|
15878 | function invalidEOF() {
|
15879 | return syntaxError(`JSON5: invalid end of input at ${line}:${column}`);
|
15880 | }
|
15881 | function invalidIdentifier() {
|
15882 | column -= 5;
|
15883 | return syntaxError(`JSON5: invalid identifier character at ${line}:${column}`);
|
15884 | }
|
15885 | function separatorChar(c2) {
|
15886 | console.warn(`JSON5: '${formatChar(c2)}' in strings is not valid ECMAScript; consider escaping`);
|
15887 | }
|
15888 | function formatChar(c2) {
|
15889 | const replacements = {
|
15890 | "'": "\\'",
|
15891 | '"': '\\"',
|
15892 | "\\": "\\\\",
|
15893 | "\b": "\\b",
|
15894 | "\f": "\\f",
|
15895 | "\n": "\\n",
|
15896 | "\r": "\\r",
|
15897 | " ": "\\t",
|
15898 | "\v": "\\v",
|
15899 | "\0": "\\0",
|
15900 | "\u2028": "\\u2028",
|
15901 | "\u2029": "\\u2029"
|
15902 | };
|
15903 | if (replacements[c2]) {
|
15904 | return replacements[c2];
|
15905 | }
|
15906 | if (c2 < " ") {
|
15907 | const hexString = c2.charCodeAt(0).toString(16);
|
15908 | return "\\x" + ("00" + hexString).substring(hexString.length);
|
15909 | }
|
15910 | return c2;
|
15911 | }
|
15912 | function syntaxError(message) {
|
15913 | const err = new SyntaxError(message);
|
15914 | err.lineNumber = line;
|
15915 | err.columnNumber = column;
|
15916 | return err;
|
15917 | }
|
15918 | var dist_default = { parse: parse2 };
|
15919 |
|
15920 |
|
15921 | var import_code_frame = __toESM(require_lib3(), 1);
|
15922 |
|
15923 |
|
15924 | var safeLastIndexOf = (string, searchString, index) => index < 0 ? -1 : string.lastIndexOf(searchString, index);
|
15925 | function getPosition(text, textIndex) {
|
15926 | const lineBreakBefore = safeLastIndexOf(text, "\n", textIndex - 1);
|
15927 | const column2 = textIndex - lineBreakBefore - 1;
|
15928 | let line3 = 0;
|
15929 | for (let index = lineBreakBefore; index >= 0; index = safeLastIndexOf(text, "\n", index - 1)) {
|
15930 | line3++;
|
15931 | }
|
15932 | return { line: line3, column: column2 };
|
15933 | }
|
15934 | function indexToLineColumn(text, textIndex, { oneBased = false } = {}) {
|
15935 | if (textIndex < 0 || textIndex >= text.length && text.length > 0) {
|
15936 | throw new RangeError("Index out of bounds");
|
15937 | }
|
15938 | const position = getPosition(text, textIndex);
|
15939 | return oneBased ? { line: position.line + 1, column: position.column + 1 } : position;
|
15940 | }
|
15941 |
|
15942 |
|
15943 | var getCodePoint = (character) => `\\u{${character.codePointAt(0).toString(16)}}`;
|
15944 | var _message;
|
15945 | var _JSONError = class _JSONError extends Error {
|
15946 | constructor(message) {
|
15947 | var _a;
|
15948 | super();
|
15949 | __publicField(this, "name", "JSONError");
|
15950 | __publicField(this, "fileName");
|
15951 | __publicField(this, "codeFrame");
|
15952 | __publicField(this, "rawCodeFrame");
|
15953 | __privateAdd(this, _message);
|
15954 | __privateSet(this, _message, message);
|
15955 | (_a = Error.captureStackTrace) == null ? void 0 : _a.call(Error, this, _JSONError);
|
15956 | }
|
15957 | get message() {
|
15958 | const { fileName, codeFrame } = this;
|
15959 | return `${__privateGet(this, _message)}${fileName ? ` in ${fileName}` : ""}${codeFrame ? `
|
15960 |
|
15961 | ${codeFrame}
|
15962 | ` : ""}`;
|
15963 | }
|
15964 | set message(message) {
|
15965 | __privateSet(this, _message, message);
|
15966 | }
|
15967 | };
|
15968 | _message = new WeakMap();
|
15969 | var JSONError = _JSONError;
|
15970 | var generateCodeFrame = (string, location, highlightCode = true) => (0, import_code_frame.codeFrameColumns)(string, { start: location }, { highlightCode });
|
15971 | var getErrorLocation = (string, message) => {
|
15972 | const match = message.match(/in JSON at position (?<index>\d+)(?: \(line (?<line>\d+) column (?<column>\d+)\))?$/);
|
15973 | if (!match) {
|
15974 | return;
|
15975 | }
|
15976 | let { index, line: line3, column: column2 } = match.groups;
|
15977 | if (line3 && column2) {
|
15978 | return { line: Number(line3), column: Number(column2) };
|
15979 | }
|
15980 | index = Number(index);
|
15981 | if (index === string.length) {
|
15982 | const { line: line4, column: column3 } = indexToLineColumn(string, string.length - 1, { oneBased: true });
|
15983 | return { line: line4, column: column3 + 1 };
|
15984 | }
|
15985 | return indexToLineColumn(string, index, { oneBased: true });
|
15986 | };
|
15987 | var addCodePointToUnexpectedToken = (message) => message.replace(
|
15988 |
|
15989 | /(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,
|
15990 | (_, _quote, token2) => `"${token2}"(${getCodePoint(token2)})`
|
15991 | );
|
15992 | function parseJson(string, reviver, fileName) {
|
15993 | if (typeof reviver === "string") {
|
15994 | fileName = reviver;
|
15995 | reviver = void 0;
|
15996 | }
|
15997 | let message;
|
15998 | try {
|
15999 | return JSON.parse(string, reviver);
|
16000 | } catch (error) {
|
16001 | message = error.message;
|
16002 | }
|
16003 | let location;
|
16004 | if (string) {
|
16005 | location = getErrorLocation(string, message);
|
16006 | message = addCodePointToUnexpectedToken(message);
|
16007 | } else {
|
16008 | message += " while parsing empty string";
|
16009 | }
|
16010 | const jsonError = new JSONError(message);
|
16011 | jsonError.fileName = fileName;
|
16012 | if (location) {
|
16013 | jsonError.codeFrame = generateCodeFrame(string, location);
|
16014 | jsonError.rawCodeFrame = generateCodeFrame(
|
16015 | string,
|
16016 | location,
|
16017 | /* highlightCode */
|
16018 | false
|
16019 | );
|
16020 | }
|
16021 | throw jsonError;
|
16022 | }
|
16023 |
|
16024 | // src/utils/read-file.js
|
16025 | import fs4 from "fs/promises";
|
16026 | async function readFile(file) {
|
16027 | if (isUrlString(file)) {
|
16028 | file = new URL(file);
|
16029 | }
|
16030 | try {
|
16031 | return await fs4.readFile(file, "utf8");
|
16032 | } catch (error) {
|
16033 | if (error.code === "ENOENT") {
|
16034 | return;
|
16035 | }
|
16036 | throw new Error(`Unable to read '${file}': ${error.message}`);
|
16037 | }
|
16038 | }
|
16039 | var read_file_default = readFile;
|
16040 |
|
16041 | // src/config/prettier-config/loaders.js
|
16042 | async function readJson(file) {
|
16043 | const content = await read_file_default(file);
|
16044 | try {
|
16045 | return parseJson(content);
|
16046 | } catch (error) {
|
16047 | error.message = `JSON Error in ${file}:
|
16048 | ${error.message}`;
|
16049 | throw error;
|
16050 | }
|
16051 | }
|
16052 | async function loadJs(file) {
|
16053 | const module = await import(pathToFileURL2(file).href);
|
16054 | return module.default;
|
16055 | }
|
16056 | async function loadConfigFromPackageJson(file) {
|
16057 | const { prettier } = await readJson(file);
|
16058 | return prettier;
|
16059 | }
|
16060 | async function loadConfigFromPackageYaml(file) {
|
16061 | const { prettier } = await loadYaml(file);
|
16062 | return prettier;
|
16063 | }
|
16064 | async function loadYaml(file) {
|
16065 | const content = await read_file_default(file);
|
16066 | try {
|
16067 | return load(content);
|
16068 | } catch (error) {
|
16069 | error.message = `YAML Error in ${file}:
|
16070 | ${error.message}`;
|
16071 | throw error;
|
16072 | }
|
16073 | }
|
16074 | var loaders = {
|
16075 | async ".toml"(file) {
|
16076 | const content = await read_file_default(file);
|
16077 | try {
|
16078 | return await (0, import_parse_async.default)(content);
|
16079 | } catch (error) {
|
16080 | error.message = `TOML Error in ${file}:
|
16081 | ${error.message}`;
|
16082 | throw error;
|
16083 | }
|
16084 | },
|
16085 | async ".json5"(file) {
|
16086 | const content = await read_file_default(file);
|
16087 | try {
|
16088 | return dist_default.parse(content);
|
16089 | } catch (error) {
|
16090 | error.message = `JSON5 Error in ${file}:
|
16091 | ${error.message}`;
|
16092 | throw error;
|
16093 | }
|
16094 | },
|
16095 | ".json": readJson,
|
16096 | ".js": loadJs,
|
16097 | ".mjs": loadJs,
|
16098 | ".cjs": loadJs,
|
16099 | ".yaml": loadYaml,
|
16100 | ".yml": loadYaml,
|
16101 | // No extension
|
16102 | "": loadYaml
|
16103 | };
|
16104 | var loaders_default = loaders;
|
16105 |
|
16106 | // src/config/prettier-config/config-searcher.js
|
16107 | var CONFIG_FILE_NAMES = [
|
16108 | "package.json",
|
16109 | "package.yaml",
|
16110 | ".prettierrc",
|
16111 | ".prettierrc.json",
|
16112 | ".prettierrc.yaml",
|
16113 | ".prettierrc.yml",
|
16114 | ".prettierrc.json5",
|
16115 | ".prettierrc.js",
|
16116 | ".prettierrc.mjs",
|
16117 | ".prettierrc.cjs",
|
16118 | "prettier.config.js",
|
16119 | "prettier.config.mjs",
|
16120 | "prettier.config.cjs",
|
16121 | ".prettierrc.toml"
|
16122 | ];
|
16123 | async function filter({ name, path: file }) {
|
16124 | if (!await is_file_default(file)) {
|
16125 | return false;
|
16126 | }
|
16127 | if (name === "package.json") {
|
16128 | try {
|
16129 | return Boolean(await loadConfigFromPackageJson(file));
|
16130 | } catch {
|
16131 | return false;
|
16132 | }
|
16133 | }
|
16134 | if (name === "package.yaml") {
|
16135 | try {
|
16136 | return Boolean(await loadConfigFromPackageYaml(file));
|
16137 | } catch {
|
16138 | return false;
|
16139 | }
|
16140 | }
|
16141 | return true;
|
16142 | }
|
16143 | function getSearcher(stopDirectory) {
|
16144 | return new searcher_default({ names: CONFIG_FILE_NAMES, filter, stopDirectory });
|
16145 | }
|
16146 | var config_searcher_default = getSearcher;
|
16147 |
|
16148 | // src/config/prettier-config/load-config.js
|
16149 | import path7 from "path";
|
16150 |
|
16151 | // src/utils/import-from-file.js
|
16152 | import { pathToFileURL as pathToFileURL4 } from "url";
|
16153 |
|
16154 | // node_modules/import-meta-resolve/lib/resolve.js
|
16155 | import assert3 from "assert";
|
16156 | import { statSync, realpathSync } from "fs";
|
16157 | import process3 from "process";
|
16158 | import { URL as URL2, fileURLToPath as fileURLToPath4, pathToFileURL as pathToFileURL3 } from "url";
|
16159 | import path6 from "path";
|
16160 | import { builtinModules } from "module";
|
16161 |
|
16162 | // node_modules/import-meta-resolve/lib/get-format.js
|
16163 | import { fileURLToPath as fileURLToPath3 } from "url";
|
16164 |
|
16165 | // node_modules/import-meta-resolve/lib/package-json-reader.js
|
16166 | import fs5 from "fs";
|
16167 | import path5 from "path";
|
16168 | import { fileURLToPath as fileURLToPath2 } from "url";
|
16169 |
|
16170 | // node_modules/import-meta-resolve/lib/errors.js
|
16171 | import v8 from "v8";
|
16172 | import assert2 from "assert";
|
16173 | import { format, inspect } from "util";
|
16174 | var own = {}.hasOwnProperty;
|
16175 | var classRegExp = /^([A-Z][a-z\d]*)+$/;
|
16176 | var kTypes = /* @__PURE__ */ new Set([
|
16177 | "string",
|
16178 | "function",
|
16179 | "number",
|
16180 | "object",
|
16181 | // Accept 'Function' and 'Object' as alternative to the lower cased version.
|
16182 | "Function",
|
16183 | "Object",
|
16184 | "boolean",
|
16185 | "bigint",
|
16186 | "symbol"
|
16187 | ]);
|
16188 | var codes = {};
|
16189 | function formatList(array2, type2 = "and") {
|
16190 | return array2.length < 3 ? array2.join(` ${type2} `) : `${array2.slice(0, -1).join(", ")}, ${type2} ${array2[array2.length - 1]}`;
|
16191 | }
|
16192 | var messages = /* @__PURE__ */ new Map();
|
16193 | var nodeInternalPrefix = "__node_internal_";
|
16194 | var userStackTraceLimit;
|
16195 | codes.ERR_INVALID_ARG_TYPE = createError(
|
16196 | "ERR_INVALID_ARG_TYPE",
|
16197 | /**
|
16198 | * @param {string} name
|
16199 | * @param {Array<string> | string} expected
|
16200 | * @param {unknown} actual
|
16201 | */
|
16202 | (name, expected, actual) => {
|
16203 | assert2(typeof name === "string", "'name' must be a string");
|
16204 | if (!Array.isArray(expected)) {
|
16205 | expected = [expected];
|
16206 | }
|
16207 | let message = "The ";
|
16208 | if (name.endsWith(" argument")) {
|
16209 | message += `${name} `;
|
16210 | } else {
|
16211 | const type2 = name.includes(".") ? "property" : "argument";
|
16212 | message += `"${name}" ${type2} `;
|
16213 | }
|
16214 | message += "must be ";
|
16215 | const types = [];
|
16216 | const instances = [];
|
16217 | const other = [];
|
16218 | for (const value of expected) {
|
16219 | assert2(
|
16220 | typeof value === "string",
|
16221 | "All expected entries have to be of type string"
|
16222 | );
|
16223 | if (kTypes.has(value)) {
|
16224 | types.push(value.toLowerCase());
|
16225 | } else if (classRegExp.exec(value) === null) {
|
16226 | assert2(
|
16227 | value !== "object",
|
16228 | 'The value "object" should be written as "Object"'
|
16229 | );
|
16230 | other.push(value);
|
16231 | } else {
|
16232 | instances.push(value);
|
16233 | }
|
16234 | }
|
16235 | if (instances.length > 0) {
|
16236 | const pos2 = types.indexOf("object");
|
16237 | if (pos2 !== -1) {
|
16238 | types.slice(pos2, 1);
|
16239 | instances.push("Object");
|
16240 | }
|
16241 | }
|
16242 | if (types.length > 0) {
|
16243 | message += `${types.length > 1 ? "one of type" : "of type"} ${formatList(
|
16244 | types,
|
16245 | "or"
|
16246 | )}`;
|
16247 | if (instances.length > 0 || other.length > 0) message += " or ";
|
16248 | }
|
16249 | if (instances.length > 0) {
|
16250 | message += `an instance of ${formatList(instances, "or")}`;
|
16251 | if (other.length > 0) message += " or ";
|
16252 | }
|
16253 | if (other.length > 0) {
|
16254 | if (other.length > 1) {
|
16255 | message += `one of ${formatList(other, "or")}`;
|
16256 | } else {
|
16257 | if (other[0].toLowerCase() !== other[0]) message += "an ";
|
16258 | message += `${other[0]}`;
|
16259 | }
|
16260 | }
|
16261 | message += `. Received ${determineSpecificType(actual)}`;
|
16262 | return message;
|
16263 | },
|
16264 | TypeError
|
16265 | );
|
16266 | codes.ERR_INVALID_MODULE_SPECIFIER = createError(
|
16267 | "ERR_INVALID_MODULE_SPECIFIER",
|
16268 | /**
|
16269 | * @param {string} request
|
16270 | * @param {string} reason
|
16271 | * @param {string} [base]
|
16272 | */
|
16273 | (request, reason, base = void 0) => {
|
16274 | return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`;
|
16275 | },
|
16276 | TypeError
|
16277 | );
|
16278 | codes.ERR_INVALID_PACKAGE_CONFIG = createError(
|
16279 | "ERR_INVALID_PACKAGE_CONFIG",
|
16280 | /**
|
16281 | * @param {string} path
|
16282 | * @param {string} [base]
|
16283 | * @param {string} [message]
|
16284 | */
|
16285 | (path13, base, message) => {
|
16286 | return `Invalid package config ${path13}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`;
|
16287 | },
|
16288 | Error
|
16289 | );
|
16290 | codes.ERR_INVALID_PACKAGE_TARGET = createError(
|
16291 | "ERR_INVALID_PACKAGE_TARGET",
|
16292 | /**
|
16293 | * @param {string} packagePath
|
16294 | * @param {string} key
|
16295 | * @param {unknown} target
|
16296 | * @param {boolean} [isImport=false]
|
16297 | * @param {string} [base]
|
16298 | */
|
16299 | (packagePath, key2, target, isImport = false, base = void 0) => {
|
16300 | const relatedError = typeof target === "string" && !isImport && target.length > 0 && !target.startsWith("./");
|
16301 | if (key2 === ".") {
|
16302 | assert2(isImport === false);
|
16303 | return `Invalid "exports" main target ${JSON.stringify(target)} defined in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? '; targets must start with "./"' : ""}`;
|
16304 | }
|
16305 | return `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify(
|
16306 | target
|
16307 | )} defined for '${key2}' in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? '; targets must start with "./"' : ""}`;
|
16308 | },
|
16309 | Error
|
16310 | );
|
16311 | codes.ERR_MODULE_NOT_FOUND = createError(
|
16312 | "ERR_MODULE_NOT_FOUND",
|
16313 | /**
|
16314 | * @param {string} path
|
16315 | * @param {string} base
|
16316 | * @param {boolean} [exactUrl]
|
16317 | */
|
16318 | (path13, base, exactUrl = false) => {
|
16319 | return `Cannot find ${exactUrl ? "module" : "package"} '${path13}' imported from ${base}`;
|
16320 | },
|
16321 | Error
|
16322 | );
|
16323 | codes.ERR_NETWORK_IMPORT_DISALLOWED = createError(
|
16324 | "ERR_NETWORK_IMPORT_DISALLOWED",
|
16325 | "import of '%s' by %s is not supported: %s",
|
16326 | Error
|
16327 | );
|
16328 | codes.ERR_PACKAGE_IMPORT_NOT_DEFINED = createError(
|
16329 | "ERR_PACKAGE_IMPORT_NOT_DEFINED",
|
16330 | /**
|
16331 | * @param {string} specifier
|
16332 | * @param {string} packagePath
|
16333 | * @param {string} base
|
16334 | */
|
16335 | (specifier, packagePath, base) => {
|
16336 | return `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath}package.json` : ""} imported from ${base}`;
|
16337 | },
|
16338 | TypeError
|
16339 | );
|
16340 | codes.ERR_PACKAGE_PATH_NOT_EXPORTED = createError(
|
16341 | "ERR_PACKAGE_PATH_NOT_EXPORTED",
|
16342 | /**
|
16343 | * @param {string} packagePath
|
16344 | * @param {string} subpath
|
16345 | * @param {string} [base]
|
16346 | */
|
16347 | (packagePath, subpath, base = void 0) => {
|
16348 | if (subpath === ".")
|
16349 | return `No "exports" main defined in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
|
16350 | return `Package subpath '${subpath}' is not defined by "exports" in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`;
|
16351 | },
|
16352 | Error
|
16353 | );
|
16354 | codes.ERR_UNSUPPORTED_DIR_IMPORT = createError(
|
16355 | "ERR_UNSUPPORTED_DIR_IMPORT",
|
16356 | "Directory import '%s' is not supported resolving ES modules imported from %s",
|
16357 | Error
|
16358 | );
|
16359 | codes.ERR_UNSUPPORTED_RESOLVE_REQUEST = createError(
|
16360 | "ERR_UNSUPPORTED_RESOLVE_REQUEST",
|
16361 | 'Failed to resolve module specifier "%s" from "%s": Invalid relative URL or base scheme is not hierarchical.',
|
16362 | TypeError
|
16363 | );
|
16364 | codes.ERR_UNKNOWN_FILE_EXTENSION = createError(
|
16365 | "ERR_UNKNOWN_FILE_EXTENSION",
|
16366 | /**
|
16367 | * @param {string} extension
|
16368 | * @param {string} path
|
16369 | */
|
16370 | (extension, path13) => {
|
16371 | return `Unknown file extension "${extension}" for ${path13}`;
|
16372 | },
|
16373 | TypeError
|
16374 | );
|
16375 | codes.ERR_INVALID_ARG_VALUE = createError(
|
16376 | "ERR_INVALID_ARG_VALUE",
|
16377 | /**
|
16378 | * @param {string} name
|
16379 | * @param {unknown} value
|
16380 | * @param {string} [reason='is invalid']
|
16381 | */
|
16382 | (name, value, reason = "is invalid") => {
|
16383 | let inspected = inspect(value);
|
16384 | if (inspected.length > 128) {
|
16385 | inspected = `${inspected.slice(0, 128)}...`;
|
16386 | }
|
16387 | const type2 = name.includes(".") ? "property" : "argument";
|
16388 | return `The ${type2} '${name}' ${reason}. Received ${inspected}`;
|
16389 | },
|
16390 | TypeError
|
16391 | // Note: extra classes have been shaken out.
|
16392 | // , RangeError
|
16393 | );
|
16394 | function createError(sym, value, constructor) {
|
16395 | messages.set(sym, value);
|
16396 | return makeNodeErrorWithCode(constructor, sym);
|
16397 | }
|
16398 | function makeNodeErrorWithCode(Base, key2) {
|
16399 | return NodeError;
|
16400 | function NodeError(...parameters) {
|
16401 | const limit = Error.stackTraceLimit;
|
16402 | if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0;
|
16403 | const error = new Base();
|
16404 | if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = limit;
|
16405 | const message = getMessage(key2, parameters, error);
|
16406 | Object.defineProperties(error, {
|
16407 | // Note: no need to implement `kIsNodeError` symbol, would be hard,
|
16408 | // probably.
|
16409 | message: {
|
16410 | value: message,
|
16411 | enumerable: false,
|
16412 | writable: true,
|
16413 | configurable: true
|
16414 | },
|
16415 | toString: {
|
16416 | /** @this {Error} */
|
16417 | value() {
|
16418 | return `${this.name} [${key2}]: ${this.message}`;
|
16419 | },
|
16420 | enumerable: false,
|
16421 | writable: true,
|
16422 | configurable: true
|
16423 | }
|
16424 | });
|
16425 | captureLargerStackTrace(error);
|
16426 | error.code = key2;
|
16427 | return error;
|
16428 | }
|
16429 | }
|
16430 | function isErrorStackTraceLimitWritable() {
|
16431 | try {
|
16432 | if (v8.startupSnapshot.isBuildingSnapshot()) {
|
16433 | return false;
|
16434 | }
|
16435 | } catch {
|
16436 | }
|
16437 | const desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
|
16438 | if (desc === void 0) {
|
16439 | return Object.isExtensible(Error);
|
16440 | }
|
16441 | return own.call(desc, "writable") && desc.writable !== void 0 ? desc.writable : desc.set !== void 0;
|
16442 | }
|
16443 | function hideStackFrames(wrappedFunction) {
|
16444 | const hidden = nodeInternalPrefix + wrappedFunction.name;
|
16445 | Object.defineProperty(wrappedFunction, "name", { value: hidden });
|
16446 | return wrappedFunction;
|
16447 | }
|
16448 | var captureLargerStackTrace = hideStackFrames(
|
16449 | /**
|
16450 | * @param {Error} error
|
16451 | * @returns {Error}
|
16452 | */
|
16453 | // @ts-expect-error: fine
|
16454 | function(error) {
|
16455 | const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
|
16456 | if (stackTraceLimitIsWritable) {
|
16457 | userStackTraceLimit = Error.stackTraceLimit;
|
16458 | Error.stackTraceLimit = Number.POSITIVE_INFINITY;
|
16459 | }
|
16460 | Error.captureStackTrace(error);
|
16461 | if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit;
|
16462 | return error;
|
16463 | }
|
16464 | );
|
16465 | function getMessage(key2, parameters, self) {
|
16466 | const message = messages.get(key2);
|
16467 | assert2(message !== void 0, "expected `message` to be found");
|
16468 | if (typeof message === "function") {
|
16469 | assert2(
|
16470 | message.length <= parameters.length,
|
16471 | // Default options do not count.
|
16472 | `Code: ${key2}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`
|
16473 | );
|
16474 | return Reflect.apply(message, self, parameters);
|
16475 | }
|
16476 | const regex = /%[dfijoOs]/g;
|
16477 | let expectedLength = 0;
|
16478 | while (regex.exec(message) !== null) expectedLength++;
|
16479 | assert2(
|
16480 | expectedLength === parameters.length,
|
16481 | `Code: ${key2}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`
|
16482 | );
|
16483 | if (parameters.length === 0) return message;
|
16484 | parameters.unshift(message);
|
16485 | return Reflect.apply(format, null, parameters);
|
16486 | }
|
16487 | function determineSpecificType(value) {
|
16488 | if (value === null || value === void 0) {
|
16489 | return String(value);
|
16490 | }
|
16491 | if (typeof value === "function" && value.name) {
|
16492 | return `function ${value.name}`;
|
16493 | }
|
16494 | if (typeof value === "object") {
|
16495 | if (value.constructor && value.constructor.name) {
|
16496 | return `an instance of ${value.constructor.name}`;
|
16497 | }
|
16498 | return `${inspect(value, { depth: -1 })}`;
|
16499 | }
|
16500 | let inspected = inspect(value, { colors: false });
|
16501 | if (inspected.length > 28) {
|
16502 | inspected = `${inspected.slice(0, 25)}...`;
|
16503 | }
|
16504 | return `type ${typeof value} (${inspected})`;
|
16505 | }
|
16506 |
|
16507 | // node_modules/import-meta-resolve/lib/package-json-reader.js
|
16508 | var hasOwnProperty = {}.hasOwnProperty;
|
16509 | var { ERR_INVALID_PACKAGE_CONFIG } = codes;
|
16510 | var cache = /* @__PURE__ */ new Map();
|
16511 | function read2(jsonPath, { base, specifier }) {
|
16512 | const existing = cache.get(jsonPath);
|
16513 | if (existing) {
|
16514 | return existing;
|
16515 | }
|
16516 | let string;
|
16517 | try {
|
16518 | string = fs5.readFileSync(path5.toNamespacedPath(jsonPath), "utf8");
|
16519 | } catch (error) {
|
16520 | const exception2 = (
|
16521 | /** @type {ErrnoException} */
|
16522 | error
|
16523 | );
|
16524 | if (exception2.code !== "ENOENT") {
|
16525 | throw exception2;
|
16526 | }
|
16527 | }
|
16528 | const result = {
|
16529 | exists: false,
|
16530 | pjsonPath: jsonPath,
|
16531 | main: void 0,
|
16532 | name: void 0,
|
16533 | type: "none",
|
16534 | // Ignore unknown types for forwards compatibility
|
16535 | exports: void 0,
|
16536 | imports: void 0
|
16537 | };
|
16538 | if (string !== void 0) {
|
16539 | let parsed;
|
16540 | try {
|
16541 | parsed = JSON.parse(string);
|
16542 | } catch (error_) {
|
16543 | const cause = (
|
16544 | /** @type {ErrnoException} */
|
16545 | error_
|
16546 | );
|
16547 | const error = new ERR_INVALID_PACKAGE_CONFIG(
|
16548 | jsonPath,
|
16549 | (base ? `"${specifier}" from ` : "") + fileURLToPath2(base || specifier),
|
16550 | cause.message
|
16551 | );
|
16552 | error.cause = cause;
|
16553 | throw error;
|
16554 | }
|
16555 | result.exists = true;
|
16556 | if (hasOwnProperty.call(parsed, "name") && typeof parsed.name === "string") {
|
16557 | result.name = parsed.name;
|
16558 | }
|
16559 | if (hasOwnProperty.call(parsed, "main") && typeof parsed.main === "string") {
|
16560 | result.main = parsed.main;
|
16561 | }
|
16562 | if (hasOwnProperty.call(parsed, "exports")) {
|
16563 | result.exports = parsed.exports;
|
16564 | }
|
16565 | if (hasOwnProperty.call(parsed, "imports")) {
|
16566 | result.imports = parsed.imports;
|
16567 | }
|
16568 | if (hasOwnProperty.call(parsed, "type") && (parsed.type === "commonjs" || parsed.type === "module")) {
|
16569 | result.type = parsed.type;
|
16570 | }
|
16571 | }
|
16572 | cache.set(jsonPath, result);
|
16573 | return result;
|
16574 | }
|
16575 | function getPackageScopeConfig(resolved) {
|
16576 | let packageJSONUrl = new URL("package.json", resolved);
|
16577 | while (true) {
|
16578 | const packageJSONPath2 = packageJSONUrl.pathname;
|
16579 | if (packageJSONPath2.endsWith("node_modules/package.json")) {
|
16580 | break;
|
16581 | }
|
16582 | const packageConfig = read2(fileURLToPath2(packageJSONUrl), {
|
16583 | specifier: resolved
|
16584 | });
|
16585 | if (packageConfig.exists) {
|
16586 | return packageConfig;
|
16587 | }
|
16588 | const lastPackageJSONUrl = packageJSONUrl;
|
16589 | packageJSONUrl = new URL("../package.json", packageJSONUrl);
|
16590 | if (packageJSONUrl.pathname === lastPackageJSONUrl.pathname) {
|
16591 | break;
|
16592 | }
|
16593 | }
|
16594 | const packageJSONPath = fileURLToPath2(packageJSONUrl);
|
16595 | return {
|
16596 | pjsonPath: packageJSONPath,
|
16597 | exists: false,
|
16598 | type: "none"
|
16599 | };
|
16600 | }
|
16601 | function getPackageType(url2) {
|
16602 | return getPackageScopeConfig(url2).type;
|
16603 | }
|
16604 |
|
16605 | // node_modules/import-meta-resolve/lib/get-format.js
|
16606 | var { ERR_UNKNOWN_FILE_EXTENSION } = codes;
|
16607 | var hasOwnProperty2 = {}.hasOwnProperty;
|
16608 | var extensionFormatMap = {
|
16609 | // @ts-expect-error: hush.
|
16610 | __proto__: null,
|
16611 | ".cjs": "commonjs",
|
16612 | ".js": "module",
|
16613 | ".json": "json",
|
16614 | ".mjs": "module"
|
16615 | };
|
16616 | function mimeToFormat(mime) {
|
16617 | if (mime && /\s*(text|application)\/javascript\s*(;\s*charset=utf-?8\s*)?/i.test(mime))
|
16618 | return "module";
|
16619 | if (mime === "application/json") return "json";
|
16620 | return null;
|
16621 | }
|
16622 | var protocolHandlers = {
|
16623 | // @ts-expect-error: hush.
|
16624 | __proto__: null,
|
16625 | "data:": getDataProtocolModuleFormat,
|
16626 | "file:": getFileProtocolModuleFormat,
|
16627 | "http:": getHttpProtocolModuleFormat,
|
16628 | "https:": getHttpProtocolModuleFormat,
|
16629 | "node:"() {
|
16630 | return "builtin";
|
16631 | }
|
16632 | };
|
16633 | function getDataProtocolModuleFormat(parsed) {
|
16634 | const { 1: mime } = /^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec(
|
16635 | parsed.pathname
|
16636 | ) || [null, null, null];
|
16637 | return mimeToFormat(mime);
|
16638 | }
|
16639 | function extname(url2) {
|
16640 | const pathname = url2.pathname;
|
16641 | let index = pathname.length;
|
16642 | while (index--) {
|
16643 | const code = pathname.codePointAt(index);
|
16644 | if (code === 47) {
|
16645 | return "";
|
16646 | }
|
16647 | if (code === 46) {
|
16648 | return pathname.codePointAt(index - 1) === 47 ? "" : pathname.slice(index);
|
16649 | }
|
16650 | }
|
16651 | return "";
|
16652 | }
|
16653 | function getFileProtocolModuleFormat(url2, _context, ignoreErrors) {
|
16654 | const value = extname(url2);
|
16655 | if (value === ".js") {
|
16656 | const packageType = getPackageType(url2);
|
16657 | if (packageType !== "none") {
|
16658 | return packageType;
|
16659 | }
|
16660 | return "commonjs";
|
16661 | }
|
16662 | if (value === "") {
|
16663 | const packageType = getPackageType(url2);
|
16664 | if (packageType === "none" || packageType === "commonjs") {
|
16665 | return "commonjs";
|
16666 | }
|
16667 | return "module";
|
16668 | }
|
16669 | const format3 = extensionFormatMap[value];
|
16670 | if (format3) return format3;
|
16671 | if (ignoreErrors) {
|
16672 | return void 0;
|
16673 | }
|
16674 | const filepath = fileURLToPath3(url2);
|
16675 | throw new ERR_UNKNOWN_FILE_EXTENSION(value, filepath);
|
16676 | }
|
16677 | function getHttpProtocolModuleFormat() {
|
16678 | }
|
16679 | function defaultGetFormatWithoutErrors(url2, context) {
|
16680 | const protocol = url2.protocol;
|
16681 | if (!hasOwnProperty2.call(protocolHandlers, protocol)) {
|
16682 | return null;
|
16683 | }
|
16684 | return protocolHandlers[protocol](url2, context, true) || null;
|
16685 | }
|
16686 |
|
16687 | // node_modules/import-meta-resolve/lib/utils.js
|
16688 | var { ERR_INVALID_ARG_VALUE } = codes;
|
16689 | var DEFAULT_CONDITIONS = Object.freeze(["node", "import"]);
|
16690 | var DEFAULT_CONDITIONS_SET = new Set(DEFAULT_CONDITIONS);
|
16691 | function getDefaultConditions() {
|
16692 | return DEFAULT_CONDITIONS;
|
16693 | }
|
16694 | function getDefaultConditionsSet() {
|
16695 | return DEFAULT_CONDITIONS_SET;
|
16696 | }
|
16697 | function getConditionsSet(conditions) {
|
16698 | if (conditions !== void 0 && conditions !== getDefaultConditions()) {
|
16699 | if (!Array.isArray(conditions)) {
|
16700 | throw new ERR_INVALID_ARG_VALUE(
|
16701 | "conditions",
|
16702 | conditions,
|
16703 | "expected an array"
|
16704 | );
|
16705 | }
|
16706 | return new Set(conditions);
|
16707 | }
|
16708 | return getDefaultConditionsSet();
|
16709 | }
|
16710 |
|
16711 | // node_modules/import-meta-resolve/lib/resolve.js
|
16712 | var RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace];
|
16713 | var {
|
16714 | ERR_NETWORK_IMPORT_DISALLOWED,
|
16715 | ERR_INVALID_MODULE_SPECIFIER,
|
16716 | ERR_INVALID_PACKAGE_CONFIG: ERR_INVALID_PACKAGE_CONFIG2,
|
16717 | ERR_INVALID_PACKAGE_TARGET,
|
16718 | ERR_MODULE_NOT_FOUND,
|
16719 | ERR_PACKAGE_IMPORT_NOT_DEFINED,
|
16720 | ERR_PACKAGE_PATH_NOT_EXPORTED,
|
16721 | ERR_UNSUPPORTED_DIR_IMPORT,
|
16722 | ERR_UNSUPPORTED_RESOLVE_REQUEST
|
16723 | } = codes;
|
16724 | var own2 = {}.hasOwnProperty;
|
16725 | var invalidSegmentRegEx = /(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))?(\\|\/|$)/i;
|
16726 | var deprecatedInvalidSegmentRegEx = /(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))(\\|\/|$)/i;
|
16727 | var invalidPackageNameRegEx = /^\.|%|\\/;
|
16728 | var patternRegEx = /\*/g;
|
16729 | var encodedSeparatorRegEx = /%2f|%5c/i;
|
16730 | var emittedPackageWarnings = /* @__PURE__ */ new Set();
|
16731 | var doubleSlashRegEx = /[/\\]{2}/;
|
16732 | function emitInvalidSegmentDeprecation(target, request, match, packageJsonUrl, internal, base, isTarget) {
|
16733 | if (process3.noDeprecation) {
|
16734 | return;
|
16735 | }
|
16736 | const pjsonPath = fileURLToPath4(packageJsonUrl);
|
16737 | const double = doubleSlashRegEx.exec(isTarget ? target : request) !== null;
|
16738 | process3.emitWarning(
|
16739 | `Use of deprecated ${double ? "double slash" : "leading or trailing slash matching"} resolving "${target}" for module request "${request}" ${request === match ? "" : `matched to "${match}" `}in the "${internal ? "imports" : "exports"}" field module resolution of the package at ${pjsonPath}${base ? ` imported from ${fileURLToPath4(base)}` : ""}.`,
|
16740 | "DeprecationWarning",
|
16741 | "DEP0166"
|
16742 | );
|
16743 | }
|
16744 | function emitLegacyIndexDeprecation(url2, packageJsonUrl, base, main) {
|
16745 | if (process3.noDeprecation) {
|
16746 | return;
|
16747 | }
|
16748 | const format3 = defaultGetFormatWithoutErrors(url2, { parentURL: base.href });
|
16749 | if (format3 !== "module") return;
|
16750 | const urlPath = fileURLToPath4(url2.href);
|
16751 | const packagePath = fileURLToPath4(new URL2(".", packageJsonUrl));
|
16752 | const basePath = fileURLToPath4(base);
|
16753 | if (!main) {
|
16754 | process3.emitWarning(
|
16755 | `No "main" or "exports" field defined in the package.json for ${packagePath} resolving the main entry point "${urlPath.slice(
|
16756 | packagePath.length
|
16757 | )}", imported from ${basePath}.
|
16758 | Default "index" lookups for the main are deprecated for ES modules.`,
|
16759 | "DeprecationWarning",
|
16760 | "DEP0151"
|
16761 | );
|
16762 | } else if (path6.resolve(packagePath, main) !== urlPath) {
|
16763 | process3.emitWarning(
|
16764 | `Package ${packagePath} has a "main" field set to "${main}", excluding the full filename and extension to the resolved file at "${urlPath.slice(
|
16765 | packagePath.length
|
16766 | )}", imported from ${basePath}.
|
16767 | Automatic extension resolution of the "main" field is deprecated for ES modules.`,
|
16768 | "DeprecationWarning",
|
16769 | "DEP0151"
|
16770 | );
|
16771 | }
|
16772 | }
|
16773 | function tryStatSync(path13) {
|
16774 | try {
|
16775 | return statSync(path13);
|
16776 | } catch {
|
16777 | }
|
16778 | }
|
16779 | function fileExists(url2) {
|
16780 | const stats = statSync(url2, { throwIfNoEntry: false });
|
16781 | const isFile2 = stats ? stats.isFile() : void 0;
|
16782 | return isFile2 === null || isFile2 === void 0 ? false : isFile2;
|
16783 | }
|
16784 | function legacyMainResolve(packageJsonUrl, packageConfig, base) {
|
16785 | let guess;
|
16786 | if (packageConfig.main !== void 0) {
|
16787 | guess = new URL2(packageConfig.main, packageJsonUrl);
|
16788 | if (fileExists(guess)) return guess;
|
16789 | const tries2 = [
|
16790 | `./${packageConfig.main}.js`,
|
16791 | `./${packageConfig.main}.json`,
|
16792 | `./${packageConfig.main}.node`,
|
16793 | `./${packageConfig.main}/index.js`,
|
16794 | `./${packageConfig.main}/index.json`,
|
16795 | `./${packageConfig.main}/index.node`
|
16796 | ];
|
16797 | let i2 = -1;
|
16798 | while (++i2 < tries2.length) {
|
16799 | guess = new URL2(tries2[i2], packageJsonUrl);
|
16800 | if (fileExists(guess)) break;
|
16801 | guess = void 0;
|
16802 | }
|
16803 | if (guess) {
|
16804 | emitLegacyIndexDeprecation(
|
16805 | guess,
|
16806 | packageJsonUrl,
|
16807 | base,
|
16808 | packageConfig.main
|
16809 | );
|
16810 | return guess;
|
16811 | }
|
16812 | }
|
16813 | const tries = ["./index.js", "./index.json", "./index.node"];
|
16814 | let i = -1;
|
16815 | while (++i < tries.length) {
|
16816 | guess = new URL2(tries[i], packageJsonUrl);
|
16817 | if (fileExists(guess)) break;
|
16818 | guess = void 0;
|
16819 | }
|
16820 | if (guess) {
|
16821 | emitLegacyIndexDeprecation(guess, packageJsonUrl, base, packageConfig.main);
|
16822 | return guess;
|
16823 | }
|
16824 | throw new ERR_MODULE_NOT_FOUND(
|
16825 | fileURLToPath4(new URL2(".", packageJsonUrl)),
|
16826 | fileURLToPath4(base)
|
16827 | );
|
16828 | }
|
16829 | function finalizeResolution(resolved, base, preserveSymlinks) {
|
16830 | if (encodedSeparatorRegEx.exec(resolved.pathname) !== null) {
|
16831 | throw new ERR_INVALID_MODULE_SPECIFIER(
|
16832 | resolved.pathname,
|
16833 | 'must not include encoded "/" or "\\" characters',
|
16834 | fileURLToPath4(base)
|
16835 | );
|
16836 | }
|
16837 | let filePath;
|
16838 | try {
|
16839 | filePath = fileURLToPath4(resolved);
|
16840 | } catch (error) {
|
16841 | const cause = (
|
16842 | /** @type {ErrnoException} */
|
16843 | error
|
16844 | );
|
16845 | Object.defineProperty(cause, "input", { value: String(resolved) });
|
16846 | Object.defineProperty(cause, "module", { value: String(base) });
|
16847 | throw cause;
|
16848 | }
|
16849 | const stats = tryStatSync(
|
16850 | filePath.endsWith("/") ? filePath.slice(-1) : filePath
|
16851 | );
|
16852 | if (stats && stats.isDirectory()) {
|
16853 | const error = new ERR_UNSUPPORTED_DIR_IMPORT(filePath, fileURLToPath4(base));
|
16854 | error.url = String(resolved);
|
16855 | throw error;
|
16856 | }
|
16857 | if (!stats || !stats.isFile()) {
|
16858 | const error = new ERR_MODULE_NOT_FOUND(
|
16859 | filePath || resolved.pathname,
|
16860 | base && fileURLToPath4(base),
|
16861 | true
|
16862 | );
|
16863 | error.url = String(resolved);
|
16864 | throw error;
|
16865 | }
|
16866 | if (!preserveSymlinks) {
|
16867 | const real = realpathSync(filePath);
|
16868 | const { search, hash } = resolved;
|
16869 | resolved = pathToFileURL3(real + (filePath.endsWith(path6.sep) ? "/" : ""));
|
16870 | resolved.search = search;
|
16871 | resolved.hash = hash;
|
16872 | }
|
16873 | return resolved;
|
16874 | }
|
16875 | function importNotDefined(specifier, packageJsonUrl, base) {
|
16876 | return new ERR_PACKAGE_IMPORT_NOT_DEFINED(
|
16877 | specifier,
|
16878 | packageJsonUrl && fileURLToPath4(new URL2(".", packageJsonUrl)),
|
16879 | fileURLToPath4(base)
|
16880 | );
|
16881 | }
|
16882 | function exportsNotFound(subpath, packageJsonUrl, base) {
|
16883 | return new ERR_PACKAGE_PATH_NOT_EXPORTED(
|
16884 | fileURLToPath4(new URL2(".", packageJsonUrl)),
|
16885 | subpath,
|
16886 | base && fileURLToPath4(base)
|
16887 | );
|
16888 | }
|
16889 | function throwInvalidSubpath(request, match, packageJsonUrl, internal, base) {
|
16890 | const reason = `request is not a valid match in pattern "${match}" for the "${internal ? "imports" : "exports"}" resolution of ${fileURLToPath4(packageJsonUrl)}`;
|
16891 | throw new ERR_INVALID_MODULE_SPECIFIER(
|
16892 | request,
|
16893 | reason,
|
16894 | base && fileURLToPath4(base)
|
16895 | );
|
16896 | }
|
16897 | function invalidPackageTarget(subpath, target, packageJsonUrl, internal, base) {
|
16898 | target = typeof target === "object" && target !== null ? JSON.stringify(target, null, "") : `${target}`;
|
16899 | return new ERR_INVALID_PACKAGE_TARGET(
|
16900 | fileURLToPath4(new URL2(".", packageJsonUrl)),
|
16901 | subpath,
|
16902 | target,
|
16903 | internal,
|
16904 | base && fileURLToPath4(base)
|
16905 | );
|
16906 | }
|
16907 | function resolvePackageTargetString(target, subpath, match, packageJsonUrl, base, pattern, internal, isPathMap, conditions) {
|
16908 | if (subpath !== "" && !pattern && target[target.length - 1] !== "/")
|
16909 | throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);
|
16910 | if (!target.startsWith("./")) {
|
16911 | if (internal && !target.startsWith("../") && !target.startsWith("/")) {
|
16912 | let isURL2 = false;
|
16913 | try {
|
16914 | new URL2(target);
|
16915 | isURL2 = true;
|
16916 | } catch {
|
16917 | }
|
16918 | if (!isURL2) {
|
16919 | const exportTarget = pattern ? RegExpPrototypeSymbolReplace.call(
|
16920 | patternRegEx,
|
16921 | target,
|
16922 | () => subpath
|
16923 | ) : target + subpath;
|
16924 | return packageResolve(exportTarget, packageJsonUrl, conditions);
|
16925 | }
|
16926 | }
|
16927 | throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);
|
16928 | }
|
16929 | if (invalidSegmentRegEx.exec(target.slice(2)) !== null) {
|
16930 | if (deprecatedInvalidSegmentRegEx.exec(target.slice(2)) === null) {
|
16931 | if (!isPathMap) {
|
16932 | const request = pattern ? match.replace("*", () => subpath) : match + subpath;
|
16933 | const resolvedTarget = pattern ? RegExpPrototypeSymbolReplace.call(
|
16934 | patternRegEx,
|
16935 | target,
|
16936 | () => subpath
|
16937 | ) : target;
|
16938 | emitInvalidSegmentDeprecation(
|
16939 | resolvedTarget,
|
16940 | request,
|
16941 | match,
|
16942 | packageJsonUrl,
|
16943 | internal,
|
16944 | base,
|
16945 | true
|
16946 | );
|
16947 | }
|
16948 | } else {
|
16949 | throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);
|
16950 | }
|
16951 | }
|
16952 | const resolved = new URL2(target, packageJsonUrl);
|
16953 | const resolvedPath = resolved.pathname;
|
16954 | const packagePath = new URL2(".", packageJsonUrl).pathname;
|
16955 | if (!resolvedPath.startsWith(packagePath))
|
16956 | throw invalidPackageTarget(match, target, packageJsonUrl, internal, base);
|
16957 | if (subpath === "") return resolved;
|
16958 | if (invalidSegmentRegEx.exec(subpath) !== null) {
|
16959 | const request = pattern ? match.replace("*", () => subpath) : match + subpath;
|
16960 | if (deprecatedInvalidSegmentRegEx.exec(subpath) === null) {
|
16961 | if (!isPathMap) {
|
16962 | const resolvedTarget = pattern ? RegExpPrototypeSymbolReplace.call(
|
16963 | patternRegEx,
|
16964 | target,
|
16965 | () => subpath
|
16966 | ) : target;
|
16967 | emitInvalidSegmentDeprecation(
|
16968 | resolvedTarget,
|
16969 | request,
|
16970 | match,
|
16971 | packageJsonUrl,
|
16972 | internal,
|
16973 | base,
|
16974 | false
|
16975 | );
|
16976 | }
|
16977 | } else {
|
16978 | throwInvalidSubpath(request, match, packageJsonUrl, internal, base);
|
16979 | }
|
16980 | }
|
16981 | if (pattern) {
|
16982 | return new URL2(
|
16983 | RegExpPrototypeSymbolReplace.call(
|
16984 | patternRegEx,
|
16985 | resolved.href,
|
16986 | () => subpath
|
16987 | )
|
16988 | );
|
16989 | }
|
16990 | return new URL2(subpath, resolved);
|
16991 | }
|
16992 | function isArrayIndex(key2) {
|
16993 | const keyNumber = Number(key2);
|
16994 | if (`${keyNumber}` !== key2) return false;
|
16995 | return keyNumber >= 0 && keyNumber < 4294967295;
|
16996 | }
|
16997 | function resolvePackageTarget(packageJsonUrl, target, subpath, packageSubpath, base, pattern, internal, isPathMap, conditions) {
|
16998 | if (typeof target === "string") {
|
16999 | return resolvePackageTargetString(
|
17000 | target,
|
17001 | subpath,
|
17002 | packageSubpath,
|
17003 | packageJsonUrl,
|
17004 | base,
|
17005 | pattern,
|
17006 | internal,
|
17007 | isPathMap,
|
17008 | conditions
|
17009 | );
|
17010 | }
|
17011 | if (Array.isArray(target)) {
|
17012 | const targetList = target;
|
17013 | if (targetList.length === 0) return null;
|
17014 | let lastException;
|
17015 | let i = -1;
|
17016 | while (++i < targetList.length) {
|
17017 | const targetItem = targetList[i];
|
17018 | let resolveResult;
|
17019 | try {
|
17020 | resolveResult = resolvePackageTarget(
|
17021 | packageJsonUrl,
|
17022 | targetItem,
|
17023 | subpath,
|
17024 | packageSubpath,
|
17025 | base,
|
17026 | pattern,
|
17027 | internal,
|
17028 | isPathMap,
|
17029 | conditions
|
17030 | );
|
17031 | } catch (error) {
|
17032 | const exception2 = (
|
17033 | /** @type {ErrnoException} */
|
17034 | error
|
17035 | );
|
17036 | lastException = exception2;
|
17037 | if (exception2.code === "ERR_INVALID_PACKAGE_TARGET") continue;
|
17038 | throw error;
|
17039 | }
|
17040 | if (resolveResult === void 0) continue;
|
17041 | if (resolveResult === null) {
|
17042 | lastException = null;
|
17043 | continue;
|
17044 | }
|
17045 | return resolveResult;
|
17046 | }
|
17047 | if (lastException === void 0 || lastException === null) {
|
17048 | return null;
|
17049 | }
|
17050 | throw lastException;
|
17051 | }
|
17052 | if (typeof target === "object" && target !== null) {
|
17053 | const keys = Object.getOwnPropertyNames(target);
|
17054 | let i = -1;
|
17055 | while (++i < keys.length) {
|
17056 | const key2 = keys[i];
|
17057 | if (isArrayIndex(key2)) {
|
17058 | throw new ERR_INVALID_PACKAGE_CONFIG2(
|
17059 | fileURLToPath4(packageJsonUrl),
|
17060 | base,
|
17061 | '"exports" cannot contain numeric property keys.'
|
17062 | );
|
17063 | }
|
17064 | }
|
17065 | i = -1;
|
17066 | while (++i < keys.length) {
|
17067 | const key2 = keys[i];
|
17068 | if (key2 === "default" || conditions && conditions.has(key2)) {
|
17069 | const conditionalTarget = (
|
17070 | /** @type {unknown} */
|
17071 | target[key2]
|
17072 | );
|
17073 | const resolveResult = resolvePackageTarget(
|
17074 | packageJsonUrl,
|
17075 | conditionalTarget,
|
17076 | subpath,
|
17077 | packageSubpath,
|
17078 | base,
|
17079 | pattern,
|
17080 | internal,
|
17081 | isPathMap,
|
17082 | conditions
|
17083 | );
|
17084 | if (resolveResult === void 0) continue;
|
17085 | return resolveResult;
|
17086 | }
|
17087 | }
|
17088 | return null;
|
17089 | }
|
17090 | if (target === null) {
|
17091 | return null;
|
17092 | }
|
17093 | throw invalidPackageTarget(
|
17094 | packageSubpath,
|
17095 | target,
|
17096 | packageJsonUrl,
|
17097 | internal,
|
17098 | base
|
17099 | );
|
17100 | }
|
17101 | function isConditionalExportsMainSugar(exports, packageJsonUrl, base) {
|
17102 | if (typeof exports === "string" || Array.isArray(exports)) return true;
|
17103 | if (typeof exports !== "object" || exports === null) return false;
|
17104 | const keys = Object.getOwnPropertyNames(exports);
|
17105 | let isConditionalSugar = false;
|
17106 | let i = 0;
|
17107 | let keyIndex = -1;
|
17108 | while (++keyIndex < keys.length) {
|
17109 | const key2 = keys[keyIndex];
|
17110 | const currentIsConditionalSugar = key2 === "" || key2[0] !== ".";
|
17111 | if (i++ === 0) {
|
17112 | isConditionalSugar = currentIsConditionalSugar;
|
17113 | } else if (isConditionalSugar !== currentIsConditionalSugar) {
|
17114 | throw new ERR_INVALID_PACKAGE_CONFIG2(
|
17115 | fileURLToPath4(packageJsonUrl),
|
17116 | base,
|
17117 | `"exports" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.`
|
17118 | );
|
17119 | }
|
17120 | }
|
17121 | return isConditionalSugar;
|
17122 | }
|
17123 | function emitTrailingSlashPatternDeprecation(match, pjsonUrl, base) {
|
17124 | if (process3.noDeprecation) {
|
17125 | return;
|
17126 | }
|
17127 | const pjsonPath = fileURLToPath4(pjsonUrl);
|
17128 | if (emittedPackageWarnings.has(pjsonPath + "|" + match)) return;
|
17129 | emittedPackageWarnings.add(pjsonPath + "|" + match);
|
17130 | process3.emitWarning(
|
17131 | `Use of deprecated trailing slash pattern mapping "${match}" in the "exports" field module resolution of the package at ${pjsonPath}${base ? ` imported from ${fileURLToPath4(base)}` : ""}. Mapping specifiers ending in "/" is no longer supported.`,
|
17132 | "DeprecationWarning",
|
17133 | "DEP0155"
|
17134 | );
|
17135 | }
|
17136 | function packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, base, conditions) {
|
17137 | let exports = packageConfig.exports;
|
17138 | if (isConditionalExportsMainSugar(exports, packageJsonUrl, base)) {
|
17139 | exports = { ".": exports };
|
17140 | }
|
17141 | if (own2.call(exports, packageSubpath) && !packageSubpath.includes("*") && !packageSubpath.endsWith("/")) {
|
17142 | const target = exports[packageSubpath];
|
17143 | const resolveResult = resolvePackageTarget(
|
17144 | packageJsonUrl,
|
17145 | target,
|
17146 | "",
|
17147 | packageSubpath,
|
17148 | base,
|
17149 | false,
|
17150 | false,
|
17151 | false,
|
17152 | conditions
|
17153 | );
|
17154 | if (resolveResult === null || resolveResult === void 0) {
|
17155 | throw exportsNotFound(packageSubpath, packageJsonUrl, base);
|
17156 | }
|
17157 | return resolveResult;
|
17158 | }
|
17159 | let bestMatch = "";
|
17160 | let bestMatchSubpath = "";
|
17161 | const keys = Object.getOwnPropertyNames(exports);
|
17162 | let i = -1;
|
17163 | while (++i < keys.length) {
|
17164 | const key2 = keys[i];
|
17165 | const patternIndex = key2.indexOf("*");
|
17166 | if (patternIndex !== -1 && packageSubpath.startsWith(key2.slice(0, patternIndex))) {
|
17167 | if (packageSubpath.endsWith("/")) {
|
17168 | emitTrailingSlashPatternDeprecation(
|
17169 | packageSubpath,
|
17170 | packageJsonUrl,
|
17171 | base
|
17172 | );
|
17173 | }
|
17174 | const patternTrailer = key2.slice(patternIndex + 1);
|
17175 | if (packageSubpath.length >= key2.length && packageSubpath.endsWith(patternTrailer) && patternKeyCompare(bestMatch, key2) === 1 && key2.lastIndexOf("*") === patternIndex) {
|
17176 | bestMatch = key2;
|
17177 | bestMatchSubpath = packageSubpath.slice(
|
17178 | patternIndex,
|
17179 | packageSubpath.length - patternTrailer.length
|
17180 | );
|
17181 | }
|
17182 | }
|
17183 | }
|
17184 | if (bestMatch) {
|
17185 | const target = (
|
17186 | /** @type {unknown} */
|
17187 | exports[bestMatch]
|
17188 | );
|
17189 | const resolveResult = resolvePackageTarget(
|
17190 | packageJsonUrl,
|
17191 | target,
|
17192 | bestMatchSubpath,
|
17193 | bestMatch,
|
17194 | base,
|
17195 | true,
|
17196 | false,
|
17197 | packageSubpath.endsWith("/"),
|
17198 | conditions
|
17199 | );
|
17200 | if (resolveResult === null || resolveResult === void 0) {
|
17201 | throw exportsNotFound(packageSubpath, packageJsonUrl, base);
|
17202 | }
|
17203 | return resolveResult;
|
17204 | }
|
17205 | throw exportsNotFound(packageSubpath, packageJsonUrl, base);
|
17206 | }
|
17207 | function patternKeyCompare(a, b) {
|
17208 | const aPatternIndex = a.indexOf("*");
|
17209 | const bPatternIndex = b.indexOf("*");
|
17210 | const baseLengthA = aPatternIndex === -1 ? a.length : aPatternIndex + 1;
|
17211 | const baseLengthB = bPatternIndex === -1 ? b.length : bPatternIndex + 1;
|
17212 | if (baseLengthA > baseLengthB) return -1;
|
17213 | if (baseLengthB > baseLengthA) return 1;
|
17214 | if (aPatternIndex === -1) return 1;
|
17215 | if (bPatternIndex === -1) return -1;
|
17216 | if (a.length > b.length) return -1;
|
17217 | if (b.length > a.length) return 1;
|
17218 | return 0;
|
17219 | }
|
17220 | function packageImportsResolve(name, base, conditions) {
|
17221 | if (name === "#" || name.startsWith("#/") || name.endsWith("/")) {
|
17222 | const reason = "is not a valid internal imports specifier name";
|
17223 | throw new ERR_INVALID_MODULE_SPECIFIER(name, reason, fileURLToPath4(base));
|
17224 | }
|
17225 | let packageJsonUrl;
|
17226 | const packageConfig = getPackageScopeConfig(base);
|
17227 | if (packageConfig.exists) {
|
17228 | packageJsonUrl = pathToFileURL3(packageConfig.pjsonPath);
|
17229 | const imports = packageConfig.imports;
|
17230 | if (imports) {
|
17231 | if (own2.call(imports, name) && !name.includes("*")) {
|
17232 | const resolveResult = resolvePackageTarget(
|
17233 | packageJsonUrl,
|
17234 | imports[name],
|
17235 | "",
|
17236 | name,
|
17237 | base,
|
17238 | false,
|
17239 | true,
|
17240 | false,
|
17241 | conditions
|
17242 | );
|
17243 | if (resolveResult !== null && resolveResult !== void 0) {
|
17244 | return resolveResult;
|
17245 | }
|
17246 | } else {
|
17247 | let bestMatch = "";
|
17248 | let bestMatchSubpath = "";
|
17249 | const keys = Object.getOwnPropertyNames(imports);
|
17250 | let i = -1;
|
17251 | while (++i < keys.length) {
|
17252 | const key2 = keys[i];
|
17253 | const patternIndex = key2.indexOf("*");
|
17254 | if (patternIndex !== -1 && name.startsWith(key2.slice(0, -1))) {
|
17255 | const patternTrailer = key2.slice(patternIndex + 1);
|
17256 | if (name.length >= key2.length && name.endsWith(patternTrailer) && patternKeyCompare(bestMatch, key2) === 1 && key2.lastIndexOf("*") === patternIndex) {
|
17257 | bestMatch = key2;
|
17258 | bestMatchSubpath = name.slice(
|
17259 | patternIndex,
|
17260 | name.length - patternTrailer.length
|
17261 | );
|
17262 | }
|
17263 | }
|
17264 | }
|
17265 | if (bestMatch) {
|
17266 | const target = imports[bestMatch];
|
17267 | const resolveResult = resolvePackageTarget(
|
17268 | packageJsonUrl,
|
17269 | target,
|
17270 | bestMatchSubpath,
|
17271 | bestMatch,
|
17272 | base,
|
17273 | true,
|
17274 | true,
|
17275 | false,
|
17276 | conditions
|
17277 | );
|
17278 | if (resolveResult !== null && resolveResult !== void 0) {
|
17279 | return resolveResult;
|
17280 | }
|
17281 | }
|
17282 | }
|
17283 | }
|
17284 | }
|
17285 | throw importNotDefined(name, packageJsonUrl, base);
|
17286 | }
|
17287 | function parsePackageName(specifier, base) {
|
17288 | let separatorIndex = specifier.indexOf("/");
|
17289 | let validPackageName = true;
|
17290 | let isScoped = false;
|
17291 | if (specifier[0] === "@") {
|
17292 | isScoped = true;
|
17293 | if (separatorIndex === -1 || specifier.length === 0) {
|
17294 | validPackageName = false;
|
17295 | } else {
|
17296 | separatorIndex = specifier.indexOf("/", separatorIndex + 1);
|
17297 | }
|
17298 | }
|
17299 | const packageName = separatorIndex === -1 ? specifier : specifier.slice(0, separatorIndex);
|
17300 | if (invalidPackageNameRegEx.exec(packageName) !== null) {
|
17301 | validPackageName = false;
|
17302 | }
|
17303 | if (!validPackageName) {
|
17304 | throw new ERR_INVALID_MODULE_SPECIFIER(
|
17305 | specifier,
|
17306 | "is not a valid package name",
|
17307 | fileURLToPath4(base)
|
17308 | );
|
17309 | }
|
17310 | const packageSubpath = "." + (separatorIndex === -1 ? "" : specifier.slice(separatorIndex));
|
17311 | return { packageName, packageSubpath, isScoped };
|
17312 | }
|
17313 | function packageResolve(specifier, base, conditions) {
|
17314 | if (builtinModules.includes(specifier)) {
|
17315 | return new URL2("node:" + specifier);
|
17316 | }
|
17317 | const { packageName, packageSubpath, isScoped } = parsePackageName(
|
17318 | specifier,
|
17319 | base
|
17320 | );
|
17321 | const packageConfig = getPackageScopeConfig(base);
|
17322 | if (packageConfig.exists) {
|
17323 | const packageJsonUrl2 = pathToFileURL3(packageConfig.pjsonPath);
|
17324 | if (packageConfig.name === packageName && packageConfig.exports !== void 0 && packageConfig.exports !== null) {
|
17325 | return packageExportsResolve(
|
17326 | packageJsonUrl2,
|
17327 | packageSubpath,
|
17328 | packageConfig,
|
17329 | base,
|
17330 | conditions
|
17331 | );
|
17332 | }
|
17333 | }
|
17334 | let packageJsonUrl = new URL2(
|
17335 | "./node_modules/" + packageName + "/package.json",
|
17336 | base
|
17337 | );
|
17338 | let packageJsonPath = fileURLToPath4(packageJsonUrl);
|
17339 | let lastPath;
|
17340 | do {
|
17341 | const stat = tryStatSync(packageJsonPath.slice(0, -13));
|
17342 | if (!stat || !stat.isDirectory()) {
|
17343 | lastPath = packageJsonPath;
|
17344 | packageJsonUrl = new URL2(
|
17345 | (isScoped ? "../../../../node_modules/" : "../../../node_modules/") + packageName + "/package.json",
|
17346 | packageJsonUrl
|
17347 | );
|
17348 | packageJsonPath = fileURLToPath4(packageJsonUrl);
|
17349 | continue;
|
17350 | }
|
17351 | const packageConfig2 = read2(packageJsonPath, { base, specifier });
|
17352 | if (packageConfig2.exports !== void 0 && packageConfig2.exports !== null) {
|
17353 | return packageExportsResolve(
|
17354 | packageJsonUrl,
|
17355 | packageSubpath,
|
17356 | packageConfig2,
|
17357 | base,
|
17358 | conditions
|
17359 | );
|
17360 | }
|
17361 | if (packageSubpath === ".") {
|
17362 | return legacyMainResolve(packageJsonUrl, packageConfig2, base);
|
17363 | }
|
17364 | return new URL2(packageSubpath, packageJsonUrl);
|
17365 | } while (packageJsonPath.length !== lastPath.length);
|
17366 | throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath4(base), false);
|
17367 | }
|
17368 | function isRelativeSpecifier(specifier) {
|
17369 | if (specifier[0] === ".") {
|
17370 | if (specifier.length === 1 || specifier[1] === "/") return true;
|
17371 | if (specifier[1] === "." && (specifier.length === 2 || specifier[2] === "/")) {
|
17372 | return true;
|
17373 | }
|
17374 | }
|
17375 | return false;
|
17376 | }
|
17377 | function shouldBeTreatedAsRelativeOrAbsolutePath(specifier) {
|
17378 | if (specifier === "") return false;
|
17379 | if (specifier[0] === "/") return true;
|
17380 | return isRelativeSpecifier(specifier);
|
17381 | }
|
17382 | function moduleResolve(specifier, base, conditions, preserveSymlinks) {
|
17383 | const protocol = base.protocol;
|
17384 | const isData = protocol === "data:";
|
17385 | const isRemote = isData || protocol === "http:" || protocol === "https:";
|
17386 | let resolved;
|
17387 | if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) {
|
17388 | try {
|
17389 | resolved = new URL2(specifier, base);
|
17390 | } catch (error_) {
|
17391 | const error = new ERR_UNSUPPORTED_RESOLVE_REQUEST(specifier, base);
|
17392 | error.cause = error_;
|
17393 | throw error;
|
17394 | }
|
17395 | } else if (protocol === "file:" && specifier[0] === "#") {
|
17396 | resolved = packageImportsResolve(specifier, base, conditions);
|
17397 | } else {
|
17398 | try {
|
17399 | resolved = new URL2(specifier);
|
17400 | } catch (error_) {
|
17401 | if (isRemote && !builtinModules.includes(specifier)) {
|
17402 | const error = new ERR_UNSUPPORTED_RESOLVE_REQUEST(specifier, base);
|
17403 | error.cause = error_;
|
17404 | throw error;
|
17405 | }
|
17406 | resolved = packageResolve(specifier, base, conditions);
|
17407 | }
|
17408 | }
|
17409 | assert3(resolved !== void 0, "expected to be defined");
|
17410 | if (resolved.protocol !== "file:") {
|
17411 | return resolved;
|
17412 | }
|
17413 | return finalizeResolution(resolved, base, preserveSymlinks);
|
17414 | }
|
17415 | function checkIfDisallowedImport(specifier, parsed, parsedParentURL) {
|
17416 | if (parsedParentURL) {
|
17417 | const parentProtocol = parsedParentURL.protocol;
|
17418 | if (parentProtocol === "http:" || parentProtocol === "https:") {
|
17419 | if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) {
|
17420 | const parsedProtocol = parsed == null ? void 0 : parsed.protocol;
|
17421 | if (parsedProtocol && parsedProtocol !== "https:" && parsedProtocol !== "http:") {
|
17422 | throw new ERR_NETWORK_IMPORT_DISALLOWED(
|
17423 | specifier,
|
17424 | parsedParentURL,
|
17425 | "remote imports cannot import from a local location."
|
17426 | );
|
17427 | }
|
17428 | return { url: (parsed == null ? void 0 : parsed.href) || "" };
|
17429 | }
|
17430 | if (builtinModules.includes(specifier)) {
|
17431 | throw new ERR_NETWORK_IMPORT_DISALLOWED(
|
17432 | specifier,
|
17433 | parsedParentURL,
|
17434 | "remote imports cannot import from a local location."
|
17435 | );
|
17436 | }
|
17437 | throw new ERR_NETWORK_IMPORT_DISALLOWED(
|
17438 | specifier,
|
17439 | parsedParentURL,
|
17440 | "only relative and absolute specifiers are supported."
|
17441 | );
|
17442 | }
|
17443 | }
|
17444 | }
|
17445 | function isURL(self) {
|
17446 | return Boolean(
|
17447 | self && typeof self === "object" && "href" in self && typeof self.href === "string" && "protocol" in self && typeof self.protocol === "string" && self.href && self.protocol
|
17448 | );
|
17449 | }
|
17450 | function throwIfInvalidParentURL(parentURL) {
|
17451 | if (parentURL === void 0) {
|
17452 | return;
|
17453 | }
|
17454 | if (typeof parentURL !== "string" && !isURL(parentURL)) {
|
17455 | throw new codes.ERR_INVALID_ARG_TYPE(
|
17456 | "parentURL",
|
17457 | ["string", "URL"],
|
17458 | parentURL
|
17459 | );
|
17460 | }
|
17461 | }
|
17462 | function defaultResolve(specifier, context = {}) {
|
17463 | const { parentURL } = context;
|
17464 | assert3(parentURL !== void 0, "expected `parentURL` to be defined");
|
17465 | throwIfInvalidParentURL(parentURL);
|
17466 | let parsedParentURL;
|
17467 | if (parentURL) {
|
17468 | try {
|
17469 | parsedParentURL = new URL2(parentURL);
|
17470 | } catch {
|
17471 | }
|
17472 | }
|
17473 | let parsed;
|
17474 | let protocol;
|
17475 | try {
|
17476 | parsed = shouldBeTreatedAsRelativeOrAbsolutePath(specifier) ? new URL2(specifier, parsedParentURL) : new URL2(specifier);
|
17477 | protocol = parsed.protocol;
|
17478 | if (protocol === "data:") {
|
17479 | return { url: parsed.href, format: null };
|
17480 | }
|
17481 | } catch {
|
17482 | }
|
17483 | const maybeReturn = checkIfDisallowedImport(
|
17484 | specifier,
|
17485 | parsed,
|
17486 | parsedParentURL
|
17487 | );
|
17488 | if (maybeReturn) return maybeReturn;
|
17489 | if (protocol === void 0 && parsed) {
|
17490 | protocol = parsed.protocol;
|
17491 | }
|
17492 | if (protocol === "node:") {
|
17493 | return { url: specifier };
|
17494 | }
|
17495 | if (parsed && parsed.protocol === "node:") return { url: specifier };
|
17496 | const conditions = getConditionsSet(context.conditions);
|
17497 | const url2 = moduleResolve(specifier, new URL2(parentURL), conditions, false);
|
17498 | return {
|
17499 | // Do NOT cast `url` to a string: that will work even when there are real
|
17500 | // problems, silencing them
|
17501 | url: url2.href,
|
17502 | format: defaultGetFormatWithoutErrors(url2, { parentURL })
|
17503 | };
|
17504 | }
|
17505 |
|
17506 | // node_modules/import-meta-resolve/index.js
|
17507 | function resolve2(specifier, parent) {
|
17508 | if (!parent) {
|
17509 | throw new Error(
|
17510 | "Please pass `parent`: `import-meta-resolve` cannot ponyfill that"
|
17511 | );
|
17512 | }
|
17513 | try {
|
17514 | return defaultResolve(specifier, { parentURL: parent }).url;
|
17515 | } catch (error) {
|
17516 | const exception2 = (
|
17517 | /** @type {ErrnoException} */
|
17518 | error
|
17519 | );
|
17520 | if ((exception2.code === "ERR_UNSUPPORTED_DIR_IMPORT" || exception2.code === "ERR_MODULE_NOT_FOUND") && typeof exception2.url === "string") {
|
17521 | return exception2.url;
|
17522 | }
|
17523 | throw error;
|
17524 | }
|
17525 | }
|
17526 |
|
17527 | // src/utils/import-from-file.js
|
17528 | function importFromFile(specifier, parent) {
|
17529 | const url2 = resolve2(specifier, pathToFileURL4(parent).href);
|
17530 | return import(url2);
|
17531 | }
|
17532 | var import_from_file_default = importFromFile;
|
17533 |
|
17534 | // src/utils/require-from-file.js
|
17535 | import { createRequire } from "module";
|
17536 | function requireFromFile(id, parent) {
|
17537 | const require2 = createRequire(parent);
|
17538 | return require2(id);
|
17539 | }
|
17540 | var require_from_file_default = requireFromFile;
|
17541 |
|
17542 | // src/config/prettier-config/load-external-config.js
|
17543 | var requireErrorCodesShouldBeIgnored = /* @__PURE__ */ new Set([
|
17544 | "MODULE_NOT_FOUND",
|
17545 | "ERR_REQUIRE_ESM",
|
17546 | "ERR_PACKAGE_PATH_NOT_EXPORTED"
|
17547 | ]);
|
17548 | async function loadExternalConfig(externalConfig, configFile) {
|
17549 | try {
|
17550 | return require_from_file_default(externalConfig, configFile);
|
17551 | } catch (error) {
|
17552 | if (!requireErrorCodesShouldBeIgnored.has(error == null ? void 0 : error.code)) {
|
17553 | throw error;
|
17554 | }
|
17555 | }
|
17556 | const module = await import_from_file_default(externalConfig, configFile);
|
17557 | return module.default;
|
17558 | }
|
17559 | var load_external_config_default = loadExternalConfig;
|
17560 |
|
17561 | // src/config/prettier-config/load-config.js
|
17562 | async function loadConfig(configFile) {
|
17563 | const { base: fileName, ext: extension } = path7.parse(configFile);
|
17564 | const load2 = fileName === "package.json" ? loadConfigFromPackageJson : fileName === "package.yaml" ? loadConfigFromPackageYaml : loaders_default[extension];
|
17565 | if (!load2) {
|
17566 | throw new Error(
|
17567 | `No loader specified for extension "${extension || "noExt"}"`
|
17568 | );
|
17569 | }
|
17570 | let config = await load2(configFile);
|
17571 | if (!config) {
|
17572 | return;
|
17573 | }
|
17574 | if (typeof config === "string") {
|
17575 | config = await load_external_config_default(config, configFile);
|
17576 | }
|
17577 | if (typeof config !== "object") {
|
17578 | throw new TypeError(
|
17579 | `Config is only allowed to be an object, but received ${typeof config} in "${configFile}"`
|
17580 | );
|
17581 | }
|
17582 | delete config.$schema;
|
17583 | return config;
|
17584 | }
|
17585 | var load_config_default = loadConfig;
|
17586 |
|
17587 | // src/config/prettier-config/index.js
|
17588 | var loadCache = /* @__PURE__ */ new Map();
|
17589 | var searchCache = /* @__PURE__ */ new Map();
|
17590 | function clearPrettierConfigCache() {
|
17591 | loadCache.clear();
|
17592 | searchCache.clear();
|
17593 | }
|
17594 | function loadPrettierConfig(configFile, { shouldCache }) {
|
17595 | configFile = path8.resolve(configFile);
|
17596 | if (!shouldCache || !loadCache.has(configFile)) {
|
17597 | loadCache.set(configFile, load_config_default(configFile));
|
17598 | }
|
17599 | return loadCache.get(configFile);
|
17600 | }
|
17601 | function getSearchFunction(stopDirectory) {
|
17602 | stopDirectory = stopDirectory ? path8.resolve(stopDirectory) : void 0;
|
17603 | if (!searchCache.has(stopDirectory)) {
|
17604 | const searcher2 = config_searcher_default(stopDirectory);
|
17605 | const searchFunction = searcher2.search.bind(searcher2);
|
17606 | searchCache.set(stopDirectory, searchFunction);
|
17607 | }
|
17608 | return searchCache.get(stopDirectory);
|
17609 | }
|
17610 | function searchPrettierConfig(startDirectory, options8 = {}) {
|
17611 | startDirectory = startDirectory ? path8.resolve(startDirectory) : process.cwd();
|
17612 | const stopDirectory = mockable_default.getPrettierConfigSearchStopDirectory();
|
17613 | const search = getSearchFunction(stopDirectory);
|
17614 | return search(startDirectory, { shouldCache: options8.shouldCache });
|
17615 | }
|
17616 |
|
17617 | // src/config/resolve-config.js
|
17618 | function clearCache() {
|
17619 | clearPrettierConfigCache();
|
17620 | clearEditorconfigCache();
|
17621 | }
|
17622 | function loadEditorconfig2(file, options8) {
|
17623 | if (!file || !options8.editorconfig) {
|
17624 | return;
|
17625 | }
|
17626 | const shouldCache = options8.useCache;
|
17627 | return loadEditorconfig(file, { shouldCache });
|
17628 | }
|
17629 | async function loadPrettierConfig2(file, options8) {
|
17630 | const shouldCache = options8.useCache;
|
17631 | let configFile = options8.config;
|
17632 | if (!configFile) {
|
17633 | const directory = file ? path9.dirname(path9.resolve(file)) : void 0;
|
17634 | configFile = await searchPrettierConfig(directory, { shouldCache });
|
17635 | }
|
17636 | if (!configFile) {
|
17637 | return;
|
17638 | }
|
17639 | const config = await loadPrettierConfig(configFile, { shouldCache });
|
17640 | return { config, configFile };
|
17641 | }
|
17642 | async function resolveConfig(fileUrlOrPath, options8) {
|
17643 | options8 = { useCache: true, ...options8 };
|
17644 | const filePath = toPath(fileUrlOrPath);
|
17645 | const [result, editorConfigured] = await Promise.all([
|
17646 | loadPrettierConfig2(filePath, options8),
|
17647 | loadEditorconfig2(filePath, options8)
|
17648 | ]);
|
17649 | if (!result && !editorConfigured) {
|
17650 | return null;
|
17651 | }
|
17652 | const merged = {
|
17653 | ...editorConfigured,
|
17654 | ...mergeOverrides(result, filePath)
|
17655 | };
|
17656 | if (Array.isArray(merged.plugins)) {
|
17657 | merged.plugins = merged.plugins.map(
|
17658 | (value) => typeof value === "string" && value.startsWith(".") ? path9.resolve(path9.dirname(result.configFile), value) : value
|
17659 | );
|
17660 | }
|
17661 | return merged;
|
17662 | }
|
17663 | async function resolveConfigFile(fileUrlOrPath) {
|
17664 | const directory = fileUrlOrPath ? path9.dirname(path9.resolve(toPath(fileUrlOrPath))) : void 0;
|
17665 | const result = await searchPrettierConfig(directory, { shouldCache: false });
|
17666 | return result ?? null;
|
17667 | }
|
17668 | function mergeOverrides(configResult, filePath) {
|
17669 | const { config, configFile } = configResult || {};
|
17670 | const { overrides, ...options8 } = config || {};
|
17671 | if (filePath && overrides) {
|
17672 | const relativeFilePath = path9.relative(path9.dirname(configFile), filePath);
|
17673 | for (const override of overrides) {
|
17674 | if (pathMatchesGlobs(
|
17675 | relativeFilePath,
|
17676 | override.files,
|
17677 | override.excludeFiles
|
17678 | )) {
|
17679 | Object.assign(options8, override.options);
|
17680 | }
|
17681 | }
|
17682 | }
|
17683 | return options8;
|
17684 | }
|
17685 | function pathMatchesGlobs(filePath, patterns, excludedPatterns) {
|
17686 | const patternList = Array.isArray(patterns) ? patterns : [patterns];
|
17687 | const [withSlashes, withoutSlashes] = partition_default(
|
17688 | patternList,
|
17689 | (pattern) => pattern.includes("/")
|
17690 | );
|
17691 | return import_micromatch.default.isMatch(filePath, withoutSlashes, {
|
17692 | ignore: excludedPatterns,
|
17693 | basename: true,
|
17694 | dot: true
|
17695 | }) || import_micromatch.default.isMatch(filePath, withSlashes, {
|
17696 | ignore: excludedPatterns,
|
17697 | basename: false,
|
17698 | dot: true
|
17699 | });
|
17700 | }
|
17701 |
|
17702 | // scripts/build/shims/string-replace-all.js
|
17703 | var stringReplaceAll2 = (isOptionalObject, original, pattern, replacement) => {
|
17704 | if (isOptionalObject && (original === void 0 || original === null)) {
|
17705 | return;
|
17706 | }
|
17707 | if (original.replaceAll) {
|
17708 | return original.replaceAll(pattern, replacement);
|
17709 | }
|
17710 | if (pattern.global) {
|
17711 | return original.replace(pattern, replacement);
|
17712 | }
|
17713 | return original.split(pattern).join(replacement);
|
17714 | };
|
17715 | var string_replace_all_default = stringReplaceAll2;
|
17716 |
|
17717 | // src/utils/ignore.js
|
17718 | var import_ignore = __toESM(require_ignore(), 1);
|
17719 | import path10 from "path";
|
17720 | import url from "url";
|
17721 | var createIgnore = import_ignore.default.default;
|
17722 | var slash = path10.sep === "\\" ? (filePath) => string_replace_all_default(
|
17723 | /* isOptionalObject */
|
17724 | false,
|
17725 | filePath,
|
17726 | "\\",
|
17727 | "/"
|
17728 | ) : (filePath) => filePath;
|
17729 | function getRelativePath(file, ignoreFile) {
|
17730 | const ignoreFilePath = toPath(ignoreFile);
|
17731 | const filePath = isUrl(file) ? url.fileURLToPath(file) : path10.resolve(file);
|
17732 | return path10.relative(
|
17733 | // If there's an ignore-path set, the filename must be relative to the
|
17734 | // ignore path, not the current working directory.
|
17735 | ignoreFilePath ? path10.dirname(ignoreFilePath) : process.cwd(),
|
17736 | filePath
|
17737 | );
|
17738 | }
|
17739 | async function createSingleIsIgnoredFunction(ignoreFile, withNodeModules) {
|
17740 | let content = "";
|
17741 | if (ignoreFile) {
|
17742 | content += await read_file_default(ignoreFile) ?? "";
|
17743 | }
|
17744 | if (!withNodeModules) {
|
17745 | content += "\nnode_modules";
|
17746 | }
|
17747 | if (!content) {
|
17748 | return;
|
17749 | }
|
17750 | const ignore = createIgnore({
|
17751 | allowRelativePaths: true
|
17752 | }).add(content);
|
17753 | return (file) => ignore.ignores(slash(getRelativePath(file, ignoreFile)));
|
17754 | }
|
17755 | async function createIsIgnoredFunction(ignoreFiles, withNodeModules) {
|
17756 | if (ignoreFiles.length === 0 && !withNodeModules) {
|
17757 | ignoreFiles = [void 0];
|
17758 | }
|
17759 | const isIgnoredFunctions = (await Promise.all(ignoreFiles.map((ignoreFile) => createSingleIsIgnoredFunction(ignoreFile, withNodeModules)))).filter(Boolean);
|
17760 | return (file) => isIgnoredFunctions.some((isIgnored2) => isIgnored2(file));
|
17761 | }
|
17762 | async function isIgnored(file, options8) {
|
17763 | const {
|
17764 | ignorePath: ignoreFiles,
|
17765 | withNodeModules
|
17766 | } = options8;
|
17767 | const isIgnored2 = await createIsIgnoredFunction(ignoreFiles, withNodeModules);
|
17768 | return isIgnored2(file);
|
17769 | }
|
17770 |
|
17771 | // src/utils/get-interpreter.js
|
17772 | var import_n_readlines = __toESM(require_readlines(), 1);
|
17773 | import fs6 from "fs";
|
17774 | function getInterpreter(file) {
|
17775 | let fd;
|
17776 | try {
|
17777 | fd = fs6.openSync(file, "r");
|
17778 | } catch {
|
17779 | return;
|
17780 | }
|
17781 | try {
|
17782 | const liner = new import_n_readlines.default(fd);
|
17783 | const firstLine = liner.next().toString("utf8");
|
17784 | const m1 = firstLine.match(/^#!\/(?:usr\/)?bin\/env\s+(\S+)/u);
|
17785 | if (m1) {
|
17786 | return m1[1];
|
17787 | }
|
17788 | const m2 = firstLine.match(/^#!\/(?:usr\/(?:local\/)?)?bin\/(\S+)/u);
|
17789 | if (m2) {
|
17790 | return m2[1];
|
17791 | }
|
17792 | } finally {
|
17793 | try {
|
17794 | fs6.closeSync(fd);
|
17795 | } catch {
|
17796 | }
|
17797 | }
|
17798 | }
|
17799 | var get_interpreter_default = getInterpreter;
|
17800 |
|
17801 | // src/utils/infer-parser.js
|
17802 | var getFileBasename = (file) => String(file).split(/[/\\]/u).pop();
|
17803 | function getLanguageByFileName(languages2, file) {
|
17804 | if (!file) {
|
17805 | return;
|
17806 | }
|
17807 | const basename = getFileBasename(file).toLowerCase();
|
17808 | return languages2.find(
|
17809 | ({ filenames }) => filenames == null ? void 0 : filenames.some((name) => name.toLowerCase() === basename)
|
17810 | ) ?? languages2.find(
|
17811 | ({ extensions }) => extensions == null ? void 0 : extensions.some((extension) => basename.endsWith(extension))
|
17812 | );
|
17813 | }
|
17814 | function getLanguageByLanguageName(languages2, languageName) {
|
17815 | if (!languageName) {
|
17816 | return;
|
17817 | }
|
17818 | return languages2.find(({ name }) => name.toLowerCase() === languageName) ?? languages2.find(({ aliases }) => aliases == null ? void 0 : aliases.includes(languageName)) ?? languages2.find(({ extensions }) => extensions == null ? void 0 : extensions.includes(`.${languageName}`));
|
17819 | }
|
17820 | function getLanguageByInterpreter(languages2, file) {
|
17821 | if (!file || getFileBasename(file).includes(".")) {
|
17822 | return;
|
17823 | }
|
17824 | const interpreter = get_interpreter_default(file);
|
17825 | if (!interpreter) {
|
17826 | return;
|
17827 | }
|
17828 | return languages2.find(
|
17829 | ({ interpreters }) => interpreters == null ? void 0 : interpreters.includes(interpreter)
|
17830 | );
|
17831 | }
|
17832 | function inferParser(options8, fileInfo) {
|
17833 | const languages2 = options8.plugins.flatMap(
|
17834 | (plugin) => (
|
17835 | // @ts-expect-error -- Safe
|
17836 | plugin.languages ?? []
|
17837 | )
|
17838 | );
|
17839 | const language = getLanguageByLanguageName(languages2, fileInfo.language) ?? getLanguageByFileName(languages2, fileInfo.physicalFile) ?? getLanguageByFileName(languages2, fileInfo.file) ?? getLanguageByInterpreter(languages2, fileInfo.physicalFile);
|
17840 | return language == null ? void 0 : language.parsers[0];
|
17841 | }
|
17842 | var infer_parser_default = inferParser;
|
17843 |
|
17844 | // src/common/get-file-info.js
|
17845 | async function getFileInfo(file, options8) {
|
17846 | if (typeof file !== "string" && !(file instanceof URL)) {
|
17847 | throw new TypeError(
|
17848 | `expect \`file\` to be a string or URL, got \`${typeof file}\``
|
17849 | );
|
17850 | }
|
17851 | let { ignorePath, withNodeModules } = options8;
|
17852 | if (!Array.isArray(ignorePath)) {
|
17853 | ignorePath = [ignorePath];
|
17854 | }
|
17855 | const ignored = await isIgnored(file, { ignorePath, withNodeModules });
|
17856 | let inferredParser;
|
17857 | if (!ignored) {
|
17858 | inferredParser = await getParser(file, options8);
|
17859 | }
|
17860 | return {
|
17861 | ignored,
|
17862 | inferredParser: inferredParser ?? null
|
17863 | };
|
17864 | }
|
17865 | async function getParser(file, options8) {
|
17866 | let config;
|
17867 | if (options8.resolveConfig !== false) {
|
17868 | config = await resolveConfig(file);
|
17869 | }
|
17870 | return (config == null ? void 0 : config.parser) ?? infer_parser_default(options8, { physicalFile: file });
|
17871 | }
|
17872 | var get_file_info_default = getFileInfo;
|
17873 |
|
17874 | // src/common/end-of-line.js
|
17875 | function guessEndOfLine(text) {
|
17876 | const index = text.indexOf("\r");
|
17877 | if (index >= 0) {
|
17878 | return text.charAt(index + 1) === "\n" ? "crlf" : "cr";
|
17879 | }
|
17880 | return "lf";
|
17881 | }
|
17882 | function convertEndOfLineToChars(value) {
|
17883 | switch (value) {
|
17884 | case "cr":
|
17885 | return "\r";
|
17886 | case "crlf":
|
17887 | return "\r\n";
|
17888 | default:
|
17889 | return "\n";
|
17890 | }
|
17891 | }
|
17892 | function countEndOfLineChars(text, eol) {
|
17893 | let regex;
|
17894 | switch (eol) {
|
17895 | case "\n":
|
17896 | regex = /\n/gu;
|
17897 | break;
|
17898 | case "\r":
|
17899 | regex = /\r/gu;
|
17900 | break;
|
17901 | case "\r\n":
|
17902 | regex = /\r\n/gu;
|
17903 | break;
|
17904 | default:
|
17905 | throw new Error(`Unexpected "eol" ${JSON.stringify(eol)}.`);
|
17906 | }
|
17907 | const endOfLines = text.match(regex);
|
17908 | return endOfLines ? endOfLines.length : 0;
|
17909 | }
|
17910 | function normalizeEndOfLine(text) {
|
17911 | return string_replace_all_default(
|
17912 | /* isOptionalObject */
|
17913 | false,
|
17914 | text,
|
17915 | /\r\n?/gu,
|
17916 | "\n"
|
17917 | );
|
17918 | }
|
17919 |
|
17920 | // src/document/constants.js
|
17921 | var DOC_TYPE_STRING = "string";
|
17922 | var DOC_TYPE_ARRAY = "array";
|
17923 | var DOC_TYPE_CURSOR = "cursor";
|
17924 | var DOC_TYPE_INDENT = "indent";
|
17925 | var DOC_TYPE_ALIGN = "align";
|
17926 | var DOC_TYPE_TRIM = "trim";
|
17927 | var DOC_TYPE_GROUP = "group";
|
17928 | var DOC_TYPE_FILL = "fill";
|
17929 | var DOC_TYPE_IF_BREAK = "if-break";
|
17930 | var DOC_TYPE_INDENT_IF_BREAK = "indent-if-break";
|
17931 | var DOC_TYPE_LINE_SUFFIX = "line-suffix";
|
17932 | var DOC_TYPE_LINE_SUFFIX_BOUNDARY = "line-suffix-boundary";
|
17933 | var DOC_TYPE_LINE = "line";
|
17934 | var DOC_TYPE_LABEL = "label";
|
17935 | var DOC_TYPE_BREAK_PARENT = "break-parent";
|
17936 | var VALID_OBJECT_DOC_TYPES = /* @__PURE__ */ new Set([
|
17937 | DOC_TYPE_CURSOR,
|
17938 | DOC_TYPE_INDENT,
|
17939 | DOC_TYPE_ALIGN,
|
17940 | DOC_TYPE_TRIM,
|
17941 | DOC_TYPE_GROUP,
|
17942 | DOC_TYPE_FILL,
|
17943 | DOC_TYPE_IF_BREAK,
|
17944 | DOC_TYPE_INDENT_IF_BREAK,
|
17945 | DOC_TYPE_LINE_SUFFIX,
|
17946 | DOC_TYPE_LINE_SUFFIX_BOUNDARY,
|
17947 | DOC_TYPE_LINE,
|
17948 | DOC_TYPE_LABEL,
|
17949 | DOC_TYPE_BREAK_PARENT
|
17950 | ]);
|
17951 |
|
17952 | // src/document/utils/get-doc-type.js
|
17953 | function getDocType(doc2) {
|
17954 | if (typeof doc2 === "string") {
|
17955 | return DOC_TYPE_STRING;
|
17956 | }
|
17957 | if (Array.isArray(doc2)) {
|
17958 | return DOC_TYPE_ARRAY;
|
17959 | }
|
17960 | if (!doc2) {
|
17961 | return;
|
17962 | }
|
17963 | const { type: type2 } = doc2;
|
17964 | if (VALID_OBJECT_DOC_TYPES.has(type2)) {
|
17965 | return type2;
|
17966 | }
|
17967 | }
|
17968 | var get_doc_type_default = getDocType;
|
17969 |
|
17970 | // src/document/invalid-doc-error.js
|
17971 | var disjunctionListFormat = (list) => new Intl.ListFormat("en-US", { type: "disjunction" }).format(list);
|
17972 | function getDocErrorMessage(doc2) {
|
17973 | const type2 = doc2 === null ? "null" : typeof doc2;
|
17974 | if (type2 !== "string" && type2 !== "object") {
|
17975 | return `Unexpected doc '${type2}',
|
17976 | Expected it to be 'string' or 'object'.`;
|
17977 | }
|
17978 | if (get_doc_type_default(doc2)) {
|
17979 | throw new Error("doc is valid.");
|
17980 | }
|
17981 | const objectType = Object.prototype.toString.call(doc2);
|
17982 | if (objectType !== "[object Object]") {
|
17983 | return `Unexpected doc '${objectType}'.`;
|
17984 | }
|
17985 | const EXPECTED_TYPE_VALUES = disjunctionListFormat(
|
17986 | [...VALID_OBJECT_DOC_TYPES].map((type3) => `'${type3}'`)
|
17987 | );
|
17988 | return `Unexpected doc.type '${doc2.type}'.
|
17989 | Expected it to be ${EXPECTED_TYPE_VALUES}.`;
|
17990 | }
|
17991 | var InvalidDocError = class extends Error {
|
17992 | name = "InvalidDocError";
|
17993 | constructor(doc2) {
|
17994 | super(getDocErrorMessage(doc2));
|
17995 | this.doc = doc2;
|
17996 | }
|
17997 | };
|
17998 | var invalid_doc_error_default = InvalidDocError;
|
17999 |
|
18000 | // src/document/utils/traverse-doc.js
|
18001 | var traverseDocOnExitStackMarker = {};
|
18002 | function traverseDoc(doc2, onEnter, onExit, shouldTraverseConditionalGroups) {
|
18003 | const docsStack = [doc2];
|
18004 | while (docsStack.length > 0) {
|
18005 | const doc3 = docsStack.pop();
|
18006 | if (doc3 === traverseDocOnExitStackMarker) {
|
18007 | onExit(docsStack.pop());
|
18008 | continue;
|
18009 | }
|
18010 | if (onExit) {
|
18011 | docsStack.push(doc3, traverseDocOnExitStackMarker);
|
18012 | }
|
18013 | const docType = get_doc_type_default(doc3);
|
18014 | if (!docType) {
|
18015 | throw new invalid_doc_error_default(doc3);
|
18016 | }
|
18017 | if ((onEnter == null ? void 0 : onEnter(doc3)) === false) {
|
18018 | continue;
|
18019 | }
|
18020 | switch (docType) {
|
18021 | case DOC_TYPE_ARRAY:
|
18022 | case DOC_TYPE_FILL: {
|
18023 | const parts = docType === DOC_TYPE_ARRAY ? doc3 : doc3.parts;
|
18024 | for (let ic = parts.length, i = ic - 1; i >= 0; --i) {
|
18025 | docsStack.push(parts[i]);
|
18026 | }
|
18027 | break;
|
18028 | }
|
18029 | case DOC_TYPE_IF_BREAK:
|
18030 | docsStack.push(doc3.flatContents, doc3.breakContents);
|
18031 | break;
|
18032 | case DOC_TYPE_GROUP:
|
18033 | if (shouldTraverseConditionalGroups && doc3.expandedStates) {
|
18034 | for (let ic = doc3.expandedStates.length, i = ic - 1; i >= 0; --i) {
|
18035 | docsStack.push(doc3.expandedStates[i]);
|
18036 | }
|
18037 | } else {
|
18038 | docsStack.push(doc3.contents);
|
18039 | }
|
18040 | break;
|
18041 | case DOC_TYPE_ALIGN:
|
18042 | case DOC_TYPE_INDENT:
|
18043 | case DOC_TYPE_INDENT_IF_BREAK:
|
18044 | case DOC_TYPE_LABEL:
|
18045 | case DOC_TYPE_LINE_SUFFIX:
|
18046 | docsStack.push(doc3.contents);
|
18047 | break;
|
18048 | case DOC_TYPE_STRING:
|
18049 | case DOC_TYPE_CURSOR:
|
18050 | case DOC_TYPE_TRIM:
|
18051 | case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
|
18052 | case DOC_TYPE_LINE:
|
18053 | case DOC_TYPE_BREAK_PARENT:
|
18054 | break;
|
18055 | default:
|
18056 | throw new invalid_doc_error_default(doc3);
|
18057 | }
|
18058 | }
|
18059 | }
|
18060 | var traverse_doc_default = traverseDoc;
|
18061 |
|
18062 | // src/document/utils/assert-doc.js
|
18063 | var noop = () => {
|
18064 | };
|
18065 | var assertDoc = true ? noop : function(doc2) {
|
18066 | traverse_doc_default(doc2, (doc3) => {
|
18067 | if (checked.has(doc3)) {
|
18068 | return false;
|
18069 | }
|
18070 | if (typeof doc3 !== "string") {
|
18071 | checked.add(doc3);
|
18072 | }
|
18073 | });
|
18074 | };
|
18075 | var assertDocArray = true ? noop : function(docs, optional = false) {
|
18076 | if (optional && !docs) {
|
18077 | return;
|
18078 | }
|
18079 | if (!Array.isArray(docs)) {
|
18080 | throw new TypeError("Unexpected doc array.");
|
18081 | }
|
18082 | for (const doc2 of docs) {
|
18083 | assertDoc(doc2);
|
18084 | }
|
18085 | };
|
18086 |
|
18087 | // src/document/builders.js
|
18088 | function indent(contents) {
|
18089 | assertDoc(contents);
|
18090 | return { type: DOC_TYPE_INDENT, contents };
|
18091 | }
|
18092 | function align(widthOrString, contents) {
|
18093 | assertDoc(contents);
|
18094 | return { type: DOC_TYPE_ALIGN, contents, n: widthOrString };
|
18095 | }
|
18096 | function fill(parts) {
|
18097 | assertDocArray(parts);
|
18098 | return { type: DOC_TYPE_FILL, parts };
|
18099 | }
|
18100 | function lineSuffix(contents) {
|
18101 | assertDoc(contents);
|
18102 | return { type: DOC_TYPE_LINE_SUFFIX, contents };
|
18103 | }
|
18104 | var breakParent = { type: DOC_TYPE_BREAK_PARENT };
|
18105 | var hardlineWithoutBreakParent = { type: DOC_TYPE_LINE, hard: true };
|
18106 | var line2 = { type: DOC_TYPE_LINE };
|
18107 | var hardline = [hardlineWithoutBreakParent, breakParent];
|
18108 | var cursor = { type: DOC_TYPE_CURSOR };
|
18109 | function addAlignmentToDoc(doc2, size, tabWidth) {
|
18110 | assertDoc(doc2);
|
18111 | let aligned = doc2;
|
18112 | if (size > 0) {
|
18113 | for (let i = 0; i < Math.floor(size / tabWidth); ++i) {
|
18114 | aligned = indent(aligned);
|
18115 | }
|
18116 | aligned = align(size % tabWidth, aligned);
|
18117 | aligned = align(Number.NEGATIVE_INFINITY, aligned);
|
18118 | }
|
18119 | return aligned;
|
18120 | }
|
18121 |
|
18122 | // src/document/debug.js
|
18123 | function flattenDoc(doc2) {
|
18124 | var _a;
|
18125 | if (!doc2) {
|
18126 | return "";
|
18127 | }
|
18128 | if (Array.isArray(doc2)) {
|
18129 | const res = [];
|
18130 | for (const part of doc2) {
|
18131 | if (Array.isArray(part)) {
|
18132 | res.push(...flattenDoc(part));
|
18133 | } else {
|
18134 | const flattened = flattenDoc(part);
|
18135 | if (flattened !== "") {
|
18136 | res.push(flattened);
|
18137 | }
|
18138 | }
|
18139 | }
|
18140 | return res;
|
18141 | }
|
18142 | if (doc2.type === DOC_TYPE_IF_BREAK) {
|
18143 | return {
|
18144 | ...doc2,
|
18145 | breakContents: flattenDoc(doc2.breakContents),
|
18146 | flatContents: flattenDoc(doc2.flatContents)
|
18147 | };
|
18148 | }
|
18149 | if (doc2.type === DOC_TYPE_GROUP) {
|
18150 | return {
|
18151 | ...doc2,
|
18152 | contents: flattenDoc(doc2.contents),
|
18153 | expandedStates: (_a = doc2.expandedStates) == null ? void 0 : _a.map(flattenDoc)
|
18154 | };
|
18155 | }
|
18156 | if (doc2.type === DOC_TYPE_FILL) {
|
18157 | return { type: "fill", parts: doc2.parts.map(flattenDoc) };
|
18158 | }
|
18159 | if (doc2.contents) {
|
18160 | return { ...doc2, contents: flattenDoc(doc2.contents) };
|
18161 | }
|
18162 | return doc2;
|
18163 | }
|
18164 | function printDocToDebug(doc2) {
|
18165 | const printedSymbols = /* @__PURE__ */ Object.create(null);
|
18166 | const usedKeysForSymbols = /* @__PURE__ */ new Set();
|
18167 | return printDoc(flattenDoc(doc2));
|
18168 | function printDoc(doc3, index, parentParts) {
|
18169 | var _a, _b;
|
18170 | if (typeof doc3 === "string") {
|
18171 | return JSON.stringify(doc3);
|
18172 | }
|
18173 | if (Array.isArray(doc3)) {
|
18174 | const printed = doc3.map(printDoc).filter(Boolean);
|
18175 | return printed.length === 1 ? printed[0] : `[${printed.join(", ")}]`;
|
18176 | }
|
18177 | if (doc3.type === DOC_TYPE_LINE) {
|
18178 | const withBreakParent = ((_a = parentParts == null ? void 0 : parentParts[index + 1]) == null ? void 0 : _a.type) === DOC_TYPE_BREAK_PARENT;
|
18179 | if (doc3.literal) {
|
18180 | return withBreakParent ? "literalline" : "literallineWithoutBreakParent";
|
18181 | }
|
18182 | if (doc3.hard) {
|
18183 | return withBreakParent ? "hardline" : "hardlineWithoutBreakParent";
|
18184 | }
|
18185 | if (doc3.soft) {
|
18186 | return "softline";
|
18187 | }
|
18188 | return "line";
|
18189 | }
|
18190 | if (doc3.type === DOC_TYPE_BREAK_PARENT) {
|
18191 | const afterHardline = ((_b = parentParts == null ? void 0 : parentParts[index - 1]) == null ? void 0 : _b.type) === DOC_TYPE_LINE && parentParts[index - 1].hard;
|
18192 | return afterHardline ? void 0 : "breakParent";
|
18193 | }
|
18194 | if (doc3.type === DOC_TYPE_TRIM) {
|
18195 | return "trim";
|
18196 | }
|
18197 | if (doc3.type === DOC_TYPE_INDENT) {
|
18198 | return "indent(" + printDoc(doc3.contents) + ")";
|
18199 | }
|
18200 | if (doc3.type === DOC_TYPE_ALIGN) {
|
18201 | return doc3.n === Number.NEGATIVE_INFINITY ? "dedentToRoot(" + printDoc(doc3.contents) + ")" : doc3.n < 0 ? "dedent(" + printDoc(doc3.contents) + ")" : doc3.n.type === "root" ? "markAsRoot(" + printDoc(doc3.contents) + ")" : "align(" + JSON.stringify(doc3.n) + ", " + printDoc(doc3.contents) + ")";
|
18202 | }
|
18203 | if (doc3.type === DOC_TYPE_IF_BREAK) {
|
18204 | return "ifBreak(" + printDoc(doc3.breakContents) + (doc3.flatContents ? ", " + printDoc(doc3.flatContents) : "") + (doc3.groupId ? (!doc3.flatContents ? ', ""' : "") + `, { groupId: ${printGroupId(doc3.groupId)} }` : "") + ")";
|
18205 | }
|
18206 | if (doc3.type === DOC_TYPE_INDENT_IF_BREAK) {
|
18207 | const optionsParts = [];
|
18208 | if (doc3.negate) {
|
18209 | optionsParts.push("negate: true");
|
18210 | }
|
18211 | if (doc3.groupId) {
|
18212 | optionsParts.push(`groupId: ${printGroupId(doc3.groupId)}`);
|
18213 | }
|
18214 | const options8 = optionsParts.length > 0 ? `, { ${optionsParts.join(", ")} }` : "";
|
18215 | return `indentIfBreak(${printDoc(doc3.contents)}${options8})`;
|
18216 | }
|
18217 | if (doc3.type === DOC_TYPE_GROUP) {
|
18218 | const optionsParts = [];
|
18219 | if (doc3.break && doc3.break !== "propagated") {
|
18220 | optionsParts.push("shouldBreak: true");
|
18221 | }
|
18222 | if (doc3.id) {
|
18223 | optionsParts.push(`id: ${printGroupId(doc3.id)}`);
|
18224 | }
|
18225 | const options8 = optionsParts.length > 0 ? `, { ${optionsParts.join(", ")} }` : "";
|
18226 | if (doc3.expandedStates) {
|
18227 | return `conditionalGroup([${doc3.expandedStates.map((part) => printDoc(part)).join(",")}]${options8})`;
|
18228 | }
|
18229 | return `group(${printDoc(doc3.contents)}${options8})`;
|
18230 | }
|
18231 | if (doc3.type === DOC_TYPE_FILL) {
|
18232 | return `fill([${doc3.parts.map((part) => printDoc(part)).join(", ")}])`;
|
18233 | }
|
18234 | if (doc3.type === DOC_TYPE_LINE_SUFFIX) {
|
18235 | return "lineSuffix(" + printDoc(doc3.contents) + ")";
|
18236 | }
|
18237 | if (doc3.type === DOC_TYPE_LINE_SUFFIX_BOUNDARY) {
|
18238 | return "lineSuffixBoundary";
|
18239 | }
|
18240 | if (doc3.type === DOC_TYPE_LABEL) {
|
18241 | return `label(${JSON.stringify(doc3.label)}, ${printDoc(doc3.contents)})`;
|
18242 | }
|
18243 | throw new Error("Unknown doc type " + doc3.type);
|
18244 | }
|
18245 | function printGroupId(id) {
|
18246 | if (typeof id !== "symbol") {
|
18247 | return JSON.stringify(String(id));
|
18248 | }
|
18249 | if (id in printedSymbols) {
|
18250 | return printedSymbols[id];
|
18251 | }
|
18252 | const prefix = id.description || "symbol";
|
18253 | for (let counter = 0; ; counter++) {
|
18254 | const key2 = prefix + (counter > 0 ? ` #${counter}` : "");
|
18255 | if (!usedKeysForSymbols.has(key2)) {
|
18256 | usedKeysForSymbols.add(key2);
|
18257 | return printedSymbols[id] = `Symbol.for(${JSON.stringify(key2)})`;
|
18258 | }
|
18259 | }
|
18260 | }
|
18261 | }
|
18262 |
|
18263 | // scripts/build/shims/at.js
|
18264 | var at = (isOptionalObject, object, index) => {
|
18265 | if (isOptionalObject && (object === void 0 || object === null)) {
|
18266 | return;
|
18267 | }
|
18268 | if (Array.isArray(object) || typeof object === "string") {
|
18269 | return object[index < 0 ? object.length + index : index];
|
18270 | }
|
18271 | return object.at(index);
|
18272 | };
|
18273 | var at_default = at;
|
18274 |
|
18275 | // node_modules/emoji-regex/index.mjs
|
18276 | var emoji_regex_default = () => {
|
18277 | return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC2\uDECE-\uDEDB\uDEE0-\uDEE8]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
18278 | };
|
18279 |
|
18280 | // node_modules/get-east-asian-width/lookup.js
|
18281 | function isFullWidth(x) {
|
18282 | return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
18283 | }
|
18284 | function isWide(x) {
|
18285 | return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9800 && x <= 9811 || x === 9855 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 19968 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101632 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129672 || x >= 129680 && x <= 129725 || x >= 129727 && x <= 129733 || x >= 129742 && x <= 129755 || x >= 129760 && x <= 129768 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
18286 | }
|
18287 |
|
18288 | // node_modules/get-east-asian-width/index.js
|
18289 | var _isNarrowWidth = (codePoint) => !(isFullWidth(codePoint) || isWide(codePoint));
|
18290 |
|
18291 | // src/utils/get-string-width.js
|
18292 | var notAsciiRegex = /[^\x20-\x7F]/u;
|
18293 | function getStringWidth(text) {
|
18294 | if (!text) {
|
18295 | return 0;
|
18296 | }
|
18297 | if (!notAsciiRegex.test(text)) {
|
18298 | return text.length;
|
18299 | }
|
18300 | text = text.replace(emoji_regex_default(), " ");
|
18301 | let width = 0;
|
18302 | for (const character of text) {
|
18303 | const codePoint = character.codePointAt(0);
|
18304 | if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
|
18305 | continue;
|
18306 | }
|
18307 | if (codePoint >= 768 && codePoint <= 879) {
|
18308 | continue;
|
18309 | }
|
18310 | width += _isNarrowWidth(codePoint) ? 1 : 2;
|
18311 | }
|
18312 | return width;
|
18313 | }
|
18314 | var get_string_width_default = getStringWidth;
|
18315 |
|
18316 | // src/document/utils.js
|
18317 | function mapDoc(doc2, cb) {
|
18318 | if (typeof doc2 === "string") {
|
18319 | return cb(doc2);
|
18320 | }
|
18321 | const mapped = /* @__PURE__ */ new Map();
|
18322 | return rec(doc2);
|
18323 | function rec(doc3) {
|
18324 | if (mapped.has(doc3)) {
|
18325 | return mapped.get(doc3);
|
18326 | }
|
18327 | const result = process4(doc3);
|
18328 | mapped.set(doc3, result);
|
18329 | return result;
|
18330 | }
|
18331 | function process4(doc3) {
|
18332 | switch (get_doc_type_default(doc3)) {
|
18333 | case DOC_TYPE_ARRAY:
|
18334 | return cb(doc3.map(rec));
|
18335 | case DOC_TYPE_FILL:
|
18336 | return cb({
|
18337 | ...doc3,
|
18338 | parts: doc3.parts.map(rec)
|
18339 | });
|
18340 | case DOC_TYPE_IF_BREAK:
|
18341 | return cb({
|
18342 | ...doc3,
|
18343 | breakContents: rec(doc3.breakContents),
|
18344 | flatContents: rec(doc3.flatContents)
|
18345 | });
|
18346 | case DOC_TYPE_GROUP: {
|
18347 | let {
|
18348 | expandedStates,
|
18349 | contents
|
18350 | } = doc3;
|
18351 | if (expandedStates) {
|
18352 | expandedStates = expandedStates.map(rec);
|
18353 | contents = expandedStates[0];
|
18354 | } else {
|
18355 | contents = rec(contents);
|
18356 | }
|
18357 | return cb({
|
18358 | ...doc3,
|
18359 | contents,
|
18360 | expandedStates
|
18361 | });
|
18362 | }
|
18363 | case DOC_TYPE_ALIGN:
|
18364 | case DOC_TYPE_INDENT:
|
18365 | case DOC_TYPE_INDENT_IF_BREAK:
|
18366 | case DOC_TYPE_LABEL:
|
18367 | case DOC_TYPE_LINE_SUFFIX:
|
18368 | return cb({
|
18369 | ...doc3,
|
18370 | contents: rec(doc3.contents)
|
18371 | });
|
18372 | case DOC_TYPE_STRING:
|
18373 | case DOC_TYPE_CURSOR:
|
18374 | case DOC_TYPE_TRIM:
|
18375 | case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
|
18376 | case DOC_TYPE_LINE:
|
18377 | case DOC_TYPE_BREAK_PARENT:
|
18378 | return cb(doc3);
|
18379 | default:
|
18380 | throw new invalid_doc_error_default(doc3);
|
18381 | }
|
18382 | }
|
18383 | }
|
18384 | function breakParentGroup(groupStack) {
|
18385 | if (groupStack.length > 0) {
|
18386 | const parentGroup = at_default(
|
18387 | /* isOptionalObject */
|
18388 | false,
|
18389 | groupStack,
|
18390 | -1
|
18391 | );
|
18392 | if (!parentGroup.expandedStates && !parentGroup.break) {
|
18393 | parentGroup.break = "propagated";
|
18394 | }
|
18395 | }
|
18396 | return null;
|
18397 | }
|
18398 | function propagateBreaks(doc2) {
|
18399 | const alreadyVisitedSet = /* @__PURE__ */ new Set();
|
18400 | const groupStack = [];
|
18401 | function propagateBreaksOnEnterFn(doc3) {
|
18402 | if (doc3.type === DOC_TYPE_BREAK_PARENT) {
|
18403 | breakParentGroup(groupStack);
|
18404 | }
|
18405 | if (doc3.type === DOC_TYPE_GROUP) {
|
18406 | groupStack.push(doc3);
|
18407 | if (alreadyVisitedSet.has(doc3)) {
|
18408 | return false;
|
18409 | }
|
18410 | alreadyVisitedSet.add(doc3);
|
18411 | }
|
18412 | }
|
18413 | function propagateBreaksOnExitFn(doc3) {
|
18414 | if (doc3.type === DOC_TYPE_GROUP) {
|
18415 | const group = groupStack.pop();
|
18416 | if (group.break) {
|
18417 | breakParentGroup(groupStack);
|
18418 | }
|
18419 | }
|
18420 | }
|
18421 | traverse_doc_default(
|
18422 | doc2,
|
18423 | propagateBreaksOnEnterFn,
|
18424 | propagateBreaksOnExitFn,
|
18425 | /* shouldTraverseConditionalGroups */
|
18426 | true
|
18427 | );
|
18428 | }
|
18429 | function stripTrailingHardlineFromParts(parts) {
|
18430 | parts = [...parts];
|
18431 | while (parts.length >= 2 && at_default(
|
18432 | /* isOptionalObject */
|
18433 | false,
|
18434 | parts,
|
18435 | -2
|
18436 | ).type === DOC_TYPE_LINE && at_default(
|
18437 | /* isOptionalObject */
|
18438 | false,
|
18439 | parts,
|
18440 | -1
|
18441 | ).type === DOC_TYPE_BREAK_PARENT) {
|
18442 | parts.length -= 2;
|
18443 | }
|
18444 | if (parts.length > 0) {
|
18445 | const lastPart = stripTrailingHardlineFromDoc(at_default(
|
18446 | /* isOptionalObject */
|
18447 | false,
|
18448 | parts,
|
18449 | -1
|
18450 | ));
|
18451 | parts[parts.length - 1] = lastPart;
|
18452 | }
|
18453 | return parts;
|
18454 | }
|
18455 | function stripTrailingHardlineFromDoc(doc2) {
|
18456 | switch (get_doc_type_default(doc2)) {
|
18457 | case DOC_TYPE_INDENT:
|
18458 | case DOC_TYPE_INDENT_IF_BREAK:
|
18459 | case DOC_TYPE_GROUP:
|
18460 | case DOC_TYPE_LINE_SUFFIX:
|
18461 | case DOC_TYPE_LABEL: {
|
18462 | const contents = stripTrailingHardlineFromDoc(doc2.contents);
|
18463 | return {
|
18464 | ...doc2,
|
18465 | contents
|
18466 | };
|
18467 | }
|
18468 | case DOC_TYPE_IF_BREAK:
|
18469 | return {
|
18470 | ...doc2,
|
18471 | breakContents: stripTrailingHardlineFromDoc(doc2.breakContents),
|
18472 | flatContents: stripTrailingHardlineFromDoc(doc2.flatContents)
|
18473 | };
|
18474 | case DOC_TYPE_FILL:
|
18475 | return {
|
18476 | ...doc2,
|
18477 | parts: stripTrailingHardlineFromParts(doc2.parts)
|
18478 | };
|
18479 | case DOC_TYPE_ARRAY:
|
18480 | return stripTrailingHardlineFromParts(doc2);
|
18481 | case DOC_TYPE_STRING:
|
18482 | return doc2.replace(/[\n\r]*$/u, "");
|
18483 | case DOC_TYPE_ALIGN:
|
18484 | case DOC_TYPE_CURSOR:
|
18485 | case DOC_TYPE_TRIM:
|
18486 | case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
|
18487 | case DOC_TYPE_LINE:
|
18488 | case DOC_TYPE_BREAK_PARENT:
|
18489 | break;
|
18490 | default:
|
18491 | throw new invalid_doc_error_default(doc2);
|
18492 | }
|
18493 | return doc2;
|
18494 | }
|
18495 | function stripTrailingHardline(doc2) {
|
18496 | return stripTrailingHardlineFromDoc(cleanDoc(doc2));
|
18497 | }
|
18498 | function cleanDocFn(doc2) {
|
18499 | switch (get_doc_type_default(doc2)) {
|
18500 | case DOC_TYPE_FILL:
|
18501 | if (doc2.parts.every((part) => part === "")) {
|
18502 | return "";
|
18503 | }
|
18504 | break;
|
18505 | case DOC_TYPE_GROUP:
|
18506 | if (!doc2.contents && !doc2.id && !doc2.break && !doc2.expandedStates) {
|
18507 | return "";
|
18508 | }
|
18509 | if (doc2.contents.type === DOC_TYPE_GROUP && doc2.contents.id === doc2.id && doc2.contents.break === doc2.break && doc2.contents.expandedStates === doc2.expandedStates) {
|
18510 | return doc2.contents;
|
18511 | }
|
18512 | break;
|
18513 | case DOC_TYPE_ALIGN:
|
18514 | case DOC_TYPE_INDENT:
|
18515 | case DOC_TYPE_INDENT_IF_BREAK:
|
18516 | case DOC_TYPE_LINE_SUFFIX:
|
18517 | if (!doc2.contents) {
|
18518 | return "";
|
18519 | }
|
18520 | break;
|
18521 | case DOC_TYPE_IF_BREAK:
|
18522 | if (!doc2.flatContents && !doc2.breakContents) {
|
18523 | return "";
|
18524 | }
|
18525 | break;
|
18526 | case DOC_TYPE_ARRAY: {
|
18527 | const parts = [];
|
18528 | for (const part of doc2) {
|
18529 | if (!part) {
|
18530 | continue;
|
18531 | }
|
18532 | const [currentPart, ...restParts] = Array.isArray(part) ? part : [part];
|
18533 | if (typeof currentPart === "string" && typeof at_default(
|
18534 | /* isOptionalObject */
|
18535 | false,
|
18536 | parts,
|
18537 | -1
|
18538 | ) === "string") {
|
18539 | parts[parts.length - 1] += currentPart;
|
18540 | } else {
|
18541 | parts.push(currentPart);
|
18542 | }
|
18543 | parts.push(...restParts);
|
18544 | }
|
18545 | if (parts.length === 0) {
|
18546 | return "";
|
18547 | }
|
18548 | if (parts.length === 1) {
|
18549 | return parts[0];
|
18550 | }
|
18551 | return parts;
|
18552 | }
|
18553 | case DOC_TYPE_STRING:
|
18554 | case DOC_TYPE_CURSOR:
|
18555 | case DOC_TYPE_TRIM:
|
18556 | case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
|
18557 | case DOC_TYPE_LINE:
|
18558 | case DOC_TYPE_LABEL:
|
18559 | case DOC_TYPE_BREAK_PARENT:
|
18560 | break;
|
18561 | default:
|
18562 | throw new invalid_doc_error_default(doc2);
|
18563 | }
|
18564 | return doc2;
|
18565 | }
|
18566 | function cleanDoc(doc2) {
|
18567 | return mapDoc(doc2, (currentDoc) => cleanDocFn(currentDoc));
|
18568 | }
|
18569 | function inheritLabel(doc2, fn) {
|
18570 | return doc2.type === DOC_TYPE_LABEL ? {
|
18571 | ...doc2,
|
18572 | contents: fn(doc2.contents)
|
18573 | } : fn(doc2);
|
18574 | }
|
18575 |
|
18576 | // src/document/printer.js
|
18577 | var MODE_BREAK = Symbol("MODE_BREAK");
|
18578 | var MODE_FLAT = Symbol("MODE_FLAT");
|
18579 | var CURSOR_PLACEHOLDER = Symbol("cursor");
|
18580 | function rootIndent() {
|
18581 | return {
|
18582 | value: "",
|
18583 | length: 0,
|
18584 | queue: []
|
18585 | };
|
18586 | }
|
18587 | function makeIndent(ind, options8) {
|
18588 | return generateInd(ind, {
|
18589 | type: "indent"
|
18590 | }, options8);
|
18591 | }
|
18592 | function makeAlign(indent2, widthOrDoc, options8) {
|
18593 | if (widthOrDoc === Number.NEGATIVE_INFINITY) {
|
18594 | return indent2.root || rootIndent();
|
18595 | }
|
18596 | if (widthOrDoc < 0) {
|
18597 | return generateInd(indent2, {
|
18598 | type: "dedent"
|
18599 | }, options8);
|
18600 | }
|
18601 | if (!widthOrDoc) {
|
18602 | return indent2;
|
18603 | }
|
18604 | if (widthOrDoc.type === "root") {
|
18605 | return {
|
18606 | ...indent2,
|
18607 | root: indent2
|
18608 | };
|
18609 | }
|
18610 | const alignType = typeof widthOrDoc === "string" ? "stringAlign" : "numberAlign";
|
18611 | return generateInd(indent2, {
|
18612 | type: alignType,
|
18613 | n: widthOrDoc
|
18614 | }, options8);
|
18615 | }
|
18616 | function generateInd(ind, newPart, options8) {
|
18617 | const queue = newPart.type === "dedent" ? ind.queue.slice(0, -1) : [...ind.queue, newPart];
|
18618 | let value = "";
|
18619 | let length = 0;
|
18620 | let lastTabs = 0;
|
18621 | let lastSpaces = 0;
|
18622 | for (const part of queue) {
|
18623 | switch (part.type) {
|
18624 | case "indent":
|
18625 | flush();
|
18626 | if (options8.useTabs) {
|
18627 | addTabs(1);
|
18628 | } else {
|
18629 | addSpaces(options8.tabWidth);
|
18630 | }
|
18631 | break;
|
18632 | case "stringAlign":
|
18633 | flush();
|
18634 | value += part.n;
|
18635 | length += part.n.length;
|
18636 | break;
|
18637 | case "numberAlign":
|
18638 | lastTabs += 1;
|
18639 | lastSpaces += part.n;
|
18640 | break;
|
18641 | default:
|
18642 | throw new Error(`Unexpected type '${part.type}'`);
|
18643 | }
|
18644 | }
|
18645 | flushSpaces();
|
18646 | return {
|
18647 | ...ind,
|
18648 | value,
|
18649 | length,
|
18650 | queue
|
18651 | };
|
18652 | function addTabs(count) {
|
18653 | value += " ".repeat(count);
|
18654 | length += options8.tabWidth * count;
|
18655 | }
|
18656 | function addSpaces(count) {
|
18657 | value += " ".repeat(count);
|
18658 | length += count;
|
18659 | }
|
18660 | function flush() {
|
18661 | if (options8.useTabs) {
|
18662 | flushTabs();
|
18663 | } else {
|
18664 | flushSpaces();
|
18665 | }
|
18666 | }
|
18667 | function flushTabs() {
|
18668 | if (lastTabs > 0) {
|
18669 | addTabs(lastTabs);
|
18670 | }
|
18671 | resetLast();
|
18672 | }
|
18673 | function flushSpaces() {
|
18674 | if (lastSpaces > 0) {
|
18675 | addSpaces(lastSpaces);
|
18676 | }
|
18677 | resetLast();
|
18678 | }
|
18679 | function resetLast() {
|
18680 | lastTabs = 0;
|
18681 | lastSpaces = 0;
|
18682 | }
|
18683 | }
|
18684 | function trim(out) {
|
18685 | let trimCount = 0;
|
18686 | let cursorCount = 0;
|
18687 | let outIndex = out.length;
|
18688 | outer: while (outIndex--) {
|
18689 | const last = out[outIndex];
|
18690 | if (last === CURSOR_PLACEHOLDER) {
|
18691 | cursorCount++;
|
18692 | continue;
|
18693 | }
|
18694 | if (false) {
|
18695 | throw new Error(`Unexpected value in trim: '${typeof last}'`);
|
18696 | }
|
18697 | for (let charIndex = last.length - 1; charIndex >= 0; charIndex--) {
|
18698 | const char = last[charIndex];
|
18699 | if (char === " " || char === " ") {
|
18700 | trimCount++;
|
18701 | } else {
|
18702 | out[outIndex] = last.slice(0, charIndex + 1);
|
18703 | break outer;
|
18704 | }
|
18705 | }
|
18706 | }
|
18707 | if (trimCount > 0 || cursorCount > 0) {
|
18708 | out.length = outIndex + 1;
|
18709 | while (cursorCount-- > 0) {
|
18710 | out.push(CURSOR_PLACEHOLDER);
|
18711 | }
|
18712 | }
|
18713 | return trimCount;
|
18714 | }
|
18715 | function fits(next, restCommands, width, hasLineSuffix, groupModeMap, mustBeFlat) {
|
18716 | if (width === Number.POSITIVE_INFINITY) {
|
18717 | return true;
|
18718 | }
|
18719 | let restIdx = restCommands.length;
|
18720 | const cmds = [next];
|
18721 | const out = [];
|
18722 | while (width >= 0) {
|
18723 | if (cmds.length === 0) {
|
18724 | if (restIdx === 0) {
|
18725 | return true;
|
18726 | }
|
18727 | cmds.push(restCommands[--restIdx]);
|
18728 | continue;
|
18729 | }
|
18730 | const {
|
18731 | mode,
|
18732 | doc: doc2
|
18733 | } = cmds.pop();
|
18734 | const docType = get_doc_type_default(doc2);
|
18735 | switch (docType) {
|
18736 | case DOC_TYPE_STRING:
|
18737 | out.push(doc2);
|
18738 | width -= get_string_width_default(doc2);
|
18739 | break;
|
18740 | case DOC_TYPE_ARRAY:
|
18741 | case DOC_TYPE_FILL: {
|
18742 | const parts = docType === DOC_TYPE_ARRAY ? doc2 : doc2.parts;
|
18743 | for (let i = parts.length - 1; i >= 0; i--) {
|
18744 | cmds.push({
|
18745 | mode,
|
18746 | doc: parts[i]
|
18747 | });
|
18748 | }
|
18749 | break;
|
18750 | }
|
18751 | case DOC_TYPE_INDENT:
|
18752 | case DOC_TYPE_ALIGN:
|
18753 | case DOC_TYPE_INDENT_IF_BREAK:
|
18754 | case DOC_TYPE_LABEL:
|
18755 | cmds.push({
|
18756 | mode,
|
18757 | doc: doc2.contents
|
18758 | });
|
18759 | break;
|
18760 | case DOC_TYPE_TRIM:
|
18761 | width += trim(out);
|
18762 | break;
|
18763 | case DOC_TYPE_GROUP: {
|
18764 | if (mustBeFlat && doc2.break) {
|
18765 | return false;
|
18766 | }
|
18767 | const groupMode = doc2.break ? MODE_BREAK : mode;
|
18768 | const contents = doc2.expandedStates && groupMode === MODE_BREAK ? at_default(
|
18769 | /* isOptionalObject */
|
18770 | false,
|
18771 | doc2.expandedStates,
|
18772 | -1
|
18773 | ) : doc2.contents;
|
18774 | cmds.push({
|
18775 | mode: groupMode,
|
18776 | doc: contents
|
18777 | });
|
18778 | break;
|
18779 | }
|
18780 | case DOC_TYPE_IF_BREAK: {
|
18781 | const groupMode = doc2.groupId ? groupModeMap[doc2.groupId] || MODE_FLAT : mode;
|
18782 | const contents = groupMode === MODE_BREAK ? doc2.breakContents : doc2.flatContents;
|
18783 | if (contents) {
|
18784 | cmds.push({
|
18785 | mode,
|
18786 | doc: contents
|
18787 | });
|
18788 | }
|
18789 | break;
|
18790 | }
|
18791 | case DOC_TYPE_LINE:
|
18792 | if (mode === MODE_BREAK || doc2.hard) {
|
18793 | return true;
|
18794 | }
|
18795 | if (!doc2.soft) {
|
18796 | out.push(" ");
|
18797 | width--;
|
18798 | }
|
18799 | break;
|
18800 | case DOC_TYPE_LINE_SUFFIX:
|
18801 | hasLineSuffix = true;
|
18802 | break;
|
18803 | case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
|
18804 | if (hasLineSuffix) {
|
18805 | return false;
|
18806 | }
|
18807 | break;
|
18808 | }
|
18809 | }
|
18810 | return false;
|
18811 | }
|
18812 | function printDocToString(doc2, options8) {
|
18813 | const groupModeMap = {};
|
18814 | const width = options8.printWidth;
|
18815 | const newLine = convertEndOfLineToChars(options8.endOfLine);
|
18816 | let pos2 = 0;
|
18817 | const cmds = [{
|
18818 | ind: rootIndent(),
|
18819 | mode: MODE_BREAK,
|
18820 | doc: doc2
|
18821 | }];
|
18822 | const out = [];
|
18823 | let shouldRemeasure = false;
|
18824 | const lineSuffix2 = [];
|
18825 | let printedCursorCount = 0;
|
18826 | propagateBreaks(doc2);
|
18827 | while (cmds.length > 0) {
|
18828 | const {
|
18829 | ind,
|
18830 | mode,
|
18831 | doc: doc3
|
18832 | } = cmds.pop();
|
18833 | switch (get_doc_type_default(doc3)) {
|
18834 | case DOC_TYPE_STRING: {
|
18835 | const formatted = newLine !== "\n" ? string_replace_all_default(
|
18836 | /* isOptionalObject */
|
18837 | false,
|
18838 | doc3,
|
18839 | "\n",
|
18840 | newLine
|
18841 | ) : doc3;
|
18842 | out.push(formatted);
|
18843 | if (cmds.length > 0) {
|
18844 | pos2 += get_string_width_default(formatted);
|
18845 | }
|
18846 | break;
|
18847 | }
|
18848 | case DOC_TYPE_ARRAY:
|
18849 | for (let i = doc3.length - 1; i >= 0; i--) {
|
18850 | cmds.push({
|
18851 | ind,
|
18852 | mode,
|
18853 | doc: doc3[i]
|
18854 | });
|
18855 | }
|
18856 | break;
|
18857 | case DOC_TYPE_CURSOR:
|
18858 | if (printedCursorCount >= 2) {
|
18859 | throw new Error("There are too many 'cursor' in doc.");
|
18860 | }
|
18861 | out.push(CURSOR_PLACEHOLDER);
|
18862 | printedCursorCount++;
|
18863 | break;
|
18864 | case DOC_TYPE_INDENT:
|
18865 | cmds.push({
|
18866 | ind: makeIndent(ind, options8),
|
18867 | mode,
|
18868 | doc: doc3.contents
|
18869 | });
|
18870 | break;
|
18871 | case DOC_TYPE_ALIGN:
|
18872 | cmds.push({
|
18873 | ind: makeAlign(ind, doc3.n, options8),
|
18874 | mode,
|
18875 | doc: doc3.contents
|
18876 | });
|
18877 | break;
|
18878 | case DOC_TYPE_TRIM:
|
18879 | pos2 -= trim(out);
|
18880 | break;
|
18881 | case DOC_TYPE_GROUP:
|
18882 | switch (mode) {
|
18883 | case MODE_FLAT:
|
18884 | if (!shouldRemeasure) {
|
18885 | cmds.push({
|
18886 | ind,
|
18887 | mode: doc3.break ? MODE_BREAK : MODE_FLAT,
|
18888 | doc: doc3.contents
|
18889 | });
|
18890 | break;
|
18891 | }
|
18892 | case MODE_BREAK: {
|
18893 | shouldRemeasure = false;
|
18894 | const next = {
|
18895 | ind,
|
18896 | mode: MODE_FLAT,
|
18897 | doc: doc3.contents
|
18898 | };
|
18899 | const rem = width - pos2;
|
18900 | const hasLineSuffix = lineSuffix2.length > 0;
|
18901 | if (!doc3.break && fits(next, cmds, rem, hasLineSuffix, groupModeMap)) {
|
18902 | cmds.push(next);
|
18903 | } else {
|
18904 | if (doc3.expandedStates) {
|
18905 | const mostExpanded = at_default(
|
18906 | /* isOptionalObject */
|
18907 | false,
|
18908 | doc3.expandedStates,
|
18909 | -1
|
18910 | );
|
18911 | if (doc3.break) {
|
18912 | cmds.push({
|
18913 | ind,
|
18914 | mode: MODE_BREAK,
|
18915 | doc: mostExpanded
|
18916 | });
|
18917 | break;
|
18918 | } else {
|
18919 | for (let i = 1; i < doc3.expandedStates.length + 1; i++) {
|
18920 | if (i >= doc3.expandedStates.length) {
|
18921 | cmds.push({
|
18922 | ind,
|
18923 | mode: MODE_BREAK,
|
18924 | doc: mostExpanded
|
18925 | });
|
18926 | break;
|
18927 | } else {
|
18928 | const state = doc3.expandedStates[i];
|
18929 | const cmd = {
|
18930 | ind,
|
18931 | mode: MODE_FLAT,
|
18932 | doc: state
|
18933 | };
|
18934 | if (fits(cmd, cmds, rem, hasLineSuffix, groupModeMap)) {
|
18935 | cmds.push(cmd);
|
18936 | break;
|
18937 | }
|
18938 | }
|
18939 | }
|
18940 | }
|
18941 | } else {
|
18942 | cmds.push({
|
18943 | ind,
|
18944 | mode: MODE_BREAK,
|
18945 | doc: doc3.contents
|
18946 | });
|
18947 | }
|
18948 | }
|
18949 | break;
|
18950 | }
|
18951 | }
|
18952 | if (doc3.id) {
|
18953 | groupModeMap[doc3.id] = at_default(
|
18954 | /* isOptionalObject */
|
18955 | false,
|
18956 | cmds,
|
18957 | -1
|
18958 | ).mode;
|
18959 | }
|
18960 | break;
|
18961 | case DOC_TYPE_FILL: {
|
18962 | const rem = width - pos2;
|
18963 | const {
|
18964 | parts
|
18965 | } = doc3;
|
18966 | if (parts.length === 0) {
|
18967 | break;
|
18968 | }
|
18969 | const [content, whitespace] = parts;
|
18970 | const contentFlatCmd = {
|
18971 | ind,
|
18972 | mode: MODE_FLAT,
|
18973 | doc: content
|
18974 | };
|
18975 | const contentBreakCmd = {
|
18976 | ind,
|
18977 | mode: MODE_BREAK,
|
18978 | doc: content
|
18979 | };
|
18980 | const contentFits = fits(contentFlatCmd, [], rem, lineSuffix2.length > 0, groupModeMap, true);
|
18981 | if (parts.length === 1) {
|
18982 | if (contentFits) {
|
18983 | cmds.push(contentFlatCmd);
|
18984 | } else {
|
18985 | cmds.push(contentBreakCmd);
|
18986 | }
|
18987 | break;
|
18988 | }
|
18989 | const whitespaceFlatCmd = {
|
18990 | ind,
|
18991 | mode: MODE_FLAT,
|
18992 | doc: whitespace
|
18993 | };
|
18994 | const whitespaceBreakCmd = {
|
18995 | ind,
|
18996 | mode: MODE_BREAK,
|
18997 | doc: whitespace
|
18998 | };
|
18999 | if (parts.length === 2) {
|
19000 | if (contentFits) {
|
19001 | cmds.push(whitespaceFlatCmd, contentFlatCmd);
|
19002 | } else {
|
19003 | cmds.push(whitespaceBreakCmd, contentBreakCmd);
|
19004 | }
|
19005 | break;
|
19006 | }
|
19007 | parts.splice(0, 2);
|
19008 | const remainingCmd = {
|
19009 | ind,
|
19010 | mode,
|
19011 | doc: fill(parts)
|
19012 | };
|
19013 | const secondContent = parts[0];
|
19014 | const firstAndSecondContentFlatCmd = {
|
19015 | ind,
|
19016 | mode: MODE_FLAT,
|
19017 | doc: [content, whitespace, secondContent]
|
19018 | };
|
19019 | const firstAndSecondContentFits = fits(firstAndSecondContentFlatCmd, [], rem, lineSuffix2.length > 0, groupModeMap, true);
|
19020 | if (firstAndSecondContentFits) {
|
19021 | cmds.push(remainingCmd, whitespaceFlatCmd, contentFlatCmd);
|
19022 | } else if (contentFits) {
|
19023 | cmds.push(remainingCmd, whitespaceBreakCmd, contentFlatCmd);
|
19024 | } else {
|
19025 | cmds.push(remainingCmd, whitespaceBreakCmd, contentBreakCmd);
|
19026 | }
|
19027 | break;
|
19028 | }
|
19029 | case DOC_TYPE_IF_BREAK:
|
19030 | case DOC_TYPE_INDENT_IF_BREAK: {
|
19031 | const groupMode = doc3.groupId ? groupModeMap[doc3.groupId] : mode;
|
19032 | if (groupMode === MODE_BREAK) {
|
19033 | const breakContents = doc3.type === DOC_TYPE_IF_BREAK ? doc3.breakContents : doc3.negate ? doc3.contents : indent(doc3.contents);
|
19034 | if (breakContents) {
|
19035 | cmds.push({
|
19036 | ind,
|
19037 | mode,
|
19038 | doc: breakContents
|
19039 | });
|
19040 | }
|
19041 | }
|
19042 | if (groupMode === MODE_FLAT) {
|
19043 | const flatContents = doc3.type === DOC_TYPE_IF_BREAK ? doc3.flatContents : doc3.negate ? indent(doc3.contents) : doc3.contents;
|
19044 | if (flatContents) {
|
19045 | cmds.push({
|
19046 | ind,
|
19047 | mode,
|
19048 | doc: flatContents
|
19049 | });
|
19050 | }
|
19051 | }
|
19052 | break;
|
19053 | }
|
19054 | case DOC_TYPE_LINE_SUFFIX:
|
19055 | lineSuffix2.push({
|
19056 | ind,
|
19057 | mode,
|
19058 | doc: doc3.contents
|
19059 | });
|
19060 | break;
|
19061 | case DOC_TYPE_LINE_SUFFIX_BOUNDARY:
|
19062 | if (lineSuffix2.length > 0) {
|
19063 | cmds.push({
|
19064 | ind,
|
19065 | mode,
|
19066 | doc: hardlineWithoutBreakParent
|
19067 | });
|
19068 | }
|
19069 | break;
|
19070 | case DOC_TYPE_LINE:
|
19071 | switch (mode) {
|
19072 | case MODE_FLAT:
|
19073 | if (!doc3.hard) {
|
19074 | if (!doc3.soft) {
|
19075 | out.push(" ");
|
19076 | pos2 += 1;
|
19077 | }
|
19078 | break;
|
19079 | } else {
|
19080 | shouldRemeasure = true;
|
19081 | }
|
19082 | case MODE_BREAK:
|
19083 | if (lineSuffix2.length > 0) {
|
19084 | cmds.push({
|
19085 | ind,
|
19086 | mode,
|
19087 | doc: doc3
|
19088 | }, ...lineSuffix2.reverse());
|
19089 | lineSuffix2.length = 0;
|
19090 | break;
|
19091 | }
|
19092 | if (doc3.literal) {
|
19093 | if (ind.root) {
|
19094 | out.push(newLine, ind.root.value);
|
19095 | pos2 = ind.root.length;
|
19096 | } else {
|
19097 | out.push(newLine);
|
19098 | pos2 = 0;
|
19099 | }
|
19100 | } else {
|
19101 | pos2 -= trim(out);
|
19102 | out.push(newLine + ind.value);
|
19103 | pos2 = ind.length;
|
19104 | }
|
19105 | break;
|
19106 | }
|
19107 | break;
|
19108 | case DOC_TYPE_LABEL:
|
19109 | cmds.push({
|
19110 | ind,
|
19111 | mode,
|
19112 | doc: doc3.contents
|
19113 | });
|
19114 | break;
|
19115 | case DOC_TYPE_BREAK_PARENT:
|
19116 | break;
|
19117 | default:
|
19118 | throw new invalid_doc_error_default(doc3);
|
19119 | }
|
19120 | if (cmds.length === 0 && lineSuffix2.length > 0) {
|
19121 | cmds.push(...lineSuffix2.reverse());
|
19122 | lineSuffix2.length = 0;
|
19123 | }
|
19124 | }
|
19125 | const cursorPlaceholderIndex = out.indexOf(CURSOR_PLACEHOLDER);
|
19126 | if (cursorPlaceholderIndex !== -1) {
|
19127 | const otherCursorPlaceholderIndex = out.indexOf(CURSOR_PLACEHOLDER, cursorPlaceholderIndex + 1);
|
19128 | const beforeCursor = out.slice(0, cursorPlaceholderIndex).join("");
|
19129 | const aroundCursor = out.slice(cursorPlaceholderIndex + 1, otherCursorPlaceholderIndex).join("");
|
19130 | const afterCursor = out.slice(otherCursorPlaceholderIndex + 1).join("");
|
19131 | return {
|
19132 | formatted: beforeCursor + aroundCursor + afterCursor,
|
19133 | cursorNodeStart: beforeCursor.length,
|
19134 | cursorNodeText: aroundCursor
|
19135 | };
|
19136 | }
|
19137 | return {
|
19138 | formatted: out.join("")
|
19139 | };
|
19140 | }
|
19141 |
|
19142 | // src/utils/get-alignment-size.js
|
19143 | function getAlignmentSize(text, tabWidth, startIndex = 0) {
|
19144 | let size = 0;
|
19145 | for (let i = startIndex; i < text.length; ++i) {
|
19146 | if (text[i] === " ") {
|
19147 | size = size + tabWidth - size % tabWidth;
|
19148 | } else {
|
19149 | size++;
|
19150 | }
|
19151 | }
|
19152 | return size;
|
19153 | }
|
19154 | var get_alignment_size_default = getAlignmentSize;
|
19155 |
|
19156 | // src/common/ast-path.js
|
19157 | var _AstPath_instances, getNodeStackIndex_fn, getAncestors_fn;
|
19158 | var AstPath = class {
|
19159 | constructor(value) {
|
19160 | __privateAdd(this, _AstPath_instances);
|
19161 | this.stack = [value];
|
19162 | }
|
19163 | /** @type {string | null} */
|
19164 | get key() {
|
19165 | const {
|
19166 | stack: stack2,
|
19167 | siblings
|
19168 | } = this;
|
19169 | return at_default(
|
19170 | /* isOptionalObject */
|
19171 | false,
|
19172 | stack2,
|
19173 | siblings === null ? -2 : -4
|
19174 | ) ?? null;
|
19175 | }
|
19176 | /** @type {number | null} */
|
19177 | get index() {
|
19178 | return this.siblings === null ? null : at_default(
|
19179 | /* isOptionalObject */
|
19180 | false,
|
19181 | this.stack,
|
19182 | -2
|
19183 | );
|
19184 | }
|
19185 | /** @type {object} */
|
19186 | get node() {
|
19187 | return at_default(
|
19188 | /* isOptionalObject */
|
19189 | false,
|
19190 | this.stack,
|
19191 | -1
|
19192 | );
|
19193 | }
|
19194 | /** @type {object | null} */
|
19195 | get parent() {
|
19196 | return this.getNode(1);
|
19197 | }
|
19198 | /** @type {object | null} */
|
19199 | get grandparent() {
|
19200 | return this.getNode(2);
|
19201 | }
|
19202 | /** @type {boolean} */
|
19203 | get isInArray() {
|
19204 | return this.siblings !== null;
|
19205 | }
|
19206 | /** @type {object[] | null} */
|
19207 | get siblings() {
|
19208 | const {
|
19209 | stack: stack2
|
19210 | } = this;
|
19211 | const maybeArray = at_default(
|
19212 | /* isOptionalObject */
|
19213 | false,
|
19214 | stack2,
|
19215 | -3
|
19216 | );
|
19217 | return Array.isArray(maybeArray) ? maybeArray : null;
|
19218 | }
|
19219 | /** @type {object | null} */
|
19220 | get next() {
|
19221 | const {
|
19222 | siblings
|
19223 | } = this;
|
19224 | return siblings === null ? null : siblings[this.index + 1];
|
19225 | }
|
19226 | /** @type {object | null} */
|
19227 | get previous() {
|
19228 | const {
|
19229 | siblings
|
19230 | } = this;
|
19231 | return siblings === null ? null : siblings[this.index - 1];
|
19232 | }
|
19233 | /** @type {boolean} */
|
19234 | get isFirst() {
|
19235 | return this.index === 0;
|
19236 | }
|
19237 | /** @type {boolean} */
|
19238 | get isLast() {
|
19239 | const {
|
19240 | siblings,
|
19241 | index
|
19242 | } = this;
|
19243 | return siblings !== null && index === siblings.length - 1;
|
19244 | }
|
19245 | /** @type {boolean} */
|
19246 | get isRoot() {
|
19247 | return this.stack.length === 1;
|
19248 | }
|
19249 | /** @type {object} */
|
19250 | get root() {
|
19251 | return this.stack[0];
|
19252 | }
|
19253 | /** @type {object[]} */
|
19254 | get ancestors() {
|
19255 | return [...__privateMethod(this, _AstPath_instances, getAncestors_fn).call(this)];
|
19256 | }
|
19257 | // The name of the current property is always the penultimate element of
|
19258 | // this.stack, and always a string/number/symbol.
|
19259 | getName() {
|
19260 | const {
|
19261 | stack: stack2
|
19262 | } = this;
|
19263 | const {
|
19264 | length
|
19265 | } = stack2;
|
19266 | if (length > 1) {
|
19267 | return at_default(
|
19268 | /* isOptionalObject */
|
19269 | false,
|
19270 | stack2,
|
19271 | -2
|
19272 | );
|
19273 | }
|
19274 | return null;
|
19275 | }
|
19276 | // The value of the current property is always the final element of
|
19277 | // this.stack.
|
19278 | getValue() {
|
19279 | return at_default(
|
19280 | /* isOptionalObject */
|
19281 | false,
|
19282 | this.stack,
|
19283 | -1
|
19284 | );
|
19285 | }
|
19286 | getNode(count = 0) {
|
19287 | const stackIndex = __privateMethod(this, _AstPath_instances, getNodeStackIndex_fn).call(this, count);
|
19288 | return stackIndex === -1 ? null : this.stack[stackIndex];
|
19289 | }
|
19290 | getParentNode(count = 0) {
|
19291 | return this.getNode(count + 1);
|
19292 | }
|
19293 | // Temporarily push properties named by string arguments given after the
|
19294 | // callback function onto this.stack, then call the callback with a
|
19295 | // reference to this (modified) AstPath object. Note that the stack will
|
19296 | // be restored to its original state after the callback is finished, so it
|
19297 | // is probably a mistake to retain a reference to the path.
|
19298 | call(callback, ...names) {
|
19299 | const {
|
19300 | stack: stack2
|
19301 | } = this;
|
19302 | const {
|
19303 | length
|
19304 | } = stack2;
|
19305 | let value = at_default(
|
19306 | /* isOptionalObject */
|
19307 | false,
|
19308 | stack2,
|
19309 | -1
|
19310 | );
|
19311 | for (const name of names) {
|
19312 | value = value[name];
|
19313 | stack2.push(name, value);
|
19314 | }
|
19315 | try {
|
19316 | return callback(this);
|
19317 | } finally {
|
19318 | stack2.length = length;
|
19319 | }
|
19320 | }
|
19321 | /**
|
19322 | * @template {(path: AstPath) => any} T
|
19323 | * @param {T} callback
|
19324 | * @param {number} [count=0]
|
19325 | * @returns {ReturnType<T>}
|
19326 | */
|
19327 | callParent(callback, count = 0) {
|
19328 | const stackIndex = __privateMethod(this, _AstPath_instances, getNodeStackIndex_fn).call(this, count + 1);
|
19329 | const parentValues = this.stack.splice(stackIndex + 1);
|
19330 | try {
|
19331 | return callback(this);
|
19332 | } finally {
|
19333 | this.stack.push(...parentValues);
|
19334 | }
|
19335 | }
|
19336 | // Similar to AstPath.prototype.call, except that the value obtained by
|
19337 | // accessing this.getValue()[name1][name2]... should be array. The
|
19338 | // callback will be called with a reference to this path object for each
|
19339 | // element of the array.
|
19340 | each(callback, ...names) {
|
19341 | const {
|
19342 | stack: stack2
|
19343 | } = this;
|
19344 | const {
|
19345 | length
|
19346 | } = stack2;
|
19347 | let value = at_default(
|
19348 | /* isOptionalObject */
|
19349 | false,
|
19350 | stack2,
|
19351 | -1
|
19352 | );
|
19353 | for (const name of names) {
|
19354 | value = value[name];
|
19355 | stack2.push(name, value);
|
19356 | }
|
19357 | try {
|
19358 | for (let i = 0; i < value.length; ++i) {
|
19359 | stack2.push(i, value[i]);
|
19360 | callback(this, i, value);
|
19361 | stack2.length -= 2;
|
19362 | }
|
19363 | } finally {
|
19364 | stack2.length = length;
|
19365 | }
|
19366 | }
|
19367 | // Similar to AstPath.prototype.each, except that the results of the
|
19368 | // callback function invocations are stored in an array and returned at
|
19369 | // the end of the iteration.
|
19370 | map(callback, ...names) {
|
19371 | const result = [];
|
19372 | this.each((path13, index, value) => {
|
19373 | result[index] = callback(path13, index, value);
|
19374 | }, ...names);
|
19375 | return result;
|
19376 | }
|
19377 | /**
|
19378 | * @param {...(
|
19379 | * | ((node: any, name: string | null, number: number | null) => boolean)
|
19380 | * | undefined
|
19381 | * )} predicates
|
19382 | */
|
19383 | match(...predicates) {
|
19384 | let stackPointer = this.stack.length - 1;
|
19385 | let name = null;
|
19386 | let node = this.stack[stackPointer--];
|
19387 | for (const predicate of predicates) {
|
19388 | if (node === void 0) {
|
19389 | return false;
|
19390 | }
|
19391 | let number = null;
|
19392 | if (typeof name === "number") {
|
19393 | number = name;
|
19394 | name = this.stack[stackPointer--];
|
19395 | node = this.stack[stackPointer--];
|
19396 | }
|
19397 | if (predicate && !predicate(node, name, number)) {
|
19398 | return false;
|
19399 | }
|
19400 | name = this.stack[stackPointer--];
|
19401 | node = this.stack[stackPointer--];
|
19402 | }
|
19403 | return true;
|
19404 | }
|
19405 | /**
|
19406 | * Traverses the ancestors of the current node heading toward the tree root
|
19407 | * until it finds a node that matches the provided predicate function. Will
|
19408 | * return the first matching ancestor. If no such node exists, returns undefined.
|
19409 | * @param {(node: any) => boolean} predicate
|
19410 | * @internal Unstable API. Don't use in plugins for now.
|
19411 | */
|
19412 | findAncestor(predicate) {
|
19413 | for (const node of __privateMethod(this, _AstPath_instances, getAncestors_fn).call(this)) {
|
19414 | if (predicate(node)) {
|
19415 | return node;
|
19416 | }
|
19417 | }
|
19418 | }
|
19419 | /**
|
19420 | * Traverses the ancestors of the current node heading toward the tree root
|
19421 | * until it finds a node that matches the provided predicate function.
|
19422 | * returns true if matched node found.
|
19423 | * @param {(node: any) => boolean} predicate
|
19424 | * @returns {boolean}
|
19425 | * @internal Unstable API. Don't use in plugins for now.
|
19426 | */
|
19427 | hasAncestor(predicate) {
|
19428 | for (const node of __privateMethod(this, _AstPath_instances, getAncestors_fn).call(this)) {
|
19429 | if (predicate(node)) {
|
19430 | return true;
|
19431 | }
|
19432 | }
|
19433 | return false;
|
19434 | }
|
19435 | };
|
19436 | _AstPath_instances = new WeakSet();
|
19437 | getNodeStackIndex_fn = function(count) {
|
19438 | const {
|
19439 | stack: stack2
|
19440 | } = this;
|
19441 | for (let i = stack2.length - 1; i >= 0; i -= 2) {
|
19442 | if (!Array.isArray(stack2[i]) && --count < 0) {
|
19443 | return i;
|
19444 | }
|
19445 | }
|
19446 | return -1;
|
19447 | };
|
19448 | getAncestors_fn = function* () {
|
19449 | const {
|
19450 | stack: stack2
|
19451 | } = this;
|
19452 | for (let index = stack2.length - 3; index >= 0; index -= 2) {
|
19453 | const value = stack2[index];
|
19454 | if (!Array.isArray(value)) {
|
19455 | yield value;
|
19456 | }
|
19457 | }
|
19458 | };
|
19459 | var ast_path_default = AstPath;
|
19460 |
|
19461 | // src/main/comments/attach.js
|
19462 | import assert4 from "assert";
|
19463 |
|
19464 | // src/utils/is-object.js
|
19465 | function isObject2(object) {
|
19466 | return object !== null && typeof object === "object";
|
19467 | }
|
19468 | var is_object_default = isObject2;
|
19469 |
|
19470 | // src/utils/ast-utils.js
|
19471 | function* getChildren(node, options8) {
|
19472 | const { getVisitorKeys, filter: filter2 = () => true } = options8;
|
19473 | const isMatchedNode = (node2) => is_object_default(node2) && filter2(node2);
|
19474 | for (const key2 of getVisitorKeys(node)) {
|
19475 | const value = node[key2];
|
19476 | if (Array.isArray(value)) {
|
19477 | for (const child of value) {
|
19478 | if (isMatchedNode(child)) {
|
19479 | yield child;
|
19480 | }
|
19481 | }
|
19482 | } else if (isMatchedNode(value)) {
|
19483 | yield value;
|
19484 | }
|
19485 | }
|
19486 | }
|
19487 | function* getDescendants(node, options8) {
|
19488 | const queue = [node];
|
19489 | for (let index = 0; index < queue.length; index++) {
|
19490 | const node2 = queue[index];
|
19491 | for (const child of getChildren(node2, options8)) {
|
19492 | yield child;
|
19493 | queue.push(child);
|
19494 | }
|
19495 | }
|
19496 | }
|
19497 |
|
19498 | // src/utils/skip.js
|
19499 | function skip(characters) {
|
19500 | return (text, startIndex, options8) => {
|
19501 | const backwards = Boolean(options8 == null ? void 0 : options8.backwards);
|
19502 | if (startIndex === false) {
|
19503 | return false;
|
19504 | }
|
19505 | const { length } = text;
|
19506 | let cursor2 = startIndex;
|
19507 | while (cursor2 >= 0 && cursor2 < length) {
|
19508 | const character = text.charAt(cursor2);
|
19509 | if (characters instanceof RegExp) {
|
19510 | if (!characters.test(character)) {
|
19511 | return cursor2;
|
19512 | }
|
19513 | } else if (!characters.includes(character)) {
|
19514 | return cursor2;
|
19515 | }
|
19516 | backwards ? cursor2-- : cursor2++;
|
19517 | }
|
19518 | if (cursor2 === -1 || cursor2 === length) {
|
19519 | return cursor2;
|
19520 | }
|
19521 | return false;
|
19522 | };
|
19523 | }
|
19524 | var skipWhitespace = skip(/\s/u);
|
19525 | var skipSpaces = skip(" ");
|
19526 | var skipToLineEnd = skip(",; ");
|
19527 | var skipEverythingButNewLine = skip(/[^\n\r]/u);
|
19528 |
|
19529 | // src/utils/skip-newline.js
|
19530 | function skipNewline(text, startIndex, options8) {
|
19531 | const backwards = Boolean(options8 == null ? void 0 : options8.backwards);
|
19532 | if (startIndex === false) {
|
19533 | return false;
|
19534 | }
|
19535 | const character = text.charAt(startIndex);
|
19536 | if (backwards) {
|
19537 | if (text.charAt(startIndex - 1) === "\r" && character === "\n") {
|
19538 | return startIndex - 2;
|
19539 | }
|
19540 | if (character === "\n" || character === "\r" || character === "\u2028" || character === "\u2029") {
|
19541 | return startIndex - 1;
|
19542 | }
|
19543 | } else {
|
19544 | if (character === "\r" && text.charAt(startIndex + 1) === "\n") {
|
19545 | return startIndex + 2;
|
19546 | }
|
19547 | if (character === "\n" || character === "\r" || character === "\u2028" || character === "\u2029") {
|
19548 | return startIndex + 1;
|
19549 | }
|
19550 | }
|
19551 | return startIndex;
|
19552 | }
|
19553 | var skip_newline_default = skipNewline;
|
19554 |
|
19555 | // src/utils/has-newline.js
|
19556 | function hasNewline(text, startIndex, options8 = {}) {
|
19557 | const idx = skipSpaces(
|
19558 | text,
|
19559 | options8.backwards ? startIndex - 1 : startIndex,
|
19560 | options8
|
19561 | );
|
19562 | const idx2 = skip_newline_default(text, idx, options8);
|
19563 | return idx !== idx2;
|
19564 | }
|
19565 | var has_newline_default = hasNewline;
|
19566 |
|
19567 | // src/utils/is-non-empty-array.js
|
19568 | function isNonEmptyArray(object) {
|
19569 | return Array.isArray(object) && object.length > 0;
|
19570 | }
|
19571 | var is_non_empty_array_default = isNonEmptyArray;
|
19572 |
|
19573 | // src/main/create-get-visitor-keys-function.js
|
19574 | var nonTraversableKeys = /* @__PURE__ */ new Set([
|
19575 | "tokens",
|
19576 | "comments",
|
19577 | "parent",
|
19578 | "enclosingNode",
|
19579 | "precedingNode",
|
19580 | "followingNode"
|
19581 | ]);
|
19582 | var defaultGetVisitorKeys = (node) => Object.keys(node).filter((key2) => !nonTraversableKeys.has(key2));
|
19583 | function createGetVisitorKeysFunction(printerGetVisitorKeys) {
|
19584 | return printerGetVisitorKeys ? (node) => printerGetVisitorKeys(node, nonTraversableKeys) : defaultGetVisitorKeys;
|
19585 | }
|
19586 | var create_get_visitor_keys_function_default = createGetVisitorKeysFunction;
|
19587 |
|
19588 | // src/main/comments/utils.js
|
19589 | function describeNodeForDebugging(node) {
|
19590 | const nodeType = node.type || node.kind || "(unknown type)";
|
19591 | let nodeName = String(
|
19592 | node.name || node.id && (typeof node.id === "object" ? node.id.name : node.id) || node.key && (typeof node.key === "object" ? node.key.name : node.key) || node.value && (typeof node.value === "object" ? "" : String(node.value)) || node.operator || ""
|
19593 | );
|
19594 | if (nodeName.length > 20) {
|
19595 | nodeName = nodeName.slice(0, 19) + "\u2026";
|
19596 | }
|
19597 | return nodeType + (nodeName ? " " + nodeName : "");
|
19598 | }
|
19599 | function addCommentHelper(node, comment) {
|
19600 | const comments = node.comments ?? (node.comments = []);
|
19601 | comments.push(comment);
|
19602 | comment.printed = false;
|
19603 | comment.nodeDescription = describeNodeForDebugging(node);
|
19604 | }
|
19605 | function addLeadingComment(node, comment) {
|
19606 | comment.leading = true;
|
19607 | comment.trailing = false;
|
19608 | addCommentHelper(node, comment);
|
19609 | }
|
19610 | function addDanglingComment(node, comment, marker) {
|
19611 | comment.leading = false;
|
19612 | comment.trailing = false;
|
19613 | if (marker) {
|
19614 | comment.marker = marker;
|
19615 | }
|
19616 | addCommentHelper(node, comment);
|
19617 | }
|
19618 | function addTrailingComment(node, comment) {
|
19619 | comment.leading = false;
|
19620 | comment.trailing = true;
|
19621 | addCommentHelper(node, comment);
|
19622 | }
|
19623 |
|
19624 | // src/main/comments/attach.js
|
19625 | var childNodesCache = /* @__PURE__ */ new WeakMap();
|
19626 | function getSortedChildNodes(node, options8) {
|
19627 | if (childNodesCache.has(node)) {
|
19628 | return childNodesCache.get(node);
|
19629 | }
|
19630 | const {
|
19631 | printer: {
|
19632 | getCommentChildNodes,
|
19633 | canAttachComment,
|
19634 | getVisitorKeys: printerGetVisitorKeys
|
19635 | },
|
19636 | locStart,
|
19637 | locEnd
|
19638 | } = options8;
|
19639 | if (!canAttachComment) {
|
19640 | return [];
|
19641 | }
|
19642 | const childNodes = ((getCommentChildNodes == null ? void 0 : getCommentChildNodes(node, options8)) ?? [
|
19643 | ...getChildren(node, {
|
19644 | getVisitorKeys: create_get_visitor_keys_function_default(printerGetVisitorKeys)
|
19645 | })
|
19646 | ]).flatMap(
|
19647 | (node2) => canAttachComment(node2) ? [node2] : getSortedChildNodes(node2, options8)
|
19648 | );
|
19649 | childNodes.sort(
|
19650 | (nodeA, nodeB) => locStart(nodeA) - locStart(nodeB) || locEnd(nodeA) - locEnd(nodeB)
|
19651 | );
|
19652 | childNodesCache.set(node, childNodes);
|
19653 | return childNodes;
|
19654 | }
|
19655 | function decorateComment(node, comment, options8, enclosingNode) {
|
19656 | const { locStart, locEnd } = options8;
|
19657 | const commentStart = locStart(comment);
|
19658 | const commentEnd = locEnd(comment);
|
19659 | const childNodes = getSortedChildNodes(node, options8);
|
19660 | let precedingNode;
|
19661 | let followingNode;
|
19662 | let left = 0;
|
19663 | let right = childNodes.length;
|
19664 | while (left < right) {
|
19665 | const middle = left + right >> 1;
|
19666 | const child = childNodes[middle];
|
19667 | const start = locStart(child);
|
19668 | const end = locEnd(child);
|
19669 | if (start <= commentStart && commentEnd <= end) {
|
19670 | return decorateComment(child, comment, options8, child);
|
19671 | }
|
19672 | if (end <= commentStart) {
|
19673 | precedingNode = child;
|
19674 | left = middle + 1;
|
19675 | continue;
|
19676 | }
|
19677 | if (commentEnd <= start) {
|
19678 | followingNode = child;
|
19679 | right = middle;
|
19680 | continue;
|
19681 | }
|
19682 | throw new Error("Comment location overlaps with node location");
|
19683 | }
|
19684 | if ((enclosingNode == null ? void 0 : enclosingNode.type) === "TemplateLiteral") {
|
19685 | const { quasis } = enclosingNode;
|
19686 | const commentIndex = findExpressionIndexForComment(
|
19687 | quasis,
|
19688 | comment,
|
19689 | options8
|
19690 | );
|
19691 | if (precedingNode && findExpressionIndexForComment(quasis, precedingNode, options8) !== commentIndex) {
|
19692 | precedingNode = null;
|
19693 | }
|
19694 | if (followingNode && findExpressionIndexForComment(quasis, followingNode, options8) !== commentIndex) {
|
19695 | followingNode = null;
|
19696 | }
|
19697 | }
|
19698 | return { enclosingNode, precedingNode, followingNode };
|
19699 | }
|
19700 | var returnFalse = () => false;
|
19701 | function attachComments(ast, options8) {
|
19702 | const { comments } = ast;
|
19703 | delete ast.comments;
|
19704 | if (!is_non_empty_array_default(comments) || !options8.printer.canAttachComment) {
|
19705 | return;
|
19706 | }
|
19707 | const tiesToBreak = [];
|
19708 | const {
|
19709 | locStart,
|
19710 | locEnd,
|
19711 | printer: {
|
19712 | experimentalFeatures: {
|
19713 | // TODO: Make this as default behavior
|
19714 | avoidAstMutation = false
|
19715 | } = {},
|
19716 | handleComments = {}
|
19717 | },
|
19718 | originalText: text
|
19719 | } = options8;
|
19720 | const {
|
19721 | ownLine: handleOwnLineComment = returnFalse,
|
19722 | endOfLine: handleEndOfLineComment = returnFalse,
|
19723 | remaining: handleRemainingComment = returnFalse
|
19724 | } = handleComments;
|
19725 | const decoratedComments = comments.map((comment, index) => ({
|
19726 | ...decorateComment(ast, comment, options8),
|
19727 | comment,
|
19728 | text,
|
19729 | options: options8,
|
19730 | ast,
|
19731 | isLastComment: comments.length - 1 === index
|
19732 | }));
|
19733 | for (const [index, context] of decoratedComments.entries()) {
|
19734 | const {
|
19735 | comment,
|
19736 | precedingNode,
|
19737 | enclosingNode,
|
19738 | followingNode,
|
19739 | text: text2,
|
19740 | options: options9,
|
19741 | ast: ast2,
|
19742 | isLastComment
|
19743 | } = context;
|
19744 | if (options9.parser === "json" || options9.parser === "json5" || options9.parser === "jsonc" || options9.parser === "__js_expression" || options9.parser === "__ts_expression" || options9.parser === "__vue_expression" || options9.parser === "__vue_ts_expression") {
|
19745 | if (locStart(comment) - locStart(ast2) <= 0) {
|
19746 | addLeadingComment(ast2, comment);
|
19747 | continue;
|
19748 | }
|
19749 | if (locEnd(comment) - locEnd(ast2) >= 0) {
|
19750 | addTrailingComment(ast2, comment);
|
19751 | continue;
|
19752 | }
|
19753 | }
|
19754 | let args;
|
19755 | if (avoidAstMutation) {
|
19756 | args = [context];
|
19757 | } else {
|
19758 | comment.enclosingNode = enclosingNode;
|
19759 | comment.precedingNode = precedingNode;
|
19760 | comment.followingNode = followingNode;
|
19761 | args = [comment, text2, options9, ast2, isLastComment];
|
19762 | }
|
19763 | if (isOwnLineComment(text2, options9, decoratedComments, index)) {
|
19764 | comment.placement = "ownLine";
|
19765 | if (handleOwnLineComment(...args)) {
|
19766 | } else if (followingNode) {
|
19767 | addLeadingComment(followingNode, comment);
|
19768 | } else if (precedingNode) {
|
19769 | addTrailingComment(precedingNode, comment);
|
19770 | } else if (enclosingNode) {
|
19771 | addDanglingComment(enclosingNode, comment);
|
19772 | } else {
|
19773 | addDanglingComment(ast2, comment);
|
19774 | }
|
19775 | } else if (isEndOfLineComment(text2, options9, decoratedComments, index)) {
|
19776 | comment.placement = "endOfLine";
|
19777 | if (handleEndOfLineComment(...args)) {
|
19778 | } else if (precedingNode) {
|
19779 | addTrailingComment(precedingNode, comment);
|
19780 | } else if (followingNode) {
|
19781 | addLeadingComment(followingNode, comment);
|
19782 | } else if (enclosingNode) {
|
19783 | addDanglingComment(enclosingNode, comment);
|
19784 | } else {
|
19785 | addDanglingComment(ast2, comment);
|
19786 | }
|
19787 | } else {
|
19788 | comment.placement = "remaining";
|
19789 | if (handleRemainingComment(...args)) {
|
19790 | } else if (precedingNode && followingNode) {
|
19791 | const tieCount = tiesToBreak.length;
|
19792 | if (tieCount > 0) {
|
19793 | const lastTie = tiesToBreak[tieCount - 1];
|
19794 | if (lastTie.followingNode !== followingNode) {
|
19795 | breakTies(tiesToBreak, options9);
|
19796 | }
|
19797 | }
|
19798 | tiesToBreak.push(context);
|
19799 | } else if (precedingNode) {
|
19800 | addTrailingComment(precedingNode, comment);
|
19801 | } else if (followingNode) {
|
19802 | addLeadingComment(followingNode, comment);
|
19803 | } else if (enclosingNode) {
|
19804 | addDanglingComment(enclosingNode, comment);
|
19805 | } else {
|
19806 | addDanglingComment(ast2, comment);
|
19807 | }
|
19808 | }
|
19809 | }
|
19810 | breakTies(tiesToBreak, options8);
|
19811 | if (!avoidAstMutation) {
|
19812 | for (const comment of comments) {
|
19813 | delete comment.precedingNode;
|
19814 | delete comment.enclosingNode;
|
19815 | delete comment.followingNode;
|
19816 | }
|
19817 | }
|
19818 | }
|
19819 | var isAllEmptyAndNoLineBreak = (text) => !/[\S\n\u2028\u2029]/u.test(text);
|
19820 | function isOwnLineComment(text, options8, decoratedComments, commentIndex) {
|
19821 | const { comment, precedingNode } = decoratedComments[commentIndex];
|
19822 | const { locStart, locEnd } = options8;
|
19823 | let start = locStart(comment);
|
19824 | if (precedingNode) {
|
19825 | for (let index = commentIndex - 1; index >= 0; index--) {
|
19826 | const { comment: comment2, precedingNode: currentCommentPrecedingNode } = decoratedComments[index];
|
19827 | if (currentCommentPrecedingNode !== precedingNode || !isAllEmptyAndNoLineBreak(text.slice(locEnd(comment2), start))) {
|
19828 | break;
|
19829 | }
|
19830 | start = locStart(comment2);
|
19831 | }
|
19832 | }
|
19833 | return has_newline_default(text, start, { backwards: true });
|
19834 | }
|
19835 | function isEndOfLineComment(text, options8, decoratedComments, commentIndex) {
|
19836 | const { comment, followingNode } = decoratedComments[commentIndex];
|
19837 | const { locStart, locEnd } = options8;
|
19838 | let end = locEnd(comment);
|
19839 | if (followingNode) {
|
19840 | for (let index = commentIndex + 1; index < decoratedComments.length; index++) {
|
19841 | const { comment: comment2, followingNode: currentCommentFollowingNode } = decoratedComments[index];
|
19842 | if (currentCommentFollowingNode !== followingNode || !isAllEmptyAndNoLineBreak(text.slice(end, locStart(comment2)))) {
|
19843 | break;
|
19844 | }
|
19845 | end = locEnd(comment2);
|
19846 | }
|
19847 | }
|
19848 | return has_newline_default(text, end);
|
19849 | }
|
19850 | function breakTies(tiesToBreak, options8) {
|
19851 | var _a, _b;
|
19852 | const tieCount = tiesToBreak.length;
|
19853 | if (tieCount === 0) {
|
19854 | return;
|
19855 | }
|
19856 | const { precedingNode, followingNode } = tiesToBreak[0];
|
19857 | let gapEndPos = options8.locStart(followingNode);
|
19858 | let indexOfFirstLeadingComment;
|
19859 | for (indexOfFirstLeadingComment = tieCount; indexOfFirstLeadingComment > 0; --indexOfFirstLeadingComment) {
|
19860 | const {
|
19861 | comment,
|
19862 | precedingNode: currentCommentPrecedingNode,
|
19863 | followingNode: currentCommentFollowingNode
|
19864 | } = tiesToBreak[indexOfFirstLeadingComment - 1];
|
19865 | assert4.strictEqual(currentCommentPrecedingNode, precedingNode);
|
19866 | assert4.strictEqual(currentCommentFollowingNode, followingNode);
|
19867 | const gap = options8.originalText.slice(options8.locEnd(comment), gapEndPos);
|
19868 | if (((_b = (_a = options8.printer).isGap) == null ? void 0 : _b.call(_a, gap, options8)) ?? /^[\s(]*$/u.test(gap)) {
|
19869 | gapEndPos = options8.locStart(comment);
|
19870 | } else {
|
19871 | break;
|
19872 | }
|
19873 | }
|
19874 | for (const [i, { comment }] of tiesToBreak.entries()) {
|
19875 | if (i < indexOfFirstLeadingComment) {
|
19876 | addTrailingComment(precedingNode, comment);
|
19877 | } else {
|
19878 | addLeadingComment(followingNode, comment);
|
19879 | }
|
19880 | }
|
19881 | for (const node of [precedingNode, followingNode]) {
|
19882 | if (node.comments && node.comments.length > 1) {
|
19883 | node.comments.sort((a, b) => options8.locStart(a) - options8.locStart(b));
|
19884 | }
|
19885 | }
|
19886 | tiesToBreak.length = 0;
|
19887 | }
|
19888 | function findExpressionIndexForComment(quasis, comment, options8) {
|
19889 | const startPos = options8.locStart(comment) - 1;
|
19890 | for (let i = 1; i < quasis.length; ++i) {
|
19891 | if (startPos < options8.locStart(quasis[i])) {
|
19892 | return i - 1;
|
19893 | }
|
19894 | }
|
19895 | return 0;
|
19896 | }
|
19897 |
|
19898 | // src/utils/is-previous-line-empty.js
|
19899 | function isPreviousLineEmpty(text, startIndex) {
|
19900 | let idx = startIndex - 1;
|
19901 | idx = skipSpaces(text, idx, { backwards: true });
|
19902 | idx = skip_newline_default(text, idx, { backwards: true });
|
19903 | idx = skipSpaces(text, idx, { backwards: true });
|
19904 | const idx2 = skip_newline_default(text, idx, { backwards: true });
|
19905 | return idx !== idx2;
|
19906 | }
|
19907 | var is_previous_line_empty_default = isPreviousLineEmpty;
|
19908 |
|
19909 | // src/main/comments/print.js
|
19910 | function printComment(path13, options8) {
|
19911 | const comment = path13.node;
|
19912 | comment.printed = true;
|
19913 | return options8.printer.printComment(path13, options8);
|
19914 | }
|
19915 | function printLeadingComment(path13, options8) {
|
19916 | var _a;
|
19917 | const comment = path13.node;
|
19918 | const parts = [printComment(path13, options8)];
|
19919 | const { printer, originalText, locStart, locEnd } = options8;
|
19920 | const isBlock = (_a = printer.isBlockComment) == null ? void 0 : _a.call(printer, comment);
|
19921 | if (isBlock) {
|
19922 | const lineBreak = has_newline_default(originalText, locEnd(comment)) ? has_newline_default(originalText, locStart(comment), {
|
19923 | backwards: true
|
19924 | }) ? hardline : line2 : " ";
|
19925 | parts.push(lineBreak);
|
19926 | } else {
|
19927 | parts.push(hardline);
|
19928 | }
|
19929 | const index = skip_newline_default(
|
19930 | originalText,
|
19931 | skipSpaces(originalText, locEnd(comment))
|
19932 | );
|
19933 | if (index !== false && has_newline_default(originalText, index)) {
|
19934 | parts.push(hardline);
|
19935 | }
|
19936 | return parts;
|
19937 | }
|
19938 | function printTrailingComment(path13, options8, previousComment) {
|
19939 | var _a;
|
19940 | const comment = path13.node;
|
19941 | const printed = printComment(path13, options8);
|
19942 | const { printer, originalText, locStart } = options8;
|
19943 | const isBlock = (_a = printer.isBlockComment) == null ? void 0 : _a.call(printer, comment);
|
19944 | if ((previousComment == null ? void 0 : previousComment.hasLineSuffix) && !(previousComment == null ? void 0 : previousComment.isBlock) || has_newline_default(originalText, locStart(comment), { backwards: true })) {
|
19945 | const isLineBeforeEmpty = is_previous_line_empty_default(
|
19946 | originalText,
|
19947 | locStart(comment)
|
19948 | );
|
19949 | return {
|
19950 | doc: lineSuffix([hardline, isLineBeforeEmpty ? hardline : "", printed]),
|
19951 | isBlock,
|
19952 | hasLineSuffix: true
|
19953 | };
|
19954 | }
|
19955 | if (!isBlock || (previousComment == null ? void 0 : previousComment.hasLineSuffix)) {
|
19956 | return {
|
19957 | doc: [lineSuffix([" ", printed]), breakParent],
|
19958 | isBlock,
|
19959 | hasLineSuffix: true
|
19960 | };
|
19961 | }
|
19962 | return { doc: [" ", printed], isBlock, hasLineSuffix: false };
|
19963 | }
|
19964 | function printCommentsSeparately(path13, options8) {
|
19965 | const value = path13.node;
|
19966 | if (!value) {
|
19967 | return {};
|
19968 | }
|
19969 | const ignored = options8[Symbol.for("printedComments")];
|
19970 | const comments = (value.comments || []).filter(
|
19971 | (comment) => !ignored.has(comment)
|
19972 | );
|
19973 | if (comments.length === 0) {
|
19974 | return { leading: "", trailing: "" };
|
19975 | }
|
19976 | const leadingParts = [];
|
19977 | const trailingParts = [];
|
19978 | let printedTrailingComment;
|
19979 | path13.each(() => {
|
19980 | const comment = path13.node;
|
19981 | if (ignored == null ? void 0 : ignored.has(comment)) {
|
19982 | return;
|
19983 | }
|
19984 | const { leading, trailing } = comment;
|
19985 | if (leading) {
|
19986 | leadingParts.push(printLeadingComment(path13, options8));
|
19987 | } else if (trailing) {
|
19988 | printedTrailingComment = printTrailingComment(
|
19989 | path13,
|
19990 | options8,
|
19991 | printedTrailingComment
|
19992 | );
|
19993 | trailingParts.push(printedTrailingComment.doc);
|
19994 | }
|
19995 | }, "comments");
|
19996 | return { leading: leadingParts, trailing: trailingParts };
|
19997 | }
|
19998 | function printComments(path13, doc2, options8) {
|
19999 | const { leading, trailing } = printCommentsSeparately(path13, options8);
|
20000 | if (!leading && !trailing) {
|
20001 | return doc2;
|
20002 | }
|
20003 | return inheritLabel(doc2, (doc3) => [leading, doc3, trailing]);
|
20004 | }
|
20005 | function ensureAllCommentsPrinted(options8) {
|
20006 | const {
|
20007 | [Symbol.for("comments")]: comments,
|
20008 | [Symbol.for("printedComments")]: printedComments
|
20009 | } = options8;
|
20010 | for (const comment of comments) {
|
20011 | if (!comment.printed && !printedComments.has(comment)) {
|
20012 | throw new Error(
|
20013 | 'Comment "' + comment.value.trim() + '" was not printed. Please report this error!'
|
20014 | );
|
20015 | }
|
20016 | delete comment.printed;
|
20017 | }
|
20018 | }
|
20019 |
|
20020 | // src/main/create-print-pre-check-function.js
|
20021 | function createPrintPreCheckFunction(options8) {
|
20022 | if (true) {
|
20023 | return () => {
|
20024 | };
|
20025 | }
|
20026 | const getVisitorKeys = create_get_visitor_keys_function_default(
|
20027 | options8.printer.getVisitorKeys
|
20028 | );
|
20029 | return function(path13) {
|
20030 | if (path13.isRoot) {
|
20031 | return;
|
20032 | }
|
20033 | const { key: key2, parent } = path13;
|
20034 | const visitorKeys = getVisitorKeys(parent);
|
20035 | if (visitorKeys.includes(key2)) {
|
20036 | return;
|
20037 | }
|
20038 | throw Object.assign(new Error("Calling `print()` on non-node object."), {
|
20039 | parentNode: parent,
|
20040 | allowedProperties: visitorKeys,
|
20041 | printingProperty: key2,
|
20042 | printingValue: path13.node,
|
20043 | pathStack: path13.stack.length > 5 ? ["...", ...path13.stack.slice(-5)] : [...path13.stack]
|
20044 | });
|
20045 | };
|
20046 | }
|
20047 | var create_print_pre_check_function_default = createPrintPreCheckFunction;
|
20048 |
|
20049 | // src/main/core-options.evaluate.js
|
20050 | var core_options_evaluate_default = {
|
20051 | "cursorOffset": {
|
20052 | "category": "Special",
|
20053 | "type": "int",
|
20054 | "default": -1,
|
20055 | "range": {
|
20056 | "start": -1,
|
20057 | "end": Infinity,
|
20058 | "step": 1
|
20059 | },
|
20060 | "description": "Print (to stderr) where a cursor at the given position would move to after formatting.",
|
20061 | "cliCategory": "Editor"
|
20062 | },
|
20063 | "endOfLine": {
|
20064 | "category": "Global",
|
20065 | "type": "choice",
|
20066 | "default": "lf",
|
20067 | "description": "Which end of line characters to apply.",
|
20068 | "choices": [
|
20069 | {
|
20070 | "value": "lf",
|
20071 | "description": "Line Feed only (\\n), common on Linux and macOS as well as inside git repos"
|
20072 | },
|
20073 | {
|
20074 | "value": "crlf",
|
20075 | "description": "Carriage Return + Line Feed characters (\\r\\n), common on Windows"
|
20076 | },
|
20077 | {
|
20078 | "value": "cr",
|
20079 | "description": "Carriage Return character only (\\r), used very rarely"
|
20080 | },
|
20081 | {
|
20082 | "value": "auto",
|
20083 | "description": "Maintain existing\n(mixed values within one file are normalised by looking at what's used after the first line)"
|
20084 | }
|
20085 | ]
|
20086 | },
|
20087 | "filepath": {
|
20088 | "category": "Special",
|
20089 | "type": "path",
|
20090 | "description": "Specify the input filepath. This will be used to do parser inference.",
|
20091 | "cliName": "stdin-filepath",
|
20092 | "cliCategory": "Other",
|
20093 | "cliDescription": "Path to the file to pretend that stdin comes from."
|
20094 | },
|
20095 | "insertPragma": {
|
20096 | "category": "Special",
|
20097 | "type": "boolean",
|
20098 | "default": false,
|
20099 | "description": "Insert @format pragma into file's first docblock comment.",
|
20100 | "cliCategory": "Other"
|
20101 | },
|
20102 | "parser": {
|
20103 | "category": "Global",
|
20104 | "type": "choice",
|
20105 | "default": void 0,
|
20106 | "description": "Which parser to use.",
|
20107 | "exception": (value) => typeof value === "string" || typeof value === "function",
|
20108 | "choices": [
|
20109 | {
|
20110 | "value": "flow",
|
20111 | "description": "Flow"
|
20112 | },
|
20113 | {
|
20114 | "value": "babel",
|
20115 | "description": "JavaScript"
|
20116 | },
|
20117 | {
|
20118 | "value": "babel-flow",
|
20119 | "description": "Flow"
|
20120 | },
|
20121 | {
|
20122 | "value": "babel-ts",
|
20123 | "description": "TypeScript"
|
20124 | },
|
20125 | {
|
20126 | "value": "typescript",
|
20127 | "description": "TypeScript"
|
20128 | },
|
20129 | {
|
20130 | "value": "acorn",
|
20131 | "description": "JavaScript"
|
20132 | },
|
20133 | {
|
20134 | "value": "espree",
|
20135 | "description": "JavaScript"
|
20136 | },
|
20137 | {
|
20138 | "value": "meriyah",
|
20139 | "description": "JavaScript"
|
20140 | },
|
20141 | {
|
20142 | "value": "css",
|
20143 | "description": "CSS"
|
20144 | },
|
20145 | {
|
20146 | "value": "less",
|
20147 | "description": "Less"
|
20148 | },
|
20149 | {
|
20150 | "value": "scss",
|
20151 | "description": "SCSS"
|
20152 | },
|
20153 | {
|
20154 | "value": "json",
|
20155 | "description": "JSON"
|
20156 | },
|
20157 | {
|
20158 | "value": "json5",
|
20159 | "description": "JSON5"
|
20160 | },
|
20161 | {
|
20162 | "value": "jsonc",
|
20163 | "description": "JSON with Comments"
|
20164 | },
|
20165 | {
|
20166 | "value": "json-stringify",
|
20167 | "description": "JSON.stringify"
|
20168 | },
|
20169 | {
|
20170 | "value": "graphql",
|
20171 | "description": "GraphQL"
|
20172 | },
|
20173 | {
|
20174 | "value": "markdown",
|
20175 | "description": "Markdown"
|
20176 | },
|
20177 | {
|
20178 | "value": "mdx",
|
20179 | "description": "MDX"
|
20180 | },
|
20181 | {
|
20182 | "value": "vue",
|
20183 | "description": "Vue"
|
20184 | },
|
20185 | {
|
20186 | "value": "yaml",
|
20187 | "description": "YAML"
|
20188 | },
|
20189 | {
|
20190 | "value": "glimmer",
|
20191 | "description": "Ember / Handlebars"
|
20192 | },
|
20193 | {
|
20194 | "value": "html",
|
20195 | "description": "HTML"
|
20196 | },
|
20197 | {
|
20198 | "value": "angular",
|
20199 | "description": "Angular"
|
20200 | },
|
20201 | {
|
20202 | "value": "lwc",
|
20203 | "description": "Lightning Web Components"
|
20204 | }
|
20205 | ]
|
20206 | },
|
20207 | "plugins": {
|
20208 | "type": "path",
|
20209 | "array": true,
|
20210 | "default": [
|
20211 | {
|
20212 | "value": []
|
20213 | }
|
20214 | ],
|
20215 | "category": "Global",
|
20216 | "description": "Add a plugin. Multiple plugins can be passed as separate `--plugin`s.",
|
20217 | "exception": (value) => typeof value === "string" || typeof value === "object",
|
20218 | "cliName": "plugin",
|
20219 | "cliCategory": "Config"
|
20220 | },
|
20221 | "printWidth": {
|
20222 | "category": "Global",
|
20223 | "type": "int",
|
20224 | "default": 80,
|
20225 | "description": "The line length where Prettier will try wrap.",
|
20226 | "range": {
|
20227 | "start": 0,
|
20228 | "end": Infinity,
|
20229 | "step": 1
|
20230 | }
|
20231 | },
|
20232 | "rangeEnd": {
|
20233 | "category": "Special",
|
20234 | "type": "int",
|
20235 | "default": Infinity,
|
20236 | "range": {
|
20237 | "start": 0,
|
20238 | "end": Infinity,
|
20239 | "step": 1
|
20240 | },
|
20241 | "description": "Format code ending at a given character offset (exclusive).\nThe range will extend forwards to the end of the selected statement.",
|
20242 | "cliCategory": "Editor"
|
20243 | },
|
20244 | "rangeStart": {
|
20245 | "category": "Special",
|
20246 | "type": "int",
|
20247 | "default": 0,
|
20248 | "range": {
|
20249 | "start": 0,
|
20250 | "end": Infinity,
|
20251 | "step": 1
|
20252 | },
|
20253 | "description": "Format code starting at a given character offset.\nThe range will extend backwards to the start of the first line containing the selected statement.",
|
20254 | "cliCategory": "Editor"
|
20255 | },
|
20256 | "requirePragma": {
|
20257 | "category": "Special",
|
20258 | "type": "boolean",
|
20259 | "default": false,
|
20260 | "description": "Require either '@prettier' or '@format' to be present in the file's first docblock comment\nin order for it to be formatted.",
|
20261 | "cliCategory": "Other"
|
20262 | },
|
20263 | "tabWidth": {
|
20264 | "type": "int",
|
20265 | "category": "Global",
|
20266 | "default": 2,
|
20267 | "description": "Number of spaces per indentation level.",
|
20268 | "range": {
|
20269 | "start": 0,
|
20270 | "end": Infinity,
|
20271 | "step": 1
|
20272 | }
|
20273 | },
|
20274 | "useTabs": {
|
20275 | "category": "Global",
|
20276 | "type": "boolean",
|
20277 | "default": false,
|
20278 | "description": "Indent with tabs instead of spaces."
|
20279 | },
|
20280 | "embeddedLanguageFormatting": {
|
20281 | "category": "Global",
|
20282 | "type": "choice",
|
20283 | "default": "auto",
|
20284 | "description": "Control how Prettier formats quoted code embedded in the file.",
|
20285 | "choices": [
|
20286 | {
|
20287 | "value": "auto",
|
20288 | "description": "Format embedded code if Prettier can automatically identify it."
|
20289 | },
|
20290 | {
|
20291 | "value": "off",
|
20292 | "description": "Never automatically format embedded code."
|
20293 | }
|
20294 | ]
|
20295 | }
|
20296 | };
|
20297 |
|
20298 | // src/main/support.js
|
20299 | function getSupportInfo({
|
20300 | plugins = [],
|
20301 | showDeprecated = false
|
20302 | } = {}) {
|
20303 | const languages2 = plugins.flatMap((plugin) => plugin.languages ?? []);
|
20304 | const options8 = [];
|
20305 | for (const option of normalizeOptionSettings(Object.assign({}, ...plugins.map(({
|
20306 | options: options9
|
20307 | }) => options9), core_options_evaluate_default))) {
|
20308 | if (!showDeprecated && option.deprecated) {
|
20309 | continue;
|
20310 | }
|
20311 | if (Array.isArray(option.choices)) {
|
20312 | if (!showDeprecated) {
|
20313 | option.choices = option.choices.filter((choice) => !choice.deprecated);
|
20314 | }
|
20315 | if (option.name === "parser") {
|
20316 | option.choices = [...option.choices, ...collectParsersFromLanguages(option.choices, languages2, plugins)];
|
20317 | }
|
20318 | }
|
20319 | option.pluginDefaults = Object.fromEntries(plugins.filter((plugin) => {
|
20320 | var _a;
|
20321 | return ((_a = plugin.defaultOptions) == null ? void 0 : _a[option.name]) !== void 0;
|
20322 | }).map((plugin) => [plugin.name, plugin.defaultOptions[option.name]]));
|
20323 | options8.push(option);
|
20324 | }
|
20325 | return {
|
20326 | languages: languages2,
|
20327 | options: options8
|
20328 | };
|
20329 | }
|
20330 | function* collectParsersFromLanguages(parserChoices, languages2, plugins) {
|
20331 | const existingParsers = new Set(parserChoices.map((choice) => choice.value));
|
20332 | for (const language of languages2) {
|
20333 | if (language.parsers) {
|
20334 | for (const parserName of language.parsers) {
|
20335 | if (!existingParsers.has(parserName)) {
|
20336 | existingParsers.add(parserName);
|
20337 | const plugin = plugins.find((plugin2) => plugin2.parsers && Object.prototype.hasOwnProperty.call(plugin2.parsers, parserName));
|
20338 | let description = language.name;
|
20339 | if (plugin == null ? void 0 : plugin.name) {
|
20340 | description += ` (plugin: ${plugin.name})`;
|
20341 | }
|
20342 | yield {
|
20343 | value: parserName,
|
20344 | description
|
20345 | };
|
20346 | }
|
20347 | }
|
20348 | }
|
20349 | }
|
20350 | }
|
20351 | function normalizeOptionSettings(settings) {
|
20352 | const options8 = [];
|
20353 | for (const [name, originalOption] of Object.entries(settings)) {
|
20354 | const option = {
|
20355 | name,
|
20356 | ...originalOption
|
20357 | };
|
20358 | if (Array.isArray(option.default)) {
|
20359 | option.default = at_default(
|
20360 | /* isOptionalObject */
|
20361 | false,
|
20362 | option.default,
|
20363 | -1
|
20364 | ).value;
|
20365 | }
|
20366 | options8.push(option);
|
20367 | }
|
20368 | return options8;
|
20369 | }
|
20370 |
|
20371 | // src/main/normalize-options.js
|
20372 | var hasDeprecationWarned;
|
20373 | function normalizeOptions(options8, optionInfos, {
|
20374 | logger = false,
|
20375 | isCLI = false,
|
20376 | passThrough = false,
|
20377 | FlagSchema,
|
20378 | descriptor
|
20379 | } = {}) {
|
20380 | if (isCLI) {
|
20381 | if (!FlagSchema) {
|
20382 | throw new Error("'FlagSchema' option is required.");
|
20383 | }
|
20384 | if (!descriptor) {
|
20385 | throw new Error("'descriptor' option is required.");
|
20386 | }
|
20387 | } else {
|
20388 | descriptor = apiDescriptor;
|
20389 | }
|
20390 | const unknown = !passThrough ? (key2, value, options9) => {
|
20391 | const {
|
20392 | _,
|
20393 | ...schemas2
|
20394 | } = options9.schemas;
|
20395 | return levenUnknownHandler(key2, value, {
|
20396 | ...options9,
|
20397 | schemas: schemas2
|
20398 | });
|
20399 | } : Array.isArray(passThrough) ? (key2, value) => !passThrough.includes(key2) ? void 0 : {
|
20400 | [key2]: value
|
20401 | } : (key2, value) => ({
|
20402 | [key2]: value
|
20403 | });
|
20404 | const schemas = optionInfosToSchemas(optionInfos, {
|
20405 | isCLI,
|
20406 | FlagSchema
|
20407 | });
|
20408 | const normalizer = new Normalizer(schemas, {
|
20409 | logger,
|
20410 | unknown,
|
20411 | descriptor
|
20412 | });
|
20413 | const shouldSuppressDuplicateDeprecationWarnings = logger !== false;
|
20414 | if (shouldSuppressDuplicateDeprecationWarnings && hasDeprecationWarned) {
|
20415 | normalizer._hasDeprecationWarned = hasDeprecationWarned;
|
20416 | }
|
20417 | const normalized = normalizer.normalize(options8);
|
20418 | if (shouldSuppressDuplicateDeprecationWarnings) {
|
20419 | hasDeprecationWarned = normalizer._hasDeprecationWarned;
|
20420 | }
|
20421 | return normalized;
|
20422 | }
|
20423 | function optionInfosToSchemas(optionInfos, {
|
20424 | isCLI,
|
20425 | FlagSchema
|
20426 | }) {
|
20427 | const schemas = [];
|
20428 | if (isCLI) {
|
20429 | schemas.push(AnySchema.create({
|
20430 | name: "_"
|
20431 | }));
|
20432 | }
|
20433 | for (const optionInfo of optionInfos) {
|
20434 | schemas.push(optionInfoToSchema(optionInfo, {
|
20435 | isCLI,
|
20436 | optionInfos,
|
20437 | FlagSchema
|
20438 | }));
|
20439 | if (optionInfo.alias && isCLI) {
|
20440 | schemas.push(AliasSchema.create({
|
20441 | // @ts-expect-error
|
20442 | name: optionInfo.alias,
|
20443 | sourceName: optionInfo.name
|
20444 | }));
|
20445 | }
|
20446 | }
|
20447 | return schemas;
|
20448 | }
|
20449 | function optionInfoToSchema(optionInfo, {
|
20450 | isCLI,
|
20451 | optionInfos,
|
20452 | FlagSchema
|
20453 | }) {
|
20454 | const {
|
20455 | name
|
20456 | } = optionInfo;
|
20457 | const parameters = {
|
20458 | name
|
20459 | };
|
20460 | let SchemaConstructor;
|
20461 | const handlers = {};
|
20462 | switch (optionInfo.type) {
|
20463 | case "int":
|
20464 | SchemaConstructor = IntegerSchema;
|
20465 | if (isCLI) {
|
20466 | parameters.preprocess = Number;
|
20467 | }
|
20468 | break;
|
20469 | case "string":
|
20470 | SchemaConstructor = StringSchema;
|
20471 | break;
|
20472 | case "choice":
|
20473 | SchemaConstructor = ChoiceSchema;
|
20474 | parameters.choices = optionInfo.choices.map((choiceInfo) => (choiceInfo == null ? void 0 : choiceInfo.redirect) ? {
|
20475 | ...choiceInfo,
|
20476 | redirect: {
|
20477 | to: {
|
20478 | key: optionInfo.name,
|
20479 | value: choiceInfo.redirect
|
20480 | }
|
20481 | }
|
20482 | } : choiceInfo);
|
20483 | break;
|
20484 | case "boolean":
|
20485 | SchemaConstructor = BooleanSchema;
|
20486 | break;
|
20487 | case "flag":
|
20488 | SchemaConstructor = FlagSchema;
|
20489 | parameters.flags = optionInfos.flatMap((optionInfo2) => [optionInfo2.alias, optionInfo2.description && optionInfo2.name, optionInfo2.oppositeDescription && `no-${optionInfo2.name}`].filter(Boolean));
|
20490 | break;
|
20491 | case "path":
|
20492 | SchemaConstructor = StringSchema;
|
20493 | break;
|
20494 | default:
|
20495 | throw new Error(`Unexpected type ${optionInfo.type}`);
|
20496 | }
|
20497 | if (optionInfo.exception) {
|
20498 | parameters.validate = (value, schema2, utils) => optionInfo.exception(value) || schema2.validate(value, utils);
|
20499 | } else {
|
20500 | parameters.validate = (value, schema2, utils) => value === void 0 || schema2.validate(value, utils);
|
20501 | }
|
20502 | if (optionInfo.redirect) {
|
20503 | handlers.redirect = (value) => !value ? void 0 : {
|
20504 | to: typeof optionInfo.redirect === "string" ? optionInfo.redirect : {
|
20505 | key: optionInfo.redirect.option,
|
20506 | value: optionInfo.redirect.value
|
20507 | }
|
20508 | };
|
20509 | }
|
20510 | if (optionInfo.deprecated) {
|
20511 | handlers.deprecated = true;
|
20512 | }
|
20513 | if (isCLI && !optionInfo.array) {
|
20514 | const originalPreprocess = parameters.preprocess || ((x) => x);
|
20515 | parameters.preprocess = (value, schema2, utils) => schema2.preprocess(originalPreprocess(Array.isArray(value) ? at_default(
|
20516 | /* isOptionalObject */
|
20517 | false,
|
20518 | value,
|
20519 | -1
|
20520 | ) : value), utils);
|
20521 | }
|
20522 | return optionInfo.array ? ArraySchema.create({
|
20523 | ...isCLI ? {
|
20524 | preprocess: (v) => Array.isArray(v) ? v : [v]
|
20525 | } : {},
|
20526 | ...handlers,
|
20527 | // @ts-expect-error
|
20528 | valueSchema: SchemaConstructor.create(parameters)
|
20529 | }) : SchemaConstructor.create({
|
20530 | ...parameters,
|
20531 | ...handlers
|
20532 | });
|
20533 | }
|
20534 | var normalize_options_default = normalizeOptions;
|
20535 |
|
20536 | // scripts/build/shims/array-find-last.js
|
20537 | var arrayFindLast = (isOptionalObject, array2, callback) => {
|
20538 | if (isOptionalObject && (array2 === void 0 || array2 === null)) {
|
20539 | return;
|
20540 | }
|
20541 | if (array2.findLast) {
|
20542 | return array2.findLast(callback);
|
20543 | }
|
20544 | for (let index = array2.length - 1; index >= 0; index--) {
|
20545 | const element = array2[index];
|
20546 | if (callback(element, index, array2)) {
|
20547 | return element;
|
20548 | }
|
20549 | }
|
20550 | };
|
20551 | var array_find_last_default = arrayFindLast;
|
20552 |
|
20553 | // src/main/parser-and-printer.js
|
20554 | function getParserPluginByParserName(plugins, parserName) {
|
20555 | if (!parserName) {
|
20556 | throw new Error("parserName is required.");
|
20557 | }
|
20558 | const plugin = array_find_last_default(
|
20559 | /* isOptionalObject */
|
20560 | false,
|
20561 | plugins,
|
20562 | (plugin2) => plugin2.parsers && Object.prototype.hasOwnProperty.call(plugin2.parsers, parserName)
|
20563 | );
|
20564 | if (plugin) {
|
20565 | return plugin;
|
20566 | }
|
20567 | let message = `Couldn't resolve parser "${parserName}".`;
|
20568 | if (false) {
|
20569 | message += " Plugins must be explicitly added to the standalone bundle.";
|
20570 | }
|
20571 | throw new ConfigError(message);
|
20572 | }
|
20573 | function getPrinterPluginByAstFormat(plugins, astFormat) {
|
20574 | if (!astFormat) {
|
20575 | throw new Error("astFormat is required.");
|
20576 | }
|
20577 | const plugin = array_find_last_default(
|
20578 | /* isOptionalObject */
|
20579 | false,
|
20580 | plugins,
|
20581 | (plugin2) => plugin2.printers && Object.prototype.hasOwnProperty.call(plugin2.printers, astFormat)
|
20582 | );
|
20583 | if (plugin) {
|
20584 | return plugin;
|
20585 | }
|
20586 | let message = `Couldn't find plugin for AST format "${astFormat}".`;
|
20587 | if (false) {
|
20588 | message += " Plugins must be explicitly added to the standalone bundle.";
|
20589 | }
|
20590 | throw new ConfigError(message);
|
20591 | }
|
20592 | function resolveParser({
|
20593 | plugins,
|
20594 | parser
|
20595 | }) {
|
20596 | const plugin = getParserPluginByParserName(plugins, parser);
|
20597 | return initParser(plugin, parser);
|
20598 | }
|
20599 | function initParser(plugin, parserName) {
|
20600 | const parserOrParserInitFunction = plugin.parsers[parserName];
|
20601 | return typeof parserOrParserInitFunction === "function" ? parserOrParserInitFunction() : parserOrParserInitFunction;
|
20602 | }
|
20603 | function initPrinter(plugin, astFormat) {
|
20604 | const printerOrPrinterInitFunction = plugin.printers[astFormat];
|
20605 | return typeof printerOrPrinterInitFunction === "function" ? printerOrPrinterInitFunction() : printerOrPrinterInitFunction;
|
20606 | }
|
20607 |
|
20608 | // src/main/normalize-format-options.js
|
20609 | var formatOptionsHiddenDefaults = {
|
20610 | astFormat: "estree",
|
20611 | printer: {},
|
20612 | originalText: void 0,
|
20613 | locStart: null,
|
20614 | locEnd: null
|
20615 | };
|
20616 | async function normalizeFormatOptions(options8, opts = {}) {
|
20617 | var _a;
|
20618 | const rawOptions = { ...options8 };
|
20619 | if (!rawOptions.parser) {
|
20620 | if (!rawOptions.filepath) {
|
20621 | throw new UndefinedParserError(
|
20622 | "No parser and no file path given, couldn't infer a parser."
|
20623 | );
|
20624 | } else {
|
20625 | rawOptions.parser = infer_parser_default(rawOptions, {
|
20626 | physicalFile: rawOptions.filepath
|
20627 | });
|
20628 | if (!rawOptions.parser) {
|
20629 | throw new UndefinedParserError(
|
20630 | `No parser could be inferred for file "${rawOptions.filepath}".`
|
20631 | );
|
20632 | }
|
20633 | }
|
20634 | }
|
20635 | const supportOptions = getSupportInfo({
|
20636 | plugins: options8.plugins,
|
20637 | showDeprecated: true
|
20638 | }).options;
|
20639 | const defaults = {
|
20640 | ...formatOptionsHiddenDefaults,
|
20641 | ...Object.fromEntries(
|
20642 | supportOptions.filter((optionInfo) => optionInfo.default !== void 0).map((option) => [option.name, option.default])
|
20643 | )
|
20644 | };
|
20645 | const parserPlugin = getParserPluginByParserName(
|
20646 | rawOptions.plugins,
|
20647 | rawOptions.parser
|
20648 | );
|
20649 | const parser = await initParser(parserPlugin, rawOptions.parser);
|
20650 | rawOptions.astFormat = parser.astFormat;
|
20651 | rawOptions.locEnd = parser.locEnd;
|
20652 | rawOptions.locStart = parser.locStart;
|
20653 | const printerPlugin = ((_a = parserPlugin.printers) == null ? void 0 : _a[parser.astFormat]) ? parserPlugin : getPrinterPluginByAstFormat(rawOptions.plugins, parser.astFormat);
|
20654 | const printer = await initPrinter(printerPlugin, parser.astFormat);
|
20655 | rawOptions.printer = printer;
|
20656 | const pluginDefaults = printerPlugin.defaultOptions ? Object.fromEntries(
|
20657 | Object.entries(printerPlugin.defaultOptions).filter(
|
20658 | ([, value]) => value !== void 0
|
20659 | )
|
20660 | ) : {};
|
20661 | const mixedDefaults = { ...defaults, ...pluginDefaults };
|
20662 | for (const [k, value] of Object.entries(mixedDefaults)) {
|
20663 | if (rawOptions[k] === null || rawOptions[k] === void 0) {
|
20664 | rawOptions[k] = value;
|
20665 | }
|
20666 | }
|
20667 | if (rawOptions.parser === "json") {
|
20668 | rawOptions.trailingComma = "none";
|
20669 | }
|
20670 | return normalize_options_default(rawOptions, supportOptions, {
|
20671 | passThrough: Object.keys(formatOptionsHiddenDefaults),
|
20672 | ...opts
|
20673 | });
|
20674 | }
|
20675 | var normalize_format_options_default = normalizeFormatOptions;
|
20676 |
|
20677 | // src/main/parse.js
|
20678 | var import_code_frame2 = __toESM(require_lib3(), 1);
|
20679 | async function parse4(originalText, options8) {
|
20680 | const parser = await resolveParser(options8);
|
20681 | const text = parser.preprocess ? parser.preprocess(originalText, options8) : originalText;
|
20682 | options8.originalText = text;
|
20683 | let ast;
|
20684 | try {
|
20685 | ast = await parser.parse(
|
20686 | text,
|
20687 | options8,
|
20688 | // TODO: remove the third argument in v4
|
20689 | // The duplicated argument is passed as intended, see #10156
|
20690 | options8
|
20691 | );
|
20692 | } catch (error) {
|
20693 | handleParseError(error, originalText);
|
20694 | }
|
20695 | return { text, ast };
|
20696 | }
|
20697 | function handleParseError(error, text) {
|
20698 | const { loc } = error;
|
20699 | if (loc) {
|
20700 | const codeFrame = (0, import_code_frame2.codeFrameColumns)(text, loc, { highlightCode: true });
|
20701 | error.message += "\n" + codeFrame;
|
20702 | error.codeFrame = codeFrame;
|
20703 | throw error;
|
20704 | }
|
20705 | throw error;
|
20706 | }
|
20707 | var parse_default = parse4;
|
20708 |
|
20709 | // src/main/multiparser.js
|
20710 | async function printEmbeddedLanguages(path13, genericPrint, options8, printAstToDoc2, embeds) {
|
20711 | const {
|
20712 | embeddedLanguageFormatting,
|
20713 | printer: {
|
20714 | embed,
|
20715 | hasPrettierIgnore = () => false,
|
20716 | getVisitorKeys: printerGetVisitorKeys
|
20717 | }
|
20718 | } = options8;
|
20719 | if (!embed || embeddedLanguageFormatting !== "auto") {
|
20720 | return;
|
20721 | }
|
20722 | if (embed.length > 2) {
|
20723 | throw new Error(
|
20724 | "printer.embed has too many parameters. The API changed in Prettier v3. Please update your plugin. See https://prettier.io/docs/en/plugins.html#optional-embed"
|
20725 | );
|
20726 | }
|
20727 | const getVisitorKeys = create_get_visitor_keys_function_default(
|
20728 | embed.getVisitorKeys ?? printerGetVisitorKeys
|
20729 | );
|
20730 | const embedCallResults = [];
|
20731 | recurse();
|
20732 | const originalPathStack = path13.stack;
|
20733 | for (const { print, node, pathStack } of embedCallResults) {
|
20734 | try {
|
20735 | path13.stack = pathStack;
|
20736 | const doc2 = await print(textToDocForEmbed, genericPrint, path13, options8);
|
20737 | if (doc2) {
|
20738 | embeds.set(node, doc2);
|
20739 | }
|
20740 | } catch (error) {
|
20741 | if (process.env.PRETTIER_DEBUG) {
|
20742 | throw error;
|
20743 | }
|
20744 | }
|
20745 | }
|
20746 | path13.stack = originalPathStack;
|
20747 | function textToDocForEmbed(text, partialNextOptions) {
|
20748 | return textToDoc(text, partialNextOptions, options8, printAstToDoc2);
|
20749 | }
|
20750 | function recurse() {
|
20751 | const { node } = path13;
|
20752 | if (node === null || typeof node !== "object" || hasPrettierIgnore(path13)) {
|
20753 | return;
|
20754 | }
|
20755 | for (const key2 of getVisitorKeys(node)) {
|
20756 | if (Array.isArray(node[key2])) {
|
20757 | path13.each(recurse, key2);
|
20758 | } else {
|
20759 | path13.call(recurse, key2);
|
20760 | }
|
20761 | }
|
20762 | const result = embed(path13, options8);
|
20763 | if (!result) {
|
20764 | return;
|
20765 | }
|
20766 | if (typeof result === "function") {
|
20767 | embedCallResults.push({
|
20768 | print: result,
|
20769 | node,
|
20770 | pathStack: [...path13.stack]
|
20771 | });
|
20772 | return;
|
20773 | }
|
20774 | if (false) {
|
20775 | throw new Error(
|
20776 | "`embed` should return an async function instead of Promise."
|
20777 | );
|
20778 | }
|
20779 | embeds.set(node, result);
|
20780 | }
|
20781 | }
|
20782 | async function textToDoc(text, partialNextOptions, parentOptions, printAstToDoc2) {
|
20783 | const options8 = await normalize_format_options_default(
|
20784 | {
|
20785 | ...parentOptions,
|
20786 | ...partialNextOptions,
|
20787 | parentParser: parentOptions.parser,
|
20788 | originalText: text
|
20789 | },
|
20790 | { passThrough: true }
|
20791 | );
|
20792 | const { ast } = await parse_default(text, options8);
|
20793 | const doc2 = await printAstToDoc2(ast, options8);
|
20794 | return stripTrailingHardline(doc2);
|
20795 | }
|
20796 |
|
20797 | // src/main/print-ignored.js
|
20798 | function printIgnored(path13, options8) {
|
20799 | const {
|
20800 | originalText,
|
20801 | [Symbol.for("comments")]: comments,
|
20802 | locStart,
|
20803 | locEnd,
|
20804 | [Symbol.for("printedComments")]: printedComments
|
20805 | } = options8;
|
20806 | const { node } = path13;
|
20807 | const start = locStart(node);
|
20808 | const end = locEnd(node);
|
20809 | for (const comment of comments) {
|
20810 | if (locStart(comment) >= start && locEnd(comment) <= end) {
|
20811 | printedComments.add(comment);
|
20812 | }
|
20813 | }
|
20814 | return originalText.slice(start, end);
|
20815 | }
|
20816 | var print_ignored_default = printIgnored;
|
20817 |
|
20818 | // src/main/ast-to-doc.js
|
20819 | async function printAstToDoc(ast, options8) {
|
20820 | ({ ast } = await prepareToPrint(ast, options8));
|
20821 | const cache3 = /* @__PURE__ */ new Map();
|
20822 | const path13 = new ast_path_default(ast);
|
20823 | const ensurePrintingNode = create_print_pre_check_function_default(options8);
|
20824 | const embeds = /* @__PURE__ */ new Map();
|
20825 | await printEmbeddedLanguages(path13, mainPrint, options8, printAstToDoc, embeds);
|
20826 | const doc2 = await callPluginPrintFunction(
|
20827 | path13,
|
20828 | options8,
|
20829 | mainPrint,
|
20830 | void 0,
|
20831 | embeds
|
20832 | );
|
20833 | ensureAllCommentsPrinted(options8);
|
20834 | return doc2;
|
20835 | function mainPrint(selector, args) {
|
20836 | if (selector === void 0 || selector === path13) {
|
20837 | return mainPrintInternal(args);
|
20838 | }
|
20839 | if (Array.isArray(selector)) {
|
20840 | return path13.call(() => mainPrintInternal(args), ...selector);
|
20841 | }
|
20842 | return path13.call(() => mainPrintInternal(args), selector);
|
20843 | }
|
20844 | function mainPrintInternal(args) {
|
20845 | ensurePrintingNode(path13);
|
20846 | const value = path13.node;
|
20847 | if (value === void 0 || value === null) {
|
20848 | return "";
|
20849 | }
|
20850 | const shouldCache = value && typeof value === "object" && args === void 0;
|
20851 | if (shouldCache && cache3.has(value)) {
|
20852 | return cache3.get(value);
|
20853 | }
|
20854 | const doc3 = callPluginPrintFunction(path13, options8, mainPrint, args, embeds);
|
20855 | if (shouldCache) {
|
20856 | cache3.set(value, doc3);
|
20857 | }
|
20858 | return doc3;
|
20859 | }
|
20860 | }
|
20861 | function callPluginPrintFunction(path13, options8, printPath, args, embeds) {
|
20862 | var _a;
|
20863 | const { node } = path13;
|
20864 | const { printer } = options8;
|
20865 | let doc2;
|
20866 | if ((_a = printer.hasPrettierIgnore) == null ? void 0 : _a.call(printer, path13)) {
|
20867 | doc2 = print_ignored_default(path13, options8);
|
20868 | } else if (embeds.has(node)) {
|
20869 | doc2 = embeds.get(node);
|
20870 | } else {
|
20871 | doc2 = printer.print(path13, options8, printPath, args);
|
20872 | }
|
20873 | if (node === options8.cursorNode) {
|
20874 | doc2 = inheritLabel(doc2, (doc3) => [cursor, doc3, cursor]);
|
20875 | }
|
20876 | if (printer.printComment && (!printer.willPrintOwnComments || !printer.willPrintOwnComments(path13, options8))) {
|
20877 | doc2 = printComments(path13, doc2, options8);
|
20878 | }
|
20879 | return doc2;
|
20880 | }
|
20881 | async function prepareToPrint(ast, options8) {
|
20882 | const comments = ast.comments ?? [];
|
20883 | options8[Symbol.for("comments")] = comments;
|
20884 | options8[Symbol.for("tokens")] = ast.tokens ?? [];
|
20885 | options8[Symbol.for("printedComments")] = /* @__PURE__ */ new Set();
|
20886 | attachComments(ast, options8);
|
20887 | const {
|
20888 | printer: { preprocess }
|
20889 | } = options8;
|
20890 | ast = preprocess ? await preprocess(ast, options8) : ast;
|
20891 | return { ast, comments };
|
20892 | }
|
20893 |
|
20894 | // src/main/get-cursor-node.js
|
20895 | function getCursorNode(ast, options8) {
|
20896 | const { cursorOffset, locStart, locEnd } = options8;
|
20897 | const getVisitorKeys = create_get_visitor_keys_function_default(
|
20898 | options8.printer.getVisitorKeys
|
20899 | );
|
20900 | const nodeContainsCursor = (node) => locStart(node) <= cursorOffset && locEnd(node) >= cursorOffset;
|
20901 | let cursorNode = ast;
|
20902 | for (const node of getDescendants(ast, {
|
20903 | getVisitorKeys,
|
20904 | filter: nodeContainsCursor
|
20905 | })) {
|
20906 | cursorNode = node;
|
20907 | }
|
20908 | return cursorNode;
|
20909 | }
|
20910 | var get_cursor_node_default = getCursorNode;
|
20911 |
|
20912 | // src/main/massage-ast.js
|
20913 | function massageAst(ast, options8) {
|
20914 | const {
|
20915 | printer: {
|
20916 | massageAstNode: cleanFunction,
|
20917 | getVisitorKeys: printerGetVisitorKeys
|
20918 | }
|
20919 | } = options8;
|
20920 | if (!cleanFunction) {
|
20921 | return ast;
|
20922 | }
|
20923 | const getVisitorKeys = create_get_visitor_keys_function_default(printerGetVisitorKeys);
|
20924 | const ignoredProperties = cleanFunction.ignoredProperties ?? /* @__PURE__ */ new Set();
|
20925 | return recurse(ast);
|
20926 | function recurse(original, parent) {
|
20927 | if (!(original !== null && typeof original === "object")) {
|
20928 | return original;
|
20929 | }
|
20930 | if (Array.isArray(original)) {
|
20931 | return original.map((child) => recurse(child, parent)).filter(Boolean);
|
20932 | }
|
20933 | const cloned = {};
|
20934 | const childrenKeys = new Set(getVisitorKeys(original));
|
20935 | for (const key2 in original) {
|
20936 | if (!Object.prototype.hasOwnProperty.call(original, key2) || ignoredProperties.has(key2)) {
|
20937 | continue;
|
20938 | }
|
20939 | if (childrenKeys.has(key2)) {
|
20940 | cloned[key2] = recurse(original[key2], original);
|
20941 | } else {
|
20942 | cloned[key2] = original[key2];
|
20943 | }
|
20944 | }
|
20945 | const result = cleanFunction(original, cloned, parent);
|
20946 | if (result === null) {
|
20947 | return;
|
20948 | }
|
20949 | return result ?? cloned;
|
20950 | }
|
20951 | }
|
20952 | var massage_ast_default = massageAst;
|
20953 |
|
20954 | // scripts/build/shims/array-find-last-index.js
|
20955 | var arrayFindLastIndex = (isOptionalObject, array2, callback) => {
|
20956 | if (isOptionalObject && (array2 === void 0 || array2 === null)) {
|
20957 | return;
|
20958 | }
|
20959 | if (array2.findLastIndex) {
|
20960 | return array2.findLastIndex(callback);
|
20961 | }
|
20962 | for (let index = array2.length - 1; index >= 0; index--) {
|
20963 | const element = array2[index];
|
20964 | if (callback(element, index, array2)) {
|
20965 | return index;
|
20966 | }
|
20967 | }
|
20968 | return -1;
|
20969 | };
|
20970 | var array_find_last_index_default = arrayFindLastIndex;
|
20971 |
|
20972 | // src/main/range-util.js
|
20973 | import assert5 from "assert";
|
20974 | var isJsonParser = ({
|
20975 | parser
|
20976 | }) => parser === "json" || parser === "json5" || parser === "jsonc" || parser === "json-stringify";
|
20977 | function findCommonAncestor(startNodeAndParents, endNodeAndParents) {
|
20978 | const startNodeAndAncestors = [startNodeAndParents.node, ...startNodeAndParents.parentNodes];
|
20979 | const endNodeAndAncestors = /* @__PURE__ */ new Set([endNodeAndParents.node, ...endNodeAndParents.parentNodes]);
|
20980 | return startNodeAndAncestors.find((node) => jsonSourceElements.has(node.type) && endNodeAndAncestors.has(node));
|
20981 | }
|
20982 | function dropRootParents(parents) {
|
20983 | const index = array_find_last_index_default(
|
20984 | /* isOptionalObject */
|
20985 | false,
|
20986 | parents,
|
20987 | (node) => node.type !== "Program" && node.type !== "File"
|
20988 | );
|
20989 | if (index === -1) {
|
20990 | return parents;
|
20991 | }
|
20992 | return parents.slice(0, index + 1);
|
20993 | }
|
20994 | function findSiblingAncestors(startNodeAndParents, endNodeAndParents, {
|
20995 | locStart,
|
20996 | locEnd
|
20997 | }) {
|
20998 | let resultStartNode = startNodeAndParents.node;
|
20999 | let resultEndNode = endNodeAndParents.node;
|
21000 | if (resultStartNode === resultEndNode) {
|
21001 | return {
|
21002 | startNode: resultStartNode,
|
21003 | endNode: resultEndNode
|
21004 | };
|
21005 | }
|
21006 | const startNodeStart = locStart(startNodeAndParents.node);
|
21007 | for (const endParent of dropRootParents(endNodeAndParents.parentNodes)) {
|
21008 | if (locStart(endParent) >= startNodeStart) {
|
21009 | resultEndNode = endParent;
|
21010 | } else {
|
21011 | break;
|
21012 | }
|
21013 | }
|
21014 | const endNodeEnd = locEnd(endNodeAndParents.node);
|
21015 | for (const startParent of dropRootParents(startNodeAndParents.parentNodes)) {
|
21016 | if (locEnd(startParent) <= endNodeEnd) {
|
21017 | resultStartNode = startParent;
|
21018 | } else {
|
21019 | break;
|
21020 | }
|
21021 | if (resultStartNode === resultEndNode) {
|
21022 | break;
|
21023 | }
|
21024 | }
|
21025 | return {
|
21026 | startNode: resultStartNode,
|
21027 | endNode: resultEndNode
|
21028 | };
|
21029 | }
|
21030 | function findNodeAtOffset(node, offset, options8, predicate, parentNodes = [], type2) {
|
21031 | const {
|
21032 | locStart,
|
21033 | locEnd
|
21034 | } = options8;
|
21035 | const start = locStart(node);
|
21036 | const end = locEnd(node);
|
21037 | if (offset > end || offset < start || type2 === "rangeEnd" && offset === start || type2 === "rangeStart" && offset === end) {
|
21038 | return;
|
21039 | }
|
21040 | for (const childNode of getSortedChildNodes(node, options8)) {
|
21041 | const childResult = findNodeAtOffset(childNode, offset, options8, predicate, [node, ...parentNodes], type2);
|
21042 | if (childResult) {
|
21043 | return childResult;
|
21044 | }
|
21045 | }
|
21046 | if (!predicate || predicate(node, parentNodes[0])) {
|
21047 | return {
|
21048 | node,
|
21049 | parentNodes
|
21050 | };
|
21051 | }
|
21052 | }
|
21053 | function isJsSourceElement(type2, parentType) {
|
21054 | return parentType !== "DeclareExportDeclaration" && type2 !== "TypeParameterDeclaration" && (type2 === "Directive" || type2 === "TypeAlias" || type2 === "TSExportAssignment" || type2.startsWith("Declare") || type2.startsWith("TSDeclare") || type2.endsWith("Statement") || type2.endsWith("Declaration"));
|
21055 | }
|
21056 | var jsonSourceElements = /* @__PURE__ */ new Set(["JsonRoot", "ObjectExpression", "ArrayExpression", "StringLiteral", "NumericLiteral", "BooleanLiteral", "NullLiteral", "UnaryExpression", "TemplateLiteral"]);
|
21057 | var graphqlSourceElements = /* @__PURE__ */ new Set(["OperationDefinition", "FragmentDefinition", "VariableDefinition", "TypeExtensionDefinition", "ObjectTypeDefinition", "FieldDefinition", "DirectiveDefinition", "EnumTypeDefinition", "EnumValueDefinition", "InputValueDefinition", "InputObjectTypeDefinition", "SchemaDefinition", "OperationTypeDefinition", "InterfaceTypeDefinition", "UnionTypeDefinition", "ScalarTypeDefinition"]);
|
21058 | function isSourceElement(opts, node, parentNode) {
|
21059 | if (!node) {
|
21060 | return false;
|
21061 | }
|
21062 | switch (opts.parser) {
|
21063 | case "flow":
|
21064 | case "babel":
|
21065 | case "babel-flow":
|
21066 | case "babel-ts":
|
21067 | case "typescript":
|
21068 | case "acorn":
|
21069 | case "espree":
|
21070 | case "meriyah":
|
21071 | case "__babel_estree":
|
21072 | return isJsSourceElement(node.type, parentNode == null ? void 0 : parentNode.type);
|
21073 | case "json":
|
21074 | case "json5":
|
21075 | case "jsonc":
|
21076 | case "json-stringify":
|
21077 | return jsonSourceElements.has(node.type);
|
21078 | case "graphql":
|
21079 | return graphqlSourceElements.has(node.kind);
|
21080 | case "vue":
|
21081 | return node.tag !== "root";
|
21082 | }
|
21083 | return false;
|
21084 | }
|
21085 | function calculateRange(text, opts, ast) {
|
21086 | let {
|
21087 | rangeStart: start,
|
21088 | rangeEnd: end,
|
21089 | locStart,
|
21090 | locEnd
|
21091 | } = opts;
|
21092 | assert5.ok(end > start);
|
21093 | const firstNonWhitespaceCharacterIndex = text.slice(start, end).search(/\S/u);
|
21094 | const isAllWhitespace = firstNonWhitespaceCharacterIndex === -1;
|
21095 | if (!isAllWhitespace) {
|
21096 | start += firstNonWhitespaceCharacterIndex;
|
21097 | for (; end > start; --end) {
|
21098 | if (/\S/u.test(text[end - 1])) {
|
21099 | break;
|
21100 | }
|
21101 | }
|
21102 | }
|
21103 | const startNodeAndParents = findNodeAtOffset(ast, start, opts, (node, parentNode) => isSourceElement(opts, node, parentNode), [], "rangeStart");
|
21104 | const endNodeAndParents = (
|
21105 | // No need find Node at `end`, it will be the same as `startNodeAndParents`
|
21106 | isAllWhitespace ? startNodeAndParents : findNodeAtOffset(ast, end, opts, (node) => isSourceElement(opts, node), [], "rangeEnd")
|
21107 | );
|
21108 | if (!startNodeAndParents || !endNodeAndParents) {
|
21109 | return {
|
21110 | rangeStart: 0,
|
21111 | rangeEnd: 0
|
21112 | };
|
21113 | }
|
21114 | let startNode;
|
21115 | let endNode;
|
21116 | if (isJsonParser(opts)) {
|
21117 | const commonAncestor = findCommonAncestor(startNodeAndParents, endNodeAndParents);
|
21118 | startNode = commonAncestor;
|
21119 | endNode = commonAncestor;
|
21120 | } else {
|
21121 | ({
|
21122 | startNode,
|
21123 | endNode
|
21124 | } = findSiblingAncestors(startNodeAndParents, endNodeAndParents, opts));
|
21125 | }
|
21126 | return {
|
21127 | rangeStart: Math.min(locStart(startNode), locStart(endNode)),
|
21128 | rangeEnd: Math.max(locEnd(startNode), locEnd(endNode))
|
21129 | };
|
21130 | }
|
21131 |
|
21132 | // src/main/core.js
|
21133 | var BOM = "\uFEFF";
|
21134 | var CURSOR = Symbol("cursor");
|
21135 | async function coreFormat(originalText, opts, addAlignmentSize = 0) {
|
21136 | if (!originalText || originalText.trim().length === 0) {
|
21137 | return {
|
21138 | formatted: "",
|
21139 | cursorOffset: -1,
|
21140 | comments: []
|
21141 | };
|
21142 | }
|
21143 | const {
|
21144 | ast,
|
21145 | text
|
21146 | } = await parse_default(originalText, opts);
|
21147 | if (opts.cursorOffset >= 0) {
|
21148 | opts.cursorNode = get_cursor_node_default(ast, opts);
|
21149 | }
|
21150 | let doc2 = await printAstToDoc(ast, opts, addAlignmentSize);
|
21151 | if (addAlignmentSize > 0) {
|
21152 | doc2 = addAlignmentToDoc([hardline, doc2], addAlignmentSize, opts.tabWidth);
|
21153 | }
|
21154 | const result = printDocToString(doc2, opts);
|
21155 | if (addAlignmentSize > 0) {
|
21156 | const trimmed = result.formatted.trim();
|
21157 | if (result.cursorNodeStart !== void 0) {
|
21158 | result.cursorNodeStart -= result.formatted.indexOf(trimmed);
|
21159 | }
|
21160 | result.formatted = trimmed + convertEndOfLineToChars(opts.endOfLine);
|
21161 | }
|
21162 | const comments = opts[Symbol.for("comments")];
|
21163 | if (opts.cursorOffset >= 0) {
|
21164 | let oldCursorNodeStart;
|
21165 | let oldCursorNodeText;
|
21166 | let cursorOffsetRelativeToOldCursorNode;
|
21167 | let newCursorNodeStart;
|
21168 | let newCursorNodeText;
|
21169 | if (opts.cursorNode && result.cursorNodeText) {
|
21170 | oldCursorNodeStart = opts.locStart(opts.cursorNode);
|
21171 | oldCursorNodeText = text.slice(oldCursorNodeStart, opts.locEnd(opts.cursorNode));
|
21172 | cursorOffsetRelativeToOldCursorNode = opts.cursorOffset - oldCursorNodeStart;
|
21173 | newCursorNodeStart = result.cursorNodeStart;
|
21174 | newCursorNodeText = result.cursorNodeText;
|
21175 | } else {
|
21176 | oldCursorNodeStart = 0;
|
21177 | oldCursorNodeText = text;
|
21178 | cursorOffsetRelativeToOldCursorNode = opts.cursorOffset;
|
21179 | newCursorNodeStart = 0;
|
21180 | newCursorNodeText = result.formatted;
|
21181 | }
|
21182 | if (oldCursorNodeText === newCursorNodeText) {
|
21183 | return {
|
21184 | formatted: result.formatted,
|
21185 | cursorOffset: newCursorNodeStart + cursorOffsetRelativeToOldCursorNode,
|
21186 | comments
|
21187 | };
|
21188 | }
|
21189 | const oldCursorNodeCharArray = oldCursorNodeText.split("");
|
21190 | oldCursorNodeCharArray.splice(cursorOffsetRelativeToOldCursorNode, 0, CURSOR);
|
21191 | const newCursorNodeCharArray = newCursorNodeText.split("");
|
21192 | const cursorNodeDiff = diffArrays(oldCursorNodeCharArray, newCursorNodeCharArray);
|
21193 | let cursorOffset = newCursorNodeStart;
|
21194 | for (const entry of cursorNodeDiff) {
|
21195 | if (entry.removed) {
|
21196 | if (entry.value.includes(CURSOR)) {
|
21197 | break;
|
21198 | }
|
21199 | } else {
|
21200 | cursorOffset += entry.count;
|
21201 | }
|
21202 | }
|
21203 | return {
|
21204 | formatted: result.formatted,
|
21205 | cursorOffset,
|
21206 | comments
|
21207 | };
|
21208 | }
|
21209 | return {
|
21210 | formatted: result.formatted,
|
21211 | cursorOffset: -1,
|
21212 | comments
|
21213 | };
|
21214 | }
|
21215 | async function formatRange(originalText, opts) {
|
21216 | const {
|
21217 | ast,
|
21218 | text
|
21219 | } = await parse_default(originalText, opts);
|
21220 | const {
|
21221 | rangeStart,
|
21222 | rangeEnd
|
21223 | } = calculateRange(text, opts, ast);
|
21224 | const rangeString = text.slice(rangeStart, rangeEnd);
|
21225 | const rangeStart2 = Math.min(rangeStart, text.lastIndexOf("\n", rangeStart) + 1);
|
21226 | const indentString = text.slice(rangeStart2, rangeStart).match(/^\s*/u)[0];
|
21227 | const alignmentSize = get_alignment_size_default(indentString, opts.tabWidth);
|
21228 | const rangeResult = await coreFormat(rangeString, {
|
21229 | ...opts,
|
21230 | rangeStart: 0,
|
21231 | rangeEnd: Number.POSITIVE_INFINITY,
|
21232 | // Track the cursor offset only if it's within our range
|
21233 | cursorOffset: opts.cursorOffset > rangeStart && opts.cursorOffset <= rangeEnd ? opts.cursorOffset - rangeStart : -1,
|
21234 | // Always use `lf` to format, we'll replace it later
|
21235 | endOfLine: "lf"
|
21236 | }, alignmentSize);
|
21237 | const rangeTrimmed = rangeResult.formatted.trimEnd();
|
21238 | let {
|
21239 | cursorOffset
|
21240 | } = opts;
|
21241 | if (cursorOffset > rangeEnd) {
|
21242 | cursorOffset += rangeTrimmed.length - rangeString.length;
|
21243 | } else if (rangeResult.cursorOffset >= 0) {
|
21244 | cursorOffset = rangeResult.cursorOffset + rangeStart;
|
21245 | }
|
21246 | let formatted = text.slice(0, rangeStart) + rangeTrimmed + text.slice(rangeEnd);
|
21247 | if (opts.endOfLine !== "lf") {
|
21248 | const eol = convertEndOfLineToChars(opts.endOfLine);
|
21249 | if (cursorOffset >= 0 && eol === "\r\n") {
|
21250 | cursorOffset += countEndOfLineChars(formatted.slice(0, cursorOffset), "\n");
|
21251 | }
|
21252 | formatted = string_replace_all_default(
|
21253 | /* isOptionalObject */
|
21254 | false,
|
21255 | formatted,
|
21256 | "\n",
|
21257 | eol
|
21258 | );
|
21259 | }
|
21260 | return {
|
21261 | formatted,
|
21262 | cursorOffset,
|
21263 | comments: rangeResult.comments
|
21264 | };
|
21265 | }
|
21266 | function ensureIndexInText(text, index, defaultValue) {
|
21267 | if (typeof index !== "number" || Number.isNaN(index) || index < 0 || index > text.length) {
|
21268 | return defaultValue;
|
21269 | }
|
21270 | return index;
|
21271 | }
|
21272 | function normalizeIndexes(text, options8) {
|
21273 | let {
|
21274 | cursorOffset,
|
21275 | rangeStart,
|
21276 | rangeEnd
|
21277 | } = options8;
|
21278 | cursorOffset = ensureIndexInText(text, cursorOffset, -1);
|
21279 | rangeStart = ensureIndexInText(text, rangeStart, 0);
|
21280 | rangeEnd = ensureIndexInText(text, rangeEnd, text.length);
|
21281 | return {
|
21282 | ...options8,
|
21283 | cursorOffset,
|
21284 | rangeStart,
|
21285 | rangeEnd
|
21286 | };
|
21287 | }
|
21288 | function normalizeInputAndOptions(text, options8) {
|
21289 | let {
|
21290 | cursorOffset,
|
21291 | rangeStart,
|
21292 | rangeEnd,
|
21293 | endOfLine
|
21294 | } = normalizeIndexes(text, options8);
|
21295 | const hasBOM = text.charAt(0) === BOM;
|
21296 | if (hasBOM) {
|
21297 | text = text.slice(1);
|
21298 | cursorOffset--;
|
21299 | rangeStart--;
|
21300 | rangeEnd--;
|
21301 | }
|
21302 | if (endOfLine === "auto") {
|
21303 | endOfLine = guessEndOfLine(text);
|
21304 | }
|
21305 | if (text.includes("\r")) {
|
21306 | const countCrlfBefore = (index) => countEndOfLineChars(text.slice(0, Math.max(index, 0)), "\r\n");
|
21307 | cursorOffset -= countCrlfBefore(cursorOffset);
|
21308 | rangeStart -= countCrlfBefore(rangeStart);
|
21309 | rangeEnd -= countCrlfBefore(rangeEnd);
|
21310 | text = normalizeEndOfLine(text);
|
21311 | }
|
21312 | return {
|
21313 | hasBOM,
|
21314 | text,
|
21315 | options: normalizeIndexes(text, {
|
21316 | ...options8,
|
21317 | cursorOffset,
|
21318 | rangeStart,
|
21319 | rangeEnd,
|
21320 | endOfLine
|
21321 | })
|
21322 | };
|
21323 | }
|
21324 | async function hasPragma(text, options8) {
|
21325 | const selectedParser = await resolveParser(options8);
|
21326 | return !selectedParser.hasPragma || selectedParser.hasPragma(text);
|
21327 | }
|
21328 | async function formatWithCursor(originalText, originalOptions) {
|
21329 | let {
|
21330 | hasBOM,
|
21331 | text,
|
21332 | options: options8
|
21333 | } = normalizeInputAndOptions(originalText, await normalize_format_options_default(originalOptions));
|
21334 | if (options8.rangeStart >= options8.rangeEnd && text !== "" || options8.requirePragma && !await hasPragma(text, options8)) {
|
21335 | return {
|
21336 | formatted: originalText,
|
21337 | cursorOffset: originalOptions.cursorOffset,
|
21338 | comments: []
|
21339 | };
|
21340 | }
|
21341 | let result;
|
21342 | if (options8.rangeStart > 0 || options8.rangeEnd < text.length) {
|
21343 | result = await formatRange(text, options8);
|
21344 | } else {
|
21345 | if (!options8.requirePragma && options8.insertPragma && options8.printer.insertPragma && !await hasPragma(text, options8)) {
|
21346 | text = options8.printer.insertPragma(text);
|
21347 | }
|
21348 | result = await coreFormat(text, options8);
|
21349 | }
|
21350 | if (hasBOM) {
|
21351 | result.formatted = BOM + result.formatted;
|
21352 | if (result.cursorOffset >= 0) {
|
21353 | result.cursorOffset++;
|
21354 | }
|
21355 | }
|
21356 | return result;
|
21357 | }
|
21358 | async function parse5(originalText, originalOptions, devOptions) {
|
21359 | const {
|
21360 | text,
|
21361 | options: options8
|
21362 | } = normalizeInputAndOptions(originalText, await normalize_format_options_default(originalOptions));
|
21363 | const parsed = await parse_default(text, options8);
|
21364 | if (devOptions) {
|
21365 | if (devOptions.preprocessForPrint) {
|
21366 | parsed.ast = await prepareToPrint(parsed.ast, options8);
|
21367 | }
|
21368 | if (devOptions.massage) {
|
21369 | parsed.ast = massage_ast_default(parsed.ast, options8);
|
21370 | }
|
21371 | }
|
21372 | return parsed;
|
21373 | }
|
21374 | async function formatAst(ast, options8) {
|
21375 | options8 = await normalize_format_options_default(options8);
|
21376 | const doc2 = await printAstToDoc(ast, options8);
|
21377 | return printDocToString(doc2, options8);
|
21378 | }
|
21379 | async function formatDoc(doc2, options8) {
|
21380 | const text = printDocToDebug(doc2);
|
21381 | const {
|
21382 | formatted
|
21383 | } = await formatWithCursor(text, {
|
21384 | ...options8,
|
21385 | parser: "__js_expression"
|
21386 | });
|
21387 | return formatted;
|
21388 | }
|
21389 | async function printToDoc(originalText, options8) {
|
21390 | options8 = await normalize_format_options_default(options8);
|
21391 | const {
|
21392 | ast
|
21393 | } = await parse_default(originalText, options8);
|
21394 | return printAstToDoc(ast, options8);
|
21395 | }
|
21396 | async function printDocToString2(doc2, options8) {
|
21397 | return printDocToString(doc2, await normalize_format_options_default(options8));
|
21398 | }
|
21399 |
|
21400 | // src/main/option-categories.js
|
21401 | var option_categories_exports = {};
|
21402 | __export(option_categories_exports, {
|
21403 | CATEGORY_CONFIG: () => CATEGORY_CONFIG,
|
21404 | CATEGORY_EDITOR: () => CATEGORY_EDITOR,
|
21405 | CATEGORY_FORMAT: () => CATEGORY_FORMAT,
|
21406 | CATEGORY_GLOBAL: () => CATEGORY_GLOBAL,
|
21407 | CATEGORY_OTHER: () => CATEGORY_OTHER,
|
21408 | CATEGORY_OUTPUT: () => CATEGORY_OUTPUT,
|
21409 | CATEGORY_SPECIAL: () => CATEGORY_SPECIAL
|
21410 | });
|
21411 | var CATEGORY_CONFIG = "Config";
|
21412 | var CATEGORY_EDITOR = "Editor";
|
21413 | var CATEGORY_FORMAT = "Format";
|
21414 | var CATEGORY_OTHER = "Other";
|
21415 | var CATEGORY_OUTPUT = "Output";
|
21416 | var CATEGORY_GLOBAL = "Global";
|
21417 | var CATEGORY_SPECIAL = "Special";
|
21418 |
|
21419 | // src/plugins/builtin-plugins-proxy.js
|
21420 | var builtin_plugins_proxy_exports = {};
|
21421 | __export(builtin_plugins_proxy_exports, {
|
21422 | languages: () => languages,
|
21423 | options: () => options7,
|
21424 | parsers: () => parsers,
|
21425 | printers: () => printers
|
21426 | });
|
21427 |
|
21428 | // src/language-css/languages.evaluate.js
|
21429 | var languages_evaluate_default = [
|
21430 | {
|
21431 | "linguistLanguageId": 50,
|
21432 | "name": "CSS",
|
21433 | "type": "markup",
|
21434 | "tmScope": "source.css",
|
21435 | "aceMode": "css",
|
21436 | "codemirrorMode": "css",
|
21437 | "codemirrorMimeType": "text/css",
|
21438 | "color": "#563d7c",
|
21439 | "extensions": [
|
21440 | ".css",
|
21441 | ".wxss"
|
21442 | ],
|
21443 | "parsers": [
|
21444 | "css"
|
21445 | ],
|
21446 | "vscodeLanguageIds": [
|
21447 | "css"
|
21448 | ]
|
21449 | },
|
21450 | {
|
21451 | "linguistLanguageId": 262764437,
|
21452 | "name": "PostCSS",
|
21453 | "type": "markup",
|
21454 | "color": "#dc3a0c",
|
21455 | "tmScope": "source.postcss",
|
21456 | "group": "CSS",
|
21457 | "extensions": [
|
21458 | ".pcss",
|
21459 | ".postcss"
|
21460 | ],
|
21461 | "aceMode": "text",
|
21462 | "parsers": [
|
21463 | "css"
|
21464 | ],
|
21465 | "vscodeLanguageIds": [
|
21466 | "postcss"
|
21467 | ]
|
21468 | },
|
21469 | {
|
21470 | "linguistLanguageId": 198,
|
21471 | "name": "Less",
|
21472 | "type": "markup",
|
21473 | "color": "#1d365d",
|
21474 | "aliases": [
|
21475 | "less-css"
|
21476 | ],
|
21477 | "extensions": [
|
21478 | ".less"
|
21479 | ],
|
21480 | "tmScope": "source.css.less",
|
21481 | "aceMode": "less",
|
21482 | "codemirrorMode": "css",
|
21483 | "codemirrorMimeType": "text/css",
|
21484 | "parsers": [
|
21485 | "less"
|
21486 | ],
|
21487 | "vscodeLanguageIds": [
|
21488 | "less"
|
21489 | ]
|
21490 | },
|
21491 | {
|
21492 | "linguistLanguageId": 329,
|
21493 | "name": "SCSS",
|
21494 | "type": "markup",
|
21495 | "color": "#c6538c",
|
21496 | "tmScope": "source.css.scss",
|
21497 | "aceMode": "scss",
|
21498 | "codemirrorMode": "css",
|
21499 | "codemirrorMimeType": "text/x-scss",
|
21500 | "extensions": [
|
21501 | ".scss"
|
21502 | ],
|
21503 | "parsers": [
|
21504 | "scss"
|
21505 | ],
|
21506 | "vscodeLanguageIds": [
|
21507 | "scss"
|
21508 | ]
|
21509 | }
|
21510 | ];
|
21511 |
|
21512 | // src/common/common-options.evaluate.js
|
21513 | var common_options_evaluate_default = {
|
21514 | "bracketSpacing": {
|
21515 | "category": "Common",
|
21516 | "type": "boolean",
|
21517 | "default": true,
|
21518 | "description": "Print spaces between brackets.",
|
21519 | "oppositeDescription": "Do not print spaces between brackets."
|
21520 | },
|
21521 | "singleQuote": {
|
21522 | "category": "Common",
|
21523 | "type": "boolean",
|
21524 | "default": false,
|
21525 | "description": "Use single quotes instead of double quotes."
|
21526 | },
|
21527 | "proseWrap": {
|
21528 | "category": "Common",
|
21529 | "type": "choice",
|
21530 | "default": "preserve",
|
21531 | "description": "How to wrap prose.",
|
21532 | "choices": [
|
21533 | {
|
21534 | "value": "always",
|
21535 | "description": "Wrap prose if it exceeds the print width."
|
21536 | },
|
21537 | {
|
21538 | "value": "never",
|
21539 | "description": "Do not wrap prose."
|
21540 | },
|
21541 | {
|
21542 | "value": "preserve",
|
21543 | "description": "Wrap prose as-is."
|
21544 | }
|
21545 | ]
|
21546 | },
|
21547 | "bracketSameLine": {
|
21548 | "category": "Common",
|
21549 | "type": "boolean",
|
21550 | "default": false,
|
21551 | "description": "Put > of opening tags on the last line instead of on a new line."
|
21552 | },
|
21553 | "singleAttributePerLine": {
|
21554 | "category": "Common",
|
21555 | "type": "boolean",
|
21556 | "default": false,
|
21557 | "description": "Enforce single attribute per line in HTML, Vue and JSX."
|
21558 | }
|
21559 | };
|
21560 |
|
21561 | // src/language-css/options.js
|
21562 | var options = {
|
21563 | singleQuote: common_options_evaluate_default.singleQuote
|
21564 | };
|
21565 | var options_default = options;
|
21566 |
|
21567 | // src/language-graphql/languages.evaluate.js
|
21568 | var languages_evaluate_default2 = [
|
21569 | {
|
21570 | "linguistLanguageId": 139,
|
21571 | "name": "GraphQL",
|
21572 | "type": "data",
|
21573 | "color": "#e10098",
|
21574 | "extensions": [
|
21575 | ".graphql",
|
21576 | ".gql",
|
21577 | ".graphqls"
|
21578 | ],
|
21579 | "tmScope": "source.graphql",
|
21580 | "aceMode": "text",
|
21581 | "parsers": [
|
21582 | "graphql"
|
21583 | ],
|
21584 | "vscodeLanguageIds": [
|
21585 | "graphql"
|
21586 | ]
|
21587 | }
|
21588 | ];
|
21589 |
|
21590 | // src/language-graphql/options.js
|
21591 | var options2 = {
|
21592 | bracketSpacing: common_options_evaluate_default.bracketSpacing
|
21593 | };
|
21594 | var options_default2 = options2;
|
21595 |
|
21596 | // src/language-handlebars/languages.evaluate.js
|
21597 | var languages_evaluate_default3 = [
|
21598 | {
|
21599 | "linguistLanguageId": 155,
|
21600 | "name": "Handlebars",
|
21601 | "type": "markup",
|
21602 | "color": "#f7931e",
|
21603 | "aliases": [
|
21604 | "hbs",
|
21605 | "htmlbars"
|
21606 | ],
|
21607 | "extensions": [
|
21608 | ".handlebars",
|
21609 | ".hbs"
|
21610 | ],
|
21611 | "tmScope": "text.html.handlebars",
|
21612 | "aceMode": "handlebars",
|
21613 | "parsers": [
|
21614 | "glimmer"
|
21615 | ],
|
21616 | "vscodeLanguageIds": [
|
21617 | "handlebars"
|
21618 | ]
|
21619 | }
|
21620 | ];
|
21621 |
|
21622 | // src/language-html/languages.evaluate.js
|
21623 | var languages_evaluate_default4 = [
|
21624 | {
|
21625 | "linguistLanguageId": 146,
|
21626 | "name": "Angular",
|
21627 | "type": "markup",
|
21628 | "tmScope": "text.html.basic",
|
21629 | "aceMode": "html",
|
21630 | "codemirrorMode": "htmlmixed",
|
21631 | "codemirrorMimeType": "text/html",
|
21632 | "color": "#e34c26",
|
21633 | "aliases": [
|
21634 | "xhtml"
|
21635 | ],
|
21636 | "extensions": [
|
21637 | ".component.html"
|
21638 | ],
|
21639 | "parsers": [
|
21640 | "angular"
|
21641 | ],
|
21642 | "vscodeLanguageIds": [
|
21643 | "html"
|
21644 | ],
|
21645 | "filenames": []
|
21646 | },
|
21647 | {
|
21648 | "linguistLanguageId": 146,
|
21649 | "name": "HTML",
|
21650 | "type": "markup",
|
21651 | "tmScope": "text.html.basic",
|
21652 | "aceMode": "html",
|
21653 | "codemirrorMode": "htmlmixed",
|
21654 | "codemirrorMimeType": "text/html",
|
21655 | "color": "#e34c26",
|
21656 | "aliases": [
|
21657 | "xhtml"
|
21658 | ],
|
21659 | "extensions": [
|
21660 | ".html",
|
21661 | ".hta",
|
21662 | ".htm",
|
21663 | ".html.hl",
|
21664 | ".inc",
|
21665 | ".xht",
|
21666 | ".xhtml",
|
21667 | ".mjml"
|
21668 | ],
|
21669 | "parsers": [
|
21670 | "html"
|
21671 | ],
|
21672 | "vscodeLanguageIds": [
|
21673 | "html"
|
21674 | ]
|
21675 | },
|
21676 | {
|
21677 | "linguistLanguageId": 146,
|
21678 | "name": "Lightning Web Components",
|
21679 | "type": "markup",
|
21680 | "tmScope": "text.html.basic",
|
21681 | "aceMode": "html",
|
21682 | "codemirrorMode": "htmlmixed",
|
21683 | "codemirrorMimeType": "text/html",
|
21684 | "color": "#e34c26",
|
21685 | "aliases": [
|
21686 | "xhtml"
|
21687 | ],
|
21688 | "extensions": [],
|
21689 | "parsers": [
|
21690 | "lwc"
|
21691 | ],
|
21692 | "vscodeLanguageIds": [
|
21693 | "html"
|
21694 | ],
|
21695 | "filenames": []
|
21696 | },
|
21697 | {
|
21698 | "linguistLanguageId": 391,
|
21699 | "name": "Vue",
|
21700 | "type": "markup",
|
21701 | "color": "#41b883",
|
21702 | "extensions": [
|
21703 | ".vue"
|
21704 | ],
|
21705 | "tmScope": "text.html.vue",
|
21706 | "aceMode": "html",
|
21707 | "parsers": [
|
21708 | "vue"
|
21709 | ],
|
21710 | "vscodeLanguageIds": [
|
21711 | "vue"
|
21712 | ]
|
21713 | }
|
21714 | ];
|
21715 |
|
21716 | // src/language-html/options.js
|
21717 | var CATEGORY_HTML = "HTML";
|
21718 | var options3 = {
|
21719 | bracketSameLine: common_options_evaluate_default.bracketSameLine,
|
21720 | htmlWhitespaceSensitivity: {
|
21721 | category: CATEGORY_HTML,
|
21722 | type: "choice",
|
21723 | default: "css",
|
21724 | description: "How to handle whitespaces in HTML.",
|
21725 | choices: [
|
21726 | {
|
21727 | value: "css",
|
21728 | description: "Respect the default value of CSS display property."
|
21729 | },
|
21730 | {
|
21731 | value: "strict",
|
21732 | description: "Whitespaces are considered sensitive."
|
21733 | },
|
21734 | {
|
21735 | value: "ignore",
|
21736 | description: "Whitespaces are considered insensitive."
|
21737 | }
|
21738 | ]
|
21739 | },
|
21740 | singleAttributePerLine: common_options_evaluate_default.singleAttributePerLine,
|
21741 | vueIndentScriptAndStyle: {
|
21742 | category: CATEGORY_HTML,
|
21743 | type: "boolean",
|
21744 | default: false,
|
21745 | description: "Indent script and style tags in Vue files."
|
21746 | }
|
21747 | };
|
21748 | var options_default3 = options3;
|
21749 |
|
21750 | // src/language-js/languages.evaluate.js
|
21751 | var languages_evaluate_default5 = [
|
21752 | {
|
21753 | "linguistLanguageId": 183,
|
21754 | "name": "JavaScript",
|
21755 | "type": "programming",
|
21756 | "tmScope": "source.js",
|
21757 | "aceMode": "javascript",
|
21758 | "codemirrorMode": "javascript",
|
21759 | "codemirrorMimeType": "text/javascript",
|
21760 | "color": "#f1e05a",
|
21761 | "aliases": [
|
21762 | "js",
|
21763 | "node"
|
21764 | ],
|
21765 | "extensions": [
|
21766 | ".js",
|
21767 | "._js",
|
21768 | ".bones",
|
21769 | ".cjs",
|
21770 | ".es",
|
21771 | ".es6",
|
21772 | ".frag",
|
21773 | ".gs",
|
21774 | ".jake",
|
21775 | ".javascript",
|
21776 | ".jsb",
|
21777 | ".jscad",
|
21778 | ".jsfl",
|
21779 | ".jslib",
|
21780 | ".jsm",
|
21781 | ".jspre",
|
21782 | ".jss",
|
21783 | ".mjs",
|
21784 | ".njs",
|
21785 | ".pac",
|
21786 | ".sjs",
|
21787 | ".ssjs",
|
21788 | ".xsjs",
|
21789 | ".xsjslib",
|
21790 | ".wxs"
|
21791 | ],
|
21792 | "filenames": [
|
21793 | "Jakefile"
|
21794 | ],
|
21795 | "interpreters": [
|
21796 | "chakra",
|
21797 | "d8",
|
21798 | "gjs",
|
21799 | "js",
|
21800 | "node",
|
21801 | "nodejs",
|
21802 | "qjs",
|
21803 | "rhino",
|
21804 | "v8",
|
21805 | "v8-shell",
|
21806 | "zx"
|
21807 | ],
|
21808 | "parsers": [
|
21809 | "babel",
|
21810 | "acorn",
|
21811 | "espree",
|
21812 | "meriyah",
|
21813 | "babel-flow",
|
21814 | "babel-ts",
|
21815 | "flow",
|
21816 | "typescript"
|
21817 | ],
|
21818 | "vscodeLanguageIds": [
|
21819 | "javascript",
|
21820 | "mongo"
|
21821 | ]
|
21822 | },
|
21823 | {
|
21824 | "linguistLanguageId": 183,
|
21825 | "name": "Flow",
|
21826 | "type": "programming",
|
21827 | "tmScope": "source.js",
|
21828 | "aceMode": "javascript",
|
21829 | "codemirrorMode": "javascript",
|
21830 | "codemirrorMimeType": "text/javascript",
|
21831 | "color": "#f1e05a",
|
21832 | "aliases": [],
|
21833 | "extensions": [
|
21834 | ".js.flow"
|
21835 | ],
|
21836 | "filenames": [],
|
21837 | "interpreters": [
|
21838 | "chakra",
|
21839 | "d8",
|
21840 | "gjs",
|
21841 | "js",
|
21842 | "node",
|
21843 | "nodejs",
|
21844 | "qjs",
|
21845 | "rhino",
|
21846 | "v8",
|
21847 | "v8-shell"
|
21848 | ],
|
21849 | "parsers": [
|
21850 | "flow",
|
21851 | "babel-flow"
|
21852 | ],
|
21853 | "vscodeLanguageIds": [
|
21854 | "javascript"
|
21855 | ]
|
21856 | },
|
21857 | {
|
21858 | "linguistLanguageId": 183,
|
21859 | "name": "JSX",
|
21860 | "type": "programming",
|
21861 | "tmScope": "source.js.jsx",
|
21862 | "aceMode": "javascript",
|
21863 | "codemirrorMode": "jsx",
|
21864 | "codemirrorMimeType": "text/jsx",
|
21865 | "color": void 0,
|
21866 | "aliases": void 0,
|
21867 | "extensions": [
|
21868 | ".jsx"
|
21869 | ],
|
21870 | "filenames": void 0,
|
21871 | "interpreters": void 0,
|
21872 | "parsers": [
|
21873 | "babel",
|
21874 | "babel-flow",
|
21875 | "babel-ts",
|
21876 | "flow",
|
21877 | "typescript",
|
21878 | "espree",
|
21879 | "meriyah"
|
21880 | ],
|
21881 | "vscodeLanguageIds": [
|
21882 | "javascriptreact"
|
21883 | ],
|
21884 | "group": "JavaScript"
|
21885 | },
|
21886 | {
|
21887 | "linguistLanguageId": 378,
|
21888 | "name": "TypeScript",
|
21889 | "type": "programming",
|
21890 | "color": "#3178c6",
|
21891 | "aliases": [
|
21892 | "ts"
|
21893 | ],
|
21894 | "interpreters": [
|
21895 | "deno",
|
21896 | "ts-node"
|
21897 | ],
|
21898 | "extensions": [
|
21899 | ".ts",
|
21900 | ".cts",
|
21901 | ".mts"
|
21902 | ],
|
21903 | "tmScope": "source.ts",
|
21904 | "aceMode": "typescript",
|
21905 | "codemirrorMode": "javascript",
|
21906 | "codemirrorMimeType": "application/typescript",
|
21907 | "parsers": [
|
21908 | "typescript",
|
21909 | "babel-ts"
|
21910 | ],
|
21911 | "vscodeLanguageIds": [
|
21912 | "typescript"
|
21913 | ]
|
21914 | },
|
21915 | {
|
21916 | "linguistLanguageId": 94901924,
|
21917 | "name": "TSX",
|
21918 | "type": "programming",
|
21919 | "color": "#3178c6",
|
21920 | "group": "TypeScript",
|
21921 | "extensions": [
|
21922 | ".tsx"
|
21923 | ],
|
21924 | "tmScope": "source.tsx",
|
21925 | "aceMode": "javascript",
|
21926 | "codemirrorMode": "jsx",
|
21927 | "codemirrorMimeType": "text/jsx",
|
21928 | "parsers": [
|
21929 | "typescript",
|
21930 | "babel-ts"
|
21931 | ],
|
21932 | "vscodeLanguageIds": [
|
21933 | "typescriptreact"
|
21934 | ]
|
21935 | }
|
21936 | ];
|
21937 |
|
21938 | // src/language-js/options.js
|
21939 | var CATEGORY_JAVASCRIPT = "JavaScript";
|
21940 | var options4 = {
|
21941 | arrowParens: {
|
21942 | category: CATEGORY_JAVASCRIPT,
|
21943 | type: "choice",
|
21944 | default: "always",
|
21945 | description: "Include parentheses around a sole arrow function parameter.",
|
21946 | choices: [
|
21947 | {
|
21948 | value: "always",
|
21949 | description: "Always include parens. Example: `(x) => x`"
|
21950 | },
|
21951 | {
|
21952 | value: "avoid",
|
21953 | description: "Omit parens when possible. Example: `x => x`"
|
21954 | }
|
21955 | ]
|
21956 | },
|
21957 | bracketSameLine: common_options_evaluate_default.bracketSameLine,
|
21958 | bracketSpacing: common_options_evaluate_default.bracketSpacing,
|
21959 | jsxBracketSameLine: {
|
21960 | category: CATEGORY_JAVASCRIPT,
|
21961 | type: "boolean",
|
21962 | description: "Put > on the last line instead of at a new line.",
|
21963 | deprecated: "2.4.0"
|
21964 | },
|
21965 | semi: {
|
21966 | category: CATEGORY_JAVASCRIPT,
|
21967 | type: "boolean",
|
21968 | default: true,
|
21969 | description: "Print semicolons.",
|
21970 | oppositeDescription: "Do not print semicolons, except at the beginning of lines which may need them."
|
21971 | },
|
21972 | experimentalTernaries: {
|
21973 | category: CATEGORY_JAVASCRIPT,
|
21974 | type: "boolean",
|
21975 | default: false,
|
21976 | description: "Use curious ternaries, with the question mark after the condition.",
|
21977 | oppositeDescription: "Default behavior of ternaries; keep question marks on the same line as the consequent."
|
21978 | },
|
21979 | singleQuote: common_options_evaluate_default.singleQuote,
|
21980 | jsxSingleQuote: {
|
21981 | category: CATEGORY_JAVASCRIPT,
|
21982 | type: "boolean",
|
21983 | default: false,
|
21984 | description: "Use single quotes in JSX."
|
21985 | },
|
21986 | quoteProps: {
|
21987 | category: CATEGORY_JAVASCRIPT,
|
21988 | type: "choice",
|
21989 | default: "as-needed",
|
21990 | description: "Change when properties in objects are quoted.",
|
21991 | choices: [
|
21992 | {
|
21993 | value: "as-needed",
|
21994 | description: "Only add quotes around object properties where required."
|
21995 | },
|
21996 | {
|
21997 | value: "consistent",
|
21998 | description: "If at least one property in an object requires quotes, quote all properties."
|
21999 | },
|
22000 | {
|
22001 | value: "preserve",
|
22002 | description: "Respect the input use of quotes in object properties."
|
22003 | }
|
22004 | ]
|
22005 | },
|
22006 | trailingComma: {
|
22007 | category: CATEGORY_JAVASCRIPT,
|
22008 | type: "choice",
|
22009 | default: "all",
|
22010 | description: "Print trailing commas wherever possible when multi-line.",
|
22011 | choices: [
|
22012 | {
|
22013 | value: "all",
|
22014 | description: "Trailing commas wherever possible (including function arguments)."
|
22015 | },
|
22016 | {
|
22017 | value: "es5",
|
22018 | description: "Trailing commas where valid in ES5 (objects, arrays, etc.)"
|
22019 | },
|
22020 | { value: "none", description: "No trailing commas." }
|
22021 | ]
|
22022 | },
|
22023 | singleAttributePerLine: common_options_evaluate_default.singleAttributePerLine
|
22024 | };
|
22025 | var options_default4 = options4;
|
22026 |
|
22027 | // src/language-json/languages.evaluate.js
|
22028 | var languages_evaluate_default6 = [
|
22029 | {
|
22030 | "linguistLanguageId": 174,
|
22031 | "name": "JSON.stringify",
|
22032 | "type": "data",
|
22033 | "color": "#292929",
|
22034 | "tmScope": "source.json",
|
22035 | "aceMode": "json",
|
22036 | "codemirrorMode": "javascript",
|
22037 | "codemirrorMimeType": "application/json",
|
22038 | "aliases": [
|
22039 | "geojson",
|
22040 | "jsonl",
|
22041 | "topojson"
|
22042 | ],
|
22043 | "extensions": [
|
22044 | ".importmap"
|
22045 | ],
|
22046 | "filenames": [
|
22047 | "package.json",
|
22048 | "package-lock.json",
|
22049 | "composer.json"
|
22050 | ],
|
22051 | "parsers": [
|
22052 | "json-stringify"
|
22053 | ],
|
22054 | "vscodeLanguageIds": [
|
22055 | "json"
|
22056 | ]
|
22057 | },
|
22058 | {
|
22059 | "linguistLanguageId": 174,
|
22060 | "name": "JSON",
|
22061 | "type": "data",
|
22062 | "color": "#292929",
|
22063 | "tmScope": "source.json",
|
22064 | "aceMode": "json",
|
22065 | "codemirrorMode": "javascript",
|
22066 | "codemirrorMimeType": "application/json",
|
22067 | "aliases": [
|
22068 | "geojson",
|
22069 | "jsonl",
|
22070 | "topojson"
|
22071 | ],
|
22072 | "extensions": [
|
22073 | ".json",
|
22074 | ".4DForm",
|
22075 | ".4DProject",
|
22076 | ".avsc",
|
22077 | ".geojson",
|
22078 | ".gltf",
|
22079 | ".har",
|
22080 | ".ice",
|
22081 | ".JSON-tmLanguage",
|
22082 | ".mcmeta",
|
22083 | ".tfstate",
|
22084 | ".tfstate.backup",
|
22085 | ".topojson",
|
22086 | ".webapp",
|
22087 | ".webmanifest",
|
22088 | ".yy",
|
22089 | ".yyp"
|
22090 | ],
|
22091 | "filenames": [
|
22092 | ".all-contributorsrc",
|
22093 | ".arcconfig",
|
22094 | ".auto-changelog",
|
22095 | ".c8rc",
|
22096 | ".htmlhintrc",
|
22097 | ".imgbotconfig",
|
22098 | ".nycrc",
|
22099 | ".tern-config",
|
22100 | ".tern-project",
|
22101 | ".watchmanconfig",
|
22102 | "Pipfile.lock",
|
22103 | "composer.lock",
|
22104 | "flake.lock",
|
22105 | "mcmod.info",
|
22106 | ".babelrc",
|
22107 | ".jscsrc",
|
22108 | ".jshintrc",
|
22109 | ".jslintrc",
|
22110 | ".swcrc"
|
22111 | ],
|
22112 | "parsers": [
|
22113 | "json"
|
22114 | ],
|
22115 | "vscodeLanguageIds": [
|
22116 | "json"
|
22117 | ]
|
22118 | },
|
22119 | {
|
22120 | "linguistLanguageId": 423,
|
22121 | "name": "JSON with Comments",
|
22122 | "type": "data",
|
22123 | "color": "#292929",
|
22124 | "group": "JSON",
|
22125 | "tmScope": "source.js",
|
22126 | "aceMode": "javascript",
|
22127 | "codemirrorMode": "javascript",
|
22128 | "codemirrorMimeType": "text/javascript",
|
22129 | "aliases": [
|
22130 | "jsonc"
|
22131 | ],
|
22132 | "extensions": [
|
22133 | ".jsonc",
|
22134 | ".code-snippets",
|
22135 | ".code-workspace",
|
22136 | ".sublime-build",
|
22137 | ".sublime-commands",
|
22138 | ".sublime-completions",
|
22139 | ".sublime-keymap",
|
22140 | ".sublime-macro",
|
22141 | ".sublime-menu",
|
22142 | ".sublime-mousemap",
|
22143 | ".sublime-project",
|
22144 | ".sublime-settings",
|
22145 | ".sublime-theme",
|
22146 | ".sublime-workspace",
|
22147 | ".sublime_metrics",
|
22148 | ".sublime_session"
|
22149 | ],
|
22150 | "filenames": [],
|
22151 | "parsers": [
|
22152 | "jsonc"
|
22153 | ],
|
22154 | "vscodeLanguageIds": [
|
22155 | "jsonc"
|
22156 | ]
|
22157 | },
|
22158 | {
|
22159 | "linguistLanguageId": 175,
|
22160 | "name": "JSON5",
|
22161 | "type": "data",
|
22162 | "color": "#267CB9",
|
22163 | "extensions": [
|
22164 | ".json5"
|
22165 | ],
|
22166 | "tmScope": "source.js",
|
22167 | "aceMode": "javascript",
|
22168 | "codemirrorMode": "javascript",
|
22169 | "codemirrorMimeType": "application/json",
|
22170 | "parsers": [
|
22171 | "json5"
|
22172 | ],
|
22173 | "vscodeLanguageIds": [
|
22174 | "json5"
|
22175 | ]
|
22176 | }
|
22177 | ];
|
22178 |
|
22179 | // src/language-markdown/languages.evaluate.js
|
22180 | var languages_evaluate_default7 = [
|
22181 | {
|
22182 | "linguistLanguageId": 222,
|
22183 | "name": "Markdown",
|
22184 | "type": "prose",
|
22185 | "color": "#083fa1",
|
22186 | "aliases": [
|
22187 | "md",
|
22188 | "pandoc"
|
22189 | ],
|
22190 | "aceMode": "markdown",
|
22191 | "codemirrorMode": "gfm",
|
22192 | "codemirrorMimeType": "text/x-gfm",
|
22193 | "wrap": true,
|
22194 | "extensions": [
|
22195 | ".md",
|
22196 | ".livemd",
|
22197 | ".markdown",
|
22198 | ".mdown",
|
22199 | ".mdwn",
|
22200 | ".mkd",
|
22201 | ".mkdn",
|
22202 | ".mkdown",
|
22203 | ".ronn",
|
22204 | ".scd",
|
22205 | ".workbook"
|
22206 | ],
|
22207 | "filenames": [
|
22208 | "contents.lr",
|
22209 | "README"
|
22210 | ],
|
22211 | "tmScope": "text.md",
|
22212 | "parsers": [
|
22213 | "markdown"
|
22214 | ],
|
22215 | "vscodeLanguageIds": [
|
22216 | "markdown"
|
22217 | ]
|
22218 | },
|
22219 | {
|
22220 | "linguistLanguageId": 222,
|
22221 | "name": "MDX",
|
22222 | "type": "prose",
|
22223 | "color": "#083fa1",
|
22224 | "aliases": [
|
22225 | "md",
|
22226 | "pandoc"
|
22227 | ],
|
22228 | "aceMode": "markdown",
|
22229 | "codemirrorMode": "gfm",
|
22230 | "codemirrorMimeType": "text/x-gfm",
|
22231 | "wrap": true,
|
22232 | "extensions": [
|
22233 | ".mdx"
|
22234 | ],
|
22235 | "filenames": [],
|
22236 | "tmScope": "text.md",
|
22237 | "parsers": [
|
22238 | "mdx"
|
22239 | ],
|
22240 | "vscodeLanguageIds": [
|
22241 | "mdx"
|
22242 | ]
|
22243 | }
|
22244 | ];
|
22245 |
|
22246 | // src/language-markdown/options.js
|
22247 | var options5 = {
|
22248 | proseWrap: common_options_evaluate_default.proseWrap,
|
22249 | singleQuote: common_options_evaluate_default.singleQuote
|
22250 | };
|
22251 | var options_default5 = options5;
|
22252 |
|
22253 | // src/language-yaml/languages.evaluate.js
|
22254 | var languages_evaluate_default8 = [
|
22255 | {
|
22256 | "linguistLanguageId": 407,
|
22257 | "name": "YAML",
|
22258 | "type": "data",
|
22259 | "color": "#cb171e",
|
22260 | "tmScope": "source.yaml",
|
22261 | "aliases": [
|
22262 | "yml"
|
22263 | ],
|
22264 | "extensions": [
|
22265 | ".yml",
|
22266 | ".mir",
|
22267 | ".reek",
|
22268 | ".rviz",
|
22269 | ".sublime-syntax",
|
22270 | ".syntax",
|
22271 | ".yaml",
|
22272 | ".yaml-tmlanguage",
|
22273 | ".yaml.sed",
|
22274 | ".yml.mysql"
|
22275 | ],
|
22276 | "filenames": [
|
22277 | ".clang-format",
|
22278 | ".clang-tidy",
|
22279 | ".gemrc",
|
22280 | "CITATION.cff",
|
22281 | "glide.lock",
|
22282 | ".prettierrc",
|
22283 | ".stylelintrc",
|
22284 | ".lintstagedrc"
|
22285 | ],
|
22286 | "aceMode": "yaml",
|
22287 | "codemirrorMode": "yaml",
|
22288 | "codemirrorMimeType": "text/x-yaml",
|
22289 | "parsers": [
|
22290 | "yaml"
|
22291 | ],
|
22292 | "vscodeLanguageIds": [
|
22293 | "yaml",
|
22294 | "ansible",
|
22295 | "home-assistant"
|
22296 | ]
|
22297 | }
|
22298 | ];
|
22299 |
|
22300 | // src/language-yaml/options.js
|
22301 | var options6 = {
|
22302 | bracketSpacing: common_options_evaluate_default.bracketSpacing,
|
22303 | singleQuote: common_options_evaluate_default.singleQuote,
|
22304 | proseWrap: common_options_evaluate_default.proseWrap
|
22305 | };
|
22306 | var options_default6 = options6;
|
22307 |
|
22308 | // src/plugins/builtin-plugins-proxy.js
|
22309 | function createParsersAndPrinters(modules) {
|
22310 | const parsers2 = /* @__PURE__ */ Object.create(null);
|
22311 | const printers2 = /* @__PURE__ */ Object.create(null);
|
22312 | for (const {
|
22313 | importPlugin: importPlugin2,
|
22314 | parsers: parserNames = [],
|
22315 | printers: printerNames = []
|
22316 | } of modules) {
|
22317 | const loadPlugin2 = async () => {
|
22318 | const plugin = await importPlugin2();
|
22319 | Object.assign(parsers2, plugin.parsers);
|
22320 | Object.assign(printers2, plugin.printers);
|
22321 | return plugin;
|
22322 | };
|
22323 | for (const parserName of parserNames) {
|
22324 | parsers2[parserName] = async () => (await loadPlugin2()).parsers[parserName];
|
22325 | }
|
22326 | for (const printerName of printerNames) {
|
22327 | printers2[printerName] = async () => (await loadPlugin2()).printers[printerName];
|
22328 | }
|
22329 | }
|
22330 | return { parsers: parsers2, printers: printers2 };
|
22331 | }
|
22332 | var options7 = {
|
22333 | ...options_default,
|
22334 | ...options_default2,
|
22335 | ...options_default3,
|
22336 | ...options_default4,
|
22337 | ...options_default5,
|
22338 | ...options_default6
|
22339 | };
|
22340 | var languages = [
|
22341 | ...languages_evaluate_default,
|
22342 | ...languages_evaluate_default2,
|
22343 | ...languages_evaluate_default3,
|
22344 | ...languages_evaluate_default4,
|
22345 | ...languages_evaluate_default5,
|
22346 | ...languages_evaluate_default6,
|
22347 | ...languages_evaluate_default7,
|
22348 | ...languages_evaluate_default8
|
22349 | ];
|
22350 | var { parsers, printers } = createParsersAndPrinters([
|
22351 | {
|
22352 | importPlugin: () => import("./plugins/acorn.mjs"),
|
22353 | parsers: ["acorn", "espree"]
|
22354 | },
|
22355 | {
|
22356 | importPlugin: () => import("./plugins/angular.mjs"),
|
22357 | parsers: [
|
22358 | "__ng_action",
|
22359 | "__ng_binding",
|
22360 | "__ng_interpolation",
|
22361 | "__ng_directive"
|
22362 | ]
|
22363 | },
|
22364 | {
|
22365 | importPlugin: () => import("./plugins/babel.mjs"),
|
22366 | parsers: [
|
22367 | "babel",
|
22368 | "babel-flow",
|
22369 | "babel-ts",
|
22370 | "__js_expression",
|
22371 | "__ts_expression",
|
22372 | "__vue_expression",
|
22373 | "__vue_ts_expression",
|
22374 | "__vue_event_binding",
|
22375 | "__vue_ts_event_binding",
|
22376 | "__babel_estree",
|
22377 | "json",
|
22378 | "json5",
|
22379 | "jsonc",
|
22380 | "json-stringify"
|
22381 | ]
|
22382 | },
|
22383 | {
|
22384 | importPlugin: () => import("./plugins/estree.mjs"),
|
22385 | printers: ["estree", "estree-json"]
|
22386 | },
|
22387 | {
|
22388 | importPlugin: () => import("./plugins/flow.mjs"),
|
22389 | parsers: ["flow"]
|
22390 | },
|
22391 | {
|
22392 | importPlugin: () => import("./plugins/glimmer.mjs"),
|
22393 | parsers: ["glimmer"],
|
22394 | printers: ["glimmer"]
|
22395 | },
|
22396 | {
|
22397 | importPlugin: () => import("./plugins/graphql.mjs"),
|
22398 | parsers: ["graphql"],
|
22399 | printers: ["graphql"]
|
22400 | },
|
22401 | {
|
22402 | importPlugin: () => import("./plugins/html.mjs"),
|
22403 | parsers: ["html", "angular", "vue", "lwc"],
|
22404 | printers: ["html"]
|
22405 | },
|
22406 | {
|
22407 | importPlugin: () => import("./plugins/markdown.mjs"),
|
22408 | parsers: ["markdown", "mdx", "remark"],
|
22409 | printers: ["mdast"]
|
22410 | },
|
22411 | {
|
22412 | importPlugin: () => import("./plugins/meriyah.mjs"),
|
22413 | parsers: ["meriyah"]
|
22414 | },
|
22415 | {
|
22416 | importPlugin: () => import("./plugins/postcss.mjs"),
|
22417 | parsers: ["css", "less", "scss"],
|
22418 | printers: ["postcss"]
|
22419 | },
|
22420 | {
|
22421 | importPlugin: () => import("./plugins/typescript.mjs"),
|
22422 | parsers: ["typescript"]
|
22423 | },
|
22424 | {
|
22425 | importPlugin: () => import("./plugins/yaml.mjs"),
|
22426 | parsers: ["yaml"],
|
22427 | printers: ["yaml"]
|
22428 | }
|
22429 | ]);
|
22430 |
|
22431 | // src/main/plugins/load-builtin-plugins.js
|
22432 | function loadBuiltinPlugins() {
|
22433 | return [builtin_plugins_proxy_exports];
|
22434 | }
|
22435 | var load_builtin_plugins_default = loadBuiltinPlugins;
|
22436 |
|
22437 | // src/main/plugins/load-plugin.js
|
22438 | import path12 from "path";
|
22439 | import { pathToFileURL as pathToFileURL5 } from "url";
|
22440 |
|
22441 | // src/utils/import-from-directory.js
|
22442 | import path11 from "path";
|
22443 | function importFromDirectory(specifier, directory) {
|
22444 | return import_from_file_default(specifier, path11.join(directory, "noop.js"));
|
22445 | }
|
22446 | var import_from_directory_default = importFromDirectory;
|
22447 |
|
22448 | // src/main/plugins/load-plugin.js
|
22449 | async function importPlugin(name, cwd) {
|
22450 | if (path12.isAbsolute(name)) {
|
22451 | return import(pathToFileURL5(name).href);
|
22452 | }
|
22453 | try {
|
22454 | return await import(pathToFileURL5(path12.resolve(name)).href);
|
22455 | } catch {
|
22456 | return import_from_directory_default(name, cwd);
|
22457 | }
|
22458 | }
|
22459 | async function loadPluginWithoutCache(plugin, cwd) {
|
22460 | const module = await importPlugin(plugin, cwd);
|
22461 | return { name: plugin, ...module.default ?? module };
|
22462 | }
|
22463 | var cache2 = /* @__PURE__ */ new Map();
|
22464 | function loadPlugin(plugin) {
|
22465 | if (typeof plugin !== "string") {
|
22466 | return plugin;
|
22467 | }
|
22468 | const cwd = process.cwd();
|
22469 | const cacheKey = JSON.stringify({ name: plugin, cwd });
|
22470 | if (!cache2.has(cacheKey)) {
|
22471 | cache2.set(cacheKey, loadPluginWithoutCache(plugin, cwd));
|
22472 | }
|
22473 | return cache2.get(cacheKey);
|
22474 | }
|
22475 | function clearCache2() {
|
22476 | cache2.clear();
|
22477 | }
|
22478 |
|
22479 | // src/main/plugins/load-plugins.js
|
22480 | function loadPlugins(plugins = []) {
|
22481 | return Promise.all(plugins.map((plugin) => loadPlugin(plugin)));
|
22482 | }
|
22483 | var load_plugins_default = loadPlugins;
|
22484 |
|
22485 | // src/utils/object-omit.js
|
22486 | function omit(object, keys) {
|
22487 | keys = new Set(keys);
|
22488 | return Object.fromEntries(
|
22489 | Object.entries(object).filter(([key2]) => !keys.has(key2))
|
22490 | );
|
22491 | }
|
22492 | var object_omit_default = omit;
|
22493 |
|
22494 | // src/index.js
|
22495 | import * as doc from "./doc.mjs";
|
22496 |
|
22497 | // src/main/version.evaluate.cjs
|
22498 | var version_evaluate_default = "3.3.3";
|
22499 |
|
22500 | // src/utils/public.js
|
22501 | var public_exports = {};
|
22502 | __export(public_exports, {
|
22503 | addDanglingComment: () => addDanglingComment,
|
22504 | addLeadingComment: () => addLeadingComment,
|
22505 | addTrailingComment: () => addTrailingComment,
|
22506 | getAlignmentSize: () => get_alignment_size_default,
|
22507 | getIndentSize: () => get_indent_size_default,
|
22508 | getMaxContinuousCount: () => get_max_continuous_count_default,
|
22509 | getNextNonSpaceNonCommentCharacter: () => get_next_non_space_non_comment_character_default,
|
22510 | getNextNonSpaceNonCommentCharacterIndex: () => getNextNonSpaceNonCommentCharacterIndex2,
|
22511 | getStringWidth: () => get_string_width_default,
|
22512 | hasNewline: () => has_newline_default,
|
22513 | hasNewlineInRange: () => has_newline_in_range_default,
|
22514 | hasSpaces: () => has_spaces_default,
|
22515 | isNextLineEmpty: () => isNextLineEmpty2,
|
22516 | isNextLineEmptyAfterIndex: () => is_next_line_empty_default,
|
22517 | isPreviousLineEmpty: () => isPreviousLineEmpty2,
|
22518 | makeString: () => make_string_default,
|
22519 | skip: () => skip,
|
22520 | skipEverythingButNewLine: () => skipEverythingButNewLine,
|
22521 | skipInlineComment: () => skip_inline_comment_default,
|
22522 | skipNewline: () => skip_newline_default,
|
22523 | skipSpaces: () => skipSpaces,
|
22524 | skipToLineEnd: () => skipToLineEnd,
|
22525 | skipTrailingComment: () => skip_trailing_comment_default,
|
22526 | skipWhitespace: () => skipWhitespace
|
22527 | });
|
22528 |
|
22529 | // src/utils/skip-inline-comment.js
|
22530 | function skipInlineComment(text, startIndex) {
|
22531 | if (startIndex === false) {
|
22532 | return false;
|
22533 | }
|
22534 | if (text.charAt(startIndex) === "/" && text.charAt(startIndex + 1) === "*") {
|
22535 | for (let i = startIndex + 2; i < text.length; ++i) {
|
22536 | if (text.charAt(i) === "*" && text.charAt(i + 1) === "/") {
|
22537 | return i + 2;
|
22538 | }
|
22539 | }
|
22540 | }
|
22541 | return startIndex;
|
22542 | }
|
22543 | var skip_inline_comment_default = skipInlineComment;
|
22544 |
|
22545 | // src/utils/skip-trailing-comment.js
|
22546 | function skipTrailingComment(text, startIndex) {
|
22547 | if (startIndex === false) {
|
22548 | return false;
|
22549 | }
|
22550 | if (text.charAt(startIndex) === "/" && text.charAt(startIndex + 1) === "/") {
|
22551 | return skipEverythingButNewLine(text, startIndex);
|
22552 | }
|
22553 | return startIndex;
|
22554 | }
|
22555 | var skip_trailing_comment_default = skipTrailingComment;
|
22556 |
|
22557 | // src/utils/get-next-non-space-non-comment-character-index.js
|
22558 | function getNextNonSpaceNonCommentCharacterIndex(text, startIndex) {
|
22559 | let oldIdx = null;
|
22560 | let nextIdx = startIndex;
|
22561 | while (nextIdx !== oldIdx) {
|
22562 | oldIdx = nextIdx;
|
22563 | nextIdx = skipSpaces(text, nextIdx);
|
22564 | nextIdx = skip_inline_comment_default(text, nextIdx);
|
22565 | nextIdx = skip_trailing_comment_default(text, nextIdx);
|
22566 | nextIdx = skip_newline_default(text, nextIdx);
|
22567 | }
|
22568 | return nextIdx;
|
22569 | }
|
22570 | var get_next_non_space_non_comment_character_index_default = getNextNonSpaceNonCommentCharacterIndex;
|
22571 |
|
22572 | // src/utils/is-next-line-empty.js
|
22573 | function isNextLineEmpty(text, startIndex) {
|
22574 | let oldIdx = null;
|
22575 | let idx = startIndex;
|
22576 | while (idx !== oldIdx) {
|
22577 | oldIdx = idx;
|
22578 | idx = skipToLineEnd(text, idx);
|
22579 | idx = skip_inline_comment_default(text, idx);
|
22580 | idx = skipSpaces(text, idx);
|
22581 | }
|
22582 | idx = skip_trailing_comment_default(text, idx);
|
22583 | idx = skip_newline_default(text, idx);
|
22584 | return idx !== false && has_newline_default(text, idx);
|
22585 | }
|
22586 | var is_next_line_empty_default = isNextLineEmpty;
|
22587 |
|
22588 | // src/utils/get-indent-size.js
|
22589 | function getIndentSize(value, tabWidth) {
|
22590 | const lastNewlineIndex = value.lastIndexOf("\n");
|
22591 | if (lastNewlineIndex === -1) {
|
22592 | return 0;
|
22593 | }
|
22594 | return get_alignment_size_default(
|
22595 | // All the leading whitespaces
|
22596 | value.slice(lastNewlineIndex + 1).match(/^[\t ]*/u)[0],
|
22597 | tabWidth
|
22598 | );
|
22599 | }
|
22600 | var get_indent_size_default = getIndentSize;
|
22601 |
|
22602 | // node_modules/escape-string-regexp/index.js
|
22603 | function escapeStringRegexp(string) {
|
22604 | if (typeof string !== "string") {
|
22605 | throw new TypeError("Expected a string");
|
22606 | }
|
22607 | return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
22608 | }
|
22609 |
|
22610 | // src/utils/get-max-continuous-count.js
|
22611 | function getMaxContinuousCount(text, searchString) {
|
22612 | const results = text.match(
|
22613 | new RegExp(`(${escapeStringRegexp(searchString)})+`, "gu")
|
22614 | );
|
22615 | if (results === null) {
|
22616 | return 0;
|
22617 | }
|
22618 | return results.reduce(
|
22619 | (maxCount, result) => Math.max(maxCount, result.length / searchString.length),
|
22620 | 0
|
22621 | );
|
22622 | }
|
22623 | var get_max_continuous_count_default = getMaxContinuousCount;
|
22624 |
|
22625 | // src/utils/get-next-non-space-non-comment-character.js
|
22626 | function getNextNonSpaceNonCommentCharacter(text, startIndex) {
|
22627 | const index = get_next_non_space_non_comment_character_index_default(text, startIndex);
|
22628 | return index === false ? "" : text.charAt(index);
|
22629 | }
|
22630 | var get_next_non_space_non_comment_character_default = getNextNonSpaceNonCommentCharacter;
|
22631 |
|
22632 | // src/utils/has-newline-in-range.js
|
22633 | function hasNewlineInRange(text, startIndex, endIndex) {
|
22634 | for (let i = startIndex; i < endIndex; ++i) {
|
22635 | if (text.charAt(i) === "\n") {
|
22636 | return true;
|
22637 | }
|
22638 | }
|
22639 | return false;
|
22640 | }
|
22641 | var has_newline_in_range_default = hasNewlineInRange;
|
22642 |
|
22643 | // src/utils/has-spaces.js
|
22644 | function hasSpaces(text, startIndex, options8 = {}) {
|
22645 | const idx = skipSpaces(
|
22646 | text,
|
22647 | options8.backwards ? startIndex - 1 : startIndex,
|
22648 | options8
|
22649 | );
|
22650 | return idx !== startIndex;
|
22651 | }
|
22652 | var has_spaces_default = hasSpaces;
|
22653 |
|
22654 | // src/utils/make-string.js
|
22655 | function makeString(rawText, enclosingQuote, unescapeUnnecessaryEscapes) {
|
22656 | const otherQuote = enclosingQuote === '"' ? "'" : '"';
|
22657 | const regex = /\\(.)|(["'])/gsu;
|
22658 | const raw = string_replace_all_default(
|
22659 | /* isOptionalObject */
|
22660 | false,
|
22661 | rawText,
|
22662 | regex,
|
22663 | (match, escaped, quote) => {
|
22664 | if (escaped === otherQuote) {
|
22665 | return escaped;
|
22666 | }
|
22667 | if (quote === enclosingQuote) {
|
22668 | return "\\" + quote;
|
22669 | }
|
22670 | if (quote) {
|
22671 | return quote;
|
22672 | }
|
22673 | return unescapeUnnecessaryEscapes && /^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/u.test(escaped) ? escaped : "\\" + escaped;
|
22674 | }
|
22675 | );
|
22676 | return enclosingQuote + raw + enclosingQuote;
|
22677 | }
|
22678 | var make_string_default = makeString;
|
22679 |
|
22680 | // src/utils/public.js
|
22681 | function legacyGetNextNonSpaceNonCommentCharacterIndex(text, node, locEnd) {
|
22682 | return get_next_non_space_non_comment_character_index_default(
|
22683 | text,
|
22684 | locEnd(node)
|
22685 | );
|
22686 | }
|
22687 | function getNextNonSpaceNonCommentCharacterIndex2(text, startIndex) {
|
22688 | return arguments.length === 2 || typeof startIndex === "number" ? get_next_non_space_non_comment_character_index_default(text, startIndex) : (
|
22689 | // @ts-expect-error -- expected
|
22690 | // eslint-disable-next-line prefer-rest-params
|
22691 | legacyGetNextNonSpaceNonCommentCharacterIndex(...arguments)
|
22692 | );
|
22693 | }
|
22694 | function legacyIsPreviousLineEmpty(text, node, locStart) {
|
22695 | return is_previous_line_empty_default(text, locStart(node));
|
22696 | }
|
22697 | function isPreviousLineEmpty2(text, startIndex) {
|
22698 | return arguments.length === 2 || typeof startIndex === "number" ? is_previous_line_empty_default(text, startIndex) : (
|
22699 | // @ts-expect-error -- expected
|
22700 | // eslint-disable-next-line prefer-rest-params
|
22701 | legacyIsPreviousLineEmpty(...arguments)
|
22702 | );
|
22703 | }
|
22704 | function legacyIsNextLineEmpty(text, node, locEnd) {
|
22705 | return is_next_line_empty_default(text, locEnd(node));
|
22706 | }
|
22707 | function isNextLineEmpty2(text, startIndex) {
|
22708 | return arguments.length === 2 || typeof startIndex === "number" ? is_next_line_empty_default(text, startIndex) : (
|
22709 | // @ts-expect-error -- expected
|
22710 | // eslint-disable-next-line prefer-rest-params
|
22711 | legacyIsNextLineEmpty(...arguments)
|
22712 | );
|
22713 | }
|
22714 |
|
22715 | // src/index.js
|
22716 | function withPlugins(fn, optionsArgumentIndex = 1) {
|
22717 | return async (...args) => {
|
22718 | const options8 = args[optionsArgumentIndex] ?? {};
|
22719 | const { plugins = [] } = options8;
|
22720 | args[optionsArgumentIndex] = {
|
22721 | ...options8,
|
22722 | plugins: (await Promise.all([
|
22723 | load_builtin_plugins_default(),
|
22724 | // TODO: standalone version allow `plugins` to be `prettierPlugins` which is an object, should allow that too
|
22725 | load_plugins_default(plugins)
|
22726 | ])).flat()
|
22727 | };
|
22728 | return fn(...args);
|
22729 | };
|
22730 | }
|
22731 | var formatWithCursor2 = withPlugins(formatWithCursor);
|
22732 | async function format2(text, options8) {
|
22733 | const { formatted } = await formatWithCursor2(text, {
|
22734 | ...options8,
|
22735 | cursorOffset: -1
|
22736 | });
|
22737 | return formatted;
|
22738 | }
|
22739 | async function check(text, options8) {
|
22740 | return await format2(text, options8) === text;
|
22741 | }
|
22742 | async function clearCache3() {
|
22743 | clearCache();
|
22744 | clearCache2();
|
22745 | }
|
22746 | var getFileInfo2 = withPlugins(get_file_info_default);
|
22747 | var getSupportInfo2 = withPlugins(getSupportInfo, 0);
|
22748 | var sharedWithCli = {
|
22749 | errors: errors_exports,
|
22750 | optionCategories: option_categories_exports,
|
22751 | createIsIgnoredFunction,
|
22752 | formatOptionsHiddenDefaults,
|
22753 | normalizeOptions: normalize_options_default,
|
22754 | getSupportInfoWithoutPlugins: getSupportInfo,
|
22755 | normalizeOptionSettings,
|
22756 | vnopts: {
|
22757 | ChoiceSchema,
|
22758 | apiDescriptor
|
22759 | },
|
22760 | fastGlob: import_fast_glob.default,
|
22761 | createTwoFilesPatch,
|
22762 | utils: {
|
22763 | isNonEmptyArray: is_non_empty_array_default,
|
22764 | partition: partition_default,
|
22765 | omit: object_omit_default
|
22766 | },
|
22767 | mockable: mockable_default
|
22768 | };
|
22769 | var debugApis = {
|
22770 | parse: withPlugins(parse5),
|
22771 | formatAST: withPlugins(formatAst),
|
22772 | formatDoc: withPlugins(formatDoc),
|
22773 | printToDoc: withPlugins(printToDoc),
|
22774 | printDocToString: withPlugins(printDocToString2),
|
22775 | mockable: mockable_default
|
22776 | };
|
22777 |
|
22778 | // with-default-export:src/index.js
|
22779 | var src_default = src_exports;
|
22780 | export {
|
22781 | debugApis as __debug,
|
22782 | sharedWithCli as __internal,
|
22783 | check,
|
22784 | clearCache3 as clearConfigCache,
|
22785 | src_default as default,
|
22786 | doc,
|
22787 | format2 as format,
|
22788 | formatWithCursor2 as formatWithCursor,
|
22789 | getFileInfo2 as getFileInfo,
|
22790 | getSupportInfo2 as getSupportInfo,
|
22791 | resolveConfig,
|
22792 | resolveConfigFile,
|
22793 | public_exports as util,
|
22794 | version_evaluate_default as version
|
22795 | };
|