prettier 2.1.1 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +0 -0
- package/README.md +3 -3
- package/bin-prettier.js +12178 -10699
- package/doc.js +1230 -1003
- package/esm/parser-angular.mjs +46 -0
- package/esm/parser-babel.mjs +1 -0
- package/esm/parser-espree.mjs +1 -0
- package/esm/parser-flow.mjs +1 -0
- package/esm/parser-glimmer.mjs +1 -0
- package/esm/parser-graphql.mjs +1 -0
- package/esm/parser-html.mjs +111 -0
- package/esm/parser-markdown.mjs +13 -0
- package/esm/parser-meriyah.mjs +1 -0
- package/esm/parser-postcss.mjs +1 -0
- package/esm/parser-typescript.mjs +1 -0
- package/esm/parser-yaml.mjs +15 -0
- package/esm/standalone.mjs +55 -0
- package/index.js +23217 -16968
- package/package.json +3 -2
- package/parser-angular.js +40 -40
- package/parser-babel.js +1 -1
- package/parser-espree.js +1 -0
- package/parser-flow.js +1 -1
- package/parser-glimmer.js +1 -1
- package/parser-graphql.js +1 -1
- package/parser-html.js +61 -63
- package/parser-markdown.js +3 -9
- package/parser-meriyah.js +1 -0
- package/parser-postcss.js +1 -8
- package/parser-typescript.js +1 -14
- package/parser-yaml.js +2 -2
- package/standalone.js +42 -2
- package/third-party.js +1042 -962
package/third-party.js
CHANGED
|
@@ -2,38 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
var os = require('os');
|
|
4
4
|
var path = require('path');
|
|
5
|
-
var
|
|
5
|
+
var Module = require('module');
|
|
6
6
|
var fs = require('fs');
|
|
7
7
|
var util = require('util');
|
|
8
|
-
var buffer$1 = require('buffer');
|
|
9
|
-
var stream = require('stream');
|
|
10
8
|
|
|
11
9
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
10
|
|
|
13
11
|
var os__default = /*#__PURE__*/_interopDefaultLegacy(os);
|
|
14
12
|
var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
|
|
15
|
-
var
|
|
13
|
+
var Module__default = /*#__PURE__*/_interopDefaultLegacy(Module);
|
|
16
14
|
var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
|
|
17
15
|
var util__default = /*#__PURE__*/_interopDefaultLegacy(util);
|
|
18
|
-
var buffer__default = /*#__PURE__*/_interopDefaultLegacy(buffer$1);
|
|
19
|
-
var stream__default = /*#__PURE__*/_interopDefaultLegacy(stream);
|
|
20
16
|
|
|
21
|
-
function createCommonjsModule(fn
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
exports: {},
|
|
25
|
-
require: function (path, base) {
|
|
26
|
-
return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
|
|
27
|
-
}
|
|
28
|
-
}, fn(module, module.exports), module.exports;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function getCjsExportFromNamespace (n) {
|
|
32
|
-
return n && n['default'] || n;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function commonjsRequire () {
|
|
36
|
-
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
|
|
17
|
+
function createCommonjsModule(fn) {
|
|
18
|
+
var module = { exports: {} };
|
|
19
|
+
return fn(module, module.exports), module.exports;
|
|
37
20
|
}
|
|
38
21
|
|
|
39
22
|
const resolveFrom = (fromDir, moduleId, silent) => {
|
|
@@ -59,10 +42,10 @@ const resolveFrom = (fromDir, moduleId, silent) => {
|
|
|
59
42
|
|
|
60
43
|
const fromFile = path__default['default'].join(fromDir, 'noop.js');
|
|
61
44
|
|
|
62
|
-
const resolveFileName = () =>
|
|
45
|
+
const resolveFileName = () => Module__default['default']._resolveFilename(moduleId, {
|
|
63
46
|
id: fromFile,
|
|
64
47
|
filename: fromFile,
|
|
65
|
-
paths:
|
|
48
|
+
paths: Module__default['default']._nodeModulePaths(fromDir)
|
|
66
49
|
});
|
|
67
50
|
|
|
68
51
|
if (silent) {
|
|
@@ -87,7 +70,8 @@ var importFresh = moduleId => {
|
|
|
87
70
|
}
|
|
88
71
|
|
|
89
72
|
const parentPath = __filename;
|
|
90
|
-
const
|
|
73
|
+
const cwd = parentPath ? path__default['default'].dirname(parentPath) : __dirname;
|
|
74
|
+
const filePath = resolveFrom_1(cwd, moduleId);
|
|
91
75
|
const oldModule = eval('require').cache[filePath]; // Delete itself from module parent
|
|
92
76
|
|
|
93
77
|
if (oldModule && oldModule.parent) {
|
|
@@ -245,36 +229,120 @@ errorEx.line = function (str, def) {
|
|
|
245
229
|
|
|
246
230
|
var errorEx_1 = errorEx;
|
|
247
231
|
|
|
248
|
-
|
|
232
|
+
const hexify = char => {
|
|
233
|
+
const h = char.charCodeAt(0).toString(16).toUpperCase();
|
|
234
|
+
return '0x' + (h.length % 2 ? '0' : '') + h;
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
const parseError = (e, txt, context) => {
|
|
238
|
+
if (!txt) {
|
|
239
|
+
return {
|
|
240
|
+
message: e.message + ' while parsing empty string',
|
|
241
|
+
position: 0
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
const badToken = e.message.match(/^Unexpected token (.) .*position\s+(\d+)/i);
|
|
246
|
+
const errIdx = badToken ? +badToken[2] : e.message.match(/^Unexpected end of JSON.*/i) ? txt.length - 1 : null;
|
|
247
|
+
const msg = badToken ? e.message.replace(/^Unexpected token ./, `Unexpected token ${JSON.stringify(badToken[1])} (${hexify(badToken[1])})`) : e.message;
|
|
248
|
+
|
|
249
|
+
if (errIdx !== null && errIdx !== undefined) {
|
|
250
|
+
const start = errIdx <= context ? 0 : errIdx - context;
|
|
251
|
+
const end = errIdx + context >= txt.length ? txt.length : errIdx + context;
|
|
252
|
+
const slice = (start === 0 ? '' : '...') + txt.slice(start, end) + (end === txt.length ? '' : '...');
|
|
253
|
+
const near = txt === slice ? '' : 'near ';
|
|
254
|
+
return {
|
|
255
|
+
message: msg + ` while parsing ${near}${JSON.stringify(slice)}`,
|
|
256
|
+
position: errIdx
|
|
257
|
+
};
|
|
258
|
+
} else {
|
|
259
|
+
return {
|
|
260
|
+
message: msg + ` while parsing '${txt.slice(0, context * 2)}'`,
|
|
261
|
+
position: 0
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
class JSONParseError extends SyntaxError {
|
|
267
|
+
constructor(er, txt, context, caller) {
|
|
268
|
+
context = context || 20;
|
|
269
|
+
const metadata = parseError(er, txt, context);
|
|
270
|
+
super(metadata.message);
|
|
271
|
+
Object.assign(this, metadata);
|
|
272
|
+
this.code = 'EJSONPARSE';
|
|
273
|
+
this.systemError = er;
|
|
274
|
+
Error.captureStackTrace(this, caller || this.constructor);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
get name() {
|
|
278
|
+
return this.constructor.name;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
set name(n) {}
|
|
282
|
+
|
|
283
|
+
get [Symbol.toStringTag]() {
|
|
284
|
+
return this.constructor.name;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
}
|
|
249
288
|
|
|
250
|
-
|
|
289
|
+
const kIndent = Symbol.for('indent');
|
|
290
|
+
const kNewline = Symbol.for('newline'); // only respect indentation if we got a line break, otherwise squash it
|
|
291
|
+
// things other than objects and arrays aren't indented, so ignore those
|
|
292
|
+
// Important: in both of these regexps, the $1 capture group is the newline
|
|
293
|
+
// or undefined, and the $2 capture group is the indent, or undefined.
|
|
294
|
+
|
|
295
|
+
const formatRE = /^\s*[{\[]((?:\r?\n)+)([\s\t]*)/;
|
|
296
|
+
const emptyRE = /^(?:\{\}|\[\])((?:\r?\n)+)?$/;
|
|
297
|
+
|
|
298
|
+
const parseJson$1 = (txt, reviver, context) => {
|
|
299
|
+
const parseText = stripBOM(txt);
|
|
251
300
|
context = context || 20;
|
|
252
301
|
|
|
253
302
|
try {
|
|
254
|
-
|
|
303
|
+
// get the indentation so that we can save it back nicely
|
|
304
|
+
// if the file starts with {" then we have an indent of '', ie, none
|
|
305
|
+
// otherwise, pick the indentation of the next line after the first \n
|
|
306
|
+
// If the pattern doesn't match, then it means no indentation.
|
|
307
|
+
// JSON.stringify ignores symbols, so this is reasonably safe.
|
|
308
|
+
// if the string is '{}' or '[]', then use the default 2-space indent.
|
|
309
|
+
const [, newline = '\n', indent = ' '] = parseText.match(emptyRE) || parseText.match(formatRE) || [, '', ''];
|
|
310
|
+
const result = JSON.parse(parseText, reviver);
|
|
311
|
+
|
|
312
|
+
if (result && typeof result === 'object') {
|
|
313
|
+
result[kNewline] = newline;
|
|
314
|
+
result[kIndent] = indent;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
return result;
|
|
255
318
|
} catch (e) {
|
|
256
|
-
if (typeof txt !== 'string') {
|
|
319
|
+
if (typeof txt !== 'string' && !Buffer.isBuffer(txt)) {
|
|
257
320
|
const isEmptyArray = Array.isArray(txt) && txt.length === 0;
|
|
258
|
-
|
|
259
|
-
|
|
321
|
+
throw Object.assign(new TypeError(`Cannot parse ${isEmptyArray ? 'an empty array' : String(txt)}`), {
|
|
322
|
+
code: 'EJSONPARSE',
|
|
323
|
+
systemError: e
|
|
324
|
+
});
|
|
260
325
|
}
|
|
261
326
|
|
|
262
|
-
|
|
263
|
-
|
|
327
|
+
throw new JSONParseError(e, parseText, context, parseJson$1);
|
|
328
|
+
}
|
|
329
|
+
}; // Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
|
|
330
|
+
// because the buffer-to-string conversion in `fs.readFileSync()`
|
|
331
|
+
// translates it to FEFF, the UTF-16 BOM.
|
|
264
332
|
|
|
265
|
-
if (errIdx != null) {
|
|
266
|
-
const start = errIdx <= context ? 0 : errIdx - context;
|
|
267
|
-
const end = errIdx + context >= txt.length ? txt.length : errIdx + context;
|
|
268
|
-
e.message += ` while parsing near '${start === 0 ? '' : '...'}${txt.slice(start, end)}${end === txt.length ? '' : '...'}'`;
|
|
269
|
-
} else {
|
|
270
|
-
e.message += ` while parsing '${txt.slice(0, context * 2)}'`;
|
|
271
|
-
}
|
|
272
333
|
|
|
273
|
-
|
|
274
|
-
}
|
|
275
|
-
}
|
|
334
|
+
const stripBOM = txt => String(txt).replace(/^\uFEFF/, '');
|
|
276
335
|
|
|
277
|
-
var
|
|
336
|
+
var jsonParseEvenBetterErrors = parseJson$1;
|
|
337
|
+
parseJson$1.JSONParseError = JSONParseError;
|
|
338
|
+
|
|
339
|
+
parseJson$1.noExceptions = (txt, reviver) => {
|
|
340
|
+
try {
|
|
341
|
+
return JSON.parse(stripBOM(txt), reviver);
|
|
342
|
+
} catch (e) {}
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
var dist$2 = createCommonjsModule(function (module, exports) {
|
|
278
346
|
|
|
279
347
|
var LF = '\n';
|
|
280
348
|
var CR = '\r';
|
|
@@ -357,147 +425,162 @@ var dist = createCommonjsModule(function (module, exports) {
|
|
|
357
425
|
exports["default"] = LinesAndColumns;
|
|
358
426
|
});
|
|
359
427
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
var token = {
|
|
372
|
-
type: "invalid",
|
|
373
|
-
value: match[0],
|
|
374
|
-
closed: undefined
|
|
375
|
-
};
|
|
376
|
-
if (match[1]) token.type = "string", token.closed = !!(match[3] || match[4]);else if (match[5]) token.type = "comment";else if (match[6]) token.type = "comment", token.closed = !!match[7];else if (match[8]) token.type = "regex";else if (match[9]) token.type = "number";else if (match[10]) token.type = "name";else if (match[11]) token.type = "punctuator";else if (match[12]) token.type = "whitespace";
|
|
377
|
-
return token;
|
|
428
|
+
// Copyright 2014, 2015, 2016, 2017, 2018 Simon Lydell
|
|
429
|
+
// License: MIT. (See LICENSE.)
|
|
430
|
+
// This regex comes from regex.coffee, and is inserted here by generate-index.js
|
|
431
|
+
// (run `npm run build`).
|
|
432
|
+
var _default$2 = /((['"])(?:(?!\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;
|
|
433
|
+
|
|
434
|
+
var matchToToken = function (match) {
|
|
435
|
+
var token = {
|
|
436
|
+
type: "invalid",
|
|
437
|
+
value: match[0],
|
|
438
|
+
closed: undefined
|
|
378
439
|
};
|
|
440
|
+
if (match[1]) token.type = "string", token.closed = !!(match[3] || match[4]);else if (match[5]) token.type = "comment";else if (match[6]) token.type = "comment", token.closed = !!match[7];else if (match[8]) token.type = "regex";else if (match[9]) token.type = "number";else if (match[10]) token.type = "name";else if (match[11]) token.type = "punctuator";else if (match[12]) token.type = "whitespace";
|
|
441
|
+
return token;
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
var jsTokens = /*#__PURE__*/Object.defineProperty({
|
|
445
|
+
default: _default$2,
|
|
446
|
+
matchToToken: matchToToken
|
|
447
|
+
}, '__esModule', {
|
|
448
|
+
value: true
|
|
379
449
|
});
|
|
380
450
|
|
|
381
|
-
var
|
|
451
|
+
var isIdentifierStart_1 = isIdentifierStart;
|
|
452
|
+
var isIdentifierChar_1 = isIdentifierChar;
|
|
453
|
+
var isIdentifierName_1 = isIdentifierName;
|
|
454
|
+
let 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\u08a0-\u08b4\u08b6-\u08c7\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\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-\u170c\u170e-\u1711\u1720-\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-\u1b4b\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-\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\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-\u9ffc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7ca\ua7f5-\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";
|
|
455
|
+
let 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\u08d3-\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\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\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-\u0ecd\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-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf\u1ac0\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-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\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";
|
|
456
|
+
const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
|
457
|
+
const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
|
458
|
+
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
|
|
459
|
+
const 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, 157, 310, 10, 21, 11, 7, 153, 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, 107, 20, 28, 22, 13, 52, 76, 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, 85, 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, 230, 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, 35, 56, 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, 190, 0, 80, 921, 103, 110, 18, 195, 2749, 1070, 4050, 582, 8634, 568, 8, 30, 114, 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, 8952, 286, 50, 2, 18, 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, 2357, 44, 11, 6, 17, 0, 370, 43, 1301, 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, 42717, 35, 4148, 12, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938];
|
|
460
|
+
const 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, 154, 10, 176, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 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, 19306, 9, 135, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 5319, 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, 262, 6, 10, 9, 419, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
|
|
382
461
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
});
|
|
386
|
-
exports.isIdentifierStart = isIdentifierStart;
|
|
387
|
-
exports.isIdentifierChar = isIdentifierChar;
|
|
388
|
-
exports.isIdentifierName = isIdentifierName;
|
|
389
|
-
let 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\u08a0-\u08b4\u08b6-\u08c7\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\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-\u170c\u170e-\u1711\u1720-\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-\u1b4b\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-\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\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-\u9ffc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7bf\ua7c2-\ua7ca\ua7f5-\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";
|
|
390
|
-
let 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\u08d3-\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\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\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-\u0ecd\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-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf\u1ac0\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-\u1df9\u1dfb-\u1dff\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\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";
|
|
391
|
-
const nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
|
|
392
|
-
const nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
|
|
393
|
-
nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
|
|
394
|
-
const 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, 157, 310, 10, 21, 11, 7, 153, 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, 107, 20, 28, 22, 13, 52, 76, 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, 85, 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, 230, 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, 35, 56, 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, 190, 0, 80, 921, 103, 110, 18, 195, 2749, 1070, 4050, 582, 8634, 568, 8, 30, 114, 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, 8952, 286, 50, 2, 18, 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, 2357, 44, 11, 6, 17, 0, 370, 43, 1301, 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, 42717, 35, 4148, 12, 221, 3, 5761, 15, 7472, 3104, 541, 1507, 4938];
|
|
395
|
-
const 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, 154, 10, 176, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 161, 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, 19306, 9, 135, 4, 60, 6, 26, 9, 1014, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 5319, 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, 262, 6, 10, 9, 419, 13, 1495, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
|
|
396
|
-
|
|
397
|
-
function isInAstralSet(code, set) {
|
|
398
|
-
let pos = 0x10000;
|
|
399
|
-
|
|
400
|
-
for (let i = 0, length = set.length; i < length; i += 2) {
|
|
401
|
-
pos += set[i];
|
|
402
|
-
if (pos > code) return false;
|
|
403
|
-
pos += set[i + 1];
|
|
404
|
-
if (pos >= code) return true;
|
|
405
|
-
}
|
|
462
|
+
function isInAstralSet(code, set) {
|
|
463
|
+
let pos = 0x10000;
|
|
406
464
|
|
|
407
|
-
|
|
465
|
+
for (let i = 0, length = set.length; i < length; i += 2) {
|
|
466
|
+
pos += set[i];
|
|
467
|
+
if (pos > code) return false;
|
|
468
|
+
pos += set[i + 1];
|
|
469
|
+
if (pos >= code) return true;
|
|
408
470
|
}
|
|
409
471
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
if (code <= 90) return true;
|
|
413
|
-
if (code < 97) return code === 95;
|
|
414
|
-
if (code <= 122) return true;
|
|
472
|
+
return false;
|
|
473
|
+
}
|
|
415
474
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
475
|
+
function isIdentifierStart(code) {
|
|
476
|
+
if (code < 65) return code === 36;
|
|
477
|
+
if (code <= 90) return true;
|
|
478
|
+
if (code < 97) return code === 95;
|
|
479
|
+
if (code <= 122) return true;
|
|
419
480
|
|
|
420
|
-
|
|
481
|
+
if (code <= 0xffff) {
|
|
482
|
+
return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code));
|
|
421
483
|
}
|
|
422
484
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
if (code < 58) return true;
|
|
426
|
-
if (code < 65) return false;
|
|
427
|
-
if (code <= 90) return true;
|
|
428
|
-
if (code < 97) return code === 95;
|
|
429
|
-
if (code <= 122) return true;
|
|
485
|
+
return isInAstralSet(code, astralIdentifierStartCodes);
|
|
486
|
+
}
|
|
430
487
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
488
|
+
function isIdentifierChar(code) {
|
|
489
|
+
if (code < 48) return code === 36;
|
|
490
|
+
if (code < 58) return true;
|
|
491
|
+
if (code < 65) return false;
|
|
492
|
+
if (code <= 90) return true;
|
|
493
|
+
if (code < 97) return code === 95;
|
|
494
|
+
if (code <= 122) return true;
|
|
434
495
|
|
|
435
|
-
|
|
496
|
+
if (code <= 0xffff) {
|
|
497
|
+
return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));
|
|
436
498
|
}
|
|
437
499
|
|
|
438
|
-
|
|
439
|
-
|
|
500
|
+
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
|
|
501
|
+
}
|
|
440
502
|
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
const cp = char.codePointAt(0);
|
|
503
|
+
function isIdentifierName(name) {
|
|
504
|
+
let isFirst = true;
|
|
444
505
|
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
return false;
|
|
448
|
-
}
|
|
506
|
+
for (let i = 0; i < name.length; i++) {
|
|
507
|
+
let cp = name.charCodeAt(i);
|
|
449
508
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
509
|
+
if ((cp & 0xfc00) === 0xd800 && i + 1 < name.length) {
|
|
510
|
+
const trail = name.charCodeAt(++i);
|
|
511
|
+
|
|
512
|
+
if ((trail & 0xfc00) === 0xdc00) {
|
|
513
|
+
cp = 0x10000 + ((cp & 0x3ff) << 10) + (trail & 0x3ff);
|
|
453
514
|
}
|
|
454
515
|
}
|
|
455
516
|
|
|
456
|
-
|
|
517
|
+
if (isFirst) {
|
|
518
|
+
isFirst = false;
|
|
519
|
+
|
|
520
|
+
if (!isIdentifierStart(cp)) {
|
|
521
|
+
return false;
|
|
522
|
+
}
|
|
523
|
+
} else if (!isIdentifierChar(cp)) {
|
|
524
|
+
return false;
|
|
525
|
+
}
|
|
457
526
|
}
|
|
527
|
+
|
|
528
|
+
return !isFirst;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
var identifier = /*#__PURE__*/Object.defineProperty({
|
|
532
|
+
isIdentifierStart: isIdentifierStart_1,
|
|
533
|
+
isIdentifierChar: isIdentifierChar_1,
|
|
534
|
+
isIdentifierName: isIdentifierName_1
|
|
535
|
+
}, '__esModule', {
|
|
536
|
+
value: true
|
|
458
537
|
});
|
|
459
538
|
|
|
460
|
-
var
|
|
539
|
+
var isReservedWord_1 = isReservedWord;
|
|
540
|
+
var isStrictReservedWord_1 = isStrictReservedWord;
|
|
541
|
+
var isStrictBindOnlyReservedWord_1 = isStrictBindOnlyReservedWord;
|
|
542
|
+
var isStrictBindReservedWord_1 = isStrictBindReservedWord;
|
|
543
|
+
var isKeyword_1 = isKeyword;
|
|
544
|
+
const reservedWords = {
|
|
545
|
+
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"],
|
|
546
|
+
strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
|
|
547
|
+
strictBind: ["eval", "arguments"]
|
|
548
|
+
};
|
|
549
|
+
const keywords = new Set(reservedWords.keyword);
|
|
550
|
+
const reservedWordsStrictSet = new Set(reservedWords.strict);
|
|
551
|
+
const reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
|
|
461
552
|
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
exports.isReservedWord = isReservedWord;
|
|
466
|
-
exports.isStrictReservedWord = isStrictReservedWord;
|
|
467
|
-
exports.isStrictBindOnlyReservedWord = isStrictBindOnlyReservedWord;
|
|
468
|
-
exports.isStrictBindReservedWord = isStrictBindReservedWord;
|
|
469
|
-
exports.isKeyword = isKeyword;
|
|
470
|
-
const reservedWords = {
|
|
471
|
-
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"],
|
|
472
|
-
strict: ["implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"],
|
|
473
|
-
strictBind: ["eval", "arguments"]
|
|
474
|
-
};
|
|
475
|
-
const keywords = new Set(reservedWords.keyword);
|
|
476
|
-
const reservedWordsStrictSet = new Set(reservedWords.strict);
|
|
477
|
-
const reservedWordsStrictBindSet = new Set(reservedWords.strictBind);
|
|
553
|
+
function isReservedWord(word, inModule) {
|
|
554
|
+
return inModule && word === "await" || word === "enum";
|
|
555
|
+
}
|
|
478
556
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
557
|
+
function isStrictReservedWord(word, inModule) {
|
|
558
|
+
return isReservedWord(word, inModule) || reservedWordsStrictSet.has(word);
|
|
559
|
+
}
|
|
482
560
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
561
|
+
function isStrictBindOnlyReservedWord(word) {
|
|
562
|
+
return reservedWordsStrictBindSet.has(word);
|
|
563
|
+
}
|
|
486
564
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
565
|
+
function isStrictBindReservedWord(word, inModule) {
|
|
566
|
+
return isStrictReservedWord(word, inModule) || isStrictBindOnlyReservedWord(word);
|
|
567
|
+
}
|
|
490
568
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
569
|
+
function isKeyword(word) {
|
|
570
|
+
return keywords.has(word);
|
|
571
|
+
}
|
|
494
572
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
573
|
+
var keyword = /*#__PURE__*/Object.defineProperty({
|
|
574
|
+
isReservedWord: isReservedWord_1,
|
|
575
|
+
isStrictReservedWord: isStrictReservedWord_1,
|
|
576
|
+
isStrictBindOnlyReservedWord: isStrictBindOnlyReservedWord_1,
|
|
577
|
+
isStrictBindReservedWord: isStrictBindReservedWord_1,
|
|
578
|
+
isKeyword: isKeyword_1
|
|
579
|
+
}, '__esModule', {
|
|
580
|
+
value: true
|
|
498
581
|
});
|
|
499
582
|
|
|
500
|
-
var lib = createCommonjsModule(function (module, exports) {
|
|
583
|
+
var lib$2 = createCommonjsModule(function (module, exports) {
|
|
501
584
|
|
|
502
585
|
Object.defineProperty(exports, "__esModule", {
|
|
503
586
|
value: true
|
|
@@ -713,8 +796,8 @@ var colorName = {
|
|
|
713
796
|
"yellowgreen": [154, 205, 50]
|
|
714
797
|
};
|
|
715
798
|
|
|
799
|
+
/* MIT license */
|
|
716
800
|
var conversions = createCommonjsModule(function (module) {
|
|
717
|
-
/* MIT license */
|
|
718
801
|
// NOTE: conversions should only return primitive values (i.e. arrays, or
|
|
719
802
|
// values that give correct `typeof` results).
|
|
720
803
|
// do not use box values types (i.e. Number(), String(), etc.)
|
|
@@ -2405,106 +2488,105 @@ var chalk = createCommonjsModule(function (module) {
|
|
|
2405
2488
|
module.exports.default = module.exports; // For TypeScript
|
|
2406
2489
|
});
|
|
2407
2490
|
|
|
2408
|
-
var
|
|
2491
|
+
var shouldHighlight_1 = shouldHighlight;
|
|
2492
|
+
var getChalk_1 = getChalk;
|
|
2493
|
+
var _default$1 = highlight;
|
|
2409
2494
|
|
|
2410
|
-
|
|
2411
|
-
value: true
|
|
2412
|
-
});
|
|
2413
|
-
exports.shouldHighlight = shouldHighlight;
|
|
2414
|
-
exports.getChalk = getChalk;
|
|
2415
|
-
exports.default = highlight;
|
|
2495
|
+
var jsTokensNs = _interopRequireWildcard$1(jsTokens);
|
|
2416
2496
|
|
|
2417
|
-
|
|
2497
|
+
var _chalk = _interopRequireDefault$2(chalk);
|
|
2418
2498
|
|
|
2419
|
-
|
|
2499
|
+
function _interopRequireDefault$2(obj) {
|
|
2500
|
+
return obj && obj.__esModule ? obj : {
|
|
2501
|
+
default: obj
|
|
2502
|
+
};
|
|
2503
|
+
}
|
|
2420
2504
|
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
};
|
|
2425
|
-
}
|
|
2505
|
+
function _getRequireWildcardCache$1() {
|
|
2506
|
+
if (typeof WeakMap !== "function") return null;
|
|
2507
|
+
var cache = new WeakMap();
|
|
2426
2508
|
|
|
2427
|
-
function
|
|
2428
|
-
|
|
2429
|
-
|
|
2509
|
+
_getRequireWildcardCache$1 = function () {
|
|
2510
|
+
return cache;
|
|
2511
|
+
};
|
|
2430
2512
|
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
};
|
|
2513
|
+
return cache;
|
|
2514
|
+
}
|
|
2434
2515
|
|
|
2435
|
-
|
|
2516
|
+
function _interopRequireWildcard$1(obj) {
|
|
2517
|
+
if (obj && obj.__esModule) {
|
|
2518
|
+
return obj;
|
|
2436
2519
|
}
|
|
2437
2520
|
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
}
|
|
2442
|
-
|
|
2443
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
2444
|
-
return {
|
|
2445
|
-
default: obj
|
|
2446
|
-
};
|
|
2447
|
-
}
|
|
2521
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
2522
|
+
return {
|
|
2523
|
+
default: obj
|
|
2524
|
+
};
|
|
2525
|
+
}
|
|
2448
2526
|
|
|
2449
|
-
|
|
2527
|
+
var cache = _getRequireWildcardCache$1();
|
|
2450
2528
|
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2529
|
+
if (cache && cache.has(obj)) {
|
|
2530
|
+
return cache.get(obj);
|
|
2531
|
+
}
|
|
2454
2532
|
|
|
2455
|
-
|
|
2456
|
-
|
|
2533
|
+
var newObj = {};
|
|
2534
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
2457
2535
|
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2536
|
+
for (var key in obj) {
|
|
2537
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
2538
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
2461
2539
|
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
}
|
|
2540
|
+
if (desc && (desc.get || desc.set)) {
|
|
2541
|
+
Object.defineProperty(newObj, key, desc);
|
|
2542
|
+
} else {
|
|
2543
|
+
newObj[key] = obj[key];
|
|
2467
2544
|
}
|
|
2468
2545
|
}
|
|
2546
|
+
}
|
|
2469
2547
|
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
if (cache) {
|
|
2473
|
-
cache.set(obj, newObj);
|
|
2474
|
-
}
|
|
2548
|
+
newObj.default = obj;
|
|
2475
2549
|
|
|
2476
|
-
|
|
2550
|
+
if (cache) {
|
|
2551
|
+
cache.set(obj, newObj);
|
|
2477
2552
|
}
|
|
2478
2553
|
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
keyword: chalk.cyan,
|
|
2482
|
-
capitalized: chalk.yellow,
|
|
2483
|
-
jsx_tag: chalk.yellow,
|
|
2484
|
-
punctuator: chalk.yellow,
|
|
2485
|
-
number: chalk.magenta,
|
|
2486
|
-
string: chalk.green,
|
|
2487
|
-
regex: chalk.magenta,
|
|
2488
|
-
comment: chalk.grey,
|
|
2489
|
-
invalid: chalk.white.bgRed.bold
|
|
2490
|
-
};
|
|
2491
|
-
}
|
|
2554
|
+
return newObj;
|
|
2555
|
+
}
|
|
2492
2556
|
|
|
2493
|
-
|
|
2494
|
-
const JSX_TAG = /^[a-z][\w-]*$/i;
|
|
2495
|
-
const BRACKET = /^[()[\]{}]$/;
|
|
2557
|
+
const sometimesKeywords = new Set(["as", "async", "from", "get", "of", "set"]);
|
|
2496
2558
|
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2559
|
+
function getDefs$1(chalk) {
|
|
2560
|
+
return {
|
|
2561
|
+
keyword: chalk.cyan,
|
|
2562
|
+
capitalized: chalk.yellow,
|
|
2563
|
+
jsxIdentifier: chalk.yellow,
|
|
2564
|
+
punctuator: chalk.yellow,
|
|
2565
|
+
number: chalk.magenta,
|
|
2566
|
+
string: chalk.green,
|
|
2567
|
+
regex: chalk.magenta,
|
|
2568
|
+
comment: chalk.grey,
|
|
2569
|
+
invalid: chalk.white.bgRed.bold
|
|
2570
|
+
};
|
|
2571
|
+
}
|
|
2500
2572
|
|
|
2573
|
+
const NEWLINE$1 = /\r\n|[\n\r\u2028\u2029]/;
|
|
2574
|
+
const BRACKET = /^[()[\]{}]$/;
|
|
2575
|
+
let tokenize;
|
|
2576
|
+
{
|
|
2577
|
+
const {
|
|
2578
|
+
matchToToken
|
|
2579
|
+
} = jsTokensNs;
|
|
2580
|
+
const JSX_TAG = /^[a-z][\w-]*$/i;
|
|
2581
|
+
|
|
2582
|
+
const getTokenType = function (token, offset, text) {
|
|
2501
2583
|
if (token.type === "name") {
|
|
2502
|
-
if ((0, lib.isKeyword)(token.value) || (0, lib.
|
|
2584
|
+
if ((0, lib$2.isKeyword)(token.value) || (0, lib$2.isStrictReservedWord)(token.value, true) || sometimesKeywords.has(token.value)) {
|
|
2503
2585
|
return "keyword";
|
|
2504
2586
|
}
|
|
2505
2587
|
|
|
2506
2588
|
if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == "</")) {
|
|
2507
|
-
return "
|
|
2589
|
+
return "jsxIdentifier";
|
|
2508
2590
|
}
|
|
2509
2591
|
|
|
2510
2592
|
if (token.value[0] !== token.value[0].toLowerCase()) {
|
|
@@ -2521,278 +2603,299 @@ var lib$1 = createCommonjsModule(function (module, exports) {
|
|
|
2521
2603
|
}
|
|
2522
2604
|
|
|
2523
2605
|
return token.type;
|
|
2524
|
-
}
|
|
2606
|
+
};
|
|
2525
2607
|
|
|
2526
|
-
function
|
|
2527
|
-
|
|
2528
|
-
const type = getTokenType(args);
|
|
2529
|
-
const colorize = defs[type];
|
|
2608
|
+
tokenize = function* (text) {
|
|
2609
|
+
let match;
|
|
2530
2610
|
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2611
|
+
while (match = jsTokensNs.default.exec(text)) {
|
|
2612
|
+
const token = matchToToken(match);
|
|
2613
|
+
yield {
|
|
2614
|
+
type: getTokenType(token, match.index, text),
|
|
2615
|
+
value: token.value
|
|
2616
|
+
};
|
|
2617
|
+
}
|
|
2618
|
+
};
|
|
2619
|
+
}
|
|
2538
2620
|
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
}
|
|
2621
|
+
function highlightTokens(defs, text) {
|
|
2622
|
+
let highlighted = "";
|
|
2542
2623
|
|
|
2543
|
-
|
|
2544
|
-
|
|
2624
|
+
for (const {
|
|
2625
|
+
type,
|
|
2626
|
+
value
|
|
2627
|
+
} of tokenize(text)) {
|
|
2628
|
+
const colorize = defs[type];
|
|
2545
2629
|
|
|
2546
|
-
if (
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
});
|
|
2630
|
+
if (colorize) {
|
|
2631
|
+
highlighted += value.split(NEWLINE$1).map(str => colorize(str)).join("\n");
|
|
2632
|
+
} else {
|
|
2633
|
+
highlighted += value;
|
|
2551
2634
|
}
|
|
2552
|
-
|
|
2553
|
-
return chalk;
|
|
2554
2635
|
}
|
|
2555
2636
|
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2637
|
+
return highlighted;
|
|
2638
|
+
}
|
|
2639
|
+
|
|
2640
|
+
function shouldHighlight(options) {
|
|
2641
|
+
return !!_chalk.default.supportsColor || options.forceColor;
|
|
2642
|
+
}
|
|
2643
|
+
|
|
2644
|
+
function getChalk(options) {
|
|
2645
|
+
return options.forceColor ? new _chalk.default.constructor({
|
|
2646
|
+
enabled: true,
|
|
2647
|
+
level: 1
|
|
2648
|
+
}) : _chalk.default;
|
|
2649
|
+
}
|
|
2650
|
+
|
|
2651
|
+
function highlight(code, options = {}) {
|
|
2652
|
+
if (shouldHighlight(options)) {
|
|
2653
|
+
const chalk = getChalk(options);
|
|
2654
|
+
const defs = getDefs$1(chalk);
|
|
2655
|
+
return highlightTokens(defs, code);
|
|
2656
|
+
} else {
|
|
2657
|
+
return code;
|
|
2564
2658
|
}
|
|
2659
|
+
}
|
|
2660
|
+
|
|
2661
|
+
var lib$1 = /*#__PURE__*/Object.defineProperty({
|
|
2662
|
+
shouldHighlight: shouldHighlight_1,
|
|
2663
|
+
getChalk: getChalk_1,
|
|
2664
|
+
default: _default$1
|
|
2665
|
+
}, '__esModule', {
|
|
2666
|
+
value: true
|
|
2565
2667
|
});
|
|
2566
2668
|
|
|
2567
|
-
var
|
|
2669
|
+
var codeFrameColumns_1 = codeFrameColumns$1;
|
|
2670
|
+
var default_1 = _default;
|
|
2568
2671
|
|
|
2569
|
-
|
|
2570
|
-
value: true
|
|
2571
|
-
});
|
|
2572
|
-
exports.codeFrameColumns = codeFrameColumns;
|
|
2573
|
-
exports.default = _default;
|
|
2672
|
+
var _highlight = _interopRequireWildcard(lib$1);
|
|
2574
2673
|
|
|
2575
|
-
|
|
2674
|
+
function _getRequireWildcardCache() {
|
|
2675
|
+
if (typeof WeakMap !== "function") return null;
|
|
2676
|
+
var cache = new WeakMap();
|
|
2576
2677
|
|
|
2577
|
-
function
|
|
2578
|
-
|
|
2579
|
-
|
|
2678
|
+
_getRequireWildcardCache = function () {
|
|
2679
|
+
return cache;
|
|
2680
|
+
};
|
|
2580
2681
|
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
};
|
|
2682
|
+
return cache;
|
|
2683
|
+
}
|
|
2584
2684
|
|
|
2585
|
-
|
|
2685
|
+
function _interopRequireWildcard(obj) {
|
|
2686
|
+
if (obj && obj.__esModule) {
|
|
2687
|
+
return obj;
|
|
2586
2688
|
}
|
|
2587
2689
|
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
}
|
|
2592
|
-
|
|
2593
|
-
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
2594
|
-
return {
|
|
2595
|
-
default: obj
|
|
2596
|
-
};
|
|
2597
|
-
}
|
|
2690
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
2691
|
+
return {
|
|
2692
|
+
default: obj
|
|
2693
|
+
};
|
|
2694
|
+
}
|
|
2598
2695
|
|
|
2599
|
-
|
|
2696
|
+
var cache = _getRequireWildcardCache();
|
|
2600
2697
|
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2698
|
+
if (cache && cache.has(obj)) {
|
|
2699
|
+
return cache.get(obj);
|
|
2700
|
+
}
|
|
2604
2701
|
|
|
2605
|
-
|
|
2606
|
-
|
|
2702
|
+
var newObj = {};
|
|
2703
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
2607
2704
|
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2705
|
+
for (var key in obj) {
|
|
2706
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
2707
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
2611
2708
|
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
}
|
|
2709
|
+
if (desc && (desc.get || desc.set)) {
|
|
2710
|
+
Object.defineProperty(newObj, key, desc);
|
|
2711
|
+
} else {
|
|
2712
|
+
newObj[key] = obj[key];
|
|
2617
2713
|
}
|
|
2618
2714
|
}
|
|
2715
|
+
}
|
|
2619
2716
|
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
if (cache) {
|
|
2623
|
-
cache.set(obj, newObj);
|
|
2624
|
-
}
|
|
2717
|
+
newObj.default = obj;
|
|
2625
2718
|
|
|
2626
|
-
|
|
2719
|
+
if (cache) {
|
|
2720
|
+
cache.set(obj, newObj);
|
|
2627
2721
|
}
|
|
2628
2722
|
|
|
2629
|
-
|
|
2723
|
+
return newObj;
|
|
2724
|
+
}
|
|
2630
2725
|
|
|
2631
|
-
|
|
2632
|
-
return {
|
|
2633
|
-
gutter: chalk.grey,
|
|
2634
|
-
marker: chalk.red.bold,
|
|
2635
|
-
message: chalk.red.bold
|
|
2636
|
-
};
|
|
2637
|
-
}
|
|
2726
|
+
let deprecationWarningShown = false;
|
|
2638
2727
|
|
|
2639
|
-
|
|
2728
|
+
function getDefs(chalk) {
|
|
2729
|
+
return {
|
|
2730
|
+
gutter: chalk.grey,
|
|
2731
|
+
marker: chalk.red.bold,
|
|
2732
|
+
message: chalk.red.bold
|
|
2733
|
+
};
|
|
2734
|
+
}
|
|
2640
2735
|
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2736
|
+
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
|
2737
|
+
|
|
2738
|
+
function getMarkerLines(loc, source, opts) {
|
|
2739
|
+
const startLoc = Object.assign({
|
|
2740
|
+
column: 0,
|
|
2741
|
+
line: -1
|
|
2742
|
+
}, loc.start);
|
|
2743
|
+
const endLoc = Object.assign({}, startLoc, loc.end);
|
|
2744
|
+
const {
|
|
2745
|
+
linesAbove = 2,
|
|
2746
|
+
linesBelow = 3
|
|
2747
|
+
} = opts || {};
|
|
2748
|
+
const startLine = startLoc.line;
|
|
2749
|
+
const startColumn = startLoc.column;
|
|
2750
|
+
const endLine = endLoc.line;
|
|
2751
|
+
const endColumn = endLoc.column;
|
|
2752
|
+
let start = Math.max(startLine - (linesAbove + 1), 0);
|
|
2753
|
+
let end = Math.min(source.length, endLine + linesBelow);
|
|
2754
|
+
|
|
2755
|
+
if (startLine === -1) {
|
|
2756
|
+
start = 0;
|
|
2757
|
+
}
|
|
2758
|
+
|
|
2759
|
+
if (endLine === -1) {
|
|
2760
|
+
end = source.length;
|
|
2761
|
+
}
|
|
2762
|
+
|
|
2763
|
+
const lineDiff = endLine - startLine;
|
|
2764
|
+
const markerLines = {};
|
|
2765
|
+
|
|
2766
|
+
if (lineDiff) {
|
|
2767
|
+
for (let i = 0; i <= lineDiff; i++) {
|
|
2768
|
+
const lineNumber = i + startLine;
|
|
2769
|
+
|
|
2770
|
+
if (!startColumn) {
|
|
2771
|
+
markerLines[lineNumber] = true;
|
|
2772
|
+
} else if (i === 0) {
|
|
2773
|
+
const sourceLength = source[lineNumber - 1].length;
|
|
2774
|
+
markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
|
|
2775
|
+
} else if (i === lineDiff) {
|
|
2776
|
+
markerLines[lineNumber] = [0, endColumn];
|
|
2777
|
+
} else {
|
|
2778
|
+
const sourceLength = source[lineNumber - i].length;
|
|
2779
|
+
markerLines[lineNumber] = [0, sourceLength];
|
|
2684
2780
|
}
|
|
2685
|
-
}
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
markerLines[startLine] = true;
|
|
2691
|
-
}
|
|
2781
|
+
}
|
|
2782
|
+
} else {
|
|
2783
|
+
if (startColumn === endColumn) {
|
|
2784
|
+
if (startColumn) {
|
|
2785
|
+
markerLines[startLine] = [startColumn, 0];
|
|
2692
2786
|
} else {
|
|
2693
|
-
markerLines[startLine] =
|
|
2787
|
+
markerLines[startLine] = true;
|
|
2694
2788
|
}
|
|
2789
|
+
} else {
|
|
2790
|
+
markerLines[startLine] = [startColumn, endColumn - startColumn];
|
|
2695
2791
|
}
|
|
2696
|
-
|
|
2697
|
-
return {
|
|
2698
|
-
start,
|
|
2699
|
-
end,
|
|
2700
|
-
markerLines
|
|
2701
|
-
};
|
|
2702
2792
|
}
|
|
2703
2793
|
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2794
|
+
return {
|
|
2795
|
+
start,
|
|
2796
|
+
end,
|
|
2797
|
+
markerLines
|
|
2798
|
+
};
|
|
2799
|
+
}
|
|
2708
2800
|
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2801
|
+
function codeFrameColumns$1(rawLines, loc, opts = {}) {
|
|
2802
|
+
const highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight.shouldHighlight)(opts);
|
|
2803
|
+
const chalk = (0, _highlight.getChalk)(opts);
|
|
2804
|
+
const defs = getDefs(chalk);
|
|
2712
2805
|
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
end,
|
|
2717
|
-
markerLines
|
|
2718
|
-
} = getMarkerLines(loc, lines, opts);
|
|
2719
|
-
const hasColumns = loc.start && typeof loc.start.column === "number";
|
|
2720
|
-
const numberMaxWidth = String(end).length;
|
|
2721
|
-
const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines;
|
|
2722
|
-
let frame = highlightedLines.split(NEWLINE).slice(start, end).map((line, index) => {
|
|
2723
|
-
const number = start + 1 + index;
|
|
2724
|
-
const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
|
|
2725
|
-
const gutter = ` ${paddedNumber} | `;
|
|
2726
|
-
const hasMarker = markerLines[number];
|
|
2727
|
-
const lastMarkerLine = !markerLines[number + 1];
|
|
2728
|
-
|
|
2729
|
-
if (hasMarker) {
|
|
2730
|
-
let markerLine = "";
|
|
2731
|
-
|
|
2732
|
-
if (Array.isArray(hasMarker)) {
|
|
2733
|
-
const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
|
|
2734
|
-
const numberOfMarkers = hasMarker[1] || 1;
|
|
2735
|
-
markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
|
|
2736
|
-
|
|
2737
|
-
if (lastMarkerLine && opts.message) {
|
|
2738
|
-
markerLine += " " + maybeHighlight(defs.message, opts.message);
|
|
2739
|
-
}
|
|
2740
|
-
}
|
|
2806
|
+
const maybeHighlight = (chalkFn, string) => {
|
|
2807
|
+
return highlighted ? chalkFn(string) : string;
|
|
2808
|
+
};
|
|
2741
2809
|
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2810
|
+
const lines = rawLines.split(NEWLINE);
|
|
2811
|
+
const {
|
|
2812
|
+
start,
|
|
2813
|
+
end,
|
|
2814
|
+
markerLines
|
|
2815
|
+
} = getMarkerLines(loc, lines, opts);
|
|
2816
|
+
const hasColumns = loc.start && typeof loc.start.column === "number";
|
|
2817
|
+
const numberMaxWidth = String(end).length;
|
|
2818
|
+
const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines;
|
|
2819
|
+
let frame = highlightedLines.split(NEWLINE).slice(start, end).map((line, index) => {
|
|
2820
|
+
const number = start + 1 + index;
|
|
2821
|
+
const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
|
|
2822
|
+
const gutter = ` ${paddedNumber} |`;
|
|
2823
|
+
const hasMarker = markerLines[number];
|
|
2824
|
+
const lastMarkerLine = !markerLines[number + 1];
|
|
2825
|
+
|
|
2826
|
+
if (hasMarker) {
|
|
2827
|
+
let markerLine = "";
|
|
2828
|
+
|
|
2829
|
+
if (Array.isArray(hasMarker)) {
|
|
2830
|
+
const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
|
|
2831
|
+
const numberOfMarkers = hasMarker[1] || 1;
|
|
2832
|
+
markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), " ", markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
|
|
2833
|
+
|
|
2834
|
+
if (lastMarkerLine && opts.message) {
|
|
2835
|
+
markerLine += " " + maybeHighlight(defs.message, opts.message);
|
|
2836
|
+
}
|
|
2745
2837
|
}
|
|
2746
|
-
}).join("\n");
|
|
2747
2838
|
|
|
2748
|
-
|
|
2749
|
-
|
|
2839
|
+
return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line.length > 0 ? ` ${line}` : "", markerLine].join("");
|
|
2840
|
+
} else {
|
|
2841
|
+
return ` ${maybeHighlight(defs.gutter, gutter)}${line.length > 0 ? ` ${line}` : ""}`;
|
|
2750
2842
|
}
|
|
2843
|
+
}).join("\n");
|
|
2844
|
+
|
|
2845
|
+
if (opts.message && !hasColumns) {
|
|
2846
|
+
frame = `${" ".repeat(numberMaxWidth + 1)}${opts.message}\n${frame}`;
|
|
2847
|
+
}
|
|
2848
|
+
|
|
2849
|
+
if (highlighted) {
|
|
2850
|
+
return chalk.reset(frame);
|
|
2851
|
+
} else {
|
|
2852
|
+
return frame;
|
|
2853
|
+
}
|
|
2854
|
+
}
|
|
2751
2855
|
|
|
2752
|
-
|
|
2753
|
-
|
|
2856
|
+
function _default(rawLines, lineNumber, colNumber, opts = {}) {
|
|
2857
|
+
if (!deprecationWarningShown) {
|
|
2858
|
+
deprecationWarningShown = true;
|
|
2859
|
+
const message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
|
|
2860
|
+
|
|
2861
|
+
if (process.emitWarning) {
|
|
2862
|
+
process.emitWarning(message, "DeprecationWarning");
|
|
2754
2863
|
} else {
|
|
2755
|
-
|
|
2864
|
+
const deprecationError = new Error(message);
|
|
2865
|
+
deprecationError.name = "DeprecationWarning";
|
|
2866
|
+
console.warn(new Error(message));
|
|
2756
2867
|
}
|
|
2757
2868
|
}
|
|
2758
2869
|
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
if (process.emitWarning) {
|
|
2765
|
-
process.emitWarning(message, "DeprecationWarning");
|
|
2766
|
-
} else {
|
|
2767
|
-
const deprecationError = new Error(message);
|
|
2768
|
-
deprecationError.name = "DeprecationWarning";
|
|
2769
|
-
console.warn(new Error(message));
|
|
2770
|
-
}
|
|
2870
|
+
colNumber = Math.max(colNumber, 0);
|
|
2871
|
+
const location = {
|
|
2872
|
+
start: {
|
|
2873
|
+
column: colNumber,
|
|
2874
|
+
line: lineNumber
|
|
2771
2875
|
}
|
|
2876
|
+
};
|
|
2877
|
+
return codeFrameColumns$1(rawLines, location, opts);
|
|
2878
|
+
}
|
|
2772
2879
|
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
}
|
|
2779
|
-
};
|
|
2780
|
-
return codeFrameColumns(rawLines, location, opts);
|
|
2781
|
-
}
|
|
2880
|
+
var lib = /*#__PURE__*/Object.defineProperty({
|
|
2881
|
+
codeFrameColumns: codeFrameColumns_1,
|
|
2882
|
+
default: default_1
|
|
2883
|
+
}, '__esModule', {
|
|
2884
|
+
value: true
|
|
2782
2885
|
});
|
|
2783
2886
|
|
|
2784
2887
|
const {
|
|
2785
2888
|
default: LinesAndColumns
|
|
2786
|
-
} = dist;
|
|
2889
|
+
} = dist$2;
|
|
2787
2890
|
const {
|
|
2788
2891
|
codeFrameColumns
|
|
2789
|
-
} = lib
|
|
2892
|
+
} = lib;
|
|
2790
2893
|
const JSONError = errorEx_1('JSONError', {
|
|
2791
2894
|
fileName: errorEx_1.append('in %s'),
|
|
2792
2895
|
codeFrame: errorEx_1.append('\n\n%s\n')
|
|
2793
2896
|
});
|
|
2794
2897
|
|
|
2795
|
-
|
|
2898
|
+
const parseJson = (string, reviver, filename) => {
|
|
2796
2899
|
if (typeof reviver === 'string') {
|
|
2797
2900
|
filename = reviver;
|
|
2798
2901
|
reviver = null;
|
|
@@ -2802,12 +2905,12 @@ var parseJson$1 = (string, reviver, filename) => {
|
|
|
2802
2905
|
try {
|
|
2803
2906
|
return JSON.parse(string, reviver);
|
|
2804
2907
|
} catch (error) {
|
|
2805
|
-
|
|
2908
|
+
jsonParseEvenBetterErrors(string, reviver);
|
|
2806
2909
|
throw error;
|
|
2807
2910
|
}
|
|
2808
2911
|
} catch (error) {
|
|
2809
2912
|
error.message = error.message.replace(/\n/g, '');
|
|
2810
|
-
const indexMatch = error.message.match(/in JSON at position (\d+) while parsing
|
|
2913
|
+
const indexMatch = error.message.match(/in JSON at position (\d+) while parsing/);
|
|
2811
2914
|
const jsonError = new JSONError(error);
|
|
2812
2915
|
|
|
2813
2916
|
if (filename) {
|
|
@@ -2833,6 +2936,9 @@ var parseJson$1 = (string, reviver, filename) => {
|
|
|
2833
2936
|
}
|
|
2834
2937
|
};
|
|
2835
2938
|
|
|
2939
|
+
parseJson.JSONError = JSONError;
|
|
2940
|
+
var parseJson_1 = parseJson;
|
|
2941
|
+
|
|
2836
2942
|
const Char = {
|
|
2837
2943
|
ANCHOR: '&',
|
|
2838
2944
|
COMMENT: '#',
|
|
@@ -3093,10 +3199,10 @@ class Range {
|
|
|
3093
3199
|
/** Root class of all nodes */
|
|
3094
3200
|
|
|
3095
3201
|
|
|
3096
|
-
class Node {
|
|
3202
|
+
class Node$1 {
|
|
3097
3203
|
static addStringTerminator(src, offset, str) {
|
|
3098
3204
|
if (str[str.length - 1] === '\n') return str;
|
|
3099
|
-
const next = Node.endOfWhiteSpace(src, offset);
|
|
3205
|
+
const next = Node$1.endOfWhiteSpace(src, offset);
|
|
3100
3206
|
return next >= src.length || src[next] === '\n' ? str + '\n' : str;
|
|
3101
3207
|
} // ^(---|...)
|
|
3102
3208
|
|
|
@@ -3175,12 +3281,12 @@ class Node {
|
|
|
3175
3281
|
|
|
3176
3282
|
|
|
3177
3283
|
static endOfBlockIndent(src, indent, lineStart) {
|
|
3178
|
-
const inEnd = Node.endOfIndent(src, lineStart);
|
|
3284
|
+
const inEnd = Node$1.endOfIndent(src, lineStart);
|
|
3179
3285
|
|
|
3180
3286
|
if (inEnd > lineStart + indent) {
|
|
3181
3287
|
return inEnd;
|
|
3182
3288
|
} else {
|
|
3183
|
-
const wsEnd = Node.endOfWhiteSpace(src, inEnd);
|
|
3289
|
+
const wsEnd = Node$1.endOfWhiteSpace(src, inEnd);
|
|
3184
3290
|
const ch = src[wsEnd];
|
|
3185
3291
|
if (!ch || ch === '\n') return wsEnd;
|
|
3186
3292
|
}
|
|
@@ -3202,7 +3308,7 @@ class Node {
|
|
|
3202
3308
|
|
|
3203
3309
|
static normalizeOffset(src, offset) {
|
|
3204
3310
|
const ch = src[offset];
|
|
3205
|
-
return !ch ? offset : ch !== '\n' && src[offset - 1] === '\n' ? offset - 1 : Node.endOfWhiteSpace(src, offset);
|
|
3311
|
+
return !ch ? offset : ch !== '\n' && src[offset - 1] === '\n' ? offset - 1 : Node$1.endOfWhiteSpace(src, offset);
|
|
3206
3312
|
} // fold single newline into space, multiple newlines to N - 1 newlines
|
|
3207
3313
|
// presumes src[offset] === '\n'
|
|
3208
3314
|
|
|
@@ -3223,7 +3329,7 @@ class Node {
|
|
|
3223
3329
|
|
|
3224
3330
|
case '\t':
|
|
3225
3331
|
if (inCount <= indent) error = true;
|
|
3226
|
-
offset = Node.endOfWhiteSpace(src, offset + 2) - 1;
|
|
3332
|
+
offset = Node$1.endOfWhiteSpace(src, offset + 2) - 1;
|
|
3227
3333
|
break;
|
|
3228
3334
|
|
|
3229
3335
|
case ' ':
|
|
@@ -3295,7 +3401,7 @@ class Node {
|
|
|
3295
3401
|
const {
|
|
3296
3402
|
end
|
|
3297
3403
|
} = this.valueRange;
|
|
3298
|
-
return start !== end || Node.atBlank(src, end - 1);
|
|
3404
|
+
return start !== end || Node$1.atBlank(src, end - 1);
|
|
3299
3405
|
}
|
|
3300
3406
|
|
|
3301
3407
|
get hasComment() {
|
|
@@ -3401,7 +3507,7 @@ class Node {
|
|
|
3401
3507
|
} = this.context;
|
|
3402
3508
|
|
|
3403
3509
|
if (src[start] === Char.COMMENT) {
|
|
3404
|
-
const end = Node.endOfLine(src, start + 1);
|
|
3510
|
+
const end = Node$1.endOfLine(src, start + 1);
|
|
3405
3511
|
const commentRange = new Range(start, end);
|
|
3406
3512
|
this.props.push(commentRange);
|
|
3407
3513
|
return end;
|
|
@@ -3436,14 +3542,14 @@ class Node {
|
|
|
3436
3542
|
} = this;
|
|
3437
3543
|
if (value != null) return value;
|
|
3438
3544
|
const str = src.slice(range.start, range.end);
|
|
3439
|
-
return Node.addStringTerminator(src, range.end, str);
|
|
3545
|
+
return Node$1.addStringTerminator(src, range.end, str);
|
|
3440
3546
|
}
|
|
3441
3547
|
|
|
3442
3548
|
}
|
|
3443
3549
|
|
|
3444
3550
|
class YAMLError extends Error {
|
|
3445
3551
|
constructor(name, source, message) {
|
|
3446
|
-
if (!message || !(source instanceof Node)) throw new Error(`Invalid arguments for new ${name}`);
|
|
3552
|
+
if (!message || !(source instanceof Node$1)) throw new Error(`Invalid arguments for new ${name}`);
|
|
3447
3553
|
super();
|
|
3448
3554
|
this.name = name;
|
|
3449
3555
|
this.message = message;
|
|
@@ -3534,7 +3640,7 @@ function _defineProperty(obj, key, value) {
|
|
|
3534
3640
|
return obj;
|
|
3535
3641
|
}
|
|
3536
3642
|
|
|
3537
|
-
class PlainValue extends Node {
|
|
3643
|
+
class PlainValue extends Node$1 {
|
|
3538
3644
|
static endOfLine(src, start, inFlow) {
|
|
3539
3645
|
let ch = src[start];
|
|
3540
3646
|
let offset = start;
|
|
@@ -3573,7 +3679,7 @@ class PlainValue extends Node {
|
|
|
3573
3679
|
const {
|
|
3574
3680
|
fold,
|
|
3575
3681
|
offset
|
|
3576
|
-
} = Node.foldNewline(src, i, -1);
|
|
3682
|
+
} = Node$1.foldNewline(src, i, -1);
|
|
3577
3683
|
str += fold;
|
|
3578
3684
|
i = offset;
|
|
3579
3685
|
} else if (ch === ' ' || ch === '\t') {
|
|
@@ -3631,8 +3737,8 @@ class PlainValue extends Node {
|
|
|
3631
3737
|
let valueEnd = start;
|
|
3632
3738
|
|
|
3633
3739
|
for (let ch = src[offset]; ch === '\n'; ch = src[offset]) {
|
|
3634
|
-
if (Node.atDocumentBoundary(src, offset + 1)) break;
|
|
3635
|
-
const end = Node.endOfBlockIndent(src, indent, offset + 1);
|
|
3740
|
+
if (Node$1.atDocumentBoundary(src, offset + 1)) break;
|
|
3741
|
+
const end = Node$1.endOfBlockIndent(src, indent, offset + 1);
|
|
3636
3742
|
if (end === null || src[end] === '#') break;
|
|
3637
3743
|
|
|
3638
3744
|
if (src[end] === '\n') {
|
|
@@ -3688,7 +3794,7 @@ class PlainValue extends Node {
|
|
|
3688
3794
|
}
|
|
3689
3795
|
|
|
3690
3796
|
this.valueRange = new Range(start, offset);
|
|
3691
|
-
offset = Node.endOfWhiteSpace(src, offset);
|
|
3797
|
+
offset = Node$1.endOfWhiteSpace(src, offset);
|
|
3692
3798
|
offset = this.parseComment(offset);
|
|
3693
3799
|
|
|
3694
3800
|
if (!this.hasComment || this.valueRange.isEmpty()) {
|
|
@@ -3701,7 +3807,7 @@ class PlainValue extends Node {
|
|
|
3701
3807
|
}
|
|
3702
3808
|
|
|
3703
3809
|
var Char_1 = Char;
|
|
3704
|
-
var Node_1 = Node;
|
|
3810
|
+
var Node_1$1 = Node$1;
|
|
3705
3811
|
var PlainValue_1 = PlainValue;
|
|
3706
3812
|
var Range_1 = Range;
|
|
3707
3813
|
var Type_1 = Type;
|
|
@@ -3715,7 +3821,7 @@ var defaultTagPrefix_1 = defaultTagPrefix;
|
|
|
3715
3821
|
var defaultTags_1 = defaultTags;
|
|
3716
3822
|
var PlainValueEc8e588e = {
|
|
3717
3823
|
Char: Char_1,
|
|
3718
|
-
Node: Node_1,
|
|
3824
|
+
Node: Node_1$1,
|
|
3719
3825
|
PlainValue: PlainValue_1,
|
|
3720
3826
|
Range: Range_1,
|
|
3721
3827
|
Type: Type_1,
|
|
@@ -3901,7 +4007,7 @@ function grabCollectionEndComments(node) {
|
|
|
3901
4007
|
|
|
3902
4008
|
while (cnode instanceof CollectionItem) cnode = cnode.node;
|
|
3903
4009
|
|
|
3904
|
-
if (!(cnode instanceof Collection)) return null;
|
|
4010
|
+
if (!(cnode instanceof Collection$1)) return null;
|
|
3905
4011
|
const len = cnode.items.length;
|
|
3906
4012
|
let ci = -1;
|
|
3907
4013
|
|
|
@@ -3933,7 +4039,7 @@ function grabCollectionEndComments(node) {
|
|
|
3933
4039
|
return ca;
|
|
3934
4040
|
}
|
|
3935
4041
|
|
|
3936
|
-
class Collection extends PlainValueEc8e588e.Node {
|
|
4042
|
+
class Collection$1 extends PlainValueEc8e588e.Node {
|
|
3937
4043
|
static nextContentHasIndent(src, offset, indent) {
|
|
3938
4044
|
const lineStart = PlainValueEc8e588e.Node.endOfLine(src, offset) + 1;
|
|
3939
4045
|
offset = PlainValueEc8e588e.Node.endOfWhiteSpace(src, lineStart);
|
|
@@ -3941,7 +4047,7 @@ class Collection extends PlainValueEc8e588e.Node {
|
|
|
3941
4047
|
if (!ch) return false;
|
|
3942
4048
|
if (offset >= lineStart + indent) return true;
|
|
3943
4049
|
if (ch !== '#' && ch !== '\n') return false;
|
|
3944
|
-
return Collection.nextContentHasIndent(src, offset, indent);
|
|
4050
|
+
return Collection$1.nextContentHasIndent(src, offset, indent);
|
|
3945
4051
|
}
|
|
3946
4052
|
|
|
3947
4053
|
constructor(firstItem) {
|
|
@@ -4011,7 +4117,7 @@ class Collection extends PlainValueEc8e588e.Node {
|
|
|
4011
4117
|
this.items.push(blankLine);
|
|
4012
4118
|
offset -= 1; // blankLine.parse() consumes terminal newline
|
|
4013
4119
|
} else if (ch === '#') {
|
|
4014
|
-
if (offset < lineStart + indent && !Collection.nextContentHasIndent(src, offset, indent)) {
|
|
4120
|
+
if (offset < lineStart + indent && !Collection$1.nextContentHasIndent(src, offset, indent)) {
|
|
4015
4121
|
return offset;
|
|
4016
4122
|
}
|
|
4017
4123
|
|
|
@@ -4195,7 +4301,7 @@ class Directive extends PlainValueEc8e588e.Node {
|
|
|
4195
4301
|
|
|
4196
4302
|
}
|
|
4197
4303
|
|
|
4198
|
-
class Document extends PlainValueEc8e588e.Node {
|
|
4304
|
+
class Document$2 extends PlainValueEc8e588e.Node {
|
|
4199
4305
|
static startCommentOrEndBlankLine(src, start) {
|
|
4200
4306
|
const offset = PlainValueEc8e588e.Node.endOfWhiteSpace(src, start);
|
|
4201
4307
|
const ch = src[offset];
|
|
@@ -4220,7 +4326,7 @@ class Document extends PlainValueEc8e588e.Node {
|
|
|
4220
4326
|
let offset = start;
|
|
4221
4327
|
|
|
4222
4328
|
while (!PlainValueEc8e588e.Node.atDocumentBoundary(src, offset, PlainValueEc8e588e.Char.DIRECTIVES_END)) {
|
|
4223
|
-
offset = Document.startCommentOrEndBlankLine(src, offset);
|
|
4329
|
+
offset = Document$2.startCommentOrEndBlankLine(src, offset);
|
|
4224
4330
|
|
|
4225
4331
|
switch (src[offset]) {
|
|
4226
4332
|
case '\n':
|
|
@@ -4358,7 +4464,7 @@ class Document extends PlainValueEc8e588e.Node {
|
|
|
4358
4464
|
}
|
|
4359
4465
|
}
|
|
4360
4466
|
|
|
4361
|
-
offset = Document.startCommentOrEndBlankLine(src, offset);
|
|
4467
|
+
offset = Document$2.startCommentOrEndBlankLine(src, offset);
|
|
4362
4468
|
}
|
|
4363
4469
|
|
|
4364
4470
|
this.valueRange.end = offset;
|
|
@@ -4447,7 +4553,7 @@ class Document extends PlainValueEc8e588e.Node {
|
|
|
4447
4553
|
|
|
4448
4554
|
}
|
|
4449
4555
|
|
|
4450
|
-
class Alias extends PlainValueEc8e588e.Node {
|
|
4556
|
+
class Alias$1 extends PlainValueEc8e588e.Node {
|
|
4451
4557
|
/**
|
|
4452
4558
|
* Parses an *alias from the source
|
|
4453
4559
|
*
|
|
@@ -5214,7 +5320,7 @@ class QuoteSingle extends PlainValueEc8e588e.Node {
|
|
|
5214
5320
|
function createNewNode(type, props) {
|
|
5215
5321
|
switch (type) {
|
|
5216
5322
|
case PlainValueEc8e588e.Type.ALIAS:
|
|
5217
|
-
return new Alias(type, props);
|
|
5323
|
+
return new Alias$1(type, props);
|
|
5218
5324
|
|
|
5219
5325
|
case PlainValueEc8e588e.Type.BLOCK_FOLDED:
|
|
5220
5326
|
case PlainValueEc8e588e.Type.BLOCK_LITERAL:
|
|
@@ -5330,7 +5436,7 @@ class ParseContext {
|
|
|
5330
5436
|
node.error = new PlainValueEc8e588e.YAMLSyntaxError(node, 'Block collection must not have preceding content here (e.g. directives-end indicator)');
|
|
5331
5437
|
}
|
|
5332
5438
|
|
|
5333
|
-
const collection = new Collection(node);
|
|
5439
|
+
const collection = new Collection$1(node);
|
|
5334
5440
|
offset = collection.parse(new ParseContext(context), offset);
|
|
5335
5441
|
collection.range = new PlainValueEc8e588e.Range(start, offset);
|
|
5336
5442
|
return collection;
|
|
@@ -5379,11 +5485,17 @@ class ParseContext {
|
|
|
5379
5485
|
|
|
5380
5486
|
while (ch === PlainValueEc8e588e.Char.ANCHOR || ch === PlainValueEc8e588e.Char.COMMENT || ch === PlainValueEc8e588e.Char.TAG || ch === '\n') {
|
|
5381
5487
|
if (ch === '\n') {
|
|
5382
|
-
|
|
5383
|
-
|
|
5488
|
+
let inEnd = offset;
|
|
5489
|
+
let lineStart;
|
|
5490
|
+
|
|
5491
|
+
do {
|
|
5492
|
+
lineStart = inEnd + 1;
|
|
5493
|
+
inEnd = PlainValueEc8e588e.Node.endOfIndent(src, lineStart);
|
|
5494
|
+
} while (src[inEnd] === '\n');
|
|
5495
|
+
|
|
5384
5496
|
const indentDiff = inEnd - (lineStart + this.indent);
|
|
5385
5497
|
const noIndicatorAsIndent = parent.type === PlainValueEc8e588e.Type.SEQ_ITEM && parent.context.atLineStart;
|
|
5386
|
-
if (!PlainValueEc8e588e.Node.nextNodeIsIndented(src[inEnd], indentDiff, !noIndicatorAsIndent)) break;
|
|
5498
|
+
if (src[inEnd] !== '#' && !PlainValueEc8e588e.Node.nextNodeIsIndented(src[inEnd], indentDiff, !noIndicatorAsIndent)) break;
|
|
5387
5499
|
this.atLineStart = true;
|
|
5388
5500
|
this.lineStart = lineStart;
|
|
5389
5501
|
lineHasProps = false;
|
|
@@ -5431,7 +5543,7 @@ class ParseContext {
|
|
|
5431
5543
|
} // Published as 'yaml/parse-cst'
|
|
5432
5544
|
|
|
5433
5545
|
|
|
5434
|
-
function parse(src) {
|
|
5546
|
+
function parse$1(src) {
|
|
5435
5547
|
const cr = [];
|
|
5436
5548
|
|
|
5437
5549
|
if (src.indexOf('\r') !== -1) {
|
|
@@ -5445,7 +5557,7 @@ function parse(src) {
|
|
|
5445
5557
|
let offset = 0;
|
|
5446
5558
|
|
|
5447
5559
|
do {
|
|
5448
|
-
const doc = new Document();
|
|
5560
|
+
const doc = new Document$2();
|
|
5449
5561
|
const context = new ParseContext({
|
|
5450
5562
|
src
|
|
5451
5563
|
});
|
|
@@ -5473,7 +5585,7 @@ function parse(src) {
|
|
|
5473
5585
|
return documents;
|
|
5474
5586
|
}
|
|
5475
5587
|
|
|
5476
|
-
var parse_1 = parse;
|
|
5588
|
+
var parse_1 = parse$1;
|
|
5477
5589
|
var parseCst = {
|
|
5478
5590
|
parse: parse_1
|
|
5479
5591
|
};
|
|
@@ -5488,7 +5600,7 @@ function addComment(str, indent, comment) {
|
|
|
5488
5600
|
return !comment ? str : comment.indexOf('\n') === -1 ? `${str} #${comment}` : `${str}\n` + comment.replace(/^/gm, `${indent || ''}#`);
|
|
5489
5601
|
}
|
|
5490
5602
|
|
|
5491
|
-
class Node
|
|
5603
|
+
class Node {}
|
|
5492
5604
|
|
|
5493
5605
|
function toJSON(value, arg, ctx) {
|
|
5494
5606
|
if (Array.isArray(value)) return value.map((v, i) => toJSON(v, String(i), ctx));
|
|
@@ -5508,7 +5620,7 @@ function toJSON(value, arg, ctx) {
|
|
|
5508
5620
|
return value;
|
|
5509
5621
|
}
|
|
5510
5622
|
|
|
5511
|
-
class Scalar extends Node
|
|
5623
|
+
class Scalar extends Node {
|
|
5512
5624
|
constructor(value) {
|
|
5513
5625
|
super();
|
|
5514
5626
|
this.value = value;
|
|
@@ -5529,9 +5641,21 @@ function collectionFromPath(schema, path, value) {
|
|
|
5529
5641
|
|
|
5530
5642
|
for (let i = path.length - 1; i >= 0; --i) {
|
|
5531
5643
|
const k = path[i];
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5644
|
+
|
|
5645
|
+
if (Number.isInteger(k) && k >= 0) {
|
|
5646
|
+
const a = [];
|
|
5647
|
+
a[k] = v;
|
|
5648
|
+
v = a;
|
|
5649
|
+
} else {
|
|
5650
|
+
const o = {};
|
|
5651
|
+
Object.defineProperty(o, k, {
|
|
5652
|
+
value: v,
|
|
5653
|
+
writable: true,
|
|
5654
|
+
enumerable: true,
|
|
5655
|
+
configurable: true
|
|
5656
|
+
});
|
|
5657
|
+
v = o;
|
|
5658
|
+
}
|
|
5535
5659
|
}
|
|
5536
5660
|
|
|
5537
5661
|
return schema.createNode(v, false);
|
|
@@ -5540,7 +5664,7 @@ function collectionFromPath(schema, path, value) {
|
|
|
5540
5664
|
|
|
5541
5665
|
const isEmptyPath = path => path == null || typeof path === 'object' && path[Symbol.iterator]().next().done;
|
|
5542
5666
|
|
|
5543
|
-
class Collection
|
|
5667
|
+
class Collection extends Node {
|
|
5544
5668
|
constructor(schema) {
|
|
5545
5669
|
super();
|
|
5546
5670
|
|
|
@@ -5553,19 +5677,19 @@ class Collection$1 extends Node$1 {
|
|
|
5553
5677
|
if (isEmptyPath(path)) this.add(value);else {
|
|
5554
5678
|
const [key, ...rest] = path;
|
|
5555
5679
|
const node = this.get(key, true);
|
|
5556
|
-
if (node instanceof Collection
|
|
5680
|
+
if (node instanceof Collection) node.addIn(rest, value);else if (node === undefined && this.schema) this.set(key, collectionFromPath(this.schema, rest, value));else throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
5557
5681
|
}
|
|
5558
5682
|
}
|
|
5559
5683
|
|
|
5560
5684
|
deleteIn([key, ...rest]) {
|
|
5561
5685
|
if (rest.length === 0) return this.delete(key);
|
|
5562
5686
|
const node = this.get(key, true);
|
|
5563
|
-
if (node instanceof Collection
|
|
5687
|
+
if (node instanceof Collection) return node.deleteIn(rest);else throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
5564
5688
|
}
|
|
5565
5689
|
|
|
5566
5690
|
getIn([key, ...rest], keepScalar) {
|
|
5567
5691
|
const node = this.get(key, true);
|
|
5568
|
-
if (rest.length === 0) return !keepScalar && node instanceof Scalar ? node.value : node;else return node instanceof Collection
|
|
5692
|
+
if (rest.length === 0) return !keepScalar && node instanceof Scalar ? node.value : node;else return node instanceof Collection ? node.getIn(rest, keepScalar) : undefined;
|
|
5569
5693
|
}
|
|
5570
5694
|
|
|
5571
5695
|
hasAllNullValues() {
|
|
@@ -5579,7 +5703,7 @@ class Collection$1 extends Node$1 {
|
|
|
5579
5703
|
hasIn([key, ...rest]) {
|
|
5580
5704
|
if (rest.length === 0) return this.has(key);
|
|
5581
5705
|
const node = this.get(key, true);
|
|
5582
|
-
return node instanceof Collection
|
|
5706
|
+
return node instanceof Collection ? node.hasIn(rest) : false;
|
|
5583
5707
|
}
|
|
5584
5708
|
|
|
5585
5709
|
setIn([key, ...rest], value) {
|
|
@@ -5587,7 +5711,7 @@ class Collection$1 extends Node$1 {
|
|
|
5587
5711
|
this.set(key, value);
|
|
5588
5712
|
} else {
|
|
5589
5713
|
const node = this.get(key, true);
|
|
5590
|
-
if (node instanceof Collection
|
|
5714
|
+
if (node instanceof Collection) node.setIn(rest, value);else if (node === undefined && this.schema) this.set(key, collectionFromPath(this.schema, rest, value));else throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
5591
5715
|
}
|
|
5592
5716
|
} // overridden in implementations
|
|
5593
5717
|
|
|
@@ -5661,7 +5785,7 @@ class Collection$1 extends Node$1 {
|
|
|
5661
5785
|
} = flowChars;
|
|
5662
5786
|
const strings = nodes.map(n => n.str);
|
|
5663
5787
|
|
|
5664
|
-
if (hasItemWithNewLine || strings.reduce((sum, str) => sum + str.length + 2, 2) > Collection
|
|
5788
|
+
if (hasItemWithNewLine || strings.reduce((sum, str) => sum + str.length + 2, 2) > Collection.maxFlowStringSingleLineLength) {
|
|
5665
5789
|
str = start;
|
|
5666
5790
|
|
|
5667
5791
|
for (const s of strings) {
|
|
@@ -5689,7 +5813,7 @@ class Collection$1 extends Node$1 {
|
|
|
5689
5813
|
|
|
5690
5814
|
}
|
|
5691
5815
|
|
|
5692
|
-
PlainValueEc8e588e._defineProperty(Collection
|
|
5816
|
+
PlainValueEc8e588e._defineProperty(Collection, "maxFlowStringSingleLineLength", 60);
|
|
5693
5817
|
|
|
5694
5818
|
function asItemIndex(key) {
|
|
5695
5819
|
let idx = key instanceof Scalar ? key.value : key;
|
|
@@ -5697,7 +5821,7 @@ function asItemIndex(key) {
|
|
|
5697
5821
|
return Number.isInteger(idx) && idx >= 0 ? idx : null;
|
|
5698
5822
|
}
|
|
5699
5823
|
|
|
5700
|
-
class YAMLSeq extends Collection
|
|
5824
|
+
class YAMLSeq extends Collection {
|
|
5701
5825
|
add(value) {
|
|
5702
5826
|
this.items.push(value);
|
|
5703
5827
|
}
|
|
@@ -5755,8 +5879,8 @@ class YAMLSeq extends Collection$1 {
|
|
|
5755
5879
|
const stringifyKey = (key, jsKey, ctx) => {
|
|
5756
5880
|
if (jsKey === null) return '';
|
|
5757
5881
|
if (typeof jsKey !== 'object') return String(jsKey);
|
|
5758
|
-
if (key instanceof Node
|
|
5759
|
-
anchors:
|
|
5882
|
+
if (key instanceof Node && ctx && ctx.doc) return key.toString({
|
|
5883
|
+
anchors: Object.create(null),
|
|
5760
5884
|
doc: ctx.doc,
|
|
5761
5885
|
indent: '',
|
|
5762
5886
|
indentStep: ctx.indentStep,
|
|
@@ -5767,7 +5891,7 @@ const stringifyKey = (key, jsKey, ctx) => {
|
|
|
5767
5891
|
return JSON.stringify(jsKey);
|
|
5768
5892
|
};
|
|
5769
5893
|
|
|
5770
|
-
class Pair extends Node
|
|
5894
|
+
class Pair extends Node {
|
|
5771
5895
|
constructor(key, value = null) {
|
|
5772
5896
|
super();
|
|
5773
5897
|
this.key = key;
|
|
@@ -5776,12 +5900,12 @@ class Pair extends Node$1 {
|
|
|
5776
5900
|
}
|
|
5777
5901
|
|
|
5778
5902
|
get commentBefore() {
|
|
5779
|
-
return this.key instanceof Node
|
|
5903
|
+
return this.key instanceof Node ? this.key.commentBefore : undefined;
|
|
5780
5904
|
}
|
|
5781
5905
|
|
|
5782
5906
|
set commentBefore(cb) {
|
|
5783
5907
|
if (this.key == null) this.key = new Scalar(null);
|
|
5784
|
-
if (this.key instanceof Node
|
|
5908
|
+
if (this.key instanceof Node) this.key.commentBefore = cb;else {
|
|
5785
5909
|
const msg = 'Pair.commentBefore is an alias for Pair.key.commentBefore. To set it, the key must be a Node.';
|
|
5786
5910
|
throw new Error(msg);
|
|
5787
5911
|
}
|
|
@@ -5797,7 +5921,13 @@ class Pair extends Node$1 {
|
|
|
5797
5921
|
map.add(key);
|
|
5798
5922
|
} else {
|
|
5799
5923
|
const stringKey = stringifyKey(this.key, key, ctx);
|
|
5800
|
-
|
|
5924
|
+
const value = toJSON(this.value, stringKey, ctx);
|
|
5925
|
+
if (stringKey in map) Object.defineProperty(map, stringKey, {
|
|
5926
|
+
value,
|
|
5927
|
+
writable: true,
|
|
5928
|
+
enumerable: true,
|
|
5929
|
+
configurable: true
|
|
5930
|
+
});else map[stringKey] = value;
|
|
5801
5931
|
}
|
|
5802
5932
|
|
|
5803
5933
|
return map;
|
|
@@ -5819,20 +5949,20 @@ class Pair extends Node$1 {
|
|
|
5819
5949
|
key,
|
|
5820
5950
|
value
|
|
5821
5951
|
} = this;
|
|
5822
|
-
let keyComment = key instanceof Node
|
|
5952
|
+
let keyComment = key instanceof Node && key.comment;
|
|
5823
5953
|
|
|
5824
5954
|
if (simpleKeys) {
|
|
5825
5955
|
if (keyComment) {
|
|
5826
5956
|
throw new Error('With simple keys, key nodes cannot have comments');
|
|
5827
5957
|
}
|
|
5828
5958
|
|
|
5829
|
-
if (key instanceof Collection
|
|
5959
|
+
if (key instanceof Collection) {
|
|
5830
5960
|
const msg = 'With simple keys, collection cannot be used as a key value';
|
|
5831
5961
|
throw new Error(msg);
|
|
5832
5962
|
}
|
|
5833
5963
|
}
|
|
5834
5964
|
|
|
5835
|
-
|
|
5965
|
+
let explicitKey = !simpleKeys && (!key || keyComment || (key instanceof Node ? key instanceof Collection || key.type === PlainValueEc8e588e.Type.BLOCK_FOLDED || key.type === PlainValueEc8e588e.Type.BLOCK_LITERAL : typeof key === 'object'));
|
|
5836
5966
|
const {
|
|
5837
5967
|
doc,
|
|
5838
5968
|
indent,
|
|
@@ -5847,13 +5977,18 @@ class Pair extends Node$1 {
|
|
|
5847
5977
|
let str = stringify(key, ctx, () => keyComment = null, () => chompKeep = true);
|
|
5848
5978
|
str = addComment(str, ctx.indent, keyComment);
|
|
5849
5979
|
|
|
5980
|
+
if (!explicitKey && str.length > 1024) {
|
|
5981
|
+
if (simpleKeys) throw new Error('With simple keys, single line scalar must not span more than 1024 characters');
|
|
5982
|
+
explicitKey = true;
|
|
5983
|
+
}
|
|
5984
|
+
|
|
5850
5985
|
if (ctx.allNullValues && !simpleKeys) {
|
|
5851
5986
|
if (this.comment) {
|
|
5852
5987
|
str = addComment(str, ctx.indent, this.comment);
|
|
5853
5988
|
if (onComment) onComment();
|
|
5854
5989
|
} else if (chompKeep && !keyComment && onChompKeep) onChompKeep();
|
|
5855
5990
|
|
|
5856
|
-
return ctx.inFlow ? str : `? ${str}`;
|
|
5991
|
+
return ctx.inFlow && !explicitKey ? str : `? ${str}`;
|
|
5857
5992
|
}
|
|
5858
5993
|
|
|
5859
5994
|
str = explicitKey ? `? ${str}\n${indent}:` : `${str}:`;
|
|
@@ -5867,7 +6002,7 @@ class Pair extends Node$1 {
|
|
|
5867
6002
|
let vcb = '';
|
|
5868
6003
|
let valueComment = null;
|
|
5869
6004
|
|
|
5870
|
-
if (value instanceof Node
|
|
6005
|
+
if (value instanceof Node) {
|
|
5871
6006
|
if (value.spaceBefore) vcb = '\n';
|
|
5872
6007
|
|
|
5873
6008
|
if (value.commentBefore) {
|
|
@@ -5894,10 +6029,10 @@ class Pair extends Node$1 {
|
|
|
5894
6029
|
|
|
5895
6030
|
if (vcb || this.comment) {
|
|
5896
6031
|
ws = `${vcb}\n${ctx.indent}`;
|
|
5897
|
-
} else if (!explicitKey && value instanceof Collection
|
|
6032
|
+
} else if (!explicitKey && value instanceof Collection) {
|
|
5898
6033
|
const flow = valueStr[0] === '[' || valueStr[0] === '{';
|
|
5899
6034
|
if (!flow || valueStr.includes('\n')) ws = `\n${ctx.indent}`;
|
|
5900
|
-
}
|
|
6035
|
+
} else if (valueStr[0] === '\n') ws = '';
|
|
5901
6036
|
|
|
5902
6037
|
if (chompKeep && !valueComment && onChompKeep) onChompKeep();
|
|
5903
6038
|
return addComment(str + ws + valueStr, ctx.indent, valueComment);
|
|
@@ -5911,10 +6046,10 @@ PlainValueEc8e588e._defineProperty(Pair, "Type", {
|
|
|
5911
6046
|
});
|
|
5912
6047
|
|
|
5913
6048
|
const getAliasCount = (node, anchors) => {
|
|
5914
|
-
if (node instanceof Alias
|
|
6049
|
+
if (node instanceof Alias) {
|
|
5915
6050
|
const anchor = anchors.get(node.source);
|
|
5916
6051
|
return anchor.count * anchor.aliasCount;
|
|
5917
|
-
} else if (node instanceof Collection
|
|
6052
|
+
} else if (node instanceof Collection) {
|
|
5918
6053
|
let count = 0;
|
|
5919
6054
|
|
|
5920
6055
|
for (const item of node.items) {
|
|
@@ -5932,7 +6067,7 @@ const getAliasCount = (node, anchors) => {
|
|
|
5932
6067
|
return 1;
|
|
5933
6068
|
};
|
|
5934
6069
|
|
|
5935
|
-
class Alias
|
|
6070
|
+
class Alias extends Node {
|
|
5936
6071
|
static stringify({
|
|
5937
6072
|
range,
|
|
5938
6073
|
source
|
|
@@ -5989,12 +6124,12 @@ class Alias$1 extends Node$1 {
|
|
|
5989
6124
|
|
|
5990
6125
|
|
|
5991
6126
|
toString(ctx) {
|
|
5992
|
-
return Alias
|
|
6127
|
+
return Alias.stringify(this, ctx);
|
|
5993
6128
|
}
|
|
5994
6129
|
|
|
5995
6130
|
}
|
|
5996
6131
|
|
|
5997
|
-
PlainValueEc8e588e._defineProperty(Alias
|
|
6132
|
+
PlainValueEc8e588e._defineProperty(Alias, "default", true);
|
|
5998
6133
|
|
|
5999
6134
|
function findPair(items, key) {
|
|
6000
6135
|
const k = key instanceof Scalar ? key.value : key;
|
|
@@ -6009,7 +6144,7 @@ function findPair(items, key) {
|
|
|
6009
6144
|
return undefined;
|
|
6010
6145
|
}
|
|
6011
6146
|
|
|
6012
|
-
class YAMLMap extends Collection
|
|
6147
|
+
class YAMLMap extends Collection {
|
|
6013
6148
|
add(pair, overwrite) {
|
|
6014
6149
|
if (!pair) pair = new Pair(pair);else if (!(pair instanceof Pair)) pair = new Pair(pair.key || pair, pair.value);
|
|
6015
6150
|
const prev = findPair(this.items, pair.key);
|
|
@@ -6123,8 +6258,13 @@ class Merge extends Pair {
|
|
|
6123
6258
|
if (!map.has(key)) map.set(key, value);
|
|
6124
6259
|
} else if (map instanceof Set) {
|
|
6125
6260
|
map.add(key);
|
|
6126
|
-
} else {
|
|
6127
|
-
|
|
6261
|
+
} else if (!Object.prototype.hasOwnProperty.call(map, key)) {
|
|
6262
|
+
Object.defineProperty(map, key, {
|
|
6263
|
+
value,
|
|
6264
|
+
writable: true,
|
|
6265
|
+
enumerable: true,
|
|
6266
|
+
configurable: true
|
|
6267
|
+
});
|
|
6128
6268
|
}
|
|
6129
6269
|
}
|
|
6130
6270
|
}
|
|
@@ -6224,7 +6364,7 @@ const consumeMoreIndentedLines = (text, i) => {
|
|
|
6224
6364
|
* the first line, defaulting to `indent.length`
|
|
6225
6365
|
* @param {number} [options.lineWidth=80]
|
|
6226
6366
|
* @param {number} [options.minContentWidth=20] Allow highly indented lines to
|
|
6227
|
-
* stretch the line width
|
|
6367
|
+
* stretch the line width or indent content from the start
|
|
6228
6368
|
* @param {function} options.onFold Called once if the text is folded
|
|
6229
6369
|
* @param {function} options.onFold Called once if any line of text exceeds
|
|
6230
6370
|
* lineWidth characters
|
|
@@ -6243,11 +6383,18 @@ function foldFlowLines(text, indent, mode, {
|
|
|
6243
6383
|
if (text.length <= endStep) return text;
|
|
6244
6384
|
const folds = [];
|
|
6245
6385
|
const escapedFolds = {};
|
|
6246
|
-
let end = lineWidth -
|
|
6386
|
+
let end = lineWidth - indent.length;
|
|
6387
|
+
|
|
6388
|
+
if (typeof indentAtStart === 'number') {
|
|
6389
|
+
if (indentAtStart > lineWidth - Math.max(2, minContentWidth)) folds.push(0);else end = lineWidth - indentAtStart;
|
|
6390
|
+
}
|
|
6391
|
+
|
|
6247
6392
|
let split = undefined;
|
|
6248
6393
|
let prev = undefined;
|
|
6249
6394
|
let overflow = false;
|
|
6250
6395
|
let i = -1;
|
|
6396
|
+
let escStart = -1;
|
|
6397
|
+
let escEnd = -1;
|
|
6251
6398
|
|
|
6252
6399
|
if (mode === FOLD_BLOCK) {
|
|
6253
6400
|
i = consumeMoreIndentedLines(text, i);
|
|
@@ -6256,6 +6403,8 @@ function foldFlowLines(text, indent, mode, {
|
|
|
6256
6403
|
|
|
6257
6404
|
for (let ch; ch = text[i += 1];) {
|
|
6258
6405
|
if (mode === FOLD_QUOTED && ch === '\\') {
|
|
6406
|
+
escStart = i;
|
|
6407
|
+
|
|
6259
6408
|
switch (text[i + 1]) {
|
|
6260
6409
|
case 'x':
|
|
6261
6410
|
i += 3;
|
|
@@ -6272,6 +6421,8 @@ function foldFlowLines(text, indent, mode, {
|
|
|
6272
6421
|
default:
|
|
6273
6422
|
i += 1;
|
|
6274
6423
|
}
|
|
6424
|
+
|
|
6425
|
+
escEnd = i;
|
|
6275
6426
|
}
|
|
6276
6427
|
|
|
6277
6428
|
if (ch === '\n') {
|
|
@@ -6296,12 +6447,15 @@ function foldFlowLines(text, indent, mode, {
|
|
|
6296
6447
|
prev = ch;
|
|
6297
6448
|
ch = text[i += 1];
|
|
6298
6449
|
overflow = true;
|
|
6299
|
-
} //
|
|
6450
|
+
} // Account for newline escape, but don't break preceding escape
|
|
6300
6451
|
|
|
6301
6452
|
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
|
|
6453
|
+
const j = i > escEnd + 1 ? i - 2 : escStart - 1; // Bail out if lineWidth & minContentWidth are shorter than an escape string
|
|
6454
|
+
|
|
6455
|
+
if (escapedFolds[j]) return text;
|
|
6456
|
+
folds.push(j);
|
|
6457
|
+
escapedFolds[j] = true;
|
|
6458
|
+
end = j + endStep;
|
|
6305
6459
|
split = undefined;
|
|
6306
6460
|
} else {
|
|
6307
6461
|
overflow = true;
|
|
@@ -6320,8 +6474,10 @@ function foldFlowLines(text, indent, mode, {
|
|
|
6320
6474
|
for (let i = 0; i < folds.length; ++i) {
|
|
6321
6475
|
const fold = folds[i];
|
|
6322
6476
|
const end = folds[i + 1] || text.length;
|
|
6323
|
-
if (
|
|
6324
|
-
|
|
6477
|
+
if (fold === 0) res = `\n${indent}${text.slice(0, end)}`;else {
|
|
6478
|
+
if (mode === FOLD_QUOTED && escapedFolds[fold]) res += `${text[fold]}\\`;
|
|
6479
|
+
res += `\n${indent}${text.slice(fold + 1, end)}`;
|
|
6480
|
+
}
|
|
6325
6481
|
}
|
|
6326
6482
|
|
|
6327
6483
|
return res;
|
|
@@ -6337,7 +6493,9 @@ const getFoldOptions = ({
|
|
|
6337
6493
|
|
|
6338
6494
|
const containsDocumentMarker = str => /^(%|---|\.\.\.)/m.test(str);
|
|
6339
6495
|
|
|
6340
|
-
function lineLengthOverLimit(str,
|
|
6496
|
+
function lineLengthOverLimit(str, lineWidth, indentLength) {
|
|
6497
|
+
if (!lineWidth || lineWidth < 0) return false;
|
|
6498
|
+
const limit = lineWidth - indentLength;
|
|
6341
6499
|
const strLen = str.length;
|
|
6342
6500
|
if (strLen <= limit) return false;
|
|
6343
6501
|
|
|
@@ -6480,7 +6638,7 @@ function blockString({
|
|
|
6480
6638
|
const indent = ctx.indent || (ctx.forceBlockIndent || containsDocumentMarker(value) ? ' ' : '');
|
|
6481
6639
|
const indentSize = indent ? '2' : '1'; // root is at -1
|
|
6482
6640
|
|
|
6483
|
-
const literal = type === PlainValueEc8e588e.Type.BLOCK_FOLDED ? false : type === PlainValueEc8e588e.Type.BLOCK_LITERAL ? true : !lineLengthOverLimit(value, strOptions.fold.lineWidth
|
|
6641
|
+
const literal = type === PlainValueEc8e588e.Type.BLOCK_FOLDED ? false : type === PlainValueEc8e588e.Type.BLOCK_LITERAL ? true : !lineLengthOverLimit(value, strOptions.fold.lineWidth, indent.length);
|
|
6484
6642
|
let header = literal ? '|' : '>';
|
|
6485
6643
|
if (!value) return header + '\n';
|
|
6486
6644
|
let wsStart = '';
|
|
@@ -6865,7 +7023,7 @@ function resolveByTagName(doc, node, tagName) {
|
|
|
6865
7023
|
if (tag.tag === tagName) {
|
|
6866
7024
|
if (tag.test) matchWithTest.push(tag);else {
|
|
6867
7025
|
const res = tag.resolve(doc, node);
|
|
6868
|
-
return res instanceof Collection
|
|
7026
|
+
return res instanceof Collection ? res : new Scalar(res);
|
|
6869
7027
|
}
|
|
6870
7028
|
}
|
|
6871
7029
|
}
|
|
@@ -7007,7 +7165,7 @@ function resolveNodeValue(doc, node) {
|
|
|
7007
7165
|
} // Lazy resolution for circular references
|
|
7008
7166
|
|
|
7009
7167
|
|
|
7010
|
-
const res = new Alias
|
|
7168
|
+
const res = new Alias(src);
|
|
7011
7169
|
|
|
7012
7170
|
anchors._cstAliases.push(res);
|
|
7013
7171
|
|
|
@@ -7102,14 +7260,14 @@ function resolveMap(doc, cst) {
|
|
|
7102
7260
|
const {
|
|
7103
7261
|
key: iKey
|
|
7104
7262
|
} = items[i];
|
|
7105
|
-
if (iKey instanceof Collection
|
|
7263
|
+
if (iKey instanceof Collection) hasCollectionKey = true;
|
|
7106
7264
|
|
|
7107
7265
|
if (doc.schema.merge && iKey && iKey.value === MERGE_KEY) {
|
|
7108
7266
|
items[i] = new Merge(items[i]);
|
|
7109
7267
|
const sources = items[i].value.items;
|
|
7110
7268
|
let error = null;
|
|
7111
7269
|
sources.some(node => {
|
|
7112
|
-
if (node instanceof Alias
|
|
7270
|
+
if (node instanceof Alias) {
|
|
7113
7271
|
// During parsing, alias sources are CST nodes; to account for
|
|
7114
7272
|
// circular references their resolved values can't be used here.
|
|
7115
7273
|
const {
|
|
@@ -7414,7 +7572,7 @@ function resolveSeq(doc, cst) {
|
|
|
7414
7572
|
seq.items = items;
|
|
7415
7573
|
resolveComments(seq, comments);
|
|
7416
7574
|
|
|
7417
|
-
if (!doc.options.mapAsMap && items.some(it => it instanceof Pair && it.key instanceof Collection
|
|
7575
|
+
if (!doc.options.mapAsMap && items.some(it => it instanceof Pair && it.key instanceof Collection)) {
|
|
7418
7576
|
const warn = 'Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this.';
|
|
7419
7577
|
doc.warnings.push(new PlainValueEc8e588e.YAMLWarning(cst, warn));
|
|
7420
7578
|
}
|
|
@@ -7573,10 +7731,10 @@ function resolveFlowSeqItems(doc, cst) {
|
|
|
7573
7731
|
};
|
|
7574
7732
|
}
|
|
7575
7733
|
|
|
7576
|
-
var Alias_1 = Alias
|
|
7577
|
-
var Collection_1 = Collection
|
|
7734
|
+
var Alias_1 = Alias;
|
|
7735
|
+
var Collection_1 = Collection;
|
|
7578
7736
|
var Merge_1 = Merge;
|
|
7579
|
-
var Node_1
|
|
7737
|
+
var Node_1 = Node;
|
|
7580
7738
|
var Pair_1 = Pair;
|
|
7581
7739
|
var Scalar_1 = Scalar;
|
|
7582
7740
|
var YAMLMap_1 = YAMLMap;
|
|
@@ -7596,11 +7754,11 @@ var strOptions_1 = strOptions;
|
|
|
7596
7754
|
var stringifyNumber_1 = stringifyNumber;
|
|
7597
7755
|
var stringifyString_1 = stringifyString;
|
|
7598
7756
|
var toJSON_1 = toJSON;
|
|
7599
|
-
var
|
|
7757
|
+
var resolveSeqD03cb037 = {
|
|
7600
7758
|
Alias: Alias_1,
|
|
7601
7759
|
Collection: Collection_1,
|
|
7602
7760
|
Merge: Merge_1,
|
|
7603
|
-
Node: Node_1
|
|
7761
|
+
Node: Node_1,
|
|
7604
7762
|
Pair: Pair_1,
|
|
7605
7763
|
Scalar: Scalar_1,
|
|
7606
7764
|
YAMLMap: YAMLMap_1,
|
|
@@ -7640,7 +7798,7 @@ const binary = {
|
|
|
7640
7798
|
* document.querySelector('#photo').src = URL.createObjectURL(blob)
|
|
7641
7799
|
*/
|
|
7642
7800
|
resolve: (doc, node) => {
|
|
7643
|
-
const src =
|
|
7801
|
+
const src = resolveSeqD03cb037.resolveString(doc, node);
|
|
7644
7802
|
|
|
7645
7803
|
if (typeof Buffer === 'function') {
|
|
7646
7804
|
return Buffer.from(src, 'base64');
|
|
@@ -7658,7 +7816,7 @@ const binary = {
|
|
|
7658
7816
|
return null;
|
|
7659
7817
|
}
|
|
7660
7818
|
},
|
|
7661
|
-
options:
|
|
7819
|
+
options: resolveSeqD03cb037.binaryOptions,
|
|
7662
7820
|
stringify: ({
|
|
7663
7821
|
comment,
|
|
7664
7822
|
type,
|
|
@@ -7678,14 +7836,14 @@ const binary = {
|
|
|
7678
7836
|
throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');
|
|
7679
7837
|
}
|
|
7680
7838
|
|
|
7681
|
-
if (!type) type =
|
|
7839
|
+
if (!type) type = resolveSeqD03cb037.binaryOptions.defaultType;
|
|
7682
7840
|
|
|
7683
7841
|
if (type === PlainValueEc8e588e.Type.QUOTE_DOUBLE) {
|
|
7684
7842
|
value = src;
|
|
7685
7843
|
} else {
|
|
7686
7844
|
const {
|
|
7687
7845
|
lineWidth
|
|
7688
|
-
} =
|
|
7846
|
+
} = resolveSeqD03cb037.binaryOptions;
|
|
7689
7847
|
const n = Math.ceil(src.length / lineWidth);
|
|
7690
7848
|
const lines = new Array(n);
|
|
7691
7849
|
|
|
@@ -7696,7 +7854,7 @@ const binary = {
|
|
|
7696
7854
|
value = lines.join(type === PlainValueEc8e588e.Type.BLOCK_LITERAL ? '\n' : ' ');
|
|
7697
7855
|
}
|
|
7698
7856
|
|
|
7699
|
-
return
|
|
7857
|
+
return resolveSeqD03cb037.stringifyString({
|
|
7700
7858
|
comment,
|
|
7701
7859
|
type,
|
|
7702
7860
|
value
|
|
@@ -7705,29 +7863,29 @@ const binary = {
|
|
|
7705
7863
|
};
|
|
7706
7864
|
|
|
7707
7865
|
function parsePairs(doc, cst) {
|
|
7708
|
-
const seq =
|
|
7866
|
+
const seq = resolveSeqD03cb037.resolveSeq(doc, cst);
|
|
7709
7867
|
|
|
7710
7868
|
for (let i = 0; i < seq.items.length; ++i) {
|
|
7711
7869
|
let item = seq.items[i];
|
|
7712
|
-
if (item instanceof
|
|
7870
|
+
if (item instanceof resolveSeqD03cb037.Pair) continue;else if (item instanceof resolveSeqD03cb037.YAMLMap) {
|
|
7713
7871
|
if (item.items.length > 1) {
|
|
7714
7872
|
const msg = 'Each pair must have its own sequence indicator';
|
|
7715
7873
|
throw new PlainValueEc8e588e.YAMLSemanticError(cst, msg);
|
|
7716
7874
|
}
|
|
7717
7875
|
|
|
7718
|
-
const pair = item.items[0] || new
|
|
7876
|
+
const pair = item.items[0] || new resolveSeqD03cb037.Pair();
|
|
7719
7877
|
if (item.commentBefore) pair.commentBefore = pair.commentBefore ? `${item.commentBefore}\n${pair.commentBefore}` : item.commentBefore;
|
|
7720
7878
|
if (item.comment) pair.comment = pair.comment ? `${item.comment}\n${pair.comment}` : item.comment;
|
|
7721
7879
|
item = pair;
|
|
7722
7880
|
}
|
|
7723
|
-
seq.items[i] = item instanceof
|
|
7881
|
+
seq.items[i] = item instanceof resolveSeqD03cb037.Pair ? item : new resolveSeqD03cb037.Pair(item);
|
|
7724
7882
|
}
|
|
7725
7883
|
|
|
7726
7884
|
return seq;
|
|
7727
7885
|
}
|
|
7728
7886
|
|
|
7729
7887
|
function createPairs(schema, iterable, ctx) {
|
|
7730
|
-
const pairs = new
|
|
7888
|
+
const pairs = new resolveSeqD03cb037.YAMLSeq(schema);
|
|
7731
7889
|
pairs.tag = 'tag:yaml.org,2002:pairs';
|
|
7732
7890
|
|
|
7733
7891
|
for (const it of iterable) {
|
|
@@ -7763,19 +7921,19 @@ const pairs = {
|
|
|
7763
7921
|
createNode: createPairs
|
|
7764
7922
|
};
|
|
7765
7923
|
|
|
7766
|
-
class YAMLOMap extends
|
|
7924
|
+
class YAMLOMap extends resolveSeqD03cb037.YAMLSeq {
|
|
7767
7925
|
constructor() {
|
|
7768
7926
|
super();
|
|
7769
7927
|
|
|
7770
|
-
PlainValueEc8e588e._defineProperty(this, "add",
|
|
7928
|
+
PlainValueEc8e588e._defineProperty(this, "add", resolveSeqD03cb037.YAMLMap.prototype.add.bind(this));
|
|
7771
7929
|
|
|
7772
|
-
PlainValueEc8e588e._defineProperty(this, "delete",
|
|
7930
|
+
PlainValueEc8e588e._defineProperty(this, "delete", resolveSeqD03cb037.YAMLMap.prototype.delete.bind(this));
|
|
7773
7931
|
|
|
7774
|
-
PlainValueEc8e588e._defineProperty(this, "get",
|
|
7932
|
+
PlainValueEc8e588e._defineProperty(this, "get", resolveSeqD03cb037.YAMLMap.prototype.get.bind(this));
|
|
7775
7933
|
|
|
7776
|
-
PlainValueEc8e588e._defineProperty(this, "has",
|
|
7934
|
+
PlainValueEc8e588e._defineProperty(this, "has", resolveSeqD03cb037.YAMLMap.prototype.has.bind(this));
|
|
7777
7935
|
|
|
7778
|
-
PlainValueEc8e588e._defineProperty(this, "set",
|
|
7936
|
+
PlainValueEc8e588e._defineProperty(this, "set", resolveSeqD03cb037.YAMLMap.prototype.set.bind(this));
|
|
7779
7937
|
|
|
7780
7938
|
this.tag = YAMLOMap.tag;
|
|
7781
7939
|
}
|
|
@@ -7787,11 +7945,11 @@ class YAMLOMap extends resolveSeq4a68b39b.YAMLSeq {
|
|
|
7787
7945
|
for (const pair of this.items) {
|
|
7788
7946
|
let key, value;
|
|
7789
7947
|
|
|
7790
|
-
if (pair instanceof
|
|
7791
|
-
key =
|
|
7792
|
-
value =
|
|
7948
|
+
if (pair instanceof resolveSeqD03cb037.Pair) {
|
|
7949
|
+
key = resolveSeqD03cb037.toJSON(pair.key, '', ctx);
|
|
7950
|
+
value = resolveSeqD03cb037.toJSON(pair.value, key, ctx);
|
|
7793
7951
|
} else {
|
|
7794
|
-
key =
|
|
7952
|
+
key = resolveSeqD03cb037.toJSON(pair, '', ctx);
|
|
7795
7953
|
}
|
|
7796
7954
|
|
|
7797
7955
|
if (map.has(key)) throw new Error('Ordered maps must not include duplicate keys');
|
|
@@ -7812,7 +7970,7 @@ function parseOMap(doc, cst) {
|
|
|
7812
7970
|
for (const {
|
|
7813
7971
|
key
|
|
7814
7972
|
} of pairs.items) {
|
|
7815
|
-
if (key instanceof
|
|
7973
|
+
if (key instanceof resolveSeqD03cb037.Scalar) {
|
|
7816
7974
|
if (seenKeys.includes(key.value)) {
|
|
7817
7975
|
const msg = 'Ordered maps must not include duplicate keys';
|
|
7818
7976
|
throw new PlainValueEc8e588e.YAMLSemanticError(cst, msg);
|
|
@@ -7841,31 +7999,31 @@ const omap = {
|
|
|
7841
7999
|
createNode: createOMap
|
|
7842
8000
|
};
|
|
7843
8001
|
|
|
7844
|
-
class YAMLSet extends
|
|
8002
|
+
class YAMLSet extends resolveSeqD03cb037.YAMLMap {
|
|
7845
8003
|
constructor() {
|
|
7846
8004
|
super();
|
|
7847
8005
|
this.tag = YAMLSet.tag;
|
|
7848
8006
|
}
|
|
7849
8007
|
|
|
7850
8008
|
add(key) {
|
|
7851
|
-
const pair = key instanceof
|
|
7852
|
-
const prev =
|
|
8009
|
+
const pair = key instanceof resolveSeqD03cb037.Pair ? key : new resolveSeqD03cb037.Pair(key);
|
|
8010
|
+
const prev = resolveSeqD03cb037.findPair(this.items, pair.key);
|
|
7853
8011
|
if (!prev) this.items.push(pair);
|
|
7854
8012
|
}
|
|
7855
8013
|
|
|
7856
8014
|
get(key, keepPair) {
|
|
7857
|
-
const pair =
|
|
7858
|
-
return !keepPair && pair instanceof
|
|
8015
|
+
const pair = resolveSeqD03cb037.findPair(this.items, key);
|
|
8016
|
+
return !keepPair && pair instanceof resolveSeqD03cb037.Pair ? pair.key instanceof resolveSeqD03cb037.Scalar ? pair.key.value : pair.key : pair;
|
|
7859
8017
|
}
|
|
7860
8018
|
|
|
7861
8019
|
set(key, value) {
|
|
7862
8020
|
if (typeof value !== 'boolean') throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof value}`);
|
|
7863
|
-
const prev =
|
|
8021
|
+
const prev = resolveSeqD03cb037.findPair(this.items, key);
|
|
7864
8022
|
|
|
7865
8023
|
if (prev && !value) {
|
|
7866
8024
|
this.items.splice(this.items.indexOf(prev), 1);
|
|
7867
8025
|
} else if (!prev && value) {
|
|
7868
|
-
this.items.push(new
|
|
8026
|
+
this.items.push(new resolveSeqD03cb037.Pair(key));
|
|
7869
8027
|
}
|
|
7870
8028
|
}
|
|
7871
8029
|
|
|
@@ -7883,7 +8041,7 @@ class YAMLSet extends resolveSeq4a68b39b.YAMLMap {
|
|
|
7883
8041
|
PlainValueEc8e588e._defineProperty(YAMLSet, "tag", 'tag:yaml.org,2002:set');
|
|
7884
8042
|
|
|
7885
8043
|
function parseSet(doc, cst) {
|
|
7886
|
-
const map =
|
|
8044
|
+
const map = resolveSeqD03cb037.resolveMap(doc, cst);
|
|
7887
8045
|
if (!map.hasAllNullValues()) throw new PlainValueEc8e588e.YAMLSemanticError(cst, 'Set items must all have null values');
|
|
7888
8046
|
return Object.assign(new YAMLSet(), map);
|
|
7889
8047
|
}
|
|
@@ -7914,7 +8072,7 @@ const parseSexagesimal = (sign, parts) => {
|
|
|
7914
8072
|
const stringifySexagesimal = ({
|
|
7915
8073
|
value
|
|
7916
8074
|
}) => {
|
|
7917
|
-
if (isNaN(value) || !isFinite(value)) return
|
|
8075
|
+
if (isNaN(value) || !isFinite(value)) return resolveSeqD03cb037.stringifyNumber(value);
|
|
7918
8076
|
let sign = '';
|
|
7919
8077
|
|
|
7920
8078
|
if (value < 0) {
|
|
@@ -8040,7 +8198,7 @@ var timestamp_1 = timestamp;
|
|
|
8040
8198
|
var warn_1 = warn;
|
|
8041
8199
|
var warnFileDeprecation_1 = warnFileDeprecation;
|
|
8042
8200
|
var warnOptionDeprecation_1 = warnOptionDeprecation;
|
|
8043
|
-
var
|
|
8201
|
+
var warnings1000a372 = {
|
|
8044
8202
|
binary: binary_1,
|
|
8045
8203
|
floatTime: floatTime_1,
|
|
8046
8204
|
intTime: intTime_1,
|
|
@@ -8054,7 +8212,7 @@ var warnings39684f17 = {
|
|
|
8054
8212
|
};
|
|
8055
8213
|
|
|
8056
8214
|
function createMap(schema, obj, ctx) {
|
|
8057
|
-
const map = new
|
|
8215
|
+
const map = new resolveSeqD03cb037.YAMLMap(schema);
|
|
8058
8216
|
|
|
8059
8217
|
if (obj instanceof Map) {
|
|
8060
8218
|
for (const [key, value] of obj) map.items.push(schema.createPair(key, value, ctx));
|
|
@@ -8072,13 +8230,13 @@ function createMap(schema, obj, ctx) {
|
|
|
8072
8230
|
const map = {
|
|
8073
8231
|
createNode: createMap,
|
|
8074
8232
|
default: true,
|
|
8075
|
-
nodeClass:
|
|
8233
|
+
nodeClass: resolveSeqD03cb037.YAMLMap,
|
|
8076
8234
|
tag: 'tag:yaml.org,2002:map',
|
|
8077
|
-
resolve:
|
|
8235
|
+
resolve: resolveSeqD03cb037.resolveMap
|
|
8078
8236
|
};
|
|
8079
8237
|
|
|
8080
8238
|
function createSeq(schema, obj, ctx) {
|
|
8081
|
-
const seq = new
|
|
8239
|
+
const seq = new resolveSeqD03cb037.YAMLSeq(schema);
|
|
8082
8240
|
|
|
8083
8241
|
if (obj && obj[Symbol.iterator]) {
|
|
8084
8242
|
for (const it of obj) {
|
|
@@ -8093,49 +8251,49 @@ function createSeq(schema, obj, ctx) {
|
|
|
8093
8251
|
const seq = {
|
|
8094
8252
|
createNode: createSeq,
|
|
8095
8253
|
default: true,
|
|
8096
|
-
nodeClass:
|
|
8254
|
+
nodeClass: resolveSeqD03cb037.YAMLSeq,
|
|
8097
8255
|
tag: 'tag:yaml.org,2002:seq',
|
|
8098
|
-
resolve:
|
|
8256
|
+
resolve: resolveSeqD03cb037.resolveSeq
|
|
8099
8257
|
};
|
|
8100
8258
|
const string = {
|
|
8101
8259
|
identify: value => typeof value === 'string',
|
|
8102
8260
|
default: true,
|
|
8103
8261
|
tag: 'tag:yaml.org,2002:str',
|
|
8104
|
-
resolve:
|
|
8262
|
+
resolve: resolveSeqD03cb037.resolveString,
|
|
8105
8263
|
|
|
8106
8264
|
stringify(item, ctx, onComment, onChompKeep) {
|
|
8107
8265
|
ctx = Object.assign({
|
|
8108
8266
|
actualString: true
|
|
8109
8267
|
}, ctx);
|
|
8110
|
-
return
|
|
8268
|
+
return resolveSeqD03cb037.stringifyString(item, ctx, onComment, onChompKeep);
|
|
8111
8269
|
},
|
|
8112
8270
|
|
|
8113
|
-
options:
|
|
8271
|
+
options: resolveSeqD03cb037.strOptions
|
|
8114
8272
|
};
|
|
8115
8273
|
const failsafe = [map, seq, string];
|
|
8116
8274
|
/* global BigInt */
|
|
8117
8275
|
|
|
8118
|
-
const intIdentify = value => typeof value === 'bigint' || Number.isInteger(value);
|
|
8276
|
+
const intIdentify$2 = value => typeof value === 'bigint' || Number.isInteger(value);
|
|
8119
8277
|
|
|
8120
|
-
const intResolve = (src, part, radix) =>
|
|
8278
|
+
const intResolve$1 = (src, part, radix) => resolveSeqD03cb037.intOptions.asBigInt ? BigInt(src) : parseInt(part, radix);
|
|
8121
8279
|
|
|
8122
|
-
function intStringify(node, radix, prefix) {
|
|
8280
|
+
function intStringify$1(node, radix, prefix) {
|
|
8123
8281
|
const {
|
|
8124
8282
|
value
|
|
8125
8283
|
} = node;
|
|
8126
|
-
if (intIdentify(value) && value >= 0) return prefix + value.toString(radix);
|
|
8127
|
-
return
|
|
8284
|
+
if (intIdentify$2(value) && value >= 0) return prefix + value.toString(radix);
|
|
8285
|
+
return resolveSeqD03cb037.stringifyNumber(node);
|
|
8128
8286
|
}
|
|
8129
8287
|
|
|
8130
8288
|
const nullObj = {
|
|
8131
8289
|
identify: value => value == null,
|
|
8132
|
-
createNode: (schema, value, ctx) => ctx.wrapScalars ? new
|
|
8290
|
+
createNode: (schema, value, ctx) => ctx.wrapScalars ? new resolveSeqD03cb037.Scalar(null) : null,
|
|
8133
8291
|
default: true,
|
|
8134
8292
|
tag: 'tag:yaml.org,2002:null',
|
|
8135
8293
|
test: /^(?:~|[Nn]ull|NULL)?$/,
|
|
8136
8294
|
resolve: () => null,
|
|
8137
|
-
options:
|
|
8138
|
-
stringify: () =>
|
|
8295
|
+
options: resolveSeqD03cb037.nullOptions,
|
|
8296
|
+
stringify: () => resolveSeqD03cb037.nullOptions.nullStr
|
|
8139
8297
|
};
|
|
8140
8298
|
const boolObj = {
|
|
8141
8299
|
identify: value => typeof value === 'boolean',
|
|
@@ -8143,39 +8301,39 @@ const boolObj = {
|
|
|
8143
8301
|
tag: 'tag:yaml.org,2002:bool',
|
|
8144
8302
|
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
|
8145
8303
|
resolve: str => str[0] === 't' || str[0] === 'T',
|
|
8146
|
-
options:
|
|
8304
|
+
options: resolveSeqD03cb037.boolOptions,
|
|
8147
8305
|
stringify: ({
|
|
8148
8306
|
value
|
|
8149
|
-
}) => value ?
|
|
8307
|
+
}) => value ? resolveSeqD03cb037.boolOptions.trueStr : resolveSeqD03cb037.boolOptions.falseStr
|
|
8150
8308
|
};
|
|
8151
8309
|
const octObj = {
|
|
8152
|
-
identify: value => intIdentify(value) && value >= 0,
|
|
8310
|
+
identify: value => intIdentify$2(value) && value >= 0,
|
|
8153
8311
|
default: true,
|
|
8154
8312
|
tag: 'tag:yaml.org,2002:int',
|
|
8155
8313
|
format: 'OCT',
|
|
8156
8314
|
test: /^0o([0-7]+)$/,
|
|
8157
|
-
resolve: (str, oct) => intResolve(str, oct, 8),
|
|
8158
|
-
options:
|
|
8159
|
-
stringify: node => intStringify(node, 8, '0o')
|
|
8315
|
+
resolve: (str, oct) => intResolve$1(str, oct, 8),
|
|
8316
|
+
options: resolveSeqD03cb037.intOptions,
|
|
8317
|
+
stringify: node => intStringify$1(node, 8, '0o')
|
|
8160
8318
|
};
|
|
8161
8319
|
const intObj = {
|
|
8162
|
-
identify: intIdentify,
|
|
8320
|
+
identify: intIdentify$2,
|
|
8163
8321
|
default: true,
|
|
8164
8322
|
tag: 'tag:yaml.org,2002:int',
|
|
8165
8323
|
test: /^[-+]?[0-9]+$/,
|
|
8166
|
-
resolve: str => intResolve(str, str, 10),
|
|
8167
|
-
options:
|
|
8168
|
-
stringify:
|
|
8324
|
+
resolve: str => intResolve$1(str, str, 10),
|
|
8325
|
+
options: resolveSeqD03cb037.intOptions,
|
|
8326
|
+
stringify: resolveSeqD03cb037.stringifyNumber
|
|
8169
8327
|
};
|
|
8170
8328
|
const hexObj = {
|
|
8171
|
-
identify: value => intIdentify(value) && value >= 0,
|
|
8329
|
+
identify: value => intIdentify$2(value) && value >= 0,
|
|
8172
8330
|
default: true,
|
|
8173
8331
|
tag: 'tag:yaml.org,2002:int',
|
|
8174
8332
|
format: 'HEX',
|
|
8175
8333
|
test: /^0x([0-9a-fA-F]+)$/,
|
|
8176
|
-
resolve: (str, hex) => intResolve(str, hex, 16),
|
|
8177
|
-
options:
|
|
8178
|
-
stringify: node => intStringify(node, 16, '0x')
|
|
8334
|
+
resolve: (str, hex) => intResolve$1(str, hex, 16),
|
|
8335
|
+
options: resolveSeqD03cb037.intOptions,
|
|
8336
|
+
stringify: node => intStringify$1(node, 16, '0x')
|
|
8179
8337
|
};
|
|
8180
8338
|
const nanObj = {
|
|
8181
8339
|
identify: value => typeof value === 'number',
|
|
@@ -8183,7 +8341,7 @@ const nanObj = {
|
|
|
8183
8341
|
tag: 'tag:yaml.org,2002:float',
|
|
8184
8342
|
test: /^(?:[-+]?\.inf|(\.nan))$/i,
|
|
8185
8343
|
resolve: (str, nan) => nan ? NaN : str[0] === '-' ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
8186
|
-
stringify:
|
|
8344
|
+
stringify: resolveSeqD03cb037.stringifyNumber
|
|
8187
8345
|
};
|
|
8188
8346
|
const expObj = {
|
|
8189
8347
|
identify: value => typeof value === 'number',
|
|
@@ -8204,12 +8362,12 @@ const floatObj = {
|
|
|
8204
8362
|
|
|
8205
8363
|
resolve(str, frac1, frac2) {
|
|
8206
8364
|
const frac = frac1 || frac2;
|
|
8207
|
-
const node = new
|
|
8365
|
+
const node = new resolveSeqD03cb037.Scalar(parseFloat(str));
|
|
8208
8366
|
if (frac && frac[frac.length - 1] === '0') node.minFractionDigits = frac.length;
|
|
8209
8367
|
return node;
|
|
8210
8368
|
},
|
|
8211
8369
|
|
|
8212
|
-
stringify:
|
|
8370
|
+
stringify: resolveSeqD03cb037.stringifyNumber
|
|
8213
8371
|
};
|
|
8214
8372
|
const core = failsafe.concat([nullObj, boolObj, octObj, intObj, hexObj, nanObj, expObj, floatObj]);
|
|
8215
8373
|
/* global BigInt */
|
|
@@ -8224,11 +8382,11 @@ const json = [map, seq, {
|
|
|
8224
8382
|
identify: value => typeof value === 'string',
|
|
8225
8383
|
default: true,
|
|
8226
8384
|
tag: 'tag:yaml.org,2002:str',
|
|
8227
|
-
resolve:
|
|
8385
|
+
resolve: resolveSeqD03cb037.resolveString,
|
|
8228
8386
|
stringify: stringifyJSON
|
|
8229
8387
|
}, {
|
|
8230
8388
|
identify: value => value == null,
|
|
8231
|
-
createNode: (schema, value, ctx) => ctx.wrapScalars ? new
|
|
8389
|
+
createNode: (schema, value, ctx) => ctx.wrapScalars ? new resolveSeqD03cb037.Scalar(null) : null,
|
|
8232
8390
|
default: true,
|
|
8233
8391
|
tag: 'tag:yaml.org,2002:null',
|
|
8234
8392
|
test: /^null$/,
|
|
@@ -8246,7 +8404,7 @@ const json = [map, seq, {
|
|
|
8246
8404
|
default: true,
|
|
8247
8405
|
tag: 'tag:yaml.org,2002:int',
|
|
8248
8406
|
test: /^-?(?:0|[1-9][0-9]*)$/,
|
|
8249
|
-
resolve: str =>
|
|
8407
|
+
resolve: str => resolveSeqD03cb037.intOptions.asBigInt ? BigInt(str) : parseInt(str, 10),
|
|
8250
8408
|
stringify: ({
|
|
8251
8409
|
value
|
|
8252
8410
|
}) => intIdentify$1(value) ? value.toString() : JSON.stringify(value)
|
|
@@ -8267,14 +8425,14 @@ json.scalarFallback = str => {
|
|
|
8267
8425
|
|
|
8268
8426
|
const boolStringify = ({
|
|
8269
8427
|
value
|
|
8270
|
-
}) => value ?
|
|
8428
|
+
}) => value ? resolveSeqD03cb037.boolOptions.trueStr : resolveSeqD03cb037.boolOptions.falseStr;
|
|
8271
8429
|
|
|
8272
|
-
const intIdentify
|
|
8430
|
+
const intIdentify = value => typeof value === 'bigint' || Number.isInteger(value);
|
|
8273
8431
|
|
|
8274
|
-
function intResolve
|
|
8432
|
+
function intResolve(sign, src, radix) {
|
|
8275
8433
|
let str = src.replace(/_/g, '');
|
|
8276
8434
|
|
|
8277
|
-
if (
|
|
8435
|
+
if (resolveSeqD03cb037.intOptions.asBigInt) {
|
|
8278
8436
|
switch (radix) {
|
|
8279
8437
|
case 2:
|
|
8280
8438
|
str = `0b${str}`;
|
|
@@ -8297,35 +8455,35 @@ function intResolve$1(sign, src, radix) {
|
|
|
8297
8455
|
return sign === '-' ? -1 * n : n;
|
|
8298
8456
|
}
|
|
8299
8457
|
|
|
8300
|
-
function intStringify
|
|
8458
|
+
function intStringify(node, radix, prefix) {
|
|
8301
8459
|
const {
|
|
8302
8460
|
value
|
|
8303
8461
|
} = node;
|
|
8304
8462
|
|
|
8305
|
-
if (intIdentify
|
|
8463
|
+
if (intIdentify(value)) {
|
|
8306
8464
|
const str = value.toString(radix);
|
|
8307
8465
|
return value < 0 ? '-' + prefix + str.substr(1) : prefix + str;
|
|
8308
8466
|
}
|
|
8309
8467
|
|
|
8310
|
-
return
|
|
8468
|
+
return resolveSeqD03cb037.stringifyNumber(node);
|
|
8311
8469
|
}
|
|
8312
8470
|
|
|
8313
8471
|
const yaml11 = failsafe.concat([{
|
|
8314
8472
|
identify: value => value == null,
|
|
8315
|
-
createNode: (schema, value, ctx) => ctx.wrapScalars ? new
|
|
8473
|
+
createNode: (schema, value, ctx) => ctx.wrapScalars ? new resolveSeqD03cb037.Scalar(null) : null,
|
|
8316
8474
|
default: true,
|
|
8317
8475
|
tag: 'tag:yaml.org,2002:null',
|
|
8318
8476
|
test: /^(?:~|[Nn]ull|NULL)?$/,
|
|
8319
8477
|
resolve: () => null,
|
|
8320
|
-
options:
|
|
8321
|
-
stringify: () =>
|
|
8478
|
+
options: resolveSeqD03cb037.nullOptions,
|
|
8479
|
+
stringify: () => resolveSeqD03cb037.nullOptions.nullStr
|
|
8322
8480
|
}, {
|
|
8323
8481
|
identify: value => typeof value === 'boolean',
|
|
8324
8482
|
default: true,
|
|
8325
8483
|
tag: 'tag:yaml.org,2002:bool',
|
|
8326
8484
|
test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
|
|
8327
8485
|
resolve: () => true,
|
|
8328
|
-
options:
|
|
8486
|
+
options: resolveSeqD03cb037.boolOptions,
|
|
8329
8487
|
stringify: boolStringify
|
|
8330
8488
|
}, {
|
|
8331
8489
|
identify: value => typeof value === 'boolean',
|
|
@@ -8333,46 +8491,46 @@ const yaml11 = failsafe.concat([{
|
|
|
8333
8491
|
tag: 'tag:yaml.org,2002:bool',
|
|
8334
8492
|
test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i,
|
|
8335
8493
|
resolve: () => false,
|
|
8336
|
-
options:
|
|
8494
|
+
options: resolveSeqD03cb037.boolOptions,
|
|
8337
8495
|
stringify: boolStringify
|
|
8338
8496
|
}, {
|
|
8339
|
-
identify: intIdentify
|
|
8497
|
+
identify: intIdentify,
|
|
8340
8498
|
default: true,
|
|
8341
8499
|
tag: 'tag:yaml.org,2002:int',
|
|
8342
8500
|
format: 'BIN',
|
|
8343
8501
|
test: /^([-+]?)0b([0-1_]+)$/,
|
|
8344
|
-
resolve: (str, sign, bin) => intResolve
|
|
8345
|
-
stringify: node => intStringify
|
|
8502
|
+
resolve: (str, sign, bin) => intResolve(sign, bin, 2),
|
|
8503
|
+
stringify: node => intStringify(node, 2, '0b')
|
|
8346
8504
|
}, {
|
|
8347
|
-
identify: intIdentify
|
|
8505
|
+
identify: intIdentify,
|
|
8348
8506
|
default: true,
|
|
8349
8507
|
tag: 'tag:yaml.org,2002:int',
|
|
8350
8508
|
format: 'OCT',
|
|
8351
8509
|
test: /^([-+]?)0([0-7_]+)$/,
|
|
8352
|
-
resolve: (str, sign, oct) => intResolve
|
|
8353
|
-
stringify: node => intStringify
|
|
8510
|
+
resolve: (str, sign, oct) => intResolve(sign, oct, 8),
|
|
8511
|
+
stringify: node => intStringify(node, 8, '0')
|
|
8354
8512
|
}, {
|
|
8355
|
-
identify: intIdentify
|
|
8513
|
+
identify: intIdentify,
|
|
8356
8514
|
default: true,
|
|
8357
8515
|
tag: 'tag:yaml.org,2002:int',
|
|
8358
8516
|
test: /^([-+]?)([0-9][0-9_]*)$/,
|
|
8359
|
-
resolve: (str, sign, abs) => intResolve
|
|
8360
|
-
stringify:
|
|
8517
|
+
resolve: (str, sign, abs) => intResolve(sign, abs, 10),
|
|
8518
|
+
stringify: resolveSeqD03cb037.stringifyNumber
|
|
8361
8519
|
}, {
|
|
8362
|
-
identify: intIdentify
|
|
8520
|
+
identify: intIdentify,
|
|
8363
8521
|
default: true,
|
|
8364
8522
|
tag: 'tag:yaml.org,2002:int',
|
|
8365
8523
|
format: 'HEX',
|
|
8366
8524
|
test: /^([-+]?)0x([0-9a-fA-F_]+)$/,
|
|
8367
|
-
resolve: (str, sign, hex) => intResolve
|
|
8368
|
-
stringify: node => intStringify
|
|
8525
|
+
resolve: (str, sign, hex) => intResolve(sign, hex, 16),
|
|
8526
|
+
stringify: node => intStringify(node, 16, '0x')
|
|
8369
8527
|
}, {
|
|
8370
8528
|
identify: value => typeof value === 'number',
|
|
8371
8529
|
default: true,
|
|
8372
8530
|
tag: 'tag:yaml.org,2002:float',
|
|
8373
8531
|
test: /^(?:[-+]?\.inf|(\.nan))$/i,
|
|
8374
8532
|
resolve: (str, nan) => nan ? NaN : str[0] === '-' ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
8375
|
-
stringify:
|
|
8533
|
+
stringify: resolveSeqD03cb037.stringifyNumber
|
|
8376
8534
|
}, {
|
|
8377
8535
|
identify: value => typeof value === 'number',
|
|
8378
8536
|
default: true,
|
|
@@ -8390,7 +8548,7 @@ const yaml11 = failsafe.concat([{
|
|
|
8390
8548
|
test: /^[-+]?(?:[0-9][0-9_]*)?\.([0-9_]*)$/,
|
|
8391
8549
|
|
|
8392
8550
|
resolve(str, frac) {
|
|
8393
|
-
const node = new
|
|
8551
|
+
const node = new resolveSeqD03cb037.Scalar(parseFloat(str.replace(/_/g, '')));
|
|
8394
8552
|
|
|
8395
8553
|
if (frac) {
|
|
8396
8554
|
const f = frac.replace(/_/g, '');
|
|
@@ -8400,8 +8558,8 @@ const yaml11 = failsafe.concat([{
|
|
|
8400
8558
|
return node;
|
|
8401
8559
|
},
|
|
8402
8560
|
|
|
8403
|
-
stringify:
|
|
8404
|
-
}],
|
|
8561
|
+
stringify: resolveSeqD03cb037.stringifyNumber
|
|
8562
|
+
}], warnings1000a372.binary, warnings1000a372.omap, warnings1000a372.pairs, warnings1000a372.set, warnings1000a372.intTime, warnings1000a372.floatTime, warnings1000a372.timestamp);
|
|
8405
8563
|
const schemas = {
|
|
8406
8564
|
core,
|
|
8407
8565
|
failsafe,
|
|
@@ -8409,23 +8567,23 @@ const schemas = {
|
|
|
8409
8567
|
yaml11
|
|
8410
8568
|
};
|
|
8411
8569
|
const tags = {
|
|
8412
|
-
binary:
|
|
8570
|
+
binary: warnings1000a372.binary,
|
|
8413
8571
|
bool: boolObj,
|
|
8414
8572
|
float: floatObj,
|
|
8415
8573
|
floatExp: expObj,
|
|
8416
8574
|
floatNaN: nanObj,
|
|
8417
|
-
floatTime:
|
|
8575
|
+
floatTime: warnings1000a372.floatTime,
|
|
8418
8576
|
int: intObj,
|
|
8419
8577
|
intHex: hexObj,
|
|
8420
8578
|
intOct: octObj,
|
|
8421
|
-
intTime:
|
|
8579
|
+
intTime: warnings1000a372.intTime,
|
|
8422
8580
|
map,
|
|
8423
8581
|
null: nullObj,
|
|
8424
|
-
omap:
|
|
8425
|
-
pairs:
|
|
8582
|
+
omap: warnings1000a372.omap,
|
|
8583
|
+
pairs: warnings1000a372.pairs,
|
|
8426
8584
|
seq,
|
|
8427
|
-
set:
|
|
8428
|
-
timestamp:
|
|
8585
|
+
set: warnings1000a372.set,
|
|
8586
|
+
timestamp: warnings1000a372.timestamp
|
|
8429
8587
|
};
|
|
8430
8588
|
|
|
8431
8589
|
function findTagObject(value, tagName, tags) {
|
|
@@ -8440,8 +8598,8 @@ function findTagObject(value, tagName, tags) {
|
|
|
8440
8598
|
return tags.find(t => (t.identify && t.identify(value) || t.class && value instanceof t.class) && !t.format);
|
|
8441
8599
|
}
|
|
8442
8600
|
|
|
8443
|
-
function createNode(value, tagName, ctx) {
|
|
8444
|
-
if (value instanceof
|
|
8601
|
+
function createNode$1(value, tagName, ctx) {
|
|
8602
|
+
if (value instanceof resolveSeqD03cb037.Node) return value;
|
|
8445
8603
|
const {
|
|
8446
8604
|
defaultPrefix,
|
|
8447
8605
|
onTagObj,
|
|
@@ -8454,7 +8612,7 @@ function createNode(value, tagName, ctx) {
|
|
|
8454
8612
|
|
|
8455
8613
|
if (!tagObj) {
|
|
8456
8614
|
if (typeof value.toJSON === 'function') value = value.toJSON();
|
|
8457
|
-
if (typeof value !== 'object') return wrapScalars ? new
|
|
8615
|
+
if (!value || typeof value !== 'object') return wrapScalars ? new resolveSeqD03cb037.Scalar(value) : value;
|
|
8458
8616
|
tagObj = value instanceof Map ? map : value[Symbol.iterator] ? seq : map;
|
|
8459
8617
|
}
|
|
8460
8618
|
|
|
@@ -8465,13 +8623,16 @@ function createNode(value, tagName, ctx) {
|
|
|
8465
8623
|
// after first. The `obj` wrapper allows for circular references to resolve.
|
|
8466
8624
|
|
|
8467
8625
|
|
|
8468
|
-
const obj = {
|
|
8626
|
+
const obj = {
|
|
8627
|
+
value: undefined,
|
|
8628
|
+
node: undefined
|
|
8629
|
+
};
|
|
8469
8630
|
|
|
8470
8631
|
if (value && typeof value === 'object' && prevObjects) {
|
|
8471
8632
|
const prev = prevObjects.get(value);
|
|
8472
8633
|
|
|
8473
8634
|
if (prev) {
|
|
8474
|
-
const alias = new
|
|
8635
|
+
const alias = new resolveSeqD03cb037.Alias(prev); // leaves source dirty; must be cleaned by caller
|
|
8475
8636
|
|
|
8476
8637
|
ctx.aliasNodes.push(alias); // defined along with prevObjects
|
|
8477
8638
|
|
|
@@ -8482,8 +8643,8 @@ function createNode(value, tagName, ctx) {
|
|
|
8482
8643
|
prevObjects.set(value, obj);
|
|
8483
8644
|
}
|
|
8484
8645
|
|
|
8485
|
-
obj.node = tagObj.createNode ? tagObj.createNode(ctx.schema, value, ctx) : wrapScalars ? new
|
|
8486
|
-
if (tagName && obj.node instanceof
|
|
8646
|
+
obj.node = tagObj.createNode ? tagObj.createNode(ctx.schema, value, ctx) : wrapScalars ? new resolveSeqD03cb037.Scalar(value) : value;
|
|
8647
|
+
if (tagName && obj.node instanceof resolveSeqD03cb037.Node) obj.node.tag = tagName;
|
|
8487
8648
|
return obj.node;
|
|
8488
8649
|
}
|
|
8489
8650
|
|
|
@@ -8534,7 +8695,7 @@ class Schema {
|
|
|
8534
8695
|
this.merge = !!merge;
|
|
8535
8696
|
this.name = schema;
|
|
8536
8697
|
this.sortMapEntries = sortMapEntries === true ? sortMapEntriesByKey : sortMapEntries || null;
|
|
8537
|
-
if (!customTags && deprecatedCustomTags)
|
|
8698
|
+
if (!customTags && deprecatedCustomTags) warnings1000a372.warnOptionDeprecation('tags', 'customTags');
|
|
8538
8699
|
this.tags = getSchemaTags(schemas, tags, customTags || deprecatedCustomTags, schema);
|
|
8539
8700
|
}
|
|
8540
8701
|
|
|
@@ -8545,7 +8706,7 @@ class Schema {
|
|
|
8545
8706
|
wrapScalars
|
|
8546
8707
|
};
|
|
8547
8708
|
const createCtx = ctx ? Object.assign(ctx, baseCtx) : baseCtx;
|
|
8548
|
-
return createNode(value, tagName, createCtx);
|
|
8709
|
+
return createNode$1(value, tagName, createCtx);
|
|
8549
8710
|
}
|
|
8550
8711
|
|
|
8551
8712
|
createPair(key, value, ctx) {
|
|
@@ -8554,7 +8715,7 @@ class Schema {
|
|
|
8554
8715
|
};
|
|
8555
8716
|
const k = this.createNode(key, ctx.wrapScalars, null, ctx);
|
|
8556
8717
|
const v = this.createNode(value, ctx.wrapScalars, null, ctx);
|
|
8557
|
-
return new
|
|
8718
|
+
return new resolveSeqD03cb037.Pair(k, v);
|
|
8558
8719
|
}
|
|
8559
8720
|
|
|
8560
8721
|
}
|
|
@@ -8564,7 +8725,7 @@ PlainValueEc8e588e._defineProperty(Schema, "defaultPrefix", PlainValueEc8e588e.d
|
|
|
8564
8725
|
PlainValueEc8e588e._defineProperty(Schema, "defaultTags", PlainValueEc8e588e.defaultTags);
|
|
8565
8726
|
|
|
8566
8727
|
var Schema_1 = Schema;
|
|
8567
|
-
var
|
|
8728
|
+
var Schema88e323a7 = {
|
|
8568
8729
|
Schema: Schema_1
|
|
8569
8730
|
};
|
|
8570
8731
|
|
|
@@ -8585,43 +8746,43 @@ const defaultOptions = {
|
|
|
8585
8746
|
};
|
|
8586
8747
|
const scalarOptions = {
|
|
8587
8748
|
get binary() {
|
|
8588
|
-
return
|
|
8749
|
+
return resolveSeqD03cb037.binaryOptions;
|
|
8589
8750
|
},
|
|
8590
8751
|
|
|
8591
8752
|
set binary(opt) {
|
|
8592
|
-
Object.assign(
|
|
8753
|
+
Object.assign(resolveSeqD03cb037.binaryOptions, opt);
|
|
8593
8754
|
},
|
|
8594
8755
|
|
|
8595
8756
|
get bool() {
|
|
8596
|
-
return
|
|
8757
|
+
return resolveSeqD03cb037.boolOptions;
|
|
8597
8758
|
},
|
|
8598
8759
|
|
|
8599
8760
|
set bool(opt) {
|
|
8600
|
-
Object.assign(
|
|
8761
|
+
Object.assign(resolveSeqD03cb037.boolOptions, opt);
|
|
8601
8762
|
},
|
|
8602
8763
|
|
|
8603
8764
|
get int() {
|
|
8604
|
-
return
|
|
8765
|
+
return resolveSeqD03cb037.intOptions;
|
|
8605
8766
|
},
|
|
8606
8767
|
|
|
8607
8768
|
set int(opt) {
|
|
8608
|
-
Object.assign(
|
|
8769
|
+
Object.assign(resolveSeqD03cb037.intOptions, opt);
|
|
8609
8770
|
},
|
|
8610
8771
|
|
|
8611
8772
|
get null() {
|
|
8612
|
-
return
|
|
8773
|
+
return resolveSeqD03cb037.nullOptions;
|
|
8613
8774
|
},
|
|
8614
8775
|
|
|
8615
8776
|
set null(opt) {
|
|
8616
|
-
Object.assign(
|
|
8777
|
+
Object.assign(resolveSeqD03cb037.nullOptions, opt);
|
|
8617
8778
|
},
|
|
8618
8779
|
|
|
8619
8780
|
get str() {
|
|
8620
|
-
return
|
|
8781
|
+
return resolveSeqD03cb037.strOptions;
|
|
8621
8782
|
},
|
|
8622
8783
|
|
|
8623
8784
|
set str(opt) {
|
|
8624
|
-
Object.assign(
|
|
8785
|
+
Object.assign(resolveSeqD03cb037.strOptions, opt);
|
|
8625
8786
|
}
|
|
8626
8787
|
|
|
8627
8788
|
};
|
|
@@ -8637,7 +8798,7 @@ const documentOptions = {
|
|
|
8637
8798
|
prefix: 'tag:private.yaml.org,2002:'
|
|
8638
8799
|
}]
|
|
8639
8800
|
},
|
|
8640
|
-
|
|
8801
|
+
1.1: {
|
|
8641
8802
|
schema: 'yaml-1.1',
|
|
8642
8803
|
merge: true,
|
|
8643
8804
|
tagPrefixes: [{
|
|
@@ -8648,7 +8809,7 @@ const documentOptions = {
|
|
|
8648
8809
|
prefix: PlainValueEc8e588e.defaultTagPrefix
|
|
8649
8810
|
}]
|
|
8650
8811
|
},
|
|
8651
|
-
|
|
8812
|
+
1.2: {
|
|
8652
8813
|
schema: 'core',
|
|
8653
8814
|
merge: false,
|
|
8654
8815
|
tagPrefixes: [{
|
|
@@ -8689,7 +8850,7 @@ function stringifyTag(doc, tag) {
|
|
|
8689
8850
|
}
|
|
8690
8851
|
|
|
8691
8852
|
function getTagObject(tags, item) {
|
|
8692
|
-
if (item instanceof
|
|
8853
|
+
if (item instanceof resolveSeqD03cb037.Alias) return resolveSeqD03cb037.Alias;
|
|
8693
8854
|
|
|
8694
8855
|
if (item.tag) {
|
|
8695
8856
|
const match = tags.filter(t => t.tag === item.tag);
|
|
@@ -8698,7 +8859,7 @@ function getTagObject(tags, item) {
|
|
|
8698
8859
|
|
|
8699
8860
|
let tagObj, obj;
|
|
8700
8861
|
|
|
8701
|
-
if (item instanceof
|
|
8862
|
+
if (item instanceof resolveSeqD03cb037.Scalar) {
|
|
8702
8863
|
obj = item.value; // TODO: deprecate/remove class check
|
|
8703
8864
|
|
|
8704
8865
|
const match = tags.filter(t => t.identify && t.identify(obj) || t.class && obj instanceof t.class);
|
|
@@ -8738,14 +8899,14 @@ function stringifyProps(node, tagObj, {
|
|
|
8738
8899
|
return props.join(' ');
|
|
8739
8900
|
}
|
|
8740
8901
|
|
|
8741
|
-
function stringify(item, ctx, onComment, onChompKeep) {
|
|
8902
|
+
function stringify$1(item, ctx, onComment, onChompKeep) {
|
|
8742
8903
|
const {
|
|
8743
8904
|
anchors,
|
|
8744
8905
|
schema
|
|
8745
8906
|
} = ctx.doc;
|
|
8746
8907
|
let tagObj;
|
|
8747
8908
|
|
|
8748
|
-
if (!(item instanceof
|
|
8909
|
+
if (!(item instanceof resolveSeqD03cb037.Node)) {
|
|
8749
8910
|
const createCtx = {
|
|
8750
8911
|
aliasNodes: [],
|
|
8751
8912
|
onTagObj: o => tagObj = o,
|
|
@@ -8764,37 +8925,37 @@ function stringify(item, ctx, onComment, onChompKeep) {
|
|
|
8764
8925
|
}
|
|
8765
8926
|
}
|
|
8766
8927
|
|
|
8767
|
-
if (item instanceof
|
|
8928
|
+
if (item instanceof resolveSeqD03cb037.Pair) return item.toString(ctx, onComment, onChompKeep);
|
|
8768
8929
|
if (!tagObj) tagObj = getTagObject(schema.tags, item);
|
|
8769
8930
|
const props = stringifyProps(item, tagObj, ctx);
|
|
8770
8931
|
if (props.length > 0) ctx.indentAtStart = (ctx.indentAtStart || 0) + props.length + 1;
|
|
8771
|
-
const str = typeof tagObj.stringify === 'function' ? tagObj.stringify(item, ctx, onComment, onChompKeep) : item instanceof
|
|
8932
|
+
const str = typeof tagObj.stringify === 'function' ? tagObj.stringify(item, ctx, onComment, onChompKeep) : item instanceof resolveSeqD03cb037.Scalar ? resolveSeqD03cb037.stringifyString(item, ctx, onComment, onChompKeep) : item.toString(ctx, onComment, onChompKeep);
|
|
8772
8933
|
if (!props) return str;
|
|
8773
|
-
return item instanceof
|
|
8934
|
+
return item instanceof resolveSeqD03cb037.Scalar || str[0] === '{' || str[0] === '[' ? `${props} ${str}` : `${props}\n${ctx.indent}${str}`;
|
|
8774
8935
|
}
|
|
8775
8936
|
|
|
8776
8937
|
class Anchors {
|
|
8777
8938
|
static validAnchorNode(node) {
|
|
8778
|
-
return node instanceof
|
|
8939
|
+
return node instanceof resolveSeqD03cb037.Scalar || node instanceof resolveSeqD03cb037.YAMLSeq || node instanceof resolveSeqD03cb037.YAMLMap;
|
|
8779
8940
|
}
|
|
8780
8941
|
|
|
8781
8942
|
constructor(prefix) {
|
|
8782
|
-
PlainValueEc8e588e._defineProperty(this, "map",
|
|
8943
|
+
PlainValueEc8e588e._defineProperty(this, "map", Object.create(null));
|
|
8783
8944
|
|
|
8784
8945
|
this.prefix = prefix;
|
|
8785
8946
|
}
|
|
8786
8947
|
|
|
8787
8948
|
createAlias(node, name) {
|
|
8788
8949
|
this.setAnchor(node, name);
|
|
8789
|
-
return new
|
|
8950
|
+
return new resolveSeqD03cb037.Alias(node);
|
|
8790
8951
|
}
|
|
8791
8952
|
|
|
8792
8953
|
createMergePair(...sources) {
|
|
8793
|
-
const merge = new
|
|
8954
|
+
const merge = new resolveSeqD03cb037.Merge();
|
|
8794
8955
|
merge.value.items = sources.map(s => {
|
|
8795
|
-
if (s instanceof
|
|
8796
|
-
if (s.source instanceof
|
|
8797
|
-
} else if (s instanceof
|
|
8956
|
+
if (s instanceof resolveSeqD03cb037.Alias) {
|
|
8957
|
+
if (s.source instanceof resolveSeqD03cb037.YAMLMap) return s;
|
|
8958
|
+
} else if (s instanceof resolveSeqD03cb037.YAMLMap) {
|
|
8798
8959
|
return this.createAlias(s);
|
|
8799
8960
|
}
|
|
8800
8961
|
|
|
@@ -8886,13 +9047,13 @@ const visit = (node, tags) => {
|
|
|
8886
9047
|
tag
|
|
8887
9048
|
} = node;
|
|
8888
9049
|
|
|
8889
|
-
if (node instanceof
|
|
9050
|
+
if (node instanceof resolveSeqD03cb037.Collection) {
|
|
8890
9051
|
if (tag) tags[tag] = true;
|
|
8891
9052
|
node.items.forEach(n => visit(n, tags));
|
|
8892
|
-
} else if (node instanceof
|
|
9053
|
+
} else if (node instanceof resolveSeqD03cb037.Pair) {
|
|
8893
9054
|
visit(node.key, tags);
|
|
8894
9055
|
visit(node.value, tags);
|
|
8895
|
-
} else if (node instanceof
|
|
9056
|
+
} else if (node instanceof resolveSeqD03cb037.Scalar) {
|
|
8896
9057
|
if (tag) tags[tag] = true;
|
|
8897
9058
|
}
|
|
8898
9059
|
}
|
|
@@ -8918,7 +9079,7 @@ function parseContents(doc, contents) {
|
|
|
8918
9079
|
break;
|
|
8919
9080
|
}
|
|
8920
9081
|
|
|
8921
|
-
const res =
|
|
9082
|
+
const res = resolveSeqD03cb037.resolveNode(doc, node);
|
|
8922
9083
|
|
|
8923
9084
|
if (spaceBefore) {
|
|
8924
9085
|
res.spaceBefore = true;
|
|
@@ -8948,7 +9109,7 @@ function parseContents(doc, contents) {
|
|
|
8948
9109
|
const cb = comments.before.join('\n');
|
|
8949
9110
|
|
|
8950
9111
|
if (cb) {
|
|
8951
|
-
const cbNode = body instanceof
|
|
9112
|
+
const cbNode = body instanceof resolveSeqD03cb037.Collection && body.items[0] ? body.items[0] : body;
|
|
8952
9113
|
cbNode.commentBefore = cbNode.commentBefore ? `${cb}\n${cbNode.commentBefore}` : cb;
|
|
8953
9114
|
}
|
|
8954
9115
|
|
|
@@ -9060,7 +9221,7 @@ function parseDirectives(doc, directives, prevDoc) {
|
|
|
9060
9221
|
}
|
|
9061
9222
|
|
|
9062
9223
|
function assertCollection(contents) {
|
|
9063
|
-
if (contents instanceof
|
|
9224
|
+
if (contents instanceof resolveSeqD03cb037.Collection) return true;
|
|
9064
9225
|
throw new Error('Expected a YAML collection as document contents');
|
|
9065
9226
|
}
|
|
9066
9227
|
|
|
@@ -9095,7 +9256,7 @@ class Document$1 {
|
|
|
9095
9256
|
}
|
|
9096
9257
|
|
|
9097
9258
|
deleteIn(path) {
|
|
9098
|
-
if (
|
|
9259
|
+
if (resolveSeqD03cb037.isEmptyPath(path)) {
|
|
9099
9260
|
if (this.contents == null) return false;
|
|
9100
9261
|
this.contents = null;
|
|
9101
9262
|
return true;
|
|
@@ -9110,21 +9271,21 @@ class Document$1 {
|
|
|
9110
9271
|
}
|
|
9111
9272
|
|
|
9112
9273
|
get(key, keepScalar) {
|
|
9113
|
-
return this.contents instanceof
|
|
9274
|
+
return this.contents instanceof resolveSeqD03cb037.Collection ? this.contents.get(key, keepScalar) : undefined;
|
|
9114
9275
|
}
|
|
9115
9276
|
|
|
9116
9277
|
getIn(path, keepScalar) {
|
|
9117
|
-
if (
|
|
9118
|
-
return this.contents instanceof
|
|
9278
|
+
if (resolveSeqD03cb037.isEmptyPath(path)) return !keepScalar && this.contents instanceof resolveSeqD03cb037.Scalar ? this.contents.value : this.contents;
|
|
9279
|
+
return this.contents instanceof resolveSeqD03cb037.Collection ? this.contents.getIn(path, keepScalar) : undefined;
|
|
9119
9280
|
}
|
|
9120
9281
|
|
|
9121
9282
|
has(key) {
|
|
9122
|
-
return this.contents instanceof
|
|
9283
|
+
return this.contents instanceof resolveSeqD03cb037.Collection ? this.contents.has(key) : false;
|
|
9123
9284
|
}
|
|
9124
9285
|
|
|
9125
9286
|
hasIn(path) {
|
|
9126
|
-
if (
|
|
9127
|
-
return this.contents instanceof
|
|
9287
|
+
if (resolveSeqD03cb037.isEmptyPath(path)) return this.contents !== undefined;
|
|
9288
|
+
return this.contents instanceof resolveSeqD03cb037.Collection ? this.contents.hasIn(path) : false;
|
|
9128
9289
|
}
|
|
9129
9290
|
|
|
9130
9291
|
set(key, value) {
|
|
@@ -9133,7 +9294,7 @@ class Document$1 {
|
|
|
9133
9294
|
}
|
|
9134
9295
|
|
|
9135
9296
|
setIn(path, value) {
|
|
9136
|
-
if (
|
|
9297
|
+
if (resolveSeqD03cb037.isEmptyPath(path)) this.contents = value;else {
|
|
9137
9298
|
assertCollection(this.contents);
|
|
9138
9299
|
this.contents.setIn(path, value);
|
|
9139
9300
|
}
|
|
@@ -9152,7 +9313,7 @@ class Document$1 {
|
|
|
9152
9313
|
|
|
9153
9314
|
if (Array.isArray(customTags)) this.options.customTags = customTags;
|
|
9154
9315
|
const opt = Object.assign({}, this.getDefaults(), this.options);
|
|
9155
|
-
this.schema = new
|
|
9316
|
+
this.schema = new Schema88e323a7.Schema(opt);
|
|
9156
9317
|
}
|
|
9157
9318
|
|
|
9158
9319
|
parse(node, prevDoc) {
|
|
@@ -9189,7 +9350,7 @@ class Document$1 {
|
|
|
9189
9350
|
}
|
|
9190
9351
|
|
|
9191
9352
|
listNonDefaultTags() {
|
|
9192
|
-
return listTagNames(this.contents).filter(t => t.indexOf(
|
|
9353
|
+
return listTagNames(this.contents).filter(t => t.indexOf(Schema88e323a7.Schema.defaultPrefix) !== 0);
|
|
9193
9354
|
}
|
|
9194
9355
|
|
|
9195
9356
|
setTagPrefix(handle, prefix) {
|
|
@@ -9212,14 +9373,14 @@ class Document$1 {
|
|
|
9212
9373
|
mapAsMap,
|
|
9213
9374
|
maxAliasCount
|
|
9214
9375
|
} = this.options;
|
|
9215
|
-
const keep = keepBlobsInJSON && (typeof arg !== 'string' || !(this.contents instanceof
|
|
9376
|
+
const keep = keepBlobsInJSON && (typeof arg !== 'string' || !(this.contents instanceof resolveSeqD03cb037.Scalar));
|
|
9216
9377
|
const ctx = {
|
|
9217
9378
|
doc: this,
|
|
9218
9379
|
indentStep: ' ',
|
|
9219
9380
|
keep,
|
|
9220
9381
|
mapAsMap: keep && !!mapAsMap,
|
|
9221
9382
|
maxAliasCount,
|
|
9222
|
-
stringify // Requiring directly in Pair would create circular dependencies
|
|
9383
|
+
stringify: stringify$1 // Requiring directly in Pair would create circular dependencies
|
|
9223
9384
|
|
|
9224
9385
|
};
|
|
9225
9386
|
const anchorNames = Object.keys(this.anchors.map);
|
|
@@ -9228,7 +9389,7 @@ class Document$1 {
|
|
|
9228
9389
|
aliasCount: 0,
|
|
9229
9390
|
count: 1
|
|
9230
9391
|
}]));
|
|
9231
|
-
const res =
|
|
9392
|
+
const res = resolveSeqD03cb037.toJSON(this.contents, arg, ctx);
|
|
9232
9393
|
if (typeof onAnchor === 'function' && ctx.anchors) for (const {
|
|
9233
9394
|
count,
|
|
9234
9395
|
res
|
|
@@ -9278,18 +9439,18 @@ class Document$1 {
|
|
|
9278
9439
|
}
|
|
9279
9440
|
|
|
9280
9441
|
const ctx = {
|
|
9281
|
-
anchors:
|
|
9442
|
+
anchors: Object.create(null),
|
|
9282
9443
|
doc: this,
|
|
9283
9444
|
indent: '',
|
|
9284
9445
|
indentStep: ' '.repeat(indentSize),
|
|
9285
|
-
stringify // Requiring directly in nodes would create circular dependencies
|
|
9446
|
+
stringify: stringify$1 // Requiring directly in nodes would create circular dependencies
|
|
9286
9447
|
|
|
9287
9448
|
};
|
|
9288
9449
|
let chompKeep = false;
|
|
9289
9450
|
let contentComment = null;
|
|
9290
9451
|
|
|
9291
9452
|
if (this.contents) {
|
|
9292
|
-
if (this.contents instanceof
|
|
9453
|
+
if (this.contents instanceof resolveSeqD03cb037.Node) {
|
|
9293
9454
|
if (this.contents.spaceBefore && (hasDirectives || this.directivesEndMarker)) lines.push('');
|
|
9294
9455
|
if (this.contents.commentBefore) lines.push(this.contents.commentBefore.replace(/^/gm, '#')); // top-level block scalars need to be indented if followed by a comment
|
|
9295
9456
|
|
|
@@ -9298,10 +9459,10 @@ class Document$1 {
|
|
|
9298
9459
|
}
|
|
9299
9460
|
|
|
9300
9461
|
const onChompKeep = contentComment ? null : () => chompKeep = true;
|
|
9301
|
-
const body = stringify(this.contents, ctx, () => contentComment = null, onChompKeep);
|
|
9302
|
-
lines.push(
|
|
9462
|
+
const body = stringify$1(this.contents, ctx, () => contentComment = null, onChompKeep);
|
|
9463
|
+
lines.push(resolveSeqD03cb037.addComment(body, '', contentComment));
|
|
9303
9464
|
} else if (this.contents !== undefined) {
|
|
9304
|
-
lines.push(stringify(this.contents, ctx));
|
|
9465
|
+
lines.push(stringify$1(this.contents, ctx));
|
|
9305
9466
|
}
|
|
9306
9467
|
|
|
9307
9468
|
if (this.comment) {
|
|
@@ -9319,26 +9480,26 @@ PlainValueEc8e588e._defineProperty(Document$1, "defaults", documentOptions);
|
|
|
9319
9480
|
var Document_1 = Document$1;
|
|
9320
9481
|
var defaultOptions_1 = defaultOptions;
|
|
9321
9482
|
var scalarOptions_1 = scalarOptions;
|
|
9322
|
-
var
|
|
9483
|
+
var Document9b4560a1 = {
|
|
9323
9484
|
Document: Document_1,
|
|
9324
9485
|
defaultOptions: defaultOptions_1,
|
|
9325
9486
|
scalarOptions: scalarOptions_1
|
|
9326
9487
|
};
|
|
9327
9488
|
|
|
9328
|
-
function createNode
|
|
9489
|
+
function createNode(value, wrapScalars = true, tag) {
|
|
9329
9490
|
if (tag === undefined && typeof wrapScalars === 'string') {
|
|
9330
9491
|
tag = wrapScalars;
|
|
9331
9492
|
wrapScalars = true;
|
|
9332
9493
|
}
|
|
9333
9494
|
|
|
9334
|
-
const options = Object.assign({},
|
|
9335
|
-
const schema = new
|
|
9495
|
+
const options = Object.assign({}, Document9b4560a1.Document.defaults[Document9b4560a1.defaultOptions.version], Document9b4560a1.defaultOptions);
|
|
9496
|
+
const schema = new Schema88e323a7.Schema(options);
|
|
9336
9497
|
return schema.createNode(value, wrapScalars, tag);
|
|
9337
9498
|
}
|
|
9338
9499
|
|
|
9339
|
-
class Document
|
|
9500
|
+
class Document extends Document9b4560a1.Document {
|
|
9340
9501
|
constructor(options) {
|
|
9341
|
-
super(Object.assign({},
|
|
9502
|
+
super(Object.assign({}, Document9b4560a1.defaultOptions, options));
|
|
9342
9503
|
}
|
|
9343
9504
|
|
|
9344
9505
|
}
|
|
@@ -9348,7 +9509,7 @@ function parseAllDocuments(src, options) {
|
|
|
9348
9509
|
let prev;
|
|
9349
9510
|
|
|
9350
9511
|
for (const cstDoc of parseCst.parse(src)) {
|
|
9351
|
-
const doc = new Document
|
|
9512
|
+
const doc = new Document(options);
|
|
9352
9513
|
doc.parse(cstDoc, prev);
|
|
9353
9514
|
stream.push(doc);
|
|
9354
9515
|
prev = doc;
|
|
@@ -9359,7 +9520,7 @@ function parseAllDocuments(src, options) {
|
|
|
9359
9520
|
|
|
9360
9521
|
function parseDocument(src, options) {
|
|
9361
9522
|
const cst = parseCst.parse(src);
|
|
9362
|
-
const doc = new Document
|
|
9523
|
+
const doc = new Document(options).parse(cst[0]);
|
|
9363
9524
|
|
|
9364
9525
|
if (cst.length > 1) {
|
|
9365
9526
|
const errMsg = 'Source contains multiple documents; please use YAML.parseAllDocuments()';
|
|
@@ -9369,29 +9530,29 @@ function parseDocument(src, options) {
|
|
|
9369
9530
|
return doc;
|
|
9370
9531
|
}
|
|
9371
9532
|
|
|
9372
|
-
function parse
|
|
9533
|
+
function parse(src, options) {
|
|
9373
9534
|
const doc = parseDocument(src, options);
|
|
9374
|
-
doc.warnings.forEach(warning =>
|
|
9535
|
+
doc.warnings.forEach(warning => warnings1000a372.warn(warning));
|
|
9375
9536
|
if (doc.errors.length > 0) throw doc.errors[0];
|
|
9376
9537
|
return doc.toJSON();
|
|
9377
9538
|
}
|
|
9378
9539
|
|
|
9379
|
-
function stringify
|
|
9380
|
-
const doc = new Document
|
|
9540
|
+
function stringify(value, options) {
|
|
9541
|
+
const doc = new Document(options);
|
|
9381
9542
|
doc.contents = value;
|
|
9382
9543
|
return String(doc);
|
|
9383
9544
|
}
|
|
9384
9545
|
|
|
9385
9546
|
const YAML = {
|
|
9386
|
-
createNode
|
|
9387
|
-
defaultOptions:
|
|
9388
|
-
Document
|
|
9389
|
-
parse
|
|
9547
|
+
createNode,
|
|
9548
|
+
defaultOptions: Document9b4560a1.defaultOptions,
|
|
9549
|
+
Document,
|
|
9550
|
+
parse,
|
|
9390
9551
|
parseAllDocuments,
|
|
9391
9552
|
parseCST: parseCst.parse,
|
|
9392
9553
|
parseDocument,
|
|
9393
|
-
scalarOptions:
|
|
9394
|
-
stringify
|
|
9554
|
+
scalarOptions: Document9b4560a1.scalarOptions,
|
|
9555
|
+
stringify
|
|
9395
9556
|
};
|
|
9396
9557
|
var YAML_1 = YAML;
|
|
9397
9558
|
var dist$1 = {
|
|
@@ -9423,7 +9584,7 @@ var loaders_1 = createCommonjsModule(function (module, exports) {
|
|
|
9423
9584
|
|
|
9424
9585
|
const loadJson = function loadJson(filepath, content) {
|
|
9425
9586
|
if (parseJson === undefined) {
|
|
9426
|
-
parseJson =
|
|
9587
|
+
parseJson = parseJson_1;
|
|
9427
9588
|
}
|
|
9428
9589
|
|
|
9429
9590
|
try {
|
|
@@ -9461,32 +9622,32 @@ var loaders_1 = createCommonjsModule(function (module, exports) {
|
|
|
9461
9622
|
exports.loaders = loaders;
|
|
9462
9623
|
});
|
|
9463
9624
|
|
|
9464
|
-
var
|
|
9625
|
+
var getPropertyByPath_2 = getPropertyByPath; // Resolves property names or property paths defined with period-delimited
|
|
9626
|
+
// strings or arrays of strings. Property names that are found on the source
|
|
9627
|
+
// object are used directly (even if they include a period).
|
|
9628
|
+
// Nested property names that include periods, within a path, are only
|
|
9629
|
+
// understood in array paths.
|
|
9465
9630
|
|
|
9466
|
-
|
|
9467
|
-
|
|
9468
|
-
|
|
9469
|
-
|
|
9470
|
-
// strings or arrays of strings. Property names that are found on the source
|
|
9471
|
-
// object are used directly (even if they include a period).
|
|
9472
|
-
// Nested property names that include periods, within a path, are only
|
|
9473
|
-
// understood in array paths.
|
|
9631
|
+
function getPropertyByPath(source, path) {
|
|
9632
|
+
if (typeof path === 'string' && Object.prototype.hasOwnProperty.call(source, path)) {
|
|
9633
|
+
return source[path];
|
|
9634
|
+
}
|
|
9474
9635
|
|
|
9475
|
-
|
|
9476
|
-
if (typeof path === 'string' && Object.prototype.hasOwnProperty.call(source, path)) {
|
|
9477
|
-
return source[path];
|
|
9478
|
-
}
|
|
9636
|
+
const parsedPath = typeof path === 'string' ? path.split('.') : path; // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9479
9637
|
|
|
9480
|
-
|
|
9638
|
+
return parsedPath.reduce((previous, key) => {
|
|
9639
|
+
if (previous === undefined) {
|
|
9640
|
+
return previous;
|
|
9641
|
+
}
|
|
9481
9642
|
|
|
9482
|
-
return
|
|
9483
|
-
|
|
9484
|
-
|
|
9485
|
-
}
|
|
9643
|
+
return previous[key];
|
|
9644
|
+
}, source);
|
|
9645
|
+
}
|
|
9486
9646
|
|
|
9487
|
-
|
|
9488
|
-
|
|
9489
|
-
|
|
9647
|
+
var getPropertyByPath_1 = /*#__PURE__*/Object.defineProperty({
|
|
9648
|
+
getPropertyByPath: getPropertyByPath_2
|
|
9649
|
+
}, '__esModule', {
|
|
9650
|
+
value: true
|
|
9490
9651
|
});
|
|
9491
9652
|
|
|
9492
9653
|
var ExplorerBase_1 = createCommonjsModule(function (module, exports) {
|
|
@@ -9632,98 +9793,100 @@ var ExplorerBase_1 = createCommonjsModule(function (module, exports) {
|
|
|
9632
9793
|
}
|
|
9633
9794
|
});
|
|
9634
9795
|
|
|
9635
|
-
var
|
|
9796
|
+
var readFile_2 = readFile;
|
|
9797
|
+
var readFileSync_1 = readFileSync;
|
|
9636
9798
|
|
|
9637
|
-
|
|
9638
|
-
value: true
|
|
9639
|
-
});
|
|
9640
|
-
exports.readFile = readFile;
|
|
9641
|
-
exports.readFileSync = readFileSync;
|
|
9642
|
-
|
|
9643
|
-
var _fs = _interopRequireDefault(fs__default['default']);
|
|
9799
|
+
var _fs = _interopRequireDefault$1(fs__default['default']);
|
|
9644
9800
|
|
|
9645
|
-
|
|
9646
|
-
|
|
9647
|
-
|
|
9648
|
-
|
|
9649
|
-
|
|
9801
|
+
function _interopRequireDefault$1(obj) {
|
|
9802
|
+
return obj && obj.__esModule ? obj : {
|
|
9803
|
+
default: obj
|
|
9804
|
+
};
|
|
9805
|
+
}
|
|
9650
9806
|
|
|
9651
|
-
|
|
9652
|
-
|
|
9653
|
-
|
|
9654
|
-
|
|
9655
|
-
|
|
9656
|
-
|
|
9657
|
-
|
|
9807
|
+
async function fsReadFileAsync(pathname, encoding) {
|
|
9808
|
+
return new Promise((resolve, reject) => {
|
|
9809
|
+
_fs.default.readFile(pathname, encoding, (error, contents) => {
|
|
9810
|
+
if (error) {
|
|
9811
|
+
reject(error);
|
|
9812
|
+
return;
|
|
9813
|
+
}
|
|
9658
9814
|
|
|
9659
|
-
|
|
9660
|
-
});
|
|
9815
|
+
resolve(contents);
|
|
9661
9816
|
});
|
|
9662
|
-
}
|
|
9817
|
+
});
|
|
9818
|
+
}
|
|
9663
9819
|
|
|
9664
|
-
|
|
9665
|
-
|
|
9820
|
+
async function readFile(filepath, options = {}) {
|
|
9821
|
+
const throwNotFound = options.throwNotFound === true;
|
|
9666
9822
|
|
|
9667
|
-
|
|
9668
|
-
|
|
9669
|
-
|
|
9670
|
-
|
|
9671
|
-
|
|
9672
|
-
|
|
9673
|
-
}
|
|
9674
|
-
|
|
9675
|
-
throw error;
|
|
9823
|
+
try {
|
|
9824
|
+
const content = await fsReadFileAsync(filepath, 'utf8');
|
|
9825
|
+
return content;
|
|
9826
|
+
} catch (error) {
|
|
9827
|
+
if (throwNotFound === false && error.code === 'ENOENT') {
|
|
9828
|
+
return null;
|
|
9676
9829
|
}
|
|
9677
|
-
}
|
|
9678
9830
|
|
|
9679
|
-
|
|
9680
|
-
|
|
9831
|
+
throw error;
|
|
9832
|
+
}
|
|
9833
|
+
}
|
|
9681
9834
|
|
|
9682
|
-
|
|
9683
|
-
|
|
9835
|
+
function readFileSync(filepath, options = {}) {
|
|
9836
|
+
const throwNotFound = options.throwNotFound === true;
|
|
9684
9837
|
|
|
9685
|
-
|
|
9686
|
-
|
|
9687
|
-
if (throwNotFound === false && error.code === 'ENOENT') {
|
|
9688
|
-
return null;
|
|
9689
|
-
}
|
|
9838
|
+
try {
|
|
9839
|
+
const content = _fs.default.readFileSync(filepath, 'utf8');
|
|
9690
9840
|
|
|
9691
|
-
|
|
9841
|
+
return content;
|
|
9842
|
+
} catch (error) {
|
|
9843
|
+
if (throwNotFound === false && error.code === 'ENOENT') {
|
|
9844
|
+
return null;
|
|
9692
9845
|
}
|
|
9693
|
-
}
|
|
9694
|
-
});
|
|
9695
9846
|
|
|
9696
|
-
|
|
9847
|
+
throw error;
|
|
9848
|
+
}
|
|
9849
|
+
}
|
|
9697
9850
|
|
|
9698
|
-
|
|
9699
|
-
|
|
9700
|
-
|
|
9701
|
-
|
|
9702
|
-
|
|
9851
|
+
var readFile_1 = /*#__PURE__*/Object.defineProperty({
|
|
9852
|
+
readFile: readFile_2,
|
|
9853
|
+
readFileSync: readFileSync_1
|
|
9854
|
+
}, '__esModule', {
|
|
9855
|
+
value: true
|
|
9856
|
+
});
|
|
9703
9857
|
|
|
9704
|
-
|
|
9705
|
-
|
|
9858
|
+
var cacheWrapper_2 = cacheWrapper;
|
|
9859
|
+
var cacheWrapperSync_1 = cacheWrapperSync;
|
|
9706
9860
|
|
|
9707
|
-
|
|
9708
|
-
|
|
9709
|
-
}
|
|
9861
|
+
async function cacheWrapper(cache, key, fn) {
|
|
9862
|
+
const cached = cache.get(key);
|
|
9710
9863
|
|
|
9711
|
-
|
|
9712
|
-
|
|
9713
|
-
return result;
|
|
9864
|
+
if (cached !== undefined) {
|
|
9865
|
+
return cached;
|
|
9714
9866
|
}
|
|
9715
9867
|
|
|
9716
|
-
|
|
9717
|
-
|
|
9868
|
+
const result = await fn();
|
|
9869
|
+
cache.set(key, result);
|
|
9870
|
+
return result;
|
|
9871
|
+
}
|
|
9718
9872
|
|
|
9719
|
-
|
|
9720
|
-
|
|
9721
|
-
}
|
|
9873
|
+
function cacheWrapperSync(cache, key, fn) {
|
|
9874
|
+
const cached = cache.get(key);
|
|
9722
9875
|
|
|
9723
|
-
|
|
9724
|
-
|
|
9725
|
-
return result;
|
|
9876
|
+
if (cached !== undefined) {
|
|
9877
|
+
return cached;
|
|
9726
9878
|
}
|
|
9879
|
+
|
|
9880
|
+
const result = fn();
|
|
9881
|
+
cache.set(key, result);
|
|
9882
|
+
return result;
|
|
9883
|
+
}
|
|
9884
|
+
|
|
9885
|
+
var cacheWrapper_1 = /*#__PURE__*/Object.defineProperty({
|
|
9886
|
+
cacheWrapper: cacheWrapper_2,
|
|
9887
|
+
cacheWrapperSync: cacheWrapperSync_1
|
|
9888
|
+
}, '__esModule', {
|
|
9889
|
+
value: true
|
|
9727
9890
|
});
|
|
9728
9891
|
|
|
9729
9892
|
const {
|
|
@@ -9778,45 +9941,46 @@ var pathType = {
|
|
|
9778
9941
|
isSymlinkSync: isSymlinkSync
|
|
9779
9942
|
};
|
|
9780
9943
|
|
|
9781
|
-
var
|
|
9944
|
+
var getDirectory_2 = getDirectory;
|
|
9945
|
+
var getDirectorySync_1 = getDirectorySync;
|
|
9782
9946
|
|
|
9783
|
-
|
|
9784
|
-
value: true
|
|
9785
|
-
});
|
|
9786
|
-
exports.getDirectory = getDirectory;
|
|
9787
|
-
exports.getDirectorySync = getDirectorySync;
|
|
9947
|
+
var _path = _interopRequireDefault(path__default['default']);
|
|
9788
9948
|
|
|
9789
|
-
|
|
9949
|
+
function _interopRequireDefault(obj) {
|
|
9950
|
+
return obj && obj.__esModule ? obj : {
|
|
9951
|
+
default: obj
|
|
9952
|
+
};
|
|
9953
|
+
}
|
|
9790
9954
|
|
|
9791
|
-
|
|
9792
|
-
|
|
9793
|
-
|
|
9794
|
-
|
|
9955
|
+
async function getDirectory(filepath) {
|
|
9956
|
+
const filePathIsDirectory = await (0, pathType.isDirectory)(filepath);
|
|
9957
|
+
|
|
9958
|
+
if (filePathIsDirectory === true) {
|
|
9959
|
+
return filepath;
|
|
9795
9960
|
}
|
|
9796
9961
|
|
|
9797
|
-
|
|
9798
|
-
const filePathIsDirectory = await (0, pathType.isDirectory)(filepath);
|
|
9962
|
+
const directory = _path.default.dirname(filepath);
|
|
9799
9963
|
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
|
-
}
|
|
9964
|
+
return directory;
|
|
9965
|
+
}
|
|
9803
9966
|
|
|
9804
|
-
|
|
9967
|
+
function getDirectorySync(filepath) {
|
|
9968
|
+
const filePathIsDirectory = (0, pathType.isDirectorySync)(filepath);
|
|
9805
9969
|
|
|
9806
|
-
|
|
9970
|
+
if (filePathIsDirectory === true) {
|
|
9971
|
+
return filepath;
|
|
9807
9972
|
}
|
|
9808
9973
|
|
|
9809
|
-
|
|
9810
|
-
const filePathIsDirectory = (0, pathType.isDirectorySync)(filepath);
|
|
9974
|
+
const directory = _path.default.dirname(filepath);
|
|
9811
9975
|
|
|
9812
|
-
|
|
9813
|
-
|
|
9814
|
-
}
|
|
9815
|
-
|
|
9816
|
-
const directory = _path.default.dirname(filepath);
|
|
9976
|
+
return directory;
|
|
9977
|
+
}
|
|
9817
9978
|
|
|
9818
|
-
|
|
9819
|
-
|
|
9979
|
+
var getDirectory_1 = /*#__PURE__*/Object.defineProperty({
|
|
9980
|
+
getDirectory: getDirectory_2,
|
|
9981
|
+
getDirectorySync: getDirectorySync_1
|
|
9982
|
+
}, '__esModule', {
|
|
9983
|
+
value: true
|
|
9820
9984
|
});
|
|
9821
9985
|
|
|
9822
9986
|
var Explorer_1 = createCommonjsModule(function (module, exports) {
|
|
@@ -10049,7 +10213,7 @@ var ExplorerSync_1 = createCommonjsModule(function (module, exports) {
|
|
|
10049
10213
|
exports.ExplorerSync = ExplorerSync;
|
|
10050
10214
|
});
|
|
10051
10215
|
|
|
10052
|
-
var dist
|
|
10216
|
+
var dist = createCommonjsModule(function (module, exports) {
|
|
10053
10217
|
|
|
10054
10218
|
Object.defineProperty(exports, "__esModule", {
|
|
10055
10219
|
value: true
|
|
@@ -10164,133 +10328,41 @@ var findParentDir = createCommonjsModule(function (module, exports) {
|
|
|
10164
10328
|
});
|
|
10165
10329
|
|
|
10166
10330
|
const {
|
|
10167
|
-
|
|
10168
|
-
} =
|
|
10331
|
+
stdin
|
|
10332
|
+
} = process;
|
|
10169
10333
|
|
|
10170
|
-
var
|
|
10171
|
-
|
|
10172
|
-
const {
|
|
10173
|
-
array
|
|
10174
|
-
} = options;
|
|
10175
|
-
let {
|
|
10176
|
-
encoding
|
|
10177
|
-
} = options;
|
|
10178
|
-
const isBuffer = encoding === 'buffer';
|
|
10179
|
-
let objectMode = false;
|
|
10180
|
-
|
|
10181
|
-
if (array) {
|
|
10182
|
-
objectMode = !(encoding || isBuffer);
|
|
10183
|
-
} else {
|
|
10184
|
-
encoding = encoding || 'utf8';
|
|
10185
|
-
}
|
|
10334
|
+
var getStdin = async () => {
|
|
10335
|
+
let result = '';
|
|
10186
10336
|
|
|
10187
|
-
if (
|
|
10188
|
-
|
|
10337
|
+
if (stdin.isTTY) {
|
|
10338
|
+
return result;
|
|
10189
10339
|
}
|
|
10190
10340
|
|
|
10191
|
-
|
|
10192
|
-
objectMode
|
|
10193
|
-
});
|
|
10341
|
+
stdin.setEncoding('utf8');
|
|
10194
10342
|
|
|
10195
|
-
|
|
10196
|
-
|
|
10343
|
+
for await (const chunk of stdin) {
|
|
10344
|
+
result += chunk;
|
|
10197
10345
|
}
|
|
10198
10346
|
|
|
10199
|
-
|
|
10200
|
-
const chunks = [];
|
|
10201
|
-
stream.on('data', chunk => {
|
|
10202
|
-
chunks.push(chunk);
|
|
10203
|
-
|
|
10204
|
-
if (objectMode) {
|
|
10205
|
-
length = chunks.length;
|
|
10206
|
-
} else {
|
|
10207
|
-
length += chunk.length;
|
|
10208
|
-
}
|
|
10209
|
-
});
|
|
10210
|
-
|
|
10211
|
-
stream.getBufferedValue = () => {
|
|
10212
|
-
if (array) {
|
|
10213
|
-
return chunks;
|
|
10214
|
-
}
|
|
10215
|
-
|
|
10216
|
-
return isBuffer ? Buffer.concat(chunks, length) : chunks.join('');
|
|
10217
|
-
};
|
|
10218
|
-
|
|
10219
|
-
stream.getBufferedLength = () => length;
|
|
10220
|
-
|
|
10221
|
-
return stream;
|
|
10347
|
+
return result;
|
|
10222
10348
|
};
|
|
10223
10349
|
|
|
10224
|
-
|
|
10225
|
-
|
|
10226
|
-
|
|
10227
|
-
const {
|
|
10228
|
-
promisify: promisify$1
|
|
10229
|
-
} = util__default['default'];
|
|
10230
|
-
const streamPipelinePromisified = promisify$1(stream__default['default'].pipeline);
|
|
10350
|
+
var buffer = async () => {
|
|
10351
|
+
const result = [];
|
|
10352
|
+
let length = 0;
|
|
10231
10353
|
|
|
10232
|
-
|
|
10233
|
-
|
|
10234
|
-
super('maxBuffer exceeded');
|
|
10235
|
-
this.name = 'MaxBufferError';
|
|
10354
|
+
if (stdin.isTTY) {
|
|
10355
|
+
return Buffer.concat([]);
|
|
10236
10356
|
}
|
|
10237
10357
|
|
|
10238
|
-
|
|
10239
|
-
|
|
10240
|
-
|
|
10241
|
-
if (!inputStream) {
|
|
10242
|
-
throw new Error('Expected a stream');
|
|
10358
|
+
for await (const chunk of stdin) {
|
|
10359
|
+
result.push(chunk);
|
|
10360
|
+
length += chunk.length;
|
|
10243
10361
|
}
|
|
10244
10362
|
|
|
10245
|
-
|
|
10246
|
-
|
|
10247
|
-
|
|
10248
|
-
const {
|
|
10249
|
-
maxBuffer
|
|
10250
|
-
} = options;
|
|
10251
|
-
const stream = bufferStream(options);
|
|
10252
|
-
await new Promise((resolve, reject) => {
|
|
10253
|
-
const rejectPromise = error => {
|
|
10254
|
-
// Don't retrieve an oversized buffer.
|
|
10255
|
-
if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
|
|
10256
|
-
error.bufferedData = stream.getBufferedValue();
|
|
10257
|
-
}
|
|
10258
|
-
|
|
10259
|
-
reject(error);
|
|
10260
|
-
};
|
|
10261
|
-
|
|
10262
|
-
(async () => {
|
|
10263
|
-
try {
|
|
10264
|
-
await streamPipelinePromisified(inputStream, stream);
|
|
10265
|
-
resolve();
|
|
10266
|
-
} catch (error) {
|
|
10267
|
-
rejectPromise(error);
|
|
10268
|
-
}
|
|
10269
|
-
})();
|
|
10270
|
-
|
|
10271
|
-
stream.on('data', () => {
|
|
10272
|
-
if (stream.getBufferedLength() > maxBuffer) {
|
|
10273
|
-
rejectPromise(new MaxBufferError());
|
|
10274
|
-
}
|
|
10275
|
-
});
|
|
10276
|
-
});
|
|
10277
|
-
return stream.getBufferedValue();
|
|
10278
|
-
}
|
|
10279
|
-
|
|
10280
|
-
var getStream_1 = getStream;
|
|
10281
|
-
|
|
10282
|
-
var buffer = (stream, options) => getStream(stream, Object.assign({}, options, {
|
|
10283
|
-
encoding: 'buffer'
|
|
10284
|
-
}));
|
|
10285
|
-
|
|
10286
|
-
var array = (stream, options) => getStream(stream, Object.assign({}, options, {
|
|
10287
|
-
array: true
|
|
10288
|
-
}));
|
|
10289
|
-
|
|
10290
|
-
var MaxBufferError_1 = MaxBufferError;
|
|
10291
|
-
getStream_1.buffer = buffer;
|
|
10292
|
-
getStream_1.array = array;
|
|
10293
|
-
getStream_1.MaxBufferError = MaxBufferError_1;
|
|
10363
|
+
return Buffer.concat(result, length);
|
|
10364
|
+
};
|
|
10365
|
+
getStdin.buffer = buffer;
|
|
10294
10366
|
|
|
10295
10367
|
var vendors = [
|
|
10296
10368
|
{
|
|
@@ -10385,7 +10457,8 @@ var vendors = [
|
|
|
10385
10457
|
{
|
|
10386
10458
|
name: "GitLab CI",
|
|
10387
10459
|
constant: "GITLAB",
|
|
10388
|
-
env: "GITLAB_CI"
|
|
10460
|
+
env: "GITLAB_CI",
|
|
10461
|
+
pr: "CI_MERGE_REQUEST_ID"
|
|
10389
10462
|
},
|
|
10390
10463
|
{
|
|
10391
10464
|
name: "GoCD",
|
|
@@ -10411,11 +10484,6 @@ var vendors = [
|
|
|
10411
10484
|
]
|
|
10412
10485
|
}
|
|
10413
10486
|
},
|
|
10414
|
-
{
|
|
10415
|
-
name: "ZEIT Now",
|
|
10416
|
-
constant: "ZEIT_NOW",
|
|
10417
|
-
env: "NOW_BUILDER"
|
|
10418
|
-
},
|
|
10419
10487
|
{
|
|
10420
10488
|
name: "Magnum CI",
|
|
10421
10489
|
constant: "MAGNUM",
|
|
@@ -10459,6 +10527,15 @@ var vendors = [
|
|
|
10459
10527
|
env: "SEMAPHORE",
|
|
10460
10528
|
pr: "PULL_REQUEST_NUMBER"
|
|
10461
10529
|
},
|
|
10530
|
+
{
|
|
10531
|
+
name: "Screwdriver",
|
|
10532
|
+
constant: "SCREWDRIVER",
|
|
10533
|
+
env: "SCREWDRIVER",
|
|
10534
|
+
pr: {
|
|
10535
|
+
env: "SD_PULL_REQUEST",
|
|
10536
|
+
ne: "false"
|
|
10537
|
+
}
|
|
10538
|
+
},
|
|
10462
10539
|
{
|
|
10463
10540
|
name: "Shippable",
|
|
10464
10541
|
constant: "SHIPPABLE",
|
|
@@ -10499,30 +10576,33 @@ var vendors = [
|
|
|
10499
10576
|
env: "TRAVIS_PULL_REQUEST",
|
|
10500
10577
|
ne: "false"
|
|
10501
10578
|
}
|
|
10579
|
+
},
|
|
10580
|
+
{
|
|
10581
|
+
name: "Vercel",
|
|
10582
|
+
constant: "VERCEL",
|
|
10583
|
+
env: "NOW_BUILDER"
|
|
10584
|
+
},
|
|
10585
|
+
{
|
|
10586
|
+
name: "Visual Studio App Center",
|
|
10587
|
+
constant: "APPCENTER",
|
|
10588
|
+
env: "APPCENTER_BUILD_ID"
|
|
10502
10589
|
}
|
|
10503
10590
|
];
|
|
10504
10591
|
|
|
10505
|
-
var vendors$1 = /*#__PURE__*/Object.freeze({
|
|
10506
|
-
__proto__: null,
|
|
10507
|
-
'default': vendors
|
|
10508
|
-
});
|
|
10509
|
-
|
|
10510
|
-
var vendors$2 = getCjsExportFromNamespace(vendors$1);
|
|
10511
|
-
|
|
10512
10592
|
var ciInfo = createCommonjsModule(function (module, exports) {
|
|
10513
10593
|
|
|
10514
|
-
|
|
10594
|
+
const env = process.env; // Used for testing only
|
|
10515
10595
|
|
|
10516
10596
|
Object.defineProperty(exports, '_vendors', {
|
|
10517
|
-
value: vendors
|
|
10597
|
+
value: vendors.map(function (v) {
|
|
10518
10598
|
return v.constant;
|
|
10519
10599
|
})
|
|
10520
10600
|
});
|
|
10521
10601
|
exports.name = null;
|
|
10522
10602
|
exports.isPR = null;
|
|
10523
|
-
vendors
|
|
10524
|
-
|
|
10525
|
-
|
|
10603
|
+
vendors.forEach(function (vendor) {
|
|
10604
|
+
const envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env];
|
|
10605
|
+
const isCI = envs.every(function (obj) {
|
|
10526
10606
|
return checkEnv(obj);
|
|
10527
10607
|
});
|
|
10528
10608
|
exports[vendor.constant] = isCI;
|
|
@@ -10573,10 +10653,10 @@ var ciInfo = createCommonjsModule(function (module, exports) {
|
|
|
10573
10653
|
});
|
|
10574
10654
|
|
|
10575
10655
|
var thirdParty = {
|
|
10576
|
-
cosmiconfig: dist
|
|
10577
|
-
cosmiconfigSync: dist
|
|
10656
|
+
cosmiconfig: dist.cosmiconfig,
|
|
10657
|
+
cosmiconfigSync: dist.cosmiconfigSync,
|
|
10578
10658
|
findParentDir: findParentDir.sync,
|
|
10579
|
-
|
|
10659
|
+
getStdin: getStdin,
|
|
10580
10660
|
isCI: () => ciInfo.isCI
|
|
10581
10661
|
};
|
|
10582
10662
|
|