path-serializer 0.0.2 → 0.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/dist/cjs/main.cjs +185 -251
- package/dist/esm/main.js +204 -271
- package/dist/rsbuild.config.cjs.mjs +333 -0
- package/dist/rsbuild.config.esm.mjs +339 -0
- package/dist/rspack.config.cjs.mjs +420 -0
- package/dist/rspack.config.esm.mjs +422 -0
- package/package.json +1 -1
package/dist/esm/main.js
CHANGED
|
@@ -1,234 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
*/
|
|
12
|
-
|
|
13
|
-
// Generated by uRequire v0.7.0-beta.33 target: 'lib' template: 'nodejs'
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var VERSION = '2.0.1'; // injected by urequire-rc-inject-version
|
|
17
|
-
|
|
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++) {
|
|
20
|
-
if (i in this && this[i] === item)
|
|
21
|
-
return i;
|
|
22
|
-
}
|
|
23
|
-
return -1;
|
|
24
|
-
}, hasProp = {}.hasOwnProperty;
|
|
25
|
-
path = __webpack_require__("path");
|
|
26
|
-
isFunction = function (val) {
|
|
27
|
-
return typeof val === "function";
|
|
28
|
-
};
|
|
29
|
-
isString = function (val) {
|
|
30
|
-
return typeof val === "string" || !!val && typeof val === "object" && Object.prototype.toString.call(val) === "[object String]";
|
|
31
|
-
};
|
|
32
|
-
upath = exports;
|
|
33
|
-
upath.VERSION = typeof VERSION !== "undefined" && VERSION !== null ? VERSION : "NO-VERSION";
|
|
34
|
-
toUnix = function (p) {
|
|
35
|
-
p = p.replace(/\\/g, "/");
|
|
36
|
-
p = p.replace(/(?<!^)\/+/g, "/");
|
|
37
|
-
return p;
|
|
38
|
-
};
|
|
39
|
-
for (propName in path) {
|
|
40
|
-
propValue = path[propName];
|
|
41
|
-
if (isFunction(propValue)) {
|
|
42
|
-
upath[propName] = function (propName) {
|
|
43
|
-
return function () {
|
|
44
|
-
var args, result;
|
|
45
|
-
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
|
46
|
-
args = args.map(function (p) {
|
|
47
|
-
if (isString(p)) {
|
|
48
|
-
return toUnix(p);
|
|
49
|
-
} else {
|
|
50
|
-
return p;
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
result = path[propName].apply(path, args);
|
|
54
|
-
if (isString(result)) {
|
|
55
|
-
return toUnix(result);
|
|
56
|
-
} else {
|
|
57
|
-
return result;
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
}(propName);
|
|
61
|
-
} else {
|
|
62
|
-
upath[propName] = propValue;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
upath.sep = "/";
|
|
66
|
-
extraFunctions = {
|
|
67
|
-
toUnix: toUnix,
|
|
68
|
-
normalizeSafe: function (p) {
|
|
69
|
-
var result;
|
|
70
|
-
p = toUnix(p);
|
|
71
|
-
result = upath.normalize(p);
|
|
72
|
-
if (p.startsWith("./") && !result.startsWith("./") && !result.startsWith("..")) {
|
|
73
|
-
result = "./" + result;
|
|
74
|
-
} else if (p.startsWith("//") && !result.startsWith("//")) {
|
|
75
|
-
if (p.startsWith("//./")) {
|
|
76
|
-
result = "//." + result;
|
|
77
|
-
} else {
|
|
78
|
-
result = "/" + result;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return result;
|
|
82
|
-
},
|
|
83
|
-
normalizeTrim: function (p) {
|
|
84
|
-
p = upath.normalizeSafe(p);
|
|
85
|
-
if (p.endsWith("/")) {
|
|
86
|
-
return p.slice(0, +(p.length - 2) + 1 || 9000000000);
|
|
87
|
-
} else {
|
|
88
|
-
return p;
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
joinSafe: function () {
|
|
92
|
-
var p, p0, result;
|
|
93
|
-
p = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
|
94
|
-
result = upath.join.apply(null, p);
|
|
95
|
-
if (p.length > 0) {
|
|
96
|
-
p0 = toUnix(p[0]);
|
|
97
|
-
if (p0.startsWith("./") && !result.startsWith("./") && !result.startsWith("..")) {
|
|
98
|
-
result = "./" + result;
|
|
99
|
-
} else if (p0.startsWith("//") && !result.startsWith("//")) {
|
|
100
|
-
if (p0.startsWith("//./")) {
|
|
101
|
-
result = "//." + result;
|
|
102
|
-
} else {
|
|
103
|
-
result = "/" + result;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
return result;
|
|
108
|
-
},
|
|
109
|
-
addExt: function (file, ext) {
|
|
110
|
-
if (!ext) {
|
|
111
|
-
return file;
|
|
112
|
-
} else {
|
|
113
|
-
if (ext[0] !== ".") {
|
|
114
|
-
ext = "." + ext;
|
|
115
|
-
}
|
|
116
|
-
return file + (file.endsWith(ext) ? "" : ext);
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
trimExt: function (filename, ignoreExts, maxSize) {
|
|
120
|
-
var oldExt;
|
|
121
|
-
if (maxSize == null) {
|
|
122
|
-
maxSize = 7;
|
|
123
|
-
}
|
|
124
|
-
oldExt = upath.extname(filename);
|
|
125
|
-
if (isValidExt(oldExt, ignoreExts, maxSize)) {
|
|
126
|
-
return filename.slice(0, +(filename.length - oldExt.length - 1) + 1 || 9000000000);
|
|
127
|
-
} else {
|
|
128
|
-
return filename;
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
removeExt: function (filename, ext) {
|
|
132
|
-
if (!ext) {
|
|
133
|
-
return filename;
|
|
134
|
-
} else {
|
|
135
|
-
ext = ext[0] === "." ? ext : "." + ext;
|
|
136
|
-
if (upath.extname(filename) === ext) {
|
|
137
|
-
return upath.trimExt(filename, [], ext.length);
|
|
138
|
-
} else {
|
|
139
|
-
return filename;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
changeExt: function (filename, ext, ignoreExts, maxSize) {
|
|
144
|
-
if (maxSize == null) {
|
|
145
|
-
maxSize = 7;
|
|
146
|
-
}
|
|
147
|
-
return upath.trimExt(filename, ignoreExts, maxSize) + (!ext ? "" : ext[0] === "." ? ext : "." + ext);
|
|
148
|
-
},
|
|
149
|
-
defaultExt: function (filename, ext, ignoreExts, maxSize) {
|
|
150
|
-
var oldExt;
|
|
151
|
-
if (maxSize == null) {
|
|
152
|
-
maxSize = 7;
|
|
153
|
-
}
|
|
154
|
-
oldExt = upath.extname(filename);
|
|
155
|
-
if (isValidExt(oldExt, ignoreExts, maxSize)) {
|
|
156
|
-
return filename;
|
|
157
|
-
} else {
|
|
158
|
-
return upath.addExt(filename, ext);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
isValidExt = function (ext, ignoreExts, maxSize) {
|
|
163
|
-
if (ignoreExts == null) {
|
|
164
|
-
ignoreExts = [];
|
|
165
|
-
}
|
|
166
|
-
return ext && ext.length <= maxSize && indexOf.call(ignoreExts.map(function (e) {
|
|
167
|
-
return (e && e[0] !== "." ? "." : "") + e;
|
|
168
|
-
}), ext) < 0;
|
|
169
|
-
};
|
|
170
|
-
for (name in extraFunctions) {
|
|
171
|
-
if (!hasProp.call(extraFunctions, name))
|
|
172
|
-
continue;
|
|
173
|
-
extraFn = extraFunctions[name];
|
|
174
|
-
if (upath[name] !== void 0) {
|
|
175
|
-
throw new Error("path." + name + " already exists.");
|
|
176
|
-
} else {
|
|
177
|
-
upath[name] = extraFn;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
;
|
|
182
|
-
|
|
183
|
-
}),
|
|
184
|
-
"path": (function () {
|
|
185
|
-
|
|
186
|
-
;// CONCATENATED MODULE: external "path"
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}),
|
|
190
|
-
|
|
191
|
-
});
|
|
192
|
-
/************************************************************************/
|
|
193
|
-
// The module cache
|
|
194
|
-
var __webpack_module_cache__ = {};
|
|
195
|
-
|
|
196
|
-
// The require function
|
|
197
|
-
function __webpack_require__(moduleId) {
|
|
198
|
-
|
|
199
|
-
// Check if module is in cache
|
|
200
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
201
|
-
if (cachedModule !== undefined) {
|
|
202
|
-
return cachedModule.exports;
|
|
203
|
-
}
|
|
204
|
-
// Create a new module (and put it into the cache)
|
|
205
|
-
var module = (__webpack_module_cache__[moduleId] = {
|
|
206
|
-
exports: {}
|
|
207
|
-
});
|
|
208
|
-
// Execute the module function
|
|
209
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
210
|
-
|
|
211
|
-
// Return the exports of the module
|
|
212
|
-
return module.exports;
|
|
213
|
-
|
|
214
|
-
}
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_fs__ from "node:fs";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_os__ from "node:os";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_path__ from "node:path";
|
|
4
|
+
// The require scope
|
|
5
|
+
var __webpack_require__ = {};
|
|
215
6
|
|
|
216
7
|
/************************************************************************/
|
|
217
|
-
// webpack/runtime/compat_get_default_export
|
|
218
|
-
(() => {
|
|
219
|
-
// getDefaultExport function for compatibility with non-harmony modules
|
|
220
|
-
__webpack_require__.n = function (module) {
|
|
221
|
-
var getter = module && module.__esModule ?
|
|
222
|
-
function () { return module['default']; } :
|
|
223
|
-
function () { return module; };
|
|
224
|
-
__webpack_require__.d(getter, { a: getter });
|
|
225
|
-
return getter;
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
})();
|
|
232
8
|
// webpack/runtime/define_property_getters
|
|
233
9
|
(() => {
|
|
234
10
|
__webpack_require__.d = function(exports, definition) {
|
|
@@ -247,11 +23,7 @@ __webpack_require__.o = function (obj, prop) {
|
|
|
247
23
|
|
|
248
24
|
})();
|
|
249
25
|
/************************************************************************/
|
|
250
|
-
var __webpack_exports__ = {};
|
|
251
26
|
|
|
252
|
-
;// CONCATENATED MODULE: external "node:os"
|
|
253
|
-
|
|
254
|
-
var external_node_os_default = /*#__PURE__*/__webpack_require__.n(external_node_os_namespaceObject);
|
|
255
27
|
;// CONCATENATED MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayReduce.js
|
|
256
28
|
/**
|
|
257
29
|
* A specialized version of `_.reduce` for arrays without support for
|
|
@@ -925,10 +697,22 @@ var snakeCase_snakeCase = _createCompounder(function(result, word, index) {
|
|
|
925
697
|
|
|
926
698
|
;// CONCATENATED MODULE: external "node:fs"
|
|
927
699
|
|
|
928
|
-
var
|
|
700
|
+
var external_node_fs_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
|
|
701
|
+
var external_node_fs_y = x => () => x
|
|
702
|
+
var external_node_fs_namespaceObject = __WEBPACK_EXTERNAL_MODULE_node_fs__;
|
|
703
|
+
|
|
704
|
+
;// CONCATENATED MODULE: external "node:os"
|
|
705
|
+
|
|
706
|
+
var external_node_os_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
|
|
707
|
+
var external_node_os_y = x => () => x
|
|
708
|
+
var external_node_os_namespaceObject = __WEBPACK_EXTERNAL_MODULE_node_os__;
|
|
709
|
+
|
|
929
710
|
;// CONCATENATED MODULE: external "node:path"
|
|
930
711
|
|
|
931
|
-
var
|
|
712
|
+
var external_node_path_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
|
|
713
|
+
var external_node_path_y = x => () => x
|
|
714
|
+
var external_node_path_namespaceObject = __WEBPACK_EXTERNAL_MODULE_node_path__;
|
|
715
|
+
|
|
932
716
|
;// CONCATENATED MODULE: ./node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/escapeRegExp.js
|
|
933
717
|
|
|
934
718
|
|
|
@@ -963,25 +747,197 @@ function escapeRegExp(string) {
|
|
|
963
747
|
|
|
964
748
|
/* harmony default export */ const lodash_es_escapeRegExp = (escapeRegExp);
|
|
965
749
|
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
750
|
+
;// CONCATENATED MODULE: ./src/upath.mjs
|
|
751
|
+
// @ts-nocheck
|
|
752
|
+
/**
|
|
753
|
+
* upath http://github.com/anodynos/upath/
|
|
754
|
+
*
|
|
755
|
+
* 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.
|
|
756
|
+
* Version 2.0.1 - Compiled on 2020-11-07 16:59:47
|
|
757
|
+
* Repository git://github.com/anodynos/upath
|
|
758
|
+
* Copyright(c) 2020 Angelos Pikoulas <agelos.pikoulas@gmail.com>
|
|
759
|
+
* License MIT
|
|
760
|
+
*/ // Generated by uRequire v0.7.0-beta.33 target: 'lib' template: 'nodejs'
|
|
761
|
+
|
|
762
|
+
const VERSION = '2.0.1';
|
|
763
|
+
// injected by urequire-rc-inject-version
|
|
764
|
+
let extraFn;
|
|
765
|
+
let extraFunctions;
|
|
766
|
+
let isFunction;
|
|
767
|
+
let isString;
|
|
768
|
+
let isValidExt;
|
|
769
|
+
let upath_name;
|
|
770
|
+
let upath_propName;
|
|
771
|
+
let propValue;
|
|
772
|
+
let toUnix;
|
|
773
|
+
let upath;
|
|
774
|
+
const slice = [].slice;
|
|
775
|
+
const indexOf = [].indexOf || function(item) {
|
|
776
|
+
for(let i = 0, l = this.length; i < l; i++){
|
|
777
|
+
if (i in this && this[i] === item) return i;
|
|
778
|
+
}
|
|
779
|
+
return -1;
|
|
780
|
+
};
|
|
781
|
+
const hasProp = {}.hasOwnProperty;
|
|
782
|
+
isFunction = (val)=>typeof val === 'function';
|
|
783
|
+
isString = (val)=>typeof val === 'string' || !!val && typeof val === 'object' && Object.prototype.toString.call(val) === '[object String]';
|
|
784
|
+
upath.VERSION = typeof VERSION !== 'undefined' && VERSION !== null ? VERSION : 'NO-VERSION';
|
|
785
|
+
toUnix = (p)=>{
|
|
786
|
+
p = p.replace(/\\/g, '/');
|
|
787
|
+
p = p.replace(/(?<!^)\/+/g, '/');
|
|
788
|
+
return p;
|
|
789
|
+
};
|
|
790
|
+
for(upath_propName in external_node_path_namespaceObject["default"]){
|
|
791
|
+
propValue = external_node_path_namespaceObject["default"][upath_propName];
|
|
792
|
+
if (isFunction(propValue)) {
|
|
793
|
+
upath[upath_propName] = ((propName)=>()=>{
|
|
794
|
+
let args;
|
|
795
|
+
let result;
|
|
796
|
+
args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
|
797
|
+
args = args.map((p)=>{
|
|
798
|
+
if (isString(p)) {
|
|
799
|
+
return toUnix(p);
|
|
800
|
+
}
|
|
801
|
+
return p;
|
|
802
|
+
});
|
|
803
|
+
result = external_node_path_namespaceObject["default"][propName].apply(external_node_path_namespaceObject["default"], args);
|
|
804
|
+
if (isString(result)) {
|
|
805
|
+
return toUnix(result);
|
|
806
|
+
}
|
|
807
|
+
return result;
|
|
808
|
+
})(upath_propName);
|
|
809
|
+
} else {
|
|
810
|
+
upath[upath_propName] = propValue;
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
upath.sep = '/';
|
|
814
|
+
extraFunctions = {
|
|
815
|
+
toUnix: toUnix,
|
|
816
|
+
normalizeSafe: (p)=>{
|
|
817
|
+
let result;
|
|
818
|
+
p = toUnix(p);
|
|
819
|
+
result = upath.normalize(p);
|
|
820
|
+
if (p.startsWith('./') && !result.startsWith('./') && !result.startsWith('..')) {
|
|
821
|
+
result = `./${result}`;
|
|
822
|
+
} else if (p.startsWith('//') && !result.startsWith('//')) {
|
|
823
|
+
if (p.startsWith('//./')) {
|
|
824
|
+
result = `//.${result}`;
|
|
825
|
+
} else {
|
|
826
|
+
result = `/${result}`;
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
return result;
|
|
830
|
+
},
|
|
831
|
+
normalizeTrim: (p)=>{
|
|
832
|
+
p = upath.normalizeSafe(p);
|
|
833
|
+
if (p.endsWith('/')) {
|
|
834
|
+
return p.slice(0, +(p.length - 2) + 1 || 9000000000);
|
|
835
|
+
}
|
|
836
|
+
return p;
|
|
837
|
+
},
|
|
838
|
+
joinSafe: ()=>{
|
|
839
|
+
let p;
|
|
840
|
+
let p0;
|
|
841
|
+
let result;
|
|
842
|
+
p = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
|
843
|
+
result = upath.join.apply(null, p);
|
|
844
|
+
if (p.length > 0) {
|
|
845
|
+
p0 = toUnix(p[0]);
|
|
846
|
+
if (p0.startsWith('./') && !result.startsWith('./') && !result.startsWith('..')) {
|
|
847
|
+
result = `./${result}`;
|
|
848
|
+
} else if (p0.startsWith('//') && !result.startsWith('//')) {
|
|
849
|
+
if (p0.startsWith('//./')) {
|
|
850
|
+
result = `//.${result}`;
|
|
851
|
+
} else {
|
|
852
|
+
result = `/${result}`;
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
return result;
|
|
857
|
+
},
|
|
858
|
+
addExt: (file, ext)=>{
|
|
859
|
+
if (!ext) {
|
|
860
|
+
return file;
|
|
861
|
+
}
|
|
862
|
+
if (ext[0] !== '.') {
|
|
863
|
+
ext = `.${ext}`;
|
|
864
|
+
}
|
|
865
|
+
return file + (file.endsWith(ext) ? '' : ext);
|
|
866
|
+
},
|
|
867
|
+
trimExt: (filename, ignoreExts, maxSize)=>{
|
|
868
|
+
let oldExt;
|
|
869
|
+
if (maxSize == null) {
|
|
870
|
+
maxSize = 7;
|
|
871
|
+
}
|
|
872
|
+
oldExt = upath.extname(filename);
|
|
873
|
+
if (isValidExt(oldExt, ignoreExts, maxSize)) {
|
|
874
|
+
return filename.slice(0, +(filename.length - oldExt.length - 1) + 1 || 9000000000);
|
|
875
|
+
}
|
|
876
|
+
return filename;
|
|
877
|
+
},
|
|
878
|
+
removeExt: (filename, ext)=>{
|
|
879
|
+
if (!ext) {
|
|
880
|
+
return filename;
|
|
881
|
+
}
|
|
882
|
+
ext = ext[0] === '.' ? ext : `.${ext}`;
|
|
883
|
+
if (upath.extname(filename) === ext) {
|
|
884
|
+
return upath.trimExt(filename, [], ext.length);
|
|
885
|
+
}
|
|
886
|
+
return filename;
|
|
887
|
+
},
|
|
888
|
+
changeExt: (filename, ext, ignoreExts, maxSize)=>{
|
|
889
|
+
if (maxSize == null) {
|
|
890
|
+
maxSize = 7;
|
|
891
|
+
}
|
|
892
|
+
return upath.trimExt(filename, ignoreExts, maxSize) + (!ext ? '' : ext[0] === '.' ? ext : `.${ext}`);
|
|
893
|
+
},
|
|
894
|
+
defaultExt: (filename, ext, ignoreExts, maxSize)=>{
|
|
895
|
+
let oldExt;
|
|
896
|
+
if (maxSize == null) {
|
|
897
|
+
maxSize = 7;
|
|
898
|
+
}
|
|
899
|
+
oldExt = upath.extname(filename);
|
|
900
|
+
if (isValidExt(oldExt, ignoreExts, maxSize)) {
|
|
901
|
+
return filename;
|
|
902
|
+
}
|
|
903
|
+
return upath.addExt(filename, ext);
|
|
904
|
+
}
|
|
905
|
+
};
|
|
906
|
+
isValidExt = (ext, ignoreExts, maxSize)=>{
|
|
907
|
+
if (ignoreExts == null) {
|
|
908
|
+
ignoreExts = [];
|
|
909
|
+
}
|
|
910
|
+
return ext && ext.length <= maxSize && indexOf.call(ignoreExts.map((e)=>(e && e[0] !== '.' ? '.' : '') + e), ext) < 0;
|
|
911
|
+
};
|
|
912
|
+
for(upath_name in extraFunctions){
|
|
913
|
+
if (!hasProp.call(extraFunctions, upath_name)) continue;
|
|
914
|
+
extraFn = extraFunctions[upath_name];
|
|
915
|
+
if (upath[upath_name] !== void 0) {
|
|
916
|
+
throw new Error(`path.${upath_name} already exists.`);
|
|
917
|
+
}
|
|
918
|
+
upath[upath_name] = extraFn;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
|
|
969
922
|
;// CONCATENATED MODULE: ./src/utils.ts
|
|
970
923
|
|
|
971
924
|
|
|
972
925
|
|
|
973
926
|
|
|
927
|
+
// @ts-ignore
|
|
974
928
|
|
|
975
|
-
const isPathString = (test)=>
|
|
976
|
-
function
|
|
929
|
+
const isPathString = (test)=>external_node_path_namespaceObject["default"].posix.basename(test) !== test || external_node_path_namespaceObject["default"].win32.basename(test) !== test;
|
|
930
|
+
function getRealTemporaryDirectory() {
|
|
977
931
|
let ret = null;
|
|
978
932
|
try {
|
|
979
|
-
ret =
|
|
980
|
-
ret =
|
|
933
|
+
ret = external_node_os_namespaceObject["default"].tmpdir();
|
|
934
|
+
ret = external_node_fs_namespaceObject["default"].realpathSync(ret);
|
|
981
935
|
} catch {}
|
|
982
936
|
return ret;
|
|
983
937
|
}
|
|
984
|
-
const normalizeToPosixPath = (p)=>
|
|
938
|
+
const normalizeToPosixPath = (p)=>{
|
|
939
|
+
return upath.normalizeSafe(external_node_path_namespaceObject["default"].normalize(p || '')).replace(/^([a-zA-Z]+):/, (_, m)=>`/${m.toLowerCase()}`);
|
|
940
|
+
};
|
|
985
941
|
/**
|
|
986
942
|
* Compile path string to RegExp.
|
|
987
943
|
* @note Only support posix path.
|
|
@@ -999,7 +955,6 @@ function splitPathString(str) {
|
|
|
999
955
|
;// CONCATENATED MODULE: ./src/applyMatcherReplacement.ts
|
|
1000
956
|
|
|
1001
957
|
|
|
1002
|
-
|
|
1003
958
|
function applyPathMatcher(matcher, str, options = {}) {
|
|
1004
959
|
const regex = compilePathMatcherRegExp(matcher.match);
|
|
1005
960
|
const replacer = (substring, ...args)=>{
|
|
@@ -1016,50 +971,28 @@ function applyMatcherReplacement(matchers, str, options = {}) {
|
|
|
1016
971
|
return applyPathMatcher(matcher, ret, options);
|
|
1017
972
|
}, str);
|
|
1018
973
|
}
|
|
1019
|
-
const createDefaultPathMatchers = ()=>{
|
|
1020
|
-
const ret = [
|
|
1021
|
-
{
|
|
1022
|
-
match: /(?<=\/)(\.pnpm\/.+?\/node_modules)(?=\/)/,
|
|
1023
|
-
mark: 'pnpmInner'
|
|
1024
|
-
}
|
|
1025
|
-
];
|
|
1026
|
-
const tmpdir = getRealTemporaryDirectory();
|
|
1027
|
-
tmpdir && ret.push({
|
|
1028
|
-
match: tmpdir,
|
|
1029
|
-
mark: 'temp'
|
|
1030
|
-
});
|
|
1031
|
-
ret.push({
|
|
1032
|
-
match: os.tmpdir(),
|
|
1033
|
-
mark: 'temp'
|
|
1034
|
-
});
|
|
1035
|
-
ret.push({
|
|
1036
|
-
match: os.homedir(),
|
|
1037
|
-
mark: 'home'
|
|
1038
|
-
});
|
|
1039
|
-
return ret;
|
|
1040
|
-
};
|
|
1041
974
|
|
|
1042
975
|
;// CONCATENATED MODULE: ./src/createDefaultPathMatchers.ts
|
|
1043
976
|
|
|
1044
977
|
|
|
1045
|
-
const
|
|
978
|
+
const createDefaultPathMatchers = ()=>{
|
|
1046
979
|
const ret = [
|
|
1047
980
|
{
|
|
1048
981
|
match: /(?<=\/)(\.pnpm\/.+?\/node_modules)(?=\/)/,
|
|
1049
982
|
mark: 'pnpmInner'
|
|
1050
983
|
}
|
|
1051
984
|
];
|
|
1052
|
-
const tmpdir =
|
|
985
|
+
const tmpdir = getRealTemporaryDirectory();
|
|
1053
986
|
tmpdir && ret.push({
|
|
1054
987
|
match: tmpdir,
|
|
1055
988
|
mark: 'temp'
|
|
1056
989
|
});
|
|
1057
990
|
ret.push({
|
|
1058
|
-
match:
|
|
991
|
+
match: external_node_os_namespaceObject["default"].tmpdir(),
|
|
1059
992
|
mark: 'temp'
|
|
1060
993
|
});
|
|
1061
994
|
ret.push({
|
|
1062
|
-
match:
|
|
995
|
+
match: external_node_os_namespaceObject["default"].homedir(),
|
|
1063
996
|
mark: 'home'
|
|
1064
997
|
});
|
|
1065
998
|
return ret;
|
|
@@ -1081,7 +1014,7 @@ function createSnapshotSerializer(options) {
|
|
|
1081
1014
|
match: workspace
|
|
1082
1015
|
},
|
|
1083
1016
|
...customMatchers,
|
|
1084
|
-
...
|
|
1017
|
+
...createDefaultPathMatchers()
|
|
1085
1018
|
];
|
|
1086
1019
|
for (const matcher of pathMatchers){
|
|
1087
1020
|
if (typeof matcher.match === 'string') {
|