@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.
Files changed (42) hide show
  1. package/dist/index.cjs +261 -60
  2. package/dist/index.js +260 -59
  3. package/package.json +6 -6
  4. package/templates/default/README.md +2 -2
  5. package/templates/default/package.json +3 -3
  6. package/templates/default/project.private.config.json +2 -1
  7. package/templates/default/src/app.json +1 -1
  8. package/templates/default/src/components/Navbar/Navbar.json +1 -1
  9. package/templates/default/src/pages/index/index.json +1 -1
  10. package/templates/default/src/sitemap.json +1 -1
  11. package/templates/default/src/theme.json +1 -1
  12. package/templates/default/vite.config.ts +1 -1
  13. package/templates/tailwindcss/README.md +2 -2
  14. package/templates/tailwindcss/package.json +8 -8
  15. package/templates/tailwindcss/project.private.config.json +2 -1
  16. package/templates/tailwindcss/src/app.json +1 -1
  17. package/templates/tailwindcss/src/components/Navbar/Navbar.json +1 -1
  18. package/templates/tailwindcss/src/pages/index/index.json +1 -1
  19. package/templates/tailwindcss/src/pages/index/index.wxml +6 -6
  20. package/templates/tailwindcss/src/sitemap.json +1 -1
  21. package/templates/tailwindcss/src/theme.json +1 -1
  22. package/templates/tailwindcss/vite.config.ts +1 -1
  23. package/templates/tdesign/README.md +2 -2
  24. package/templates/tdesign/package.json +11 -11
  25. package/templates/tdesign/project.private.config.json +2 -1
  26. package/templates/tdesign/src/app.json +1 -1
  27. package/templates/tdesign/src/components/Navbar/Navbar.json +1 -1
  28. package/templates/tdesign/src/pages/index/index.json +1 -1
  29. package/templates/tdesign/src/pages/index/index.wxml +4 -4
  30. package/templates/tdesign/src/sitemap.json +1 -1
  31. package/templates/tdesign/src/theme.json +1 -1
  32. package/templates/tdesign/vite.config.ts +1 -1
  33. package/templates/vant/README.md +2 -2
  34. package/templates/vant/package.json +11 -11
  35. package/templates/vant/project.private.config.json +2 -1
  36. package/templates/vant/src/app.json +1 -1
  37. package/templates/vant/src/components/Navbar/Navbar.json +1 -1
  38. package/templates/vant/src/pages/index/index.json +1 -1
  39. package/templates/vant/src/pages/index/index.wxml +4 -4
  40. package/templates/vant/src/sitemap.json +1 -1
  41. package/templates/vant/src/theme.json +1 -1
  42. 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@1.1.2/node_modules/pathe/dist/shared/pathe.ff20891b.mjs
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 delimiter = ":";
22
- var normalize = function(path2) {
23
- if (path2.length === 0) {
188
+ var normalize = function(path) {
189
+ if (path.length === 0) {
24
190
  return ".";
25
191
  }
26
- path2 = normalizeWindowsPath(path2);
27
- const isUNCPath = path2.match(_UNC_REGEX);
28
- const isPathAbsolute = isAbsolute(path2);
29
- const trailingSeparator = path2[path2.length - 1] === "/";
30
- path2 = normalizeString(path2, !isPathAbsolute);
31
- if (path2.length === 0) {
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
- path2 += "/";
204
+ path += "/";
39
205
  }
40
- if (_DRIVE_LETTER_RE.test(path2)) {
41
- path2 += "/";
206
+ if (_DRIVE_LETTER_RE.test(path)) {
207
+ path += "/";
42
208
  }
43
209
  if (isUNCPath) {
44
210
  if (!isPathAbsolute) {
45
- return `//./${path2}`;
211
+ return `//./${path}`;
46
212
  }
47
- return `//${path2}`;
213
+ return `//${path}`;
48
214
  }
49
- return isPathAbsolute && !isAbsolute(path2) ? `/${path2}` : path2;
215
+ return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
50
216
  };
51
- var join = function(...arguments_) {
52
- if (arguments_.length === 0) {
53
- return ".";
54
- }
55
- let joined;
56
- for (const argument of arguments_) {
57
- if (argument && argument.length > 0) {
58
- if (joined === void 0) {
59
- joined = argument;
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
- joined += `/${argument}`;
230
+ path += pathTrailing || segLeading ? seg : `/${seg}`;
62
231
  }
232
+ } else {
233
+ path += seg;
63
234
  }
64
235
  }
65
- if (joined === void 0) {
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 path2 = index >= 0 ? arguments_[index] : cwd();
82
- if (!path2 || path2.length === 0) {
249
+ const path = index >= 0 ? arguments_[index] : cwd();
250
+ if (!path || path.length === 0) {
83
251
  continue;
84
252
  }
85
- resolvedPath = `${path2}/${resolvedPath}`;
86
- resolvedAbsolute = isAbsolute(path2);
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(path2, allowAboveRoot) {
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 <= path2.length; ++index) {
101
- if (index < path2.length) {
102
- char = path2[index];
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 += `/${path2.slice(lastSlash + 1, index)}`;
306
+ res += `/${path.slice(lastSlash + 1, index)}`;
139
307
  } else {
140
- res = path2.slice(lastSlash + 1, index);
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 segments = [p.root, p.dir, p.base ?? p.name + p.ext].filter(Boolean);
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 lastSegment = normalizeWindowsPath(p).split("/").pop();
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 = normalizeWindowsPath(p).split("/").shift() || "/";
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 path = {
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 = "2.0.1";
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 = path.dirname(fileURLToPath(import.meta.url));
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 = path.resolve(root, projectConfigFilename);
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 = path.resolve(root, packageJsonFilename);
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.icebreaker.top/",
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 = path.resolve(root, targetFilename);
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 = path.resolve(root, targetFilename);
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 = path.resolve(root, tsJsonFilename);
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 = path.resolve(root, tsNodeJsonFilename);
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 = path.resolve(root, ".gitignore");
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 = path.resolve(__dirname2, "../templates", templateName);
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 = path.resolve(targetTemplateDir, "package.json");
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(path.resolve(targetDir, "package.json"), pkgJson, { spaces: 2 });
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.15",
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.2.0",
42
- "@weapp-core/logger": "^1.0.2",
43
- "@weapp-core/shared": "^1.0.5"
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.5.8",
47
- "semver": "^7.6.3"
46
+ "@types/semver": "^7.7.0",
47
+ "semver": "^7.7.1"
48
48
  },
49
49
  "scripts": {
50
50
  "dev": "tsup --watch --sourcemap",
@@ -24,5 +24,5 @@
24
24
 
25
25
  ## 文档地址
26
26
 
27
- 0. `weapp-vite`: https://vite.icebreaker.top/
28
- 1. `weapp-tailwindcss`: https://tw.icebreaker.top/
27
+ 0. `weapp-vite`: https://ice-vite.netlify.app/
28
+ 1. `weapp-tailwindcss`: https://ice-tw.netlify.app/
@@ -23,9 +23,9 @@
23
23
  "g": "weapp-vite generate"
24
24
  },
25
25
  "devDependencies": {
26
- "miniprogram-api-typings": "^4.0.2",
27
- "sass": "^1.83.0",
28
- "typescript": "^5.7.2",
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
  }
@@ -3,5 +3,6 @@
3
3
  "projectname": "weapp-vite-template",
4
4
  "setting": {
5
5
  "compileHotReLoad": true
6
- }
6
+ },
7
+ "libVersion": "development"
7
8
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://vite.icebreaker.top/app.json",
2
+ "$schema": "https://ice-vite.netlify.app/app.json",
3
3
  "pages": [
4
4
  "pages/index/index"
5
5
  ],
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://vite.icebreaker.top/component.json",
2
+ "$schema": "https://ice-vite.netlify.app/component.json",
3
3
  "component": true,
4
4
  // 组件需要设置成 "apply-shared" 才能使用 app.wxss 里的全局样式
5
5
  "styleIsolation": "apply-shared",
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://vite.icebreaker.top/page.json",
2
+ "$schema": "https://ice-vite.netlify.app/page.json",
3
3
  "usingComponents": {
4
4
  "Navbar": "/components/Navbar/Navbar"
5
5
  },
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://vite.icebreaker.top/sitemap.json",
2
+ "$schema": "https://ice-vite.netlify.app/sitemap.json",
3
3
  "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
4
4
  "rules": [
5
5
  {
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://vite.icebreaker.top/theme.json",
2
+ "$schema": "https://ice-vite.netlify.app/theme.json",
3
3
  "light": {},
4
4
  "dark": {}
5
5
  }
@@ -4,7 +4,7 @@ export default defineConfig({
4
4
  weapp: {
5
5
  srcRoot: 'src',
6
6
  // pnpm g 生成的格式
7
- // https://vite.icebreaker.top/guide/generate.html
7
+ // https://ice-vite.netlify.app/guide/generate.html
8
8
  generate: {
9
9
  extensions: {
10
10
  js: 'ts',
@@ -24,5 +24,5 @@
24
24
 
25
25
  ## 文档地址
26
26
 
27
- 0. `weapp-vite`: https://vite.icebreaker.top/
28
- 1. `weapp-tailwindcss`: https://tw.icebreaker.top/
27
+ 0. `weapp-vite`: https://ice-vite.netlify.app/
28
+ 1. `weapp-tailwindcss`: https://ice-tw.netlify.app/
@@ -24,15 +24,15 @@
24
24
  "postinstall": "weapp-tw patch"
25
25
  },
26
26
  "devDependencies": {
27
- "@egoist/tailwindcss-icons": "^1.8.2",
28
- "@iconify-json/mdi": "^1.2.2",
29
- "autoprefixer": "^10.4.20",
30
- "miniprogram-api-typings": "^4.0.2",
31
- "postcss": "^8.4.49",
32
- "sass": "^1.83.0",
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.7.2",
35
- "weapp-tailwindcss": "^3.7.0",
34
+ "typescript": "^5.8.3",
35
+ "weapp-tailwindcss": "^4.1.5",
36
36
  "weapp-vite": "workspace:*"
37
37
  }
38
38
  }
@@ -3,5 +3,6 @@
3
3
  "projectname": "weapp-vite-tailwindcss-template",
4
4
  "setting": {
5
5
  "compileHotReLoad": true
6
- }
6
+ },
7
+ "libVersion": "development"
7
8
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://vite.icebreaker.top/app.json",
2
+ "$schema": "https://ice-vite.netlify.app/app.json",
3
3
  "pages": [
4
4
  "pages/index/index"
5
5
  ],