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