vite 5.0.1 → 5.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +406 -12
- package/dist/node/chunks/{dep-2UYu25Ks.js → dep-_rppyaaB.js} +1 -1
- package/dist/node/chunks/{dep-1HTAyDZa.js → dep-m-h4L35S.js} +1 -1
- package/dist/node/chunks/{dep-VPh1kAXQ.js → dep-vyqc0_aB.js} +1604 -431
- package/dist/node/cli.js +6 -6
- package/dist/node/index.d.ts +2 -0
- package/dist/node/index.js +2 -2
- package/dist/node-cjs/publicUtils.cjs +10 -4
- package/package.json +7 -7
|
@@ -6,8 +6,8 @@ import { promisify as promisify$4, format as format$2, inspect } from 'node:util
|
|
|
6
6
|
import { performance } from 'node:perf_hooks';
|
|
7
7
|
import { createRequire as createRequire$1, builtinModules } from 'node:module';
|
|
8
8
|
import require$$0$3 from 'tty';
|
|
9
|
-
import esbuild, { transform as transform$1, formatMessages, build as build$3 } from 'esbuild';
|
|
10
9
|
import require$$0$4, { win32, posix, isAbsolute as isAbsolute$1, resolve as resolve$3, relative as relative$1, basename as basename$1, extname, dirname as dirname$1, join as join$1, sep, normalize } from 'path';
|
|
10
|
+
import esbuild, { transform as transform$1, formatMessages, build as build$3 } from 'esbuild';
|
|
11
11
|
import * as require$$0$2 from 'fs';
|
|
12
12
|
import require$$0__default, { existsSync, readFileSync, statSync as statSync$1, readdirSync } from 'fs';
|
|
13
13
|
import require$$0$5 from 'events';
|
|
@@ -219,7 +219,16 @@ function alias$1(options = {}) {
|
|
|
219
219
|
if (matchedEntry.resolverFunction) {
|
|
220
220
|
return matchedEntry.resolverFunction.call(this, updatedId, importer, resolveOptions);
|
|
221
221
|
}
|
|
222
|
-
return this.resolve(updatedId, importer, Object.assign({ skipSelf: true }, resolveOptions)).then((resolved) =>
|
|
222
|
+
return this.resolve(updatedId, importer, Object.assign({ skipSelf: true }, resolveOptions)).then((resolved) => {
|
|
223
|
+
if (resolved)
|
|
224
|
+
return resolved;
|
|
225
|
+
if (!require$$0$4.isAbsolute(updatedId)) {
|
|
226
|
+
this.warn(`rewrote ${importee} to ${updatedId} but was not an abolute path and was not handled by other plugins. ` +
|
|
227
|
+
`This will lead to duplicated modules for the same path. ` +
|
|
228
|
+
`To avoid duplicating modules, you should resolve to an absolute path.`);
|
|
229
|
+
}
|
|
230
|
+
return { id: updatedId };
|
|
231
|
+
});
|
|
223
232
|
}
|
|
224
233
|
};
|
|
225
234
|
}
|
|
@@ -5298,7 +5307,7 @@ function makeres (key) {
|
|
|
5298
5307
|
return once(function RES () {
|
|
5299
5308
|
var cbs = reqs[key];
|
|
5300
5309
|
var len = cbs.length;
|
|
5301
|
-
var args = slice$
|
|
5310
|
+
var args = slice$3(arguments);
|
|
5302
5311
|
|
|
5303
5312
|
// XXX It's somewhat ambiguous whether a new callback added in this
|
|
5304
5313
|
// pass should be queued for later execution if something in the
|
|
@@ -5325,7 +5334,7 @@ function makeres (key) {
|
|
|
5325
5334
|
})
|
|
5326
5335
|
}
|
|
5327
5336
|
|
|
5328
|
-
function slice$
|
|
5337
|
+
function slice$3 (args) {
|
|
5329
5338
|
var length = args.length;
|
|
5330
5339
|
var array = [];
|
|
5331
5340
|
|
|
@@ -6556,10 +6565,10 @@ function getRelativePath(from, to) {
|
|
|
6556
6565
|
return fromParts.concat(toParts).join('/');
|
|
6557
6566
|
}
|
|
6558
6567
|
|
|
6559
|
-
const toString$
|
|
6568
|
+
const toString$3 = Object.prototype.toString;
|
|
6560
6569
|
|
|
6561
6570
|
function isObject$2(thing) {
|
|
6562
|
-
return toString$
|
|
6571
|
+
return toString$3.call(thing) === '[object Object]';
|
|
6563
6572
|
}
|
|
6564
6573
|
|
|
6565
6574
|
function getLocator(source) {
|
|
@@ -10657,7 +10666,7 @@ function remapping(input, loader, options) {
|
|
|
10657
10666
|
return new SourceMap(traceMappings(tree), opts);
|
|
10658
10667
|
}
|
|
10659
10668
|
|
|
10660
|
-
var src$
|
|
10669
|
+
var src$3 = {exports: {}};
|
|
10661
10670
|
|
|
10662
10671
|
var node$1 = {exports: {}};
|
|
10663
10672
|
|
|
@@ -11674,12 +11683,12 @@ function requireBrowser$1 () {
|
|
|
11674
11683
|
*/
|
|
11675
11684
|
|
|
11676
11685
|
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
|
|
11677
|
-
src$
|
|
11686
|
+
src$3.exports = requireBrowser$1();
|
|
11678
11687
|
} else {
|
|
11679
|
-
src$
|
|
11688
|
+
src$3.exports = requireNode$1();
|
|
11680
11689
|
}
|
|
11681
11690
|
|
|
11682
|
-
var srcExports$1 = src$
|
|
11691
|
+
var srcExports$1 = src$3.exports;
|
|
11683
11692
|
var debug$i = /*@__PURE__*/getDefaultExportFromCjs(srcExports$1);
|
|
11684
11693
|
|
|
11685
11694
|
let pnp;
|
|
@@ -12276,8 +12285,8 @@ function numberToPos(source, offset) {
|
|
|
12276
12285
|
return { line: line + 1, column };
|
|
12277
12286
|
}
|
|
12278
12287
|
function generateCodeFrame(source, start = 0, end) {
|
|
12279
|
-
start = posToNumber(source, start);
|
|
12280
|
-
end = end !== undefined ? posToNumber(source, end) : start;
|
|
12288
|
+
start = Math.max(posToNumber(source, start), 0);
|
|
12289
|
+
end = Math.min(end !== undefined ? posToNumber(source, end) : start, source.length);
|
|
12281
12290
|
const lines = source.split(splitRE);
|
|
12282
12291
|
let count = 0;
|
|
12283
12292
|
const res = [];
|
|
@@ -12681,6 +12690,7 @@ function arraify(target) {
|
|
|
12681
12690
|
const multilineCommentsRE$1 = /\/\*[^*]*\*+(?:[^/*][^*]*\*+)*\//g;
|
|
12682
12691
|
const singlelineCommentsRE$1 = /\/\/.*/g;
|
|
12683
12692
|
const requestQuerySplitRE = /\?(?!.*[/|}])/;
|
|
12693
|
+
const requestQueryMaybeEscapedSplitRE = /\\?\?(?!.*[/|}])/;
|
|
12684
12694
|
function parseRequest(id) {
|
|
12685
12695
|
const [_, search] = id.split(requestQuerySplitRE, 2);
|
|
12686
12696
|
if (!search) {
|
|
@@ -14919,86 +14929,1020 @@ function terserPlugin(config) {
|
|
|
14919
14929
|
};
|
|
14920
14930
|
}
|
|
14921
14931
|
|
|
14922
|
-
var
|
|
14932
|
+
var toString$2 = {}.toString;
|
|
14923
14933
|
|
|
14924
|
-
var
|
|
14925
|
-
|
|
14934
|
+
var isarray = Array.isArray || function (arr) {
|
|
14935
|
+
return toString$2.call(arr) == '[object Array]';
|
|
14926
14936
|
};
|
|
14927
14937
|
|
|
14928
|
-
var
|
|
14929
|
-
|
|
14930
|
-
|
|
14931
|
-
|
|
14932
|
-
|
|
14938
|
+
var toStr$2 = Object.prototype.toString;
|
|
14939
|
+
|
|
14940
|
+
var isArguments = function isArguments(value) {
|
|
14941
|
+
var str = toStr$2.call(value);
|
|
14942
|
+
var isArgs = str === '[object Arguments]';
|
|
14943
|
+
if (!isArgs) {
|
|
14944
|
+
isArgs = str !== '[object Array]' &&
|
|
14945
|
+
value !== null &&
|
|
14946
|
+
typeof value === 'object' &&
|
|
14947
|
+
typeof value.length === 'number' &&
|
|
14948
|
+
value.length >= 0 &&
|
|
14949
|
+
toStr$2.call(value.callee) === '[object Function]';
|
|
14933
14950
|
}
|
|
14934
|
-
return
|
|
14935
|
-
};
|
|
14936
|
-
|
|
14937
|
-
var
|
|
14938
|
-
|
|
14939
|
-
|
|
14940
|
-
|
|
14941
|
-
if (
|
|
14942
|
-
|
|
14943
|
-
|
|
14944
|
-
|
|
14945
|
-
|
|
14946
|
-
|
|
14947
|
-
|
|
14948
|
-
|
|
14949
|
-
|
|
14950
|
-
|
|
14951
|
+
return isArgs;
|
|
14952
|
+
};
|
|
14953
|
+
|
|
14954
|
+
var implementation$4;
|
|
14955
|
+
var hasRequiredImplementation;
|
|
14956
|
+
|
|
14957
|
+
function requireImplementation () {
|
|
14958
|
+
if (hasRequiredImplementation) return implementation$4;
|
|
14959
|
+
hasRequiredImplementation = 1;
|
|
14960
|
+
|
|
14961
|
+
var keysShim;
|
|
14962
|
+
if (!Object.keys) {
|
|
14963
|
+
// modified from https://github.com/es-shims/es5-shim
|
|
14964
|
+
var has = Object.prototype.hasOwnProperty;
|
|
14965
|
+
var toStr = Object.prototype.toString;
|
|
14966
|
+
var isArgs = isArguments; // eslint-disable-line global-require
|
|
14967
|
+
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
|
14968
|
+
var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
|
|
14969
|
+
var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
|
|
14970
|
+
var dontEnums = [
|
|
14971
|
+
'toString',
|
|
14972
|
+
'toLocaleString',
|
|
14973
|
+
'valueOf',
|
|
14974
|
+
'hasOwnProperty',
|
|
14975
|
+
'isPrototypeOf',
|
|
14976
|
+
'propertyIsEnumerable',
|
|
14977
|
+
'constructor'
|
|
14978
|
+
];
|
|
14979
|
+
var equalsConstructorPrototype = function (o) {
|
|
14980
|
+
var ctor = o.constructor;
|
|
14981
|
+
return ctor && ctor.prototype === o;
|
|
14982
|
+
};
|
|
14983
|
+
var excludedKeys = {
|
|
14984
|
+
$applicationCache: true,
|
|
14985
|
+
$console: true,
|
|
14986
|
+
$external: true,
|
|
14987
|
+
$frame: true,
|
|
14988
|
+
$frameElement: true,
|
|
14989
|
+
$frames: true,
|
|
14990
|
+
$innerHeight: true,
|
|
14991
|
+
$innerWidth: true,
|
|
14992
|
+
$onmozfullscreenchange: true,
|
|
14993
|
+
$onmozfullscreenerror: true,
|
|
14994
|
+
$outerHeight: true,
|
|
14995
|
+
$outerWidth: true,
|
|
14996
|
+
$pageXOffset: true,
|
|
14997
|
+
$pageYOffset: true,
|
|
14998
|
+
$parent: true,
|
|
14999
|
+
$scrollLeft: true,
|
|
15000
|
+
$scrollTop: true,
|
|
15001
|
+
$scrollX: true,
|
|
15002
|
+
$scrollY: true,
|
|
15003
|
+
$self: true,
|
|
15004
|
+
$webkitIndexedDB: true,
|
|
15005
|
+
$webkitStorageInfo: true,
|
|
15006
|
+
$window: true
|
|
15007
|
+
};
|
|
15008
|
+
var hasAutomationEqualityBug = (function () {
|
|
15009
|
+
/* global window */
|
|
15010
|
+
if (typeof window === 'undefined') { return false; }
|
|
15011
|
+
for (var k in window) {
|
|
15012
|
+
try {
|
|
15013
|
+
if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
|
|
15014
|
+
try {
|
|
15015
|
+
equalsConstructorPrototype(window[k]);
|
|
15016
|
+
} catch (e) {
|
|
15017
|
+
return true;
|
|
15018
|
+
}
|
|
15019
|
+
}
|
|
15020
|
+
} catch (e) {
|
|
15021
|
+
return true;
|
|
15022
|
+
}
|
|
15023
|
+
}
|
|
15024
|
+
return false;
|
|
15025
|
+
}());
|
|
15026
|
+
var equalsConstructorPrototypeIfNotBuggy = function (o) {
|
|
15027
|
+
/* global window */
|
|
15028
|
+
if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
|
|
15029
|
+
return equalsConstructorPrototype(o);
|
|
15030
|
+
}
|
|
15031
|
+
try {
|
|
15032
|
+
return equalsConstructorPrototype(o);
|
|
15033
|
+
} catch (e) {
|
|
15034
|
+
return false;
|
|
15035
|
+
}
|
|
15036
|
+
};
|
|
15037
|
+
|
|
15038
|
+
keysShim = function keys(object) {
|
|
15039
|
+
var isObject = object !== null && typeof object === 'object';
|
|
15040
|
+
var isFunction = toStr.call(object) === '[object Function]';
|
|
15041
|
+
var isArguments = isArgs(object);
|
|
15042
|
+
var isString = isObject && toStr.call(object) === '[object String]';
|
|
15043
|
+
var theKeys = [];
|
|
15044
|
+
|
|
15045
|
+
if (!isObject && !isFunction && !isArguments) {
|
|
15046
|
+
throw new TypeError('Object.keys called on a non-object');
|
|
15047
|
+
}
|
|
15048
|
+
|
|
15049
|
+
var skipProto = hasProtoEnumBug && isFunction;
|
|
15050
|
+
if (isString && object.length > 0 && !has.call(object, 0)) {
|
|
15051
|
+
for (var i = 0; i < object.length; ++i) {
|
|
15052
|
+
theKeys.push(String(i));
|
|
15053
|
+
}
|
|
15054
|
+
}
|
|
15055
|
+
|
|
15056
|
+
if (isArguments && object.length > 0) {
|
|
15057
|
+
for (var j = 0; j < object.length; ++j) {
|
|
15058
|
+
theKeys.push(String(j));
|
|
15059
|
+
}
|
|
15060
|
+
} else {
|
|
15061
|
+
for (var name in object) {
|
|
15062
|
+
if (!(skipProto && name === 'prototype') && has.call(object, name)) {
|
|
15063
|
+
theKeys.push(String(name));
|
|
15064
|
+
}
|
|
15065
|
+
}
|
|
15066
|
+
}
|
|
15067
|
+
|
|
15068
|
+
if (hasDontEnumBug) {
|
|
15069
|
+
var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
|
|
15070
|
+
|
|
15071
|
+
for (var k = 0; k < dontEnums.length; ++k) {
|
|
15072
|
+
if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
|
|
15073
|
+
theKeys.push(dontEnums[k]);
|
|
15074
|
+
}
|
|
15075
|
+
}
|
|
15076
|
+
}
|
|
15077
|
+
return theKeys;
|
|
15078
|
+
};
|
|
15079
|
+
}
|
|
15080
|
+
implementation$4 = keysShim;
|
|
15081
|
+
return implementation$4;
|
|
15082
|
+
}
|
|
15083
|
+
|
|
15084
|
+
var slice$2 = Array.prototype.slice;
|
|
15085
|
+
var isArgs = isArguments;
|
|
15086
|
+
|
|
15087
|
+
var origKeys = Object.keys;
|
|
15088
|
+
var keysShim = origKeys ? function keys(o) { return origKeys(o); } : requireImplementation();
|
|
15089
|
+
|
|
15090
|
+
var originalKeys = Object.keys;
|
|
15091
|
+
|
|
15092
|
+
keysShim.shim = function shimObjectKeys() {
|
|
15093
|
+
if (Object.keys) {
|
|
15094
|
+
var keysWorksWithArguments = (function () {
|
|
15095
|
+
// Safari 5.0 bug
|
|
15096
|
+
var args = Object.keys(arguments);
|
|
15097
|
+
return args && args.length === arguments.length;
|
|
15098
|
+
}(1, 2));
|
|
15099
|
+
if (!keysWorksWithArguments) {
|
|
15100
|
+
Object.keys = function keys(object) { // eslint-disable-line func-name-matching
|
|
15101
|
+
if (isArgs(object)) {
|
|
15102
|
+
return originalKeys(slice$2.call(object));
|
|
15103
|
+
}
|
|
15104
|
+
return originalKeys(object);
|
|
14951
15105
|
};
|
|
15106
|
+
}
|
|
15107
|
+
} else {
|
|
15108
|
+
Object.keys = keysShim;
|
|
15109
|
+
}
|
|
15110
|
+
return Object.keys || keysShim;
|
|
15111
|
+
};
|
|
15112
|
+
|
|
15113
|
+
var objectKeys$1 = keysShim;
|
|
15114
|
+
|
|
15115
|
+
var callBind$1 = {exports: {}};
|
|
15116
|
+
|
|
15117
|
+
/* eslint no-invalid-this: 1 */
|
|
15118
|
+
|
|
15119
|
+
var ERROR_MESSAGE$1 = 'Function.prototype.bind called on incompatible ';
|
|
15120
|
+
var toStr$1 = Object.prototype.toString;
|
|
15121
|
+
var max = Math.max;
|
|
15122
|
+
var funcType$1 = '[object Function]';
|
|
15123
|
+
|
|
15124
|
+
var concatty = function concatty(a, b) {
|
|
15125
|
+
var arr = [];
|
|
15126
|
+
|
|
15127
|
+
for (var i = 0; i < a.length; i += 1) {
|
|
15128
|
+
arr[i] = a[i];
|
|
15129
|
+
}
|
|
15130
|
+
for (var j = 0; j < b.length; j += 1) {
|
|
15131
|
+
arr[j + a.length] = b[j];
|
|
15132
|
+
}
|
|
15133
|
+
|
|
15134
|
+
return arr;
|
|
15135
|
+
};
|
|
15136
|
+
|
|
15137
|
+
var slicy = function slicy(arrLike, offset) {
|
|
15138
|
+
var arr = [];
|
|
15139
|
+
for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
|
|
15140
|
+
arr[j] = arrLike[i];
|
|
15141
|
+
}
|
|
15142
|
+
return arr;
|
|
15143
|
+
};
|
|
15144
|
+
|
|
15145
|
+
var joiny = function (arr, joiner) {
|
|
15146
|
+
var str = '';
|
|
15147
|
+
for (var i = 0; i < arr.length; i += 1) {
|
|
15148
|
+
str += arr[i];
|
|
15149
|
+
if (i + 1 < arr.length) {
|
|
15150
|
+
str += joiner;
|
|
15151
|
+
}
|
|
15152
|
+
}
|
|
15153
|
+
return str;
|
|
15154
|
+
};
|
|
15155
|
+
|
|
15156
|
+
var implementation$3 = function bind(that) {
|
|
15157
|
+
var target = this;
|
|
15158
|
+
if (typeof target !== 'function' || toStr$1.apply(target) !== funcType$1) {
|
|
15159
|
+
throw new TypeError(ERROR_MESSAGE$1 + target);
|
|
15160
|
+
}
|
|
15161
|
+
var args = slicy(arguments, 1);
|
|
15162
|
+
|
|
15163
|
+
var bound;
|
|
15164
|
+
var binder = function () {
|
|
15165
|
+
if (this instanceof bound) {
|
|
15166
|
+
var result = target.apply(
|
|
15167
|
+
this,
|
|
15168
|
+
concatty(args, arguments)
|
|
15169
|
+
);
|
|
15170
|
+
if (Object(result) === result) {
|
|
15171
|
+
return result;
|
|
15172
|
+
}
|
|
15173
|
+
return this;
|
|
15174
|
+
}
|
|
15175
|
+
return target.apply(
|
|
15176
|
+
that,
|
|
15177
|
+
concatty(args, arguments)
|
|
15178
|
+
);
|
|
15179
|
+
|
|
15180
|
+
};
|
|
15181
|
+
|
|
15182
|
+
var boundLength = max(0, target.length - args.length);
|
|
15183
|
+
var boundArgs = [];
|
|
15184
|
+
for (var i = 0; i < boundLength; i++) {
|
|
15185
|
+
boundArgs[i] = '$' + i;
|
|
15186
|
+
}
|
|
15187
|
+
|
|
15188
|
+
bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder);
|
|
15189
|
+
|
|
15190
|
+
if (target.prototype) {
|
|
15191
|
+
var Empty = function Empty() {};
|
|
15192
|
+
Empty.prototype = target.prototype;
|
|
15193
|
+
bound.prototype = new Empty();
|
|
15194
|
+
Empty.prototype = null;
|
|
15195
|
+
}
|
|
15196
|
+
|
|
15197
|
+
return bound;
|
|
15198
|
+
};
|
|
15199
|
+
|
|
15200
|
+
var implementation$2 = implementation$3;
|
|
15201
|
+
|
|
15202
|
+
var functionBind$1 = Function.prototype.bind || implementation$2;
|
|
15203
|
+
|
|
15204
|
+
/* eslint complexity: [2, 18], max-statements: [2, 33] */
|
|
15205
|
+
var shams = function hasSymbols() {
|
|
15206
|
+
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
|
|
15207
|
+
if (typeof Symbol.iterator === 'symbol') { return true; }
|
|
15208
|
+
|
|
15209
|
+
var obj = {};
|
|
15210
|
+
var sym = Symbol('test');
|
|
15211
|
+
var symObj = Object(sym);
|
|
15212
|
+
if (typeof sym === 'string') { return false; }
|
|
15213
|
+
|
|
15214
|
+
if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
|
|
15215
|
+
if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
|
|
15216
|
+
|
|
15217
|
+
// temp disabled per https://github.com/ljharb/object.assign/issues/17
|
|
15218
|
+
// if (sym instanceof Symbol) { return false; }
|
|
15219
|
+
// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
|
|
15220
|
+
// if (!(symObj instanceof Symbol)) { return false; }
|
|
15221
|
+
|
|
15222
|
+
// if (typeof Symbol.prototype.toString !== 'function') { return false; }
|
|
15223
|
+
// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
|
|
15224
|
+
|
|
15225
|
+
var symVal = 42;
|
|
15226
|
+
obj[sym] = symVal;
|
|
15227
|
+
for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
|
|
15228
|
+
if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
|
|
15229
|
+
|
|
15230
|
+
if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
|
|
15231
|
+
|
|
15232
|
+
var syms = Object.getOwnPropertySymbols(obj);
|
|
15233
|
+
if (syms.length !== 1 || syms[0] !== sym) { return false; }
|
|
15234
|
+
|
|
15235
|
+
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
|
|
15236
|
+
|
|
15237
|
+
if (typeof Object.getOwnPropertyDescriptor === 'function') {
|
|
15238
|
+
var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
|
|
15239
|
+
if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
|
|
15240
|
+
}
|
|
15241
|
+
|
|
15242
|
+
return true;
|
|
15243
|
+
};
|
|
15244
|
+
|
|
15245
|
+
var origSymbol = typeof Symbol !== 'undefined' && Symbol;
|
|
15246
|
+
var hasSymbolSham = shams;
|
|
15247
|
+
|
|
15248
|
+
var hasSymbols$1 = function hasNativeSymbols() {
|
|
15249
|
+
if (typeof origSymbol !== 'function') { return false; }
|
|
15250
|
+
if (typeof Symbol !== 'function') { return false; }
|
|
15251
|
+
if (typeof origSymbol('foo') !== 'symbol') { return false; }
|
|
15252
|
+
if (typeof Symbol('bar') !== 'symbol') { return false; }
|
|
15253
|
+
|
|
15254
|
+
return hasSymbolSham();
|
|
15255
|
+
};
|
|
15256
|
+
|
|
15257
|
+
var test = {
|
|
15258
|
+
foo: {}
|
|
15259
|
+
};
|
|
15260
|
+
|
|
15261
|
+
var $Object = Object;
|
|
15262
|
+
|
|
15263
|
+
var hasProto$1 = function hasProto() {
|
|
15264
|
+
return { __proto__: test }.foo === test.foo && !({ __proto__: null } instanceof $Object);
|
|
15265
|
+
};
|
|
15266
|
+
|
|
15267
|
+
/* eslint no-invalid-this: 1 */
|
|
15268
|
+
|
|
15269
|
+
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
|
|
15270
|
+
var slice$1 = Array.prototype.slice;
|
|
15271
|
+
var toStr = Object.prototype.toString;
|
|
15272
|
+
var funcType = '[object Function]';
|
|
15273
|
+
|
|
15274
|
+
var implementation$1 = function bind(that) {
|
|
15275
|
+
var target = this;
|
|
15276
|
+
if (typeof target !== 'function' || toStr.call(target) !== funcType) {
|
|
15277
|
+
throw new TypeError(ERROR_MESSAGE + target);
|
|
15278
|
+
}
|
|
15279
|
+
var args = slice$1.call(arguments, 1);
|
|
15280
|
+
|
|
15281
|
+
var bound;
|
|
15282
|
+
var binder = function () {
|
|
15283
|
+
if (this instanceof bound) {
|
|
15284
|
+
var result = target.apply(
|
|
15285
|
+
this,
|
|
15286
|
+
args.concat(slice$1.call(arguments))
|
|
15287
|
+
);
|
|
15288
|
+
if (Object(result) === result) {
|
|
15289
|
+
return result;
|
|
15290
|
+
}
|
|
15291
|
+
return this;
|
|
15292
|
+
} else {
|
|
15293
|
+
return target.apply(
|
|
15294
|
+
that,
|
|
15295
|
+
args.concat(slice$1.call(arguments))
|
|
15296
|
+
);
|
|
15297
|
+
}
|
|
15298
|
+
};
|
|
15299
|
+
|
|
15300
|
+
var boundLength = Math.max(0, target.length - args.length);
|
|
15301
|
+
var boundArgs = [];
|
|
15302
|
+
for (var i = 0; i < boundLength; i++) {
|
|
15303
|
+
boundArgs.push('$' + i);
|
|
15304
|
+
}
|
|
15305
|
+
|
|
15306
|
+
bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
|
|
15307
|
+
|
|
15308
|
+
if (target.prototype) {
|
|
15309
|
+
var Empty = function Empty() {};
|
|
15310
|
+
Empty.prototype = target.prototype;
|
|
15311
|
+
bound.prototype = new Empty();
|
|
15312
|
+
Empty.prototype = null;
|
|
15313
|
+
}
|
|
15314
|
+
|
|
15315
|
+
return bound;
|
|
15316
|
+
};
|
|
15317
|
+
|
|
15318
|
+
var implementation = implementation$1;
|
|
15319
|
+
|
|
15320
|
+
var functionBind = Function.prototype.bind || implementation;
|
|
15321
|
+
|
|
15322
|
+
var bind$1 = functionBind;
|
|
15323
|
+
|
|
15324
|
+
var src$2 = bind$1.call(Function.call, Object.prototype.hasOwnProperty);
|
|
15325
|
+
|
|
15326
|
+
var undefined$1;
|
|
15327
|
+
|
|
15328
|
+
var $SyntaxError$1 = SyntaxError;
|
|
15329
|
+
var $Function = Function;
|
|
15330
|
+
var $TypeError$2 = TypeError;
|
|
15331
|
+
|
|
15332
|
+
// eslint-disable-next-line consistent-return
|
|
15333
|
+
var getEvalledConstructor = function (expressionSyntax) {
|
|
15334
|
+
try {
|
|
15335
|
+
return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
|
|
15336
|
+
} catch (e) {}
|
|
15337
|
+
};
|
|
15338
|
+
|
|
15339
|
+
var $gOPD$1 = Object.getOwnPropertyDescriptor;
|
|
15340
|
+
|
|
15341
|
+
var throwTypeError = function () {
|
|
15342
|
+
throw new $TypeError$2();
|
|
15343
|
+
};
|
|
15344
|
+
var ThrowTypeError = $gOPD$1
|
|
15345
|
+
? (function () {
|
|
15346
|
+
try {
|
|
15347
|
+
return throwTypeError;
|
|
15348
|
+
} catch (calleeThrows) {
|
|
15349
|
+
try {
|
|
15350
|
+
// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
|
|
15351
|
+
return $gOPD$1(arguments, 'callee').get;
|
|
15352
|
+
} catch (gOPDthrows) {
|
|
15353
|
+
return throwTypeError;
|
|
15354
|
+
}
|
|
15355
|
+
}
|
|
15356
|
+
}())
|
|
15357
|
+
: throwTypeError;
|
|
15358
|
+
|
|
15359
|
+
var hasSymbols = hasSymbols$1();
|
|
15360
|
+
var hasProto = hasProto$1();
|
|
15361
|
+
|
|
15362
|
+
var getProto = Object.getPrototypeOf || (
|
|
15363
|
+
hasProto
|
|
15364
|
+
? function (x) { return x.__proto__; } // eslint-disable-line no-proto
|
|
15365
|
+
: null
|
|
15366
|
+
);
|
|
15367
|
+
|
|
15368
|
+
var needsEval = {};
|
|
15369
|
+
|
|
15370
|
+
var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined$1 : getProto(Uint8Array);
|
|
15371
|
+
|
|
15372
|
+
var INTRINSICS = {
|
|
15373
|
+
'%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
|
|
15374
|
+
'%Array%': Array,
|
|
15375
|
+
'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
|
|
15376
|
+
'%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined$1,
|
|
15377
|
+
'%AsyncFromSyncIteratorPrototype%': undefined$1,
|
|
15378
|
+
'%AsyncFunction%': needsEval,
|
|
15379
|
+
'%AsyncGenerator%': needsEval,
|
|
15380
|
+
'%AsyncGeneratorFunction%': needsEval,
|
|
15381
|
+
'%AsyncIteratorPrototype%': needsEval,
|
|
15382
|
+
'%Atomics%': typeof Atomics === 'undefined' ? undefined$1 : Atomics,
|
|
15383
|
+
'%BigInt%': typeof BigInt === 'undefined' ? undefined$1 : BigInt,
|
|
15384
|
+
'%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined$1 : BigInt64Array,
|
|
15385
|
+
'%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined$1 : BigUint64Array,
|
|
15386
|
+
'%Boolean%': Boolean,
|
|
15387
|
+
'%DataView%': typeof DataView === 'undefined' ? undefined$1 : DataView,
|
|
15388
|
+
'%Date%': Date,
|
|
15389
|
+
'%decodeURI%': decodeURI,
|
|
15390
|
+
'%decodeURIComponent%': decodeURIComponent,
|
|
15391
|
+
'%encodeURI%': encodeURI,
|
|
15392
|
+
'%encodeURIComponent%': encodeURIComponent,
|
|
15393
|
+
'%Error%': Error,
|
|
15394
|
+
'%eval%': eval, // eslint-disable-line no-eval
|
|
15395
|
+
'%EvalError%': EvalError,
|
|
15396
|
+
'%Float32Array%': typeof Float32Array === 'undefined' ? undefined$1 : Float32Array,
|
|
15397
|
+
'%Float64Array%': typeof Float64Array === 'undefined' ? undefined$1 : Float64Array,
|
|
15398
|
+
'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined$1 : FinalizationRegistry,
|
|
15399
|
+
'%Function%': $Function,
|
|
15400
|
+
'%GeneratorFunction%': needsEval,
|
|
15401
|
+
'%Int8Array%': typeof Int8Array === 'undefined' ? undefined$1 : Int8Array,
|
|
15402
|
+
'%Int16Array%': typeof Int16Array === 'undefined' ? undefined$1 : Int16Array,
|
|
15403
|
+
'%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
|
|
15404
|
+
'%isFinite%': isFinite,
|
|
15405
|
+
'%isNaN%': isNaN,
|
|
15406
|
+
'%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
|
|
15407
|
+
'%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
|
|
15408
|
+
'%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
|
|
15409
|
+
'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined$1 : getProto(new Map()[Symbol.iterator]()),
|
|
15410
|
+
'%Math%': Math,
|
|
15411
|
+
'%Number%': Number,
|
|
15412
|
+
'%Object%': Object,
|
|
15413
|
+
'%parseFloat%': parseFloat,
|
|
15414
|
+
'%parseInt%': parseInt,
|
|
15415
|
+
'%Promise%': typeof Promise === 'undefined' ? undefined$1 : Promise,
|
|
15416
|
+
'%Proxy%': typeof Proxy === 'undefined' ? undefined$1 : Proxy,
|
|
15417
|
+
'%RangeError%': RangeError,
|
|
15418
|
+
'%ReferenceError%': ReferenceError,
|
|
15419
|
+
'%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
|
|
15420
|
+
'%RegExp%': RegExp,
|
|
15421
|
+
'%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
|
|
15422
|
+
'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined$1 : getProto(new Set()[Symbol.iterator]()),
|
|
15423
|
+
'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
|
|
15424
|
+
'%String%': String,
|
|
15425
|
+
'%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined$1,
|
|
15426
|
+
'%Symbol%': hasSymbols ? Symbol : undefined$1,
|
|
15427
|
+
'%SyntaxError%': $SyntaxError$1,
|
|
15428
|
+
'%ThrowTypeError%': ThrowTypeError,
|
|
15429
|
+
'%TypedArray%': TypedArray,
|
|
15430
|
+
'%TypeError%': $TypeError$2,
|
|
15431
|
+
'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array,
|
|
15432
|
+
'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined$1 : Uint8ClampedArray,
|
|
15433
|
+
'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined$1 : Uint16Array,
|
|
15434
|
+
'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined$1 : Uint32Array,
|
|
15435
|
+
'%URIError%': URIError,
|
|
15436
|
+
'%WeakMap%': typeof WeakMap === 'undefined' ? undefined$1 : WeakMap,
|
|
15437
|
+
'%WeakRef%': typeof WeakRef === 'undefined' ? undefined$1 : WeakRef,
|
|
15438
|
+
'%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet
|
|
15439
|
+
};
|
|
15440
|
+
|
|
15441
|
+
var doEval = function doEval(name) {
|
|
15442
|
+
var value;
|
|
15443
|
+
if (name === '%AsyncFunction%') {
|
|
15444
|
+
value = getEvalledConstructor('async function () {}');
|
|
15445
|
+
} else if (name === '%GeneratorFunction%') {
|
|
15446
|
+
value = getEvalledConstructor('function* () {}');
|
|
15447
|
+
} else if (name === '%AsyncGeneratorFunction%') {
|
|
15448
|
+
value = getEvalledConstructor('async function* () {}');
|
|
15449
|
+
} else if (name === '%AsyncGenerator%') {
|
|
15450
|
+
var fn = doEval('%AsyncGeneratorFunction%');
|
|
15451
|
+
if (fn) {
|
|
15452
|
+
value = fn.prototype;
|
|
15453
|
+
}
|
|
15454
|
+
} else if (name === '%AsyncIteratorPrototype%') {
|
|
15455
|
+
var gen = doEval('%AsyncGenerator%');
|
|
15456
|
+
if (gen && getProto) {
|
|
15457
|
+
value = getProto(gen.prototype);
|
|
15458
|
+
}
|
|
15459
|
+
}
|
|
15460
|
+
|
|
15461
|
+
INTRINSICS[name] = value;
|
|
15462
|
+
|
|
15463
|
+
return value;
|
|
15464
|
+
};
|
|
15465
|
+
|
|
15466
|
+
var LEGACY_ALIASES = {
|
|
15467
|
+
'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
|
|
15468
|
+
'%ArrayPrototype%': ['Array', 'prototype'],
|
|
15469
|
+
'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
|
|
15470
|
+
'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
|
|
15471
|
+
'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
|
|
15472
|
+
'%ArrayProto_values%': ['Array', 'prototype', 'values'],
|
|
15473
|
+
'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
|
|
15474
|
+
'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
|
|
15475
|
+
'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
|
|
15476
|
+
'%BooleanPrototype%': ['Boolean', 'prototype'],
|
|
15477
|
+
'%DataViewPrototype%': ['DataView', 'prototype'],
|
|
15478
|
+
'%DatePrototype%': ['Date', 'prototype'],
|
|
15479
|
+
'%ErrorPrototype%': ['Error', 'prototype'],
|
|
15480
|
+
'%EvalErrorPrototype%': ['EvalError', 'prototype'],
|
|
15481
|
+
'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
|
|
15482
|
+
'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
|
|
15483
|
+
'%FunctionPrototype%': ['Function', 'prototype'],
|
|
15484
|
+
'%Generator%': ['GeneratorFunction', 'prototype'],
|
|
15485
|
+
'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
|
|
15486
|
+
'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
|
|
15487
|
+
'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
|
|
15488
|
+
'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
|
|
15489
|
+
'%JSONParse%': ['JSON', 'parse'],
|
|
15490
|
+
'%JSONStringify%': ['JSON', 'stringify'],
|
|
15491
|
+
'%MapPrototype%': ['Map', 'prototype'],
|
|
15492
|
+
'%NumberPrototype%': ['Number', 'prototype'],
|
|
15493
|
+
'%ObjectPrototype%': ['Object', 'prototype'],
|
|
15494
|
+
'%ObjProto_toString%': ['Object', 'prototype', 'toString'],
|
|
15495
|
+
'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
|
|
15496
|
+
'%PromisePrototype%': ['Promise', 'prototype'],
|
|
15497
|
+
'%PromiseProto_then%': ['Promise', 'prototype', 'then'],
|
|
15498
|
+
'%Promise_all%': ['Promise', 'all'],
|
|
15499
|
+
'%Promise_reject%': ['Promise', 'reject'],
|
|
15500
|
+
'%Promise_resolve%': ['Promise', 'resolve'],
|
|
15501
|
+
'%RangeErrorPrototype%': ['RangeError', 'prototype'],
|
|
15502
|
+
'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
|
|
15503
|
+
'%RegExpPrototype%': ['RegExp', 'prototype'],
|
|
15504
|
+
'%SetPrototype%': ['Set', 'prototype'],
|
|
15505
|
+
'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
|
|
15506
|
+
'%StringPrototype%': ['String', 'prototype'],
|
|
15507
|
+
'%SymbolPrototype%': ['Symbol', 'prototype'],
|
|
15508
|
+
'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
|
|
15509
|
+
'%TypedArrayPrototype%': ['TypedArray', 'prototype'],
|
|
15510
|
+
'%TypeErrorPrototype%': ['TypeError', 'prototype'],
|
|
15511
|
+
'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
|
|
15512
|
+
'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
|
|
15513
|
+
'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
|
|
15514
|
+
'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
|
|
15515
|
+
'%URIErrorPrototype%': ['URIError', 'prototype'],
|
|
15516
|
+
'%WeakMapPrototype%': ['WeakMap', 'prototype'],
|
|
15517
|
+
'%WeakSetPrototype%': ['WeakSet', 'prototype']
|
|
15518
|
+
};
|
|
15519
|
+
|
|
15520
|
+
var bind = functionBind$1;
|
|
15521
|
+
var hasOwn$1 = src$2;
|
|
15522
|
+
var $concat = bind.call(Function.call, Array.prototype.concat);
|
|
15523
|
+
var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
|
|
15524
|
+
var $replace = bind.call(Function.call, String.prototype.replace);
|
|
15525
|
+
var $strSlice = bind.call(Function.call, String.prototype.slice);
|
|
15526
|
+
var $exec = bind.call(Function.call, RegExp.prototype.exec);
|
|
15527
|
+
|
|
15528
|
+
/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
|
|
15529
|
+
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
|
|
15530
|
+
var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
|
|
15531
|
+
var stringToPath = function stringToPath(string) {
|
|
15532
|
+
var first = $strSlice(string, 0, 1);
|
|
15533
|
+
var last = $strSlice(string, -1);
|
|
15534
|
+
if (first === '%' && last !== '%') {
|
|
15535
|
+
throw new $SyntaxError$1('invalid intrinsic syntax, expected closing `%`');
|
|
15536
|
+
} else if (last === '%' && first !== '%') {
|
|
15537
|
+
throw new $SyntaxError$1('invalid intrinsic syntax, expected opening `%`');
|
|
15538
|
+
}
|
|
15539
|
+
var result = [];
|
|
15540
|
+
$replace(string, rePropName, function (match, number, quote, subString) {
|
|
15541
|
+
result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
|
|
15542
|
+
});
|
|
15543
|
+
return result;
|
|
15544
|
+
};
|
|
15545
|
+
/* end adaptation */
|
|
15546
|
+
|
|
15547
|
+
var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
|
|
15548
|
+
var intrinsicName = name;
|
|
15549
|
+
var alias;
|
|
15550
|
+
if (hasOwn$1(LEGACY_ALIASES, intrinsicName)) {
|
|
15551
|
+
alias = LEGACY_ALIASES[intrinsicName];
|
|
15552
|
+
intrinsicName = '%' + alias[0] + '%';
|
|
15553
|
+
}
|
|
15554
|
+
|
|
15555
|
+
if (hasOwn$1(INTRINSICS, intrinsicName)) {
|
|
15556
|
+
var value = INTRINSICS[intrinsicName];
|
|
15557
|
+
if (value === needsEval) {
|
|
15558
|
+
value = doEval(intrinsicName);
|
|
15559
|
+
}
|
|
15560
|
+
if (typeof value === 'undefined' && !allowMissing) {
|
|
15561
|
+
throw new $TypeError$2('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
|
|
15562
|
+
}
|
|
15563
|
+
|
|
15564
|
+
return {
|
|
15565
|
+
alias: alias,
|
|
15566
|
+
name: intrinsicName,
|
|
15567
|
+
value: value
|
|
15568
|
+
};
|
|
15569
|
+
}
|
|
15570
|
+
|
|
15571
|
+
throw new $SyntaxError$1('intrinsic ' + name + ' does not exist!');
|
|
15572
|
+
};
|
|
15573
|
+
|
|
15574
|
+
var getIntrinsic = function GetIntrinsic(name, allowMissing) {
|
|
15575
|
+
if (typeof name !== 'string' || name.length === 0) {
|
|
15576
|
+
throw new $TypeError$2('intrinsic name must be a non-empty string');
|
|
15577
|
+
}
|
|
15578
|
+
if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
|
|
15579
|
+
throw new $TypeError$2('"allowMissing" argument must be a boolean');
|
|
15580
|
+
}
|
|
15581
|
+
|
|
15582
|
+
if ($exec(/^%?[^%]*%?$/, name) === null) {
|
|
15583
|
+
throw new $SyntaxError$1('`%` may not be present anywhere but at the beginning and end of the intrinsic name');
|
|
15584
|
+
}
|
|
15585
|
+
var parts = stringToPath(name);
|
|
15586
|
+
var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
|
|
15587
|
+
|
|
15588
|
+
var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
|
|
15589
|
+
var intrinsicRealName = intrinsic.name;
|
|
15590
|
+
var value = intrinsic.value;
|
|
15591
|
+
var skipFurtherCaching = false;
|
|
15592
|
+
|
|
15593
|
+
var alias = intrinsic.alias;
|
|
15594
|
+
if (alias) {
|
|
15595
|
+
intrinsicBaseName = alias[0];
|
|
15596
|
+
$spliceApply(parts, $concat([0, 1], alias));
|
|
15597
|
+
}
|
|
15598
|
+
|
|
15599
|
+
for (var i = 1, isOwn = true; i < parts.length; i += 1) {
|
|
15600
|
+
var part = parts[i];
|
|
15601
|
+
var first = $strSlice(part, 0, 1);
|
|
15602
|
+
var last = $strSlice(part, -1);
|
|
15603
|
+
if (
|
|
15604
|
+
(
|
|
15605
|
+
(first === '"' || first === "'" || first === '`')
|
|
15606
|
+
|| (last === '"' || last === "'" || last === '`')
|
|
15607
|
+
)
|
|
15608
|
+
&& first !== last
|
|
15609
|
+
) {
|
|
15610
|
+
throw new $SyntaxError$1('property names with quotes must have matching quotes');
|
|
15611
|
+
}
|
|
15612
|
+
if (part === 'constructor' || !isOwn) {
|
|
15613
|
+
skipFurtherCaching = true;
|
|
15614
|
+
}
|
|
15615
|
+
|
|
15616
|
+
intrinsicBaseName += '.' + part;
|
|
15617
|
+
intrinsicRealName = '%' + intrinsicBaseName + '%';
|
|
15618
|
+
|
|
15619
|
+
if (hasOwn$1(INTRINSICS, intrinsicRealName)) {
|
|
15620
|
+
value = INTRINSICS[intrinsicRealName];
|
|
15621
|
+
} else if (value != null) {
|
|
15622
|
+
if (!(part in value)) {
|
|
15623
|
+
if (!allowMissing) {
|
|
15624
|
+
throw new $TypeError$2('base intrinsic for ' + name + ' exists, but the property is not available.');
|
|
15625
|
+
}
|
|
15626
|
+
return void undefined$1;
|
|
15627
|
+
}
|
|
15628
|
+
if ($gOPD$1 && (i + 1) >= parts.length) {
|
|
15629
|
+
var desc = $gOPD$1(value, part);
|
|
15630
|
+
isOwn = !!desc;
|
|
15631
|
+
|
|
15632
|
+
// By convention, when a data property is converted to an accessor
|
|
15633
|
+
// property to emulate a data property that does not suffer from
|
|
15634
|
+
// the override mistake, that accessor's getter is marked with
|
|
15635
|
+
// an `originalValue` property. Here, when we detect this, we
|
|
15636
|
+
// uphold the illusion by pretending to see that original data
|
|
15637
|
+
// property, i.e., returning the value rather than the getter
|
|
15638
|
+
// itself.
|
|
15639
|
+
if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
|
|
15640
|
+
value = desc.get;
|
|
15641
|
+
} else {
|
|
15642
|
+
value = value[part];
|
|
15643
|
+
}
|
|
15644
|
+
} else {
|
|
15645
|
+
isOwn = hasOwn$1(value, part);
|
|
15646
|
+
value = value[part];
|
|
15647
|
+
}
|
|
15648
|
+
|
|
15649
|
+
if (isOwn && !skipFurtherCaching) {
|
|
15650
|
+
INTRINSICS[intrinsicRealName] = value;
|
|
15651
|
+
}
|
|
15652
|
+
}
|
|
15653
|
+
}
|
|
15654
|
+
return value;
|
|
15655
|
+
};
|
|
15656
|
+
|
|
15657
|
+
var GetIntrinsic$3 = getIntrinsic;
|
|
15658
|
+
|
|
15659
|
+
var $defineProperty$1 = GetIntrinsic$3('%Object.defineProperty%', true);
|
|
15660
|
+
|
|
15661
|
+
var hasPropertyDescriptors$1 = function hasPropertyDescriptors() {
|
|
15662
|
+
if ($defineProperty$1) {
|
|
15663
|
+
try {
|
|
15664
|
+
$defineProperty$1({}, 'a', { value: 1 });
|
|
15665
|
+
return true;
|
|
15666
|
+
} catch (e) {
|
|
15667
|
+
// IE 8 has a broken defineProperty
|
|
15668
|
+
return false;
|
|
15669
|
+
}
|
|
15670
|
+
}
|
|
15671
|
+
return false;
|
|
15672
|
+
};
|
|
15673
|
+
|
|
15674
|
+
hasPropertyDescriptors$1.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
|
|
15675
|
+
// node v0.6 has a bug where array lengths can be Set but not Defined
|
|
15676
|
+
if (!hasPropertyDescriptors$1()) {
|
|
15677
|
+
return null;
|
|
15678
|
+
}
|
|
15679
|
+
try {
|
|
15680
|
+
return $defineProperty$1([], 'length', { value: 1 }).length !== 1;
|
|
15681
|
+
} catch (e) {
|
|
15682
|
+
// In Firefox 4-22, defining length on an array throws an exception.
|
|
15683
|
+
return true;
|
|
15684
|
+
}
|
|
15685
|
+
};
|
|
15686
|
+
|
|
15687
|
+
var hasPropertyDescriptors_1 = hasPropertyDescriptors$1;
|
|
15688
|
+
|
|
15689
|
+
var GetIntrinsic$2 = getIntrinsic;
|
|
15690
|
+
|
|
15691
|
+
var $gOPD = GetIntrinsic$2('%Object.getOwnPropertyDescriptor%', true);
|
|
15692
|
+
|
|
15693
|
+
if ($gOPD) {
|
|
15694
|
+
try {
|
|
15695
|
+
$gOPD([], 'length');
|
|
15696
|
+
} catch (e) {
|
|
15697
|
+
// IE 8 has a broken gOPD
|
|
15698
|
+
$gOPD = null;
|
|
15699
|
+
}
|
|
15700
|
+
}
|
|
15701
|
+
|
|
15702
|
+
var gopd$1 = $gOPD;
|
|
15703
|
+
|
|
15704
|
+
var hasPropertyDescriptors = hasPropertyDescriptors_1();
|
|
15705
|
+
|
|
15706
|
+
var GetIntrinsic$1 = getIntrinsic;
|
|
15707
|
+
|
|
15708
|
+
var $defineProperty = hasPropertyDescriptors && GetIntrinsic$1('%Object.defineProperty%', true);
|
|
15709
|
+
if ($defineProperty) {
|
|
15710
|
+
try {
|
|
15711
|
+
$defineProperty({}, 'a', { value: 1 });
|
|
15712
|
+
} catch (e) {
|
|
15713
|
+
// IE 8 has a broken defineProperty
|
|
15714
|
+
$defineProperty = false;
|
|
15715
|
+
}
|
|
15716
|
+
}
|
|
15717
|
+
|
|
15718
|
+
var $SyntaxError = GetIntrinsic$1('%SyntaxError%');
|
|
15719
|
+
var $TypeError$1 = GetIntrinsic$1('%TypeError%');
|
|
15720
|
+
|
|
15721
|
+
var gopd = gopd$1;
|
|
15722
|
+
|
|
15723
|
+
/** @type {(obj: Record<PropertyKey, unknown>, property: PropertyKey, value: unknown, nonEnumerable?: boolean | null, nonWritable?: boolean | null, nonConfigurable?: boolean | null, loose?: boolean) => void} */
|
|
15724
|
+
var defineDataProperty = function defineDataProperty(
|
|
15725
|
+
obj,
|
|
15726
|
+
property,
|
|
15727
|
+
value
|
|
15728
|
+
) {
|
|
15729
|
+
if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
|
15730
|
+
throw new $TypeError$1('`obj` must be an object or a function`');
|
|
15731
|
+
}
|
|
15732
|
+
if (typeof property !== 'string' && typeof property !== 'symbol') {
|
|
15733
|
+
throw new $TypeError$1('`property` must be a string or a symbol`');
|
|
15734
|
+
}
|
|
15735
|
+
if (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) {
|
|
15736
|
+
throw new $TypeError$1('`nonEnumerable`, if provided, must be a boolean or null');
|
|
15737
|
+
}
|
|
15738
|
+
if (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) {
|
|
15739
|
+
throw new $TypeError$1('`nonWritable`, if provided, must be a boolean or null');
|
|
15740
|
+
}
|
|
15741
|
+
if (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) {
|
|
15742
|
+
throw new $TypeError$1('`nonConfigurable`, if provided, must be a boolean or null');
|
|
15743
|
+
}
|
|
15744
|
+
if (arguments.length > 6 && typeof arguments[6] !== 'boolean') {
|
|
15745
|
+
throw new $TypeError$1('`loose`, if provided, must be a boolean');
|
|
15746
|
+
}
|
|
15747
|
+
|
|
15748
|
+
var nonEnumerable = arguments.length > 3 ? arguments[3] : null;
|
|
15749
|
+
var nonWritable = arguments.length > 4 ? arguments[4] : null;
|
|
15750
|
+
var nonConfigurable = arguments.length > 5 ? arguments[5] : null;
|
|
15751
|
+
var loose = arguments.length > 6 ? arguments[6] : false;
|
|
15752
|
+
|
|
15753
|
+
/* @type {false | TypedPropertyDescriptor<unknown>} */
|
|
15754
|
+
var desc = !!gopd && gopd(obj, property);
|
|
15755
|
+
|
|
15756
|
+
if ($defineProperty) {
|
|
15757
|
+
$defineProperty(obj, property, {
|
|
15758
|
+
configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,
|
|
15759
|
+
enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,
|
|
15760
|
+
value: value,
|
|
15761
|
+
writable: nonWritable === null && desc ? desc.writable : !nonWritable
|
|
15762
|
+
});
|
|
15763
|
+
} else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) {
|
|
15764
|
+
// must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable
|
|
15765
|
+
obj[property] = value; // eslint-disable-line no-param-reassign
|
|
15766
|
+
} else {
|
|
15767
|
+
throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.');
|
|
15768
|
+
}
|
|
15769
|
+
};
|
|
15770
|
+
|
|
15771
|
+
var GetIntrinsic = getIntrinsic;
|
|
15772
|
+
var define = defineDataProperty;
|
|
15773
|
+
var hasDescriptors = hasPropertyDescriptors_1();
|
|
15774
|
+
var gOPD = gopd$1;
|
|
15775
|
+
|
|
15776
|
+
var $TypeError = GetIntrinsic('%TypeError%');
|
|
15777
|
+
var $floor = GetIntrinsic('%Math.floor%');
|
|
15778
|
+
|
|
15779
|
+
var setFunctionLength = function setFunctionLength(fn, length) {
|
|
15780
|
+
if (typeof fn !== 'function') {
|
|
15781
|
+
throw new $TypeError('`fn` is not a function');
|
|
15782
|
+
}
|
|
15783
|
+
if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) {
|
|
15784
|
+
throw new $TypeError('`length` must be a positive 32-bit integer');
|
|
15785
|
+
}
|
|
15786
|
+
|
|
15787
|
+
var loose = arguments.length > 2 && !!arguments[2];
|
|
15788
|
+
|
|
15789
|
+
var functionLengthIsConfigurable = true;
|
|
15790
|
+
var functionLengthIsWritable = true;
|
|
15791
|
+
if ('length' in fn && gOPD) {
|
|
15792
|
+
var desc = gOPD(fn, 'length');
|
|
15793
|
+
if (desc && !desc.configurable) {
|
|
15794
|
+
functionLengthIsConfigurable = false;
|
|
15795
|
+
}
|
|
15796
|
+
if (desc && !desc.writable) {
|
|
15797
|
+
functionLengthIsWritable = false;
|
|
15798
|
+
}
|
|
15799
|
+
}
|
|
15800
|
+
|
|
15801
|
+
if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
|
|
15802
|
+
if (hasDescriptors) {
|
|
15803
|
+
define(fn, 'length', length, true, true);
|
|
15804
|
+
} else {
|
|
15805
|
+
define(fn, 'length', length);
|
|
15806
|
+
}
|
|
15807
|
+
}
|
|
15808
|
+
return fn;
|
|
15809
|
+
};
|
|
15810
|
+
|
|
15811
|
+
(function (module) {
|
|
15812
|
+
|
|
15813
|
+
var bind = functionBind$1;
|
|
15814
|
+
var GetIntrinsic = getIntrinsic;
|
|
15815
|
+
var setFunctionLength$1 = setFunctionLength;
|
|
15816
|
+
|
|
15817
|
+
var $TypeError = GetIntrinsic('%TypeError%');
|
|
15818
|
+
var $apply = GetIntrinsic('%Function.prototype.apply%');
|
|
15819
|
+
var $call = GetIntrinsic('%Function.prototype.call%');
|
|
15820
|
+
var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
|
|
15821
|
+
|
|
15822
|
+
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
|
|
15823
|
+
var $max = GetIntrinsic('%Math.max%');
|
|
15824
|
+
|
|
15825
|
+
if ($defineProperty) {
|
|
15826
|
+
try {
|
|
15827
|
+
$defineProperty({}, 'a', { value: 1 });
|
|
15828
|
+
} catch (e) {
|
|
15829
|
+
// IE 8 has a broken defineProperty
|
|
15830
|
+
$defineProperty = null;
|
|
15831
|
+
}
|
|
15832
|
+
}
|
|
15833
|
+
|
|
15834
|
+
module.exports = function callBind(originalFunction) {
|
|
15835
|
+
if (typeof originalFunction !== 'function') {
|
|
15836
|
+
throw new $TypeError('a function is required');
|
|
15837
|
+
}
|
|
15838
|
+
var func = $reflectApply(bind, $call, arguments);
|
|
15839
|
+
return setFunctionLength$1(
|
|
15840
|
+
func,
|
|
15841
|
+
1 + $max(0, originalFunction.length - (arguments.length - 1)),
|
|
15842
|
+
true
|
|
15843
|
+
);
|
|
15844
|
+
};
|
|
15845
|
+
|
|
15846
|
+
var applyBind = function applyBind() {
|
|
15847
|
+
return $reflectApply(bind, $apply, arguments);
|
|
15848
|
+
};
|
|
15849
|
+
|
|
15850
|
+
if ($defineProperty) {
|
|
15851
|
+
$defineProperty(module.exports, 'apply', { value: applyBind });
|
|
15852
|
+
} else {
|
|
15853
|
+
module.exports.apply = applyBind;
|
|
15854
|
+
}
|
|
15855
|
+
} (callBind$1));
|
|
15856
|
+
|
|
15857
|
+
var callBindExports = callBind$1.exports;
|
|
15858
|
+
|
|
15859
|
+
var jsonStringify = (typeof JSON !== 'undefined' ? JSON : JSON).stringify;
|
|
15860
|
+
|
|
15861
|
+
var isArray$1 = isarray;
|
|
15862
|
+
var objectKeys = objectKeys$1;
|
|
15863
|
+
var callBind = callBindExports;
|
|
15864
|
+
|
|
15865
|
+
var strRepeat = function repeat(n, char) {
|
|
15866
|
+
var str = '';
|
|
15867
|
+
for (var i = 0; i < n; i += 1) {
|
|
15868
|
+
str += char;
|
|
15869
|
+
}
|
|
15870
|
+
return str;
|
|
15871
|
+
};
|
|
15872
|
+
|
|
15873
|
+
var defaultReplacer = function (parent, key, value) { return value; };
|
|
15874
|
+
|
|
15875
|
+
var jsonStableStringify = function stableStringify(obj) {
|
|
15876
|
+
var opts = arguments.length > 1 ? arguments[1] : void undefined;
|
|
15877
|
+
var space = (opts && opts.space) || '';
|
|
15878
|
+
if (typeof space === 'number') { space = strRepeat(space, ' '); }
|
|
15879
|
+
var cycles = !!opts && typeof opts.cycles === 'boolean' && opts.cycles;
|
|
15880
|
+
var replacer = opts && opts.replacer ? callBind(opts.replacer) : defaultReplacer;
|
|
15881
|
+
|
|
15882
|
+
var cmpOpt = typeof opts === 'function' ? opts : opts && opts.cmp;
|
|
15883
|
+
var cmp = cmpOpt && function (node) {
|
|
15884
|
+
var get = cmpOpt.length > 2 && function get(k) { return node[k]; };
|
|
15885
|
+
return function (a, b) {
|
|
15886
|
+
return cmpOpt(
|
|
15887
|
+
{ key: a, value: node[a] },
|
|
15888
|
+
{ key: b, value: node[b] },
|
|
15889
|
+
get ? { __proto__: null, get: get } : void undefined
|
|
15890
|
+
);
|
|
14952
15891
|
};
|
|
14953
|
-
}
|
|
15892
|
+
};
|
|
14954
15893
|
|
|
14955
15894
|
var seen = [];
|
|
14956
15895
|
return (function stringify(parent, key, node, level) {
|
|
14957
|
-
var indent = space ? '\n' +
|
|
15896
|
+
var indent = space ? '\n' + strRepeat(level, space) : '';
|
|
14958
15897
|
var colonSeparator = space ? ': ' : ':';
|
|
14959
15898
|
|
|
14960
15899
|
if (node && node.toJSON && typeof node.toJSON === 'function') {
|
|
14961
15900
|
node = node.toJSON();
|
|
14962
15901
|
}
|
|
14963
15902
|
|
|
14964
|
-
node = replacer
|
|
15903
|
+
node = replacer(parent, key, node);
|
|
14965
15904
|
|
|
14966
15905
|
if (node === undefined) {
|
|
14967
15906
|
return;
|
|
14968
15907
|
}
|
|
14969
15908
|
if (typeof node !== 'object' || node === null) {
|
|
14970
|
-
return
|
|
15909
|
+
return jsonStringify(node);
|
|
14971
15910
|
}
|
|
14972
15911
|
if (isArray$1(node)) {
|
|
14973
|
-
var out =
|
|
15912
|
+
var out = '';
|
|
14974
15913
|
for (var i = 0; i < node.length; i++) {
|
|
14975
|
-
var item = stringify(node, i, node[i], level + 1) ||
|
|
14976
|
-
out
|
|
15914
|
+
var item = stringify(node, i, node[i], level + 1) || jsonStringify(null);
|
|
15915
|
+
out += indent + space + item;
|
|
15916
|
+
if ((i + 1) < node.length) {
|
|
15917
|
+
out += ',';
|
|
15918
|
+
}
|
|
14977
15919
|
}
|
|
14978
|
-
return '[' + out
|
|
15920
|
+
return '[' + out + indent + ']';
|
|
14979
15921
|
}
|
|
14980
15922
|
|
|
14981
15923
|
if (seen.indexOf(node) !== -1) {
|
|
14982
|
-
if (cycles) { return
|
|
15924
|
+
if (cycles) { return jsonStringify('__cycle__'); }
|
|
14983
15925
|
throw new TypeError('Converting circular structure to JSON');
|
|
14984
15926
|
} else { seen.push(node); }
|
|
14985
15927
|
|
|
14986
15928
|
var keys = objectKeys(node).sort(cmp && cmp(node));
|
|
14987
|
-
var out =
|
|
15929
|
+
var out = '';
|
|
15930
|
+
var needsComma = false;
|
|
14988
15931
|
for (var i = 0; i < keys.length; i++) {
|
|
14989
15932
|
var key = keys[i];
|
|
14990
15933
|
var value = stringify(node, key, node[key], level + 1);
|
|
14991
15934
|
|
|
14992
15935
|
if (!value) { continue; }
|
|
14993
15936
|
|
|
14994
|
-
var keyValue =
|
|
14995
|
-
|
|
14996
|
-
|
|
15937
|
+
var keyValue = jsonStringify(key)
|
|
15938
|
+
+ colonSeparator
|
|
15939
|
+
+ value;
|
|
14997
15940
|
|
|
14998
|
-
out
|
|
15941
|
+
out += (needsComma ? ',' : '') + indent + space + keyValue;
|
|
15942
|
+
needsComma = true;
|
|
14999
15943
|
}
|
|
15000
15944
|
seen.splice(seen.indexOf(node), 1);
|
|
15001
|
-
return '{' + out
|
|
15945
|
+
return '{' + out + indent + '}';
|
|
15002
15946
|
|
|
15003
15947
|
}({ '': obj }, '', obj, 0));
|
|
15004
15948
|
};
|
|
@@ -16197,6 +17141,11 @@ async function injectSourcesContent(map, file, logger) {
|
|
|
16197
17141
|
debug$g?.(`Missing sources:\n ` + missingSources.join(`\n `));
|
|
16198
17142
|
}
|
|
16199
17143
|
}
|
|
17144
|
+
async function getOriginalContent(filepath) {
|
|
17145
|
+
if (virtualSourceRE.test(filepath))
|
|
17146
|
+
return undefined;
|
|
17147
|
+
return await fsp.readFile(filepath, 'utf-8').catch(() => undefined);
|
|
17148
|
+
}
|
|
16200
17149
|
function genSourceMapUrl(map) {
|
|
16201
17150
|
if (typeof map !== 'string') {
|
|
16202
17151
|
map = JSON.stringify(map);
|
|
@@ -28281,22 +29230,17 @@ var dist = {};
|
|
|
28281
29230
|
'package.json',
|
|
28282
29231
|
`.${name}rc.json`,
|
|
28283
29232
|
`.${name}rc.js`,
|
|
28284
|
-
`${name}.config.js`,
|
|
28285
29233
|
`.${name}rc.cjs`,
|
|
29234
|
+
`.config/${name}rc`,
|
|
29235
|
+
`.config/${name}rc.json`,
|
|
29236
|
+
`.config/${name}rc.js`,
|
|
29237
|
+
`.config/${name}rc.cjs`,
|
|
29238
|
+
`${name}.config.js`,
|
|
28286
29239
|
`${name}.config.cjs`,
|
|
28287
29240
|
];
|
|
28288
29241
|
}
|
|
28289
|
-
function
|
|
28290
|
-
return
|
|
28291
|
-
.split(path.sep)
|
|
28292
|
-
.reduceRight((acc, _, ind, arr) => {
|
|
28293
|
-
const currentPath = arr.slice(0, ind + 1).join(path.sep);
|
|
28294
|
-
if (!acc.passedStopDir)
|
|
28295
|
-
acc.searchPlaces.push(currentPath || path.sep);
|
|
28296
|
-
if (currentPath === stopDir)
|
|
28297
|
-
acc.passedStopDir = true;
|
|
28298
|
-
return acc;
|
|
28299
|
-
}, { searchPlaces: [], passedStopDir: false }).searchPlaces;
|
|
29242
|
+
function parentDir(p) {
|
|
29243
|
+
return path.dirname(p) || path.sep;
|
|
28300
29244
|
}
|
|
28301
29245
|
exports.defaultLoaders = Object.freeze({
|
|
28302
29246
|
'.js': __require,
|
|
@@ -28314,6 +29258,7 @@ var dist = {};
|
|
|
28314
29258
|
stopDir: os.homedir(),
|
|
28315
29259
|
searchPlaces: getDefaultSearchPlaces(name),
|
|
28316
29260
|
ignoreEmptySearchPlaces: true,
|
|
29261
|
+
cache: true,
|
|
28317
29262
|
transform: (x) => x,
|
|
28318
29263
|
packageProp: [name],
|
|
28319
29264
|
...options,
|
|
@@ -28336,16 +29281,6 @@ var dist = {};
|
|
|
28336
29281
|
return obj[props];
|
|
28337
29282
|
return ((Array.isArray(props) ? props : props.split('.')).reduce((acc, prop) => (acc === undefined ? acc : acc[prop]), obj) || null);
|
|
28338
29283
|
}
|
|
28339
|
-
function getSearchItems(searchPlaces, searchPaths) {
|
|
28340
|
-
return searchPaths.reduce((acc, searchPath) => {
|
|
28341
|
-
searchPlaces.forEach(fileName => acc.push({
|
|
28342
|
-
fileName,
|
|
28343
|
-
filepath: path.join(searchPath, fileName),
|
|
28344
|
-
loaderKey: path.extname(fileName) || 'noExt',
|
|
28345
|
-
}));
|
|
28346
|
-
return acc;
|
|
28347
|
-
}, []);
|
|
28348
|
-
}
|
|
28349
29284
|
function validateFilePath(filepath) {
|
|
28350
29285
|
if (!filepath)
|
|
28351
29286
|
throw new Error('load must pass a non-empty string');
|
|
@@ -28356,56 +29291,88 @@ var dist = {};
|
|
|
28356
29291
|
if (typeof loader !== 'function')
|
|
28357
29292
|
throw new Error('loader is not a function');
|
|
28358
29293
|
}
|
|
29294
|
+
const makeEmplace = (enableCache) => (c, filepath, res) => {
|
|
29295
|
+
if (enableCache)
|
|
29296
|
+
c.set(filepath, res);
|
|
29297
|
+
return res;
|
|
29298
|
+
};
|
|
28359
29299
|
function lilconfig(name, options) {
|
|
28360
|
-
const { ignoreEmptySearchPlaces, loaders, packageProp, searchPlaces, stopDir, transform, } = getOptions(name, options);
|
|
29300
|
+
const { ignoreEmptySearchPlaces, loaders, packageProp, searchPlaces, stopDir, transform, cache, } = getOptions(name, options);
|
|
29301
|
+
const searchCache = new Map();
|
|
29302
|
+
const loadCache = new Map();
|
|
29303
|
+
const emplace = makeEmplace(cache);
|
|
28361
29304
|
return {
|
|
28362
29305
|
async search(searchFrom = process.cwd()) {
|
|
28363
|
-
const searchPaths = getSearchPaths(searchFrom, stopDir);
|
|
28364
29306
|
const result = {
|
|
28365
29307
|
config: null,
|
|
28366
29308
|
filepath: '',
|
|
28367
29309
|
};
|
|
28368
|
-
const
|
|
28369
|
-
|
|
28370
|
-
|
|
28371
|
-
|
|
28372
|
-
|
|
28373
|
-
|
|
28374
|
-
|
|
28375
|
-
|
|
28376
|
-
|
|
28377
|
-
const loader = loaders[loaderKey];
|
|
28378
|
-
if (fileName === 'package.json') {
|
|
28379
|
-
const pkg = await loader(filepath, content);
|
|
28380
|
-
const maybeConfig = getPackageProp(packageProp, pkg);
|
|
28381
|
-
if (maybeConfig != null) {
|
|
28382
|
-
result.config = maybeConfig;
|
|
28383
|
-
result.filepath = filepath;
|
|
28384
|
-
break;
|
|
29310
|
+
const visited = new Set();
|
|
29311
|
+
let dir = searchFrom;
|
|
29312
|
+
dirLoop: while (true) {
|
|
29313
|
+
if (cache) {
|
|
29314
|
+
const r = searchCache.get(dir);
|
|
29315
|
+
if (r !== undefined) {
|
|
29316
|
+
for (const p of visited)
|
|
29317
|
+
searchCache.set(p, r);
|
|
29318
|
+
return r;
|
|
28385
29319
|
}
|
|
28386
|
-
|
|
28387
|
-
}
|
|
28388
|
-
const isEmpty = content.trim() === '';
|
|
28389
|
-
if (isEmpty && ignoreEmptySearchPlaces)
|
|
28390
|
-
continue;
|
|
28391
|
-
if (isEmpty) {
|
|
28392
|
-
result.isEmpty = true;
|
|
28393
|
-
result.config = undefined;
|
|
29320
|
+
visited.add(dir);
|
|
28394
29321
|
}
|
|
28395
|
-
|
|
28396
|
-
|
|
28397
|
-
|
|
29322
|
+
for (const searchPlace of searchPlaces) {
|
|
29323
|
+
const filepath = path.join(dir, searchPlace);
|
|
29324
|
+
try {
|
|
29325
|
+
await fs.promises.access(filepath);
|
|
29326
|
+
}
|
|
29327
|
+
catch (_a) {
|
|
29328
|
+
continue;
|
|
29329
|
+
}
|
|
29330
|
+
const content = String(await fsReadFileAsync(filepath));
|
|
29331
|
+
const loaderKey = path.extname(searchPlace) || 'noExt';
|
|
29332
|
+
const loader = loaders[loaderKey];
|
|
29333
|
+
if (searchPlace === 'package.json') {
|
|
29334
|
+
const pkg = await loader(filepath, content);
|
|
29335
|
+
const maybeConfig = getPackageProp(packageProp, pkg);
|
|
29336
|
+
if (maybeConfig != null) {
|
|
29337
|
+
result.config = maybeConfig;
|
|
29338
|
+
result.filepath = filepath;
|
|
29339
|
+
break dirLoop;
|
|
29340
|
+
}
|
|
29341
|
+
continue;
|
|
29342
|
+
}
|
|
29343
|
+
const isEmpty = content.trim() === '';
|
|
29344
|
+
if (isEmpty && ignoreEmptySearchPlaces)
|
|
29345
|
+
continue;
|
|
29346
|
+
if (isEmpty) {
|
|
29347
|
+
result.isEmpty = true;
|
|
29348
|
+
result.config = undefined;
|
|
29349
|
+
}
|
|
29350
|
+
else {
|
|
29351
|
+
validateLoader(loader, loaderKey);
|
|
29352
|
+
result.config = await loader(filepath, content);
|
|
29353
|
+
}
|
|
29354
|
+
result.filepath = filepath;
|
|
29355
|
+
break dirLoop;
|
|
28398
29356
|
}
|
|
28399
|
-
|
|
28400
|
-
|
|
29357
|
+
if (dir === stopDir || dir === parentDir(dir))
|
|
29358
|
+
break dirLoop;
|
|
29359
|
+
dir = parentDir(dir);
|
|
29360
|
+
}
|
|
29361
|
+
const transformed = result.filepath === '' && result.config === null
|
|
29362
|
+
? transform(null)
|
|
29363
|
+
: transform(result);
|
|
29364
|
+
if (cache) {
|
|
29365
|
+
for (const p of visited)
|
|
29366
|
+
searchCache.set(p, transformed);
|
|
28401
29367
|
}
|
|
28402
|
-
|
|
28403
|
-
return transform(null);
|
|
28404
|
-
return transform(result);
|
|
29368
|
+
return transformed;
|
|
28405
29369
|
},
|
|
28406
29370
|
async load(filepath) {
|
|
28407
29371
|
validateFilePath(filepath);
|
|
28408
29372
|
const absPath = path.resolve(process.cwd(), filepath);
|
|
29373
|
+
if (cache && loadCache.has(absPath)) {
|
|
29374
|
+
return loadCache.get(absPath);
|
|
29375
|
+
}
|
|
28409
29376
|
const { base, ext } = path.parse(absPath);
|
|
28410
29377
|
const loaderKey = ext || 'noExt';
|
|
28411
29378
|
const loader = loaders[loaderKey];
|
|
@@ -28413,10 +29380,10 @@ var dist = {};
|
|
|
28413
29380
|
const content = String(await fsReadFileAsync(absPath));
|
|
28414
29381
|
if (base === 'package.json') {
|
|
28415
29382
|
const pkg = await loader(absPath, content);
|
|
28416
|
-
return transform({
|
|
29383
|
+
return emplace(loadCache, absPath, transform({
|
|
28417
29384
|
config: getPackageProp(packageProp, pkg),
|
|
28418
29385
|
filepath: absPath,
|
|
28419
|
-
});
|
|
29386
|
+
}));
|
|
28420
29387
|
}
|
|
28421
29388
|
const result = {
|
|
28422
29389
|
config: null,
|
|
@@ -28424,69 +29391,110 @@ var dist = {};
|
|
|
28424
29391
|
};
|
|
28425
29392
|
const isEmpty = content.trim() === '';
|
|
28426
29393
|
if (isEmpty && ignoreEmptySearchPlaces)
|
|
28427
|
-
return transform({
|
|
29394
|
+
return emplace(loadCache, absPath, transform({
|
|
28428
29395
|
config: undefined,
|
|
28429
29396
|
filepath: absPath,
|
|
28430
29397
|
isEmpty: true,
|
|
28431
|
-
});
|
|
29398
|
+
}));
|
|
28432
29399
|
result.config = isEmpty
|
|
28433
29400
|
? undefined
|
|
28434
29401
|
: await loader(absPath, content);
|
|
28435
|
-
return transform(isEmpty ? { ...result, isEmpty, config: undefined } : result);
|
|
29402
|
+
return emplace(loadCache, absPath, transform(isEmpty ? { ...result, isEmpty, config: undefined } : result));
|
|
29403
|
+
},
|
|
29404
|
+
clearLoadCache() {
|
|
29405
|
+
if (cache)
|
|
29406
|
+
loadCache.clear();
|
|
29407
|
+
},
|
|
29408
|
+
clearSearchCache() {
|
|
29409
|
+
if (cache)
|
|
29410
|
+
searchCache.clear();
|
|
29411
|
+
},
|
|
29412
|
+
clearCaches() {
|
|
29413
|
+
if (cache) {
|
|
29414
|
+
loadCache.clear();
|
|
29415
|
+
searchCache.clear();
|
|
29416
|
+
}
|
|
28436
29417
|
},
|
|
28437
29418
|
};
|
|
28438
29419
|
}
|
|
28439
29420
|
exports.lilconfig = lilconfig;
|
|
28440
29421
|
function lilconfigSync(name, options) {
|
|
28441
|
-
const { ignoreEmptySearchPlaces, loaders, packageProp, searchPlaces, stopDir, transform, } = getOptions(name, options);
|
|
29422
|
+
const { ignoreEmptySearchPlaces, loaders, packageProp, searchPlaces, stopDir, transform, cache, } = getOptions(name, options);
|
|
29423
|
+
const searchCache = new Map();
|
|
29424
|
+
const loadCache = new Map();
|
|
29425
|
+
const emplace = makeEmplace(cache);
|
|
28442
29426
|
return {
|
|
28443
29427
|
search(searchFrom = process.cwd()) {
|
|
28444
|
-
const searchPaths = getSearchPaths(searchFrom, stopDir);
|
|
28445
29428
|
const result = {
|
|
28446
29429
|
config: null,
|
|
28447
29430
|
filepath: '',
|
|
28448
29431
|
};
|
|
28449
|
-
const
|
|
28450
|
-
|
|
28451
|
-
|
|
28452
|
-
|
|
28453
|
-
|
|
28454
|
-
|
|
28455
|
-
|
|
28456
|
-
|
|
28457
|
-
|
|
28458
|
-
const content = String(fs.readFileSync(filepath));
|
|
28459
|
-
if (fileName === 'package.json') {
|
|
28460
|
-
const pkg = loader(filepath, content);
|
|
28461
|
-
const maybeConfig = getPackageProp(packageProp, pkg);
|
|
28462
|
-
if (maybeConfig != null) {
|
|
28463
|
-
result.config = maybeConfig;
|
|
28464
|
-
result.filepath = filepath;
|
|
28465
|
-
break;
|
|
29432
|
+
const visited = new Set();
|
|
29433
|
+
let dir = searchFrom;
|
|
29434
|
+
dirLoop: while (true) {
|
|
29435
|
+
if (cache) {
|
|
29436
|
+
const r = searchCache.get(dir);
|
|
29437
|
+
if (r !== undefined) {
|
|
29438
|
+
for (const p of visited)
|
|
29439
|
+
searchCache.set(p, r);
|
|
29440
|
+
return r;
|
|
28466
29441
|
}
|
|
28467
|
-
|
|
28468
|
-
}
|
|
28469
|
-
const isEmpty = content.trim() === '';
|
|
28470
|
-
if (isEmpty && ignoreEmptySearchPlaces)
|
|
28471
|
-
continue;
|
|
28472
|
-
if (isEmpty) {
|
|
28473
|
-
result.isEmpty = true;
|
|
28474
|
-
result.config = undefined;
|
|
29442
|
+
visited.add(dir);
|
|
28475
29443
|
}
|
|
28476
|
-
|
|
28477
|
-
|
|
28478
|
-
|
|
29444
|
+
for (const searchPlace of searchPlaces) {
|
|
29445
|
+
const filepath = path.join(dir, searchPlace);
|
|
29446
|
+
try {
|
|
29447
|
+
fs.accessSync(filepath);
|
|
29448
|
+
}
|
|
29449
|
+
catch (_a) {
|
|
29450
|
+
continue;
|
|
29451
|
+
}
|
|
29452
|
+
const loaderKey = path.extname(searchPlace) || 'noExt';
|
|
29453
|
+
const loader = loaders[loaderKey];
|
|
29454
|
+
const content = String(fs.readFileSync(filepath));
|
|
29455
|
+
if (searchPlace === 'package.json') {
|
|
29456
|
+
const pkg = loader(filepath, content);
|
|
29457
|
+
const maybeConfig = getPackageProp(packageProp, pkg);
|
|
29458
|
+
if (maybeConfig != null) {
|
|
29459
|
+
result.config = maybeConfig;
|
|
29460
|
+
result.filepath = filepath;
|
|
29461
|
+
break dirLoop;
|
|
29462
|
+
}
|
|
29463
|
+
continue;
|
|
29464
|
+
}
|
|
29465
|
+
const isEmpty = content.trim() === '';
|
|
29466
|
+
if (isEmpty && ignoreEmptySearchPlaces)
|
|
29467
|
+
continue;
|
|
29468
|
+
if (isEmpty) {
|
|
29469
|
+
result.isEmpty = true;
|
|
29470
|
+
result.config = undefined;
|
|
29471
|
+
}
|
|
29472
|
+
else {
|
|
29473
|
+
validateLoader(loader, loaderKey);
|
|
29474
|
+
result.config = loader(filepath, content);
|
|
29475
|
+
}
|
|
29476
|
+
result.filepath = filepath;
|
|
29477
|
+
break dirLoop;
|
|
28479
29478
|
}
|
|
28480
|
-
|
|
28481
|
-
|
|
29479
|
+
if (dir === stopDir || dir === parentDir(dir))
|
|
29480
|
+
break dirLoop;
|
|
29481
|
+
dir = parentDir(dir);
|
|
29482
|
+
}
|
|
29483
|
+
const transformed = result.filepath === '' && result.config === null
|
|
29484
|
+
? transform(null)
|
|
29485
|
+
: transform(result);
|
|
29486
|
+
if (cache) {
|
|
29487
|
+
for (const p of visited)
|
|
29488
|
+
searchCache.set(p, transformed);
|
|
28482
29489
|
}
|
|
28483
|
-
|
|
28484
|
-
return transform(null);
|
|
28485
|
-
return transform(result);
|
|
29490
|
+
return transformed;
|
|
28486
29491
|
},
|
|
28487
29492
|
load(filepath) {
|
|
28488
29493
|
validateFilePath(filepath);
|
|
28489
29494
|
const absPath = path.resolve(process.cwd(), filepath);
|
|
29495
|
+
if (cache && loadCache.has(absPath)) {
|
|
29496
|
+
return loadCache.get(absPath);
|
|
29497
|
+
}
|
|
28490
29498
|
const { base, ext } = path.parse(absPath);
|
|
28491
29499
|
const loaderKey = ext || 'noExt';
|
|
28492
29500
|
const loader = loaders[loaderKey];
|
|
@@ -28505,13 +29513,27 @@ var dist = {};
|
|
|
28505
29513
|
};
|
|
28506
29514
|
const isEmpty = content.trim() === '';
|
|
28507
29515
|
if (isEmpty && ignoreEmptySearchPlaces)
|
|
28508
|
-
return transform({
|
|
29516
|
+
return emplace(loadCache, absPath, transform({
|
|
28509
29517
|
filepath: absPath,
|
|
28510
29518
|
config: undefined,
|
|
28511
29519
|
isEmpty: true,
|
|
28512
|
-
});
|
|
29520
|
+
}));
|
|
28513
29521
|
result.config = isEmpty ? undefined : loader(absPath, content);
|
|
28514
|
-
return transform(isEmpty ? { ...result, isEmpty, config: undefined } : result);
|
|
29522
|
+
return emplace(loadCache, absPath, transform(isEmpty ? { ...result, isEmpty, config: undefined } : result));
|
|
29523
|
+
},
|
|
29524
|
+
clearLoadCache() {
|
|
29525
|
+
if (cache)
|
|
29526
|
+
loadCache.clear();
|
|
29527
|
+
},
|
|
29528
|
+
clearSearchCache() {
|
|
29529
|
+
if (cache)
|
|
29530
|
+
searchCache.clear();
|
|
29531
|
+
},
|
|
29532
|
+
clearCaches() {
|
|
29533
|
+
if (cache) {
|
|
29534
|
+
loadCache.clear();
|
|
29535
|
+
searchCache.clear();
|
|
29536
|
+
}
|
|
28515
29537
|
},
|
|
28516
29538
|
};
|
|
28517
29539
|
}
|
|
@@ -28552,18 +29574,6 @@ function isNode$1(node) {
|
|
|
28552
29574
|
return false;
|
|
28553
29575
|
}
|
|
28554
29576
|
const hasAnchor = (node) => (isScalar$1(node) || isCollection$1(node)) && !!node.anchor;
|
|
28555
|
-
class NodeBase {
|
|
28556
|
-
constructor(type) {
|
|
28557
|
-
Object.defineProperty(this, NODE_TYPE, { value: type });
|
|
28558
|
-
}
|
|
28559
|
-
/** Create a copy of this node. */
|
|
28560
|
-
clone() {
|
|
28561
|
-
const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
28562
|
-
if (this.range)
|
|
28563
|
-
copy.range = this.range.slice();
|
|
28564
|
-
return copy;
|
|
28565
|
-
}
|
|
28566
|
-
}
|
|
28567
29577
|
|
|
28568
29578
|
const BREAK$1 = Symbol('break visit');
|
|
28569
29579
|
const SKIP$1 = Symbol('skip children');
|
|
@@ -28910,12 +29920,19 @@ class Directives {
|
|
|
28910
29920
|
onError('Verbatim tags must end with a >');
|
|
28911
29921
|
return verbatim;
|
|
28912
29922
|
}
|
|
28913
|
-
const [, handle, suffix] = source.match(/^(.*!)([^!]*)$/);
|
|
29923
|
+
const [, handle, suffix] = source.match(/^(.*!)([^!]*)$/s);
|
|
28914
29924
|
if (!suffix)
|
|
28915
29925
|
onError(`The ${source} tag has no suffix`);
|
|
28916
29926
|
const prefix = this.tags[handle];
|
|
28917
|
-
if (prefix)
|
|
28918
|
-
|
|
29927
|
+
if (prefix) {
|
|
29928
|
+
try {
|
|
29929
|
+
return prefix + decodeURIComponent(suffix);
|
|
29930
|
+
}
|
|
29931
|
+
catch (error) {
|
|
29932
|
+
onError(String(error));
|
|
29933
|
+
return null;
|
|
29934
|
+
}
|
|
29935
|
+
}
|
|
28919
29936
|
if (handle === '!')
|
|
28920
29937
|
return source; // local tag
|
|
28921
29938
|
onError(`Could not resolve tag: ${source}`);
|
|
@@ -29028,6 +30045,126 @@ function createNodeAnchors(doc, prefix) {
|
|
|
29028
30045
|
};
|
|
29029
30046
|
}
|
|
29030
30047
|
|
|
30048
|
+
/**
|
|
30049
|
+
* Applies the JSON.parse reviver algorithm as defined in the ECMA-262 spec,
|
|
30050
|
+
* in section 24.5.1.1 "Runtime Semantics: InternalizeJSONProperty" of the
|
|
30051
|
+
* 2021 edition: https://tc39.es/ecma262/#sec-json.parse
|
|
30052
|
+
*
|
|
30053
|
+
* Includes extensions for handling Map and Set objects.
|
|
30054
|
+
*/
|
|
30055
|
+
function applyReviver(reviver, obj, key, val) {
|
|
30056
|
+
if (val && typeof val === 'object') {
|
|
30057
|
+
if (Array.isArray(val)) {
|
|
30058
|
+
for (let i = 0, len = val.length; i < len; ++i) {
|
|
30059
|
+
const v0 = val[i];
|
|
30060
|
+
const v1 = applyReviver(reviver, val, String(i), v0);
|
|
30061
|
+
if (v1 === undefined)
|
|
30062
|
+
delete val[i];
|
|
30063
|
+
else if (v1 !== v0)
|
|
30064
|
+
val[i] = v1;
|
|
30065
|
+
}
|
|
30066
|
+
}
|
|
30067
|
+
else if (val instanceof Map) {
|
|
30068
|
+
for (const k of Array.from(val.keys())) {
|
|
30069
|
+
const v0 = val.get(k);
|
|
30070
|
+
const v1 = applyReviver(reviver, val, k, v0);
|
|
30071
|
+
if (v1 === undefined)
|
|
30072
|
+
val.delete(k);
|
|
30073
|
+
else if (v1 !== v0)
|
|
30074
|
+
val.set(k, v1);
|
|
30075
|
+
}
|
|
30076
|
+
}
|
|
30077
|
+
else if (val instanceof Set) {
|
|
30078
|
+
for (const v0 of Array.from(val)) {
|
|
30079
|
+
const v1 = applyReviver(reviver, val, v0, v0);
|
|
30080
|
+
if (v1 === undefined)
|
|
30081
|
+
val.delete(v0);
|
|
30082
|
+
else if (v1 !== v0) {
|
|
30083
|
+
val.delete(v0);
|
|
30084
|
+
val.add(v1);
|
|
30085
|
+
}
|
|
30086
|
+
}
|
|
30087
|
+
}
|
|
30088
|
+
else {
|
|
30089
|
+
for (const [k, v0] of Object.entries(val)) {
|
|
30090
|
+
const v1 = applyReviver(reviver, val, k, v0);
|
|
30091
|
+
if (v1 === undefined)
|
|
30092
|
+
delete val[k];
|
|
30093
|
+
else if (v1 !== v0)
|
|
30094
|
+
val[k] = v1;
|
|
30095
|
+
}
|
|
30096
|
+
}
|
|
30097
|
+
}
|
|
30098
|
+
return reviver.call(obj, key, val);
|
|
30099
|
+
}
|
|
30100
|
+
|
|
30101
|
+
/**
|
|
30102
|
+
* Recursively convert any node or its contents to native JavaScript
|
|
30103
|
+
*
|
|
30104
|
+
* @param value - The input value
|
|
30105
|
+
* @param arg - If `value` defines a `toJSON()` method, use this
|
|
30106
|
+
* as its first argument
|
|
30107
|
+
* @param ctx - Conversion context, originally set in Document#toJS(). If
|
|
30108
|
+
* `{ keep: true }` is not set, output should be suitable for JSON
|
|
30109
|
+
* stringification.
|
|
30110
|
+
*/
|
|
30111
|
+
function toJS(value, arg, ctx) {
|
|
30112
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
30113
|
+
if (Array.isArray(value))
|
|
30114
|
+
return value.map((v, i) => toJS(v, String(i), ctx));
|
|
30115
|
+
if (value && typeof value.toJSON === 'function') {
|
|
30116
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
30117
|
+
if (!ctx || !hasAnchor(value))
|
|
30118
|
+
return value.toJSON(arg, ctx);
|
|
30119
|
+
const data = { aliasCount: 0, count: 1, res: undefined };
|
|
30120
|
+
ctx.anchors.set(value, data);
|
|
30121
|
+
ctx.onCreate = res => {
|
|
30122
|
+
data.res = res;
|
|
30123
|
+
delete ctx.onCreate;
|
|
30124
|
+
};
|
|
30125
|
+
const res = value.toJSON(arg, ctx);
|
|
30126
|
+
if (ctx.onCreate)
|
|
30127
|
+
ctx.onCreate(res);
|
|
30128
|
+
return res;
|
|
30129
|
+
}
|
|
30130
|
+
if (typeof value === 'bigint' && !ctx?.keep)
|
|
30131
|
+
return Number(value);
|
|
30132
|
+
return value;
|
|
30133
|
+
}
|
|
30134
|
+
|
|
30135
|
+
class NodeBase {
|
|
30136
|
+
constructor(type) {
|
|
30137
|
+
Object.defineProperty(this, NODE_TYPE, { value: type });
|
|
30138
|
+
}
|
|
30139
|
+
/** Create a copy of this node. */
|
|
30140
|
+
clone() {
|
|
30141
|
+
const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
30142
|
+
if (this.range)
|
|
30143
|
+
copy.range = this.range.slice();
|
|
30144
|
+
return copy;
|
|
30145
|
+
}
|
|
30146
|
+
/** A plain JavaScript representation of this node. */
|
|
30147
|
+
toJS(doc, { mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {
|
|
30148
|
+
if (!isDocument(doc))
|
|
30149
|
+
throw new TypeError('A document argument is required');
|
|
30150
|
+
const ctx = {
|
|
30151
|
+
anchors: new Map(),
|
|
30152
|
+
doc,
|
|
30153
|
+
keep: true,
|
|
30154
|
+
mapAsMap: mapAsMap === true,
|
|
30155
|
+
mapKeyWarned: false,
|
|
30156
|
+
maxAliasCount: typeof maxAliasCount === 'number' ? maxAliasCount : 100
|
|
30157
|
+
};
|
|
30158
|
+
const res = toJS(this, '', ctx);
|
|
30159
|
+
if (typeof onAnchor === 'function')
|
|
30160
|
+
for (const { count, res } of ctx.anchors.values())
|
|
30161
|
+
onAnchor(res, count);
|
|
30162
|
+
return typeof reviver === 'function'
|
|
30163
|
+
? applyReviver(reviver, { '': res }, '', res)
|
|
30164
|
+
: res;
|
|
30165
|
+
}
|
|
30166
|
+
}
|
|
30167
|
+
|
|
29031
30168
|
class Alias extends NodeBase {
|
|
29032
30169
|
constructor(source) {
|
|
29033
30170
|
super(ALIAS);
|
|
@@ -29063,7 +30200,12 @@ class Alias extends NodeBase {
|
|
|
29063
30200
|
const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
|
|
29064
30201
|
throw new ReferenceError(msg);
|
|
29065
30202
|
}
|
|
29066
|
-
|
|
30203
|
+
let data = anchors.get(source);
|
|
30204
|
+
if (!data) {
|
|
30205
|
+
// Resolve anchors for Node.prototype.toJS()
|
|
30206
|
+
toJS(source, null, ctx);
|
|
30207
|
+
data = anchors.get(source);
|
|
30208
|
+
}
|
|
29067
30209
|
/* istanbul ignore if */
|
|
29068
30210
|
if (!data || data.res === undefined) {
|
|
29069
30211
|
const msg = 'This should not happen: Alias anchor was not resolved?';
|
|
@@ -29117,40 +30259,6 @@ function getAliasCount(doc, node, anchors) {
|
|
|
29117
30259
|
return 1;
|
|
29118
30260
|
}
|
|
29119
30261
|
|
|
29120
|
-
/**
|
|
29121
|
-
* Recursively convert any node or its contents to native JavaScript
|
|
29122
|
-
*
|
|
29123
|
-
* @param value - The input value
|
|
29124
|
-
* @param arg - If `value` defines a `toJSON()` method, use this
|
|
29125
|
-
* as its first argument
|
|
29126
|
-
* @param ctx - Conversion context, originally set in Document#toJS(). If
|
|
29127
|
-
* `{ keep: true }` is not set, output should be suitable for JSON
|
|
29128
|
-
* stringification.
|
|
29129
|
-
*/
|
|
29130
|
-
function toJS(value, arg, ctx) {
|
|
29131
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
29132
|
-
if (Array.isArray(value))
|
|
29133
|
-
return value.map((v, i) => toJS(v, String(i), ctx));
|
|
29134
|
-
if (value && typeof value.toJSON === 'function') {
|
|
29135
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
29136
|
-
if (!ctx || !hasAnchor(value))
|
|
29137
|
-
return value.toJSON(arg, ctx);
|
|
29138
|
-
const data = { aliasCount: 0, count: 1, res: undefined };
|
|
29139
|
-
ctx.anchors.set(value, data);
|
|
29140
|
-
ctx.onCreate = res => {
|
|
29141
|
-
data.res = res;
|
|
29142
|
-
delete ctx.onCreate;
|
|
29143
|
-
};
|
|
29144
|
-
const res = value.toJSON(arg, ctx);
|
|
29145
|
-
if (ctx.onCreate)
|
|
29146
|
-
ctx.onCreate(res);
|
|
29147
|
-
return res;
|
|
29148
|
-
}
|
|
29149
|
-
if (typeof value === 'bigint' && !ctx?.keep)
|
|
29150
|
-
return Number(value);
|
|
29151
|
-
return value;
|
|
29152
|
-
}
|
|
29153
|
-
|
|
29154
30262
|
const isScalarValue = (value) => !value || (typeof value !== 'function' && typeof value !== 'object');
|
|
29155
30263
|
class Scalar extends NodeBase {
|
|
29156
30264
|
constructor(value) {
|
|
@@ -29194,7 +30302,7 @@ function createNode(value, tagName, ctx) {
|
|
|
29194
30302
|
if (value instanceof String ||
|
|
29195
30303
|
value instanceof Number ||
|
|
29196
30304
|
value instanceof Boolean ||
|
|
29197
|
-
(typeof BigInt
|
|
30305
|
+
(typeof BigInt !== 'undefined' && value instanceof BigInt) // not supported everywhere
|
|
29198
30306
|
) {
|
|
29199
30307
|
// https://tc39.es/ecma262/#sec-serializejsonproperty
|
|
29200
30308
|
value = value.valueOf();
|
|
@@ -29242,9 +30350,13 @@ function createNode(value, tagName, ctx) {
|
|
|
29242
30350
|
}
|
|
29243
30351
|
const node = tagObj?.createNode
|
|
29244
30352
|
? tagObj.createNode(ctx.schema, value, ctx)
|
|
29245
|
-
:
|
|
30353
|
+
: typeof tagObj?.nodeClass?.from === 'function'
|
|
30354
|
+
? tagObj.nodeClass.from(ctx.schema, value, ctx)
|
|
30355
|
+
: new Scalar(value);
|
|
29246
30356
|
if (tagName)
|
|
29247
30357
|
node.tag = tagName;
|
|
30358
|
+
else if (!tagObj.default)
|
|
30359
|
+
node.tag = tagObj.tag;
|
|
29248
30360
|
if (ref)
|
|
29249
30361
|
ref.node = node;
|
|
29250
30362
|
return node;
|
|
@@ -29546,8 +30658,8 @@ function consumeMoreIndentedLines(text, i) {
|
|
|
29546
30658
|
return i;
|
|
29547
30659
|
}
|
|
29548
30660
|
|
|
29549
|
-
const getFoldOptions = (ctx) => ({
|
|
29550
|
-
indentAtStart: ctx.indentAtStart,
|
|
30661
|
+
const getFoldOptions = (ctx, isBlock) => ({
|
|
30662
|
+
indentAtStart: isBlock ? ctx.indent.length : ctx.indentAtStart,
|
|
29551
30663
|
lineWidth: ctx.options.lineWidth,
|
|
29552
30664
|
minContentWidth: ctx.options.minContentWidth
|
|
29553
30665
|
});
|
|
@@ -29660,7 +30772,7 @@ function doubleQuotedString(value, ctx) {
|
|
|
29660
30772
|
str = start ? str + json.slice(start) : json;
|
|
29661
30773
|
return implicitKey
|
|
29662
30774
|
? str
|
|
29663
|
-
: foldFlowLines(str, indent, FOLD_QUOTED, getFoldOptions(ctx));
|
|
30775
|
+
: foldFlowLines(str, indent, FOLD_QUOTED, getFoldOptions(ctx, false));
|
|
29664
30776
|
}
|
|
29665
30777
|
function singleQuotedString(value, ctx) {
|
|
29666
30778
|
if (ctx.options.singleQuote === false ||
|
|
@@ -29672,7 +30784,7 @@ function singleQuotedString(value, ctx) {
|
|
|
29672
30784
|
const res = "'" + value.replace(/'/g, "''").replace(/\n+/g, `$&\n${indent}`) + "'";
|
|
29673
30785
|
return ctx.implicitKey
|
|
29674
30786
|
? res
|
|
29675
|
-
: foldFlowLines(res, indent, FOLD_FLOW, getFoldOptions(ctx));
|
|
30787
|
+
: foldFlowLines(res, indent, FOLD_FLOW, getFoldOptions(ctx, false));
|
|
29676
30788
|
}
|
|
29677
30789
|
function quotedString(value, ctx) {
|
|
29678
30790
|
const { singleQuote } = ctx.options;
|
|
@@ -29691,6 +30803,15 @@ function quotedString(value, ctx) {
|
|
|
29691
30803
|
}
|
|
29692
30804
|
return qs(value, ctx);
|
|
29693
30805
|
}
|
|
30806
|
+
// The negative lookbehind avoids a polynomial search,
|
|
30807
|
+
// but isn't supported yet on Safari: https://caniuse.com/js-regexp-lookbehind
|
|
30808
|
+
let blockEndNewlines;
|
|
30809
|
+
try {
|
|
30810
|
+
blockEndNewlines = new RegExp('(^|(?<!\n))\n+(?!\n|$)', 'g');
|
|
30811
|
+
}
|
|
30812
|
+
catch {
|
|
30813
|
+
blockEndNewlines = /\n+(?!\n|$)/g;
|
|
30814
|
+
}
|
|
29694
30815
|
function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
|
|
29695
30816
|
const { blockQuote, commentString, lineWidth } = ctx.options;
|
|
29696
30817
|
// 1. Block can't end in whitespace unless the last line is non-empty.
|
|
@@ -29734,7 +30855,7 @@ function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
|
|
|
29734
30855
|
value = value.slice(0, -end.length);
|
|
29735
30856
|
if (end[end.length - 1] === '\n')
|
|
29736
30857
|
end = end.slice(0, -1);
|
|
29737
|
-
end = end.replace(
|
|
30858
|
+
end = end.replace(blockEndNewlines, `$&${indent}`);
|
|
29738
30859
|
}
|
|
29739
30860
|
// determine indent indicator from whitespace at value start
|
|
29740
30861
|
let startWithSpace = false;
|
|
@@ -29770,13 +30891,13 @@ function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
|
|
|
29770
30891
|
.replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded
|
|
29771
30892
|
// ^ more-ind. ^ empty ^ capture next empty lines only at end of indent
|
|
29772
30893
|
.replace(/\n+/g, `$&${indent}`);
|
|
29773
|
-
const body = foldFlowLines(`${start}${value}${end}`, indent, FOLD_BLOCK, getFoldOptions(ctx));
|
|
30894
|
+
const body = foldFlowLines(`${start}${value}${end}`, indent, FOLD_BLOCK, getFoldOptions(ctx, true));
|
|
29774
30895
|
return `${header}\n${indent}${body}`;
|
|
29775
30896
|
}
|
|
29776
30897
|
function plainString(item, ctx, onComment, onChompKeep) {
|
|
29777
30898
|
const { type, value } = item;
|
|
29778
|
-
const { actualString, implicitKey, indent, inFlow } = ctx;
|
|
29779
|
-
if ((implicitKey &&
|
|
30899
|
+
const { actualString, implicitKey, indent, indentStep, inFlow } = ctx;
|
|
30900
|
+
if ((implicitKey && value.includes('\n')) ||
|
|
29780
30901
|
(inFlow && /[[\]{},]/.test(value))) {
|
|
29781
30902
|
return quotedString(value, ctx);
|
|
29782
30903
|
}
|
|
@@ -29799,9 +30920,14 @@ function plainString(item, ctx, onComment, onChompKeep) {
|
|
|
29799
30920
|
// Where allowed & type not set explicitly, prefer block style for multiline strings
|
|
29800
30921
|
return blockString(item, ctx, onComment, onChompKeep);
|
|
29801
30922
|
}
|
|
29802
|
-
if (
|
|
29803
|
-
|
|
29804
|
-
|
|
30923
|
+
if (containsDocumentMarker(value)) {
|
|
30924
|
+
if (indent === '') {
|
|
30925
|
+
ctx.forceBlockIndent = true;
|
|
30926
|
+
return blockString(item, ctx, onComment, onChompKeep);
|
|
30927
|
+
}
|
|
30928
|
+
else if (implicitKey && indent === indentStep) {
|
|
30929
|
+
return quotedString(value, ctx);
|
|
30930
|
+
}
|
|
29805
30931
|
}
|
|
29806
30932
|
const str = value.replace(/\n+/g, `$&\n${indent}`);
|
|
29807
30933
|
// Verify that output will be parsed as a string, as e.g. plain numbers and
|
|
@@ -29815,7 +30941,7 @@ function plainString(item, ctx, onComment, onChompKeep) {
|
|
|
29815
30941
|
}
|
|
29816
30942
|
return implicitKey
|
|
29817
30943
|
? str
|
|
29818
|
-
: foldFlowLines(str, indent, FOLD_FLOW, getFoldOptions(ctx));
|
|
30944
|
+
: foldFlowLines(str, indent, FOLD_FLOW, getFoldOptions(ctx, false));
|
|
29819
30945
|
}
|
|
29820
30946
|
function stringifyString(item, ctx, onComment, onChompKeep) {
|
|
29821
30947
|
const { implicitKey, inFlow } = ctx;
|
|
@@ -29866,6 +30992,7 @@ function createStringifyContext(doc, options) {
|
|
|
29866
30992
|
doubleQuotedAsJSON: false,
|
|
29867
30993
|
doubleQuotedMinMultiLineLength: 40,
|
|
29868
30994
|
falseStr: 'false',
|
|
30995
|
+
flowCollectionPadding: true,
|
|
29869
30996
|
indentSeq: true,
|
|
29870
30997
|
lineWidth: 80,
|
|
29871
30998
|
minContentWidth: 20,
|
|
@@ -29889,6 +31016,7 @@ function createStringifyContext(doc, options) {
|
|
|
29889
31016
|
return {
|
|
29890
31017
|
anchors: new Set(),
|
|
29891
31018
|
doc,
|
|
31019
|
+
flowCollectionPadding: opt.flowCollectionPadding ? ' ' : '',
|
|
29892
31020
|
indent: '',
|
|
29893
31021
|
indentStep: typeof opt.indent === 'number' ? ' '.repeat(opt.indent) : ' ',
|
|
29894
31022
|
inFlow,
|
|
@@ -30032,19 +31160,18 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
|
|
30032
31160
|
if (keyComment)
|
|
30033
31161
|
str += lineComment(str, ctx.indent, commentString(keyComment));
|
|
30034
31162
|
}
|
|
30035
|
-
let vcb
|
|
30036
|
-
let valueComment = null;
|
|
31163
|
+
let vsb, vcb, valueComment;
|
|
30037
31164
|
if (isNode$1(value)) {
|
|
30038
|
-
|
|
30039
|
-
|
|
30040
|
-
if (value.commentBefore) {
|
|
30041
|
-
const cs = commentString(value.commentBefore);
|
|
30042
|
-
vcb += `\n${indentComment(cs, ctx.indent)}`;
|
|
30043
|
-
}
|
|
31165
|
+
vsb = !!value.spaceBefore;
|
|
31166
|
+
vcb = value.commentBefore;
|
|
30044
31167
|
valueComment = value.comment;
|
|
30045
31168
|
}
|
|
30046
|
-
else
|
|
30047
|
-
|
|
31169
|
+
else {
|
|
31170
|
+
vsb = false;
|
|
31171
|
+
vcb = null;
|
|
31172
|
+
valueComment = null;
|
|
31173
|
+
if (value && typeof value === 'object')
|
|
31174
|
+
value = doc.createNode(value);
|
|
30048
31175
|
}
|
|
30049
31176
|
ctx.implicitKey = false;
|
|
30050
31177
|
if (!explicitKey && !keyComment && isScalar$1(value))
|
|
@@ -30059,24 +31186,50 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
|
|
30059
31186
|
!value.tag &&
|
|
30060
31187
|
!value.anchor) {
|
|
30061
31188
|
// If indentSeq === false, consider '- ' as part of indentation where possible
|
|
30062
|
-
ctx.indent = ctx.indent.
|
|
31189
|
+
ctx.indent = ctx.indent.substring(2);
|
|
30063
31190
|
}
|
|
30064
31191
|
let valueCommentDone = false;
|
|
30065
31192
|
const valueStr = stringify$2(value, ctx, () => (valueCommentDone = true), () => (chompKeep = true));
|
|
30066
31193
|
let ws = ' ';
|
|
30067
|
-
if (
|
|
30068
|
-
|
|
30069
|
-
|
|
30070
|
-
|
|
30071
|
-
ws
|
|
31194
|
+
if (keyComment || vsb || vcb) {
|
|
31195
|
+
ws = vsb ? '\n' : '';
|
|
31196
|
+
if (vcb) {
|
|
31197
|
+
const cs = commentString(vcb);
|
|
31198
|
+
ws += `\n${indentComment(cs, ctx.indent)}`;
|
|
31199
|
+
}
|
|
31200
|
+
if (valueStr === '' && !ctx.inFlow) {
|
|
31201
|
+
if (ws === '\n')
|
|
31202
|
+
ws = '\n\n';
|
|
31203
|
+
}
|
|
31204
|
+
else {
|
|
31205
|
+
ws += `\n${ctx.indent}`;
|
|
31206
|
+
}
|
|
30072
31207
|
}
|
|
30073
31208
|
else if (!explicitKey && isCollection$1(value)) {
|
|
30074
|
-
const
|
|
30075
|
-
|
|
30076
|
-
|
|
31209
|
+
const vs0 = valueStr[0];
|
|
31210
|
+
const nl0 = valueStr.indexOf('\n');
|
|
31211
|
+
const hasNewline = nl0 !== -1;
|
|
31212
|
+
const flow = ctx.inFlow ?? value.flow ?? value.items.length === 0;
|
|
31213
|
+
if (hasNewline || !flow) {
|
|
31214
|
+
let hasPropsLine = false;
|
|
31215
|
+
if (hasNewline && (vs0 === '&' || vs0 === '!')) {
|
|
31216
|
+
let sp0 = valueStr.indexOf(' ');
|
|
31217
|
+
if (vs0 === '&' &&
|
|
31218
|
+
sp0 !== -1 &&
|
|
31219
|
+
sp0 < nl0 &&
|
|
31220
|
+
valueStr[sp0 + 1] === '!') {
|
|
31221
|
+
sp0 = valueStr.indexOf(' ', sp0 + 1);
|
|
31222
|
+
}
|
|
31223
|
+
if (sp0 === -1 || nl0 < sp0)
|
|
31224
|
+
hasPropsLine = true;
|
|
31225
|
+
}
|
|
31226
|
+
if (!hasPropsLine)
|
|
31227
|
+
ws = `\n${ctx.indent}`;
|
|
31228
|
+
}
|
|
30077
31229
|
}
|
|
30078
|
-
else if (valueStr === '' || valueStr[0] === '\n')
|
|
31230
|
+
else if (valueStr === '' || valueStr[0] === '\n') {
|
|
30079
31231
|
ws = '';
|
|
31232
|
+
}
|
|
30080
31233
|
str += ws + valueStr;
|
|
30081
31234
|
if (ctx.inFlow) {
|
|
30082
31235
|
if (valueCommentDone && onComment)
|
|
@@ -30093,6 +31246,8 @@ function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
|
|
30093
31246
|
|
|
30094
31247
|
function warn(logLevel, warning) {
|
|
30095
31248
|
if (logLevel === 'debug' || logLevel === 'warn') {
|
|
31249
|
+
// https://github.com/typescript-eslint/typescript-eslint/issues/7478
|
|
31250
|
+
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
|
|
30096
31251
|
if (typeof process !== 'undefined' && process.emitWarning)
|
|
30097
31252
|
process.emitWarning(warning);
|
|
30098
31253
|
else
|
|
@@ -30177,7 +31332,7 @@ function stringifyKey(key, jsKey, ctx) {
|
|
|
30177
31332
|
return '';
|
|
30178
31333
|
if (typeof jsKey !== 'object')
|
|
30179
31334
|
return String(jsKey);
|
|
30180
|
-
if (isNode$1(key) && ctx
|
|
31335
|
+
if (isNode$1(key) && ctx?.doc) {
|
|
30181
31336
|
const strCtx = createStringifyContext(ctx.doc, {});
|
|
30182
31337
|
strCtx.anchors = new Set();
|
|
30183
31338
|
for (const node of ctx.anchors.keys())
|
|
@@ -30284,7 +31439,7 @@ function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, fl
|
|
|
30284
31439
|
return str;
|
|
30285
31440
|
}
|
|
30286
31441
|
function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemIndent, onComment }) {
|
|
30287
|
-
const { indent, indentStep, options: { commentString } } = ctx;
|
|
31442
|
+
const { indent, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx;
|
|
30288
31443
|
itemIndent += indentStep;
|
|
30289
31444
|
const itemCtx = Object.assign({}, ctx, {
|
|
30290
31445
|
indent: itemIndent,
|
|
@@ -30320,7 +31475,7 @@ function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemInden
|
|
|
30320
31475
|
if (iv.commentBefore)
|
|
30321
31476
|
reqNewline = true;
|
|
30322
31477
|
}
|
|
30323
|
-
else if (item.value == null && ik
|
|
31478
|
+
else if (item.value == null && ik?.comment) {
|
|
30324
31479
|
comment = ik.comment;
|
|
30325
31480
|
}
|
|
30326
31481
|
}
|
|
@@ -30353,11 +31508,11 @@ function stringifyFlowCollection({ comment, items }, ctx, { flowChars, itemInden
|
|
|
30353
31508
|
str += `\n${indent}${end}`;
|
|
30354
31509
|
}
|
|
30355
31510
|
else {
|
|
30356
|
-
str = `${start}
|
|
31511
|
+
str = `${start}${fcPadding}${lines.join(' ')}${fcPadding}${end}`;
|
|
30357
31512
|
}
|
|
30358
31513
|
}
|
|
30359
31514
|
if (comment) {
|
|
30360
|
-
str += lineComment(str, commentString(comment)
|
|
31515
|
+
str += lineComment(str, indent, commentString(comment));
|
|
30361
31516
|
if (onComment)
|
|
30362
31517
|
onComment();
|
|
30363
31518
|
}
|
|
@@ -30385,12 +31540,40 @@ function findPair(items, key) {
|
|
|
30385
31540
|
return undefined;
|
|
30386
31541
|
}
|
|
30387
31542
|
class YAMLMap extends Collection {
|
|
31543
|
+
static get tagName() {
|
|
31544
|
+
return 'tag:yaml.org,2002:map';
|
|
31545
|
+
}
|
|
30388
31546
|
constructor(schema) {
|
|
30389
31547
|
super(MAP, schema);
|
|
30390
31548
|
this.items = [];
|
|
30391
31549
|
}
|
|
30392
|
-
|
|
30393
|
-
|
|
31550
|
+
/**
|
|
31551
|
+
* A generic collection parsing method that can be extended
|
|
31552
|
+
* to other node classes that inherit from YAMLMap
|
|
31553
|
+
*/
|
|
31554
|
+
static from(schema, obj, ctx) {
|
|
31555
|
+
const { keepUndefined, replacer } = ctx;
|
|
31556
|
+
const map = new this(schema);
|
|
31557
|
+
const add = (key, value) => {
|
|
31558
|
+
if (typeof replacer === 'function')
|
|
31559
|
+
value = replacer.call(obj, key, value);
|
|
31560
|
+
else if (Array.isArray(replacer) && !replacer.includes(key))
|
|
31561
|
+
return;
|
|
31562
|
+
if (value !== undefined || keepUndefined)
|
|
31563
|
+
map.items.push(createPair(key, value, ctx));
|
|
31564
|
+
};
|
|
31565
|
+
if (obj instanceof Map) {
|
|
31566
|
+
for (const [key, value] of obj)
|
|
31567
|
+
add(key, value);
|
|
31568
|
+
}
|
|
31569
|
+
else if (obj && typeof obj === 'object') {
|
|
31570
|
+
for (const key of Object.keys(obj))
|
|
31571
|
+
add(key, obj[key]);
|
|
31572
|
+
}
|
|
31573
|
+
if (typeof schema.sortMapEntries === 'function') {
|
|
31574
|
+
map.items.sort(schema.sortMapEntries);
|
|
31575
|
+
}
|
|
31576
|
+
return map;
|
|
30394
31577
|
}
|
|
30395
31578
|
/**
|
|
30396
31579
|
* Adds a value to the collection.
|
|
@@ -30480,33 +31663,8 @@ class YAMLMap extends Collection {
|
|
|
30480
31663
|
}
|
|
30481
31664
|
}
|
|
30482
31665
|
|
|
30483
|
-
function createMap(schema, obj, ctx) {
|
|
30484
|
-
const { keepUndefined, replacer } = ctx;
|
|
30485
|
-
const map = new YAMLMap(schema);
|
|
30486
|
-
const add = (key, value) => {
|
|
30487
|
-
if (typeof replacer === 'function')
|
|
30488
|
-
value = replacer.call(obj, key, value);
|
|
30489
|
-
else if (Array.isArray(replacer) && !replacer.includes(key))
|
|
30490
|
-
return;
|
|
30491
|
-
if (value !== undefined || keepUndefined)
|
|
30492
|
-
map.items.push(createPair(key, value, ctx));
|
|
30493
|
-
};
|
|
30494
|
-
if (obj instanceof Map) {
|
|
30495
|
-
for (const [key, value] of obj)
|
|
30496
|
-
add(key, value);
|
|
30497
|
-
}
|
|
30498
|
-
else if (obj && typeof obj === 'object') {
|
|
30499
|
-
for (const key of Object.keys(obj))
|
|
30500
|
-
add(key, obj[key]);
|
|
30501
|
-
}
|
|
30502
|
-
if (typeof schema.sortMapEntries === 'function') {
|
|
30503
|
-
map.items.sort(schema.sortMapEntries);
|
|
30504
|
-
}
|
|
30505
|
-
return map;
|
|
30506
|
-
}
|
|
30507
31666
|
const map$1 = {
|
|
30508
31667
|
collection: 'map',
|
|
30509
|
-
createNode: createMap,
|
|
30510
31668
|
default: true,
|
|
30511
31669
|
nodeClass: YAMLMap,
|
|
30512
31670
|
tag: 'tag:yaml.org,2002:map',
|
|
@@ -30514,17 +31672,18 @@ const map$1 = {
|
|
|
30514
31672
|
if (!isMap(map))
|
|
30515
31673
|
onError('Expected a mapping for this tag');
|
|
30516
31674
|
return map;
|
|
30517
|
-
}
|
|
31675
|
+
},
|
|
31676
|
+
createNode: (schema, obj, ctx) => YAMLMap.from(schema, obj, ctx)
|
|
30518
31677
|
};
|
|
30519
31678
|
|
|
30520
31679
|
class YAMLSeq extends Collection {
|
|
31680
|
+
static get tagName() {
|
|
31681
|
+
return 'tag:yaml.org,2002:seq';
|
|
31682
|
+
}
|
|
30521
31683
|
constructor(schema) {
|
|
30522
31684
|
super(SEQ, schema);
|
|
30523
31685
|
this.items = [];
|
|
30524
31686
|
}
|
|
30525
|
-
static get tagName() {
|
|
30526
|
-
return 'tag:yaml.org,2002:seq';
|
|
30527
|
-
}
|
|
30528
31687
|
add(value) {
|
|
30529
31688
|
this.items.push(value);
|
|
30530
31689
|
}
|
|
@@ -30597,6 +31756,21 @@ class YAMLSeq extends Collection {
|
|
|
30597
31756
|
onComment
|
|
30598
31757
|
});
|
|
30599
31758
|
}
|
|
31759
|
+
static from(schema, obj, ctx) {
|
|
31760
|
+
const { replacer } = ctx;
|
|
31761
|
+
const seq = new this(schema);
|
|
31762
|
+
if (obj && Symbol.iterator in Object(obj)) {
|
|
31763
|
+
let i = 0;
|
|
31764
|
+
for (let it of obj) {
|
|
31765
|
+
if (typeof replacer === 'function') {
|
|
31766
|
+
const key = obj instanceof Set ? it : String(i++);
|
|
31767
|
+
it = replacer.call(obj, key, it);
|
|
31768
|
+
}
|
|
31769
|
+
seq.items.push(createNode(it, undefined, ctx));
|
|
31770
|
+
}
|
|
31771
|
+
}
|
|
31772
|
+
return seq;
|
|
31773
|
+
}
|
|
30600
31774
|
}
|
|
30601
31775
|
function asItemIndex(key) {
|
|
30602
31776
|
let idx = isScalar$1(key) ? key.value : key;
|
|
@@ -30607,24 +31781,8 @@ function asItemIndex(key) {
|
|
|
30607
31781
|
: null;
|
|
30608
31782
|
}
|
|
30609
31783
|
|
|
30610
|
-
function createSeq(schema, obj, ctx) {
|
|
30611
|
-
const { replacer } = ctx;
|
|
30612
|
-
const seq = new YAMLSeq(schema);
|
|
30613
|
-
if (obj && Symbol.iterator in Object(obj)) {
|
|
30614
|
-
let i = 0;
|
|
30615
|
-
for (let it of obj) {
|
|
30616
|
-
if (typeof replacer === 'function') {
|
|
30617
|
-
const key = obj instanceof Set ? it : String(i++);
|
|
30618
|
-
it = replacer.call(obj, key, it);
|
|
30619
|
-
}
|
|
30620
|
-
seq.items.push(createNode(it, undefined, ctx));
|
|
30621
|
-
}
|
|
30622
|
-
}
|
|
30623
|
-
return seq;
|
|
30624
|
-
}
|
|
30625
31784
|
const seq = {
|
|
30626
31785
|
collection: 'seq',
|
|
30627
|
-
createNode: createSeq,
|
|
30628
31786
|
default: true,
|
|
30629
31787
|
nodeClass: YAMLSeq,
|
|
30630
31788
|
tag: 'tag:yaml.org,2002:seq',
|
|
@@ -30632,7 +31790,8 @@ const seq = {
|
|
|
30632
31790
|
if (!isSeq(seq))
|
|
30633
31791
|
onError('Expected a sequence for this tag');
|
|
30634
31792
|
return seq;
|
|
30635
|
-
}
|
|
31793
|
+
},
|
|
31794
|
+
createNode: (schema, obj, ctx) => YAMLSeq.from(schema, obj, ctx)
|
|
30636
31795
|
};
|
|
30637
31796
|
|
|
30638
31797
|
const string = {
|
|
@@ -30957,8 +32116,9 @@ function createPairs(schema, iterable, ctx) {
|
|
|
30957
32116
|
key = keys[0];
|
|
30958
32117
|
value = it[key];
|
|
30959
32118
|
}
|
|
30960
|
-
else
|
|
30961
|
-
throw new TypeError(`Expected
|
|
32119
|
+
else {
|
|
32120
|
+
throw new TypeError(`Expected tuple with one key, not ${keys.length} keys`);
|
|
32121
|
+
}
|
|
30962
32122
|
}
|
|
30963
32123
|
else {
|
|
30964
32124
|
key = it;
|
|
@@ -31010,6 +32170,12 @@ class YAMLOMap extends YAMLSeq {
|
|
|
31010
32170
|
}
|
|
31011
32171
|
return map;
|
|
31012
32172
|
}
|
|
32173
|
+
static from(schema, iterable, ctx) {
|
|
32174
|
+
const pairs = createPairs(schema, iterable, ctx);
|
|
32175
|
+
const omap = new this();
|
|
32176
|
+
omap.items = pairs.items;
|
|
32177
|
+
return omap;
|
|
32178
|
+
}
|
|
31013
32179
|
}
|
|
31014
32180
|
YAMLOMap.tag = 'tag:yaml.org,2002:omap';
|
|
31015
32181
|
const omap = {
|
|
@@ -31033,12 +32199,7 @@ const omap = {
|
|
|
31033
32199
|
}
|
|
31034
32200
|
return Object.assign(new YAMLOMap(), pairs);
|
|
31035
32201
|
},
|
|
31036
|
-
createNode(schema, iterable, ctx)
|
|
31037
|
-
const pairs = createPairs(schema, iterable, ctx);
|
|
31038
|
-
const omap = new YAMLOMap();
|
|
31039
|
-
omap.items = pairs.items;
|
|
31040
|
-
return omap;
|
|
31041
|
-
}
|
|
32202
|
+
createNode: (schema, iterable, ctx) => YAMLOMap.from(schema, iterable, ctx)
|
|
31042
32203
|
};
|
|
31043
32204
|
|
|
31044
32205
|
function boolStringify({ value, source }, ctx) {
|
|
@@ -31183,7 +32344,8 @@ class YAMLSet extends YAMLMap {
|
|
|
31183
32344
|
let pair;
|
|
31184
32345
|
if (isPair(key))
|
|
31185
32346
|
pair = key;
|
|
31186
|
-
else if (
|
|
32347
|
+
else if (key &&
|
|
32348
|
+
typeof key === 'object' &&
|
|
31187
32349
|
'key' in key &&
|
|
31188
32350
|
'value' in key &&
|
|
31189
32351
|
key.value === null)
|
|
@@ -31228,6 +32390,17 @@ class YAMLSet extends YAMLMap {
|
|
|
31228
32390
|
else
|
|
31229
32391
|
throw new Error('Set items must all have null values');
|
|
31230
32392
|
}
|
|
32393
|
+
static from(schema, iterable, ctx) {
|
|
32394
|
+
const { replacer } = ctx;
|
|
32395
|
+
const set = new this(schema);
|
|
32396
|
+
if (iterable && Symbol.iterator in Object(iterable))
|
|
32397
|
+
for (let value of iterable) {
|
|
32398
|
+
if (typeof replacer === 'function')
|
|
32399
|
+
value = replacer.call(iterable, value, value);
|
|
32400
|
+
set.items.push(createPair(value, null, ctx));
|
|
32401
|
+
}
|
|
32402
|
+
return set;
|
|
32403
|
+
}
|
|
31231
32404
|
}
|
|
31232
32405
|
YAMLSet.tag = 'tag:yaml.org,2002:set';
|
|
31233
32406
|
const set = {
|
|
@@ -31236,6 +32409,7 @@ const set = {
|
|
|
31236
32409
|
nodeClass: YAMLSet,
|
|
31237
32410
|
default: false,
|
|
31238
32411
|
tag: 'tag:yaml.org,2002:set',
|
|
32412
|
+
createNode: (schema, iterable, ctx) => YAMLSet.from(schema, iterable, ctx),
|
|
31239
32413
|
resolve(map, onError) {
|
|
31240
32414
|
if (isMap(map)) {
|
|
31241
32415
|
if (map.hasAllNullValues(true))
|
|
@@ -31246,17 +32420,6 @@ const set = {
|
|
|
31246
32420
|
else
|
|
31247
32421
|
onError('Expected a mapping for this tag');
|
|
31248
32422
|
return map;
|
|
31249
|
-
},
|
|
31250
|
-
createNode(schema, iterable, ctx) {
|
|
31251
|
-
const { replacer } = ctx;
|
|
31252
|
-
const set = new YAMLSet(schema);
|
|
31253
|
-
if (iterable && Symbol.iterator in Object(iterable))
|
|
31254
|
-
for (let value of iterable) {
|
|
31255
|
-
if (typeof replacer === 'function')
|
|
31256
|
-
value = replacer.call(iterable, value, value);
|
|
31257
|
-
set.items.push(createPair(value, null, ctx));
|
|
31258
|
-
}
|
|
31259
|
-
return set;
|
|
31260
32423
|
}
|
|
31261
32424
|
};
|
|
31262
32425
|
|
|
@@ -31303,7 +32466,7 @@ function stringifySexagesimal(node) {
|
|
|
31303
32466
|
}
|
|
31304
32467
|
return (sign +
|
|
31305
32468
|
parts
|
|
31306
|
-
.map(n => (n
|
|
32469
|
+
.map(n => String(n).padStart(2, '0'))
|
|
31307
32470
|
.join(':')
|
|
31308
32471
|
.replace(/000000\d*$/, '') // % 60 may introduce error
|
|
31309
32472
|
);
|
|
@@ -31558,59 +32721,6 @@ function stringifyDocument(doc, options) {
|
|
|
31558
32721
|
return lines.join('\n') + '\n';
|
|
31559
32722
|
}
|
|
31560
32723
|
|
|
31561
|
-
/**
|
|
31562
|
-
* Applies the JSON.parse reviver algorithm as defined in the ECMA-262 spec,
|
|
31563
|
-
* in section 24.5.1.1 "Runtime Semantics: InternalizeJSONProperty" of the
|
|
31564
|
-
* 2021 edition: https://tc39.es/ecma262/#sec-json.parse
|
|
31565
|
-
*
|
|
31566
|
-
* Includes extensions for handling Map and Set objects.
|
|
31567
|
-
*/
|
|
31568
|
-
function applyReviver(reviver, obj, key, val) {
|
|
31569
|
-
if (val && typeof val === 'object') {
|
|
31570
|
-
if (Array.isArray(val)) {
|
|
31571
|
-
for (let i = 0, len = val.length; i < len; ++i) {
|
|
31572
|
-
const v0 = val[i];
|
|
31573
|
-
const v1 = applyReviver(reviver, val, String(i), v0);
|
|
31574
|
-
if (v1 === undefined)
|
|
31575
|
-
delete val[i];
|
|
31576
|
-
else if (v1 !== v0)
|
|
31577
|
-
val[i] = v1;
|
|
31578
|
-
}
|
|
31579
|
-
}
|
|
31580
|
-
else if (val instanceof Map) {
|
|
31581
|
-
for (const k of Array.from(val.keys())) {
|
|
31582
|
-
const v0 = val.get(k);
|
|
31583
|
-
const v1 = applyReviver(reviver, val, k, v0);
|
|
31584
|
-
if (v1 === undefined)
|
|
31585
|
-
val.delete(k);
|
|
31586
|
-
else if (v1 !== v0)
|
|
31587
|
-
val.set(k, v1);
|
|
31588
|
-
}
|
|
31589
|
-
}
|
|
31590
|
-
else if (val instanceof Set) {
|
|
31591
|
-
for (const v0 of Array.from(val)) {
|
|
31592
|
-
const v1 = applyReviver(reviver, val, v0, v0);
|
|
31593
|
-
if (v1 === undefined)
|
|
31594
|
-
val.delete(v0);
|
|
31595
|
-
else if (v1 !== v0) {
|
|
31596
|
-
val.delete(v0);
|
|
31597
|
-
val.add(v1);
|
|
31598
|
-
}
|
|
31599
|
-
}
|
|
31600
|
-
}
|
|
31601
|
-
else {
|
|
31602
|
-
for (const [k, v0] of Object.entries(val)) {
|
|
31603
|
-
const v1 = applyReviver(reviver, val, k, v0);
|
|
31604
|
-
if (v1 === undefined)
|
|
31605
|
-
delete val[k];
|
|
31606
|
-
else if (v1 !== v0)
|
|
31607
|
-
val[k] = v1;
|
|
31608
|
-
}
|
|
31609
|
-
}
|
|
31610
|
-
}
|
|
31611
|
-
return reviver.call(obj, key, val);
|
|
31612
|
-
}
|
|
31613
|
-
|
|
31614
32724
|
class Document {
|
|
31615
32725
|
constructor(value, replacer, options) {
|
|
31616
32726
|
/** A comment before this Document */
|
|
@@ -31649,11 +32759,9 @@ class Document {
|
|
|
31649
32759
|
else
|
|
31650
32760
|
this.directives = new Directives({ version });
|
|
31651
32761
|
this.setSchema(version, options);
|
|
31652
|
-
|
|
31653
|
-
|
|
31654
|
-
|
|
31655
|
-
this.contents = this.createNode(value, _replacer, options);
|
|
31656
|
-
}
|
|
32762
|
+
// @ts-expect-error We can't really know that this matches Contents.
|
|
32763
|
+
this.contents =
|
|
32764
|
+
value === undefined ? null : this.createNode(value, _replacer, options);
|
|
31657
32765
|
}
|
|
31658
32766
|
/**
|
|
31659
32767
|
* Create a deep copy of this Document and its contents.
|
|
@@ -31672,6 +32780,7 @@ class Document {
|
|
|
31672
32780
|
if (this.directives)
|
|
31673
32781
|
copy.directives = this.directives.clone();
|
|
31674
32782
|
copy.schema = this.schema.clone();
|
|
32783
|
+
// @ts-expect-error We can't really know that this matches Contents.
|
|
31675
32784
|
copy.contents = isNode$1(this.contents)
|
|
31676
32785
|
? this.contents.clone(copy.schema)
|
|
31677
32786
|
: this.contents;
|
|
@@ -31767,6 +32876,7 @@ class Document {
|
|
|
31767
32876
|
if (isEmptyPath(path)) {
|
|
31768
32877
|
if (this.contents == null)
|
|
31769
32878
|
return false;
|
|
32879
|
+
// @ts-expect-error Presumed impossible if Strict extends false
|
|
31770
32880
|
this.contents = null;
|
|
31771
32881
|
return true;
|
|
31772
32882
|
}
|
|
@@ -31818,6 +32928,7 @@ class Document {
|
|
|
31818
32928
|
*/
|
|
31819
32929
|
set(key, value) {
|
|
31820
32930
|
if (this.contents == null) {
|
|
32931
|
+
// @ts-expect-error We can't really know that this matches Contents.
|
|
31821
32932
|
this.contents = collectionFromPath(this.schema, [key], value);
|
|
31822
32933
|
}
|
|
31823
32934
|
else if (assertCollection(this.contents)) {
|
|
@@ -31829,9 +32940,12 @@ class Document {
|
|
|
31829
32940
|
* boolean to add/remove the item from the set.
|
|
31830
32941
|
*/
|
|
31831
32942
|
setIn(path, value) {
|
|
31832
|
-
if (isEmptyPath(path))
|
|
32943
|
+
if (isEmptyPath(path)) {
|
|
32944
|
+
// @ts-expect-error We can't really know that this matches Contents.
|
|
31833
32945
|
this.contents = value;
|
|
32946
|
+
}
|
|
31834
32947
|
else if (this.contents == null) {
|
|
32948
|
+
// @ts-expect-error We can't really know that this matches Contents.
|
|
31835
32949
|
this.contents = collectionFromPath(this.schema, Array.from(path), value);
|
|
31836
32950
|
}
|
|
31837
32951
|
else if (assertCollection(this.contents)) {
|
|
@@ -31891,8 +33005,7 @@ class Document {
|
|
|
31891
33005
|
keep: !json,
|
|
31892
33006
|
mapAsMap: mapAsMap === true,
|
|
31893
33007
|
mapKeyWarned: false,
|
|
31894
|
-
maxAliasCount: typeof maxAliasCount === 'number' ? maxAliasCount : 100
|
|
31895
|
-
stringify: stringify$2
|
|
33008
|
+
maxAliasCount: typeof maxAliasCount === 'number' ? maxAliasCount : 100
|
|
31896
33009
|
};
|
|
31897
33010
|
const res = toJS(this.contents, jsonArg ?? '', ctx);
|
|
31898
33011
|
if (typeof onAnchor === 'function')
|
|
@@ -31978,7 +33091,7 @@ const prettifyError = (src, lc) => (error) => {
|
|
|
31978
33091
|
let count = 1;
|
|
31979
33092
|
const end = error.linePos[1];
|
|
31980
33093
|
if (end && end.line === line && end.col > col) {
|
|
31981
|
-
count = Math.min(end.col - col, 80 - ci);
|
|
33094
|
+
count = Math.max(1, Math.min(end.col - col, 80 - ci));
|
|
31982
33095
|
}
|
|
31983
33096
|
const pointer = ' '.repeat(ci) + '^'.repeat(count);
|
|
31984
33097
|
error.message += `:\n\n${lineStr}\n${pointer}\n`;
|
|
@@ -32178,11 +33291,13 @@ function mapIncludes(ctx, items, search) {
|
|
|
32178
33291
|
}
|
|
32179
33292
|
|
|
32180
33293
|
const startColMsg = 'All mapping items must start at the same column';
|
|
32181
|
-
function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError) {
|
|
32182
|
-
const
|
|
33294
|
+
function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, tag) {
|
|
33295
|
+
const NodeClass = tag?.nodeClass ?? YAMLMap;
|
|
33296
|
+
const map = new NodeClass(ctx.schema);
|
|
32183
33297
|
if (ctx.atRoot)
|
|
32184
33298
|
ctx.atRoot = false;
|
|
32185
33299
|
let offset = bm.offset;
|
|
33300
|
+
let commentEnd = null;
|
|
32186
33301
|
for (const collItem of bm.items) {
|
|
32187
33302
|
const { start, key, sep, value } = collItem;
|
|
32188
33303
|
// key properties
|
|
@@ -32202,7 +33317,7 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError) {
|
|
|
32202
33317
|
onError(offset, 'BAD_INDENT', startColMsg);
|
|
32203
33318
|
}
|
|
32204
33319
|
if (!keyProps.anchor && !keyProps.tag && !sep) {
|
|
32205
|
-
|
|
33320
|
+
commentEnd = keyProps.end;
|
|
32206
33321
|
if (keyProps.comment) {
|
|
32207
33322
|
if (map.comment)
|
|
32208
33323
|
map.comment += '\n' + keyProps.comment;
|
|
@@ -32272,15 +33387,19 @@ function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError) {
|
|
|
32272
33387
|
map.items.push(pair);
|
|
32273
33388
|
}
|
|
32274
33389
|
}
|
|
32275
|
-
|
|
33390
|
+
if (commentEnd && commentEnd < offset)
|
|
33391
|
+
onError(commentEnd, 'IMPOSSIBLE', 'Map comment with trailing content');
|
|
33392
|
+
map.range = [bm.offset, offset, commentEnd ?? offset];
|
|
32276
33393
|
return map;
|
|
32277
33394
|
}
|
|
32278
33395
|
|
|
32279
|
-
function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError) {
|
|
32280
|
-
const
|
|
33396
|
+
function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError, tag) {
|
|
33397
|
+
const NodeClass = tag?.nodeClass ?? YAMLSeq;
|
|
33398
|
+
const seq = new NodeClass(ctx.schema);
|
|
32281
33399
|
if (ctx.atRoot)
|
|
32282
33400
|
ctx.atRoot = false;
|
|
32283
33401
|
let offset = bs.offset;
|
|
33402
|
+
let commentEnd = null;
|
|
32284
33403
|
for (const { start, value } of bs.items) {
|
|
32285
33404
|
const props = resolveProps(start, {
|
|
32286
33405
|
indicator: 'seq-item-ind',
|
|
@@ -32289,16 +33408,15 @@ function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError) {
|
|
|
32289
33408
|
onError,
|
|
32290
33409
|
startOnNewline: true
|
|
32291
33410
|
});
|
|
32292
|
-
offset = props.end;
|
|
32293
33411
|
if (!props.found) {
|
|
32294
33412
|
if (props.anchor || props.tag || value) {
|
|
32295
33413
|
if (value && value.type === 'block-seq')
|
|
32296
|
-
onError(
|
|
33414
|
+
onError(props.end, 'BAD_INDENT', 'All sequence items must start at the same column');
|
|
32297
33415
|
else
|
|
32298
33416
|
onError(offset, 'MISSING_CHAR', 'Sequence item without - indicator');
|
|
32299
33417
|
}
|
|
32300
33418
|
else {
|
|
32301
|
-
|
|
33419
|
+
commentEnd = props.end;
|
|
32302
33420
|
if (props.comment)
|
|
32303
33421
|
seq.comment = props.comment;
|
|
32304
33422
|
continue;
|
|
@@ -32306,13 +33424,13 @@ function resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError) {
|
|
|
32306
33424
|
}
|
|
32307
33425
|
const node = value
|
|
32308
33426
|
? composeNode(ctx, value, props, onError)
|
|
32309
|
-
: composeEmptyNode(ctx,
|
|
33427
|
+
: composeEmptyNode(ctx, props.end, start, null, props, onError);
|
|
32310
33428
|
if (ctx.schema.compat)
|
|
32311
33429
|
flowIndentCheck(bs.indent, value, onError);
|
|
32312
33430
|
offset = node.range[2];
|
|
32313
33431
|
seq.items.push(node);
|
|
32314
33432
|
}
|
|
32315
|
-
seq.range = [bs.offset, offset, offset];
|
|
33433
|
+
seq.range = [bs.offset, offset, commentEnd ?? offset];
|
|
32316
33434
|
return seq;
|
|
32317
33435
|
}
|
|
32318
33436
|
|
|
@@ -32354,12 +33472,11 @@ function resolveEnd(end, offset, reqSpace, onError) {
|
|
|
32354
33472
|
|
|
32355
33473
|
const blockMsg = 'Block collections are not allowed within flow collections';
|
|
32356
33474
|
const isBlock$1 = (token) => token && (token.type === 'block-map' || token.type === 'block-seq');
|
|
32357
|
-
function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onError) {
|
|
33475
|
+
function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onError, tag) {
|
|
32358
33476
|
const isMap = fc.start.source === '{';
|
|
32359
33477
|
const fcName = isMap ? 'flow map' : 'flow sequence';
|
|
32360
|
-
const
|
|
32361
|
-
|
|
32362
|
-
: new YAMLSeq(ctx.schema);
|
|
33478
|
+
const NodeClass = (tag?.nodeClass ?? (isMap ? YAMLMap : YAMLSeq));
|
|
33479
|
+
const coll = new NodeClass(ctx.schema);
|
|
32363
33480
|
coll.flow = true;
|
|
32364
33481
|
const atRoot = ctx.atRoot;
|
|
32365
33482
|
if (atRoot)
|
|
@@ -32542,35 +33659,45 @@ function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onErr
|
|
|
32542
33659
|
return coll;
|
|
32543
33660
|
}
|
|
32544
33661
|
|
|
32545
|
-
function
|
|
32546
|
-
|
|
32547
|
-
|
|
32548
|
-
|
|
32549
|
-
|
|
32550
|
-
|
|
32551
|
-
}
|
|
32552
|
-
case 'block-seq': {
|
|
32553
|
-
coll = resolveBlockSeq(CN, ctx, token, onError);
|
|
32554
|
-
break;
|
|
32555
|
-
}
|
|
32556
|
-
case 'flow-collection': {
|
|
32557
|
-
coll = resolveFlowCollection(CN, ctx, token, onError);
|
|
32558
|
-
break;
|
|
32559
|
-
}
|
|
32560
|
-
}
|
|
32561
|
-
if (!tagToken)
|
|
32562
|
-
return coll;
|
|
32563
|
-
const tagName = ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg));
|
|
32564
|
-
if (!tagName)
|
|
32565
|
-
return coll;
|
|
32566
|
-
// Cast needed due to: https://github.com/Microsoft/TypeScript/issues/3841
|
|
33662
|
+
function resolveCollection(CN, ctx, token, onError, tagName, tag) {
|
|
33663
|
+
const coll = token.type === 'block-map'
|
|
33664
|
+
? resolveBlockMap(CN, ctx, token, onError, tag)
|
|
33665
|
+
: token.type === 'block-seq'
|
|
33666
|
+
? resolveBlockSeq(CN, ctx, token, onError, tag)
|
|
33667
|
+
: resolveFlowCollection(CN, ctx, token, onError, tag);
|
|
32567
33668
|
const Coll = coll.constructor;
|
|
33669
|
+
// If we got a tagName matching the class, or the tag name is '!',
|
|
33670
|
+
// then use the tagName from the node class used to create it.
|
|
32568
33671
|
if (tagName === '!' || tagName === Coll.tagName) {
|
|
32569
33672
|
coll.tag = Coll.tagName;
|
|
32570
33673
|
return coll;
|
|
32571
33674
|
}
|
|
32572
|
-
|
|
32573
|
-
|
|
33675
|
+
if (tagName)
|
|
33676
|
+
coll.tag = tagName;
|
|
33677
|
+
return coll;
|
|
33678
|
+
}
|
|
33679
|
+
function composeCollection(CN, ctx, token, tagToken, onError) {
|
|
33680
|
+
const tagName = !tagToken
|
|
33681
|
+
? null
|
|
33682
|
+
: ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg));
|
|
33683
|
+
const expType = token.type === 'block-map'
|
|
33684
|
+
? 'map'
|
|
33685
|
+
: token.type === 'block-seq'
|
|
33686
|
+
? 'seq'
|
|
33687
|
+
: token.start.source === '{'
|
|
33688
|
+
? 'map'
|
|
33689
|
+
: 'seq';
|
|
33690
|
+
// shortcut: check if it's a generic YAMLMap or YAMLSeq
|
|
33691
|
+
// before jumping into the custom tag logic.
|
|
33692
|
+
if (!tagToken ||
|
|
33693
|
+
!tagName ||
|
|
33694
|
+
tagName === '!' ||
|
|
33695
|
+
(tagName === YAMLMap.tagName && expType === 'map') ||
|
|
33696
|
+
(tagName === YAMLSeq.tagName && expType === 'seq') ||
|
|
33697
|
+
!expType) {
|
|
33698
|
+
return resolveCollection(CN, ctx, token, onError, tagName);
|
|
33699
|
+
}
|
|
33700
|
+
let tag = ctx.schema.tags.find(t => t.tag === tagName && t.collection === expType);
|
|
32574
33701
|
if (!tag) {
|
|
32575
33702
|
const kt = ctx.schema.knownTags[tagName];
|
|
32576
33703
|
if (kt && kt.collection === expType) {
|
|
@@ -32578,12 +33705,17 @@ function composeCollection(CN, ctx, token, tagToken, onError) {
|
|
|
32578
33705
|
tag = kt;
|
|
32579
33706
|
}
|
|
32580
33707
|
else {
|
|
32581
|
-
|
|
32582
|
-
|
|
32583
|
-
|
|
33708
|
+
if (kt?.collection) {
|
|
33709
|
+
onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection}`, true);
|
|
33710
|
+
}
|
|
33711
|
+
else {
|
|
33712
|
+
onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, true);
|
|
33713
|
+
}
|
|
33714
|
+
return resolveCollection(CN, ctx, token, onError, tagName);
|
|
32584
33715
|
}
|
|
32585
33716
|
}
|
|
32586
|
-
const
|
|
33717
|
+
const coll = resolveCollection(CN, ctx, token, onError, tagName, tag);
|
|
33718
|
+
const res = tag.resolve?.(coll, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg), ctx.options) ?? coll;
|
|
32587
33719
|
const node = isNode$1(res)
|
|
32588
33720
|
? res
|
|
32589
33721
|
: new Scalar(res);
|
|
@@ -33154,7 +34286,7 @@ function composeNode(ctx, token, props, onError) {
|
|
|
33154
34286
|
node.srcToken = token;
|
|
33155
34287
|
return node;
|
|
33156
34288
|
}
|
|
33157
|
-
function composeEmptyNode(ctx, offset, before, pos, { spaceBefore, comment, anchor, tag }, onError) {
|
|
34289
|
+
function composeEmptyNode(ctx, offset, before, pos, { spaceBefore, comment, anchor, tag, end }, onError) {
|
|
33158
34290
|
const token = {
|
|
33159
34291
|
type: 'scalar',
|
|
33160
34292
|
offset: emptyScalarPosition(offset, before, pos),
|
|
@@ -33169,8 +34301,10 @@ function composeEmptyNode(ctx, offset, before, pos, { spaceBefore, comment, anch
|
|
|
33169
34301
|
}
|
|
33170
34302
|
if (spaceBefore)
|
|
33171
34303
|
node.spaceBefore = true;
|
|
33172
|
-
if (comment)
|
|
34304
|
+
if (comment) {
|
|
33173
34305
|
node.comment = comment;
|
|
34306
|
+
node.range[2] = end;
|
|
34307
|
+
}
|
|
33174
34308
|
return node;
|
|
33175
34309
|
}
|
|
33176
34310
|
function composeAlias({ options }, { offset, source, end }, onError) {
|
|
@@ -33210,6 +34344,7 @@ function composeDoc(options, directives, { offset, start, value, end }, onError)
|
|
|
33210
34344
|
!props.hasNewline)
|
|
33211
34345
|
onError(props.end, 'MISSING_CHAR', 'Block collection cannot start on same line with directives-end marker');
|
|
33212
34346
|
}
|
|
34347
|
+
// @ts-expect-error If Contents is set, let's trust the user
|
|
33213
34348
|
doc.contents = value
|
|
33214
34349
|
? composeNode(ctx, value, props, onError)
|
|
33215
34350
|
: composeEmptyNode(ctx, props.end, start, null, props, onError);
|
|
@@ -36006,6 +37141,7 @@ const withTypeScriptLoader = (rcFunc) => {
|
|
|
36006
37141
|
try {
|
|
36007
37142
|
// Register TypeScript compiler instance
|
|
36008
37143
|
registerer = __require('ts-node').register({
|
|
37144
|
+
// transpile to cjs even if compilerOptions.module in tsconfig is not Node16/NodeNext.
|
|
36009
37145
|
moduleTypes: { '**/*.cts': 'cjs' }
|
|
36010
37146
|
});
|
|
36011
37147
|
|
|
@@ -37857,11 +38993,12 @@ function cssPostPlugin(config) {
|
|
|
37857
38993
|
? rollupOptionsOutput[0]
|
|
37858
38994
|
: rollupOptionsOutput)?.assetFileNames;
|
|
37859
38995
|
const getCssAssetDirname = (cssAssetName) => {
|
|
38996
|
+
const cssAssetNameDir = path$o.dirname(cssAssetName);
|
|
37860
38997
|
if (!assetFileNames) {
|
|
37861
|
-
return config.build.assetsDir;
|
|
38998
|
+
return path$o.join(config.build.assetsDir, cssAssetNameDir);
|
|
37862
38999
|
}
|
|
37863
39000
|
else if (typeof assetFileNames === 'string') {
|
|
37864
|
-
return path$o.dirname(assetFileNames);
|
|
39001
|
+
return path$o.join(path$o.dirname(assetFileNames), cssAssetNameDir);
|
|
37865
39002
|
}
|
|
37866
39003
|
else {
|
|
37867
39004
|
return path$o.dirname(assetFileNames({
|
|
@@ -37997,7 +39134,7 @@ function cssPostPlugin(config) {
|
|
|
37997
39134
|
const encodedPublicUrls = encodePublicUrlsInCSS(config);
|
|
37998
39135
|
const relative = config.base === './' || config.base === '';
|
|
37999
39136
|
const cssAssetDirname = encodedPublicUrls || relative
|
|
38000
|
-
? getCssAssetDirname(cssAssetName)
|
|
39137
|
+
? slash$1(getCssAssetDirname(cssAssetName))
|
|
38001
39138
|
: undefined;
|
|
38002
39139
|
const toRelative = (filename) => {
|
|
38003
39140
|
// relative base + extracted CSS
|
|
@@ -38030,7 +39167,14 @@ function cssPostPlugin(config) {
|
|
|
38030
39167
|
pureCssChunks.add(chunk);
|
|
38031
39168
|
}
|
|
38032
39169
|
const isEntry = chunk.isEntry && isPureCssChunk;
|
|
38033
|
-
const
|
|
39170
|
+
const cssFullAssetName = ensureFileExt(chunk.name, '.css');
|
|
39171
|
+
// if facadeModuleId doesn't exist or doesn't have a CSS extension,
|
|
39172
|
+
// that means a JS entry file imports a CSS file.
|
|
39173
|
+
// in this case, only use the filename for the CSS chunk name like JS chunks.
|
|
39174
|
+
const cssAssetName = chunk.isEntry &&
|
|
39175
|
+
(!chunk.facadeModuleId || !isCSSRequest(chunk.facadeModuleId))
|
|
39176
|
+
? path$o.basename(cssFullAssetName)
|
|
39177
|
+
: cssFullAssetName;
|
|
38034
39178
|
const originalFilename = getChunkOriginalFileName(chunk, config.root, opts.format);
|
|
38035
39179
|
chunkCSS = resolveAssetUrlsInCss(chunkCSS, cssAssetName);
|
|
38036
39180
|
const previousTask = emitTasks[emitTasks.length - 1];
|
|
@@ -38509,8 +39653,8 @@ function createCachedImport(imp) {
|
|
|
38509
39653
|
return cached;
|
|
38510
39654
|
};
|
|
38511
39655
|
}
|
|
38512
|
-
const importPostcssImport = createCachedImport(() => import('./dep-
|
|
38513
|
-
const importPostcssModules = createCachedImport(() => import('./dep-
|
|
39656
|
+
const importPostcssImport = createCachedImport(() => import('./dep-_rppyaaB.js').then(function (n) { return n.i; }));
|
|
39657
|
+
const importPostcssModules = createCachedImport(() => import('./dep-m-h4L35S.js').then(function (n) { return n.i; }));
|
|
38514
39658
|
const importPostcss = createCachedImport(() => import('postcss'));
|
|
38515
39659
|
/**
|
|
38516
39660
|
* @experimental
|
|
@@ -57162,10 +58306,9 @@ function htmlFallbackMiddleware(root, spaFallback) {
|
|
|
57162
58306
|
if (
|
|
57163
58307
|
// Only accept GET or HEAD
|
|
57164
58308
|
(req.method !== 'GET' && req.method !== 'HEAD') ||
|
|
57165
|
-
// Ignore JSON requests
|
|
57166
|
-
req.headers.accept?.includes('application/json') ||
|
|
57167
58309
|
// Require Accept: text/html or */*
|
|
57168
58310
|
!(req.headers.accept === undefined || // equivalent to `Accept: */*`
|
|
58311
|
+
req.headers.accept === '' || // equivalent to `Accept: */*`
|
|
57169
58312
|
req.headers.accept.includes('text/html') ||
|
|
57170
58313
|
req.headers.accept.includes('*/*'))) {
|
|
57171
58314
|
return next();
|
|
@@ -57245,7 +58388,9 @@ function send(req, res, content, type, options) {
|
|
|
57245
58388
|
}
|
|
57246
58389
|
// inject fallback sourcemap for js for improved debugging
|
|
57247
58390
|
// https://github.com/vitejs/vite/pull/13514#issuecomment-1592431496
|
|
57248
|
-
|
|
58391
|
+
// for { mappings: "" }, we don't inject fallback sourcemap
|
|
58392
|
+
// because it indicates generating a sourcemap is meaningless
|
|
58393
|
+
else if (type === 'js' && map == null) {
|
|
57249
58394
|
const code = content.toString();
|
|
57250
58395
|
// if the code has existing inline sourcemap, assume it's correct and skip
|
|
57251
58396
|
if (convertSourceMap.mapFileCommentRegex.test(code)) {
|
|
@@ -57254,11 +58399,15 @@ function send(req, res, content, type, options) {
|
|
|
57254
58399
|
else {
|
|
57255
58400
|
const urlWithoutTimestamp = removeTimestampQuery(req.url);
|
|
57256
58401
|
const ms = new MagicString(code);
|
|
57257
|
-
|
|
58402
|
+
const map = ms.generateMap({
|
|
57258
58403
|
source: path$o.basename(urlWithoutTimestamp),
|
|
57259
58404
|
hires: 'boundary',
|
|
57260
|
-
includeContent:
|
|
57261
|
-
})
|
|
58405
|
+
includeContent: !options.originalContent,
|
|
58406
|
+
});
|
|
58407
|
+
if (options.originalContent != null) {
|
|
58408
|
+
map.sourcesContent = [options.originalContent];
|
|
58409
|
+
}
|
|
58410
|
+
content = getCodeWithSourcemap(type, code, map);
|
|
57262
58411
|
}
|
|
57263
58412
|
}
|
|
57264
58413
|
res.statusCode = 200;
|
|
@@ -57394,12 +58543,19 @@ function transformMiddleware(server) {
|
|
|
57394
58543
|
const depsOptimizer = getDepsOptimizer(server.config, false); // non-ssr
|
|
57395
58544
|
const type = isDirectCSSRequest(url) ? 'css' : 'js';
|
|
57396
58545
|
const isDep = DEP_VERSION_RE.test(url) || depsOptimizer?.isOptimizedDepUrl(url);
|
|
58546
|
+
let originalContent;
|
|
58547
|
+
if (type === 'js' && result.map == null) {
|
|
58548
|
+
const filepath = (await server.moduleGraph.getModuleByUrl(url, false))?.file;
|
|
58549
|
+
originalContent =
|
|
58550
|
+
filepath != null ? await getOriginalContent(filepath) : undefined;
|
|
58551
|
+
}
|
|
57397
58552
|
return send(req, res, result.code, type, {
|
|
57398
58553
|
etag: result.etag,
|
|
57399
58554
|
// allow browser to cache npm deps!
|
|
57400
58555
|
cacheControl: isDep ? 'max-age=31536000,immutable' : 'no-cache',
|
|
57401
58556
|
headers: server.config.server.headers,
|
|
57402
58557
|
map: result.map,
|
|
58558
|
+
originalContent,
|
|
57403
58559
|
});
|
|
57404
58560
|
}
|
|
57405
58561
|
}
|
|
@@ -61095,10 +62251,11 @@ class VariableDynamicImportError extends Error {}
|
|
|
61095
62251
|
const example = 'For example: import(`./foo/${bar}.js`).';
|
|
61096
62252
|
|
|
61097
62253
|
function sanitizeString(str) {
|
|
62254
|
+
if (str === '') return str;
|
|
61098
62255
|
if (str.includes('*')) {
|
|
61099
62256
|
throw new VariableDynamicImportError('A dynamic import cannot contain * characters.');
|
|
61100
62257
|
}
|
|
61101
|
-
return str;
|
|
62258
|
+
return glob.escapePath(str);
|
|
61102
62259
|
}
|
|
61103
62260
|
|
|
61104
62261
|
function templateLiteralToGlob(node) {
|
|
@@ -61239,7 +62396,9 @@ function parseDynamicImportPattern(strings) {
|
|
|
61239
62396
|
if (!userPatternQuery) {
|
|
61240
62397
|
return null;
|
|
61241
62398
|
}
|
|
61242
|
-
const [userPattern] = userPatternQuery.split(
|
|
62399
|
+
const [userPattern] = userPatternQuery.split(
|
|
62400
|
+
// ? is escaped on posix OS
|
|
62401
|
+
requestQueryMaybeEscapedSplitRE, 2);
|
|
61243
62402
|
const [rawPattern] = filename.split(requestQuerySplitRE, 2);
|
|
61244
62403
|
const as = ['worker', 'url', 'raw'].find((key) => rawQuery && key in rawQuery);
|
|
61245
62404
|
if (as) {
|
|
@@ -61628,6 +62787,20 @@ async function createPluginContainer(config, moduleGraph, watcher) {
|
|
|
61628
62787
|
_addedImports = null;
|
|
61629
62788
|
constructor(initialPlugin) {
|
|
61630
62789
|
this._activePlugin = initialPlugin || null;
|
|
62790
|
+
this.parse = this.parse.bind(this);
|
|
62791
|
+
this.resolve = this.resolve.bind(this);
|
|
62792
|
+
this.load = this.load.bind(this);
|
|
62793
|
+
this.getModuleInfo = this.getModuleInfo.bind(this);
|
|
62794
|
+
this.getModuleIds = this.getModuleIds.bind(this);
|
|
62795
|
+
this.addWatchFile = this.addWatchFile.bind(this);
|
|
62796
|
+
this.getWatchFiles = this.getWatchFiles.bind(this);
|
|
62797
|
+
this.emitFile = this.emitFile.bind(this);
|
|
62798
|
+
this.setAssetSource = this.setAssetSource.bind(this);
|
|
62799
|
+
this.getFileName = this.getFileName.bind(this);
|
|
62800
|
+
this.warn = this.warn.bind(this);
|
|
62801
|
+
this.error = this.error.bind(this);
|
|
62802
|
+
this.debug = this.debug.bind(this);
|
|
62803
|
+
this.info = this.info.bind(this);
|
|
61631
62804
|
}
|
|
61632
62805
|
parse(code, opts) {
|
|
61633
62806
|
return parseAst(code, opts);
|