@modern-js/utils 3.9.0 → 3.9.2
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/cli/applyOptionsChain.js +1 -1
- package/dist/cjs/cli/get/config.js +1 -1
- package/dist/cjs/cli/get/data.js +1 -1
- package/dist/cjs/cli/require.js +2 -2
- package/dist/compiled/browserslist/index.js +37 -35
- package/dist/compiled/commander/index.js +2 -3
- package/dist/compiled/debug/index.js +1 -1
- package/dist/compiled/execa/index.js +8 -6
- package/dist/compiled/fs-extra/index.js +39 -35
- package/dist/compiled/glob/index.js +17 -15
- package/dist/compiled/inquirer/index.js +29 -25
- package/dist/compiled/js-yaml/index.js +17 -15
- package/dist/compiled/js-yaml/index.mjs +17 -15
- package/dist/compiled/minimist/index.js +1 -2
- package/dist/compiled/ora/index.js +17 -15
- package/dist/compiled/semver/index.js +12 -13
- package/dist/compiled/signale/index.js +3 -3
- package/dist/compiled/upath/index.js +15 -11
- package/dist/compiled/webpack-chain/index.js +5 -3
- package/dist/esm/cli/applyOptionsChain.mjs +1 -1
- package/dist/esm/cli/get/config.mjs +1 -1
- package/dist/esm/cli/get/data.mjs +1 -1
- package/dist/esm/cli/require.mjs +1 -1
- package/dist/esm/compiled.mjs +1 -1
- package/dist/esm-node/cli/applyOptionsChain.mjs +1 -1
- package/dist/esm-node/cli/get/config.mjs +1 -1
- package/dist/esm-node/cli/get/data.mjs +1 -1
- package/dist/esm-node/cli/require.mjs +1 -1
- package/dist/types/cli/common.d.ts +1 -1
- package/dist/types/cli/constants.d.ts +1 -1
- package/dist/types/cli/get/index.d.ts +2 -2
- package/dist/types/cli/index.d.ts +24 -24
- package/dist/types/cli/is/index.d.ts +4 -4
- package/dist/types/cli/watch.d.ts +1 -1
- package/dist/types/compiled.d.ts +27 -27
- package/dist/types/index.d.ts +3 -3
- package/dist/types/universal/index.d.ts +1 -1
- package/package.json +4 -4
- package/rslib.config.mts +5 -4
- /package/dist/esm/{rslib-runtime.mjs → rslib-runtime~1.mjs} +0 -0
|
@@ -35,7 +35,7 @@ const external_logger_js_namespaceObject = require("./logger.js");
|
|
|
35
35
|
function applyOptionsChain(defaults, options, utils, mergeFn = Object.assign) {
|
|
36
36
|
if (!options) return defaults;
|
|
37
37
|
if ((0, index_js_namespaceObject.isPlainObject)(options)) return mergeFn(defaults, options);
|
|
38
|
-
if ((0, index_js_namespaceObject.isFunction)(options)) {
|
|
38
|
+
else if ((0, index_js_namespaceObject.isFunction)(options)) {
|
|
39
39
|
const ret = options(defaults, utils);
|
|
40
40
|
if (ret) {
|
|
41
41
|
if (!(0, index_js_namespaceObject.isPlainObject)(ret)) external_logger_js_namespaceObject.logger.warn(`${options.name}: Function should mutate the config and return nothing, Or return a cloned or merged version of config object.`);
|
|
@@ -33,7 +33,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
33
33
|
const index_js_namespaceObject = require("../is/index.js");
|
|
34
34
|
const getEntryOptions = (name, isMainEntry, baseOptions, optionsByEntries, packageName)=>{
|
|
35
35
|
if (!optionsByEntries) return baseOptions;
|
|
36
|
-
{
|
|
36
|
+
else {
|
|
37
37
|
let optionsByEntry = getOptionsByEntryName(name, optionsByEntries);
|
|
38
38
|
if (void 0 === optionsByEntry && isMainEntry && packageName) optionsByEntry = getOptionsByEntryName(packageName, optionsByEntries);
|
|
39
39
|
return void 0 !== optionsByEntry ? (0, index_js_namespaceObject.isPlainObject)(optionsByEntry) && (0, index_js_namespaceObject.isPlainObject)(baseOptions) ? {
|
package/dist/cjs/cli/get/data.js
CHANGED
package/dist/cjs/cli/require.js
CHANGED
|
@@ -41,7 +41,7 @@ const external_fs_js_namespaceObject = require("./fs.js");
|
|
|
41
41
|
async function importPath(path, options) {
|
|
42
42
|
const modulePath = (0, external_node_path_namespaceObject.isAbsolute)(path) ? (0, external_node_url_namespaceObject.pathToFileURL)(path).href : path;
|
|
43
43
|
if ('development' !== process.env.NODE_ENV) return await import(modulePath, options);
|
|
44
|
-
{
|
|
44
|
+
else {
|
|
45
45
|
const timestamp = Date.now();
|
|
46
46
|
return await import(`${modulePath}?t=${timestamp}`, options);
|
|
47
47
|
}
|
|
@@ -65,7 +65,7 @@ async function compatibleRequireCJS(path, interop = true) {
|
|
|
65
65
|
return interop && requiredModule?.__esModule ? requiredModule.default : requiredModule;
|
|
66
66
|
} catch (err) {
|
|
67
67
|
if ('ERR_REQUIRE_ESM' === err.code) return await compatibleRequireESM(path, interop);
|
|
68
|
-
throw err;
|
|
68
|
+
else throw err;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
async function compatibleRequire(path, interop = true) {
|
|
@@ -74,13 +74,13 @@
|
|
|
74
74
|
if (">" === e) return function(e) {
|
|
75
75
|
return parseFloat(e) > s;
|
|
76
76
|
};
|
|
77
|
-
if (">=" === e) return function(e) {
|
|
77
|
+
else if (">=" === e) return function(e) {
|
|
78
78
|
return parseFloat(e) >= s;
|
|
79
79
|
};
|
|
80
|
-
if ("<" === e) return function(e) {
|
|
80
|
+
else if ("<" === e) return function(e) {
|
|
81
81
|
return parseFloat(e) < s;
|
|
82
82
|
};
|
|
83
|
-
return function(e) {
|
|
83
|
+
else return function(e) {
|
|
84
84
|
return parseFloat(e) <= s;
|
|
85
85
|
};
|
|
86
86
|
}
|
|
@@ -92,15 +92,15 @@
|
|
|
92
92
|
e = e.split(".").map(parseSimpleInt);
|
|
93
93
|
return compareSemver(e, s) > 0;
|
|
94
94
|
};
|
|
95
|
-
if (">=" === e) return function(e) {
|
|
95
|
+
else if (">=" === e) return function(e) {
|
|
96
96
|
e = e.split(".").map(parseSimpleInt);
|
|
97
97
|
return compareSemver(e, s) >= 0;
|
|
98
98
|
};
|
|
99
|
-
if ("<" === e) return function(e) {
|
|
99
|
+
else if ("<" === e) return function(e) {
|
|
100
100
|
e = e.split(".").map(parseSimpleInt);
|
|
101
101
|
return compareSemver(s, e) > 0;
|
|
102
102
|
};
|
|
103
|
-
return function(e) {
|
|
103
|
+
else return function(e) {
|
|
104
104
|
e = e.split(".").map(parseSimpleInt);
|
|
105
105
|
return compareSemver(s, e) >= 0;
|
|
106
106
|
};
|
|
@@ -141,14 +141,14 @@
|
|
|
141
141
|
}
|
|
142
142
|
function resolveVersion(e, s) {
|
|
143
143
|
if (-1 !== e.versions.indexOf(s)) return s;
|
|
144
|
-
if (browserslist.versionAliases[e.name][s]) return browserslist.versionAliases[e.name][s];
|
|
145
|
-
return false;
|
|
144
|
+
else if (browserslist.versionAliases[e.name][s]) return browserslist.versionAliases[e.name][s];
|
|
145
|
+
else return false;
|
|
146
146
|
}
|
|
147
147
|
function normalizeVersion(e, s) {
|
|
148
148
|
var r = resolveVersion(e, s);
|
|
149
149
|
if (r) return r;
|
|
150
|
-
if (1 === e.versions.length) return e.versions[0];
|
|
151
|
-
return false;
|
|
150
|
+
else if (1 === e.versions.length) return e.versions[0];
|
|
151
|
+
else return false;
|
|
152
152
|
}
|
|
153
153
|
function filterByYear(e, s) {
|
|
154
154
|
e /= 1e3;
|
|
@@ -188,12 +188,14 @@
|
|
|
188
188
|
if (s.mobileToDesktop && browserslist.desktopNames[e]) {
|
|
189
189
|
var r = browserslist.data[browserslist.desktopNames[e]];
|
|
190
190
|
if ("android" === e) return normalizeAndroidData(cloneData(browserslist.data[e]), r);
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
"
|
|
195
|
-
|
|
196
|
-
|
|
191
|
+
else {
|
|
192
|
+
var n = cloneData(r);
|
|
193
|
+
n.name = e;
|
|
194
|
+
if ("op_mob" === e) n = mapVersions(n, {
|
|
195
|
+
"10.0-10.1": "10"
|
|
196
|
+
});
|
|
197
|
+
return n;
|
|
198
|
+
}
|
|
197
199
|
}
|
|
198
200
|
return browserslist.data[e];
|
|
199
201
|
}
|
|
@@ -223,7 +225,7 @@
|
|
|
223
225
|
var t = n[n.length - 1];
|
|
224
226
|
var a = t - d - s;
|
|
225
227
|
if (a > 0) return e.slice(-1);
|
|
226
|
-
return e.slice(a - 1);
|
|
228
|
+
else return e.slice(a - 1);
|
|
227
229
|
}
|
|
228
230
|
function resolve(e, s) {
|
|
229
231
|
e = Array.isArray(e) ? flatten(e.map(parse)) : parse(e);
|
|
@@ -244,14 +246,14 @@
|
|
|
244
246
|
var d = o.select.apply(browserslist, u).map(function(e) {
|
|
245
247
|
var r = e.split(" ");
|
|
246
248
|
if ("0" === r[1]) return r[0] + " " + byName(r[0], s).versions[0];
|
|
247
|
-
return e;
|
|
249
|
+
else return e;
|
|
248
250
|
});
|
|
249
251
|
switch(r.type){
|
|
250
252
|
case v:
|
|
251
253
|
if (a) return e.filter(function(e) {
|
|
252
254
|
return -1 === d.indexOf(e);
|
|
253
255
|
});
|
|
254
|
-
return e.filter(function(e) {
|
|
256
|
+
else return e.filter(function(e) {
|
|
255
257
|
return -1 !== d.indexOf(e);
|
|
256
258
|
});
|
|
257
259
|
case c:
|
|
@@ -303,9 +305,11 @@
|
|
|
303
305
|
e = e.split(" ");
|
|
304
306
|
s = s.split(" ");
|
|
305
307
|
if (e[0] !== s[0]) return compare(e[0], s[0]);
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
308
|
+
else {
|
|
309
|
+
var r = e[1].split("-")[0];
|
|
310
|
+
var n = s[1].split("-")[0];
|
|
311
|
+
return compareSemver(n.split("."), r.split("."));
|
|
312
|
+
}
|
|
309
313
|
});
|
|
310
314
|
if (!process.env.BROWSERSLIST_DISABLE_CACHE) m[o] = u;
|
|
311
315
|
return u;
|
|
@@ -326,15 +330,13 @@
|
|
|
326
330
|
queryString: e.match(n)[1]
|
|
327
331
|
});
|
|
328
332
|
return true;
|
|
329
|
-
}
|
|
330
|
-
if (r.test(e)) {
|
|
333
|
+
} else if (r.test(e)) {
|
|
331
334
|
s.unshift({
|
|
332
335
|
type: c,
|
|
333
336
|
queryString: e.match(r)[1]
|
|
334
337
|
});
|
|
335
338
|
return true;
|
|
336
|
-
}
|
|
337
|
-
if (t === a) {
|
|
339
|
+
} else if (t === a) {
|
|
338
340
|
s.unshift({
|
|
339
341
|
type: c,
|
|
340
342
|
queryString: e.trim()
|
|
@@ -890,7 +892,7 @@
|
|
|
890
892
|
regexp: /^(\w+)$/i,
|
|
891
893
|
select: function(e, s) {
|
|
892
894
|
if (byName(s, e)) throw new l("Specify versions in Browserslist query for browser " + s);
|
|
893
|
-
throw unknownQuery(s);
|
|
895
|
+
else throw unknownQuery(s);
|
|
894
896
|
}
|
|
895
897
|
}
|
|
896
898
|
];
|
|
@@ -1057,12 +1059,12 @@
|
|
|
1057
1059
|
},
|
|
1058
1060
|
loadConfig: function(s) {
|
|
1059
1061
|
if (process.env.BROWSERSLIST) return process.env.BROWSERSLIST;
|
|
1060
|
-
if (s.config || process.env.BROWSERSLIST_CONFIG) {
|
|
1062
|
+
else if (s.config || process.env.BROWSERSLIST_CONFIG) {
|
|
1061
1063
|
var r = s.config || process.env.BROWSERSLIST_CONFIG;
|
|
1062
1064
|
if ("package.json" === a.basename(r)) return pickEnv(parsePackage(r), s);
|
|
1063
|
-
return pickEnv(e.exports.readConfig(r), s);
|
|
1064
|
-
}
|
|
1065
|
-
|
|
1065
|
+
else return pickEnv(e.exports.readConfig(r), s);
|
|
1066
|
+
} else if (s.path) return pickEnv(e.exports.findConfig(s.path), s);
|
|
1067
|
+
else return;
|
|
1066
1068
|
},
|
|
1067
1069
|
loadCountry: function(e, s, r) {
|
|
1068
1070
|
var n = s.replace(/[^\w-]/g, "");
|
|
@@ -1127,10 +1129,10 @@
|
|
|
1127
1129
|
console.warn("[Browserslist] Could not parse " + t + ". Ignoring it.");
|
|
1128
1130
|
}
|
|
1129
1131
|
if (isFile(n) && l) throw new o(s + " contains both browserslist and package.json with browsers");
|
|
1130
|
-
if (isFile(i) && l) throw new o(s + " contains both .browserslistrc and package.json with browsers");
|
|
1131
|
-
if (isFile(n) && isFile(i)) throw new o(s + " contains both .browserslistrc and browserslist");
|
|
1132
|
-
if (isFile(n)) return e.exports.readConfig(n);
|
|
1133
|
-
if (isFile(i)) return e.exports.readConfig(i);
|
|
1132
|
+
else if (isFile(i) && l) throw new o(s + " contains both .browserslistrc and package.json with browsers");
|
|
1133
|
+
else if (isFile(n) && isFile(i)) throw new o(s + " contains both .browserslistrc and browserslist");
|
|
1134
|
+
else if (isFile(n)) return e.exports.readConfig(n);
|
|
1135
|
+
else if (isFile(i)) return e.exports.readConfig(i);
|
|
1134
1136
|
else return l;
|
|
1135
1137
|
});
|
|
1136
1138
|
if (!process.env.BROWSERSLIST_DISABLE_CACHE) r.forEach(function(e) {
|
|
@@ -557,8 +557,7 @@
|
|
|
557
557
|
const e = h ? `searched for local subcommand relative to directory '${h}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
|
|
558
558
|
const i = `'${l}' does not exist\n - if '${t._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\n - if the default executable name is not suitable, use the executableFile option to supply a custom name or path\n - ${e}`;
|
|
559
559
|
throw new Error(i);
|
|
560
|
-
}
|
|
561
|
-
if ("EACCES" === e.code) throw new Error(`'${l}' not executable`);
|
|
560
|
+
} else if ("EACCES" === e.code) throw new Error(`'${l}' not executable`);
|
|
562
561
|
if (p) {
|
|
563
562
|
const t = new u(1, "commander.executeSubCommandAsync", "(error)");
|
|
564
563
|
t.nestedError = e;
|
|
@@ -576,7 +575,7 @@
|
|
|
576
575
|
s = this._chainOrCallSubCommandHook(s, n, "preSubcommand");
|
|
577
576
|
s = this._chainOrCall(s, ()=>{
|
|
578
577
|
if (!n._executableHandler) return n._parseCommand(e, i);
|
|
579
|
-
this._executeSubCommand(n, e.concat(i));
|
|
578
|
+
else this._executeSubCommand(n, e.concat(i));
|
|
580
579
|
});
|
|
581
580
|
return s;
|
|
582
581
|
}
|
|
@@ -447,7 +447,7 @@
|
|
|
447
447
|
t = t || {};
|
|
448
448
|
var r = typeof e;
|
|
449
449
|
if ("string" === r && e.length > 0) return parse(e);
|
|
450
|
-
if ("number" === r && isFinite(e)) return t.long ? fmtLong(e) : fmtShort(e);
|
|
450
|
+
else if ("number" === r && isFinite(e)) return t.long ? fmtLong(e) : fmtShort(e);
|
|
451
451
|
throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(e));
|
|
452
452
|
};
|
|
453
453
|
function parse(e) {
|
|
@@ -1259,7 +1259,7 @@
|
|
|
1259
1259
|
return o.sync(e, t || {});
|
|
1260
1260
|
} catch (e) {
|
|
1261
1261
|
if (t && t.ignoreErrors || "EACCES" === e.code) return false;
|
|
1262
|
-
throw e;
|
|
1262
|
+
else throw e;
|
|
1263
1263
|
}
|
|
1264
1264
|
}
|
|
1265
1265
|
},
|
|
@@ -1561,11 +1561,13 @@
|
|
|
1561
1561
|
var x = r.emit;
|
|
1562
1562
|
var h = function(e, t) {
|
|
1563
1563
|
if (!("exit" === e && processOk(global.process))) return x.apply(this, arguments);
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1564
|
+
else {
|
|
1565
|
+
if (void 0 !== t) r.exitCode = t;
|
|
1566
|
+
var n = x.apply(this, arguments);
|
|
1567
|
+
u("exit", r.exitCode, null);
|
|
1568
|
+
u("afterexit", r.exitCode, null);
|
|
1569
|
+
return n;
|
|
1570
|
+
}
|
|
1569
1571
|
};
|
|
1570
1572
|
} else e.exports = function() {
|
|
1571
1573
|
return function() {};
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
const o = i.dereference ? n.statSync : n.lstatSync;
|
|
34
34
|
const c = o(t);
|
|
35
35
|
if (c.isDirectory()) return onDir(c, e, t, r, i);
|
|
36
|
-
if (c.isFile() || c.isCharacterDevice() || c.isBlockDevice()) return onFile(c, e, t, r, i);
|
|
37
|
-
if (c.isSymbolicLink()) return onLink(e, t, r, i);
|
|
38
|
-
if (c.isSocket()) throw new Error(`Cannot copy a socket file: ${t}`);
|
|
39
|
-
if (c.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${t}`);
|
|
36
|
+
else if (c.isFile() || c.isCharacterDevice() || c.isBlockDevice()) return onFile(c, e, t, r, i);
|
|
37
|
+
else if (c.isSymbolicLink()) return onLink(e, t, r, i);
|
|
38
|
+
else if (c.isSocket()) throw new Error(`Cannot copy a socket file: ${t}`);
|
|
39
|
+
else if (c.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${t}`);
|
|
40
40
|
throw new Error(`Unknown file: ${t}`);
|
|
41
41
|
}
|
|
42
42
|
function onFile(e, t, r, n, i) {
|
|
@@ -47,8 +47,7 @@
|
|
|
47
47
|
if (i.overwrite) {
|
|
48
48
|
n.unlinkSync(r);
|
|
49
49
|
return copyFile(e, t, r, i);
|
|
50
|
-
}
|
|
51
|
-
if (i.errorOnExist) throw new Error(`'${r}' already exists`);
|
|
50
|
+
} else if (i.errorOnExist) throw new Error(`'${r}' already exists`);
|
|
52
51
|
}
|
|
53
52
|
function copyFile(e, t, r, i) {
|
|
54
53
|
n.copyFileSync(t, r);
|
|
@@ -94,7 +93,7 @@
|
|
|
94
93
|
let c = n.readlinkSync(t);
|
|
95
94
|
if (o.dereference) c = i.resolve(process.cwd(), c);
|
|
96
95
|
if (!e) return n.symlinkSync(c, r);
|
|
97
|
-
{
|
|
96
|
+
else {
|
|
98
97
|
let e;
|
|
99
98
|
try {
|
|
100
99
|
e = n.readlinkSync(r);
|
|
@@ -172,10 +171,10 @@
|
|
|
172
171
|
c(t, (n, c)=>{
|
|
173
172
|
if (n) return o(n);
|
|
174
173
|
if (c.isDirectory()) return onDir(c, e, t, r, i, o);
|
|
175
|
-
if (c.isFile() || c.isCharacterDevice() || c.isBlockDevice()) return onFile(c, e, t, r, i, o);
|
|
176
|
-
if (c.isSymbolicLink()) return onLink(e, t, r, i, o);
|
|
177
|
-
if (c.isSocket()) return o(new Error(`Cannot copy a socket file: ${t}`));
|
|
178
|
-
if (c.isFIFO()) return o(new Error(`Cannot copy a FIFO pipe: ${t}`));
|
|
174
|
+
else if (c.isFile() || c.isCharacterDevice() || c.isBlockDevice()) return onFile(c, e, t, r, i, o);
|
|
175
|
+
else if (c.isSymbolicLink()) return onLink(e, t, r, i, o);
|
|
176
|
+
else if (c.isSocket()) return o(new Error(`Cannot copy a socket file: ${t}`));
|
|
177
|
+
else if (c.isFIFO()) return o(new Error(`Cannot copy a FIFO pipe: ${t}`));
|
|
179
178
|
return o(new Error(`Unknown file: ${t}`));
|
|
180
179
|
});
|
|
181
180
|
}
|
|
@@ -267,7 +266,7 @@
|
|
|
267
266
|
if (t) return c(t);
|
|
268
267
|
if (o.dereference) s = i.resolve(process.cwd(), s);
|
|
269
268
|
if (!e) return n.symlink(s, r, c);
|
|
270
|
-
n.readlink(r, (t, u)=>{
|
|
269
|
+
else n.readlink(r, (t, u)=>{
|
|
271
270
|
if (t) {
|
|
272
271
|
if ("EINVAL" === t.code || "UNKNOWN" === t.code) return n.symlink(s, r, c);
|
|
273
272
|
return c(t);
|
|
@@ -474,7 +473,7 @@
|
|
|
474
473
|
toDst: e
|
|
475
474
|
});
|
|
476
475
|
});
|
|
477
|
-
{
|
|
476
|
+
else {
|
|
478
477
|
const c = n.dirname(t);
|
|
479
478
|
const s = n.join(c, e);
|
|
480
479
|
return o(s, (t, o)=>{
|
|
@@ -483,7 +482,7 @@
|
|
|
483
482
|
toCwd: s,
|
|
484
483
|
toDst: e
|
|
485
484
|
});
|
|
486
|
-
return i.lstat(e, (t)=>{
|
|
485
|
+
else return i.lstat(e, (t)=>{
|
|
487
486
|
if (t) {
|
|
488
487
|
t.message = t.message.replace("lstat", "ensureSymlink");
|
|
489
488
|
return r(t);
|
|
@@ -505,8 +504,7 @@
|
|
|
505
504
|
toCwd: e,
|
|
506
505
|
toDst: e
|
|
507
506
|
};
|
|
508
|
-
}
|
|
509
|
-
{
|
|
507
|
+
} else {
|
|
510
508
|
const o = n.dirname(t);
|
|
511
509
|
const c = n.join(o, e);
|
|
512
510
|
r = i.existsSync(c);
|
|
@@ -514,12 +512,14 @@
|
|
|
514
512
|
toCwd: c,
|
|
515
513
|
toDst: e
|
|
516
514
|
};
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
515
|
+
else {
|
|
516
|
+
r = i.existsSync(e);
|
|
517
|
+
if (!r) throw new Error("relative srcpath does not exist");
|
|
518
|
+
return {
|
|
519
|
+
toCwd: e,
|
|
520
|
+
toDst: n.relative(o, e)
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
523
|
}
|
|
524
524
|
}
|
|
525
525
|
e.exports = {
|
|
@@ -1103,13 +1103,13 @@
|
|
|
1103
1103
|
t.chmodSync(e, 438);
|
|
1104
1104
|
} catch (e) {
|
|
1105
1105
|
if ("ENOENT" === e.code) return;
|
|
1106
|
-
throw r;
|
|
1106
|
+
else throw r;
|
|
1107
1107
|
}
|
|
1108
1108
|
try {
|
|
1109
1109
|
n = t.statSync(e);
|
|
1110
1110
|
} catch (e) {
|
|
1111
1111
|
if ("ENOENT" === e.code) return;
|
|
1112
|
-
throw r;
|
|
1112
|
+
else throw r;
|
|
1113
1113
|
}
|
|
1114
1114
|
if (n.isDirectory()) rmdirSync(e, t, r);
|
|
1115
1115
|
else t.unlinkSync(e);
|
|
@@ -1160,8 +1160,8 @@
|
|
|
1160
1160
|
else t.unlinkSync(e);
|
|
1161
1161
|
} catch (r) {
|
|
1162
1162
|
if ("ENOENT" === r.code) return;
|
|
1163
|
-
if ("EPERM" === r.code) return c ? fixWinEPERMSync(e, t, r) : rmdirSync(e, t, r);
|
|
1164
|
-
if ("EISDIR" !== r.code) throw r;
|
|
1163
|
+
else if ("EPERM" === r.code) return c ? fixWinEPERMSync(e, t, r) : rmdirSync(e, t, r);
|
|
1164
|
+
else if ("EISDIR" !== r.code) throw r;
|
|
1165
1165
|
rmdirSync(e, t, r);
|
|
1166
1166
|
}
|
|
1167
1167
|
}
|
|
@@ -1172,7 +1172,7 @@
|
|
|
1172
1172
|
t.rmdirSync(e);
|
|
1173
1173
|
} catch (n) {
|
|
1174
1174
|
if ("ENOTDIR" === n.code) throw r;
|
|
1175
|
-
if ("ENOTEMPTY" === n.code || "EEXIST" === n.code || "EPERM" === n.code) rmkidsSync(e, t);
|
|
1175
|
+
else if ("ENOTEMPTY" === n.code || "EEXIST" === n.code || "EPERM" === n.code) rmkidsSync(e, t);
|
|
1176
1176
|
else if ("ENOENT" !== n.code) throw n;
|
|
1177
1177
|
}
|
|
1178
1178
|
}
|
|
@@ -1633,7 +1633,7 @@
|
|
|
1633
1633
|
});
|
|
1634
1634
|
function ReadStream(e, t) {
|
|
1635
1635
|
if (this instanceof ReadStream) return f.apply(this, arguments), this;
|
|
1636
|
-
return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
|
|
1636
|
+
else return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
|
|
1637
1637
|
}
|
|
1638
1638
|
function ReadStream$open() {
|
|
1639
1639
|
var e = this;
|
|
@@ -1650,7 +1650,7 @@
|
|
|
1650
1650
|
}
|
|
1651
1651
|
function WriteStream(e, t) {
|
|
1652
1652
|
if (this instanceof WriteStream) return l.apply(this, arguments), this;
|
|
1653
|
-
return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
|
|
1653
|
+
else return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
|
|
1654
1654
|
}
|
|
1655
1655
|
function WriteStream$open() {
|
|
1656
1656
|
var e = this;
|
|
@@ -2097,8 +2097,10 @@
|
|
|
2097
2097
|
a = JSON.parse(s, t ? t.reviver : null);
|
|
2098
2098
|
} catch (t) {
|
|
2099
2099
|
if (!o) return null;
|
|
2100
|
-
|
|
2101
|
-
|
|
2100
|
+
else {
|
|
2101
|
+
t.message = `${e}: ${t.message}`;
|
|
2102
|
+
throw t;
|
|
2103
|
+
}
|
|
2102
2104
|
}
|
|
2103
2105
|
return a;
|
|
2104
2106
|
}
|
|
@@ -2115,8 +2117,10 @@
|
|
|
2115
2117
|
return JSON.parse(n, t.reviver);
|
|
2116
2118
|
} catch (t) {
|
|
2117
2119
|
if (!i) return null;
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
+
else {
|
|
2121
|
+
t.message = `${e}: ${t.message}`;
|
|
2122
|
+
throw t;
|
|
2123
|
+
}
|
|
2120
2124
|
}
|
|
2121
2125
|
}
|
|
2122
2126
|
async function _writeFile(e, t, r = {}) {
|
|
@@ -2160,7 +2164,7 @@
|
|
|
2160
2164
|
if ("function" != typeof t[t.length - 1]) return new Promise((r, n)=>{
|
|
2161
2165
|
e.call(this, ...t, (e, t)=>null != e ? n(e) : r(t));
|
|
2162
2166
|
});
|
|
2163
|
-
e.apply(this, t);
|
|
2167
|
+
else e.apply(this, t);
|
|
2164
2168
|
}, "name", {
|
|
2165
2169
|
value: e.name
|
|
2166
2170
|
});
|
|
@@ -2169,7 +2173,7 @@
|
|
|
2169
2173
|
return Object.defineProperty(function(...t) {
|
|
2170
2174
|
const r = t[t.length - 1];
|
|
2171
2175
|
if ("function" != typeof r) return e.apply(this, t);
|
|
2172
|
-
e.apply(this, t.slice(0, -1)).then((e)=>r(null, e), r);
|
|
2176
|
+
else e.apply(this, t.slice(0, -1)).then((e)=>r(null, e), r);
|
|
2173
2177
|
}, "name", {
|
|
2174
2178
|
value: e.name
|
|
2175
2179
|
});
|
|
@@ -240,7 +240,7 @@
|
|
|
240
240
|
return n(t, e);
|
|
241
241
|
} catch (r) {
|
|
242
242
|
if (newError(r)) return c.realpathSync(t, e);
|
|
243
|
-
throw r;
|
|
243
|
+
else throw r;
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
function monkeypatch() {
|
|
@@ -986,7 +986,7 @@
|
|
|
986
986
|
else {
|
|
987
987
|
var o = s.isDirectory() ? "DIR" : "FILE";
|
|
988
988
|
if (i && "FILE" === o) return e();
|
|
989
|
-
return e(null, o, s);
|
|
989
|
+
else return e(null, o, s);
|
|
990
990
|
}
|
|
991
991
|
var c = this;
|
|
992
992
|
var h = m("stat\0" + r, lstatcb_);
|
|
@@ -996,7 +996,7 @@
|
|
|
996
996
|
if (i) c._stat2(t, r, null, a, e);
|
|
997
997
|
else c._stat2(t, r, i, n, e);
|
|
998
998
|
});
|
|
999
|
-
c._stat2(t, r, i, a, e);
|
|
999
|
+
else c._stat2(t, r, i, a, e);
|
|
1000
1000
|
}
|
|
1001
1001
|
};
|
|
1002
1002
|
Glob.prototype._stat2 = function(t, e, r, i, a) {
|
|
@@ -1298,11 +1298,12 @@
|
|
|
1298
1298
|
if (a[t]) {
|
|
1299
1299
|
a[t].push(e);
|
|
1300
1300
|
return null;
|
|
1301
|
+
} else {
|
|
1302
|
+
a[t] = [
|
|
1303
|
+
e
|
|
1304
|
+
];
|
|
1305
|
+
return makeres(t);
|
|
1301
1306
|
}
|
|
1302
|
-
a[t] = [
|
|
1303
|
-
e
|
|
1304
|
-
];
|
|
1305
|
-
return makeres(t);
|
|
1306
1307
|
}
|
|
1307
1308
|
function makeres(t) {
|
|
1308
1309
|
return n(function RES() {
|
|
@@ -1856,13 +1857,14 @@
|
|
|
1856
1857
|
if (this.matchOne(t.slice(u), e.slice(p), r)) {
|
|
1857
1858
|
this.debug("globstar found match!", u, o, v);
|
|
1858
1859
|
return true;
|
|
1860
|
+
} else {
|
|
1861
|
+
if ("." === v || ".." === v || !i.dot && "." === v.charAt(0)) {
|
|
1862
|
+
this.debug("dot detected!", t, u, e, p);
|
|
1863
|
+
break;
|
|
1864
|
+
}
|
|
1865
|
+
this.debug("globstar swallow a segment, and continue");
|
|
1866
|
+
u++;
|
|
1859
1867
|
}
|
|
1860
|
-
if ("." === v || ".." === v || !i.dot && "." === v.charAt(0)) {
|
|
1861
|
-
this.debug("dot detected!", t, u, e, p);
|
|
1862
|
-
break;
|
|
1863
|
-
}
|
|
1864
|
-
this.debug("globstar swallow a segment, and continue");
|
|
1865
|
-
u++;
|
|
1866
1868
|
}
|
|
1867
1869
|
if (r) {
|
|
1868
1870
|
this.debug("\n>>> no match, partial?", t, u, e, p);
|
|
@@ -1881,8 +1883,8 @@
|
|
|
1881
1883
|
if (!d) return false;
|
|
1882
1884
|
}
|
|
1883
1885
|
if (n === o && s === c) return true;
|
|
1884
|
-
if (n === o) return r;
|
|
1885
|
-
if (s === c) return n === o - 1 && "" === t[n];
|
|
1886
|
+
else if (n === o) return r;
|
|
1887
|
+
else if (s === c) return n === o - 1 && "" === t[n];
|
|
1886
1888
|
throw new Error("wtf?");
|
|
1887
1889
|
};
|
|
1888
1890
|
function globUnescape(t) {
|