@modern-js/tailwindcss-generator 3.0.3 → 3.0.4
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/index.js +1336 -1169
- package/package.json +6 -6
package/dist/index.js
CHANGED
@@ -1,9 +1,27 @@
|
|
1
1
|
var __create = Object.create;
|
2
2
|
var __defProp = Object.defineProperty;
|
3
|
+
var __defProps = Object.defineProperties;
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
4
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
5
8
|
var __getProtoOf = Object.getPrototypeOf;
|
6
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
11
|
+
var __pow = Math.pow;
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
13
|
+
var __spreadValues = (a, b) => {
|
14
|
+
for (var prop in b || (b = {}))
|
15
|
+
if (__hasOwnProp.call(b, prop))
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
17
|
+
if (__getOwnPropSymbols)
|
18
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
19
|
+
if (__propIsEnum.call(b, prop))
|
20
|
+
__defNormalProp(a, prop, b[prop]);
|
21
|
+
}
|
22
|
+
return a;
|
23
|
+
};
|
24
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
7
25
|
var __esm = (fn, res) => function __init() {
|
8
26
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
9
27
|
};
|
@@ -27,6 +45,26 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
27
45
|
mod
|
28
46
|
));
|
29
47
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
48
|
+
var __async = (__this, __arguments, generator) => {
|
49
|
+
return new Promise((resolve, reject) => {
|
50
|
+
var fulfilled = (value) => {
|
51
|
+
try {
|
52
|
+
step(generator.next(value));
|
53
|
+
} catch (e) {
|
54
|
+
reject(e);
|
55
|
+
}
|
56
|
+
};
|
57
|
+
var rejected = (value) => {
|
58
|
+
try {
|
59
|
+
step(generator.throw(value));
|
60
|
+
} catch (e) {
|
61
|
+
reject(e);
|
62
|
+
}
|
63
|
+
};
|
64
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
65
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
66
|
+
});
|
67
|
+
};
|
30
68
|
|
31
69
|
// ../../../../node_modules/.pnpm/@modern-js+utils@1.21.5/node_modules/@modern-js/utils/compiled/import-lazy/index.js
|
32
70
|
var require_import_lazy = __commonJS({
|
@@ -468,20 +506,22 @@ var require_fs_extra = __commonJS({
|
|
468
506
|
const o = r2(17);
|
469
507
|
const c = r2(971);
|
470
508
|
const s = r2(95);
|
471
|
-
const a = n(
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
509
|
+
const a = n(function emptyDir(e3) {
|
510
|
+
return __async(this, null, function* () {
|
511
|
+
let t3;
|
512
|
+
try {
|
513
|
+
t3 = yield i.readdir(e3);
|
514
|
+
} catch (e4) {
|
515
|
+
return c.mkdirs(e3);
|
516
|
+
}
|
517
|
+
return Promise.all(t3.map((t4) => s.remove(o.join(e3, t4))));
|
518
|
+
});
|
479
519
|
});
|
480
520
|
function emptyDirSync(e3) {
|
481
521
|
let t3;
|
482
522
|
try {
|
483
523
|
t3 = i.readdirSync(e3);
|
484
|
-
} catch {
|
524
|
+
} catch (e4) {
|
485
525
|
return c.mkdirsSync(e3);
|
486
526
|
}
|
487
527
|
t3.forEach((t4) => {
|
@@ -534,7 +574,7 @@ var require_fs_extra = __commonJS({
|
|
534
574
|
let t3;
|
535
575
|
try {
|
536
576
|
t3 = o.statSync(e3);
|
537
|
-
} catch {
|
577
|
+
} catch (e4) {
|
538
578
|
}
|
539
579
|
if (t3 && t3.isFile())
|
540
580
|
return;
|
@@ -601,7 +641,7 @@ var require_fs_extra = __commonJS({
|
|
601
641
|
let r3;
|
602
642
|
try {
|
603
643
|
r3 = o.lstatSync(t3);
|
604
|
-
} catch {
|
644
|
+
} catch (e4) {
|
605
645
|
}
|
606
646
|
try {
|
607
647
|
const t4 = o.lstatSync(e3);
|
@@ -696,7 +736,7 @@ var require_fs_extra = __commonJS({
|
|
696
736
|
return t3;
|
697
737
|
try {
|
698
738
|
r3 = n.lstatSync(e3);
|
699
|
-
} catch {
|
739
|
+
} catch (e4) {
|
700
740
|
return "file";
|
701
741
|
}
|
702
742
|
return r3 && r3.isDirectory() ? "dir" : "file";
|
@@ -759,7 +799,7 @@ var require_fs_extra = __commonJS({
|
|
759
799
|
let n2;
|
760
800
|
try {
|
761
801
|
n2 = o.lstatSync(t3);
|
762
|
-
} catch {
|
802
|
+
} catch (e4) {
|
763
803
|
}
|
764
804
|
if (n2 && n2.isSymbolicLink()) {
|
765
805
|
const r4 = o.statSync(e3);
|
@@ -834,7 +874,7 @@ var require_fs_extra = __commonJS({
|
|
834
874
|
}
|
835
875
|
}, 81: (e2, t2, r2) => {
|
836
876
|
"use strict";
|
837
|
-
e2.exports = {
|
877
|
+
e2.exports = __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, r2(812)), r2(2)), r2(708)), r2(726)), r2(779)), r2(971)), r2(511)), r2(701)), r2(725)), r2(95));
|
838
878
|
}, 779: (e2, t2, r2) => {
|
839
879
|
"use strict";
|
840
880
|
const n = r2(5).fromPromise;
|
@@ -865,9 +905,11 @@ var require_fs_extra = __commonJS({
|
|
865
905
|
"use strict";
|
866
906
|
const { stringify: n } = r2(208);
|
867
907
|
const { outputFile: i } = r2(701);
|
868
|
-
|
869
|
-
|
870
|
-
|
908
|
+
function outputJson(_0, _1) {
|
909
|
+
return __async(this, arguments, function* (e3, t3, r3 = {}) {
|
910
|
+
const o = n(t3, r3);
|
911
|
+
yield i(e3, o, r3);
|
912
|
+
});
|
871
913
|
}
|
872
914
|
e2.exports = outputJson;
|
873
915
|
}, 971: (e2, t2, r2) => {
|
@@ -884,12 +926,12 @@ var require_fs_extra = __commonJS({
|
|
884
926
|
const t3 = { mode: 511 };
|
885
927
|
if (typeof e3 === "number")
|
886
928
|
return e3;
|
887
|
-
return {
|
929
|
+
return __spreadValues(__spreadValues({}, t3), e3).mode;
|
888
930
|
};
|
889
|
-
e2.exports.makeDir =
|
931
|
+
e2.exports.makeDir = (e3, t3) => __async(exports, null, function* () {
|
890
932
|
i(e3);
|
891
933
|
return n.mkdir(e3, { mode: getMode(t3), recursive: true });
|
892
|
-
};
|
934
|
+
});
|
893
935
|
e2.exports.makeDirSync = (e3, t3) => {
|
894
936
|
i(e3);
|
895
937
|
return n.mkdirSync(e3, { mode: getMode(t3), recursive: true });
|
@@ -1307,7 +1349,7 @@ var require_fs_extra = __commonJS({
|
|
1307
1349
|
try {
|
1308
1350
|
const r4 = t3.rmdirSync(e3, t3);
|
1309
1351
|
return r4;
|
1310
|
-
} catch {
|
1352
|
+
} catch (e4) {
|
1311
1353
|
}
|
1312
1354
|
} while (Date.now() - r3 < 500);
|
1313
1355
|
} else {
|
@@ -2206,26 +2248,28 @@ var require_fs_extra = __commonJS({
|
|
2206
2248
|
}
|
2207
2249
|
const i = r2(5);
|
2208
2250
|
const { stringify: o, stripBom: c } = r2(208);
|
2209
|
-
|
2210
|
-
|
2211
|
-
|
2212
|
-
|
2213
|
-
|
2214
|
-
|
2215
|
-
|
2216
|
-
|
2217
|
-
|
2218
|
-
|
2219
|
-
|
2220
|
-
|
2221
|
-
|
2222
|
-
|
2223
|
-
|
2224
|
-
|
2225
|
-
|
2251
|
+
function _readFile(_0) {
|
2252
|
+
return __async(this, arguments, function* (e3, t3 = {}) {
|
2253
|
+
if (typeof t3 === "string") {
|
2254
|
+
t3 = { encoding: t3 };
|
2255
|
+
}
|
2256
|
+
const r3 = t3.fs || n;
|
2257
|
+
const o2 = "throws" in t3 ? t3.throws : true;
|
2258
|
+
let s2 = yield i.fromCallback(r3.readFile)(e3, t3);
|
2259
|
+
s2 = c(s2);
|
2260
|
+
let a2;
|
2261
|
+
try {
|
2262
|
+
a2 = JSON.parse(s2, t3 ? t3.reviver : null);
|
2263
|
+
} catch (t4) {
|
2264
|
+
if (o2) {
|
2265
|
+
t4.message = `${e3}: ${t4.message}`;
|
2266
|
+
throw t4;
|
2267
|
+
} else {
|
2268
|
+
return null;
|
2269
|
+
}
|
2226
2270
|
}
|
2227
|
-
|
2228
|
-
|
2271
|
+
return a2;
|
2272
|
+
});
|
2229
2273
|
}
|
2230
2274
|
const s = i.fromPromise(_readFile);
|
2231
2275
|
function readFileSync(e3, t3 = {}) {
|
@@ -2247,10 +2291,12 @@ var require_fs_extra = __commonJS({
|
|
2247
2291
|
}
|
2248
2292
|
}
|
2249
2293
|
}
|
2250
|
-
|
2251
|
-
|
2252
|
-
|
2253
|
-
|
2294
|
+
function _writeFile(_0, _1) {
|
2295
|
+
return __async(this, arguments, function* (e3, t3, r3 = {}) {
|
2296
|
+
const c2 = r3.fs || n;
|
2297
|
+
const s2 = o(t3, r3);
|
2298
|
+
yield i.fromCallback(c2.writeFile)(e3, s2, r3);
|
2299
|
+
});
|
2254
2300
|
}
|
2255
2301
|
const a = i.fromPromise(_writeFile);
|
2256
2302
|
function writeFileSync(e3, t3, r3 = {}) {
|
@@ -2478,11 +2524,11 @@ var require_chalk = __commonJS({
|
|
2478
2524
|
} };
|
2479
2525
|
}
|
2480
2526
|
const f = Object.defineProperties(() => {
|
2481
|
-
}, {
|
2527
|
+
}, __spreadProps(__spreadValues({}, u), { level: { enumerable: true, get() {
|
2482
2528
|
return this._generator.level;
|
2483
2529
|
}, set(e3) {
|
2484
2530
|
this._generator.level = e3;
|
2485
|
-
} } });
|
2531
|
+
} } }));
|
2486
2532
|
const createStyler = (e3, t3, n3) => {
|
2487
2533
|
let r2;
|
2488
2534
|
let s2;
|
@@ -2793,7 +2839,7 @@ var require_chalk = __commonJS({
|
|
2793
2839
|
return [o2 * 100, l * 100, c * 100, s2 * 100];
|
2794
2840
|
};
|
2795
2841
|
function comparativeDistance(e3, t3) {
|
2796
|
-
return (e3[0] - t3[0]
|
2842
|
+
return __pow(e3[0] - t3[0], 2) + __pow(e3[1] - t3[1], 2) + __pow(e3[2] - t3[2], 2);
|
2797
2843
|
}
|
2798
2844
|
o.rgb.keyword = function(e3) {
|
2799
2845
|
const t3 = s[e3];
|
@@ -2819,9 +2865,9 @@ var require_chalk = __commonJS({
|
|
2819
2865
|
let t3 = e3[0] / 255;
|
2820
2866
|
let n3 = e3[1] / 255;
|
2821
2867
|
let r2 = e3[2] / 255;
|
2822
|
-
t3 = t3 > 0.04045 ? ((t3 + 0.055) / 1.055
|
2823
|
-
n3 = n3 > 0.04045 ? ((n3 + 0.055) / 1.055
|
2824
|
-
r2 = r2 > 0.04045 ? ((r2 + 0.055) / 1.055
|
2868
|
+
t3 = t3 > 0.04045 ? __pow((t3 + 0.055) / 1.055, 2.4) : t3 / 12.92;
|
2869
|
+
n3 = n3 > 0.04045 ? __pow((n3 + 0.055) / 1.055, 2.4) : n3 / 12.92;
|
2870
|
+
r2 = r2 > 0.04045 ? __pow((r2 + 0.055) / 1.055, 2.4) : r2 / 12.92;
|
2825
2871
|
const s2 = t3 * 0.4124 + n3 * 0.3576 + r2 * 0.1805;
|
2826
2872
|
const o2 = t3 * 0.2126 + n3 * 0.7152 + r2 * 0.0722;
|
2827
2873
|
const l = t3 * 0.0193 + n3 * 0.1192 + r2 * 0.9505;
|
@@ -2835,9 +2881,9 @@ var require_chalk = __commonJS({
|
|
2835
2881
|
n3 /= 95.047;
|
2836
2882
|
r2 /= 100;
|
2837
2883
|
s2 /= 108.883;
|
2838
|
-
n3 = n3 > 8856e-6 ? n3
|
2839
|
-
r2 = r2 > 8856e-6 ? r2
|
2840
|
-
s2 = s2 > 8856e-6 ? s2
|
2884
|
+
n3 = n3 > 8856e-6 ? __pow(n3, 1 / 3) : 7.787 * n3 + 16 / 116;
|
2885
|
+
r2 = r2 > 8856e-6 ? __pow(r2, 1 / 3) : 7.787 * r2 + 16 / 116;
|
2886
|
+
s2 = s2 > 8856e-6 ? __pow(s2, 1 / 3) : 7.787 * s2 + 16 / 116;
|
2841
2887
|
const l = 116 * r2 - 16;
|
2842
2888
|
const c = 500 * (n3 - r2);
|
2843
2889
|
const i = 200 * (r2 - s2);
|
@@ -3011,9 +3057,9 @@ var require_chalk = __commonJS({
|
|
3011
3057
|
s2 = t3 * 3.2406 + n3 * -1.5372 + r2 * -0.4986;
|
3012
3058
|
o2 = t3 * -0.9689 + n3 * 1.8758 + r2 * 0.0415;
|
3013
3059
|
l = t3 * 0.0557 + n3 * -0.204 + r2 * 1.057;
|
3014
|
-
s2 = s2 > 31308e-7 ? 1.055 * s2
|
3015
|
-
o2 = o2 > 31308e-7 ? 1.055 * o2
|
3016
|
-
l = l > 31308e-7 ? 1.055 * l
|
3060
|
+
s2 = s2 > 31308e-7 ? 1.055 * __pow(s2, 1 / 2.4) - 0.055 : s2 * 12.92;
|
3061
|
+
o2 = o2 > 31308e-7 ? 1.055 * __pow(o2, 1 / 2.4) - 0.055 : o2 * 12.92;
|
3062
|
+
l = l > 31308e-7 ? 1.055 * __pow(l, 1 / 2.4) - 0.055 : l * 12.92;
|
3017
3063
|
s2 = Math.min(Math.max(0, s2), 1);
|
3018
3064
|
o2 = Math.min(Math.max(0, o2), 1);
|
3019
3065
|
l = Math.min(Math.max(0, l), 1);
|
@@ -3026,9 +3072,9 @@ var require_chalk = __commonJS({
|
|
3026
3072
|
t3 /= 95.047;
|
3027
3073
|
n3 /= 100;
|
3028
3074
|
r2 /= 108.883;
|
3029
|
-
t3 = t3 > 8856e-6 ? t3
|
3030
|
-
n3 = n3 > 8856e-6 ? n3
|
3031
|
-
r2 = r2 > 8856e-6 ? r2
|
3075
|
+
t3 = t3 > 8856e-6 ? __pow(t3, 1 / 3) : 7.787 * t3 + 16 / 116;
|
3076
|
+
n3 = n3 > 8856e-6 ? __pow(n3, 1 / 3) : 7.787 * n3 + 16 / 116;
|
3077
|
+
r2 = r2 > 8856e-6 ? __pow(r2, 1 / 3) : 7.787 * r2 + 16 / 116;
|
3032
3078
|
const s2 = 116 * n3 - 16;
|
3033
3079
|
const o2 = 500 * (t3 - n3);
|
3034
3080
|
const l = 200 * (n3 - r2);
|
@@ -3044,9 +3090,9 @@ var require_chalk = __commonJS({
|
|
3044
3090
|
o2 = (t3 + 16) / 116;
|
3045
3091
|
s2 = n3 / 500 + o2;
|
3046
3092
|
l = o2 - r2 / 200;
|
3047
|
-
const c = o2
|
3048
|
-
const i = s2
|
3049
|
-
const a = l
|
3093
|
+
const c = __pow(o2, 3);
|
3094
|
+
const i = __pow(s2, 3);
|
3095
|
+
const a = __pow(l, 3);
|
3050
3096
|
o2 = c > 8856e-6 ? c : (o2 - 16 / 116) / 7.787;
|
3051
3097
|
s2 = i > 8856e-6 ? i : (s2 - 16 / 116) / 7.787;
|
3052
3098
|
l = a > 8856e-6 ? a : (l - 16 / 116) / 7.787;
|
@@ -4302,7 +4348,7 @@ var require_ora = __commonJS({
|
|
4302
4348
|
if (typeof e3 === "string") {
|
4303
4349
|
e3 = { text: e3 };
|
4304
4350
|
}
|
4305
|
-
this.options = { text: "", color: "cyan", stream: process.stderr, discardStdin: true,
|
4351
|
+
this.options = __spreadValues({ text: "", color: "cyan", stream: process.stderr, discardStdin: true }, e3);
|
4306
4352
|
this.spinner = this.options.spinner;
|
4307
4353
|
this.color = this.options.color;
|
4308
4354
|
this.hideCursor = this.options.hideCursor !== false;
|
@@ -4519,14 +4565,14 @@ var require_ora = __commonJS({
|
|
4519
4565
|
}
|
4520
4566
|
const r3 = new Ora(t3);
|
4521
4567
|
r3.start();
|
4522
|
-
(
|
4568
|
+
(() => __async(exports, null, function* () {
|
4523
4569
|
try {
|
4524
|
-
|
4570
|
+
yield e3;
|
4525
4571
|
r3.succeed();
|
4526
|
-
} catch {
|
4572
|
+
} catch (e4) {
|
4527
4573
|
r3.fail();
|
4528
4574
|
}
|
4529
|
-
})();
|
4575
|
+
}))();
|
4530
4576
|
return r3;
|
4531
4577
|
};
|
4532
4578
|
}, 959: (e2) => {
|
@@ -12946,7 +12992,7 @@ var require_execa = __commonJS({
|
|
12946
12992
|
const { joinCommand: w, parseCommand: E, getEscapedCommand: I } = n2(192);
|
12947
12993
|
const T = 1e3 * 1e3 * 100;
|
12948
12994
|
const getEnv = ({ env: e3, extendEnv: t3, preferLocal: n3, localDir: r2, execPath: o2 }) => {
|
12949
|
-
const s2 = t3 ? {
|
12995
|
+
const s2 = t3 ? __spreadValues(__spreadValues({}, process.env), e3) : e3;
|
12950
12996
|
if (n3) {
|
12951
12997
|
return a.env({ env: s2, cwd: r2, execPath: o2 });
|
12952
12998
|
}
|
@@ -12957,7 +13003,7 @@ var require_execa = __commonJS({
|
|
12957
13003
|
e3 = o2.command;
|
12958
13004
|
t3 = o2.args;
|
12959
13005
|
n3 = o2.options;
|
12960
|
-
n3 = { maxBuffer: T, buffer: true, stripFinalNewline: true, extendEnv: true, preferLocal: false, localDir: n3.cwd || process.cwd(), execPath: process.execPath, encoding: "utf8", reject: true, cleanup: true, all: false, windowsHide: true,
|
13006
|
+
n3 = __spreadValues({ maxBuffer: T, buffer: true, stripFinalNewline: true, extendEnv: true, preferLocal: false, localDir: n3.cwd || process.cwd(), execPath: process.execPath, encoding: "utf8", reject: true, cleanup: true, all: false, windowsHide: true }, n3);
|
12961
13007
|
n3.env = getEnv(n3);
|
12962
13008
|
n3.stdio = u(n3);
|
12963
13009
|
if (process.platform === "win32" && r.basename(e3, ".exe") === "cmd") {
|
@@ -12993,8 +13039,8 @@ var require_execa = __commonJS({
|
|
12993
13039
|
const T2 = { isCanceled: false };
|
12994
13040
|
a2.kill = l.bind(null, a2.kill.bind(a2));
|
12995
13041
|
a2.cancel = f.bind(null, a2, T2);
|
12996
|
-
const handlePromise =
|
12997
|
-
const [{ error: e4, exitCode: t4, signal: n4, timedOut: o2 }, c2, u3, l2] =
|
13042
|
+
const handlePromise = () => __async(exports, null, function* () {
|
13043
|
+
const [{ error: e4, exitCode: t4, signal: n4, timedOut: o2 }, c2, u3, l2] = yield h(a2, r2.options, E2);
|
12998
13044
|
const f2 = handleOutput(r2.options, c2);
|
12999
13045
|
const p2 = handleOutput(r2.options, u3);
|
13000
13046
|
const m2 = handleOutput(r2.options, l2);
|
@@ -13006,7 +13052,7 @@ var require_execa = __commonJS({
|
|
13006
13052
|
throw c3;
|
13007
13053
|
}
|
13008
13054
|
return { command: s2, escapedCommand: i2, exitCode: 0, stdout: f2, stderr: p2, all: m2, failed: false, timedOut: false, isCanceled: false, killed: false };
|
13009
|
-
};
|
13055
|
+
});
|
13010
13056
|
const C = c(handlePromise);
|
13011
13057
|
x(a2, r2.options.input);
|
13012
13058
|
a2.all = y(a2, r2.options);
|
@@ -13051,7 +13097,7 @@ var require_execa = __commonJS({
|
|
13051
13097
|
const r2 = u.node(n3);
|
13052
13098
|
const o2 = process.execArgv.filter((e4) => !e4.startsWith("--inspect"));
|
13053
13099
|
const { nodePath: s2 = process.execPath, nodeOptions: i2 = o2 } = n3;
|
13054
|
-
return execa(s2, [...i2, e3, ...Array.isArray(t3) ? t3 : []], {
|
13100
|
+
return execa(s2, [...i2, e3, ...Array.isArray(t3) ? t3 : []], __spreadProps(__spreadValues({}, n3), { stdin: void 0, stdout: void 0, stderr: void 0, stdio: r2, shell: false }));
|
13055
13101
|
};
|
13056
13102
|
}, 192: (e2) => {
|
13057
13103
|
"use strict";
|
@@ -13207,7 +13253,7 @@ ${o.message}` : x;
|
|
13207
13253
|
throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${e3}\` (${typeof e3})`);
|
13208
13254
|
}
|
13209
13255
|
};
|
13210
|
-
const setExitHandler =
|
13256
|
+
const setExitHandler = (_0, _1, _2) => __async(exports, [_0, _1, _2], function* (e3, { cleanup: t3, detached: n3 }, r2) {
|
13211
13257
|
if (!t3 || n3) {
|
13212
13258
|
return r2;
|
13213
13259
|
}
|
@@ -13217,17 +13263,17 @@ ${o.message}` : x;
|
|
13217
13263
|
return r2.finally(() => {
|
13218
13264
|
s2();
|
13219
13265
|
});
|
13220
|
-
};
|
13266
|
+
});
|
13221
13267
|
e2.exports = { spawnedKill, spawnedCancel, setupTimeout, validateTimeout, setExitHandler };
|
13222
13268
|
}, 210: (e2) => {
|
13223
13269
|
"use strict";
|
13224
|
-
const t2 = (
|
13225
|
-
})().constructor.prototype;
|
13270
|
+
const t2 = (() => __async(exports, null, function* () {
|
13271
|
+
}))().constructor.prototype;
|
13226
13272
|
const n2 = ["then", "catch", "finally"].map((e3) => [e3, Reflect.getOwnPropertyDescriptor(t2, e3)]);
|
13227
13273
|
const mergePromise = (e3, t3) => {
|
13228
13274
|
for (const [r, o] of n2) {
|
13229
13275
|
const n3 = typeof t3 === "function" ? (...e4) => Reflect.apply(o.value, t3(), e4) : o.value.bind(t3);
|
13230
|
-
Reflect.defineProperty(e3, r, {
|
13276
|
+
Reflect.defineProperty(e3, r, __spreadProps(__spreadValues({}, o), { value: n3 }));
|
13231
13277
|
}
|
13232
13278
|
return e3;
|
13233
13279
|
};
|
@@ -13311,17 +13357,17 @@ ${o.message}` : x;
|
|
13311
13357
|
}
|
13312
13358
|
return n3;
|
13313
13359
|
};
|
13314
|
-
const getBufferedData =
|
13360
|
+
const getBufferedData = (e3, t3) => __async(exports, null, function* () {
|
13315
13361
|
if (!e3) {
|
13316
13362
|
return;
|
13317
13363
|
}
|
13318
13364
|
e3.destroy();
|
13319
13365
|
try {
|
13320
|
-
return
|
13366
|
+
return yield t3;
|
13321
13367
|
} catch (e4) {
|
13322
13368
|
return e4.bufferedData;
|
13323
13369
|
}
|
13324
|
-
};
|
13370
|
+
});
|
13325
13371
|
const getStreamPromise = (e3, { encoding: t3, buffer: n3, maxBuffer: r2 }) => {
|
13326
13372
|
if (!e3 || !n3) {
|
13327
13373
|
return;
|
@@ -13331,16 +13377,16 @@ ${o.message}` : x;
|
|
13331
13377
|
}
|
13332
13378
|
return o.buffer(e3, { maxBuffer: r2 });
|
13333
13379
|
};
|
13334
|
-
const getSpawnedResult =
|
13380
|
+
const getSpawnedResult = (_0, _1, _2) => __async(exports, [_0, _1, _2], function* ({ stdout: e3, stderr: t3, all: n3 }, { encoding: r2, buffer: o2, maxBuffer: s2 }, i) {
|
13335
13381
|
const a = getStreamPromise(e3, { encoding: r2, buffer: o2, maxBuffer: s2 });
|
13336
13382
|
const c = getStreamPromise(t3, { encoding: r2, buffer: o2, maxBuffer: s2 });
|
13337
13383
|
const d = getStreamPromise(n3, { encoding: r2, buffer: o2, maxBuffer: s2 * 2 });
|
13338
13384
|
try {
|
13339
|
-
return
|
13385
|
+
return yield Promise.all([i, a, c, d]);
|
13340
13386
|
} catch (r3) {
|
13341
13387
|
return Promise.all([{ error: r3, signal: r3.signal, timedOut: r3.timedOut }, getBufferedData(e3, a), getBufferedData(t3, c), getBufferedData(n3, d)]);
|
13342
13388
|
}
|
13343
|
-
};
|
13389
|
+
});
|
13344
13390
|
const validateInputSync = ({ input: e3 }) => {
|
13345
13391
|
if (r(e3)) {
|
13346
13392
|
throw new TypeError("The `input` option cannot be a stream in sync mode");
|
@@ -13351,7 +13397,7 @@ ${o.message}` : x;
|
|
13351
13397
|
"use strict";
|
13352
13398
|
const { PassThrough: r } = n2(781);
|
13353
13399
|
e2.exports = (e3) => {
|
13354
|
-
e3 = {
|
13400
|
+
e3 = __spreadValues({}, e3);
|
13355
13401
|
const { array: t3 } = e3;
|
13356
13402
|
let { encoding: n3 } = e3;
|
13357
13403
|
const o = n3 === "buffer";
|
@@ -13400,39 +13446,41 @@ ${o.message}` : x;
|
|
13400
13446
|
this.name = "MaxBufferError";
|
13401
13447
|
}
|
13402
13448
|
}
|
13403
|
-
|
13404
|
-
|
13405
|
-
|
13406
|
-
|
13407
|
-
|
13408
|
-
|
13409
|
-
|
13410
|
-
|
13411
|
-
|
13412
|
-
|
13413
|
-
e4
|
13414
|
-
|
13415
|
-
|
13416
|
-
|
13417
|
-
|
13418
|
-
|
13419
|
-
|
13420
|
-
|
13421
|
-
|
13422
|
-
|
13423
|
-
|
13424
|
-
|
13425
|
-
|
13426
|
-
|
13427
|
-
|
13428
|
-
|
13449
|
+
function getStream(e3, t3) {
|
13450
|
+
return __async(this, null, function* () {
|
13451
|
+
if (!e3) {
|
13452
|
+
throw new Error("Expected a stream");
|
13453
|
+
}
|
13454
|
+
t3 = __spreadValues({ maxBuffer: Infinity }, t3);
|
13455
|
+
const { maxBuffer: n3 } = t3;
|
13456
|
+
const o2 = i(t3);
|
13457
|
+
yield new Promise((t4, s2) => {
|
13458
|
+
const rejectPromise = (e4) => {
|
13459
|
+
if (e4 && o2.getBufferedLength() <= r.MAX_LENGTH) {
|
13460
|
+
e4.bufferedData = o2.getBufferedValue();
|
13461
|
+
}
|
13462
|
+
s2(e4);
|
13463
|
+
};
|
13464
|
+
(() => __async(this, null, function* () {
|
13465
|
+
try {
|
13466
|
+
yield a(e3, o2);
|
13467
|
+
t4();
|
13468
|
+
} catch (e4) {
|
13469
|
+
rejectPromise(e4);
|
13470
|
+
}
|
13471
|
+
}))();
|
13472
|
+
o2.on("data", () => {
|
13473
|
+
if (o2.getBufferedLength() > n3) {
|
13474
|
+
rejectPromise(new MaxBufferError());
|
13475
|
+
}
|
13476
|
+
});
|
13429
13477
|
});
|
13478
|
+
return o2.getBufferedValue();
|
13430
13479
|
});
|
13431
|
-
return o2.getBufferedValue();
|
13432
13480
|
}
|
13433
13481
|
e2.exports = getStream;
|
13434
|
-
e2.exports.buffer = (e3, t3) => getStream(e3, {
|
13435
|
-
e2.exports.array = (e3, t3) => getStream(e3, {
|
13482
|
+
e2.exports.buffer = (e3, t3) => getStream(e3, __spreadProps(__spreadValues({}, t3), { encoding: "buffer" }));
|
13483
|
+
e2.exports.array = (e3, t3) => getStream(e3, __spreadProps(__spreadValues({}, t3), { array: true }));
|
13436
13484
|
e2.exports.MaxBufferError = MaxBufferError;
|
13437
13485
|
}, 221: (e2, t2) => {
|
13438
13486
|
"use strict";
|
@@ -13452,7 +13500,7 @@ ${o.message}` : x;
|
|
13452
13500
|
return e3.reduce(getSignalByName, {});
|
13453
13501
|
};
|
13454
13502
|
const getSignalByName = function(e3, { name: t3, number: n3, description: r2, supported: o2, action: s2, forced: i2, standard: a2 }) {
|
13455
|
-
return {
|
13503
|
+
return __spreadProps(__spreadValues({}, e3), { [t3]: { name: t3, number: n3, description: r2, supported: o2, action: s2, forced: i2, standard: a2 } });
|
13456
13504
|
};
|
13457
13505
|
const i = getSignalsByName();
|
13458
13506
|
t2.signalsByName = i;
|
@@ -13684,7 +13732,7 @@ ${o.message}` : x;
|
|
13684
13732
|
const r = n2(17);
|
13685
13733
|
const o = n2(460);
|
13686
13734
|
const npmRunPath = (e3) => {
|
13687
|
-
e3 = { cwd: process.cwd(), path: process.env[o()], execPath: process.execPath,
|
13735
|
+
e3 = __spreadValues({ cwd: process.cwd(), path: process.env[o()], execPath: process.execPath }, e3);
|
13688
13736
|
let t3;
|
13689
13737
|
let n3 = r.resolve(e3.cwd);
|
13690
13738
|
const s = [];
|
@@ -13700,8 +13748,8 @@ ${o.message}` : x;
|
|
13700
13748
|
e2.exports = npmRunPath;
|
13701
13749
|
e2.exports["default"] = npmRunPath;
|
13702
13750
|
e2.exports.env = (t3) => {
|
13703
|
-
t3 = { env: process.env,
|
13704
|
-
const n3 = {
|
13751
|
+
t3 = __spreadValues({ env: process.env }, t3);
|
13752
|
+
const n3 = __spreadValues({}, t3.env);
|
13705
13753
|
const r2 = o({ env: n3 });
|
13706
13754
|
t3.path = n3[r2];
|
13707
13755
|
n3[r2] = e2.exports(t3);
|
@@ -15098,7 +15146,7 @@ var require_upath = __commonJS({
|
|
15098
15146
|
_.VERSION = typeof n !== "undefined" && n !== null ? n : "NO-VERSION";
|
15099
15147
|
p = function(e3) {
|
15100
15148
|
e3 = e3.replace(/\\/g, "/");
|
15101
|
-
e3 = e3.replace(
|
15149
|
+
e3 = e3.replace(new RegExp("(?<!^)\\/+", "g"), "/");
|
15102
15150
|
return e3;
|
15103
15151
|
};
|
15104
15152
|
for (c in o) {
|
@@ -15394,7 +15442,9 @@ var require_pkg_up = __commonJS({
|
|
15394
15442
|
};
|
15395
15443
|
}, 800: (e2, r2, n2) => {
|
15396
15444
|
const t = n2(485);
|
15397
|
-
e2.exports =
|
15445
|
+
e2.exports = (..._0) => __async(exports, [..._0], function* ({ cwd: e3 } = {}) {
|
15446
|
+
return t("package.json", { cwd: e3 });
|
15447
|
+
});
|
15398
15448
|
e2.exports.sync = ({ cwd: e3 } = {}) => t.sync("package.json", { cwd: e3 });
|
15399
15449
|
}, 147: (e2) => {
|
15400
15450
|
e2.exports = require("fs");
|
@@ -23883,7 +23933,7 @@ var require_fast_glob = __commonJS({
|
|
23883
23933
|
}
|
23884
23934
|
if (t4.nodes && t4.ranges > 0) {
|
23885
23935
|
let r4 = s.reduce(t4.nodes);
|
23886
|
-
let i2 = n(...r4, {
|
23936
|
+
let i2 = n(...r4, __spreadProps(__spreadValues({}, e3), { wrap: false, toRegex: true }));
|
23887
23937
|
if (i2.length !== 0) {
|
23888
23938
|
return r4.length > 1 && i2.length > 1 ? `(${i2})` : i2;
|
23889
23939
|
}
|
@@ -24309,11 +24359,13 @@ var require_fast_glob = __commonJS({
|
|
24309
24359
|
const a = r2(1066);
|
24310
24360
|
const u = r2(7190);
|
24311
24361
|
const c = r2(3828);
|
24312
|
-
|
24313
|
-
|
24314
|
-
|
24315
|
-
|
24316
|
-
|
24362
|
+
function FastGlob(t3, e3) {
|
24363
|
+
return __async(this, null, function* () {
|
24364
|
+
assertPatternsInput(t3);
|
24365
|
+
const r3 = getWorks(t3, i.default, e3);
|
24366
|
+
const n2 = yield Promise.all(r3);
|
24367
|
+
return c.array.flatten(n2);
|
24368
|
+
});
|
24317
24369
|
}
|
24318
24370
|
(function(t3) {
|
24319
24371
|
function sync(t4, e3) {
|
@@ -25484,7 +25536,7 @@ var require_fast_glob = __commonJS({
|
|
25484
25536
|
};
|
25485
25537
|
const toRange = (t3, e3, r3, n2) => {
|
25486
25538
|
if (r3) {
|
25487
|
-
return s(t3, e3, { wrap: false,
|
25539
|
+
return s(t3, e3, __spreadValues({ wrap: false }, n2));
|
25488
25540
|
}
|
25489
25541
|
let i = String.fromCharCode(t3);
|
25490
25542
|
if (t3 === e3)
|
@@ -25550,7 +25602,7 @@ var require_fast_glob = __commonJS({
|
|
25550
25602
|
g++;
|
25551
25603
|
}
|
25552
25604
|
if (n2.toRegex === true) {
|
25553
|
-
return r3 > 1 ? toSequence(d, n2) : toRegex(_, null, { wrap: false,
|
25605
|
+
return r3 > 1 ? toSequence(d, n2) : toRegex(_, null, __spreadValues({ wrap: false }, n2));
|
25554
25606
|
}
|
25555
25607
|
return _;
|
25556
25608
|
};
|
@@ -25592,7 +25644,7 @@ var require_fast_glob = __commonJS({
|
|
25592
25644
|
if (isObject2(r3)) {
|
25593
25645
|
return fill(t3, e3, 0, r3);
|
25594
25646
|
}
|
25595
|
-
let s2 = {
|
25647
|
+
let s2 = __spreadValues({}, n2);
|
25596
25648
|
if (s2.capture === true)
|
25597
25649
|
s2.wrap = true;
|
25598
25650
|
r3 = r3 || s2.step || 1;
|
@@ -25916,7 +25968,7 @@ var require_fast_glob = __commonJS({
|
|
25916
25968
|
}
|
25917
25969
|
};
|
25918
25970
|
for (let o3 = 0; o3 < e3.length; o3++) {
|
25919
|
-
let u2 = i(String(e3[o3]), {
|
25971
|
+
let u2 = i(String(e3[o3]), __spreadProps(__spreadValues({}, r3), { onResult }), true);
|
25920
25972
|
let c2 = u2.state.negated || u2.state.negatedExtglob;
|
25921
25973
|
if (c2)
|
25922
25974
|
a++;
|
@@ -25958,7 +26010,7 @@ var require_fast_glob = __commonJS({
|
|
25958
26010
|
r3.onResult(t4);
|
25959
26011
|
s2.push(t4.output);
|
25960
26012
|
};
|
25961
|
-
let i2 = new Set(micromatch(t3, e3, {
|
26013
|
+
let i2 = new Set(micromatch(t3, e3, __spreadProps(__spreadValues({}, r3), { onResult })));
|
25962
26014
|
for (let t4 of s2) {
|
25963
26015
|
if (!i2.has(t4)) {
|
25964
26016
|
n2.add(t4);
|
@@ -25981,7 +26033,7 @@ var require_fast_glob = __commonJS({
|
|
25981
26033
|
return true;
|
25982
26034
|
}
|
25983
26035
|
}
|
25984
|
-
return micromatch.isMatch(t3, e3, {
|
26036
|
+
return micromatch.isMatch(t3, e3, __spreadProps(__spreadValues({}, r3), { contains: true }));
|
25985
26037
|
};
|
25986
26038
|
micromatch.matchKeys = (t3, e3, r3) => {
|
25987
26039
|
if (!o.isObject(t3)) {
|
@@ -26021,7 +26073,7 @@ var require_fast_glob = __commonJS({
|
|
26021
26073
|
};
|
26022
26074
|
micromatch.capture = (t3, e3, r3) => {
|
26023
26075
|
let n2 = o.isWindows(r3);
|
26024
|
-
let s2 = i.makeRe(String(t3), {
|
26076
|
+
let s2 = i.makeRe(String(t3), __spreadProps(__spreadValues({}, r3), { capture: true }));
|
26025
26077
|
let a = s2.exec(n2 ? o.toPosixSlashes(e3) : e3);
|
26026
26078
|
if (a) {
|
26027
26079
|
return a.slice(1).map((t4) => t4 === void 0 ? "" : t4);
|
@@ -26049,7 +26101,7 @@ var require_fast_glob = __commonJS({
|
|
26049
26101
|
micromatch.braceExpand = (t3, e3) => {
|
26050
26102
|
if (typeof t3 !== "string")
|
26051
26103
|
throw new TypeError("Expected a string");
|
26052
|
-
return micromatch.braces(t3, {
|
26104
|
+
return micromatch.braces(t3, __spreadProps(__spreadValues({}, e3), { expand: true }));
|
26053
26105
|
};
|
26054
26106
|
t2.exports = micromatch;
|
26055
26107
|
}, 376: (t2, e2, r2) => {
|
@@ -26076,7 +26128,7 @@ var require_fast_glob = __commonJS({
|
|
26076
26128
|
const m = `[^.${c}]`;
|
26077
26129
|
const v = `${f}*?`;
|
26078
26130
|
const E = { DOT_LITERAL: o, PLUS_LITERAL: a, QMARK_LITERAL: u, SLASH_LITERAL: c, ONE_CHAR: l, QMARK: f, END_ANCHOR: p, DOTS_SLASH: d, NO_DOT: _, NO_DOTS: g, NO_DOT_SLASH: y, NO_DOTS_SLASH: S, QMARK_NO_DOT: m, STAR: v, START_ANCHOR: h };
|
26079
|
-
const A = {
|
26131
|
+
const A = __spreadProps(__spreadValues({}, E), { SLASH_LITERAL: `[${s}]`, QMARK: i, STAR: `${i}*?`, DOTS_SLASH: `${o}{1,2}(?:[${s}]|$)`, NO_DOT: `(?!${o})`, NO_DOTS: `(?!(?:^|[${s}])${o}{1,2}(?:[${s}]|$))`, NO_DOT_SLASH: `(?!${o}{0,1}(?:[${s}]|$))`, NO_DOTS_SLASH: `(?!${o}{1,2}(?:[${s}]|$))`, QMARK_NO_DOT: `[^.${s}]`, START_ANCHOR: `(?:^|[${s}])`, END_ANCHOR: `(?:[${s}]|$)` });
|
26080
26132
|
const b = { alnum: "a-zA-Z0-9", alpha: "a-zA-Z", ascii: "\\x00-\\x7F", blank: " \\t", cntrl: "\\x00-\\x1F\\x7F", digit: "0-9", graph: "\\x21-\\x7E", lower: "a-z", print: "\\x20-\\x7E ", punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~", space: " \\t\\r\\n\\v\\f", upper: "A-Z", word: "A-Za-z0-9_", xdigit: "A-Fa-f0-9" };
|
26081
26133
|
t2.exports = { MAX_LENGTH: 1024 * 64, POSIX_REGEX_SOURCE: b, REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g, REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/, REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/, REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g, REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g, REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g, REPLACEMENTS: { "***": "*", "**/**": "**", "**/**/**": "**" }, CHAR_0: 48, CHAR_9: 57, CHAR_UPPERCASE_A: 65, CHAR_LOWERCASE_A: 97, CHAR_UPPERCASE_Z: 90, CHAR_LOWERCASE_Z: 122, CHAR_LEFT_PARENTHESES: 40, CHAR_RIGHT_PARENTHESES: 41, CHAR_ASTERISK: 42, CHAR_AMPERSAND: 38, CHAR_AT: 64, CHAR_BACKWARD_SLASH: 92, CHAR_CARRIAGE_RETURN: 13, CHAR_CIRCUMFLEX_ACCENT: 94, CHAR_COLON: 58, CHAR_COMMA: 44, CHAR_DOT: 46, CHAR_DOUBLE_QUOTE: 34, CHAR_EQUAL: 61, CHAR_EXCLAMATION_MARK: 33, CHAR_FORM_FEED: 12, CHAR_FORWARD_SLASH: 47, CHAR_GRAVE_ACCENT: 96, CHAR_HASH: 35, CHAR_HYPHEN_MINUS: 45, CHAR_LEFT_ANGLE_BRACKET: 60, CHAR_LEFT_CURLY_BRACE: 123, CHAR_LEFT_SQUARE_BRACKET: 91, CHAR_LINE_FEED: 10, CHAR_NO_BREAK_SPACE: 160, CHAR_PERCENT: 37, CHAR_PLUS: 43, CHAR_QUESTION_MARK: 63, CHAR_RIGHT_ANGLE_BRACKET: 62, CHAR_RIGHT_CURLY_BRACE: 125, CHAR_RIGHT_SQUARE_BRACKET: 93, CHAR_SEMICOLON: 59, CHAR_SINGLE_QUOTE: 39, CHAR_SPACE: 32, CHAR_TAB: 9, CHAR_UNDERSCORE: 95, CHAR_VERTICAL_LINE: 124, CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, SEP: n.sep, extglobChars(t3) {
|
26082
26134
|
return { "!": { type: "negate", open: "(?:(?!(?:", close: `))${t3.STAR})` }, "?": { type: "qmark", open: "(?:", close: ")?" }, "+": { type: "plus", open: "(?:", close: ")+" }, "*": { type: "star", open: "(?:", close: ")*" }, "@": { type: "at", open: "(?:", close: ")" } };
|
@@ -26107,7 +26159,7 @@ var require_fast_glob = __commonJS({
|
|
26107
26159
|
throw new TypeError("Expected a string");
|
26108
26160
|
}
|
26109
26161
|
t3 = c[t3] || t3;
|
26110
|
-
const r3 = {
|
26162
|
+
const r3 = __spreadValues({}, e3);
|
26111
26163
|
const l = typeof r3.maxLength === "number" ? Math.min(i, r3.maxLength) : i;
|
26112
26164
|
let f = t3.length;
|
26113
26165
|
if (f > l) {
|
@@ -26199,7 +26251,7 @@ var require_fast_glob = __commonJS({
|
|
26199
26251
|
M = t4;
|
26200
26252
|
};
|
26201
26253
|
const extglobOpen = (t4, e4) => {
|
26202
|
-
const n2 = {
|
26254
|
+
const n2 = __spreadProps(__spreadValues({}, y[e4]), { conditions: 1, inner: "" });
|
26203
26255
|
n2.prev = M;
|
26204
26256
|
n2.parens = H.parens;
|
26205
26257
|
n2.output = H.output;
|
@@ -26221,7 +26273,7 @@ var require_fast_glob = __commonJS({
|
|
26221
26273
|
n2 = t4.close = `)$))${i2}`;
|
26222
26274
|
}
|
26223
26275
|
if (t4.inner.includes("*") && (s2 = remaining()) && /^\.[^\\/.]+$/.test(s2)) {
|
26224
|
-
const r4 = parse2(s2, {
|
26276
|
+
const r4 = parse2(s2, __spreadProps(__spreadValues({}, e3), { fastpaths: false })).output;
|
26225
26277
|
n2 = t4.close = `)${r4})${i2})`;
|
26226
26278
|
}
|
26227
26279
|
if (t4.prev.type === "bos") {
|
@@ -26743,7 +26795,7 @@ var require_fast_glob = __commonJS({
|
|
26743
26795
|
return H;
|
26744
26796
|
};
|
26745
26797
|
parse2.fastpaths = (t3, e3) => {
|
26746
|
-
const r3 = {
|
26798
|
+
const r3 = __spreadValues({}, e3);
|
26747
26799
|
const o2 = typeof r3.maxLength === "number" ? Math.min(i, r3.maxLength) : i;
|
26748
26800
|
const a2 = t3.length;
|
26749
26801
|
if (a2 > o2) {
|
@@ -26834,7 +26886,7 @@ var require_fast_glob = __commonJS({
|
|
26834
26886
|
delete a2.state;
|
26835
26887
|
let isIgnored = () => false;
|
26836
26888
|
if (s2.ignore) {
|
26837
|
-
const t4 = {
|
26889
|
+
const t4 = __spreadProps(__spreadValues({}, e3), { ignore: null, onMatch: null, onResult: null });
|
26838
26890
|
isIgnored = picomatch(s2.ignore, t4, r3);
|
26839
26891
|
}
|
26840
26892
|
const matcher = (r4, n3 = false) => {
|
@@ -26896,7 +26948,7 @@ var require_fast_glob = __commonJS({
|
|
26896
26948
|
picomatch.parse = (t3, e3) => {
|
26897
26949
|
if (Array.isArray(t3))
|
26898
26950
|
return t3.map((t4) => picomatch.parse(t4, e3));
|
26899
|
-
return i(t3, {
|
26951
|
+
return i(t3, __spreadProps(__spreadValues({}, e3), { fastpaths: false }));
|
26900
26952
|
};
|
26901
26953
|
picomatch.scan = (t3, e3) => s(t3, e3);
|
26902
26954
|
picomatch.compileRe = (t3, e3, r3 = false, n2 = false) => {
|
@@ -27361,7 +27413,7 @@ var require_fast_glob = __commonJS({
|
|
27361
27413
|
if (n(e3) === false) {
|
27362
27414
|
throw new TypeError("toRegexRange: expected the second argument to be a number.");
|
27363
27415
|
}
|
27364
|
-
let s = { relaxZeros: true,
|
27416
|
+
let s = __spreadValues({ relaxZeros: true }, r3);
|
27365
27417
|
if (typeof s.strictZeros === "boolean") {
|
27366
27418
|
s.relaxZeros = s.strictZeros === false;
|
27367
27419
|
}
|
@@ -27639,19 +27691,19 @@ var require_globby = __commonJS({
|
|
27639
27691
|
}
|
27640
27692
|
return [n.posix.join(t3, "**")];
|
27641
27693
|
};
|
27642
|
-
t2.exports =
|
27643
|
-
e3 = { cwd: process.cwd(),
|
27694
|
+
t2.exports = (t3, e3) => __async(exports, null, function* () {
|
27695
|
+
e3 = __spreadValues({ cwd: process.cwd() }, e3);
|
27644
27696
|
if (typeof e3.cwd !== "string") {
|
27645
27697
|
throw new TypeError(`Expected \`cwd\` to be of type \`string\` but received type \`${typeof e3.cwd}\``);
|
27646
27698
|
}
|
27647
|
-
const r3 =
|
27648
|
-
const r4 =
|
27699
|
+
const r3 = yield Promise.all([].concat(t3).map((t4) => __async(exports, null, function* () {
|
27700
|
+
const r4 = yield s.isDirectory(getPath(t4, e3.cwd));
|
27649
27701
|
return r4 ? getGlob(t4, e3) : t4;
|
27650
|
-
}));
|
27702
|
+
})));
|
27651
27703
|
return [].concat.apply([], r3);
|
27652
|
-
};
|
27704
|
+
});
|
27653
27705
|
t2.exports.sync = (t3, e3) => {
|
27654
|
-
e3 = { cwd: process.cwd(),
|
27706
|
+
e3 = __spreadValues({ cwd: process.cwd() }, e3);
|
27655
27707
|
if (typeof e3.cwd !== "string") {
|
27656
27708
|
throw new TypeError(`Expected \`cwd\` to be of type \`string\` but received type \`${typeof e3.cwd}\``);
|
27657
27709
|
}
|
@@ -27696,24 +27748,24 @@ var require_globby = __commonJS({
|
|
27696
27748
|
return o.join(t3, e3);
|
27697
27749
|
};
|
27698
27750
|
const getIsIgnoredPredecate = (t3, e3) => (r3) => t3.ignores(a(o.relative(e3, ensureAbsolutePathForCwd(e3, r3.path || r3))));
|
27699
|
-
const getFile =
|
27751
|
+
const getFile = (t3, e3) => __async(exports, null, function* () {
|
27700
27752
|
const r3 = o.join(e3, t3);
|
27701
|
-
const n2 =
|
27753
|
+
const n2 = yield u(r3, "utf8");
|
27702
27754
|
return { cwd: e3, filePath: r3, content: n2 };
|
27703
|
-
};
|
27755
|
+
});
|
27704
27756
|
const getFileSync = (t3, e3) => {
|
27705
27757
|
const r3 = o.join(e3, t3);
|
27706
27758
|
const n2 = s.readFileSync(r3, "utf8");
|
27707
27759
|
return { cwd: e3, filePath: r3, content: n2 };
|
27708
27760
|
};
|
27709
27761
|
const normalizeOptions = ({ ignore: t3 = [], cwd: e3 = a(process.cwd()) } = {}) => ({ ignore: t3, cwd: e3 });
|
27710
|
-
t2.exports =
|
27762
|
+
t2.exports = (t3) => __async(exports, null, function* () {
|
27711
27763
|
t3 = normalizeOptions(t3);
|
27712
|
-
const e3 =
|
27713
|
-
const r3 =
|
27764
|
+
const e3 = yield i("**/.gitignore", { ignore: p.concat(t3.ignore), cwd: t3.cwd });
|
27765
|
+
const r3 = yield Promise.all(e3.map((e4) => getFile(e4, t3.cwd)));
|
27714
27766
|
const n2 = reduceIgnore(r3);
|
27715
27767
|
return getIsIgnoredPredecate(n2, t3.cwd);
|
27716
|
-
};
|
27768
|
+
});
|
27717
27769
|
t2.exports.sync = (t3) => {
|
27718
27770
|
t3 = normalizeOptions(t3);
|
27719
27771
|
const e3 = i.sync("**/.gitignore", { ignore: p.concat(t3.ignore), cwd: t3.cwd });
|
@@ -27744,7 +27796,7 @@ var require_globby = __commonJS({
|
|
27744
27796
|
let e3;
|
27745
27797
|
try {
|
27746
27798
|
e3 = n.statSync(t3.cwd);
|
27747
|
-
} catch {
|
27799
|
+
} catch (e4) {
|
27748
27800
|
return;
|
27749
27801
|
}
|
27750
27802
|
if (!e3.isDirectory()) {
|
@@ -27757,13 +27809,13 @@ var require_globby = __commonJS({
|
|
27757
27809
|
assertPatternsInput(t3);
|
27758
27810
|
checkCwdOption(e3);
|
27759
27811
|
const r3 = [];
|
27760
|
-
e3 = { ignore: [], expandDirectories: true,
|
27812
|
+
e3 = __spreadValues({ ignore: [], expandDirectories: true }, e3);
|
27761
27813
|
for (const [n2, s2] of t3.entries()) {
|
27762
27814
|
if (isNegative(s2)) {
|
27763
27815
|
continue;
|
27764
27816
|
}
|
27765
27817
|
const o2 = t3.slice(n2).filter((t4) => isNegative(t4)).map((t4) => t4.slice(1));
|
27766
|
-
const i2 = {
|
27818
|
+
const i2 = __spreadProps(__spreadValues({}, e3), { ignore: e3.ignore.concat(o2) });
|
27767
27819
|
r3.push({ pattern: s2, options: i2 });
|
27768
27820
|
}
|
27769
27821
|
return r3;
|
@@ -27774,9 +27826,9 @@ var require_globby = __commonJS({
|
|
27774
27826
|
r3.cwd = t3.options.cwd;
|
27775
27827
|
}
|
27776
27828
|
if (Array.isArray(t3.options.expandDirectories)) {
|
27777
|
-
r3 = {
|
27829
|
+
r3 = __spreadProps(__spreadValues({}, r3), { files: t3.options.expandDirectories });
|
27778
27830
|
} else if (typeof t3.options.expandDirectories === "object") {
|
27779
|
-
r3 = {
|
27831
|
+
r3 = __spreadValues(__spreadValues({}, r3), t3.options.expandDirectories);
|
27780
27832
|
}
|
27781
27833
|
return e3(t3.pattern, r3);
|
27782
27834
|
};
|
@@ -27789,20 +27841,22 @@ var require_globby = __commonJS({
|
|
27789
27841
|
}
|
27790
27842
|
return { pattern: e3, options: r3 };
|
27791
27843
|
};
|
27792
|
-
t2.exports =
|
27844
|
+
t2.exports = (t3, e3) => __async(exports, null, function* () {
|
27793
27845
|
const r3 = generateGlobTasks(t3, e3);
|
27794
|
-
const getFilter =
|
27795
|
-
|
27796
|
-
|
27797
|
-
|
27846
|
+
const getFilter = () => __async(exports, null, function* () {
|
27847
|
+
return e3 && e3.gitignore ? a({ cwd: e3.cwd, ignore: e3.ignore }) : DEFAULT_FILTER;
|
27848
|
+
});
|
27849
|
+
const getTasks = () => __async(exports, null, function* () {
|
27850
|
+
const t4 = yield Promise.all(r3.map((t5) => __async(exports, null, function* () {
|
27851
|
+
const e4 = yield getPattern(t5, c);
|
27798
27852
|
return Promise.all(e4.map(globToTask(t5)));
|
27799
|
-
}));
|
27853
|
+
})));
|
27800
27854
|
return s(...t4);
|
27801
|
-
};
|
27802
|
-
const [n2, o2] =
|
27803
|
-
const p2 =
|
27855
|
+
});
|
27856
|
+
const [n2, o2] = yield Promise.all([getFilter(), getTasks()]);
|
27857
|
+
const p2 = yield Promise.all(o2.map((t4) => i(t4.pattern, t4.options)));
|
27804
27858
|
return s(...p2).filter((t4) => !n2(getPathString(t4)));
|
27805
|
-
};
|
27859
|
+
});
|
27806
27860
|
t2.exports.sync = (t3, e3) => {
|
27807
27861
|
const r3 = generateGlobTasks(t3, e3);
|
27808
27862
|
const n2 = [];
|
@@ -28156,19 +28210,21 @@ var require_globby = __commonJS({
|
|
28156
28210
|
"use strict";
|
28157
28211
|
const { promisify: n } = r2(837);
|
28158
28212
|
const s = r2(147);
|
28159
|
-
|
28160
|
-
|
28161
|
-
|
28162
|
-
|
28163
|
-
try {
|
28164
|
-
const o = await n(s[t3])(r3);
|
28165
|
-
return o[e3]();
|
28166
|
-
} catch (t4) {
|
28167
|
-
if (t4.code === "ENOENT") {
|
28168
|
-
return false;
|
28213
|
+
function isType4(t3, e3, r3) {
|
28214
|
+
return __async(this, null, function* () {
|
28215
|
+
if (typeof r3 !== "string") {
|
28216
|
+
throw new TypeError(`Expected a string, got ${typeof r3}`);
|
28169
28217
|
}
|
28170
|
-
|
28171
|
-
|
28218
|
+
try {
|
28219
|
+
const o = yield n(s[t3])(r3);
|
28220
|
+
return o[e3]();
|
28221
|
+
} catch (t4) {
|
28222
|
+
if (t4.code === "ENOENT") {
|
28223
|
+
return false;
|
28224
|
+
}
|
28225
|
+
throw t4;
|
28226
|
+
}
|
28227
|
+
});
|
28172
28228
|
}
|
28173
28229
|
function isTypeSync(t3, e3, r3) {
|
28174
28230
|
if (typeof r3 !== "string") {
|
@@ -30543,15 +30599,15 @@ var require_gzip_size = __commonJS({
|
|
30543
30599
|
const i = t2(796);
|
30544
30600
|
const { promisify: a } = t2(837);
|
30545
30601
|
const s = t2(325);
|
30546
|
-
const getOptions = (e3) => ({ level: 9,
|
30602
|
+
const getOptions = (e3) => __spreadValues({ level: 9 }, e3);
|
30547
30603
|
const p = a(i.gzip);
|
30548
|
-
e2.exports =
|
30604
|
+
e2.exports = (e3, r3) => __async(exports, null, function* () {
|
30549
30605
|
if (!e3) {
|
30550
30606
|
return 0;
|
30551
30607
|
}
|
30552
|
-
const t3 =
|
30608
|
+
const t3 = yield p(e3, getOptions(r3));
|
30553
30609
|
return t3.length;
|
30554
|
-
};
|
30610
|
+
});
|
30555
30611
|
e2.exports.sync = (e3, r3) => i.gzipSync(e3, getOptions(r3)).length;
|
30556
30612
|
e2.exports.stream = (e3) => {
|
30557
30613
|
const r3 = new o.PassThrough();
|
@@ -33495,10 +33551,12 @@ Expecting one of '${i3.join("', '")}'`);
|
|
33495
33551
|
this._parseCommand([], i3);
|
33496
33552
|
return this;
|
33497
33553
|
}
|
33498
|
-
|
33499
|
-
|
33500
|
-
|
33501
|
-
|
33554
|
+
parseAsync(e3, t3) {
|
33555
|
+
return __async(this, null, function* () {
|
33556
|
+
const i3 = this._prepareUserArgs(e3, t3);
|
33557
|
+
yield this._parseCommand([], i3);
|
33558
|
+
return this;
|
33559
|
+
});
|
33502
33560
|
}
|
33503
33561
|
_executeSubCommand(e3, t3) {
|
33504
33562
|
t3 = t3.slice();
|
@@ -34770,11 +34828,8 @@ var require_logger = __commonJS({
|
|
34770
34828
|
var Logger = class {
|
34771
34829
|
constructor(options = {}) {
|
34772
34830
|
this.level = options.level || LOG_TYPES.log.level;
|
34773
|
-
this.config = {
|
34774
|
-
this.types = {
|
34775
|
-
...LOG_TYPES,
|
34776
|
-
...options.types || {}
|
34777
|
-
};
|
34831
|
+
this.config = __spreadValues(__spreadValues({}, DEFAULT_CONFIG), options.config || {});
|
34832
|
+
this.types = __spreadValues(__spreadValues({}, LOG_TYPES), options.types || {});
|
34778
34833
|
this.longestLabel = this.getLongestLabel();
|
34779
34834
|
Object.keys(this.types).forEach((type) => {
|
34780
34835
|
this[type] = this._log.bind(this, type);
|
@@ -35529,7 +35584,7 @@ var require_getEntryOptions = __commonJS({
|
|
35529
35584
|
if (optionsByEntry === void 0 && name === constants_1.MAIN_ENTRY_NAME && packageName) {
|
35530
35585
|
optionsByEntry = getOptionsByEntryName(packageName, optionsByEntries);
|
35531
35586
|
}
|
35532
|
-
return optionsByEntry !== void 0 ? (0, is_1.isPlainObject)(optionsByEntry) && (0, is_1.isPlainObject)(baseOptions) ? {
|
35587
|
+
return optionsByEntry !== void 0 ? (0, is_1.isPlainObject)(optionsByEntry) && (0, is_1.isPlainObject)(baseOptions) ? __spreadValues(__spreadValues({}, baseOptions), optionsByEntry) : optionsByEntry : baseOptions;
|
35533
35588
|
} else {
|
35534
35589
|
return baseOptions;
|
35535
35590
|
}
|
@@ -35551,7 +35606,7 @@ var require_getPort = __commonJS({
|
|
35551
35606
|
var net_1 = __importDefault(require("net"));
|
35552
35607
|
var compiled_1 = require_compiled();
|
35553
35608
|
var logger_1 = require_logger();
|
35554
|
-
var getPort =
|
35609
|
+
var getPort = (_0, ..._1) => __async(exports, [_0, ..._1], function* (port, { tryLimits = 20, strictPort = false } = {}) {
|
35555
35610
|
if (typeof port === "string") {
|
35556
35611
|
port = parseInt(port, 10);
|
35557
35612
|
}
|
@@ -35563,7 +35618,7 @@ var require_getPort = __commonJS({
|
|
35563
35618
|
let attempts = 0;
|
35564
35619
|
while (!found && attempts <= tryLimits) {
|
35565
35620
|
try {
|
35566
|
-
|
35621
|
+
yield new Promise((resolve, reject) => {
|
35567
35622
|
const server = net_1.default.createServer();
|
35568
35623
|
server.unref();
|
35569
35624
|
server.on("error", reject);
|
@@ -35591,7 +35646,7 @@ var require_getPort = __commonJS({
|
|
35591
35646
|
}
|
35592
35647
|
}
|
35593
35648
|
return port;
|
35594
|
-
};
|
35649
|
+
});
|
35595
35650
|
exports.getPort = getPort;
|
35596
35651
|
}
|
35597
35652
|
});
|
@@ -35636,10 +35691,7 @@ var require_monorepo = __commonJS({
|
|
35636
35691
|
return false;
|
35637
35692
|
}
|
35638
35693
|
const json = JSON.parse(fs_1.default.readFileSync(pkgJsonPath, "utf8"));
|
35639
|
-
const deps = {
|
35640
|
-
...json.dependencies || {},
|
35641
|
-
...json.devDependencies || {}
|
35642
|
-
};
|
35694
|
+
const deps = __spreadValues(__spreadValues({}, json.dependencies || {}), json.devDependencies || {});
|
35643
35695
|
return Boolean(deps["@modern-js/monorepo-tools"]);
|
35644
35696
|
};
|
35645
35697
|
exports.isModernjsMonorepo = isModernjsMonorepo;
|
@@ -35687,31 +35739,37 @@ var require_nodeEnv = __commonJS({
|
|
35687
35739
|
Object.defineProperty(exports, "__esModule", { value: true });
|
35688
35740
|
exports.canUsePnpm = exports.canUseYarn = exports.canUseNpm = void 0;
|
35689
35741
|
var compiled_1 = require_compiled();
|
35690
|
-
|
35691
|
-
|
35692
|
-
|
35693
|
-
|
35694
|
-
|
35695
|
-
|
35696
|
-
|
35742
|
+
function canUseNpm() {
|
35743
|
+
return __async(this, null, function* () {
|
35744
|
+
try {
|
35745
|
+
yield (0, compiled_1.execa)("npm", ["--version"], { env: process.env });
|
35746
|
+
return true;
|
35747
|
+
} catch (e) {
|
35748
|
+
return false;
|
35749
|
+
}
|
35750
|
+
});
|
35697
35751
|
}
|
35698
35752
|
exports.canUseNpm = canUseNpm;
|
35699
|
-
|
35700
|
-
|
35701
|
-
|
35702
|
-
|
35703
|
-
|
35704
|
-
|
35705
|
-
|
35753
|
+
function canUseYarn() {
|
35754
|
+
return __async(this, null, function* () {
|
35755
|
+
try {
|
35756
|
+
yield (0, compiled_1.execa)("yarn", ["--version"], { env: process.env });
|
35757
|
+
return true;
|
35758
|
+
} catch (e) {
|
35759
|
+
return false;
|
35760
|
+
}
|
35761
|
+
});
|
35706
35762
|
}
|
35707
35763
|
exports.canUseYarn = canUseYarn;
|
35708
|
-
|
35709
|
-
|
35710
|
-
|
35711
|
-
|
35712
|
-
|
35713
|
-
|
35714
|
-
|
35764
|
+
function canUsePnpm() {
|
35765
|
+
return __async(this, null, function* () {
|
35766
|
+
try {
|
35767
|
+
yield (0, compiled_1.execa)("pnpm", ["--version"], { env: process.env });
|
35768
|
+
return true;
|
35769
|
+
} catch (e) {
|
35770
|
+
return false;
|
35771
|
+
}
|
35772
|
+
});
|
35715
35773
|
}
|
35716
35774
|
exports.canUsePnpm = canUsePnpm;
|
35717
35775
|
}
|
@@ -35731,29 +35789,31 @@ var require_getPackageManager = __commonJS({
|
|
35731
35789
|
var compiled_1 = require_compiled();
|
35732
35790
|
var nodeEnv_1 = require_nodeEnv();
|
35733
35791
|
var MAX_TIMES = 5;
|
35734
|
-
|
35735
|
-
|
35736
|
-
|
35737
|
-
|
35738
|
-
times
|
35739
|
-
|
35792
|
+
function getPackageManager() {
|
35793
|
+
return __async(this, arguments, function* (cwd = process.cwd()) {
|
35794
|
+
let appDirectory = cwd;
|
35795
|
+
let times = 0;
|
35796
|
+
while (os_1.default.homedir() !== appDirectory && times < MAX_TIMES) {
|
35797
|
+
times++;
|
35798
|
+
if (compiled_1.fs.existsSync(path_1.default.resolve(appDirectory, "pnpm-lock.yaml"))) {
|
35799
|
+
return "pnpm";
|
35800
|
+
}
|
35801
|
+
if (compiled_1.fs.existsSync(path_1.default.resolve(appDirectory, "yarn.lock"))) {
|
35802
|
+
return "yarn";
|
35803
|
+
}
|
35804
|
+
if (compiled_1.fs.existsSync(path_1.default.resolve(appDirectory, "package-lock.json"))) {
|
35805
|
+
return "npm";
|
35806
|
+
}
|
35807
|
+
appDirectory = path_1.default.join(appDirectory, "..");
|
35808
|
+
}
|
35809
|
+
if (yield (0, nodeEnv_1.canUsePnpm)()) {
|
35740
35810
|
return "pnpm";
|
35741
35811
|
}
|
35742
|
-
if (
|
35812
|
+
if (yield (0, nodeEnv_1.canUseYarn)()) {
|
35743
35813
|
return "yarn";
|
35744
35814
|
}
|
35745
|
-
|
35746
|
-
|
35747
|
-
}
|
35748
|
-
appDirectory = path_1.default.join(appDirectory, "..");
|
35749
|
-
}
|
35750
|
-
if (await (0, nodeEnv_1.canUsePnpm)()) {
|
35751
|
-
return "pnpm";
|
35752
|
-
}
|
35753
|
-
if (await (0, nodeEnv_1.canUseYarn)()) {
|
35754
|
-
return "yarn";
|
35755
|
-
}
|
35756
|
-
return "npm";
|
35815
|
+
return "npm";
|
35816
|
+
});
|
35757
35817
|
}
|
35758
35818
|
exports.getPackageManager = getPackageManager;
|
35759
35819
|
}
|
@@ -35826,7 +35886,7 @@ var require_runtimeExports = __commonJS({
|
|
35826
35886
|
compiled_1.fs.appendFileSync(entryExportFile, `${statement}
|
35827
35887
|
`);
|
35828
35888
|
}
|
35829
|
-
} catch {
|
35889
|
+
} catch (e) {
|
35830
35890
|
}
|
35831
35891
|
};
|
35832
35892
|
const getPath = () => entryExportFile;
|
@@ -36023,10 +36083,7 @@ var require_alias = __commonJS({
|
|
36023
36083
|
const baseUrl = (_a2 = tsconfig === null || tsconfig === void 0 ? void 0 : tsconfig.compilerOptions) === null || _a2 === void 0 ? void 0 : _a2.baseUrl;
|
36024
36084
|
aliasConfig = {
|
36025
36085
|
absoluteBaseUrl: baseUrl ? path_1.default.join(option.appDirectory, baseUrl) : option.appDirectory,
|
36026
|
-
paths: {
|
36027
|
-
...aliasOption || {},
|
36028
|
-
...(_b = tsconfig === null || tsconfig === void 0 ? void 0 : tsconfig.compilerOptions) === null || _b === void 0 ? void 0 : _b.paths
|
36029
|
-
},
|
36086
|
+
paths: __spreadValues(__spreadValues({}, aliasOption || {}), (_b = tsconfig === null || tsconfig === void 0 ? void 0 : tsconfig.compilerOptions) === null || _b === void 0 ? void 0 : _b.paths),
|
36030
36087
|
isTsPath: true,
|
36031
36088
|
isTsProject
|
36032
36089
|
};
|
@@ -36095,20 +36152,20 @@ var require_watch = __commonJS({
|
|
36095
36152
|
ignored
|
36096
36153
|
});
|
36097
36154
|
watcher.on("ready", () => ready = true);
|
36098
|
-
watcher.on("change",
|
36155
|
+
watcher.on("change", (filePath) => __async(exports, null, function* () {
|
36099
36156
|
const changedFilePath = path2.resolve(filePath);
|
36100
|
-
|
36101
|
-
});
|
36102
|
-
watcher.on("add",
|
36157
|
+
yield runTask({ changedFilePath, changeType: exports.WatchChangeType.CHANGE });
|
36158
|
+
}));
|
36159
|
+
watcher.on("add", (filePath) => __async(exports, null, function* () {
|
36103
36160
|
const changedFilePath = path2.resolve(filePath);
|
36104
36161
|
if (ready) {
|
36105
|
-
|
36162
|
+
yield runTask({ changedFilePath, changeType: exports.WatchChangeType.ADD });
|
36106
36163
|
}
|
36107
|
-
});
|
36108
|
-
watcher.on("unlink",
|
36164
|
+
}));
|
36165
|
+
watcher.on("unlink", (filePath) => __async(exports, null, function* () {
|
36109
36166
|
const changedFilePath = path2.resolve(filePath);
|
36110
|
-
|
36111
|
-
});
|
36167
|
+
yield runTask({ changedFilePath, changeType: exports.WatchChangeType.UNLINK });
|
36168
|
+
}));
|
36112
36169
|
watcher.on("error", (err) => {
|
36113
36170
|
throw err;
|
36114
36171
|
});
|
@@ -36138,11 +36195,11 @@ var require_emptyDir = __commonJS({
|
|
36138
36195
|
Object.defineProperty(exports, "__esModule", { value: true });
|
36139
36196
|
exports.emptyDir = void 0;
|
36140
36197
|
var compiled_1 = require_compiled();
|
36141
|
-
var emptyDir =
|
36142
|
-
if (
|
36143
|
-
|
36198
|
+
var emptyDir = (dir) => __async(exports, null, function* () {
|
36199
|
+
if (yield compiled_1.fs.pathExists(dir)) {
|
36200
|
+
yield compiled_1.fs.emptyDir(dir);
|
36144
36201
|
}
|
36145
|
-
};
|
36202
|
+
});
|
36146
36203
|
exports.emptyDir = emptyDir;
|
36147
36204
|
}
|
36148
36205
|
});
|
@@ -36188,10 +36245,10 @@ var require_getServerConfig = __commonJS({
|
|
36188
36245
|
var path2 = __importStar(require("path"));
|
36189
36246
|
var constants_1 = require_constants();
|
36190
36247
|
var findExists_1 = require_findExists();
|
36191
|
-
var getServerConfig =
|
36248
|
+
var getServerConfig = (appDirectory, configFile) => __async(exports, null, function* () {
|
36192
36249
|
const configFilePath = (0, findExists_1.findExists)(constants_1.CONFIG_FILE_EXTENSIONS.map((extension) => path2.resolve(appDirectory, `${configFile}${extension}`)));
|
36193
36250
|
return configFilePath;
|
36194
|
-
};
|
36251
|
+
});
|
36195
36252
|
exports.getServerConfig = getServerConfig;
|
36196
36253
|
}
|
36197
36254
|
});
|
@@ -36361,12 +36418,12 @@ var require_analyzeProject = __commonJS({
|
|
36361
36418
|
exports.isApiOnly = void 0;
|
36362
36419
|
var path2 = __importStar(require("path"));
|
36363
36420
|
var compiled_1 = require_compiled();
|
36364
|
-
var isApiOnly =
|
36421
|
+
var isApiOnly = (appDirectory, entryDir) => __async(exports, null, function* () {
|
36365
36422
|
const srcDir = path2.join(appDirectory, entryDir !== null && entryDir !== void 0 ? entryDir : "src");
|
36366
|
-
const existSrc =
|
36423
|
+
const existSrc = yield compiled_1.fs.pathExists(srcDir);
|
36367
36424
|
const options = (0, compiled_1.minimist)(process.argv.slice(2));
|
36368
36425
|
return !existSrc || Boolean(options["api-only"]);
|
36369
|
-
};
|
36426
|
+
});
|
36370
36427
|
exports.isApiOnly = isApiOnly;
|
36371
36428
|
}
|
36372
36429
|
});
|
@@ -36485,9 +36542,11 @@ var require_version = __commonJS({
|
|
36485
36542
|
exports.isReact18 = exports.getPnpmVersion = void 0;
|
36486
36543
|
var path_1 = __importDefault(require("path"));
|
36487
36544
|
var compiled_1 = require_compiled();
|
36488
|
-
|
36489
|
-
|
36490
|
-
|
36545
|
+
function getPnpmVersion() {
|
36546
|
+
return __async(this, null, function* () {
|
36547
|
+
const { stdout } = yield (0, compiled_1.execa)("pnpm", ["--version"]);
|
36548
|
+
return stdout;
|
36549
|
+
});
|
36491
36550
|
}
|
36492
36551
|
exports.getPnpmVersion = getPnpmVersion;
|
36493
36552
|
var isReact18 = (cwd) => {
|
@@ -36496,10 +36555,7 @@ var require_version = __commonJS({
|
|
36496
36555
|
return false;
|
36497
36556
|
}
|
36498
36557
|
const pkgInfo = JSON.parse(compiled_1.fs.readFileSync(pkgPath, "utf8"));
|
36499
|
-
const deps = {
|
36500
|
-
...pkgInfo.devDependencies,
|
36501
|
-
...pkgInfo.dependencies
|
36502
|
-
};
|
36558
|
+
const deps = __spreadValues(__spreadValues({}, pkgInfo.devDependencies), pkgInfo.dependencies);
|
36503
36559
|
if (typeof deps.react !== "string") {
|
36504
36560
|
return false;
|
36505
36561
|
}
|
@@ -43909,10 +43965,9 @@ var require_parse = __commonJS({
|
|
43909
43965
|
var parse_comments = (prefix) => {
|
43910
43966
|
const comments = [];
|
43911
43967
|
while (current && (is("LineComment") || is("BlockComment"))) {
|
43912
|
-
const comment = {
|
43913
|
-
...current,
|
43968
|
+
const comment = __spreadProps(__spreadValues({}, current), {
|
43914
43969
|
inline
|
43915
|
-
};
|
43970
|
+
});
|
43916
43971
|
comments.push(comment);
|
43917
43972
|
next();
|
43918
43973
|
}
|
@@ -44345,46 +44400,54 @@ var require_env = __commonJS({
|
|
44345
44400
|
exports.canUsePnpm = canUsePnpm;
|
44346
44401
|
exports.canUseYarn = canUseYarn;
|
44347
44402
|
var _utils = require_dist();
|
44348
|
-
|
44349
|
-
|
44350
|
-
|
44351
|
-
|
44352
|
-
|
44353
|
-
|
44354
|
-
|
44355
|
-
|
44356
|
-
|
44357
|
-
|
44403
|
+
function canUseNvm() {
|
44404
|
+
return __async(this, null, function* () {
|
44405
|
+
try {
|
44406
|
+
yield (0, _utils.execa)("source ~/.nvm/nvm.sh", {
|
44407
|
+
env: process.env,
|
44408
|
+
shell: true
|
44409
|
+
});
|
44410
|
+
return true;
|
44411
|
+
} catch (e) {
|
44412
|
+
return false;
|
44413
|
+
}
|
44414
|
+
});
|
44358
44415
|
}
|
44359
|
-
|
44360
|
-
|
44361
|
-
|
44362
|
-
|
44363
|
-
|
44364
|
-
|
44365
|
-
|
44366
|
-
|
44367
|
-
|
44416
|
+
function canUseNpm() {
|
44417
|
+
return __async(this, null, function* () {
|
44418
|
+
try {
|
44419
|
+
yield (0, _utils.execa)("npm", ["--version"], {
|
44420
|
+
env: process.env
|
44421
|
+
});
|
44422
|
+
return true;
|
44423
|
+
} catch (e) {
|
44424
|
+
return false;
|
44425
|
+
}
|
44426
|
+
});
|
44368
44427
|
}
|
44369
|
-
|
44370
|
-
|
44371
|
-
|
44372
|
-
|
44373
|
-
|
44374
|
-
|
44375
|
-
|
44376
|
-
|
44377
|
-
|
44428
|
+
function canUseYarn() {
|
44429
|
+
return __async(this, null, function* () {
|
44430
|
+
try {
|
44431
|
+
yield (0, _utils.execa)("yarn", ["--version"], {
|
44432
|
+
env: process.env
|
44433
|
+
});
|
44434
|
+
return true;
|
44435
|
+
} catch (e) {
|
44436
|
+
return false;
|
44437
|
+
}
|
44438
|
+
});
|
44378
44439
|
}
|
44379
|
-
|
44380
|
-
|
44381
|
-
|
44382
|
-
|
44383
|
-
|
44384
|
-
|
44385
|
-
|
44386
|
-
|
44387
|
-
|
44440
|
+
function canUsePnpm() {
|
44441
|
+
return __async(this, null, function* () {
|
44442
|
+
try {
|
44443
|
+
yield (0, _utils.execa)("pnpm", ["--version"], {
|
44444
|
+
env: process.env
|
44445
|
+
});
|
44446
|
+
return true;
|
44447
|
+
} catch (e) {
|
44448
|
+
return false;
|
44449
|
+
}
|
44450
|
+
});
|
44388
44451
|
}
|
44389
44452
|
}
|
44390
44453
|
});
|
@@ -44440,97 +44503,105 @@ var require_install = __commonJS({
|
|
44440
44503
|
}));
|
44441
44504
|
return promise;
|
44442
44505
|
}
|
44443
|
-
|
44444
|
-
|
44445
|
-
|
44446
|
-
|
44447
|
-
|
44448
|
-
|
44449
|
-
|
44506
|
+
function runInstallWithNvm(command, options) {
|
44507
|
+
return __async(this, null, function* () {
|
44508
|
+
yield (0, _utils.execa)(`~/.nvm/nvm-exec ${command}`, _objectSpread(_objectSpread({}, options), {}, {
|
44509
|
+
shell: true,
|
44510
|
+
stdin: "inherit",
|
44511
|
+
stdout: "inherit",
|
44512
|
+
stderr: "inherit"
|
44513
|
+
}));
|
44514
|
+
});
|
44450
44515
|
}
|
44451
|
-
|
44452
|
-
|
44453
|
-
|
44454
|
-
|
44455
|
-
|
44456
|
-
|
44457
|
-
|
44458
|
-
|
44459
|
-
|
44460
|
-
|
44461
|
-
|
44462
|
-
|
44463
|
-
|
44464
|
-
|
44465
|
-
|
44466
|
-
|
44467
|
-
|
44516
|
+
function npmInstall(_0) {
|
44517
|
+
return __async(this, arguments, function* ({
|
44518
|
+
cwd,
|
44519
|
+
registryUrl,
|
44520
|
+
ignoreScripts,
|
44521
|
+
useNvm
|
44522
|
+
}) {
|
44523
|
+
const canUse = yield (0, _env.canUseNpm)();
|
44524
|
+
if (canUse) {
|
44525
|
+
const params = ["install"];
|
44526
|
+
if (registryUrl) {
|
44527
|
+
params.push(`--registry=${registryUrl}`);
|
44528
|
+
}
|
44529
|
+
if (ignoreScripts) {
|
44530
|
+
params.push("--ignore-scripts");
|
44531
|
+
}
|
44532
|
+
if (useNvm) {
|
44533
|
+
return runInstallWithNvm(`npm ${params.join(" ")}`, {
|
44534
|
+
cwd,
|
44535
|
+
env: process.env
|
44536
|
+
});
|
44537
|
+
}
|
44538
|
+
return execaWithStreamLog("npm", params, {
|
44468
44539
|
cwd,
|
44469
44540
|
env: process.env
|
44470
44541
|
});
|
44471
44542
|
}
|
44472
|
-
|
44473
|
-
|
44474
|
-
|
44475
|
-
|
44476
|
-
|
44477
|
-
|
44478
|
-
|
44479
|
-
|
44480
|
-
|
44481
|
-
|
44482
|
-
|
44483
|
-
|
44484
|
-
|
44485
|
-
|
44486
|
-
|
44487
|
-
|
44488
|
-
|
44489
|
-
|
44490
|
-
|
44491
|
-
|
44492
|
-
|
44493
|
-
|
44494
|
-
|
44495
|
-
|
44543
|
+
throw new Error("please install npm first");
|
44544
|
+
});
|
44545
|
+
}
|
44546
|
+
function yarnInstall(_0) {
|
44547
|
+
return __async(this, arguments, function* ({
|
44548
|
+
cwd,
|
44549
|
+
registryUrl,
|
44550
|
+
ignoreScripts,
|
44551
|
+
useNvm
|
44552
|
+
}) {
|
44553
|
+
const canUse = yield (0, _env.canUseYarn)();
|
44554
|
+
if (canUse) {
|
44555
|
+
const params = ["install"];
|
44556
|
+
if (registryUrl) {
|
44557
|
+
params.push(`--registry=${registryUrl}`);
|
44558
|
+
}
|
44559
|
+
if (ignoreScripts) {
|
44560
|
+
params.push("--ignore-scripts");
|
44561
|
+
}
|
44562
|
+
if (useNvm) {
|
44563
|
+
return runInstallWithNvm(`yarn ${params.join(" ")}`, {
|
44564
|
+
cwd,
|
44565
|
+
env: process.env
|
44566
|
+
});
|
44567
|
+
}
|
44568
|
+
return execaWithStreamLog("yarn", params, {
|
44496
44569
|
cwd,
|
44497
44570
|
env: process.env
|
44498
44571
|
});
|
44499
44572
|
}
|
44500
|
-
|
44501
|
-
|
44502
|
-
|
44503
|
-
|
44504
|
-
|
44505
|
-
|
44506
|
-
|
44507
|
-
|
44508
|
-
|
44509
|
-
|
44510
|
-
|
44511
|
-
|
44512
|
-
|
44513
|
-
|
44514
|
-
|
44515
|
-
|
44516
|
-
|
44517
|
-
|
44518
|
-
|
44519
|
-
|
44520
|
-
|
44521
|
-
|
44522
|
-
|
44523
|
-
|
44573
|
+
throw new Error("please install yarn first");
|
44574
|
+
});
|
44575
|
+
}
|
44576
|
+
function pnpmInstall(_0) {
|
44577
|
+
return __async(this, arguments, function* ({
|
44578
|
+
cwd,
|
44579
|
+
registryUrl,
|
44580
|
+
ignoreScripts,
|
44581
|
+
useNvm
|
44582
|
+
}) {
|
44583
|
+
const canUse = yield (0, _env.canUsePnpm)();
|
44584
|
+
if (canUse) {
|
44585
|
+
const params = ["install"];
|
44586
|
+
if (registryUrl) {
|
44587
|
+
params.push(`--registry=${registryUrl}`);
|
44588
|
+
}
|
44589
|
+
if (ignoreScripts) {
|
44590
|
+
params.push("--ignore-scripts");
|
44591
|
+
}
|
44592
|
+
if (useNvm) {
|
44593
|
+
return runInstallWithNvm(`yarn ${params.join(" ")}`, {
|
44594
|
+
cwd,
|
44595
|
+
env: process.env
|
44596
|
+
});
|
44597
|
+
}
|
44598
|
+
return execaWithStreamLog("pnpm", params, {
|
44524
44599
|
cwd,
|
44525
44600
|
env: process.env
|
44526
44601
|
});
|
44527
44602
|
}
|
44528
|
-
|
44529
|
-
|
44530
|
-
env: process.env
|
44531
|
-
});
|
44532
|
-
}
|
44533
|
-
throw new Error("please install pnpm first");
|
44603
|
+
throw new Error("please install pnpm first");
|
44604
|
+
});
|
44534
44605
|
}
|
44535
44606
|
}
|
44536
44607
|
});
|
@@ -44691,55 +44762,65 @@ var require_utils2 = __commonJS({
|
|
44691
44762
|
exports.initGitRepo = initGitRepo;
|
44692
44763
|
exports.isInGitRepo = isInGitRepo;
|
44693
44764
|
var _utils = require_dist();
|
44694
|
-
|
44695
|
-
|
44696
|
-
|
44697
|
-
|
44698
|
-
|
44699
|
-
|
44700
|
-
|
44701
|
-
|
44702
|
-
|
44765
|
+
function canUseGit() {
|
44766
|
+
return __async(this, null, function* () {
|
44767
|
+
try {
|
44768
|
+
yield (0, _utils.execa)("git", ["--version"], {
|
44769
|
+
env: process.env
|
44770
|
+
});
|
44771
|
+
return true;
|
44772
|
+
} catch (e) {
|
44773
|
+
return false;
|
44774
|
+
}
|
44775
|
+
});
|
44703
44776
|
}
|
44704
|
-
|
44705
|
-
|
44706
|
-
|
44777
|
+
function isInGitRepo(cwd) {
|
44778
|
+
return __async(this, null, function* () {
|
44779
|
+
try {
|
44780
|
+
yield (0, _utils.execa)("git", ["rev-parse", "--is-inside-work-tree"], {
|
44781
|
+
env: process.env,
|
44782
|
+
cwd
|
44783
|
+
});
|
44784
|
+
return true;
|
44785
|
+
} catch (e) {
|
44786
|
+
return false;
|
44787
|
+
}
|
44788
|
+
});
|
44789
|
+
}
|
44790
|
+
function initGitRepo(cwd, defaultBranch) {
|
44791
|
+
return __async(this, null, function* () {
|
44792
|
+
yield (0, _utils.execa)("git", ["init"], {
|
44707
44793
|
env: process.env,
|
44708
44794
|
cwd
|
44709
44795
|
});
|
44710
|
-
|
44711
|
-
|
44712
|
-
|
44713
|
-
}
|
44714
|
-
}
|
44715
|
-
async function initGitRepo(cwd, defaultBranch) {
|
44716
|
-
await (0, _utils.execa)("git", ["init"], {
|
44717
|
-
env: process.env,
|
44718
|
-
cwd
|
44719
|
-
});
|
44720
|
-
const {
|
44721
|
-
stdout
|
44722
|
-
} = await (0, _utils.execa)("git", ["symbolic-ref", "--short", "HEAD"], {
|
44723
|
-
env: process.env,
|
44724
|
-
cwd
|
44725
|
-
});
|
44726
|
-
if (stdout !== defaultBranch) {
|
44727
|
-
await (0, _utils.execa)("git", ["checkout", "-b", defaultBranch], {
|
44796
|
+
const {
|
44797
|
+
stdout
|
44798
|
+
} = yield (0, _utils.execa)("git", ["symbolic-ref", "--short", "HEAD"], {
|
44728
44799
|
env: process.env,
|
44729
44800
|
cwd
|
44730
44801
|
});
|
44731
|
-
|
44802
|
+
if (stdout !== defaultBranch) {
|
44803
|
+
yield (0, _utils.execa)("git", ["checkout", "-b", defaultBranch], {
|
44804
|
+
env: process.env,
|
44805
|
+
cwd
|
44806
|
+
});
|
44807
|
+
}
|
44808
|
+
});
|
44732
44809
|
}
|
44733
|
-
|
44734
|
-
|
44735
|
-
|
44736
|
-
|
44810
|
+
function gitAdd(cwd) {
|
44811
|
+
return __async(this, null, function* () {
|
44812
|
+
yield (0, _utils.execa)("git", ["add", "-A"], {
|
44813
|
+
env: process.env,
|
44814
|
+
cwd
|
44815
|
+
});
|
44737
44816
|
});
|
44738
44817
|
}
|
44739
|
-
|
44740
|
-
|
44741
|
-
|
44742
|
-
|
44818
|
+
function gitCommit(cwd, commitMessage) {
|
44819
|
+
return __async(this, null, function* () {
|
44820
|
+
yield (0, _utils.execa)("git", ["commit", "-m", commitMessage, "--no-verify"], {
|
44821
|
+
env: process.env,
|
44822
|
+
cwd
|
44823
|
+
});
|
44743
44824
|
});
|
44744
44825
|
}
|
44745
44826
|
}
|
@@ -44769,51 +44850,57 @@ var require_node2 = __commonJS({
|
|
44769
44850
|
this.generatorCore = generatorCore;
|
44770
44851
|
this.generatorContext = generatorContext;
|
44771
44852
|
}
|
44772
|
-
|
44773
|
-
|
44774
|
-
|
44775
|
-
|
44776
|
-
|
44777
|
-
|
44778
|
-
}
|
44779
|
-
async initGitRepo(cwd = this.generatorCore.outputPath, force = false) {
|
44780
|
-
const canUse = await (0, _utils.canUseGit)();
|
44781
|
-
if (!canUse) {
|
44853
|
+
isInGitRepo() {
|
44854
|
+
return __async(this, arguments, function* (cwd = this.generatorCore.outputPath) {
|
44855
|
+
const canUse = yield (0, _utils.canUseGit)();
|
44856
|
+
if (canUse) {
|
44857
|
+
return (0, _utils.isInGitRepo)(cwd);
|
44858
|
+
}
|
44782
44859
|
throw new Error("git is not found");
|
44783
|
-
}
|
44784
|
-
const alreadyInit = await this.isInGitRepo(cwd);
|
44785
|
-
if (alreadyInit && !force) {
|
44786
|
-
this.generatorCore.logger.debug("already in a git repo, skip init");
|
44787
|
-
return;
|
44788
|
-
}
|
44789
|
-
try {
|
44790
|
-
const {
|
44791
|
-
config: {
|
44792
|
-
defaultBranch = "master"
|
44793
|
-
}
|
44794
|
-
} = this.generatorContext || {
|
44795
|
-
config: {
|
44796
|
-
defaultBranch: "master"
|
44797
|
-
}
|
44798
|
-
};
|
44799
|
-
await (0, _utils.initGitRepo)(cwd, defaultBranch);
|
44800
|
-
} catch (e) {
|
44801
|
-
this.generatorCore.logger.debug("[GitAPI.error]:", e);
|
44802
|
-
throw e;
|
44803
|
-
}
|
44860
|
+
});
|
44804
44861
|
}
|
44805
|
-
|
44806
|
-
|
44807
|
-
|
44808
|
-
|
44809
|
-
|
44810
|
-
|
44811
|
-
|
44812
|
-
|
44813
|
-
|
44814
|
-
|
44815
|
-
|
44816
|
-
|
44862
|
+
initGitRepo() {
|
44863
|
+
return __async(this, arguments, function* (cwd = this.generatorCore.outputPath, force = false) {
|
44864
|
+
const canUse = yield (0, _utils.canUseGit)();
|
44865
|
+
if (!canUse) {
|
44866
|
+
throw new Error("git is not found");
|
44867
|
+
}
|
44868
|
+
const alreadyInit = yield this.isInGitRepo(cwd);
|
44869
|
+
if (alreadyInit && !force) {
|
44870
|
+
this.generatorCore.logger.debug("already in a git repo, skip init");
|
44871
|
+
return;
|
44872
|
+
}
|
44873
|
+
try {
|
44874
|
+
const {
|
44875
|
+
config: {
|
44876
|
+
defaultBranch = "master"
|
44877
|
+
}
|
44878
|
+
} = this.generatorContext || {
|
44879
|
+
config: {
|
44880
|
+
defaultBranch: "master"
|
44881
|
+
}
|
44882
|
+
};
|
44883
|
+
yield (0, _utils.initGitRepo)(cwd, defaultBranch);
|
44884
|
+
} catch (e) {
|
44885
|
+
this.generatorCore.logger.debug("[GitAPI.error]:", e);
|
44886
|
+
throw e;
|
44887
|
+
}
|
44888
|
+
});
|
44889
|
+
}
|
44890
|
+
addAndCommit(_0) {
|
44891
|
+
return __async(this, arguments, function* (commitMessage, cwd = this.generatorCore.outputPath) {
|
44892
|
+
const canUse = yield (0, _utils.canUseGit)();
|
44893
|
+
if (!canUse) {
|
44894
|
+
throw new Error("git is not found");
|
44895
|
+
}
|
44896
|
+
try {
|
44897
|
+
yield (0, _utils.gitAdd)(cwd);
|
44898
|
+
yield (0, _utils.gitCommit)(cwd, commitMessage);
|
44899
|
+
} catch (e) {
|
44900
|
+
this.generatorCore.logger.debug("[GitAPI.error]:", e);
|
44901
|
+
throw e;
|
44902
|
+
}
|
44903
|
+
});
|
44817
44904
|
}
|
44818
44905
|
};
|
44819
44906
|
exports.GitAPI = GitAPI;
|
@@ -44958,19 +45045,21 @@ var require_FsResource = __commonJS({
|
|
44958
45045
|
this.filePath = filePath;
|
44959
45046
|
this.resourceKey = resourceKey;
|
44960
45047
|
}
|
44961
|
-
|
44962
|
-
|
44963
|
-
|
44964
|
-
|
44965
|
-
|
44966
|
-
|
44967
|
-
|
44968
|
-
|
44969
|
-
|
44970
|
-
|
44971
|
-
|
44972
|
-
|
44973
|
-
|
45048
|
+
value() {
|
45049
|
+
return __async(this, null, function* () {
|
45050
|
+
const resourceFileExt = _path.default.extname(this.filePath);
|
45051
|
+
if (_constants.IMAGE_EXT_LIST.includes(resourceFileExt)) {
|
45052
|
+
const buffer = yield _utils.fs.readFile(_path.default.resolve(this.filePath));
|
45053
|
+
return {
|
45054
|
+
content: buffer
|
45055
|
+
};
|
45056
|
+
} else {
|
45057
|
+
const text = yield _utils.fs.readFile(_path.default.resolve(this.filePath), "utf8");
|
45058
|
+
return {
|
45059
|
+
content: text
|
45060
|
+
};
|
45061
|
+
}
|
45062
|
+
});
|
44974
45063
|
}
|
44975
45064
|
};
|
44976
45065
|
exports.FsResource = FsResource;
|
@@ -45012,17 +45101,19 @@ var require_FsMaterial = __commonJS({
|
|
45012
45101
|
get(resourceKey) {
|
45013
45102
|
return new _FsResource.FsResource(_path.default.resolve(this.basePath, resourceKey), resourceKey);
|
45014
45103
|
}
|
45015
|
-
|
45016
|
-
|
45017
|
-
|
45018
|
-
|
45019
|
-
|
45020
|
-
|
45104
|
+
find(globStr, options) {
|
45105
|
+
return __async(this, null, function* () {
|
45106
|
+
const matches = yield promisifyGlob(globStr, {
|
45107
|
+
cwd: _path.default.resolve(this.basePath),
|
45108
|
+
nodir: options === null || options === void 0 ? void 0 : options.nodir,
|
45109
|
+
dot: options === null || options === void 0 ? void 0 : options.dot,
|
45110
|
+
ignore: options === null || options === void 0 ? void 0 : options.ignore
|
45111
|
+
});
|
45112
|
+
return matches.reduce((pre, cur) => {
|
45113
|
+
pre[cur] = new _FsResource.FsResource(_path.default.resolve(this.basePath, cur), cur);
|
45114
|
+
return pre;
|
45115
|
+
}, {});
|
45021
45116
|
});
|
45022
|
-
return matches.reduce((pre, cur) => {
|
45023
|
-
pre[cur] = new _FsResource.FsResource(_path.default.resolve(this.basePath, cur), cur);
|
45024
|
-
return pre;
|
45025
|
-
}, {});
|
45026
45117
|
}
|
45027
45118
|
};
|
45028
45119
|
exports.FsMaterial = FsMaterial;
|
@@ -45065,13 +45156,15 @@ var require_fsExists = __commonJS({
|
|
45065
45156
|
});
|
45066
45157
|
exports.fsExists = fsExists;
|
45067
45158
|
var _utils = require_dist();
|
45068
|
-
|
45069
|
-
|
45070
|
-
|
45071
|
-
|
45072
|
-
|
45073
|
-
|
45074
|
-
|
45159
|
+
function fsExists(path2) {
|
45160
|
+
return __async(this, null, function* () {
|
45161
|
+
try {
|
45162
|
+
yield _utils.fs.access(path2);
|
45163
|
+
return true;
|
45164
|
+
} catch (e) {
|
45165
|
+
return false;
|
45166
|
+
}
|
45167
|
+
});
|
45075
45168
|
}
|
45076
45169
|
}
|
45077
45170
|
});
|
@@ -45091,21 +45184,23 @@ var require_getGeneratorDir = __commonJS({
|
|
45091
45184
|
return obj && obj.__esModule ? obj : { default: obj };
|
45092
45185
|
}
|
45093
45186
|
var MaxTimes = 5;
|
45094
|
-
|
45095
|
-
|
45096
|
-
|
45097
|
-
|
45098
|
-
|
45099
|
-
|
45100
|
-
|
45101
|
-
|
45102
|
-
|
45103
|
-
|
45104
|
-
|
45105
|
-
|
45106
|
-
|
45107
|
-
|
45108
|
-
|
45187
|
+
function getGeneratorDir(generator) {
|
45188
|
+
return __async(this, null, function* () {
|
45189
|
+
let result = generator;
|
45190
|
+
const isDirectory = (yield _utils.fs.stat(generator)).isDirectory();
|
45191
|
+
if (!isDirectory) {
|
45192
|
+
result = _path.default.dirname(generator);
|
45193
|
+
}
|
45194
|
+
let times = 0;
|
45195
|
+
while (times < MaxTimes && !(yield (0, _fsExists.fsExists)(_path.default.join(result, "package.json")))) {
|
45196
|
+
result = _path.default.join(result, "../");
|
45197
|
+
times++;
|
45198
|
+
}
|
45199
|
+
if (times >= MaxTimes) {
|
45200
|
+
throw Error("generator is not valid");
|
45201
|
+
}
|
45202
|
+
return result;
|
45203
|
+
});
|
45109
45204
|
}
|
45110
45205
|
}
|
45111
45206
|
});
|
@@ -45166,11 +45261,11 @@ var require_generator = __commonJS({
|
|
45166
45261
|
_defineProperty(this, "materialsManager", void 0);
|
45167
45262
|
_defineProperty(this, "outputPath", void 0);
|
45168
45263
|
_defineProperty(this, "output", {
|
45169
|
-
fs:
|
45264
|
+
fs: (file, content, options) => __async(this, null, function* () {
|
45170
45265
|
const filePath = _path.default.resolve(this.outputPath, file.toString());
|
45171
|
-
|
45172
|
-
|
45173
|
-
}
|
45266
|
+
yield _utils.fs.mkdirp(_path.default.dirname(filePath));
|
45267
|
+
yield _utils.fs.writeFile(filePath, content, options);
|
45268
|
+
})
|
45174
45269
|
});
|
45175
45270
|
_defineProperty(this, "_context", void 0);
|
45176
45271
|
_defineProperty(this, "event", void 0);
|
@@ -45203,58 +45298,62 @@ var require_generator = __commonJS({
|
|
45203
45298
|
setOutputPath(outputPath) {
|
45204
45299
|
this.outputPath = outputPath;
|
45205
45300
|
}
|
45206
|
-
|
45207
|
-
this
|
45208
|
-
|
45209
|
-
|
45210
|
-
|
45211
|
-
|
45212
|
-
|
45213
|
-
|
45214
|
-
|
45215
|
-
|
45216
|
-
|
45217
|
-
|
45218
|
-
|
45219
|
-
|
45220
|
-
|
45221
|
-
|
45222
|
-
|
45223
|
-
|
45224
|
-
|
45301
|
+
loadLocalGenerator(generator) {
|
45302
|
+
return __async(this, null, function* () {
|
45303
|
+
this.logger.debug("[runGenerator] generator is absolute, using local generator");
|
45304
|
+
let generatorPkg;
|
45305
|
+
let pkgJson;
|
45306
|
+
try {
|
45307
|
+
const generatorDir = yield (0, _getGeneratorDir.getGeneratorDir)(generator);
|
45308
|
+
generatorPkg = yield this.materialsManager.loadLocalGenerator(generatorDir);
|
45309
|
+
} catch (e) {
|
45310
|
+
this.logger.debug("load local generator failed:", e);
|
45311
|
+
return {
|
45312
|
+
generatorPkg: null
|
45313
|
+
};
|
45314
|
+
}
|
45315
|
+
try {
|
45316
|
+
pkgJson = (0, _nodeRequire.nodeRequire)(generatorPkg.get("package.json").filePath);
|
45317
|
+
} catch (e) {
|
45318
|
+
this.logger.debug("nodeRequire fail:", e);
|
45319
|
+
this.logger.error("can not require package.json");
|
45320
|
+
this.logger.warn(`generator need a package.json in top directory
|
45225
45321
|
check path: ${_utils.chalk.blue.underline(generator)} exist a package.json file or not`);
|
45226
|
-
|
45227
|
-
|
45228
|
-
|
45229
|
-
|
45230
|
-
|
45231
|
-
|
45232
|
-
|
45233
|
-
return {
|
45234
|
-
generatorPkg,
|
45235
|
-
pkgJson,
|
45236
|
-
materialKey
|
45237
|
-
};
|
45238
|
-
}
|
45239
|
-
async loadRemoteGenerator(generator) {
|
45240
|
-
this.logger.debug("[runGenerator] task.generator is remote package");
|
45241
|
-
try {
|
45242
|
-
const generatorPkg = await this.materialsManager.loadRemoteGenerator(generator);
|
45243
|
-
const pkgJson = (0, _nodeRequire.nodeRequire)(generatorPkg.get("package.json").filePath);
|
45244
|
-
const materialKey = `${pkgJson.name}@${pkgJson.version}`;
|
45245
|
-
this.logger.debug(`[runTask] loaded remote generator, ${pkgJson.name}@${pkgJson.version}`);
|
45322
|
+
return {
|
45323
|
+
generatorPkg: null
|
45324
|
+
};
|
45325
|
+
}
|
45326
|
+
this.logger.debug(`[runGenerator] generator version is ${pkgJson.version}`);
|
45327
|
+
const materialKey = `${pkgJson.name}@local`;
|
45328
|
+
this.logger.debug(`[runGenerator] loaded local generator, ${generator}`);
|
45246
45329
|
return {
|
45247
45330
|
generatorPkg,
|
45248
45331
|
pkgJson,
|
45249
45332
|
materialKey
|
45250
45333
|
};
|
45251
|
-
}
|
45252
|
-
|
45253
|
-
|
45254
|
-
|
45255
|
-
|
45256
|
-
|
45257
|
-
|
45334
|
+
});
|
45335
|
+
}
|
45336
|
+
loadRemoteGenerator(generator) {
|
45337
|
+
return __async(this, null, function* () {
|
45338
|
+
this.logger.debug("[runGenerator] task.generator is remote package");
|
45339
|
+
try {
|
45340
|
+
const generatorPkg = yield this.materialsManager.loadRemoteGenerator(generator);
|
45341
|
+
const pkgJson = (0, _nodeRequire.nodeRequire)(generatorPkg.get("package.json").filePath);
|
45342
|
+
const materialKey = `${pkgJson.name}@${pkgJson.version}`;
|
45343
|
+
this.logger.debug(`[runTask] loaded remote generator, ${pkgJson.name}@${pkgJson.version}`);
|
45344
|
+
return {
|
45345
|
+
generatorPkg,
|
45346
|
+
pkgJson,
|
45347
|
+
materialKey
|
45348
|
+
};
|
45349
|
+
} catch (e) {
|
45350
|
+
this.logger.debug("load remote generator failed:", e);
|
45351
|
+
this.logger.error(`load remote generator failed: Package ${generator} could not be found or get timeout`);
|
45352
|
+
return {
|
45353
|
+
generatorPkg: null
|
45354
|
+
};
|
45355
|
+
}
|
45356
|
+
});
|
45258
45357
|
}
|
45259
45358
|
handleForged(generatorName, context, needWait = false, projectPath = "") {
|
45260
45359
|
if (needWait) {
|
@@ -45269,79 +45368,85 @@ check path: ${_utils.chalk.blue.underline(generator)} exist a package.json file
|
|
45269
45368
|
}
|
45270
45369
|
return Promise.resolve();
|
45271
45370
|
}
|
45272
|
-
|
45273
|
-
|
45274
|
-
|
45275
|
-
|
45276
|
-
|
45277
|
-
|
45278
|
-
|
45279
|
-
|
45280
|
-
|
45281
|
-
|
45282
|
-
|
45283
|
-
|
45284
|
-
|
45285
|
-
|
45286
|
-
|
45287
|
-
|
45288
|
-
|
45289
|
-
|
45290
|
-
|
45291
|
-
|
45292
|
-
|
45293
|
-
|
45294
|
-
async runGenerator(generator, config = {}) {
|
45295
|
-
const spinner = (0, _utils.ora)({
|
45296
|
-
text: "Load Generator...",
|
45297
|
-
spinner: "runner"
|
45298
|
-
}).start();
|
45299
|
-
const {
|
45300
|
-
materialKey,
|
45301
|
-
generatorPkg,
|
45302
|
-
generatorScript
|
45303
|
-
} = await this.loadGenerator(generator);
|
45304
|
-
if (!materialKey || !generatorPkg) {
|
45305
|
-
throw new Error("load generator failed");
|
45306
|
-
}
|
45307
|
-
this.addMaterial(materialKey, generatorPkg);
|
45308
|
-
this.setConfig(config || {});
|
45309
|
-
this.setCurrent({
|
45310
|
-
material: generatorPkg
|
45371
|
+
loadGenerator(generator) {
|
45372
|
+
return __async(this, null, function* () {
|
45373
|
+
const loadGeneratorPromise = _path.default.isAbsolute(generator) ? this.loadLocalGenerator(generator) : this.loadRemoteGenerator(generator);
|
45374
|
+
const {
|
45375
|
+
generatorPkg,
|
45376
|
+
pkgJson,
|
45377
|
+
materialKey
|
45378
|
+
} = yield loadGeneratorPromise;
|
45379
|
+
if (!generatorPkg || !pkgJson || !materialKey) {
|
45380
|
+
return {};
|
45381
|
+
}
|
45382
|
+
this.logger.debug("[runGenerator] task.generator loaded");
|
45383
|
+
const generatorScript = (0, _nodeRequire.nodeRequire)(generatorPkg.basePath);
|
45384
|
+
if (typeof generatorScript !== "function") {
|
45385
|
+
this.logger.debug(`generator module [${pkgJson.name}] export default is not a function`, generatorScript);
|
45386
|
+
throw new Error(`generator module [${pkgJson.name}] export default is not a function`);
|
45387
|
+
}
|
45388
|
+
return {
|
45389
|
+
materialKey,
|
45390
|
+
generatorPkg,
|
45391
|
+
generatorScript
|
45392
|
+
};
|
45311
45393
|
});
|
45312
|
-
|
45313
|
-
|
45314
|
-
this
|
45315
|
-
|
45316
|
-
|
45317
|
-
|
45318
|
-
|
45319
|
-
|
45320
|
-
|
45321
|
-
|
45322
|
-
|
45323
|
-
|
45324
|
-
|
45325
|
-
|
45326
|
-
|
45327
|
-
|
45328
|
-
|
45329
|
-
|
45330
|
-
const subContext = _objectSpread(_objectSpread({}, this._context), {}, {
|
45331
|
-
config: _objectSpread(_objectSpread({}, this._context.config), config),
|
45332
|
-
materials: _objectSpread(_objectSpread({}, this._context.materials), {}, {
|
45333
|
-
default: new _FsMaterial.FsMaterial(_path.default.resolve(this.outputPath, relativePwdPath))
|
45334
|
-
}),
|
45335
|
-
current: {
|
45394
|
+
}
|
45395
|
+
runGenerator(_0) {
|
45396
|
+
return __async(this, arguments, function* (generator, config = {}) {
|
45397
|
+
const spinner = (0, _utils.ora)({
|
45398
|
+
text: "Load Generator...",
|
45399
|
+
spinner: "runner"
|
45400
|
+
}).start();
|
45401
|
+
const {
|
45402
|
+
materialKey,
|
45403
|
+
generatorPkg,
|
45404
|
+
generatorScript
|
45405
|
+
} = yield this.loadGenerator(generator);
|
45406
|
+
if (!materialKey || !generatorPkg) {
|
45407
|
+
throw new Error("load generator failed");
|
45408
|
+
}
|
45409
|
+
this.addMaterial(materialKey, generatorPkg);
|
45410
|
+
this.setConfig(config || {});
|
45411
|
+
this.setCurrent({
|
45336
45412
|
material: generatorPkg
|
45337
|
-
}
|
45413
|
+
});
|
45414
|
+
spinner.stop();
|
45415
|
+
yield generatorScript(this._context, this);
|
45416
|
+
this.setCurrent(null);
|
45417
|
+
});
|
45418
|
+
}
|
45419
|
+
runSubGenerator(subGenerator, relativePwdPath = "", config) {
|
45420
|
+
return __async(this, null, function* () {
|
45421
|
+
const spinner = (0, _utils.ora)({
|
45422
|
+
text: "Load Generator...",
|
45423
|
+
spinner: "runner"
|
45424
|
+
}).start();
|
45425
|
+
const {
|
45426
|
+
materialKey,
|
45427
|
+
generatorPkg,
|
45428
|
+
generatorScript
|
45429
|
+
} = yield this.loadGenerator(subGenerator);
|
45430
|
+
if (!materialKey || !generatorPkg) {
|
45431
|
+
throw new Error("load generator failed");
|
45432
|
+
}
|
45433
|
+
this.addMaterial(materialKey, generatorPkg);
|
45434
|
+
const subContext = _objectSpread(_objectSpread({}, this._context), {}, {
|
45435
|
+
config: _objectSpread(_objectSpread({}, this._context.config), config),
|
45436
|
+
materials: _objectSpread(_objectSpread({}, this._context.materials), {}, {
|
45437
|
+
default: new _FsMaterial.FsMaterial(_path.default.resolve(this.outputPath, relativePwdPath))
|
45438
|
+
}),
|
45439
|
+
current: {
|
45440
|
+
material: generatorPkg
|
45441
|
+
}
|
45442
|
+
});
|
45443
|
+
this.logger.debug("subContext", subContext);
|
45444
|
+
const preOutputPath = this.outputPath;
|
45445
|
+
this.setOutputPath(_path.default.resolve(this.outputPath, relativePwdPath || ""));
|
45446
|
+
spinner.stop();
|
45447
|
+
yield generatorScript(subContext, this);
|
45448
|
+
this.setOutputPath(preOutputPath);
|
45338
45449
|
});
|
45339
|
-
this.logger.debug("subContext", subContext);
|
45340
|
-
const preOutputPath = this.outputPath;
|
45341
|
-
this.setOutputPath(_path.default.resolve(this.outputPath, relativePwdPath || ""));
|
45342
|
-
spinner.stop();
|
45343
|
-
await generatorScript(subContext, this);
|
45344
|
-
this.setOutputPath(preOutputPath);
|
45345
45450
|
}
|
45346
45451
|
};
|
45347
45452
|
exports.GeneratorCore = GeneratorCore;
|
@@ -45363,61 +45468,67 @@ var require_packageManager = __commonJS({
|
|
45363
45468
|
function _interopRequireDefault(obj) {
|
45364
45469
|
return obj && obj.__esModule ? obj : { default: obj };
|
45365
45470
|
}
|
45366
|
-
|
45367
|
-
|
45368
|
-
|
45369
|
-
|
45370
|
-
|
45371
|
-
|
45372
|
-
|
45373
|
-
|
45374
|
-
|
45375
|
-
|
45376
|
-
|
45377
|
-
try {
|
45378
|
-
await (0, _utils.execa)("pnpm", ["--version"], {
|
45379
|
-
env: process.env
|
45380
|
-
});
|
45381
|
-
return true;
|
45382
|
-
} catch (e) {
|
45383
|
-
return false;
|
45384
|
-
}
|
45471
|
+
function canUseYarn() {
|
45472
|
+
return __async(this, null, function* () {
|
45473
|
+
try {
|
45474
|
+
yield (0, _utils.execa)("yarn", ["--version"], {
|
45475
|
+
env: process.env
|
45476
|
+
});
|
45477
|
+
return true;
|
45478
|
+
} catch (e) {
|
45479
|
+
return false;
|
45480
|
+
}
|
45481
|
+
});
|
45385
45482
|
}
|
45386
|
-
|
45387
|
-
|
45388
|
-
|
45389
|
-
|
45390
|
-
|
45391
|
-
|
45392
|
-
|
45393
|
-
|
45394
|
-
|
45395
|
-
}));
|
45396
|
-
delete pkgJSON.devDependencies;
|
45397
|
-
_utils.fs.writeFileSync(pkgPath, JSON.stringify(pkgJSON, null, 2), {
|
45398
|
-
encoding: "utf-8"
|
45399
|
-
});
|
45400
|
-
} catch (e) {
|
45401
|
-
}
|
45402
|
-
if (await canUsePnpm()) {
|
45403
|
-
const params = ["install", "--prod", "--reporter=silent", "--prefer-offline", "--ignore-scripts"];
|
45404
|
-
if (registryUrl) {
|
45405
|
-
params.push(`--registry=${registryUrl}`);
|
45483
|
+
function canUsePnpm() {
|
45484
|
+
return __async(this, null, function* () {
|
45485
|
+
try {
|
45486
|
+
yield (0, _utils.execa)("pnpm", ["--version"], {
|
45487
|
+
env: process.env
|
45488
|
+
});
|
45489
|
+
return true;
|
45490
|
+
} catch (e) {
|
45491
|
+
return false;
|
45406
45492
|
}
|
45407
|
-
|
45408
|
-
|
45409
|
-
|
45410
|
-
|
45411
|
-
|
45493
|
+
});
|
45494
|
+
}
|
45495
|
+
function runInstall(targetDir, registryUrl) {
|
45496
|
+
return __async(this, null, function* () {
|
45497
|
+
const options = {
|
45498
|
+
cwd: targetDir,
|
45499
|
+
env: process.env
|
45500
|
+
};
|
45501
|
+
try {
|
45502
|
+
const pkgPath = _path.default.join(targetDir, "package.json");
|
45503
|
+
const pkgJSON = JSON.parse(_utils.fs.readFileSync(pkgPath, {
|
45504
|
+
encoding: "utf-8"
|
45505
|
+
}));
|
45506
|
+
delete pkgJSON.devDependencies;
|
45507
|
+
_utils.fs.writeFileSync(pkgPath, JSON.stringify(pkgJSON, null, 2), {
|
45508
|
+
encoding: "utf-8"
|
45509
|
+
});
|
45510
|
+
} catch (e) {
|
45412
45511
|
}
|
45413
|
-
|
45414
|
-
|
45415
|
-
|
45416
|
-
|
45417
|
-
|
45512
|
+
if (yield canUsePnpm()) {
|
45513
|
+
const params = ["install", "--prod", "--reporter=silent", "--prefer-offline", "--ignore-scripts"];
|
45514
|
+
if (registryUrl) {
|
45515
|
+
params.push(`--registry=${registryUrl}`);
|
45516
|
+
}
|
45517
|
+
yield (0, _utils.execa)("pnpm", params, options);
|
45518
|
+
} else if (yield canUseYarn()) {
|
45519
|
+
const params = ["install", "--production", "--silent", "--ignore-scripts"];
|
45520
|
+
if (registryUrl) {
|
45521
|
+
params.push(`--registry=${registryUrl}`);
|
45522
|
+
}
|
45523
|
+
yield (0, _utils.execa)("yarn", params, options);
|
45524
|
+
} else {
|
45525
|
+
const params = ["install", "--production", "--loglevel=error", "--prefer-offline", "--ignore-scripts"];
|
45526
|
+
if (registryUrl) {
|
45527
|
+
params.push(`--registry=${registryUrl}`);
|
45528
|
+
}
|
45529
|
+
yield (0, _utils.execa)("npm", params, options);
|
45418
45530
|
}
|
45419
|
-
|
45420
|
-
}
|
45531
|
+
});
|
45421
45532
|
}
|
45422
45533
|
}
|
45423
45534
|
});
|
@@ -45430,22 +45541,24 @@ var require_timeoutPromise = __commonJS({
|
|
45430
45541
|
value: true
|
45431
45542
|
});
|
45432
45543
|
exports.timeoutPromise = timeoutPromise;
|
45433
|
-
|
45434
|
-
|
45435
|
-
|
45436
|
-
|
45437
|
-
|
45438
|
-
|
45439
|
-
|
45440
|
-
|
45441
|
-
|
45442
|
-
|
45443
|
-
|
45444
|
-
|
45445
|
-
|
45446
|
-
|
45544
|
+
function timeoutPromise(promise, ms, reason = "Operation") {
|
45545
|
+
return __async(this, null, function* () {
|
45546
|
+
let timeoutId = null;
|
45547
|
+
const delayPromise = (ms2) => new Promise((resolve) => {
|
45548
|
+
timeoutId = setTimeout(resolve, ms2);
|
45549
|
+
});
|
45550
|
+
const timeout = delayPromise(ms).then(() => {
|
45551
|
+
throw new Error(`${reason} timed out after ${ms}ms`);
|
45552
|
+
});
|
45553
|
+
try {
|
45554
|
+
const result = yield Promise.race([promise, timeout]);
|
45555
|
+
return result;
|
45556
|
+
} finally {
|
45557
|
+
if (timeoutId) {
|
45558
|
+
clearTimeout(timeoutId);
|
45559
|
+
}
|
45447
45560
|
}
|
45448
|
-
}
|
45561
|
+
});
|
45449
45562
|
}
|
45450
45563
|
}
|
45451
45564
|
});
|
@@ -51765,7 +51878,7 @@ var require_opts_arg = __commonJS({
|
|
51765
51878
|
if (!opts)
|
51766
51879
|
opts = { mode: 511, fs };
|
51767
51880
|
else if (typeof opts === "object")
|
51768
|
-
opts = { mode: 511, fs,
|
51881
|
+
opts = __spreadValues({ mode: 511, fs }, opts);
|
51769
51882
|
else if (typeof opts === "number")
|
51770
51883
|
opts = { mode: opts, fs };
|
51771
51884
|
else if (typeof opts === "string")
|
@@ -53192,25 +53305,27 @@ var require_getNpmTarballUrl = __commonJS({
|
|
53192
53305
|
var _utils = require_dist();
|
53193
53306
|
var _timeoutPromise = require_timeoutPromise();
|
53194
53307
|
var _constants = require_constants5();
|
53195
|
-
|
53196
|
-
|
53197
|
-
|
53198
|
-
|
53199
|
-
|
53200
|
-
|
53201
|
-
|
53202
|
-
|
53203
|
-
|
53204
|
-
|
53205
|
-
|
53206
|
-
|
53207
|
-
|
53208
|
-
|
53209
|
-
|
53210
|
-
|
53211
|
-
|
53212
|
-
|
53213
|
-
|
53308
|
+
function getNpmTarballUrl(pkgName, pkgVersion, options) {
|
53309
|
+
return __async(this, null, function* () {
|
53310
|
+
const {
|
53311
|
+
registryUrl
|
53312
|
+
} = options || {};
|
53313
|
+
const params = ["view", `${pkgName}@${pkgVersion}`, "dist", "--json"];
|
53314
|
+
if (registryUrl) {
|
53315
|
+
params.push("--registry");
|
53316
|
+
params.push(registryUrl);
|
53317
|
+
}
|
53318
|
+
const getPkgInfoPromise = (0, _utils.execa)("npm", params);
|
53319
|
+
const {
|
53320
|
+
stdout
|
53321
|
+
} = yield (0, _timeoutPromise.timeoutPromise)(getPkgInfoPromise, _constants.NPM_API_TIMEOUT, `Get npm tarball of '${pkgName}'`);
|
53322
|
+
try {
|
53323
|
+
const pkgDistInfo = JSON.parse(stdout);
|
53324
|
+
return pkgDistInfo.tarball;
|
53325
|
+
} catch (e) {
|
53326
|
+
throw new Error(`Version \`${pkgVersion}\` for package \`${pkgName}\` could not be found`);
|
53327
|
+
}
|
53328
|
+
});
|
53214
53329
|
}
|
53215
53330
|
}
|
53216
53331
|
});
|
@@ -53226,27 +53341,29 @@ var require_getNpmVersion = __commonJS({
|
|
53226
53341
|
var _utils = require_dist();
|
53227
53342
|
var _timeoutPromise = require_timeoutPromise();
|
53228
53343
|
var _constants = require_constants5();
|
53229
|
-
|
53230
|
-
|
53231
|
-
|
53232
|
-
|
53233
|
-
|
53234
|
-
|
53235
|
-
|
53236
|
-
|
53237
|
-
|
53238
|
-
|
53239
|
-
|
53240
|
-
|
53241
|
-
|
53242
|
-
|
53243
|
-
|
53244
|
-
|
53245
|
-
|
53246
|
-
|
53247
|
-
|
53248
|
-
|
53249
|
-
|
53344
|
+
function getNpmVersion(packageName, options) {
|
53345
|
+
return __async(this, null, function* () {
|
53346
|
+
const {
|
53347
|
+
version,
|
53348
|
+
registryUrl
|
53349
|
+
} = options || {};
|
53350
|
+
const params = ["view"];
|
53351
|
+
if (version) {
|
53352
|
+
params.push(`${packageName}@${version}`);
|
53353
|
+
} else {
|
53354
|
+
params.push(packageName);
|
53355
|
+
}
|
53356
|
+
params.push("version");
|
53357
|
+
if (registryUrl) {
|
53358
|
+
params.push("--registry");
|
53359
|
+
params.push(registryUrl);
|
53360
|
+
}
|
53361
|
+
const getPkgInfoPromise = (0, _utils.execa)("npm", params);
|
53362
|
+
const {
|
53363
|
+
stdout
|
53364
|
+
} = yield (0, _timeoutPromise.timeoutPromise)(getPkgInfoPromise, _constants.NPM_API_TIMEOUT, `Get npm version of '${packageName}'`);
|
53365
|
+
return stdout;
|
53366
|
+
});
|
53250
53367
|
}
|
53251
53368
|
}
|
53252
53369
|
});
|
@@ -53271,84 +53388,90 @@ var require_downloadPackage = __commonJS({
|
|
53271
53388
|
function _interopRequireDefault(obj) {
|
53272
53389
|
return obj && obj.__esModule ? obj : { default: obj };
|
53273
53390
|
}
|
53274
|
-
|
53275
|
-
|
53276
|
-
|
53277
|
-
|
53278
|
-
|
53279
|
-
|
53280
|
-
|
53281
|
-
|
53391
|
+
function isValidCache(cacheDir) {
|
53392
|
+
return __async(this, null, function* () {
|
53393
|
+
if (yield (0, _fsExists.fsExists)(`${cacheDir}/.codesmith.completed`)) {
|
53394
|
+
const preCacheTimeStr = yield _utils.fs.readFile(`${cacheDir}/.codesmith.completed`, {
|
53395
|
+
encoding: "utf-8"
|
53396
|
+
});
|
53397
|
+
const preCacheTime = preCacheTimeStr ? new Date(preCacheTimeStr) : new Date(0);
|
53398
|
+
if (Number(new Date()) - Number(preCacheTime) < _constants.CATCHE_VALIDITY_PREIOD) {
|
53399
|
+
return true;
|
53400
|
+
}
|
53401
|
+
return false;
|
53282
53402
|
}
|
53283
53403
|
return false;
|
53284
|
-
}
|
53285
|
-
return false;
|
53286
|
-
}
|
53287
|
-
async function downloadAndDecompressTargz(tarballPkg, targetDir) {
|
53288
|
-
const response = await (0, _axios.default)({
|
53289
|
-
method: "get",
|
53290
|
-
url: tarballPkg,
|
53291
|
-
responseType: "stream"
|
53292
53404
|
});
|
53293
|
-
|
53294
|
-
|
53295
|
-
|
53296
|
-
|
53297
|
-
|
53298
|
-
|
53299
|
-
|
53300
|
-
await new Promise((resolve, reject) => {
|
53301
|
-
response.data.pipe(dest);
|
53302
|
-
response.data.on("error", (err) => {
|
53303
|
-
reject(err);
|
53405
|
+
}
|
53406
|
+
function downloadAndDecompressTargz(tarballPkg, targetDir) {
|
53407
|
+
return __async(this, null, function* () {
|
53408
|
+
const response = yield (0, _axios.default)({
|
53409
|
+
method: "get",
|
53410
|
+
url: tarballPkg,
|
53411
|
+
responseType: "stream"
|
53304
53412
|
});
|
53305
|
-
|
53306
|
-
|
53413
|
+
if (response.status !== 200) {
|
53414
|
+
throw new Error(`download tar package get bad status code: ${response.status}`);
|
53415
|
+
}
|
53416
|
+
const contentLength = Number(response.headers["content-length"]);
|
53417
|
+
const randomId = Math.floor(Math.random() * 1e4);
|
53418
|
+
const tempTgzFilePath = `${_os.default.tmpdir()}/temp-${randomId}.tgz`;
|
53419
|
+
const dest = _utils.fs.createWriteStream(tempTgzFilePath);
|
53420
|
+
yield new Promise((resolve, reject) => {
|
53421
|
+
response.data.pipe(dest);
|
53422
|
+
response.data.on("error", (err) => {
|
53423
|
+
reject(err);
|
53424
|
+
});
|
53425
|
+
dest.on("finish", () => {
|
53426
|
+
resolve();
|
53427
|
+
});
|
53307
53428
|
});
|
53308
|
-
|
53309
|
-
|
53310
|
-
|
53311
|
-
|
53312
|
-
|
53313
|
-
|
53314
|
-
|
53315
|
-
|
53316
|
-
|
53317
|
-
|
53318
|
-
|
53319
|
-
|
53429
|
+
if ((yield _utils.fs.stat(tempTgzFilePath)).size !== contentLength) {
|
53430
|
+
throw new Error("download tar package get bad content length");
|
53431
|
+
}
|
53432
|
+
yield new Promise((resolve, reject) => {
|
53433
|
+
_utils.fs.createReadStream(tempTgzFilePath).pipe(_tar.default.x({
|
53434
|
+
strip: 1,
|
53435
|
+
C: `${targetDir}`
|
53436
|
+
})).on("finish", () => {
|
53437
|
+
resolve();
|
53438
|
+
}).on("error", (err) => {
|
53439
|
+
reject(err);
|
53440
|
+
});
|
53320
53441
|
});
|
53321
53442
|
});
|
53322
53443
|
}
|
53323
|
-
|
53324
|
-
|
53325
|
-
|
53326
|
-
|
53327
|
-
|
53328
|
-
|
53329
|
-
|
53330
|
-
|
53331
|
-
|
53332
|
-
|
53333
|
-
|
53334
|
-
|
53335
|
-
|
53336
|
-
|
53444
|
+
function downloadPackage(_0) {
|
53445
|
+
return __async(this, arguments, function* (pkgName, pkgVersion = "latest", options = {}) {
|
53446
|
+
const {
|
53447
|
+
registryUrl,
|
53448
|
+
install
|
53449
|
+
} = options;
|
53450
|
+
const version = yield (0, _getNpmVersion.getNpmVersion)(pkgName, {
|
53451
|
+
registryUrl,
|
53452
|
+
version: pkgVersion
|
53453
|
+
});
|
53454
|
+
if (version === void 0) {
|
53455
|
+
throw new Error(`package ${pkgName}@${pkgVersion} not found in registry`);
|
53456
|
+
}
|
53457
|
+
const targetDir = `${_os.default.tmpdir()}/csmith-generator/${pkgName}@${version}`;
|
53458
|
+
if ((yield (0, _fsExists.fsExists)(targetDir)) && (yield isValidCache(targetDir))) {
|
53459
|
+
return targetDir;
|
53460
|
+
}
|
53461
|
+
yield _utils.fs.remove(targetDir);
|
53462
|
+
yield _utils.fs.mkdirp(targetDir);
|
53463
|
+
const tarballPkg = yield (0, _getNpmTarballUrl.getNpmTarballUrl)(pkgName, version, {
|
53464
|
+
registryUrl
|
53465
|
+
});
|
53466
|
+
yield downloadAndDecompressTargz(tarballPkg, targetDir);
|
53467
|
+
if (install) {
|
53468
|
+
yield (0, _packageManager.runInstall)(targetDir, registryUrl);
|
53469
|
+
}
|
53470
|
+
yield _utils.fs.writeFile(`${targetDir}/.codesmith.completed`, new Date().toISOString(), {
|
53471
|
+
encoding: "utf-8"
|
53472
|
+
});
|
53337
53473
|
return targetDir;
|
53338
|
-
}
|
53339
|
-
await _utils.fs.remove(targetDir);
|
53340
|
-
await _utils.fs.mkdirp(targetDir);
|
53341
|
-
const tarballPkg = await (0, _getNpmTarballUrl.getNpmTarballUrl)(pkgName, version, {
|
53342
|
-
registryUrl
|
53343
|
-
});
|
53344
|
-
await downloadAndDecompressTargz(tarballPkg, targetDir);
|
53345
|
-
if (install) {
|
53346
|
-
await (0, _packageManager.runInstall)(targetDir, registryUrl);
|
53347
|
-
}
|
53348
|
-
await _utils.fs.writeFile(`${targetDir}/.codesmith.completed`, new Date().toISOString(), {
|
53349
|
-
encoding: "utf-8"
|
53350
53474
|
});
|
53351
|
-
return targetDir;
|
53352
53475
|
}
|
53353
53476
|
}
|
53354
53477
|
});
|
@@ -53504,19 +53627,21 @@ var require_materials = __commonJS({
|
|
53504
53627
|
this.materialMap[generator] = fsMaterial;
|
53505
53628
|
return Promise.resolve(fsMaterial);
|
53506
53629
|
}
|
53507
|
-
|
53508
|
-
|
53509
|
-
|
53510
|
-
|
53511
|
-
|
53512
|
-
|
53513
|
-
|
53514
|
-
|
53630
|
+
loadRemoteGenerator(generator) {
|
53631
|
+
return __async(this, null, function* () {
|
53632
|
+
const {
|
53633
|
+
name,
|
53634
|
+
version
|
53635
|
+
} = (0, _utils.getPackageInfo)(generator);
|
53636
|
+
const localPath = yield (0, _utils.downloadPackage)(name, version, {
|
53637
|
+
registryUrl: this.registryUrl,
|
53638
|
+
install: true
|
53639
|
+
});
|
53640
|
+
const pkgJson = (0, _utils.nodeRequire)(`${localPath}/package.json`);
|
53641
|
+
const materialKey = `${pkgJson.name}@${pkgJson.version}`;
|
53642
|
+
this.materialMap[materialKey] = new _FsMaterial.FsMaterial(localPath);
|
53643
|
+
return Promise.resolve(this.materialMap[materialKey]);
|
53515
53644
|
});
|
53516
|
-
const pkgJson = (0, _utils.nodeRequire)(`${localPath}/package.json`);
|
53517
|
-
const materialKey = `${pkgJson.name}@${pkgJson.version}`;
|
53518
|
-
this.materialMap[materialKey] = new _FsMaterial.FsMaterial(localPath);
|
53519
|
-
return Promise.resolve(this.materialMap[materialKey]);
|
53520
53645
|
}
|
53521
53646
|
};
|
53522
53647
|
exports.MaterialsManager = MaterialsManager;
|
@@ -53562,34 +53687,38 @@ var require_codesmith = __commonJS({
|
|
53562
53687
|
this.logger = logger || new _logger.Logger(debug ? _constants.LoggerLevel.Debug : _constants.LoggerLevel.Info);
|
53563
53688
|
this.materialsManager = new _materials.MaterialsManager(this.logger, registryUrl);
|
53564
53689
|
}
|
53565
|
-
|
53566
|
-
|
53567
|
-
|
53568
|
-
|
53569
|
-
|
53570
|
-
|
53571
|
-
|
53572
|
-
|
53573
|
-
|
53574
|
-
|
53575
|
-
|
53576
|
-
|
53577
|
-
|
53690
|
+
forge(_0) {
|
53691
|
+
return __async(this, arguments, function* ({
|
53692
|
+
tasks,
|
53693
|
+
pwd
|
53694
|
+
}) {
|
53695
|
+
this.core = new _generator.GeneratorCore({
|
53696
|
+
logger: this.logger,
|
53697
|
+
materialsManager: this.materialsManager,
|
53698
|
+
outputPath: pwd || process.cwd()
|
53699
|
+
});
|
53700
|
+
this.core.addMaterial("default", new _FsMaterial.FsMaterial(_path.default.resolve(pwd || process.cwd())));
|
53701
|
+
try {
|
53702
|
+
for (const task of tasks) {
|
53703
|
+
yield this.runTask(task);
|
53704
|
+
}
|
53705
|
+
} catch (e) {
|
53706
|
+
this.logger.error("run task error:", e);
|
53707
|
+
throw new Error("run task error");
|
53578
53708
|
}
|
53579
|
-
}
|
53580
|
-
this.logger.error("run task error:", e);
|
53581
|
-
throw new Error("run task error");
|
53582
|
-
}
|
53709
|
+
});
|
53583
53710
|
}
|
53584
|
-
|
53585
|
-
|
53586
|
-
|
53587
|
-
|
53588
|
-
|
53589
|
-
|
53590
|
-
|
53591
|
-
|
53592
|
-
|
53711
|
+
runTask(task) {
|
53712
|
+
return __async(this, null, function* () {
|
53713
|
+
if (!this.core) {
|
53714
|
+
throw new Error("no core in 'runTask'");
|
53715
|
+
}
|
53716
|
+
const {
|
53717
|
+
generator,
|
53718
|
+
config
|
53719
|
+
} = task;
|
53720
|
+
yield this.core.runGenerator(generator, config);
|
53721
|
+
});
|
53593
53722
|
}
|
53594
53723
|
};
|
53595
53724
|
exports.CodeSmith = CodeSmith;
|
@@ -59472,26 +59601,30 @@ var require_node4 = __commonJS({
|
|
59472
59601
|
partials: {}
|
59473
59602
|
};
|
59474
59603
|
}
|
59475
|
-
|
59476
|
-
|
59477
|
-
|
59478
|
-
|
59479
|
-
|
59480
|
-
|
59481
|
-
|
59482
|
-
|
59483
|
-
|
59484
|
-
|
59604
|
+
renderTemplate(_0, _1) {
|
59605
|
+
return __async(this, arguments, function* (templateResource, target, parameters = {}) {
|
59606
|
+
if (templateResource._type !== _codesmith.FS_RESOURCE) {
|
59607
|
+
throw new Error("resource not match");
|
59608
|
+
}
|
59609
|
+
const resourceValue = yield templateResource.value();
|
59610
|
+
if (typeof resourceValue.content !== "string") {
|
59611
|
+
throw new Error(`resource.value is not string, resourceValue=${resourceValue}`);
|
59612
|
+
}
|
59613
|
+
yield this.generatorCore.output.fs(target, (0, _utils.renderString)(resourceValue.content, parameters, this.registers), {
|
59614
|
+
encoding: "utf-8"
|
59615
|
+
});
|
59485
59616
|
});
|
59486
59617
|
}
|
59487
|
-
|
59488
|
-
|
59489
|
-
|
59490
|
-
|
59491
|
-
|
59492
|
-
|
59493
|
-
|
59494
|
-
|
59618
|
+
renderTemplateDir(material, findGlob, target, options) {
|
59619
|
+
return __async(this, null, function* () {
|
59620
|
+
const resourceMap = yield material.find(findGlob, options);
|
59621
|
+
yield Promise.all(
|
59622
|
+
Object.keys(resourceMap).map((resourceKey) => __async(this, null, function* () {
|
59623
|
+
this.generatorCore.logger.debug(`[renderDir] resourceKey=${resourceKey}`);
|
59624
|
+
yield this.renderTemplate(material.get(resourceKey), target(resourceKey), options === null || options === void 0 ? void 0 : options.parameters);
|
59625
|
+
}))
|
59626
|
+
);
|
59627
|
+
});
|
59495
59628
|
}
|
59496
59629
|
};
|
59497
59630
|
exports.HandlebarsAPI = HandlebarsAPI;
|
@@ -60272,26 +60405,30 @@ var require_node5 = __commonJS({
|
|
60272
60405
|
_defineProperty(this, "generatorCore", void 0);
|
60273
60406
|
this.generatorCore = generatorCore;
|
60274
60407
|
}
|
60275
|
-
|
60276
|
-
|
60277
|
-
|
60278
|
-
|
60279
|
-
|
60280
|
-
|
60281
|
-
|
60282
|
-
|
60283
|
-
|
60284
|
-
|
60408
|
+
renderTemplate(_0, _1) {
|
60409
|
+
return __async(this, arguments, function* (templateResource, target, parameters = {}) {
|
60410
|
+
if (templateResource._type !== _codesmith.FS_RESOURCE) {
|
60411
|
+
throw new Error("resource not match");
|
60412
|
+
}
|
60413
|
+
const resourceValue = yield templateResource.value();
|
60414
|
+
if (typeof resourceValue.content !== "string") {
|
60415
|
+
throw new Error(`resource.value is not string, resourceValue=${resourceValue}`);
|
60416
|
+
}
|
60417
|
+
yield this.generatorCore.output.fs(target, (0, _utils.renderString)(resourceValue.content, parameters), {
|
60418
|
+
encoding: "utf-8"
|
60419
|
+
});
|
60285
60420
|
});
|
60286
60421
|
}
|
60287
|
-
|
60288
|
-
|
60289
|
-
|
60290
|
-
|
60291
|
-
|
60292
|
-
|
60293
|
-
|
60294
|
-
|
60422
|
+
renderTemplateDir(material, findGlob, target, options) {
|
60423
|
+
return __async(this, null, function* () {
|
60424
|
+
const resourceMap = yield material.find(findGlob, options);
|
60425
|
+
yield Promise.all(
|
60426
|
+
Object.keys(resourceMap).map((resourceKey) => __async(this, null, function* () {
|
60427
|
+
this.generatorCore.logger.debug(`[renderDir] resourceKey=${resourceKey}`);
|
60428
|
+
yield this.renderTemplate(material.get(resourceKey), target(resourceKey), options === null || options === void 0 ? void 0 : options.parameters);
|
60429
|
+
}))
|
60430
|
+
);
|
60431
|
+
});
|
60295
60432
|
}
|
60296
60433
|
};
|
60297
60434
|
exports.EjsAPI = EjsAPI;
|
@@ -60338,28 +60475,32 @@ var require_node6 = __commonJS({
|
|
60338
60475
|
_defineProperty(this, "generatorCore", void 0);
|
60339
60476
|
this.generatorCore = generatorCore;
|
60340
60477
|
}
|
60341
|
-
|
60342
|
-
|
60343
|
-
|
60344
|
-
|
60345
|
-
|
60346
|
-
|
60347
|
-
|
60348
|
-
|
60349
|
-
|
60350
|
-
|
60351
|
-
|
60352
|
-
|
60353
|
-
|
60354
|
-
|
60355
|
-
|
60478
|
+
renderFile(resource, target) {
|
60479
|
+
return __async(this, null, function* () {
|
60480
|
+
if (resource._type !== _codesmith.FS_RESOURCE) {
|
60481
|
+
throw new Error("resource not match");
|
60482
|
+
}
|
60483
|
+
const resourceValue = yield resource.value();
|
60484
|
+
const resourceFileExt = _path.default.extname(resource.filePath);
|
60485
|
+
if (_constant.imageExtNameList.includes(resourceFileExt)) {
|
60486
|
+
yield this.generatorCore.output.fs(target, resourceValue.content, {
|
60487
|
+
encoding: "binary"
|
60488
|
+
});
|
60489
|
+
} else {
|
60490
|
+
yield this.generatorCore.output.fs(target, resourceValue.content, {
|
60491
|
+
encoding: "utf-8"
|
60492
|
+
});
|
60493
|
+
}
|
60494
|
+
});
|
60356
60495
|
}
|
60357
|
-
|
60358
|
-
|
60359
|
-
|
60360
|
-
|
60361
|
-
|
60362
|
-
|
60496
|
+
renderDir(material, findGlob, target, options) {
|
60497
|
+
return __async(this, null, function* () {
|
60498
|
+
const resourceMap = yield material.find(findGlob, options);
|
60499
|
+
yield Promise.all(Object.keys(resourceMap).map((resourceKey) => __async(this, null, function* () {
|
60500
|
+
this.generatorCore.logger.debug(`[renderDir] resourceKey=${resourceKey}`);
|
60501
|
+
yield this.renderFile(material.get(resourceKey), target(resourceKey));
|
60502
|
+
})));
|
60503
|
+
});
|
60363
60504
|
}
|
60364
60505
|
};
|
60365
60506
|
exports.FsAPI = FsAPI;
|
@@ -70925,12 +71066,12 @@ var require_baseUI = __commonJS({
|
|
70925
71066
|
const ms = new MuteStream();
|
70926
71067
|
ms.pipe(opt.output || process.stdout);
|
70927
71068
|
const output2 = ms;
|
70928
|
-
return {
|
70929
|
-
terminal: true
|
70930
|
-
|
71069
|
+
return __spreadProps(__spreadValues({
|
71070
|
+
terminal: true
|
71071
|
+
}, opt), {
|
70931
71072
|
input,
|
70932
71073
|
output: output2
|
70933
|
-
};
|
71074
|
+
});
|
70934
71075
|
}
|
70935
71076
|
module2.exports = UI;
|
70936
71077
|
}
|
@@ -82350,14 +82491,14 @@ var require_prompt = __commonJS({
|
|
82350
82491
|
}
|
82351
82492
|
run(questions, answers) {
|
82352
82493
|
if (_.isPlainObject(answers)) {
|
82353
|
-
this.answers = {
|
82494
|
+
this.answers = __spreadValues({}, answers);
|
82354
82495
|
} else {
|
82355
82496
|
this.answers = {};
|
82356
82497
|
}
|
82357
82498
|
if (_.isPlainObject(questions)) {
|
82358
82499
|
questions = Object.values(questions).every(
|
82359
82500
|
(v) => _.isPlainObject(v) && v.name === void 0
|
82360
|
-
) ? Object.entries(questions).map(([name, question]) => ({ name,
|
82501
|
+
) ? Object.entries(questions).map(([name, question]) => __spreadValues({ name }, question)) : [questions];
|
82361
82502
|
}
|
82362
82503
|
const obs = Array.isArray(questions) ? from(questions) : questions;
|
82363
82504
|
this.process = obs.pipe(
|
@@ -82381,7 +82522,7 @@ var require_prompt = __commonJS({
|
|
82381
82522
|
return Promise.reject(error);
|
82382
82523
|
}
|
82383
82524
|
processQuestion(question) {
|
82384
|
-
question = {
|
82525
|
+
question = __spreadValues({}, question);
|
82385
82526
|
return defer(() => {
|
82386
82527
|
const obs = of(question);
|
82387
82528
|
return obs.pipe(
|
@@ -90146,13 +90287,12 @@ var require_ora2 = __commonJS({
|
|
90146
90287
|
text: options
|
90147
90288
|
};
|
90148
90289
|
}
|
90149
|
-
this.options = {
|
90290
|
+
this.options = __spreadValues({
|
90150
90291
|
text: "",
|
90151
90292
|
color: "cyan",
|
90152
90293
|
stream: process.stderr,
|
90153
|
-
discardStdin: true
|
90154
|
-
|
90155
|
-
};
|
90294
|
+
discardStdin: true
|
90295
|
+
}, options);
|
90156
90296
|
this.spinner = this.options.spinner;
|
90157
90297
|
this.color = this.options.color;
|
90158
90298
|
this.hideCursor = this.options.hideCursor !== false;
|
@@ -90369,14 +90509,14 @@ var require_ora2 = __commonJS({
|
|
90369
90509
|
}
|
90370
90510
|
const spinner = new Ora(options);
|
90371
90511
|
spinner.start();
|
90372
|
-
(
|
90512
|
+
(() => __async(exports, null, function* () {
|
90373
90513
|
try {
|
90374
|
-
|
90514
|
+
yield action2;
|
90375
90515
|
spinner.succeed();
|
90376
|
-
} catch {
|
90516
|
+
} catch (e) {
|
90377
90517
|
spinner.fail();
|
90378
90518
|
}
|
90379
|
-
})();
|
90519
|
+
}))();
|
90380
90520
|
return spinner;
|
90381
90521
|
};
|
90382
90522
|
}
|
@@ -101295,10 +101435,10 @@ var require_transform = __commonJS({
|
|
101295
101435
|
if (type !== "string" && type !== "number") {
|
101296
101436
|
throw Error("only support string or number schema");
|
101297
101437
|
}
|
101298
|
-
const questionValidate =
|
101438
|
+
const questionValidate = (field2, input) => __async(this, null, function* () {
|
101299
101439
|
if (fieldValidate) {
|
101300
101440
|
var _result$error;
|
101301
|
-
const result2 =
|
101441
|
+
const result2 = yield (0, _validator.validate)(input, (0, _lodash.isFunction)(fieldValidate) ? {
|
101302
101442
|
validator: fieldValidate
|
101303
101443
|
} : fieldValidate);
|
101304
101444
|
if ((_result$error = result2.error) !== null && _result$error !== void 0 && _result$error.length) {
|
@@ -101312,7 +101452,7 @@ var require_transform = __commonJS({
|
|
101312
101452
|
}
|
101313
101453
|
}
|
101314
101454
|
return true;
|
101315
|
-
};
|
101455
|
+
});
|
101316
101456
|
const result = {
|
101317
101457
|
name: field,
|
101318
101458
|
message: title || field,
|
@@ -101416,7 +101556,7 @@ var require_prompt2 = __commonJS({
|
|
101416
101556
|
}, scope));
|
101417
101557
|
return state;
|
101418
101558
|
};
|
101419
|
-
var handleXReactions =
|
101559
|
+
var handleXReactions = (xReactions, answers, items, item) => __async(exports, null, function* () {
|
101420
101560
|
let answer = {};
|
101421
101561
|
for (const xReaction of xReactions) {
|
101422
101562
|
const isActive = xReaction === null || xReaction === void 0 ? void 0 : xReaction.target;
|
@@ -101424,7 +101564,7 @@ var require_prompt2 = __commonJS({
|
|
101424
101564
|
if (isActive) {
|
101425
101565
|
var _xReaction$otherwise, _xReaction$fulfill;
|
101426
101566
|
if (answers[item.name] === void 0) {
|
101427
|
-
answer =
|
101567
|
+
answer = yield _inquirer.default.prompt(item);
|
101428
101568
|
answers[item.name] = answer[item.name];
|
101429
101569
|
}
|
101430
101570
|
const scope = {
|
@@ -101473,25 +101613,27 @@ var require_prompt2 = __commonJS({
|
|
101473
101613
|
}
|
101474
101614
|
}
|
101475
101615
|
if (answers[item.name] === void 0) {
|
101476
|
-
answer =
|
101616
|
+
answer = yield _inquirer.default.prompt(item);
|
101477
101617
|
}
|
101478
101618
|
return answer;
|
101479
|
-
};
|
101480
|
-
|
101481
|
-
|
101482
|
-
|
101483
|
-
|
101484
|
-
|
101485
|
-
|
101486
|
-
|
101487
|
-
|
101488
|
-
|
101489
|
-
|
101490
|
-
|
101619
|
+
});
|
101620
|
+
function prompt(_0) {
|
101621
|
+
return __async(this, arguments, function* (schema, configValue = {}, validateMap, initValue) {
|
101622
|
+
const questions = (0, _transform.transformForm)(schema, configValue, validateMap, initValue);
|
101623
|
+
let answers = configValue;
|
101624
|
+
for (const question of questions) {
|
101625
|
+
var _question$origin;
|
101626
|
+
const xReactions = (question === null || question === void 0 ? void 0 : (_question$origin = question.origin) === null || _question$origin === void 0 ? void 0 : _question$origin["x-reactions"]) || [];
|
101627
|
+
let answer = {};
|
101628
|
+
if (xReactions.length) {
|
101629
|
+
answer = yield handleXReactions(xReactions, answers, questions, question);
|
101630
|
+
} else {
|
101631
|
+
answer = yield _inquirer.default.prompt(question);
|
101632
|
+
}
|
101633
|
+
answers = _objectSpread(_objectSpread({}, answers), answer);
|
101491
101634
|
}
|
101492
|
-
|
101493
|
-
}
|
101494
|
-
return answers;
|
101635
|
+
return answers;
|
101636
|
+
});
|
101495
101637
|
}
|
101496
101638
|
}
|
101497
101639
|
});
|
@@ -101555,13 +101697,15 @@ var require_inquirer2 = __commonJS({
|
|
101555
101697
|
setAnswers(answers) {
|
101556
101698
|
this.answers = _objectSpread(_objectSpread({}, this.answers), answers);
|
101557
101699
|
}
|
101558
|
-
|
101559
|
-
|
101560
|
-
|
101561
|
-
|
101562
|
-
|
101563
|
-
|
101564
|
-
|
101700
|
+
start() {
|
101701
|
+
return __async(this, null, function* () {
|
101702
|
+
if (!this.schema) {
|
101703
|
+
throw Error("schema is not valid");
|
101704
|
+
}
|
101705
|
+
const answers = yield (0, _prompt.prompt)(this.schema, this.answers, this.validateMap, this.initValue);
|
101706
|
+
this.setAnswers(answers);
|
101707
|
+
return answers;
|
101708
|
+
});
|
101565
101709
|
}
|
101566
101710
|
};
|
101567
101711
|
exports.CLIReader = CLIReader;
|
@@ -101621,15 +101765,17 @@ var require_node7 = __commonJS({
|
|
101621
101765
|
this.generatorContext.config = (0, _lodash.merge)(this.generatorContext.config, inputData);
|
101622
101766
|
return inputData;
|
101623
101767
|
}
|
101624
|
-
|
101625
|
-
|
101626
|
-
|
101627
|
-
|
101628
|
-
|
101768
|
+
getInputBySchemaFunc(_0) {
|
101769
|
+
return __async(this, arguments, function* (schemaFunc, configValue = {}, validateMap = {}, initValue = {}) {
|
101770
|
+
const reader = new _inquirer.CLIReader({
|
101771
|
+
schema: schemaFunc(configValue),
|
101772
|
+
validateMap,
|
101773
|
+
initValue
|
101774
|
+
});
|
101775
|
+
reader.setAnswers(configValue);
|
101776
|
+
const answers = yield reader.start();
|
101777
|
+
return this.mergeAnswers(answers, configValue);
|
101629
101778
|
});
|
101630
|
-
reader.setAnswers(configValue);
|
101631
|
-
const answers = await reader.start();
|
101632
|
-
return this.mergeAnswers(answers, configValue);
|
101633
101779
|
}
|
101634
101780
|
};
|
101635
101781
|
exports.FormilyAPI = FormilyAPI;
|
@@ -102085,7 +102231,7 @@ var require_prompt3 = __commonJS({
|
|
102085
102231
|
if (_.isPlainObject(questions)) {
|
102086
102232
|
questions = Object.values(questions).every(
|
102087
102233
|
(v) => _.isPlainObject(v) && v.name === void 0
|
102088
|
-
) ? Object.entries(questions).map(([name, question]) => ({ name,
|
102234
|
+
) ? Object.entries(questions).map(([name, question]) => __spreadValues({ name }, question)) : [questions];
|
102089
102235
|
}
|
102090
102236
|
const obs = _.isArray(questions) ? from(questions) : questions;
|
102091
102237
|
this.process = obs.pipe(
|
@@ -104269,9 +104415,9 @@ var require_transform2 = __commonJS({
|
|
104269
104415
|
for (const question of questions) {
|
104270
104416
|
question.default = initValue[question.name] || question.default;
|
104271
104417
|
const originValidate = question.validate;
|
104272
|
-
question.validate =
|
104418
|
+
question.validate = (input, answers) => __async(this, null, function* () {
|
104273
104419
|
if (originValidate) {
|
104274
|
-
const result =
|
104420
|
+
const result = yield originValidate(input, answers);
|
104275
104421
|
if ((0, _lodash.isString)(result)) {
|
104276
104422
|
return result;
|
104277
104423
|
}
|
@@ -104283,7 +104429,7 @@ var require_transform2 = __commonJS({
|
|
104283
104429
|
}
|
104284
104430
|
}
|
104285
104431
|
return true;
|
104286
|
-
};
|
104432
|
+
});
|
104287
104433
|
if (configValue[question.name]) {
|
104288
104434
|
question.when = false;
|
104289
104435
|
}
|
@@ -104320,36 +104466,40 @@ var require_checkUseNvm = __commonJS({
|
|
104320
104466
|
"lts/gallium": 16,
|
104321
104467
|
"lts/hydrogen": 18
|
104322
104468
|
};
|
104323
|
-
|
104324
|
-
|
104325
|
-
|
104469
|
+
function getNoteVersion() {
|
104470
|
+
return __async(this, null, function* () {
|
104471
|
+
const result = yield (0, _utils.execa)("node", ["--version"]);
|
104472
|
+
return result.stdout.slice(1);
|
104473
|
+
});
|
104326
104474
|
}
|
104327
|
-
|
104328
|
-
|
104329
|
-
|
104330
|
-
|
104331
|
-
|
104332
|
-
|
104333
|
-
|
104334
|
-
|
104335
|
-
|
104336
|
-
|
104337
|
-
|
104338
|
-
|
104339
|
-
|
104340
|
-
|
104341
|
-
|
104342
|
-
|
104343
|
-
|
104344
|
-
|
104345
|
-
|
104346
|
-
|
104347
|
-
|
104348
|
-
|
104349
|
-
|
104350
|
-
|
104351
|
-
|
104352
|
-
|
104475
|
+
function checkUseNvm(cwd, logger) {
|
104476
|
+
return __async(this, null, function* () {
|
104477
|
+
if (process.platform.startsWith("win")) {
|
104478
|
+
return false;
|
104479
|
+
}
|
104480
|
+
if (!(yield (0, _codesmith.fsExists)(_path.default.join(cwd, ".nvmrc")))) {
|
104481
|
+
return false;
|
104482
|
+
}
|
104483
|
+
const nvmrcContent = (yield _utils.fs.readFile(_path.default.join(cwd, ".nvmrc"), "utf-8")).replace("\n", "");
|
104484
|
+
const expectNodeVersion = NODE_MAJOR_VERSION_MAP[nvmrcContent] || nvmrcContent;
|
104485
|
+
const currentNodeVersion = yield getNoteVersion();
|
104486
|
+
if (expectNodeVersion === _utils.semver.major(currentNodeVersion)) {
|
104487
|
+
return false;
|
104488
|
+
}
|
104489
|
+
if (!(yield (0, _codesmithApiNpm.canUseNvm)())) {
|
104490
|
+
logger.warn(`current node version is not expect, you should install ${expectNodeVersion}`);
|
104491
|
+
return false;
|
104492
|
+
}
|
104493
|
+
try {
|
104494
|
+
yield (0, _codesmithApiNpm.execaWithStreamLog)("source ~/.nvm/nvm.sh && nvm install", [], {
|
104495
|
+
shell: true,
|
104496
|
+
cwd
|
104497
|
+
});
|
104498
|
+
return true;
|
104499
|
+
} catch (e) {
|
104500
|
+
return false;
|
104501
|
+
}
|
104502
|
+
});
|
104353
104503
|
}
|
104354
104504
|
}
|
104355
104505
|
});
|
@@ -104425,199 +104575,217 @@ var require_node9 = __commonJS({
|
|
104425
104575
|
this.ejsAPI = new _codesmithApiEjs.EjsAPI(generatorCore);
|
104426
104576
|
this.fsAPI = new _codesmithApiFs.FsAPI(generatorCore);
|
104427
104577
|
}
|
104428
|
-
|
104429
|
-
|
104430
|
-
|
104431
|
-
|
104432
|
-
|
104433
|
-
if (!await (0, _codesmithApiNpm.canUseYarn)() && !await (0, _codesmithApiNpm.canUsePnpm)() && !await (0, _codesmithApiNpm.canUseNpm)()) {
|
104434
|
-
this.generatorCore.logger.debug("can't use yarn or pnpm or npm");
|
104435
|
-
this.generatorCore.logger.warn(_locale.i18n.t(_locale.localeKeys.environment.yarn_pnpm_npm));
|
104436
|
-
return false;
|
104437
|
-
}
|
104438
|
-
return true;
|
104439
|
-
}
|
104440
|
-
async runInstall(command, options) {
|
104441
|
-
const {
|
104442
|
-
config: {
|
104443
|
-
packageManager,
|
104444
|
-
noNeedInstall,
|
104445
|
-
noNeedCheckNvm
|
104578
|
+
checkEnvironment(nodeVersion) {
|
104579
|
+
return __async(this, null, function* () {
|
104580
|
+
if (_utils.semver.lt(process.versions.node, nodeVersion || "12.22.12")) {
|
104581
|
+
this.generatorCore.logger.warn(_locale.i18n.t(_locale.localeKeys.environment.node_version));
|
104582
|
+
return false;
|
104446
104583
|
}
|
104447
|
-
|
104448
|
-
|
104449
|
-
|
104450
|
-
|
104451
|
-
|
104452
|
-
|
104453
|
-
|
104454
|
-
}
|
104455
|
-
let intallPromise;
|
104456
|
-
if (command) {
|
104457
|
-
intallPromise = (0, _utils.execa)(command);
|
104458
|
-
} else if (packageManager === "pnpm") {
|
104459
|
-
intallPromise = this.npmApi.pnpmInstall(_objectSpread(_objectSpread({}, options || {}), {}, {
|
104460
|
-
useNvm
|
104461
|
-
}));
|
104462
|
-
} else if (packageManager === "yarn") {
|
104463
|
-
intallPromise = this.npmApi.yarnInstall(_objectSpread(_objectSpread({}, options || {}), {}, {
|
104464
|
-
useNvm
|
104465
|
-
}));
|
104466
|
-
} else {
|
104467
|
-
intallPromise = this.npmApi.npmInstall(_objectSpread(_objectSpread({}, options || {}), {}, {
|
104468
|
-
useNvm
|
104469
|
-
}));
|
104470
|
-
}
|
104471
|
-
try {
|
104472
|
-
await intallPromise;
|
104473
|
-
this.generatorCore.logger.info(_locale.i18n.t(_locale.localeKeys.install.success));
|
104474
|
-
} catch (e) {
|
104475
|
-
this.generatorCore.logger.warn(_locale.i18n.t(_locale.localeKeys.install.failed, {
|
104476
|
-
command: command || `${packageManager} install`
|
104477
|
-
}));
|
104478
|
-
}
|
104584
|
+
if (!(yield (0, _codesmithApiNpm.canUseYarn)()) && !(yield (0, _codesmithApiNpm.canUsePnpm)()) && !(yield (0, _codesmithApiNpm.canUseNpm)())) {
|
104585
|
+
this.generatorCore.logger.debug("can't use yarn or pnpm or npm");
|
104586
|
+
this.generatorCore.logger.warn(_locale.i18n.t(_locale.localeKeys.environment.yarn_pnpm_npm));
|
104587
|
+
return false;
|
104588
|
+
}
|
104589
|
+
return true;
|
104590
|
+
});
|
104479
104591
|
}
|
104480
|
-
|
104481
|
-
|
104482
|
-
|
104483
|
-
|
104484
|
-
|
104592
|
+
runInstall(command, options) {
|
104593
|
+
return __async(this, null, function* () {
|
104594
|
+
const {
|
104595
|
+
config: {
|
104596
|
+
packageManager,
|
104597
|
+
noNeedInstall,
|
104598
|
+
noNeedCheckNvm
|
104599
|
+
}
|
104600
|
+
} = this.generatorContext;
|
104601
|
+
if (noNeedInstall || process.env.NoNeedInstall === "true") {
|
104602
|
+
return;
|
104485
104603
|
}
|
104486
|
-
|
104487
|
-
|
104488
|
-
|
104489
|
-
|
104490
|
-
|
104491
|
-
|
104492
|
-
|
104493
|
-
if (
|
104494
|
-
|
104604
|
+
let useNvm = false;
|
104605
|
+
if (!noNeedCheckNvm && process.env.NoNeedCheckNvm !== "true") {
|
104606
|
+
useNvm = yield (0, _checkUseNvm.checkUseNvm)((options === null || options === void 0 ? void 0 : options.cwd) || this.generatorCore.outputPath, this.generatorCore.logger);
|
104607
|
+
}
|
104608
|
+
let intallPromise;
|
104609
|
+
if (command) {
|
104610
|
+
intallPromise = (0, _utils.execa)(command);
|
104611
|
+
} else if (packageManager === "pnpm") {
|
104612
|
+
intallPromise = this.npmApi.pnpmInstall(_objectSpread(_objectSpread({}, options || {}), {}, {
|
104613
|
+
useNvm
|
104614
|
+
}));
|
104615
|
+
} else if (packageManager === "yarn") {
|
104616
|
+
intallPromise = this.npmApi.yarnInstall(_objectSpread(_objectSpread({}, options || {}), {}, {
|
104617
|
+
useNvm
|
104618
|
+
}));
|
104495
104619
|
} else {
|
104496
|
-
|
104620
|
+
intallPromise = this.npmApi.npmInstall(_objectSpread(_objectSpread({}, options || {}), {}, {
|
104621
|
+
useNvm
|
104622
|
+
}));
|
104497
104623
|
}
|
104498
|
-
|
104499
|
-
|
104500
|
-
|
104501
|
-
|
104502
|
-
|
104503
|
-
|
104504
|
-
|
104505
|
-
this.generatorCore.logger.info(_locale.i18n.t(_locale.localeKeys.git.success));
|
104624
|
+
try {
|
104625
|
+
yield intallPromise;
|
104626
|
+
this.generatorCore.logger.info(_locale.i18n.t(_locale.localeKeys.install.success));
|
104627
|
+
} catch (e) {
|
104628
|
+
this.generatorCore.logger.warn(_locale.i18n.t(_locale.localeKeys.install.failed, {
|
104629
|
+
command: command || `${packageManager} install`
|
104630
|
+
}));
|
104506
104631
|
}
|
104507
|
-
}
|
104508
|
-
this.generatorCore.logger.debug("Git repository create failed", e);
|
104509
|
-
this.generatorCore.logger.warn(_locale.i18n.t(_locale.localeKeys.git.failed));
|
104510
|
-
}
|
104632
|
+
});
|
104511
104633
|
}
|
104512
|
-
|
104513
|
-
|
104634
|
+
runGitAndInstall(commitMessage, installFunc) {
|
104635
|
+
return __async(this, null, function* () {
|
104514
104636
|
const {
|
104515
|
-
|
104516
|
-
|
104517
|
-
|
104518
|
-
|
104519
|
-
|
104520
|
-
|
104521
|
-
|
104522
|
-
|
104523
|
-
|
104524
|
-
this.generatorCore.logger.debug(`[renderDir] resourceKey=${resourceKey}`);
|
104525
|
-
const target = rename ? rename(resourceKey) : resourceKey.replace(`templates/`, "").replace(".handlebars", "");
|
104526
|
-
await api.renderTemplate(material.get(resourceKey), target, _objectSpread(_objectSpread({}, this.generatorContext.data || {}), parameters || {}));
|
104527
|
-
}));
|
104637
|
+
config: {
|
104638
|
+
isMonorepoSubProject = false,
|
104639
|
+
noNeedGit
|
104640
|
+
}
|
104641
|
+
} = this.generatorContext;
|
104642
|
+
const customNoNeedGit = noNeedGit || process.env.NoNeedGit === "true";
|
104643
|
+
const inGitRepo = isMonorepoSubProject || (yield this.gitApi.isInGitRepo());
|
104644
|
+
if (!inGitRepo && !customNoNeedGit) {
|
104645
|
+
yield this.gitApi.initGitRepo();
|
104528
104646
|
}
|
104529
|
-
|
104530
|
-
|
104531
|
-
|
104532
|
-
|
104533
|
-
|
104647
|
+
try {
|
104648
|
+
if (installFunc) {
|
104649
|
+
yield installFunc();
|
104650
|
+
} else {
|
104651
|
+
yield this.runInstall();
|
104652
|
+
}
|
104653
|
+
} catch (e) {
|
104654
|
+
this.generatorCore.logger.debug("Dependencies install failed", e);
|
104655
|
+
this.generatorCore.logger.warn(_locale.i18n.t(_locale.localeKeys.install.failed_no_command));
|
104656
|
+
}
|
104657
|
+
try {
|
104658
|
+
if (!isMonorepoSubProject && !customNoNeedGit) {
|
104659
|
+
yield this.gitApi.addAndCommit(commitMessage || "feat: init");
|
104660
|
+
this.generatorCore.logger.info(_locale.i18n.t(_locale.localeKeys.git.success));
|
104661
|
+
}
|
104662
|
+
} catch (e) {
|
104663
|
+
this.generatorCore.logger.debug("Git repository create failed", e);
|
104664
|
+
this.generatorCore.logger.warn(_locale.i18n.t(_locale.localeKeys.git.failed));
|
104665
|
+
}
|
104666
|
+
});
|
104534
104667
|
}
|
104535
|
-
|
104536
|
-
|
104537
|
-
|
104538
|
-
|
104539
|
-
|
104540
|
-
|
104541
|
-
|
104542
|
-
|
104543
|
-
|
104544
|
-
|
104545
|
-
|
104546
|
-
this.
|
104547
|
-
|
104668
|
+
forgeTemplate(templatePattern, filter, rename, parameters, type = "handlebars") {
|
104669
|
+
return __async(this, null, function* () {
|
104670
|
+
try {
|
104671
|
+
const {
|
104672
|
+
material
|
104673
|
+
} = this.generatorContext.current;
|
104674
|
+
const resourceMap = yield material.find(templatePattern, {
|
104675
|
+
nodir: true,
|
104676
|
+
dot: true
|
104677
|
+
});
|
104678
|
+
if (resourceMap) {
|
104679
|
+
const api = type === "ejs" ? this.ejsAPI : this.handlebarsAPI;
|
104680
|
+
yield Promise.all(Object.keys(resourceMap).filter((resourceKey) => filter ? filter(resourceKey) : true).map((resourceKey) => __async(this, null, function* () {
|
104681
|
+
this.generatorCore.logger.debug(`[renderDir] resourceKey=${resourceKey}`);
|
104548
104682
|
const target = rename ? rename(resourceKey) : resourceKey.replace(`templates/`, "").replace(".handlebars", "");
|
104549
|
-
|
104550
|
-
}
|
104551
|
-
|
104552
|
-
|
104553
|
-
|
104554
|
-
|
104555
|
-
|
104556
|
-
}
|
104557
|
-
}));
|
104683
|
+
yield api.renderTemplate(material.get(resourceKey), target, _objectSpread(_objectSpread({}, this.generatorContext.data || {}), parameters || {}));
|
104684
|
+
})));
|
104685
|
+
}
|
104686
|
+
} catch (e) {
|
104687
|
+
this.generatorCore.logger.debug("base forging failed:", e);
|
104688
|
+
this.generatorCore.logger.warn(_locale.i18n.t(_locale.localeKeys.templated.failed));
|
104689
|
+
throw new Error("base forging failed");
|
104558
104690
|
}
|
104559
|
-
}
|
104560
|
-
this.generatorCore.logger.debug("base forging failed:", e);
|
104561
|
-
this.generatorCore.logger.warn(_locale.i18n.t(_locale.localeKeys.templated.failed));
|
104562
|
-
throw new Error("base forging failed");
|
104563
|
-
}
|
104691
|
+
});
|
104564
104692
|
}
|
104565
|
-
|
104566
|
-
|
104567
|
-
|
104568
|
-
|
104569
|
-
|
104570
|
-
|
104571
|
-
|
104572
|
-
|
104573
|
-
|
104574
|
-
|
104575
|
-
|
104576
|
-
|
104577
|
-
|
104693
|
+
renderTemplateByFileType(templatePattern, filter, rename, parameters) {
|
104694
|
+
return __async(this, null, function* () {
|
104695
|
+
try {
|
104696
|
+
const {
|
104697
|
+
material
|
104698
|
+
} = this.generatorContext.current;
|
104699
|
+
const resourceMap = yield material.find(templatePattern, {
|
104700
|
+
nodir: true,
|
104701
|
+
dot: true
|
104702
|
+
});
|
104703
|
+
if (resourceMap) {
|
104704
|
+
yield Promise.all(Object.keys(resourceMap).filter((resourceKey) => filter ? filter(resourceKey) : true).map((resourceKey) => __async(this, null, function* () {
|
104705
|
+
this.generatorCore.logger.debug(`[renderDir] resourceKey=${resourceKey}`);
|
104706
|
+
if (resourceKey.includes(".handlebars")) {
|
104707
|
+
const target = rename ? rename(resourceKey) : resourceKey.replace(`templates/`, "").replace(".handlebars", "");
|
104708
|
+
yield this.handlebarsAPI.renderTemplate(material.get(resourceKey), target, _objectSpread(_objectSpread({}, this.generatorContext.data || {}), parameters || {}));
|
104709
|
+
} else if (resourceKey.includes(".ejs")) {
|
104710
|
+
const target = rename ? rename(resourceKey) : resourceKey.replace(`templates/`, "").replace(".ejs", "");
|
104711
|
+
yield this.ejsAPI.renderTemplate(material.get(resourceKey), target, _objectSpread(_objectSpread({}, this.generatorContext.data || {}), parameters || {}));
|
104712
|
+
} else {
|
104713
|
+
const target = rename ? rename(resourceKey) : resourceKey.replace(`templates/`, "");
|
104714
|
+
yield this.fsAPI.renderFile(material.get(resourceKey), target);
|
104715
|
+
}
|
104716
|
+
})));
|
104717
|
+
}
|
104718
|
+
} catch (e) {
|
104719
|
+
this.generatorCore.logger.debug("base forging failed:", e);
|
104720
|
+
this.generatorCore.logger.warn(_locale.i18n.t(_locale.localeKeys.templated.failed));
|
104721
|
+
throw new Error("base forging failed");
|
104722
|
+
}
|
104723
|
+
});
|
104724
|
+
}
|
104725
|
+
updateWorkspace(folder, workspaceName = "monorepo.code-workspace") {
|
104726
|
+
return __async(this, null, function* () {
|
104727
|
+
const {
|
104728
|
+
filePath
|
104729
|
+
} = this.generatorContext.materials.default.get(workspaceName);
|
104730
|
+
if (!_utils.fs.existsSync(filePath)) {
|
104731
|
+
return;
|
104732
|
+
}
|
104733
|
+
const content = yield _utils.fs.readFile(filePath);
|
104734
|
+
const workspace = (0, _commentJson.parse)(content.toString());
|
104735
|
+
workspace.folders = [folder, ...workspace.folders || []];
|
104736
|
+
const indent = 2;
|
104737
|
+
yield _utils.fs.writeFile(filePath, (0, _commentJson.stringify)(workspace, null, indent), {
|
104738
|
+
encoding: "utf-8"
|
104739
|
+
});
|
104578
104740
|
});
|
104579
104741
|
}
|
104580
104742
|
showSuccessInfo(successInfo) {
|
104581
104743
|
this.generatorCore.logger.info(successInfo || _locale.i18n.t(_locale.localeKeys.success.info));
|
104582
104744
|
}
|
104583
|
-
|
104584
|
-
|
104585
|
-
|
104586
|
-
|
104587
|
-
|
104588
|
-
|
104589
|
-
|
104590
|
-
|
104745
|
+
runSubGenerator(subGenerator, relativePwdPath, config) {
|
104746
|
+
return __async(this, null, function* () {
|
104747
|
+
try {
|
104748
|
+
yield this.generatorCore.runSubGenerator(subGenerator, relativePwdPath, config);
|
104749
|
+
} catch (e) {
|
104750
|
+
this.generatorCore.logger.warn(_locale.i18n.t(_locale.localeKeys.generator.failed));
|
104751
|
+
this.generatorCore.logger.debug(_locale.i18n.t(_locale.localeKeys.generator.failed), e);
|
104752
|
+
throw new Error("run sub generator failed");
|
104753
|
+
}
|
104754
|
+
});
|
104591
104755
|
}
|
104592
104756
|
mergeAnswers(answers, configValue) {
|
104593
104757
|
const inputData = (0, _lodash.merge)(answers, configValue);
|
104594
104758
|
this.generatorContext.config = (0, _lodash.merge)(this.generatorContext.config, inputData);
|
104595
104759
|
return inputData;
|
104596
104760
|
}
|
104597
|
-
|
104598
|
-
|
104599
|
-
schema: schemaFunc(configValue),
|
104600
|
-
validateMap,
|
104601
|
-
initValue
|
104602
|
-
});
|
104603
|
-
reader.setAnswers(configValue);
|
104604
|
-
const answers = await reader.start();
|
104605
|
-
return this.mergeAnswers(answers, configValue);
|
104606
|
-
}
|
104607
|
-
async getInputBySchema(schema, type = "formily", configValue = {}, validateMap = {}, initValue = {}) {
|
104608
|
-
if (type === "formily") {
|
104761
|
+
getInputBySchemaFunc(_0) {
|
104762
|
+
return __async(this, arguments, function* (schemaFunc, configValue = {}, validateMap = {}, initValue = {}) {
|
104609
104763
|
const reader = new _codesmithFormily.CLIReader({
|
104610
|
-
schema,
|
104764
|
+
schema: schemaFunc(configValue),
|
104611
104765
|
validateMap,
|
104612
104766
|
initValue
|
104613
104767
|
});
|
104614
104768
|
reader.setAnswers(configValue);
|
104615
|
-
const answers =
|
104769
|
+
const answers = yield reader.start();
|
104616
104770
|
return this.mergeAnswers(answers, configValue);
|
104617
|
-
}
|
104618
|
-
|
104619
|
-
|
104620
|
-
}
|
104771
|
+
});
|
104772
|
+
}
|
104773
|
+
getInputBySchema(_0) {
|
104774
|
+
return __async(this, arguments, function* (schema, type = "formily", configValue = {}, validateMap = {}, initValue = {}) {
|
104775
|
+
if (type === "formily") {
|
104776
|
+
const reader = new _codesmithFormily.CLIReader({
|
104777
|
+
schema,
|
104778
|
+
validateMap,
|
104779
|
+
initValue
|
104780
|
+
});
|
104781
|
+
reader.setAnswers(configValue);
|
104782
|
+
const answers = yield reader.start();
|
104783
|
+
return this.mergeAnswers(answers, configValue);
|
104784
|
+
} else {
|
104785
|
+
const answers = yield _inquirer.default.prompt((0, _transform.transformInquirerSchema)(schema, configValue, validateMap, initValue));
|
104786
|
+
return this.mergeAnswers(answers, configValue);
|
104787
|
+
}
|
104788
|
+
});
|
104621
104789
|
}
|
104622
104790
|
};
|
104623
104791
|
exports.AppAPI = AppAPI2;
|
@@ -104907,43 +105075,42 @@ var getGeneratorPath = (generator, distTag) => {
|
|
104907
105075
|
}
|
104908
105076
|
return generator;
|
104909
105077
|
};
|
104910
|
-
var handleTemplateFile =
|
105078
|
+
var handleTemplateFile = (context, generator, appApi) => __async(void 0, null, function* () {
|
104911
105079
|
const { dependencies, peerDependencies, devDependencies } = context.config;
|
104912
105080
|
const tailwindVersion = "~3.2.4";
|
104913
|
-
if (dependencies
|
105081
|
+
if (dependencies == null ? void 0 : dependencies.tailwindcss) {
|
104914
105082
|
dependencies.tailwindcss = tailwindVersion;
|
104915
105083
|
}
|
104916
|
-
if (peerDependencies
|
105084
|
+
if (peerDependencies == null ? void 0 : peerDependencies.tailwindcss) {
|
104917
105085
|
peerDependencies.tailwindcss = tailwindVersion;
|
104918
105086
|
}
|
104919
|
-
if (devDependencies
|
105087
|
+
if (devDependencies == null ? void 0 : devDependencies.tailwindcss) {
|
104920
105088
|
devDependencies.tailwindcss = tailwindVersion;
|
104921
105089
|
}
|
104922
|
-
|
105090
|
+
yield appApi.runSubGenerator(
|
104923
105091
|
getGeneratorPath(DependenceGenerator, context.config.distTag),
|
104924
105092
|
void 0,
|
104925
|
-
{
|
104926
|
-
...context.config,
|
105093
|
+
__spreadProps(__spreadValues({}, context.config), {
|
104927
105094
|
dependencies,
|
104928
105095
|
devDependencies,
|
104929
105096
|
peerDependencies
|
104930
|
-
}
|
105097
|
+
})
|
104931
105098
|
);
|
104932
|
-
};
|
104933
|
-
var src_default =
|
105099
|
+
});
|
105100
|
+
var src_default = (context, generator) => __async(void 0, null, function* () {
|
104934
105101
|
const appApi = new import_codesmith_api_app.AppAPI(context, generator);
|
104935
105102
|
const { locale } = context.config;
|
104936
105103
|
i18n.changeLanguage({ locale });
|
104937
105104
|
appApi.i18n.changeLanguage({ locale });
|
104938
|
-
if (!
|
105105
|
+
if (!(yield appApi.checkEnvironment())) {
|
104939
105106
|
process.exit(1);
|
104940
105107
|
}
|
104941
105108
|
generator.logger.debug(`start run @modern-js/tailwindcss-generator`);
|
104942
105109
|
generator.logger.debug(`context=${JSON.stringify(context)}`);
|
104943
105110
|
generator.logger.debug(`context.data=${JSON.stringify(context.data)}`);
|
104944
|
-
|
105111
|
+
yield handleTemplateFile(context, generator, appApi);
|
104945
105112
|
generator.logger.debug(`forge @modern-js/tailwindcss-generator succeed `);
|
104946
|
-
};
|
105113
|
+
});
|
104947
105114
|
// Annotate the CommonJS export names for ESM import in node:
|
104948
105115
|
0 && (module.exports = {
|
104949
105116
|
handleTemplateFile
|