@weapp-core/init 1.1.15 → 1.1.17
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.cjs +261 -60
- package/dist/index.js +260 -59
- package/package.json +6 -6
- package/templates/default/README.md +2 -2
- package/templates/default/package.json +3 -3
- package/templates/default/project.private.config.json +2 -1
- package/templates/default/src/app.json +1 -1
- package/templates/default/src/components/Navbar/Navbar.json +1 -1
- package/templates/default/src/pages/index/index.json +1 -1
- package/templates/default/src/sitemap.json +1 -1
- package/templates/default/src/theme.json +1 -1
- package/templates/default/vite.config.ts +1 -1
- package/templates/tailwindcss/README.md +2 -2
- package/templates/tailwindcss/package.json +8 -8
- package/templates/tailwindcss/project.private.config.json +2 -1
- package/templates/tailwindcss/src/app.json +1 -1
- package/templates/tailwindcss/src/components/Navbar/Navbar.json +1 -1
- package/templates/tailwindcss/src/pages/index/index.json +1 -1
- package/templates/tailwindcss/src/pages/index/index.wxml +6 -6
- package/templates/tailwindcss/src/sitemap.json +1 -1
- package/templates/tailwindcss/src/theme.json +1 -1
- package/templates/tailwindcss/vite.config.ts +1 -1
- package/templates/tdesign/README.md +2 -2
- package/templates/tdesign/package.json +11 -11
- package/templates/tdesign/project.private.config.json +2 -1
- package/templates/tdesign/src/app.json +1 -1
- package/templates/tdesign/src/components/Navbar/Navbar.json +1 -1
- package/templates/tdesign/src/pages/index/index.json +1 -1
- package/templates/tdesign/src/pages/index/index.wxml +4 -4
- package/templates/tdesign/src/sitemap.json +1 -1
- package/templates/tdesign/src/theme.json +1 -1
- package/templates/tdesign/vite.config.ts +1 -1
- package/templates/vant/README.md +2 -2
- package/templates/vant/package.json +11 -11
- package/templates/vant/project.private.config.json +2 -1
- package/templates/vant/src/app.json +1 -1
- package/templates/vant/src/components/Navbar/Navbar.json +1 -1
- package/templates/vant/src/pages/index/index.json +1 -1
- package/templates/vant/src/pages/index/index.wxml +4 -4
- package/templates/vant/src/sitemap.json +1 -1
- package/templates/vant/src/theme.json +1 -1
- package/templates/vant/vite.config.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -5,7 +5,172 @@ import logger from "@weapp-core/logger";
|
|
|
5
5
|
import { defu, get, set } from "@weapp-core/shared";
|
|
6
6
|
import fs from "fs-extra";
|
|
7
7
|
|
|
8
|
-
// ../../node_modules/.pnpm/pathe@
|
|
8
|
+
// ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
|
|
9
|
+
var _lazyMatch = () => {
|
|
10
|
+
var __lib__ = (() => {
|
|
11
|
+
var m = Object.defineProperty, V = Object.getOwnPropertyDescriptor, G = Object.getOwnPropertyNames, T = Object.prototype.hasOwnProperty, q = (r, e) => {
|
|
12
|
+
for (var n in e) m(r, n, { get: e[n], enumerable: true });
|
|
13
|
+
}, H = (r, e, n, a) => {
|
|
14
|
+
if (e && typeof e == "object" || typeof e == "function") for (let t of G(e)) !T.call(r, t) && t !== n && m(r, t, { get: () => e[t], enumerable: !(a = V(e, t)) || a.enumerable });
|
|
15
|
+
return r;
|
|
16
|
+
}, J = (r) => H(m({}, "__esModule", { value: true }), r), w = {};
|
|
17
|
+
q(w, { default: () => re });
|
|
18
|
+
var A = (r) => Array.isArray(r), d = (r) => typeof r == "function", Q = (r) => r.length === 0, W = (r) => typeof r == "number", K = (r) => typeof r == "object" && r !== null, X = (r) => r instanceof RegExp, b = (r) => typeof r == "string", h = (r) => r === void 0, Y = (r) => {
|
|
19
|
+
const e = /* @__PURE__ */ new Map();
|
|
20
|
+
return (n) => {
|
|
21
|
+
const a = e.get(n);
|
|
22
|
+
if (a) return a;
|
|
23
|
+
const t = r(n);
|
|
24
|
+
return e.set(n, t), t;
|
|
25
|
+
};
|
|
26
|
+
}, rr = (r, e, n = {}) => {
|
|
27
|
+
const a = { cache: {}, input: r, index: 0, indexMax: 0, options: n, output: [] };
|
|
28
|
+
if (v(e)(a) && a.index === r.length) return a.output;
|
|
29
|
+
throw new Error(`Failed to parse at index ${a.indexMax}`);
|
|
30
|
+
}, i = (r, e) => A(r) ? er(r, e) : b(r) ? ar(r, e) : nr(r, e), er = (r, e) => {
|
|
31
|
+
const n = {};
|
|
32
|
+
for (const a of r) {
|
|
33
|
+
if (a.length !== 1) throw new Error(`Invalid character: "${a}"`);
|
|
34
|
+
const t = a.charCodeAt(0);
|
|
35
|
+
n[t] = true;
|
|
36
|
+
}
|
|
37
|
+
return (a) => {
|
|
38
|
+
const t = a.index, o = a.input;
|
|
39
|
+
for (; a.index < o.length && o.charCodeAt(a.index) in n; ) a.index += 1;
|
|
40
|
+
const u = a.index;
|
|
41
|
+
if (u > t) {
|
|
42
|
+
if (!h(e) && !a.options.silent) {
|
|
43
|
+
const s = a.input.slice(t, u), c = d(e) ? e(s, o, String(t)) : e;
|
|
44
|
+
h(c) || a.output.push(c);
|
|
45
|
+
}
|
|
46
|
+
a.indexMax = Math.max(a.indexMax, a.index);
|
|
47
|
+
}
|
|
48
|
+
return true;
|
|
49
|
+
};
|
|
50
|
+
}, nr = (r, e) => {
|
|
51
|
+
const n = r.source, a = r.flags.replace(/y|$/, "y"), t = new RegExp(n, a);
|
|
52
|
+
return g((o) => {
|
|
53
|
+
t.lastIndex = o.index;
|
|
54
|
+
const u = t.exec(o.input);
|
|
55
|
+
if (u) {
|
|
56
|
+
if (!h(e) && !o.options.silent) {
|
|
57
|
+
const s = d(e) ? e(...u, o.input, String(o.index)) : e;
|
|
58
|
+
h(s) || o.output.push(s);
|
|
59
|
+
}
|
|
60
|
+
return o.index += u[0].length, o.indexMax = Math.max(o.indexMax, o.index), true;
|
|
61
|
+
} else return false;
|
|
62
|
+
});
|
|
63
|
+
}, ar = (r, e) => (n) => {
|
|
64
|
+
if (n.input.startsWith(r, n.index)) {
|
|
65
|
+
if (!h(e) && !n.options.silent) {
|
|
66
|
+
const t = d(e) ? e(r, n.input, String(n.index)) : e;
|
|
67
|
+
h(t) || n.output.push(t);
|
|
68
|
+
}
|
|
69
|
+
return n.index += r.length, n.indexMax = Math.max(n.indexMax, n.index), true;
|
|
70
|
+
} else return false;
|
|
71
|
+
}, C = (r, e, n, a) => {
|
|
72
|
+
const t = v(r);
|
|
73
|
+
return g(_(M((o) => {
|
|
74
|
+
let u = 0;
|
|
75
|
+
for (; u < n; ) {
|
|
76
|
+
const s = o.index;
|
|
77
|
+
if (!t(o) || (u += 1, o.index === s)) break;
|
|
78
|
+
}
|
|
79
|
+
return u >= e;
|
|
80
|
+
})));
|
|
81
|
+
}, tr = (r, e) => C(r, 0, 1), f = (r, e) => C(r, 0, 1 / 0), x = (r, e) => {
|
|
82
|
+
const n = r.map(v);
|
|
83
|
+
return g(_(M((a) => {
|
|
84
|
+
for (let t = 0, o = n.length; t < o; t++) if (!n[t](a)) return false;
|
|
85
|
+
return true;
|
|
86
|
+
})));
|
|
87
|
+
}, l = (r, e) => {
|
|
88
|
+
const n = r.map(v);
|
|
89
|
+
return g(_((a) => {
|
|
90
|
+
for (let t = 0, o = n.length; t < o; t++) if (n[t](a)) return true;
|
|
91
|
+
return false;
|
|
92
|
+
}));
|
|
93
|
+
}, M = (r, e = false) => {
|
|
94
|
+
const n = v(r);
|
|
95
|
+
return (a) => {
|
|
96
|
+
const t = a.index, o = a.output.length, u = n(a);
|
|
97
|
+
return (!u || e) && (a.index = t, a.output.length !== o && (a.output.length = o)), u;
|
|
98
|
+
};
|
|
99
|
+
}, _ = (r, e) => {
|
|
100
|
+
const n = v(r);
|
|
101
|
+
return n;
|
|
102
|
+
}, g = /* @__PURE__ */ (() => {
|
|
103
|
+
let r = 0;
|
|
104
|
+
return (e) => {
|
|
105
|
+
const n = v(e), a = r += 1;
|
|
106
|
+
return (t) => {
|
|
107
|
+
var o;
|
|
108
|
+
if (t.options.memoization === false) return n(t);
|
|
109
|
+
const u = t.index, s = (o = t.cache)[a] || (o[a] = /* @__PURE__ */ new Map()), c = s.get(u);
|
|
110
|
+
if (c === false) return false;
|
|
111
|
+
if (W(c)) return t.index = c, true;
|
|
112
|
+
if (c) return t.index = c.index, c.output?.length && t.output.push(...c.output), true;
|
|
113
|
+
{
|
|
114
|
+
const Z = t.output.length;
|
|
115
|
+
if (n(t)) {
|
|
116
|
+
const D = t.index, U = t.output.length;
|
|
117
|
+
if (U > Z) {
|
|
118
|
+
const ee = t.output.slice(Z, U);
|
|
119
|
+
s.set(u, { index: D, output: ee });
|
|
120
|
+
} else s.set(u, D);
|
|
121
|
+
return true;
|
|
122
|
+
} else return s.set(u, false), false;
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
})(), E = (r) => {
|
|
127
|
+
let e;
|
|
128
|
+
return (n) => (e || (e = v(r())), e(n));
|
|
129
|
+
}, v = Y((r) => {
|
|
130
|
+
if (d(r)) return Q(r) ? E(r) : r;
|
|
131
|
+
if (b(r) || X(r)) return i(r);
|
|
132
|
+
if (A(r)) return x(r);
|
|
133
|
+
if (K(r)) return l(Object.values(r));
|
|
134
|
+
throw new Error("Invalid rule");
|
|
135
|
+
}), P = "abcdefghijklmnopqrstuvwxyz", ir = (r) => {
|
|
136
|
+
let e = "";
|
|
137
|
+
for (; r > 0; ) {
|
|
138
|
+
const n = (r - 1) % 26;
|
|
139
|
+
e = P[n] + e, r = Math.floor((r - 1) / 26);
|
|
140
|
+
}
|
|
141
|
+
return e;
|
|
142
|
+
}, O = (r) => {
|
|
143
|
+
let e = 0;
|
|
144
|
+
for (let n = 0, a = r.length; n < a; n++) e = e * 26 + P.indexOf(r[n]) + 1;
|
|
145
|
+
return e;
|
|
146
|
+
}, S = (r, e) => {
|
|
147
|
+
if (e < r) return S(e, r);
|
|
148
|
+
const n = [];
|
|
149
|
+
for (; r <= e; ) n.push(r++);
|
|
150
|
+
return n;
|
|
151
|
+
}, or = (r, e, n) => S(r, e).map((a) => String(a).padStart(n, "0")), R = (r, e) => S(O(r), O(e)).map(ir), p = (r) => r, z = (r) => ur((e) => rr(e, r, { memoization: false }).join("")), ur = (r) => {
|
|
152
|
+
const e = {};
|
|
153
|
+
return (n) => e[n] ?? (e[n] = r(n));
|
|
154
|
+
}, sr = i(/^\*\*\/\*$/, ".*"), cr = i(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (r, e, n) => `.*${e ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}`), lr = i(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/, (r, e, n, a) => `.*${e ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}(?:${a.replaceAll(",", "|").replaceAll(".", "\\.")})`), y = i(/\\./, p), pr = i(/[$.*+?^(){}[\]\|]/, (r) => `\\${r}`), vr = i(/./, p), hr = i(/^(?:!!)*!(.*)$/, (r, e) => `(?!^${L(e)}$).*?`), dr = i(/^(!!)+/, ""), fr = l([hr, dr]), xr = i(/\/(\*\*\/)+/, "(?:/.+/|/)"), gr = i(/^(\*\*\/)+/, "(?:^|.*/)"), mr = i(/\/(\*\*)$/, "(?:/.*|$)"), _r = i(/\*\*/, ".*"), j = l([xr, gr, mr, _r]), Sr = i(/\*\/(?!\*\*\/)/, "[^/]*/"), yr = i(/\*/, "[^/]*"), N = l([Sr, yr]), k = i("?", "[^/]"), $r = i("[", p), wr = i("]", p), Ar = i(/[!^]/, "^/"), br = i(/[a-z]-[a-z]|[0-9]-[0-9]/i, p), Cr = i(/[$.*+?^(){}[\|]/, (r) => `\\${r}`), Mr = i(/[^\]]/, p), Er = l([y, Cr, br, Mr]), B = x([$r, tr(Ar), f(Er), wr]), Pr = i("{", "(?:"), Or = i("}", ")"), Rr = i(/(\d+)\.\.(\d+)/, (r, e, n) => or(+e, +n, Math.min(e.length, n.length)).join("|")), zr = i(/([a-z]+)\.\.([a-z]+)/, (r, e, n) => R(e, n).join("|")), jr = i(/([A-Z]+)\.\.([A-Z]+)/, (r, e, n) => R(e.toLowerCase(), n.toLowerCase()).join("|").toUpperCase()), Nr = l([Rr, zr, jr]), I = x([Pr, Nr, Or]), kr = i("{", "(?:"), Br = i("}", ")"), Ir = i(",", "|"), Fr = i(/[$.*+?^(){[\]\|]/, (r) => `\\${r}`), Lr = i(/[^}]/, p), Zr = E(() => F), Dr = l([j, N, k, B, I, Zr, y, Fr, Ir, Lr]), F = x([kr, f(Dr), Br]), Ur = f(l([sr, cr, lr, fr, j, N, k, B, I, F, y, pr, vr])), Vr = Ur, Gr = z(Vr), L = Gr, Tr = i(/\\./, p), qr = i(/./, p), Hr = i(/\*\*\*+/, "*"), Jr = i(/([^/{[(!])\*\*/, (r, e) => `${e}*`), Qr = i(/(^|.)\*\*(?=[^*/)\]}])/, (r, e) => `${e}*`), Wr = f(l([Tr, Hr, Jr, Qr, qr])), Kr = Wr, Xr = z(Kr), Yr = Xr, $ = (r, e) => {
|
|
155
|
+
const n = Array.isArray(r) ? r : [r];
|
|
156
|
+
if (!n.length) return false;
|
|
157
|
+
const a = n.map($.compile), t = n.every((s) => /(\/(?:\*\*)?|\[\/\])$/.test(s)), o = e.replace(/[\\\/]+/g, "/").replace(/\/$/, t ? "/" : "");
|
|
158
|
+
return a.some((s) => s.test(o));
|
|
159
|
+
};
|
|
160
|
+
$.compile = (r) => new RegExp(`^${L(Yr(r))}$`, "s");
|
|
161
|
+
var re = $;
|
|
162
|
+
return J(w);
|
|
163
|
+
})();
|
|
164
|
+
return __lib__.default || __lib__;
|
|
165
|
+
};
|
|
166
|
+
var _match;
|
|
167
|
+
var zeptomatch = (path, pattern) => {
|
|
168
|
+
if (!_match) {
|
|
169
|
+
_match = _lazyMatch();
|
|
170
|
+
_lazyMatch = null;
|
|
171
|
+
}
|
|
172
|
+
return _match(path, pattern);
|
|
173
|
+
};
|
|
9
174
|
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
10
175
|
function normalizeWindowsPath(input = "") {
|
|
11
176
|
if (!input) {
|
|
@@ -17,55 +182,58 @@ var _UNC_REGEX = /^[/\\]{2}/;
|
|
|
17
182
|
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
18
183
|
var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
19
184
|
var _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
|
|
185
|
+
var _EXTNAME_RE = /.(\.[^./]+|\.)$/;
|
|
186
|
+
var _PATH_ROOT_RE = /^[/\\]|^[a-zA-Z]:[/\\]/;
|
|
20
187
|
var sep = "/";
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
if (path2.length === 0) {
|
|
188
|
+
var normalize = function(path) {
|
|
189
|
+
if (path.length === 0) {
|
|
24
190
|
return ".";
|
|
25
191
|
}
|
|
26
|
-
|
|
27
|
-
const isUNCPath =
|
|
28
|
-
const isPathAbsolute = isAbsolute(
|
|
29
|
-
const trailingSeparator =
|
|
30
|
-
|
|
31
|
-
if (
|
|
192
|
+
path = normalizeWindowsPath(path);
|
|
193
|
+
const isUNCPath = path.match(_UNC_REGEX);
|
|
194
|
+
const isPathAbsolute = isAbsolute(path);
|
|
195
|
+
const trailingSeparator = path[path.length - 1] === "/";
|
|
196
|
+
path = normalizeString(path, !isPathAbsolute);
|
|
197
|
+
if (path.length === 0) {
|
|
32
198
|
if (isPathAbsolute) {
|
|
33
199
|
return "/";
|
|
34
200
|
}
|
|
35
201
|
return trailingSeparator ? "./" : ".";
|
|
36
202
|
}
|
|
37
203
|
if (trailingSeparator) {
|
|
38
|
-
|
|
204
|
+
path += "/";
|
|
39
205
|
}
|
|
40
|
-
if (_DRIVE_LETTER_RE.test(
|
|
41
|
-
|
|
206
|
+
if (_DRIVE_LETTER_RE.test(path)) {
|
|
207
|
+
path += "/";
|
|
42
208
|
}
|
|
43
209
|
if (isUNCPath) {
|
|
44
210
|
if (!isPathAbsolute) {
|
|
45
|
-
return `//./${
|
|
211
|
+
return `//./${path}`;
|
|
46
212
|
}
|
|
47
|
-
return `//${
|
|
213
|
+
return `//${path}`;
|
|
48
214
|
}
|
|
49
|
-
return isPathAbsolute && !isAbsolute(
|
|
215
|
+
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
|
50
216
|
};
|
|
51
|
-
var join = function(...
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (
|
|
58
|
-
|
|
59
|
-
|
|
217
|
+
var join = function(...segments) {
|
|
218
|
+
let path = "";
|
|
219
|
+
for (const seg of segments) {
|
|
220
|
+
if (!seg) {
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
if (path.length > 0) {
|
|
224
|
+
const pathTrailing = path[path.length - 1] === "/";
|
|
225
|
+
const segLeading = seg[0] === "/";
|
|
226
|
+
const both = pathTrailing && segLeading;
|
|
227
|
+
if (both) {
|
|
228
|
+
path += seg.slice(1);
|
|
60
229
|
} else {
|
|
61
|
-
|
|
230
|
+
path += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
62
231
|
}
|
|
232
|
+
} else {
|
|
233
|
+
path += seg;
|
|
63
234
|
}
|
|
64
235
|
}
|
|
65
|
-
|
|
66
|
-
return ".";
|
|
67
|
-
}
|
|
68
|
-
return normalize(joined.replace(/\/\/+/g, "/"));
|
|
236
|
+
return normalize(path);
|
|
69
237
|
};
|
|
70
238
|
function cwd() {
|
|
71
239
|
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
|
@@ -78,12 +246,12 @@ var resolve = function(...arguments_) {
|
|
|
78
246
|
let resolvedPath = "";
|
|
79
247
|
let resolvedAbsolute = false;
|
|
80
248
|
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
81
|
-
const
|
|
82
|
-
if (!
|
|
249
|
+
const path = index >= 0 ? arguments_[index] : cwd();
|
|
250
|
+
if (!path || path.length === 0) {
|
|
83
251
|
continue;
|
|
84
252
|
}
|
|
85
|
-
resolvedPath = `${
|
|
86
|
-
resolvedAbsolute = isAbsolute(
|
|
253
|
+
resolvedPath = `${path}/${resolvedPath}`;
|
|
254
|
+
resolvedAbsolute = isAbsolute(path);
|
|
87
255
|
}
|
|
88
256
|
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
|
89
257
|
if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
|
|
@@ -91,15 +259,15 @@ var resolve = function(...arguments_) {
|
|
|
91
259
|
}
|
|
92
260
|
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
93
261
|
};
|
|
94
|
-
function normalizeString(
|
|
262
|
+
function normalizeString(path, allowAboveRoot) {
|
|
95
263
|
let res = "";
|
|
96
264
|
let lastSegmentLength = 0;
|
|
97
265
|
let lastSlash = -1;
|
|
98
266
|
let dots = 0;
|
|
99
267
|
let char = null;
|
|
100
|
-
for (let index = 0; index <=
|
|
101
|
-
if (index <
|
|
102
|
-
char =
|
|
268
|
+
for (let index = 0; index <= path.length; ++index) {
|
|
269
|
+
if (index < path.length) {
|
|
270
|
+
char = path[index];
|
|
103
271
|
} else if (char === "/") {
|
|
104
272
|
break;
|
|
105
273
|
} else {
|
|
@@ -135,9 +303,9 @@ function normalizeString(path2, allowAboveRoot) {
|
|
|
135
303
|
}
|
|
136
304
|
} else {
|
|
137
305
|
if (res.length > 0) {
|
|
138
|
-
res += `/${
|
|
306
|
+
res += `/${path.slice(lastSlash + 1, index)}`;
|
|
139
307
|
} else {
|
|
140
|
-
res =
|
|
308
|
+
res = path.slice(lastSlash + 1, index);
|
|
141
309
|
}
|
|
142
310
|
lastSegmentLength = index - lastSlash - 1;
|
|
143
311
|
}
|
|
@@ -157,8 +325,8 @@ var isAbsolute = function(p) {
|
|
|
157
325
|
var toNamespacedPath = function(p) {
|
|
158
326
|
return normalizeWindowsPath(p);
|
|
159
327
|
};
|
|
160
|
-
var _EXTNAME_RE = /.(\.[^./]+)$/;
|
|
161
328
|
var extname = function(p) {
|
|
329
|
+
if (p === "..") return "";
|
|
162
330
|
const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
|
|
163
331
|
return match && match[1] || "";
|
|
164
332
|
};
|
|
@@ -186,17 +354,28 @@ var dirname = function(p) {
|
|
|
186
354
|
return segments.join("/") || (isAbsolute(p) ? "/" : ".");
|
|
187
355
|
};
|
|
188
356
|
var format = function(p) {
|
|
189
|
-
const
|
|
357
|
+
const ext = p.ext ? p.ext.startsWith(".") ? p.ext : `.${p.ext}` : "";
|
|
358
|
+
const segments = [p.root, p.dir, p.base ?? (p.name ?? "") + ext].filter(
|
|
359
|
+
Boolean
|
|
360
|
+
);
|
|
190
361
|
return normalizeWindowsPath(
|
|
191
362
|
p.root ? resolve(...segments) : segments.join("/")
|
|
192
363
|
);
|
|
193
364
|
};
|
|
194
365
|
var basename = function(p, extension) {
|
|
195
|
-
const
|
|
366
|
+
const segments = normalizeWindowsPath(p).split("/");
|
|
367
|
+
let lastSegment = "";
|
|
368
|
+
for (let i = segments.length - 1; i >= 0; i--) {
|
|
369
|
+
const val = segments[i];
|
|
370
|
+
if (val) {
|
|
371
|
+
lastSegment = val;
|
|
372
|
+
break;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
196
375
|
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
|
|
197
376
|
};
|
|
198
377
|
var parse = function(p) {
|
|
199
|
-
const root =
|
|
378
|
+
const root = _PATH_ROOT_RE.exec(p)?.[0]?.replace(/\\/g, "/") || "";
|
|
200
379
|
const base = basename(p);
|
|
201
380
|
const extension = extname(base);
|
|
202
381
|
return {
|
|
@@ -207,15 +386,18 @@ var parse = function(p) {
|
|
|
207
386
|
name: base.slice(0, base.length - extension.length)
|
|
208
387
|
};
|
|
209
388
|
};
|
|
210
|
-
var
|
|
389
|
+
var matchesGlob = (path, pattern) => {
|
|
390
|
+
return zeptomatch(pattern, normalize(path));
|
|
391
|
+
};
|
|
392
|
+
var _path = {
|
|
211
393
|
__proto__: null,
|
|
212
394
|
basename,
|
|
213
|
-
delimiter,
|
|
214
395
|
dirname,
|
|
215
396
|
extname,
|
|
216
397
|
format,
|
|
217
398
|
isAbsolute,
|
|
218
399
|
join,
|
|
400
|
+
matchesGlob,
|
|
219
401
|
normalize,
|
|
220
402
|
normalizeString,
|
|
221
403
|
parse,
|
|
@@ -225,8 +407,24 @@ var path = {
|
|
|
225
407
|
toNamespacedPath
|
|
226
408
|
};
|
|
227
409
|
|
|
410
|
+
// ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/index.mjs
|
|
411
|
+
var delimiter = /* @__PURE__ */ (() => globalThis.process?.platform === "win32" ? ";" : ":")();
|
|
412
|
+
var _platforms = { posix: void 0, win32: void 0 };
|
|
413
|
+
var mix = (del = delimiter) => {
|
|
414
|
+
return new Proxy(_path, {
|
|
415
|
+
get(_, prop) {
|
|
416
|
+
if (prop === "delimiter") return del;
|
|
417
|
+
if (prop === "posix") return posix;
|
|
418
|
+
if (prop === "win32") return win32;
|
|
419
|
+
return _platforms[prop] || _path[prop];
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
};
|
|
423
|
+
var posix = /* @__PURE__ */ mix(":");
|
|
424
|
+
var win32 = /* @__PURE__ */ mix(";");
|
|
425
|
+
|
|
228
426
|
// ../../packages/weapp-vite/package.json
|
|
229
|
-
var version = "
|
|
427
|
+
var version = "4.0.0";
|
|
230
428
|
|
|
231
429
|
// src/context.ts
|
|
232
430
|
function createContext() {
|
|
@@ -394,7 +592,7 @@ export default defineConfig({
|
|
|
394
592
|
}
|
|
395
593
|
|
|
396
594
|
// src/index.ts
|
|
397
|
-
var __dirname2 =
|
|
595
|
+
var __dirname2 = posix.dirname(fileURLToPath(import.meta.url));
|
|
398
596
|
var ctx = createContext();
|
|
399
597
|
async function createOrUpdateProjectConfig(options) {
|
|
400
598
|
const { root, dest, cb, write, filename } = defu(
|
|
@@ -405,7 +603,7 @@ async function createOrUpdateProjectConfig(options) {
|
|
|
405
603
|
}
|
|
406
604
|
);
|
|
407
605
|
const projectConfigFilename = ctx.projectConfig.name = filename;
|
|
408
|
-
const projectConfigPath = ctx.projectConfig.path =
|
|
606
|
+
const projectConfigPath = ctx.projectConfig.path = posix.resolve(root, projectConfigFilename);
|
|
409
607
|
if (await fs.exists(projectConfigPath)) {
|
|
410
608
|
try {
|
|
411
609
|
const projectConfig = await fs.readJSON(projectConfigPath);
|
|
@@ -494,14 +692,14 @@ async function createOrUpdatePackageJson(options) {
|
|
|
494
692
|
command: "weapp-vite"
|
|
495
693
|
});
|
|
496
694
|
const packageJsonFilename = ctx.packageJson.name = filename;
|
|
497
|
-
const packageJsonPath = ctx.packageJson.path =
|
|
695
|
+
const packageJsonPath = ctx.packageJson.path = posix.resolve(root, packageJsonFilename);
|
|
498
696
|
let packageJson;
|
|
499
697
|
if (await fs.exists(packageJsonPath)) {
|
|
500
698
|
packageJson = await fs.readJSON(packageJsonPath);
|
|
501
699
|
} else {
|
|
502
700
|
packageJson = {
|
|
503
701
|
name: "weapp-vite-app",
|
|
504
|
-
homepage: "https://vite.
|
|
702
|
+
homepage: "https://ice-vite.netlify.app/",
|
|
505
703
|
type: "module"
|
|
506
704
|
};
|
|
507
705
|
}
|
|
@@ -536,7 +734,7 @@ async function initViteConfigFile(options) {
|
|
|
536
734
|
const { root, write = true } = options;
|
|
537
735
|
const type = get(ctx.packageJson.value, "type");
|
|
538
736
|
const targetFilename = ctx.viteConfig.name = type === "module" ? "vite.config.ts" : "vite.config.mts";
|
|
539
|
-
const viteConfigFilePath = ctx.viteConfig.path =
|
|
737
|
+
const viteConfigFilePath = ctx.viteConfig.path = posix.resolve(root, targetFilename);
|
|
540
738
|
const viteConfigFileCode = ctx.viteConfig.value = getDefaultViteConfig();
|
|
541
739
|
if (write) {
|
|
542
740
|
await fs.outputFile(viteConfigFilePath, viteConfigFileCode, "utf8");
|
|
@@ -547,7 +745,7 @@ async function initViteConfigFile(options) {
|
|
|
547
745
|
async function initTsDtsFile(options) {
|
|
548
746
|
const { root, write = true } = options;
|
|
549
747
|
const targetFilename = "vite-env.d.ts";
|
|
550
|
-
const viteDtsFilePath =
|
|
748
|
+
const viteDtsFilePath = posix.resolve(root, targetFilename);
|
|
551
749
|
const code = getDefaultTsDts();
|
|
552
750
|
if (write) {
|
|
553
751
|
await fs.outputFile(viteDtsFilePath, code, "utf8");
|
|
@@ -558,9 +756,9 @@ async function initTsDtsFile(options) {
|
|
|
558
756
|
async function initTsJsonFiles(options) {
|
|
559
757
|
const { root, write = true } = options;
|
|
560
758
|
const tsJsonFilename = ctx.tsconfig.name = "tsconfig.json";
|
|
561
|
-
const tsJsonFilePath = ctx.tsconfig.path =
|
|
759
|
+
const tsJsonFilePath = ctx.tsconfig.path = posix.resolve(root, tsJsonFilename);
|
|
562
760
|
const tsNodeJsonFilename = ctx.tsconfigNode.name = "tsconfig.node.json";
|
|
563
|
-
const tsNodeJsonFilePath = ctx.tsconfigNode.path =
|
|
761
|
+
const tsNodeJsonFilePath = ctx.tsconfigNode.path = posix.resolve(root, tsNodeJsonFilename);
|
|
564
762
|
if (write) {
|
|
565
763
|
const tsJsonValue = getDefaultTsconfigJson();
|
|
566
764
|
if (write) {
|
|
@@ -590,7 +788,7 @@ async function initTsJsonFiles(options) {
|
|
|
590
788
|
}
|
|
591
789
|
async function updateGitIgnore(options) {
|
|
592
790
|
const { root, write = true } = options;
|
|
593
|
-
const filepath =
|
|
791
|
+
const filepath = posix.resolve(root, ".gitignore");
|
|
594
792
|
const data = getDefaultGitignore();
|
|
595
793
|
if (write) {
|
|
596
794
|
await fs.outputFile(filepath, data, {
|
|
@@ -612,10 +810,10 @@ async function initConfig(options) {
|
|
|
612
810
|
return ctx;
|
|
613
811
|
}
|
|
614
812
|
async function createProject(targetDir = "", templateName = "default" /* default */) {
|
|
615
|
-
const targetTemplateDir =
|
|
813
|
+
const targetTemplateDir = posix.resolve(__dirname2, "../templates", templateName);
|
|
616
814
|
if (await fs.exists(targetTemplateDir)) {
|
|
617
815
|
await fs.copy(targetTemplateDir, targetDir);
|
|
618
|
-
const pkgJsonPath =
|
|
816
|
+
const pkgJsonPath = posix.resolve(targetTemplateDir, "package.json");
|
|
619
817
|
const pkgJson = await fs.readJson(pkgJsonPath);
|
|
620
818
|
if (pkgJson.devDependencies) {
|
|
621
819
|
if (pkgJson.devDependencies["weapp-vite"]) {
|
|
@@ -625,7 +823,10 @@ async function createProject(targetDir = "", templateName = "default" /* default
|
|
|
625
823
|
pkgJson.devDependencies["weapp-tailwindcss"] = "latest";
|
|
626
824
|
}
|
|
627
825
|
}
|
|
628
|
-
await fs.writeJson(
|
|
826
|
+
await fs.writeJson(posix.resolve(targetDir, "package.json"), pkgJson, { spaces: 2 });
|
|
827
|
+
if (!await fs.exists(posix.resolve(targetDir, ".gitignore"))) {
|
|
828
|
+
await updateGitIgnore({ root: targetDir, write: true });
|
|
829
|
+
}
|
|
629
830
|
logger.log(`\u2728 \u521B\u5EFA\u6A21\u677F\u6210\u529F!`);
|
|
630
831
|
} else {
|
|
631
832
|
logger.warn(`\u6CA1\u6709\u627E\u5230 ${templateName} \u6A21\u677F!`);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-core/init",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.17",
|
|
5
5
|
"description": "@weapp-core/init",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"templates"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"fs-extra": "^11.
|
|
42
|
-
"@weapp-core/logger": "^1.0.
|
|
43
|
-
"@weapp-core/shared": "^1.0.
|
|
41
|
+
"fs-extra": "^11.3.0",
|
|
42
|
+
"@weapp-core/logger": "^1.0.3",
|
|
43
|
+
"@weapp-core/shared": "^1.0.7"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@types/semver": "^7.
|
|
47
|
-
"semver": "^7.
|
|
46
|
+
"@types/semver": "^7.7.0",
|
|
47
|
+
"semver": "^7.7.1"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
50
|
"dev": "tsup --watch --sourcemap",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"g": "weapp-vite generate"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"miniprogram-api-typings": "^4.0.
|
|
27
|
-
"sass": "^1.
|
|
28
|
-
"typescript": "^5.
|
|
26
|
+
"miniprogram-api-typings": "^4.0.5",
|
|
27
|
+
"sass": "^1.86.3",
|
|
28
|
+
"typescript": "^5.8.3",
|
|
29
29
|
"weapp-vite": "workspace:*"
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -24,15 +24,15 @@
|
|
|
24
24
|
"postinstall": "weapp-tw patch"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@egoist/tailwindcss-icons": "^1.
|
|
28
|
-
"@iconify-json/mdi": "^1.2.
|
|
29
|
-
"autoprefixer": "^10.4.
|
|
30
|
-
"miniprogram-api-typings": "^4.0.
|
|
31
|
-
"postcss": "^8.
|
|
32
|
-
"sass": "^1.
|
|
27
|
+
"@egoist/tailwindcss-icons": "^1.9.0",
|
|
28
|
+
"@iconify-json/mdi": "^1.2.3",
|
|
29
|
+
"autoprefixer": "^10.4.21",
|
|
30
|
+
"miniprogram-api-typings": "^4.0.5",
|
|
31
|
+
"postcss": "^8.5.3",
|
|
32
|
+
"sass": "^1.86.3",
|
|
33
33
|
"tailwindcss": "^3.4.17",
|
|
34
|
-
"typescript": "^5.
|
|
35
|
-
"weapp-tailwindcss": "^
|
|
34
|
+
"typescript": "^5.8.3",
|
|
35
|
+
"weapp-tailwindcss": "^4.1.5",
|
|
36
36
|
"weapp-vite": "workspace:*"
|
|
37
37
|
}
|
|
38
38
|
}
|