path-serializer 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +139 -11
- package/dist/cjs/index.cjs +643 -0
- package/dist/esm/index.js +616 -0
- package/package.json +29 -34
- package/dist/cjs/index.js +0 -930
- package/dist/esm/index.mjs +0 -899
package/dist/cjs/index.js
DELETED
|
@@ -1,930 +0,0 @@
|
|
|
1
|
-
var __webpack_modules__ = {
|
|
2
|
-
"./node_modules/.pnpm/upath@2.0.1/node_modules/upath/build/code/upath.js": function(__unused_webpack_module, exports1, __webpack_require__) {
|
|
3
|
-
/**
|
|
4
|
-
* upath http://github.com/anodynos/upath/
|
|
5
|
-
*
|
|
6
|
-
* A proxy to `path`, replacing `\` with `/` for all results (supports UNC paths) & new methods to normalize & join keeping leading `./` and add, change, default, trim file extensions.
|
|
7
|
-
* Version 2.0.1 - Compiled on 2020-11-07 16:59:47
|
|
8
|
-
* Repository git://github.com/anodynos/upath
|
|
9
|
-
* Copyright(c) 2020 Angelos Pikoulas <agelos.pikoulas@gmail.com>
|
|
10
|
-
* License MIT
|
|
11
|
-
*/ // Generated by uRequire v0.7.0-beta.33 target: 'lib' template: 'nodejs'
|
|
12
|
-
var VERSION = '2.0.1'; // injected by urequire-rc-inject-version
|
|
13
|
-
var extraFn, extraFunctions, isFunction, isString, isValidExt, name, path, propName, propValue, toUnix, upath, slice = [].slice, indexOf = [].indexOf || function(item) {
|
|
14
|
-
for(var i = 0, l = this.length; i < l; i++)if (i in this && this[i] === item) return i;
|
|
15
|
-
return -1;
|
|
16
|
-
}, hasProp = {}.hasOwnProperty;
|
|
17
|
-
path = __webpack_require__("path");
|
|
18
|
-
isFunction = function(val) {
|
|
19
|
-
return "function" == typeof val;
|
|
20
|
-
};
|
|
21
|
-
isString = function(val) {
|
|
22
|
-
return "string" == typeof val || !!val && "object" == typeof val && "[object String]" === Object.prototype.toString.call(val);
|
|
23
|
-
};
|
|
24
|
-
upath = exports1;
|
|
25
|
-
upath.VERSION = null != VERSION ? VERSION : "NO-VERSION";
|
|
26
|
-
toUnix = function(p) {
|
|
27
|
-
p = p.replace(/\\/g, "/");
|
|
28
|
-
p = p.replace(/(?<!^)\/+/g, "/");
|
|
29
|
-
return p;
|
|
30
|
-
};
|
|
31
|
-
for(propName in path){
|
|
32
|
-
propValue = path[propName];
|
|
33
|
-
if (isFunction(propValue)) upath[propName] = function(propName) {
|
|
34
|
-
return function() {
|
|
35
|
-
var args, result;
|
|
36
|
-
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
|
37
|
-
args = args.map(function(p) {
|
|
38
|
-
if (isString(p)) return toUnix(p);
|
|
39
|
-
return p;
|
|
40
|
-
});
|
|
41
|
-
result = path[propName].apply(path, args);
|
|
42
|
-
if (isString(result)) return toUnix(result);
|
|
43
|
-
return result;
|
|
44
|
-
};
|
|
45
|
-
}(propName);
|
|
46
|
-
else upath[propName] = propValue;
|
|
47
|
-
}
|
|
48
|
-
upath.sep = "/";
|
|
49
|
-
extraFunctions = {
|
|
50
|
-
toUnix: toUnix,
|
|
51
|
-
normalizeSafe: function(p) {
|
|
52
|
-
var result;
|
|
53
|
-
p = toUnix(p);
|
|
54
|
-
result = upath.normalize(p);
|
|
55
|
-
if (!p.startsWith("./") || result.startsWith("./") || result.startsWith("..")) {
|
|
56
|
-
if (p.startsWith("//") && !result.startsWith("//")) result = p.startsWith("//./") ? "//." + result : "/" + result;
|
|
57
|
-
} else result = "./" + result;
|
|
58
|
-
return result;
|
|
59
|
-
},
|
|
60
|
-
normalizeTrim: function(p) {
|
|
61
|
-
p = upath.normalizeSafe(p);
|
|
62
|
-
if (p.endsWith("/")) return p.slice(0, +(p.length - 2) + 1 || 9000000000);
|
|
63
|
-
return p;
|
|
64
|
-
},
|
|
65
|
-
joinSafe: function() {
|
|
66
|
-
var p, p0, result;
|
|
67
|
-
p = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
|
68
|
-
result = upath.join.apply(null, p);
|
|
69
|
-
if (p.length > 0) {
|
|
70
|
-
p0 = toUnix(p[0]);
|
|
71
|
-
if (!p0.startsWith("./") || result.startsWith("./") || result.startsWith("..")) {
|
|
72
|
-
if (p0.startsWith("//") && !result.startsWith("//")) result = p0.startsWith("//./") ? "//." + result : "/" + result;
|
|
73
|
-
} else result = "./" + result;
|
|
74
|
-
}
|
|
75
|
-
return result;
|
|
76
|
-
},
|
|
77
|
-
addExt: function(file, ext) {
|
|
78
|
-
if (!ext) return file;
|
|
79
|
-
if ("." !== ext[0]) ext = "." + ext;
|
|
80
|
-
return file + (file.endsWith(ext) ? "" : ext);
|
|
81
|
-
},
|
|
82
|
-
trimExt: function(filename, ignoreExts, maxSize) {
|
|
83
|
-
var oldExt;
|
|
84
|
-
if (null == maxSize) maxSize = 7;
|
|
85
|
-
oldExt = upath.extname(filename);
|
|
86
|
-
if (isValidExt(oldExt, ignoreExts, maxSize)) return filename.slice(0, +(filename.length - oldExt.length - 1) + 1 || 9000000000);
|
|
87
|
-
return filename;
|
|
88
|
-
},
|
|
89
|
-
removeExt: function(filename, ext) {
|
|
90
|
-
if (!ext) return filename;
|
|
91
|
-
ext = "." === ext[0] ? ext : "." + ext;
|
|
92
|
-
if (upath.extname(filename) === ext) return upath.trimExt(filename, [], ext.length);
|
|
93
|
-
return filename;
|
|
94
|
-
},
|
|
95
|
-
changeExt: function(filename, ext, ignoreExts, maxSize) {
|
|
96
|
-
if (null == maxSize) maxSize = 7;
|
|
97
|
-
return upath.trimExt(filename, ignoreExts, maxSize) + (ext ? "." === ext[0] ? ext : "." + ext : "");
|
|
98
|
-
},
|
|
99
|
-
defaultExt: function(filename, ext, ignoreExts, maxSize) {
|
|
100
|
-
var oldExt;
|
|
101
|
-
if (null == maxSize) maxSize = 7;
|
|
102
|
-
oldExt = upath.extname(filename);
|
|
103
|
-
if (isValidExt(oldExt, ignoreExts, maxSize)) return filename;
|
|
104
|
-
return upath.addExt(filename, ext);
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
isValidExt = function(ext, ignoreExts, maxSize) {
|
|
108
|
-
if (null == ignoreExts) ignoreExts = [];
|
|
109
|
-
return ext && ext.length <= maxSize && indexOf.call(ignoreExts.map(function(e) {
|
|
110
|
-
return (e && "." !== e[0] ? "." : "") + e;
|
|
111
|
-
}), ext) < 0;
|
|
112
|
-
};
|
|
113
|
-
for(name in extraFunctions)if (!!hasProp.call(extraFunctions, name)) {
|
|
114
|
-
extraFn = extraFunctions[name];
|
|
115
|
-
if (void 0 !== upath[name]) throw new Error("path." + name + " already exists.");
|
|
116
|
-
upath[name] = extraFn;
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
path: function(module) {
|
|
120
|
-
"use strict";
|
|
121
|
-
module.exports = require("path");
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
/************************************************************************/ // The module cache
|
|
125
|
-
var __webpack_module_cache__ = {};
|
|
126
|
-
// The require function
|
|
127
|
-
function __webpack_require__(moduleId) {
|
|
128
|
-
// Check if module is in cache
|
|
129
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
130
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
131
|
-
// Create a new module (and put it into the cache)
|
|
132
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
133
|
-
exports: {}
|
|
134
|
-
};
|
|
135
|
-
// Execute the module function
|
|
136
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
137
|
-
// Return the exports of the module
|
|
138
|
-
return module.exports;
|
|
139
|
-
}
|
|
140
|
-
/************************************************************************/ // webpack/runtime/compat_get_default_export
|
|
141
|
-
(()=>{
|
|
142
|
-
// getDefaultExport function for compatibility with non-ESM modules
|
|
143
|
-
__webpack_require__.n = function(module) {
|
|
144
|
-
var getter = module && module.__esModule ? function() {
|
|
145
|
-
return module['default'];
|
|
146
|
-
} : function() {
|
|
147
|
-
return module;
|
|
148
|
-
};
|
|
149
|
-
__webpack_require__.d(getter, {
|
|
150
|
-
a: getter
|
|
151
|
-
});
|
|
152
|
-
return getter;
|
|
153
|
-
};
|
|
154
|
-
})();
|
|
155
|
-
// webpack/runtime/define_property_getters
|
|
156
|
-
(()=>{
|
|
157
|
-
__webpack_require__.d = function(exports1, definition) {
|
|
158
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
159
|
-
enumerable: true,
|
|
160
|
-
get: definition[key]
|
|
161
|
-
});
|
|
162
|
-
};
|
|
163
|
-
})();
|
|
164
|
-
// webpack/runtime/has_own_property
|
|
165
|
-
(()=>{
|
|
166
|
-
__webpack_require__.o = function(obj, prop) {
|
|
167
|
-
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
168
|
-
};
|
|
169
|
-
})();
|
|
170
|
-
// webpack/runtime/make_namespace_object
|
|
171
|
-
(()=>{
|
|
172
|
-
// define __esModule on exports
|
|
173
|
-
__webpack_require__.r = function(exports1) {
|
|
174
|
-
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
175
|
-
value: 'Module'
|
|
176
|
-
});
|
|
177
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
178
|
-
value: true
|
|
179
|
-
});
|
|
180
|
-
};
|
|
181
|
-
})();
|
|
182
|
-
/************************************************************************/ var __webpack_exports__ = {};
|
|
183
|
-
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
|
|
184
|
-
(()=>{
|
|
185
|
-
"use strict";
|
|
186
|
-
// ESM COMPAT FLAG
|
|
187
|
-
__webpack_require__.r(__webpack_exports__);
|
|
188
|
-
// EXPORTS
|
|
189
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
190
|
-
createSnapshotSerializer: ()=>/* reexport */ createSnapshotSerializer
|
|
191
|
-
});
|
|
192
|
-
const external_node_url_namespaceObject = require("node:url");
|
|
193
|
-
/**
|
|
194
|
-
* A specialized version of `_.reduce` for arrays without support for
|
|
195
|
-
* iteratee shorthands.
|
|
196
|
-
*
|
|
197
|
-
* @private
|
|
198
|
-
* @param {Array} [array] The array to iterate over.
|
|
199
|
-
* @param {Function} iteratee The function invoked per iteration.
|
|
200
|
-
* @param {*} [accumulator] The initial value.
|
|
201
|
-
* @param {boolean} [initAccum] Specify using the first element of `array` as
|
|
202
|
-
* the initial value.
|
|
203
|
-
* @returns {*} Returns the accumulated value.
|
|
204
|
-
*/ function arrayReduce(array, iteratee, accumulator, initAccum) {
|
|
205
|
-
var index = -1, length = null == array ? 0 : array.length;
|
|
206
|
-
if (initAccum && length) accumulator = array[++index];
|
|
207
|
-
while(++index < length)accumulator = iteratee(accumulator, array[index], index, array);
|
|
208
|
-
return accumulator;
|
|
209
|
-
}
|
|
210
|
-
/* ESM default export */ const _arrayReduce = arrayReduce;
|
|
211
|
-
/**
|
|
212
|
-
* The base implementation of `_.propertyOf` without support for deep paths.
|
|
213
|
-
*
|
|
214
|
-
* @private
|
|
215
|
-
* @param {Object} object The object to query.
|
|
216
|
-
* @returns {Function} Returns the new accessor function.
|
|
217
|
-
*/ function basePropertyOf(object) {
|
|
218
|
-
return function(key) {
|
|
219
|
-
return null == object ? void 0 : object[key];
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
/* ESM default export */ const _basePropertyOf = basePropertyOf;
|
|
223
|
-
/** Used to map Latin Unicode letters to basic Latin letters. */ var deburredLetters = {
|
|
224
|
-
// Latin-1 Supplement block.
|
|
225
|
-
À: 'A',
|
|
226
|
-
Á: 'A',
|
|
227
|
-
Â: 'A',
|
|
228
|
-
Ã: 'A',
|
|
229
|
-
Ä: 'A',
|
|
230
|
-
Å: 'A',
|
|
231
|
-
à: 'a',
|
|
232
|
-
á: 'a',
|
|
233
|
-
â: 'a',
|
|
234
|
-
ã: 'a',
|
|
235
|
-
ä: 'a',
|
|
236
|
-
å: 'a',
|
|
237
|
-
Ç: 'C',
|
|
238
|
-
ç: 'c',
|
|
239
|
-
Ð: 'D',
|
|
240
|
-
ð: 'd',
|
|
241
|
-
È: 'E',
|
|
242
|
-
É: 'E',
|
|
243
|
-
Ê: 'E',
|
|
244
|
-
Ë: 'E',
|
|
245
|
-
è: 'e',
|
|
246
|
-
é: 'e',
|
|
247
|
-
ê: 'e',
|
|
248
|
-
ë: 'e',
|
|
249
|
-
Ì: 'I',
|
|
250
|
-
Í: 'I',
|
|
251
|
-
Î: 'I',
|
|
252
|
-
Ï: 'I',
|
|
253
|
-
ì: 'i',
|
|
254
|
-
í: 'i',
|
|
255
|
-
î: 'i',
|
|
256
|
-
ï: 'i',
|
|
257
|
-
Ñ: 'N',
|
|
258
|
-
ñ: 'n',
|
|
259
|
-
Ò: 'O',
|
|
260
|
-
Ó: 'O',
|
|
261
|
-
Ô: 'O',
|
|
262
|
-
Õ: 'O',
|
|
263
|
-
Ö: 'O',
|
|
264
|
-
Ø: 'O',
|
|
265
|
-
ò: 'o',
|
|
266
|
-
ó: 'o',
|
|
267
|
-
ô: 'o',
|
|
268
|
-
õ: 'o',
|
|
269
|
-
ö: 'o',
|
|
270
|
-
ø: 'o',
|
|
271
|
-
Ù: 'U',
|
|
272
|
-
Ú: 'U',
|
|
273
|
-
Û: 'U',
|
|
274
|
-
Ü: 'U',
|
|
275
|
-
ù: 'u',
|
|
276
|
-
ú: 'u',
|
|
277
|
-
û: 'u',
|
|
278
|
-
ü: 'u',
|
|
279
|
-
Ý: 'Y',
|
|
280
|
-
ý: 'y',
|
|
281
|
-
ÿ: 'y',
|
|
282
|
-
Æ: 'Ae',
|
|
283
|
-
æ: 'ae',
|
|
284
|
-
Þ: 'Th',
|
|
285
|
-
þ: 'th',
|
|
286
|
-
ß: 'ss',
|
|
287
|
-
// Latin Extended-A block.
|
|
288
|
-
Ā: 'A',
|
|
289
|
-
Ă: 'A',
|
|
290
|
-
Ą: 'A',
|
|
291
|
-
ā: 'a',
|
|
292
|
-
ă: 'a',
|
|
293
|
-
ą: 'a',
|
|
294
|
-
Ć: 'C',
|
|
295
|
-
Ĉ: 'C',
|
|
296
|
-
Ċ: 'C',
|
|
297
|
-
Č: 'C',
|
|
298
|
-
ć: 'c',
|
|
299
|
-
ĉ: 'c',
|
|
300
|
-
ċ: 'c',
|
|
301
|
-
č: 'c',
|
|
302
|
-
Ď: 'D',
|
|
303
|
-
Đ: 'D',
|
|
304
|
-
ď: 'd',
|
|
305
|
-
đ: 'd',
|
|
306
|
-
Ē: 'E',
|
|
307
|
-
Ĕ: 'E',
|
|
308
|
-
Ė: 'E',
|
|
309
|
-
Ę: 'E',
|
|
310
|
-
Ě: 'E',
|
|
311
|
-
ē: 'e',
|
|
312
|
-
ĕ: 'e',
|
|
313
|
-
ė: 'e',
|
|
314
|
-
ę: 'e',
|
|
315
|
-
ě: 'e',
|
|
316
|
-
Ĝ: 'G',
|
|
317
|
-
Ğ: 'G',
|
|
318
|
-
Ġ: 'G',
|
|
319
|
-
Ģ: 'G',
|
|
320
|
-
ĝ: 'g',
|
|
321
|
-
ğ: 'g',
|
|
322
|
-
ġ: 'g',
|
|
323
|
-
ģ: 'g',
|
|
324
|
-
Ĥ: 'H',
|
|
325
|
-
Ħ: 'H',
|
|
326
|
-
ĥ: 'h',
|
|
327
|
-
ħ: 'h',
|
|
328
|
-
Ĩ: 'I',
|
|
329
|
-
Ī: 'I',
|
|
330
|
-
Ĭ: 'I',
|
|
331
|
-
Į: 'I',
|
|
332
|
-
İ: 'I',
|
|
333
|
-
ĩ: 'i',
|
|
334
|
-
ī: 'i',
|
|
335
|
-
ĭ: 'i',
|
|
336
|
-
į: 'i',
|
|
337
|
-
ı: 'i',
|
|
338
|
-
Ĵ: 'J',
|
|
339
|
-
ĵ: 'j',
|
|
340
|
-
Ķ: 'K',
|
|
341
|
-
ķ: 'k',
|
|
342
|
-
ĸ: 'k',
|
|
343
|
-
Ĺ: 'L',
|
|
344
|
-
Ļ: 'L',
|
|
345
|
-
Ľ: 'L',
|
|
346
|
-
Ŀ: 'L',
|
|
347
|
-
Ł: 'L',
|
|
348
|
-
ĺ: 'l',
|
|
349
|
-
ļ: 'l',
|
|
350
|
-
ľ: 'l',
|
|
351
|
-
ŀ: 'l',
|
|
352
|
-
ł: 'l',
|
|
353
|
-
Ń: 'N',
|
|
354
|
-
Ņ: 'N',
|
|
355
|
-
Ň: 'N',
|
|
356
|
-
Ŋ: 'N',
|
|
357
|
-
ń: 'n',
|
|
358
|
-
ņ: 'n',
|
|
359
|
-
ň: 'n',
|
|
360
|
-
ŋ: 'n',
|
|
361
|
-
Ō: 'O',
|
|
362
|
-
Ŏ: 'O',
|
|
363
|
-
Ő: 'O',
|
|
364
|
-
ō: 'o',
|
|
365
|
-
ŏ: 'o',
|
|
366
|
-
ő: 'o',
|
|
367
|
-
Ŕ: 'R',
|
|
368
|
-
Ŗ: 'R',
|
|
369
|
-
Ř: 'R',
|
|
370
|
-
ŕ: 'r',
|
|
371
|
-
ŗ: 'r',
|
|
372
|
-
ř: 'r',
|
|
373
|
-
Ś: 'S',
|
|
374
|
-
Ŝ: 'S',
|
|
375
|
-
Ş: 'S',
|
|
376
|
-
Š: 'S',
|
|
377
|
-
ś: 's',
|
|
378
|
-
ŝ: 's',
|
|
379
|
-
ş: 's',
|
|
380
|
-
š: 's',
|
|
381
|
-
Ţ: 'T',
|
|
382
|
-
Ť: 'T',
|
|
383
|
-
Ŧ: 'T',
|
|
384
|
-
ţ: 't',
|
|
385
|
-
ť: 't',
|
|
386
|
-
ŧ: 't',
|
|
387
|
-
Ũ: 'U',
|
|
388
|
-
Ū: 'U',
|
|
389
|
-
Ŭ: 'U',
|
|
390
|
-
Ů: 'U',
|
|
391
|
-
Ű: 'U',
|
|
392
|
-
Ų: 'U',
|
|
393
|
-
ũ: 'u',
|
|
394
|
-
ū: 'u',
|
|
395
|
-
ŭ: 'u',
|
|
396
|
-
ů: 'u',
|
|
397
|
-
ű: 'u',
|
|
398
|
-
ų: 'u',
|
|
399
|
-
Ŵ: 'W',
|
|
400
|
-
ŵ: 'w',
|
|
401
|
-
Ŷ: 'Y',
|
|
402
|
-
ŷ: 'y',
|
|
403
|
-
Ÿ: 'Y',
|
|
404
|
-
Ź: 'Z',
|
|
405
|
-
Ż: 'Z',
|
|
406
|
-
Ž: 'Z',
|
|
407
|
-
ź: 'z',
|
|
408
|
-
ż: 'z',
|
|
409
|
-
ž: 'z',
|
|
410
|
-
IJ: 'IJ',
|
|
411
|
-
ij: 'ij',
|
|
412
|
-
Œ: 'Oe',
|
|
413
|
-
œ: 'oe',
|
|
414
|
-
ʼn: "'n",
|
|
415
|
-
ſ: 's'
|
|
416
|
-
};
|
|
417
|
-
/**
|
|
418
|
-
* Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A
|
|
419
|
-
* letters to basic Latin letters.
|
|
420
|
-
*
|
|
421
|
-
* @private
|
|
422
|
-
* @param {string} letter The matched letter to deburr.
|
|
423
|
-
* @returns {string} Returns the deburred letter.
|
|
424
|
-
*/ var deburrLetter = _basePropertyOf(deburredLetters);
|
|
425
|
-
/* ESM default export */ const _deburrLetter = deburrLetter;
|
|
426
|
-
/** Detect free variable `global` from Node.js. */ var freeGlobal = 'object' == typeof global && global && global.Object === Object && global;
|
|
427
|
-
/* ESM default export */ const _freeGlobal = freeGlobal;
|
|
428
|
-
/** Detect free variable `self`. */ var freeSelf = 'object' == typeof self && self && self.Object === Object && self;
|
|
429
|
-
/** Used as a reference to the global object. */ var _root_root = _freeGlobal || freeSelf || Function('return this')();
|
|
430
|
-
/* ESM default export */ const _root = _root_root;
|
|
431
|
-
/** Built-in value references. */ var Symbol1 = _root.Symbol;
|
|
432
|
-
/* ESM default export */ const _Symbol = Symbol1;
|
|
433
|
-
/**
|
|
434
|
-
* A specialized version of `_.map` for arrays without support for iteratee
|
|
435
|
-
* shorthands.
|
|
436
|
-
*
|
|
437
|
-
* @private
|
|
438
|
-
* @param {Array} [array] The array to iterate over.
|
|
439
|
-
* @param {Function} iteratee The function invoked per iteration.
|
|
440
|
-
* @returns {Array} Returns the new mapped array.
|
|
441
|
-
*/ function arrayMap(array, iteratee) {
|
|
442
|
-
var index = -1, length = null == array ? 0 : array.length, result = Array(length);
|
|
443
|
-
while(++index < length)result[index] = iteratee(array[index], index, array);
|
|
444
|
-
return result;
|
|
445
|
-
}
|
|
446
|
-
/* ESM default export */ const _arrayMap = arrayMap;
|
|
447
|
-
/**
|
|
448
|
-
* Checks if `value` is classified as an `Array` object.
|
|
449
|
-
*
|
|
450
|
-
* @static
|
|
451
|
-
* @memberOf _
|
|
452
|
-
* @since 0.1.0
|
|
453
|
-
* @category Lang
|
|
454
|
-
* @param {*} value The value to check.
|
|
455
|
-
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
456
|
-
* @example
|
|
457
|
-
*
|
|
458
|
-
* _.isArray([1, 2, 3]);
|
|
459
|
-
* // => true
|
|
460
|
-
*
|
|
461
|
-
* _.isArray(document.body.children);
|
|
462
|
-
* // => false
|
|
463
|
-
*
|
|
464
|
-
* _.isArray('abc');
|
|
465
|
-
* // => false
|
|
466
|
-
*
|
|
467
|
-
* _.isArray(_.noop);
|
|
468
|
-
* // => false
|
|
469
|
-
*/ var isArray_isArray = Array.isArray;
|
|
470
|
-
/* ESM default export */ const isArray = isArray_isArray;
|
|
471
|
-
/** Used for built-in method references. */ var objectProto = Object.prototype;
|
|
472
|
-
/** Used to check objects for own properties. */ var _getRawTag_hasOwnProperty = objectProto.hasOwnProperty;
|
|
473
|
-
/**
|
|
474
|
-
* Used to resolve the
|
|
475
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
476
|
-
* of values.
|
|
477
|
-
*/ var nativeObjectToString = objectProto.toString;
|
|
478
|
-
/** Built-in value references. */ var symToStringTag = _Symbol ? _Symbol.toStringTag : void 0;
|
|
479
|
-
/**
|
|
480
|
-
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
481
|
-
*
|
|
482
|
-
* @private
|
|
483
|
-
* @param {*} value The value to query.
|
|
484
|
-
* @returns {string} Returns the raw `toStringTag`.
|
|
485
|
-
*/ function getRawTag(value) {
|
|
486
|
-
var isOwn = _getRawTag_hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
|
|
487
|
-
try {
|
|
488
|
-
value[symToStringTag] = void 0;
|
|
489
|
-
var unmasked = true;
|
|
490
|
-
} catch (e) {}
|
|
491
|
-
var result = nativeObjectToString.call(value);
|
|
492
|
-
if (unmasked) {
|
|
493
|
-
if (isOwn) value[symToStringTag] = tag;
|
|
494
|
-
else delete value[symToStringTag];
|
|
495
|
-
}
|
|
496
|
-
return result;
|
|
497
|
-
}
|
|
498
|
-
/* ESM default export */ const _getRawTag = getRawTag;
|
|
499
|
-
/** Used for built-in method references. */ var _objectToString_objectProto = Object.prototype;
|
|
500
|
-
/**
|
|
501
|
-
* Used to resolve the
|
|
502
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
503
|
-
* of values.
|
|
504
|
-
*/ var _objectToString_nativeObjectToString = _objectToString_objectProto.toString;
|
|
505
|
-
/**
|
|
506
|
-
* Converts `value` to a string using `Object.prototype.toString`.
|
|
507
|
-
*
|
|
508
|
-
* @private
|
|
509
|
-
* @param {*} value The value to convert.
|
|
510
|
-
* @returns {string} Returns the converted string.
|
|
511
|
-
*/ function objectToString(value) {
|
|
512
|
-
return _objectToString_nativeObjectToString.call(value);
|
|
513
|
-
}
|
|
514
|
-
/* ESM default export */ const _objectToString = objectToString;
|
|
515
|
-
/** `Object#toString` result references. */ var nullTag = '[object Null]', undefinedTag = '[object Undefined]';
|
|
516
|
-
/** Built-in value references. */ var _baseGetTag_symToStringTag = _Symbol ? _Symbol.toStringTag : void 0;
|
|
517
|
-
/**
|
|
518
|
-
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
519
|
-
*
|
|
520
|
-
* @private
|
|
521
|
-
* @param {*} value The value to query.
|
|
522
|
-
* @returns {string} Returns the `toStringTag`.
|
|
523
|
-
*/ function baseGetTag(value) {
|
|
524
|
-
if (null == value) return void 0 === value ? undefinedTag : nullTag;
|
|
525
|
-
return _baseGetTag_symToStringTag && _baseGetTag_symToStringTag in Object(value) ? _getRawTag(value) : _objectToString(value);
|
|
526
|
-
}
|
|
527
|
-
/* ESM default export */ const _baseGetTag = baseGetTag;
|
|
528
|
-
/**
|
|
529
|
-
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
530
|
-
* and has a `typeof` result of "object".
|
|
531
|
-
*
|
|
532
|
-
* @static
|
|
533
|
-
* @memberOf _
|
|
534
|
-
* @since 4.0.0
|
|
535
|
-
* @category Lang
|
|
536
|
-
* @param {*} value The value to check.
|
|
537
|
-
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
538
|
-
* @example
|
|
539
|
-
*
|
|
540
|
-
* _.isObjectLike({});
|
|
541
|
-
* // => true
|
|
542
|
-
*
|
|
543
|
-
* _.isObjectLike([1, 2, 3]);
|
|
544
|
-
* // => true
|
|
545
|
-
*
|
|
546
|
-
* _.isObjectLike(_.noop);
|
|
547
|
-
* // => false
|
|
548
|
-
*
|
|
549
|
-
* _.isObjectLike(null);
|
|
550
|
-
* // => false
|
|
551
|
-
*/ function isObjectLike(value) {
|
|
552
|
-
return null != value && 'object' == typeof value;
|
|
553
|
-
}
|
|
554
|
-
/* ESM default export */ const lodash_es_isObjectLike = isObjectLike;
|
|
555
|
-
/** `Object#toString` result references. */ var symbolTag = '[object Symbol]';
|
|
556
|
-
/**
|
|
557
|
-
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
558
|
-
*
|
|
559
|
-
* @static
|
|
560
|
-
* @memberOf _
|
|
561
|
-
* @since 4.0.0
|
|
562
|
-
* @category Lang
|
|
563
|
-
* @param {*} value The value to check.
|
|
564
|
-
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
565
|
-
* @example
|
|
566
|
-
*
|
|
567
|
-
* _.isSymbol(Symbol.iterator);
|
|
568
|
-
* // => true
|
|
569
|
-
*
|
|
570
|
-
* _.isSymbol('abc');
|
|
571
|
-
* // => false
|
|
572
|
-
*/ function isSymbol_isSymbol(value) {
|
|
573
|
-
return 'symbol' == typeof value || lodash_es_isObjectLike(value) && _baseGetTag(value) == symbolTag;
|
|
574
|
-
}
|
|
575
|
-
/* ESM default export */ const isSymbol = isSymbol_isSymbol;
|
|
576
|
-
/** Used as references for various `Number` constants. */ var INFINITY = 1 / 0;
|
|
577
|
-
/** Used to convert symbols to primitives and strings. */ var symbolProto = _Symbol ? _Symbol.prototype : void 0, symbolToString = symbolProto ? symbolProto.toString : void 0;
|
|
578
|
-
/**
|
|
579
|
-
* The base implementation of `_.toString` which doesn't convert nullish
|
|
580
|
-
* values to empty strings.
|
|
581
|
-
*
|
|
582
|
-
* @private
|
|
583
|
-
* @param {*} value The value to process.
|
|
584
|
-
* @returns {string} Returns the string.
|
|
585
|
-
*/ function baseToString(value) {
|
|
586
|
-
// Exit early for strings to avoid a performance hit in some environments.
|
|
587
|
-
if ('string' == typeof value) return value;
|
|
588
|
-
if (isArray(value)) // Recursively convert values (susceptible to call stack limits).
|
|
589
|
-
return _arrayMap(value, baseToString) + '';
|
|
590
|
-
if (isSymbol(value)) return symbolToString ? symbolToString.call(value) : '';
|
|
591
|
-
var result = value + '';
|
|
592
|
-
return '0' == result && 1 / value == -INFINITY ? '-0' : result;
|
|
593
|
-
}
|
|
594
|
-
/* ESM default export */ const _baseToString = baseToString;
|
|
595
|
-
/**
|
|
596
|
-
* Converts `value` to a string. An empty string is returned for `null`
|
|
597
|
-
* and `undefined` values. The sign of `-0` is preserved.
|
|
598
|
-
*
|
|
599
|
-
* @static
|
|
600
|
-
* @memberOf _
|
|
601
|
-
* @since 4.0.0
|
|
602
|
-
* @category Lang
|
|
603
|
-
* @param {*} value The value to convert.
|
|
604
|
-
* @returns {string} Returns the converted string.
|
|
605
|
-
* @example
|
|
606
|
-
*
|
|
607
|
-
* _.toString(null);
|
|
608
|
-
* // => ''
|
|
609
|
-
*
|
|
610
|
-
* _.toString(-0);
|
|
611
|
-
* // => '-0'
|
|
612
|
-
*
|
|
613
|
-
* _.toString([1, 2, 3]);
|
|
614
|
-
* // => '1,2,3'
|
|
615
|
-
*/ function toString_toString(value) {
|
|
616
|
-
return null == value ? '' : _baseToString(value);
|
|
617
|
-
}
|
|
618
|
-
/* ESM default export */ const lodash_es_toString = toString_toString;
|
|
619
|
-
/** Used to match Latin Unicode letters (excluding mathematical operators). */ var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
|
|
620
|
-
/** Used to compose unicode character classes. */ var rsComboMarksRange = '\\u0300-\\u036f', reComboHalfMarksRange = '\\ufe20-\\ufe2f', rsComboSymbolsRange = '\\u20d0-\\u20ff', rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
|
|
621
|
-
/** Used to compose unicode capture groups. */ var rsCombo = '[' + rsComboRange + ']';
|
|
622
|
-
/**
|
|
623
|
-
* Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
|
|
624
|
-
* [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
|
|
625
|
-
*/ var reComboMark = RegExp(rsCombo, 'g');
|
|
626
|
-
/**
|
|
627
|
-
* Deburrs `string` by converting
|
|
628
|
-
* [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
|
|
629
|
-
* and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
|
|
630
|
-
* letters to basic Latin letters and removing
|
|
631
|
-
* [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
|
|
632
|
-
*
|
|
633
|
-
* @static
|
|
634
|
-
* @memberOf _
|
|
635
|
-
* @since 3.0.0
|
|
636
|
-
* @category String
|
|
637
|
-
* @param {string} [string=''] The string to deburr.
|
|
638
|
-
* @returns {string} Returns the deburred string.
|
|
639
|
-
* @example
|
|
640
|
-
*
|
|
641
|
-
* _.deburr('déjà vu');
|
|
642
|
-
* // => 'deja vu'
|
|
643
|
-
*/ function deburr_deburr(string) {
|
|
644
|
-
string = lodash_es_toString(string);
|
|
645
|
-
return string && string.replace(reLatin, _deburrLetter).replace(reComboMark, '');
|
|
646
|
-
}
|
|
647
|
-
/* ESM default export */ const deburr = deburr_deburr;
|
|
648
|
-
/** Used to match words composed of alphanumeric characters. */ var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
|
|
649
|
-
/**
|
|
650
|
-
* Splits an ASCII `string` into an array of its words.
|
|
651
|
-
*
|
|
652
|
-
* @private
|
|
653
|
-
* @param {string} The string to inspect.
|
|
654
|
-
* @returns {Array} Returns the words of `string`.
|
|
655
|
-
*/ function asciiWords(string) {
|
|
656
|
-
return string.match(reAsciiWord) || [];
|
|
657
|
-
}
|
|
658
|
-
/* ESM default export */ const _asciiWords = asciiWords;
|
|
659
|
-
/** Used to detect strings that need a more robust regexp to match words. */ var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
|
|
660
|
-
/**
|
|
661
|
-
* Checks if `string` contains a word composed of Unicode symbols.
|
|
662
|
-
*
|
|
663
|
-
* @private
|
|
664
|
-
* @param {string} string The string to inspect.
|
|
665
|
-
* @returns {boolean} Returns `true` if a word is found, else `false`.
|
|
666
|
-
*/ function hasUnicodeWord(string) {
|
|
667
|
-
return reHasUnicodeWord.test(string);
|
|
668
|
-
}
|
|
669
|
-
/* ESM default export */ const _hasUnicodeWord = hasUnicodeWord;
|
|
670
|
-
/** Used to compose unicode character classes. */ var rsAstralRange = '\\ud800-\\udfff', _unicodeWords_rsComboMarksRange = '\\u0300-\\u036f', _unicodeWords_reComboHalfMarksRange = '\\ufe20-\\ufe2f', _unicodeWords_rsComboSymbolsRange = '\\u20d0-\\u20ff', _unicodeWords_rsComboRange = _unicodeWords_rsComboMarksRange + _unicodeWords_reComboHalfMarksRange + _unicodeWords_rsComboSymbolsRange, rsDingbatRange = '\\u2700-\\u27bf', rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', rsPunctuationRange = '\\u2000-\\u206f', rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', rsVarRange = '\\ufe0e\\ufe0f', rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
|
|
671
|
-
/** Used to compose unicode capture groups. */ var rsApos = "['\u2019]", rsBreak = '[' + rsBreakRange + ']', _unicodeWords_rsCombo = '[' + _unicodeWords_rsComboRange + ']', rsDigits = '\\d+', rsDingbat = '[' + rsDingbatRange + ']', rsLower = '[' + rsLowerRange + ']', rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', rsFitz = '\\ud83c[\\udffb-\\udfff]', rsModifier = '(?:' + _unicodeWords_rsCombo + '|' + rsFitz + ')', rsNonAstral = '[^' + rsAstralRange + ']', rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', rsUpper = '[' + rsUpperRange + ']', rsZWJ = '\\u200d';
|
|
672
|
-
/** Used to compose unicode regexes. */ var rsMiscLower = '(?:' + rsLower + '|' + rsMisc + ')', rsMiscUpper = '(?:' + rsUpper + '|' + rsMisc + ')', rsOptContrLower = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', rsOptContrUpper = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', reOptMod = rsModifier + '?', rsOptVar = '[' + rsVarRange + ']?', rsOptJoin = '(?:' + rsZWJ + '(?:' + [
|
|
673
|
-
rsNonAstral,
|
|
674
|
-
rsRegional,
|
|
675
|
-
rsSurrPair
|
|
676
|
-
].join('|') + ')' + rsOptVar + reOptMod + ')*', rsOrdLower = '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])', rsOrdUpper = '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])', rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = '(?:' + [
|
|
677
|
-
rsDingbat,
|
|
678
|
-
rsRegional,
|
|
679
|
-
rsSurrPair
|
|
680
|
-
].join('|') + ')' + rsSeq;
|
|
681
|
-
/** Used to match complex or compound words. */ var reUnicodeWord = RegExp([
|
|
682
|
-
rsUpper + '?' + rsLower + '+' + rsOptContrLower + '(?=' + [
|
|
683
|
-
rsBreak,
|
|
684
|
-
rsUpper,
|
|
685
|
-
'$'
|
|
686
|
-
].join('|') + ')',
|
|
687
|
-
rsMiscUpper + '+' + rsOptContrUpper + '(?=' + [
|
|
688
|
-
rsBreak,
|
|
689
|
-
rsUpper + rsMiscLower,
|
|
690
|
-
'$'
|
|
691
|
-
].join('|') + ')',
|
|
692
|
-
rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower,
|
|
693
|
-
rsUpper + '+' + rsOptContrUpper,
|
|
694
|
-
rsOrdUpper,
|
|
695
|
-
rsOrdLower,
|
|
696
|
-
rsDigits,
|
|
697
|
-
rsEmoji
|
|
698
|
-
].join('|'), 'g');
|
|
699
|
-
/**
|
|
700
|
-
* Splits a Unicode `string` into an array of its words.
|
|
701
|
-
*
|
|
702
|
-
* @private
|
|
703
|
-
* @param {string} The string to inspect.
|
|
704
|
-
* @returns {Array} Returns the words of `string`.
|
|
705
|
-
*/ function unicodeWords(string) {
|
|
706
|
-
return string.match(reUnicodeWord) || [];
|
|
707
|
-
}
|
|
708
|
-
/* ESM default export */ const _unicodeWords = unicodeWords;
|
|
709
|
-
/**
|
|
710
|
-
* Splits `string` into an array of its words.
|
|
711
|
-
*
|
|
712
|
-
* @static
|
|
713
|
-
* @memberOf _
|
|
714
|
-
* @since 3.0.0
|
|
715
|
-
* @category String
|
|
716
|
-
* @param {string} [string=''] The string to inspect.
|
|
717
|
-
* @param {RegExp|string} [pattern] The pattern to match words.
|
|
718
|
-
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
|
|
719
|
-
* @returns {Array} Returns the words of `string`.
|
|
720
|
-
* @example
|
|
721
|
-
*
|
|
722
|
-
* _.words('fred, barney, & pebbles');
|
|
723
|
-
* // => ['fred', 'barney', 'pebbles']
|
|
724
|
-
*
|
|
725
|
-
* _.words('fred, barney, & pebbles', /[^, ]+/g);
|
|
726
|
-
* // => ['fred', 'barney', '&', 'pebbles']
|
|
727
|
-
*/ function words_words(string, pattern, guard) {
|
|
728
|
-
string = lodash_es_toString(string);
|
|
729
|
-
pattern = guard ? void 0 : pattern;
|
|
730
|
-
if (void 0 === pattern) return _hasUnicodeWord(string) ? _unicodeWords(string) : _asciiWords(string);
|
|
731
|
-
return string.match(pattern) || [];
|
|
732
|
-
}
|
|
733
|
-
/* ESM default export */ const words = words_words;
|
|
734
|
-
/** Used to compose unicode capture groups. */ var _createCompounder_rsApos = "['\u2019]";
|
|
735
|
-
/** Used to match apostrophes. */ var reApos = RegExp(_createCompounder_rsApos, 'g');
|
|
736
|
-
/**
|
|
737
|
-
* Creates a function like `_.camelCase`.
|
|
738
|
-
*
|
|
739
|
-
* @private
|
|
740
|
-
* @param {Function} callback The function to combine each word.
|
|
741
|
-
* @returns {Function} Returns the new compounder function.
|
|
742
|
-
*/ function createCompounder(callback) {
|
|
743
|
-
return function(string) {
|
|
744
|
-
return _arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
|
|
745
|
-
};
|
|
746
|
-
}
|
|
747
|
-
/* ESM default export */ const _createCompounder = createCompounder;
|
|
748
|
-
/**
|
|
749
|
-
* Converts `string` to
|
|
750
|
-
* [snake case](https://en.wikipedia.org/wiki/Snake_case).
|
|
751
|
-
*
|
|
752
|
-
* @static
|
|
753
|
-
* @memberOf _
|
|
754
|
-
* @since 3.0.0
|
|
755
|
-
* @category String
|
|
756
|
-
* @param {string} [string=''] The string to convert.
|
|
757
|
-
* @returns {string} Returns the snake cased string.
|
|
758
|
-
* @example
|
|
759
|
-
*
|
|
760
|
-
* _.snakeCase('Foo Bar');
|
|
761
|
-
* // => 'foo_bar'
|
|
762
|
-
*
|
|
763
|
-
* _.snakeCase('fooBar');
|
|
764
|
-
* // => 'foo_bar'
|
|
765
|
-
*
|
|
766
|
-
* _.snakeCase('--FOO-BAR--');
|
|
767
|
-
* // => 'foo_bar'
|
|
768
|
-
*/ var snakeCase_snakeCase = _createCompounder(function(result, word, index) {
|
|
769
|
-
return result + (index ? '_' : '') + word.toLowerCase();
|
|
770
|
-
});
|
|
771
|
-
/* ESM default export */ const snakeCase = snakeCase_snakeCase;
|
|
772
|
-
const external_node_fs_namespaceObject = require("node:fs");
|
|
773
|
-
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
774
|
-
const external_node_os_namespaceObject = require("node:os");
|
|
775
|
-
var external_node_os_default = /*#__PURE__*/ __webpack_require__.n(external_node_os_namespaceObject);
|
|
776
|
-
/**
|
|
777
|
-
* Used to match `RegExp`
|
|
778
|
-
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
779
|
-
*/ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source);
|
|
780
|
-
/**
|
|
781
|
-
* Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
|
|
782
|
-
* "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
|
|
783
|
-
*
|
|
784
|
-
* @static
|
|
785
|
-
* @memberOf _
|
|
786
|
-
* @since 3.0.0
|
|
787
|
-
* @category String
|
|
788
|
-
* @param {string} [string=''] The string to escape.
|
|
789
|
-
* @returns {string} Returns the escaped string.
|
|
790
|
-
* @example
|
|
791
|
-
*
|
|
792
|
-
* _.escapeRegExp('[lodash](https://lodash.com/)');
|
|
793
|
-
* // => '\[lodash\]\(https://lodash\.com/\)'
|
|
794
|
-
*/ function escapeRegExp(string) {
|
|
795
|
-
string = lodash_es_toString(string);
|
|
796
|
-
return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, '\\$&') : string;
|
|
797
|
-
}
|
|
798
|
-
/* ESM default export */ const lodash_es_escapeRegExp = escapeRegExp;
|
|
799
|
-
function getRealTemporaryDirectory() {
|
|
800
|
-
let ret = null;
|
|
801
|
-
try {
|
|
802
|
-
ret = external_node_os_default().tmpdir();
|
|
803
|
-
ret = external_node_fs_default().realpathSync(ret);
|
|
804
|
-
} catch {}
|
|
805
|
-
return ret;
|
|
806
|
-
}
|
|
807
|
-
/**
|
|
808
|
-
* Compile path string to RegExp.
|
|
809
|
-
* @note Only support posix path.
|
|
810
|
-
*/ function compilePathMatcherRegExp(match) {
|
|
811
|
-
if ('string' != typeof match) return match;
|
|
812
|
-
const escaped = lodash_es_escapeRegExp(match);
|
|
813
|
-
return new RegExp(`(?<=\\W|^)${escaped}(?=\\W|$)`, 'g');
|
|
814
|
-
}
|
|
815
|
-
function splitPathString(str) {
|
|
816
|
-
return str.split(/[\\/]/);
|
|
817
|
-
}
|
|
818
|
-
function applyPathMatcher(matcher, str, options = {}) {
|
|
819
|
-
const regex = compilePathMatcherRegExp(matcher.match);
|
|
820
|
-
const replacer = (substring, ...args)=>{
|
|
821
|
-
if (options.minPartials && splitPathString(substring).length < options.minPartials) return substring;
|
|
822
|
-
const ret = 'string' == typeof matcher.mark ? matcher.mark : matcher.mark(substring, ...args);
|
|
823
|
-
return `<${snakeCase(ret).toUpperCase()}>`;
|
|
824
|
-
};
|
|
825
|
-
return str.replace(regex, replacer);
|
|
826
|
-
}
|
|
827
|
-
function applyMatcherReplacement(matchers, str, options = {}) {
|
|
828
|
-
return matchers.reduce((ret, matcher)=>applyPathMatcher(matcher, ret, options), str);
|
|
829
|
-
}
|
|
830
|
-
const createTmpDirMatchers = ()=>{
|
|
831
|
-
const ret = [];
|
|
832
|
-
const realTmpDir = getRealTemporaryDirectory();
|
|
833
|
-
realTmpDir && ret.push({
|
|
834
|
-
match: realTmpDir,
|
|
835
|
-
mark: 'temp'
|
|
836
|
-
});
|
|
837
|
-
const tmpDir = external_node_os_default().tmpdir();
|
|
838
|
-
tmpDir && ret.push({
|
|
839
|
-
match: tmpDir,
|
|
840
|
-
mark: 'temp'
|
|
841
|
-
});
|
|
842
|
-
return ret;
|
|
843
|
-
};
|
|
844
|
-
const createHomeDirMatchers = ()=>{
|
|
845
|
-
const ret = [];
|
|
846
|
-
const homedir = external_node_os_default().homedir();
|
|
847
|
-
homedir && ret.push({
|
|
848
|
-
match: homedir,
|
|
849
|
-
mark: 'home'
|
|
850
|
-
});
|
|
851
|
-
return ret;
|
|
852
|
-
};
|
|
853
|
-
const createPnpmInnerMatchers = ()=>[
|
|
854
|
-
// posix
|
|
855
|
-
{
|
|
856
|
-
match: /(?<=\/)(\.pnpm\/.+?\/node_modules)(?=\/)/g,
|
|
857
|
-
mark: 'pnpmInner'
|
|
858
|
-
},
|
|
859
|
-
// win32
|
|
860
|
-
{
|
|
861
|
-
match: /(?<=\\)(\.pnpm\\.+?\\node_modules)(?=\\)/g,
|
|
862
|
-
mark: 'pnpmInner'
|
|
863
|
-
}
|
|
864
|
-
];
|
|
865
|
-
const external_node_path_namespaceObject = require("node:path");
|
|
866
|
-
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
867
|
-
// EXTERNAL MODULE: ./node_modules/.pnpm/upath@2.0.1/node_modules/upath/build/code/upath.js
|
|
868
|
-
var upath = __webpack_require__("./node_modules/.pnpm/upath@2.0.1/node_modules/upath/build/code/upath.js");
|
|
869
|
-
var upath_default = /*#__PURE__*/ __webpack_require__.n(upath);
|
|
870
|
-
const normalizePathToPosix = (p)=>upath_default().normalizeSafe(external_node_path_default().normalize(p || '')).replace(/^([a-zA-Z]+):/, (_, m)=>`/${m.toLowerCase()}`);
|
|
871
|
-
// find the path in code and replace it with normalizePathToPosix
|
|
872
|
-
const normalizeCodeToPosix = (code)=>code.replace(// ignore http, https, file
|
|
873
|
-
/(?<![a-zA-Z])([a-zA-Z]:[\\/]+)([-\u4e00-\u9fa5\w\s.()~!@#$%^&()\[\]{}+=]+[\\/]+)*/g, (match, _diskName)=>normalizePathToPosix(match.replace(/[\\]{2,}/g, '\\')));
|
|
874
|
-
const normalizeCLR = (str)=>str.replace(/\u001b\[1m\u001b\[([0-9;]*)m/g, '<CLR=$1,BOLD>').replace(/\u001b\[1m/g, '<CLR=BOLD>').replace(/\u001b\[39m\u001b\[22m/g, '</CLR>').replace(/\u001b\[([0-9;]*)m/g, '<CLR=$1>') // CHANGE: The time unit display in Rspack is second
|
|
875
|
-
// CHANGE2: avoid a bad case "./react/assets.svg" -> "./react/assetsXsvg"
|
|
876
|
-
// modified based on https://github.com/webpack/webpack/blob/001cab14692eb9a833c6b56709edbab547e291a1/test/StatsTestCases.basictest.js#L199
|
|
877
|
-
.replace(/[0-9]+(\.[0-9]+)*(<\/CLR>)?(\s?s)/g, 'X$2$3');
|
|
878
|
-
function createSnapshotSerializer(options) {
|
|
879
|
-
const { root = process.cwd(), workspace = '', replace: customMatchers = [], replacePost: customPostMatchers = [], features = {}, beforeSerialize, afterSerialize } = options || {};
|
|
880
|
-
const { replaceWorkspaceWithFileProtocol = true, replaceWorkspace = true, replaceRootWithFileProtocol = true, replaceRoot = true, replacePnpmInner = true, replaceTmpDir = true, replaceHomeDir = true, addDoubleQuotes = true, transformWin32Path = true, escapeDoubleQuotes = true, escapeEOL = true, transformCLR = true } = features;
|
|
881
|
-
function createPathMatchers() {
|
|
882
|
-
const pathMatchers = [];
|
|
883
|
-
pathMatchers.push(...customMatchers);
|
|
884
|
-
if (replaceWorkspace && workspace) pathMatchers.push({
|
|
885
|
-
mark: 'workspace',
|
|
886
|
-
match: workspace
|
|
887
|
-
});
|
|
888
|
-
if (replaceRoot && root) pathMatchers.push({
|
|
889
|
-
mark: 'root',
|
|
890
|
-
match: root
|
|
891
|
-
});
|
|
892
|
-
if (replacePnpmInner) pathMatchers.push(...createPnpmInnerMatchers());
|
|
893
|
-
if (replaceTmpDir) pathMatchers.push(...createTmpDirMatchers());
|
|
894
|
-
if (replaceHomeDir) pathMatchers.push(...createHomeDirMatchers());
|
|
895
|
-
pathMatchers.push(...customPostMatchers);
|
|
896
|
-
return pathMatchers;
|
|
897
|
-
}
|
|
898
|
-
const pathMatchers = createPathMatchers();
|
|
899
|
-
for (const matcher of pathMatchers)if ('string' == typeof matcher.match) matcher.match = normalizePathToPosix(matcher.match);
|
|
900
|
-
const serializer = {
|
|
901
|
-
// match path-format string
|
|
902
|
-
test (val) {
|
|
903
|
-
return 'string' == typeof val;
|
|
904
|
-
},
|
|
905
|
-
serialize (val) {
|
|
906
|
-
let replaced = val;
|
|
907
|
-
if (beforeSerialize) replaced = beforeSerialize(replaced);
|
|
908
|
-
if (replaceWorkspaceWithFileProtocol && workspace) // this is a polyfill for .replaceAll(string, string)
|
|
909
|
-
replaced = replaced.split((0, external_node_url_namespaceObject.pathToFileURL)(workspace).toString()).join('<WORKSPACE>');
|
|
910
|
-
if (replaceRootWithFileProtocol && root) // this is a polyfill for .replaceAll(string, string)
|
|
911
|
-
replaced = replaced.split((0, external_node_url_namespaceObject.pathToFileURL)(root).toString()).join('<ROOT>');
|
|
912
|
-
if (transformWin32Path) replaced = normalizeCodeToPosix(replaced);
|
|
913
|
-
replaced = applyMatcherReplacement(pathMatchers, replaced);
|
|
914
|
-
if (transformCLR) replaced = normalizeCLR(replaced);
|
|
915
|
-
if (escapeDoubleQuotes) replaced = replaced.replace(/"/g, '\\"');
|
|
916
|
-
if (escapeEOL) replaced = replaced.replace(/\\r\\n/g, '\\n');
|
|
917
|
-
if (addDoubleQuotes) replaced = `"${replaced}"`;
|
|
918
|
-
if (afterSerialize) replaced = afterSerialize(replaced);
|
|
919
|
-
return replaced;
|
|
920
|
-
}
|
|
921
|
-
};
|
|
922
|
-
return serializer;
|
|
923
|
-
}
|
|
924
|
-
// export types related to `createSnapshotSerializer`
|
|
925
|
-
})();
|
|
926
|
-
var __webpack_export_target__ = exports;
|
|
927
|
-
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
928
|
-
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
929
|
-
value: true
|
|
930
|
-
});
|