@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.cjs
CHANGED
|
@@ -41,7 +41,7 @@ __export(index_exports, {
|
|
|
41
41
|
});
|
|
42
42
|
module.exports = __toCommonJS(index_exports);
|
|
43
43
|
|
|
44
|
-
// ../../node_modules/.pnpm/tsup@8.
|
|
44
|
+
// ../../node_modules/.pnpm/tsup@8.4.0_@swc+core@1.11.21_jiti@2.4.2_postcss@8.5.3_tsx@4.19.3_typescript@5.8.3_yaml@2.7.1/node_modules/tsup/assets/cjs_shims.js
|
|
45
45
|
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
46
46
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
47
47
|
|
|
@@ -52,7 +52,172 @@ var import_logger = __toESM(require("@weapp-core/logger"), 1);
|
|
|
52
52
|
var import_shared = require("@weapp-core/shared");
|
|
53
53
|
var import_fs_extra = __toESM(require("fs-extra"), 1);
|
|
54
54
|
|
|
55
|
-
// ../../node_modules/.pnpm/pathe@
|
|
55
|
+
// ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
|
|
56
|
+
var _lazyMatch = () => {
|
|
57
|
+
var __lib__ = (() => {
|
|
58
|
+
var m = Object.defineProperty, V = Object.getOwnPropertyDescriptor, G = Object.getOwnPropertyNames, T = Object.prototype.hasOwnProperty, q = (r, e) => {
|
|
59
|
+
for (var n in e) m(r, n, { get: e[n], enumerable: true });
|
|
60
|
+
}, H = (r, e, n, a) => {
|
|
61
|
+
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 });
|
|
62
|
+
return r;
|
|
63
|
+
}, J = (r) => H(m({}, "__esModule", { value: true }), r), w = {};
|
|
64
|
+
q(w, { default: () => re });
|
|
65
|
+
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) => {
|
|
66
|
+
const e = /* @__PURE__ */ new Map();
|
|
67
|
+
return (n) => {
|
|
68
|
+
const a = e.get(n);
|
|
69
|
+
if (a) return a;
|
|
70
|
+
const t = r(n);
|
|
71
|
+
return e.set(n, t), t;
|
|
72
|
+
};
|
|
73
|
+
}, rr = (r, e, n = {}) => {
|
|
74
|
+
const a = { cache: {}, input: r, index: 0, indexMax: 0, options: n, output: [] };
|
|
75
|
+
if (v(e)(a) && a.index === r.length) return a.output;
|
|
76
|
+
throw new Error(`Failed to parse at index ${a.indexMax}`);
|
|
77
|
+
}, i = (r, e) => A(r) ? er(r, e) : b(r) ? ar(r, e) : nr(r, e), er = (r, e) => {
|
|
78
|
+
const n = {};
|
|
79
|
+
for (const a of r) {
|
|
80
|
+
if (a.length !== 1) throw new Error(`Invalid character: "${a}"`);
|
|
81
|
+
const t = a.charCodeAt(0);
|
|
82
|
+
n[t] = true;
|
|
83
|
+
}
|
|
84
|
+
return (a) => {
|
|
85
|
+
const t = a.index, o = a.input;
|
|
86
|
+
for (; a.index < o.length && o.charCodeAt(a.index) in n; ) a.index += 1;
|
|
87
|
+
const u = a.index;
|
|
88
|
+
if (u > t) {
|
|
89
|
+
if (!h(e) && !a.options.silent) {
|
|
90
|
+
const s = a.input.slice(t, u), c = d(e) ? e(s, o, String(t)) : e;
|
|
91
|
+
h(c) || a.output.push(c);
|
|
92
|
+
}
|
|
93
|
+
a.indexMax = Math.max(a.indexMax, a.index);
|
|
94
|
+
}
|
|
95
|
+
return true;
|
|
96
|
+
};
|
|
97
|
+
}, nr = (r, e) => {
|
|
98
|
+
const n = r.source, a = r.flags.replace(/y|$/, "y"), t = new RegExp(n, a);
|
|
99
|
+
return g((o) => {
|
|
100
|
+
t.lastIndex = o.index;
|
|
101
|
+
const u = t.exec(o.input);
|
|
102
|
+
if (u) {
|
|
103
|
+
if (!h(e) && !o.options.silent) {
|
|
104
|
+
const s = d(e) ? e(...u, o.input, String(o.index)) : e;
|
|
105
|
+
h(s) || o.output.push(s);
|
|
106
|
+
}
|
|
107
|
+
return o.index += u[0].length, o.indexMax = Math.max(o.indexMax, o.index), true;
|
|
108
|
+
} else return false;
|
|
109
|
+
});
|
|
110
|
+
}, ar = (r, e) => (n) => {
|
|
111
|
+
if (n.input.startsWith(r, n.index)) {
|
|
112
|
+
if (!h(e) && !n.options.silent) {
|
|
113
|
+
const t = d(e) ? e(r, n.input, String(n.index)) : e;
|
|
114
|
+
h(t) || n.output.push(t);
|
|
115
|
+
}
|
|
116
|
+
return n.index += r.length, n.indexMax = Math.max(n.indexMax, n.index), true;
|
|
117
|
+
} else return false;
|
|
118
|
+
}, C = (r, e, n, a) => {
|
|
119
|
+
const t = v(r);
|
|
120
|
+
return g(_(M((o) => {
|
|
121
|
+
let u = 0;
|
|
122
|
+
for (; u < n; ) {
|
|
123
|
+
const s = o.index;
|
|
124
|
+
if (!t(o) || (u += 1, o.index === s)) break;
|
|
125
|
+
}
|
|
126
|
+
return u >= e;
|
|
127
|
+
})));
|
|
128
|
+
}, tr = (r, e) => C(r, 0, 1), f = (r, e) => C(r, 0, 1 / 0), x = (r, e) => {
|
|
129
|
+
const n = r.map(v);
|
|
130
|
+
return g(_(M((a) => {
|
|
131
|
+
for (let t = 0, o = n.length; t < o; t++) if (!n[t](a)) return false;
|
|
132
|
+
return true;
|
|
133
|
+
})));
|
|
134
|
+
}, l = (r, e) => {
|
|
135
|
+
const n = r.map(v);
|
|
136
|
+
return g(_((a) => {
|
|
137
|
+
for (let t = 0, o = n.length; t < o; t++) if (n[t](a)) return true;
|
|
138
|
+
return false;
|
|
139
|
+
}));
|
|
140
|
+
}, M = (r, e = false) => {
|
|
141
|
+
const n = v(r);
|
|
142
|
+
return (a) => {
|
|
143
|
+
const t = a.index, o = a.output.length, u = n(a);
|
|
144
|
+
return (!u || e) && (a.index = t, a.output.length !== o && (a.output.length = o)), u;
|
|
145
|
+
};
|
|
146
|
+
}, _ = (r, e) => {
|
|
147
|
+
const n = v(r);
|
|
148
|
+
return n;
|
|
149
|
+
}, g = /* @__PURE__ */ (() => {
|
|
150
|
+
let r = 0;
|
|
151
|
+
return (e) => {
|
|
152
|
+
const n = v(e), a = r += 1;
|
|
153
|
+
return (t) => {
|
|
154
|
+
var o;
|
|
155
|
+
if (t.options.memoization === false) return n(t);
|
|
156
|
+
const u = t.index, s = (o = t.cache)[a] || (o[a] = /* @__PURE__ */ new Map()), c = s.get(u);
|
|
157
|
+
if (c === false) return false;
|
|
158
|
+
if (W(c)) return t.index = c, true;
|
|
159
|
+
if (c) return t.index = c.index, c.output?.length && t.output.push(...c.output), true;
|
|
160
|
+
{
|
|
161
|
+
const Z = t.output.length;
|
|
162
|
+
if (n(t)) {
|
|
163
|
+
const D = t.index, U = t.output.length;
|
|
164
|
+
if (U > Z) {
|
|
165
|
+
const ee = t.output.slice(Z, U);
|
|
166
|
+
s.set(u, { index: D, output: ee });
|
|
167
|
+
} else s.set(u, D);
|
|
168
|
+
return true;
|
|
169
|
+
} else return s.set(u, false), false;
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
})(), E = (r) => {
|
|
174
|
+
let e;
|
|
175
|
+
return (n) => (e || (e = v(r())), e(n));
|
|
176
|
+
}, v = Y((r) => {
|
|
177
|
+
if (d(r)) return Q(r) ? E(r) : r;
|
|
178
|
+
if (b(r) || X(r)) return i(r);
|
|
179
|
+
if (A(r)) return x(r);
|
|
180
|
+
if (K(r)) return l(Object.values(r));
|
|
181
|
+
throw new Error("Invalid rule");
|
|
182
|
+
}), P = "abcdefghijklmnopqrstuvwxyz", ir = (r) => {
|
|
183
|
+
let e = "";
|
|
184
|
+
for (; r > 0; ) {
|
|
185
|
+
const n = (r - 1) % 26;
|
|
186
|
+
e = P[n] + e, r = Math.floor((r - 1) / 26);
|
|
187
|
+
}
|
|
188
|
+
return e;
|
|
189
|
+
}, O = (r) => {
|
|
190
|
+
let e = 0;
|
|
191
|
+
for (let n = 0, a = r.length; n < a; n++) e = e * 26 + P.indexOf(r[n]) + 1;
|
|
192
|
+
return e;
|
|
193
|
+
}, S = (r, e) => {
|
|
194
|
+
if (e < r) return S(e, r);
|
|
195
|
+
const n = [];
|
|
196
|
+
for (; r <= e; ) n.push(r++);
|
|
197
|
+
return n;
|
|
198
|
+
}, 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) => {
|
|
199
|
+
const e = {};
|
|
200
|
+
return (n) => e[n] ?? (e[n] = r(n));
|
|
201
|
+
}, 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) => {
|
|
202
|
+
const n = Array.isArray(r) ? r : [r];
|
|
203
|
+
if (!n.length) return false;
|
|
204
|
+
const a = n.map($.compile), t = n.every((s) => /(\/(?:\*\*)?|\[\/\])$/.test(s)), o = e.replace(/[\\\/]+/g, "/").replace(/\/$/, t ? "/" : "");
|
|
205
|
+
return a.some((s) => s.test(o));
|
|
206
|
+
};
|
|
207
|
+
$.compile = (r) => new RegExp(`^${L(Yr(r))}$`, "s");
|
|
208
|
+
var re = $;
|
|
209
|
+
return J(w);
|
|
210
|
+
})();
|
|
211
|
+
return __lib__.default || __lib__;
|
|
212
|
+
};
|
|
213
|
+
var _match;
|
|
214
|
+
var zeptomatch = (path, pattern) => {
|
|
215
|
+
if (!_match) {
|
|
216
|
+
_match = _lazyMatch();
|
|
217
|
+
_lazyMatch = null;
|
|
218
|
+
}
|
|
219
|
+
return _match(path, pattern);
|
|
220
|
+
};
|
|
56
221
|
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
57
222
|
function normalizeWindowsPath(input = "") {
|
|
58
223
|
if (!input) {
|
|
@@ -64,55 +229,58 @@ var _UNC_REGEX = /^[/\\]{2}/;
|
|
|
64
229
|
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
65
230
|
var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
66
231
|
var _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/;
|
|
232
|
+
var _EXTNAME_RE = /.(\.[^./]+|\.)$/;
|
|
233
|
+
var _PATH_ROOT_RE = /^[/\\]|^[a-zA-Z]:[/\\]/;
|
|
67
234
|
var sep = "/";
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
if (path2.length === 0) {
|
|
235
|
+
var normalize = function(path) {
|
|
236
|
+
if (path.length === 0) {
|
|
71
237
|
return ".";
|
|
72
238
|
}
|
|
73
|
-
|
|
74
|
-
const isUNCPath =
|
|
75
|
-
const isPathAbsolute = isAbsolute(
|
|
76
|
-
const trailingSeparator =
|
|
77
|
-
|
|
78
|
-
if (
|
|
239
|
+
path = normalizeWindowsPath(path);
|
|
240
|
+
const isUNCPath = path.match(_UNC_REGEX);
|
|
241
|
+
const isPathAbsolute = isAbsolute(path);
|
|
242
|
+
const trailingSeparator = path[path.length - 1] === "/";
|
|
243
|
+
path = normalizeString(path, !isPathAbsolute);
|
|
244
|
+
if (path.length === 0) {
|
|
79
245
|
if (isPathAbsolute) {
|
|
80
246
|
return "/";
|
|
81
247
|
}
|
|
82
248
|
return trailingSeparator ? "./" : ".";
|
|
83
249
|
}
|
|
84
250
|
if (trailingSeparator) {
|
|
85
|
-
|
|
251
|
+
path += "/";
|
|
86
252
|
}
|
|
87
|
-
if (_DRIVE_LETTER_RE.test(
|
|
88
|
-
|
|
253
|
+
if (_DRIVE_LETTER_RE.test(path)) {
|
|
254
|
+
path += "/";
|
|
89
255
|
}
|
|
90
256
|
if (isUNCPath) {
|
|
91
257
|
if (!isPathAbsolute) {
|
|
92
|
-
return `//./${
|
|
258
|
+
return `//./${path}`;
|
|
93
259
|
}
|
|
94
|
-
return `//${
|
|
260
|
+
return `//${path}`;
|
|
95
261
|
}
|
|
96
|
-
return isPathAbsolute && !isAbsolute(
|
|
262
|
+
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
|
97
263
|
};
|
|
98
|
-
var join = function(...
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (
|
|
105
|
-
|
|
106
|
-
|
|
264
|
+
var join = function(...segments) {
|
|
265
|
+
let path = "";
|
|
266
|
+
for (const seg of segments) {
|
|
267
|
+
if (!seg) {
|
|
268
|
+
continue;
|
|
269
|
+
}
|
|
270
|
+
if (path.length > 0) {
|
|
271
|
+
const pathTrailing = path[path.length - 1] === "/";
|
|
272
|
+
const segLeading = seg[0] === "/";
|
|
273
|
+
const both = pathTrailing && segLeading;
|
|
274
|
+
if (both) {
|
|
275
|
+
path += seg.slice(1);
|
|
107
276
|
} else {
|
|
108
|
-
|
|
277
|
+
path += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
109
278
|
}
|
|
279
|
+
} else {
|
|
280
|
+
path += seg;
|
|
110
281
|
}
|
|
111
282
|
}
|
|
112
|
-
|
|
113
|
-
return ".";
|
|
114
|
-
}
|
|
115
|
-
return normalize(joined.replace(/\/\/+/g, "/"));
|
|
283
|
+
return normalize(path);
|
|
116
284
|
};
|
|
117
285
|
function cwd() {
|
|
118
286
|
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
|
@@ -125,12 +293,12 @@ var resolve = function(...arguments_) {
|
|
|
125
293
|
let resolvedPath = "";
|
|
126
294
|
let resolvedAbsolute = false;
|
|
127
295
|
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
128
|
-
const
|
|
129
|
-
if (!
|
|
296
|
+
const path = index >= 0 ? arguments_[index] : cwd();
|
|
297
|
+
if (!path || path.length === 0) {
|
|
130
298
|
continue;
|
|
131
299
|
}
|
|
132
|
-
resolvedPath = `${
|
|
133
|
-
resolvedAbsolute = isAbsolute(
|
|
300
|
+
resolvedPath = `${path}/${resolvedPath}`;
|
|
301
|
+
resolvedAbsolute = isAbsolute(path);
|
|
134
302
|
}
|
|
135
303
|
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
|
136
304
|
if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
|
|
@@ -138,15 +306,15 @@ var resolve = function(...arguments_) {
|
|
|
138
306
|
}
|
|
139
307
|
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
140
308
|
};
|
|
141
|
-
function normalizeString(
|
|
309
|
+
function normalizeString(path, allowAboveRoot) {
|
|
142
310
|
let res = "";
|
|
143
311
|
let lastSegmentLength = 0;
|
|
144
312
|
let lastSlash = -1;
|
|
145
313
|
let dots = 0;
|
|
146
314
|
let char = null;
|
|
147
|
-
for (let index = 0; index <=
|
|
148
|
-
if (index <
|
|
149
|
-
char =
|
|
315
|
+
for (let index = 0; index <= path.length; ++index) {
|
|
316
|
+
if (index < path.length) {
|
|
317
|
+
char = path[index];
|
|
150
318
|
} else if (char === "/") {
|
|
151
319
|
break;
|
|
152
320
|
} else {
|
|
@@ -182,9 +350,9 @@ function normalizeString(path2, allowAboveRoot) {
|
|
|
182
350
|
}
|
|
183
351
|
} else {
|
|
184
352
|
if (res.length > 0) {
|
|
185
|
-
res += `/${
|
|
353
|
+
res += `/${path.slice(lastSlash + 1, index)}`;
|
|
186
354
|
} else {
|
|
187
|
-
res =
|
|
355
|
+
res = path.slice(lastSlash + 1, index);
|
|
188
356
|
}
|
|
189
357
|
lastSegmentLength = index - lastSlash - 1;
|
|
190
358
|
}
|
|
@@ -204,8 +372,8 @@ var isAbsolute = function(p) {
|
|
|
204
372
|
var toNamespacedPath = function(p) {
|
|
205
373
|
return normalizeWindowsPath(p);
|
|
206
374
|
};
|
|
207
|
-
var _EXTNAME_RE = /.(\.[^./]+)$/;
|
|
208
375
|
var extname = function(p) {
|
|
376
|
+
if (p === "..") return "";
|
|
209
377
|
const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
|
|
210
378
|
return match && match[1] || "";
|
|
211
379
|
};
|
|
@@ -233,17 +401,28 @@ var dirname = function(p) {
|
|
|
233
401
|
return segments.join("/") || (isAbsolute(p) ? "/" : ".");
|
|
234
402
|
};
|
|
235
403
|
var format = function(p) {
|
|
236
|
-
const
|
|
404
|
+
const ext = p.ext ? p.ext.startsWith(".") ? p.ext : `.${p.ext}` : "";
|
|
405
|
+
const segments = [p.root, p.dir, p.base ?? (p.name ?? "") + ext].filter(
|
|
406
|
+
Boolean
|
|
407
|
+
);
|
|
237
408
|
return normalizeWindowsPath(
|
|
238
409
|
p.root ? resolve(...segments) : segments.join("/")
|
|
239
410
|
);
|
|
240
411
|
};
|
|
241
412
|
var basename = function(p, extension) {
|
|
242
|
-
const
|
|
413
|
+
const segments = normalizeWindowsPath(p).split("/");
|
|
414
|
+
let lastSegment = "";
|
|
415
|
+
for (let i = segments.length - 1; i >= 0; i--) {
|
|
416
|
+
const val = segments[i];
|
|
417
|
+
if (val) {
|
|
418
|
+
lastSegment = val;
|
|
419
|
+
break;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
243
422
|
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
|
|
244
423
|
};
|
|
245
424
|
var parse = function(p) {
|
|
246
|
-
const root =
|
|
425
|
+
const root = _PATH_ROOT_RE.exec(p)?.[0]?.replace(/\\/g, "/") || "";
|
|
247
426
|
const base = basename(p);
|
|
248
427
|
const extension = extname(base);
|
|
249
428
|
return {
|
|
@@ -254,15 +433,18 @@ var parse = function(p) {
|
|
|
254
433
|
name: base.slice(0, base.length - extension.length)
|
|
255
434
|
};
|
|
256
435
|
};
|
|
257
|
-
var
|
|
436
|
+
var matchesGlob = (path, pattern) => {
|
|
437
|
+
return zeptomatch(pattern, normalize(path));
|
|
438
|
+
};
|
|
439
|
+
var _path = {
|
|
258
440
|
__proto__: null,
|
|
259
441
|
basename,
|
|
260
|
-
delimiter,
|
|
261
442
|
dirname,
|
|
262
443
|
extname,
|
|
263
444
|
format,
|
|
264
445
|
isAbsolute,
|
|
265
446
|
join,
|
|
447
|
+
matchesGlob,
|
|
266
448
|
normalize,
|
|
267
449
|
normalizeString,
|
|
268
450
|
parse,
|
|
@@ -272,8 +454,24 @@ var path = {
|
|
|
272
454
|
toNamespacedPath
|
|
273
455
|
};
|
|
274
456
|
|
|
457
|
+
// ../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/index.mjs
|
|
458
|
+
var delimiter = /* @__PURE__ */ (() => globalThis.process?.platform === "win32" ? ";" : ":")();
|
|
459
|
+
var _platforms = { posix: void 0, win32: void 0 };
|
|
460
|
+
var mix = (del = delimiter) => {
|
|
461
|
+
return new Proxy(_path, {
|
|
462
|
+
get(_, prop) {
|
|
463
|
+
if (prop === "delimiter") return del;
|
|
464
|
+
if (prop === "posix") return posix;
|
|
465
|
+
if (prop === "win32") return win32;
|
|
466
|
+
return _platforms[prop] || _path[prop];
|
|
467
|
+
}
|
|
468
|
+
});
|
|
469
|
+
};
|
|
470
|
+
var posix = /* @__PURE__ */ mix(":");
|
|
471
|
+
var win32 = /* @__PURE__ */ mix(";");
|
|
472
|
+
|
|
275
473
|
// ../../packages/weapp-vite/package.json
|
|
276
|
-
var version = "
|
|
474
|
+
var version = "4.0.0";
|
|
277
475
|
|
|
278
476
|
// src/context.ts
|
|
279
477
|
function createContext() {
|
|
@@ -441,7 +639,7 @@ export default defineConfig({
|
|
|
441
639
|
}
|
|
442
640
|
|
|
443
641
|
// src/index.ts
|
|
444
|
-
var __dirname =
|
|
642
|
+
var __dirname = posix.dirname((0, import_node_url.fileURLToPath)(importMetaUrl));
|
|
445
643
|
var ctx = createContext();
|
|
446
644
|
async function createOrUpdateProjectConfig(options) {
|
|
447
645
|
const { root, dest, cb, write, filename } = (0, import_shared.defu)(
|
|
@@ -452,7 +650,7 @@ async function createOrUpdateProjectConfig(options) {
|
|
|
452
650
|
}
|
|
453
651
|
);
|
|
454
652
|
const projectConfigFilename = ctx.projectConfig.name = filename;
|
|
455
|
-
const projectConfigPath = ctx.projectConfig.path =
|
|
653
|
+
const projectConfigPath = ctx.projectConfig.path = posix.resolve(root, projectConfigFilename);
|
|
456
654
|
if (await import_fs_extra.default.exists(projectConfigPath)) {
|
|
457
655
|
try {
|
|
458
656
|
const projectConfig = await import_fs_extra.default.readJSON(projectConfigPath);
|
|
@@ -541,14 +739,14 @@ async function createOrUpdatePackageJson(options) {
|
|
|
541
739
|
command: "weapp-vite"
|
|
542
740
|
});
|
|
543
741
|
const packageJsonFilename = ctx.packageJson.name = filename;
|
|
544
|
-
const packageJsonPath = ctx.packageJson.path =
|
|
742
|
+
const packageJsonPath = ctx.packageJson.path = posix.resolve(root, packageJsonFilename);
|
|
545
743
|
let packageJson;
|
|
546
744
|
if (await import_fs_extra.default.exists(packageJsonPath)) {
|
|
547
745
|
packageJson = await import_fs_extra.default.readJSON(packageJsonPath);
|
|
548
746
|
} else {
|
|
549
747
|
packageJson = {
|
|
550
748
|
name: "weapp-vite-app",
|
|
551
|
-
homepage: "https://vite.
|
|
749
|
+
homepage: "https://ice-vite.netlify.app/",
|
|
552
750
|
type: "module"
|
|
553
751
|
};
|
|
554
752
|
}
|
|
@@ -583,7 +781,7 @@ async function initViteConfigFile(options) {
|
|
|
583
781
|
const { root, write = true } = options;
|
|
584
782
|
const type = (0, import_shared.get)(ctx.packageJson.value, "type");
|
|
585
783
|
const targetFilename = ctx.viteConfig.name = type === "module" ? "vite.config.ts" : "vite.config.mts";
|
|
586
|
-
const viteConfigFilePath = ctx.viteConfig.path =
|
|
784
|
+
const viteConfigFilePath = ctx.viteConfig.path = posix.resolve(root, targetFilename);
|
|
587
785
|
const viteConfigFileCode = ctx.viteConfig.value = getDefaultViteConfig();
|
|
588
786
|
if (write) {
|
|
589
787
|
await import_fs_extra.default.outputFile(viteConfigFilePath, viteConfigFileCode, "utf8");
|
|
@@ -594,7 +792,7 @@ async function initViteConfigFile(options) {
|
|
|
594
792
|
async function initTsDtsFile(options) {
|
|
595
793
|
const { root, write = true } = options;
|
|
596
794
|
const targetFilename = "vite-env.d.ts";
|
|
597
|
-
const viteDtsFilePath =
|
|
795
|
+
const viteDtsFilePath = posix.resolve(root, targetFilename);
|
|
598
796
|
const code = getDefaultTsDts();
|
|
599
797
|
if (write) {
|
|
600
798
|
await import_fs_extra.default.outputFile(viteDtsFilePath, code, "utf8");
|
|
@@ -605,9 +803,9 @@ async function initTsDtsFile(options) {
|
|
|
605
803
|
async function initTsJsonFiles(options) {
|
|
606
804
|
const { root, write = true } = options;
|
|
607
805
|
const tsJsonFilename = ctx.tsconfig.name = "tsconfig.json";
|
|
608
|
-
const tsJsonFilePath = ctx.tsconfig.path =
|
|
806
|
+
const tsJsonFilePath = ctx.tsconfig.path = posix.resolve(root, tsJsonFilename);
|
|
609
807
|
const tsNodeJsonFilename = ctx.tsconfigNode.name = "tsconfig.node.json";
|
|
610
|
-
const tsNodeJsonFilePath = ctx.tsconfigNode.path =
|
|
808
|
+
const tsNodeJsonFilePath = ctx.tsconfigNode.path = posix.resolve(root, tsNodeJsonFilename);
|
|
611
809
|
if (write) {
|
|
612
810
|
const tsJsonValue = getDefaultTsconfigJson();
|
|
613
811
|
if (write) {
|
|
@@ -637,7 +835,7 @@ async function initTsJsonFiles(options) {
|
|
|
637
835
|
}
|
|
638
836
|
async function updateGitIgnore(options) {
|
|
639
837
|
const { root, write = true } = options;
|
|
640
|
-
const filepath =
|
|
838
|
+
const filepath = posix.resolve(root, ".gitignore");
|
|
641
839
|
const data = getDefaultGitignore();
|
|
642
840
|
if (write) {
|
|
643
841
|
await import_fs_extra.default.outputFile(filepath, data, {
|
|
@@ -659,10 +857,10 @@ async function initConfig(options) {
|
|
|
659
857
|
return ctx;
|
|
660
858
|
}
|
|
661
859
|
async function createProject(targetDir = "", templateName = "default" /* default */) {
|
|
662
|
-
const targetTemplateDir =
|
|
860
|
+
const targetTemplateDir = posix.resolve(__dirname, "../templates", templateName);
|
|
663
861
|
if (await import_fs_extra.default.exists(targetTemplateDir)) {
|
|
664
862
|
await import_fs_extra.default.copy(targetTemplateDir, targetDir);
|
|
665
|
-
const pkgJsonPath =
|
|
863
|
+
const pkgJsonPath = posix.resolve(targetTemplateDir, "package.json");
|
|
666
864
|
const pkgJson = await import_fs_extra.default.readJson(pkgJsonPath);
|
|
667
865
|
if (pkgJson.devDependencies) {
|
|
668
866
|
if (pkgJson.devDependencies["weapp-vite"]) {
|
|
@@ -672,7 +870,10 @@ async function createProject(targetDir = "", templateName = "default" /* default
|
|
|
672
870
|
pkgJson.devDependencies["weapp-tailwindcss"] = "latest";
|
|
673
871
|
}
|
|
674
872
|
}
|
|
675
|
-
await import_fs_extra.default.writeJson(
|
|
873
|
+
await import_fs_extra.default.writeJson(posix.resolve(targetDir, "package.json"), pkgJson, { spaces: 2 });
|
|
874
|
+
if (!await import_fs_extra.default.exists(posix.resolve(targetDir, ".gitignore"))) {
|
|
875
|
+
await updateGitIgnore({ root: targetDir, write: true });
|
|
876
|
+
}
|
|
676
877
|
import_logger.default.log(`\u2728 \u521B\u5EFA\u6A21\u677F\u6210\u529F!`);
|
|
677
878
|
} else {
|
|
678
879
|
import_logger.default.warn(`\u6CA1\u6709\u627E\u5230 ${templateName} \u6A21\u677F!`);
|