create-weapp-vite 2.0.39 → 2.0.41

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.
@@ -5,10 +5,10 @@ import fs2 from "fs-extra";
5
5
  import path2 from "pathe";
6
6
 
7
7
  // ../weapp-vite/package.json
8
- var version = "6.6.16";
8
+ var version = "6.7.1";
9
9
 
10
10
  // ../wevu/package.json
11
- var version2 = "6.6.16";
11
+ var version2 = "6.7.1";
12
12
 
13
13
  // src/enums.ts
14
14
  var TemplateName = /* @__PURE__ */ ((TemplateName2) => {
@@ -22,6 +22,78 @@ var TemplateName = /* @__PURE__ */ ((TemplateName2) => {
22
22
  return TemplateName2;
23
23
  })(TemplateName || {});
24
24
 
25
+ // src/generated/catalog.ts
26
+ var TEMPLATE_CATALOG = {
27
+ "@babel/core": "^7.29.0",
28
+ "@babel/generator": "^7.29.1",
29
+ "@babel/parser": "^7.29.0",
30
+ "@babel/traverse": "^7.29.0",
31
+ "@babel/types": "^7.29.0",
32
+ "@egoist/tailwindcss-icons": "^1.9.2",
33
+ "@iconify-json/mdi": "^1.2.3",
34
+ "@mini-types/alipay": "^3.0.14",
35
+ "@tailwindcss/postcss": "^4.2.1",
36
+ "@tailwindcss/vite": "^4.2.1",
37
+ "@types/node": "^25.3.3",
38
+ "@types/semver": "^7.7.1",
39
+ "@vant/weapp": "^1.11.7",
40
+ "@vue/compiler-core": "^3.5.29",
41
+ "@vue/language-core": "^3.2.5",
42
+ "antd-mini": "^3.4.3",
43
+ "bundle-require": "^5.1.0",
44
+ "class-variance-authority": "^0.7.1",
45
+ "comment-json": "^4.6.2",
46
+ "estree-walker": "^3.0.3",
47
+ "fs-extra": "^11.3.3",
48
+ "gm-crypto": "^0.1.12",
49
+ "lru-cache": "^11.2.6",
50
+ "magic-string": "^0.30.21",
51
+ "miniprogram-api-typings": "^5.1.1",
52
+ "miniprogram-automator": "^0.12.1",
53
+ "object-hash": "^3.0.0",
54
+ "pkg-types": "^2.3.0",
55
+ "sass-embedded": "^1.97.3",
56
+ "tdesign-miniprogram": "^1.12.3",
57
+ "ts-morph": "^27.0.2",
58
+ "vite-plugin-inspect": "^11.3.3",
59
+ "vue-tsc": "^3.2.5",
60
+ "weapp-tailwindcss": "^4.10.3",
61
+ autoprefixer: "^10.4.27",
62
+ clsx: "^2.1.1",
63
+ dayjs: "^1.9.3",
64
+ debug: "^4.4.3",
65
+ echarts: "^6.0.0",
66
+ esbuild: "^0.27.3",
67
+ fdir: "^6.5.0",
68
+ htmlparser2: "^10.1.0",
69
+ lodash: "^4.17.23",
70
+ merge: "^2.1.1",
71
+ pathe: "^2.0.3",
72
+ postcss: "^8.5.8",
73
+ sass: "^1.97.3",
74
+ tailwindcss: "^3.4.19",
75
+ tslib: "^2.8.1",
76
+ typescript: "^5.9.3",
77
+ vite: "8.0.0-beta.16",
78
+ vue: "^3.5.29",
79
+ zod: "^4.3.6"
80
+ };
81
+ var TEMPLATE_NAMED_CATALOG = {
82
+ "tdesign-miniprogram-fixed": {
83
+ "tdesign-miniprogram": "1.12.3"
84
+ },
85
+ "weapp-tailwindcss-fixed": {
86
+ "weapp-tailwindcss": "4.10.3"
87
+ },
88
+ latest: {
89
+ "miniprogram-api-typings": "latest",
90
+ typescript: "latest"
91
+ },
92
+ tailwind4: {
93
+ tailwindcss: "^4.2.1"
94
+ }
95
+ };
96
+
25
97
  // src/npm.ts
26
98
  import https from "https";
27
99
  function getLatestVersionFromNpm(packageName) {
@@ -211,6 +283,10 @@ async function updateGitIgnore(options) {
211
283
 
212
284
  // src/createProject.ts
213
285
  var moduleDir = path2.dirname(fileURLToPath(import.meta.url));
286
+ var templateCatalogMap = { ...TEMPLATE_CATALOG };
287
+ var templateNamedCatalogMap = Object.fromEntries(
288
+ Object.entries(TEMPLATE_NAMED_CATALOG).map(([name, deps]) => [name, { ...deps }])
289
+ );
214
290
  async function ensureDotGitignore(root) {
215
291
  const gitignorePath = path2.resolve(root, "gitignore");
216
292
  const dotGitignorePath = path2.resolve(root, ".gitignore");
@@ -254,6 +330,56 @@ function upsertExistingDependencyVersion(pkgJson, packageName, resolvedVersion)
254
330
  function toCaretVersion(version3) {
255
331
  return version3.startsWith("^") ? version3 : `^${version3}`;
256
332
  }
333
+ function resolveCatalogSpec(packageName, spec) {
334
+ if (!spec.startsWith("catalog:")) {
335
+ return spec;
336
+ }
337
+ const catalogName = spec.slice("catalog:".length);
338
+ if (!catalogName) {
339
+ return templateCatalogMap[packageName] ?? spec;
340
+ }
341
+ const fromNamedCatalog = templateNamedCatalogMap[catalogName]?.[packageName];
342
+ if (fromNamedCatalog) {
343
+ if (fromNamedCatalog === "latest") {
344
+ return templateCatalogMap[packageName] ?? fromNamedCatalog;
345
+ }
346
+ return fromNamedCatalog;
347
+ }
348
+ return templateCatalogMap[packageName] ?? spec;
349
+ }
350
+ function normalizeTemplateDependencySpecs(pkgJson) {
351
+ const fields = [
352
+ "dependencies",
353
+ "devDependencies",
354
+ "peerDependencies",
355
+ "optionalDependencies"
356
+ ];
357
+ for (const field of fields) {
358
+ const deps = pkgJson[field];
359
+ if (!deps) {
360
+ continue;
361
+ }
362
+ for (const [name, rawSpec] of Object.entries(deps)) {
363
+ if (typeof rawSpec !== "string" || !rawSpec) {
364
+ continue;
365
+ }
366
+ const spec = rawSpec;
367
+ if (spec.startsWith("catalog:")) {
368
+ deps[name] = resolveCatalogSpec(name, spec);
369
+ } else if (spec.startsWith("workspace:")) {
370
+ const workspaceSpec = spec.slice("workspace:".length);
371
+ if (workspaceSpec && /\d/.test(workspaceSpec)) {
372
+ deps[name] = workspaceSpec;
373
+ continue;
374
+ }
375
+ const fromCatalog = templateCatalogMap[name];
376
+ if (fromCatalog) {
377
+ deps[name] = fromCatalog;
378
+ }
379
+ }
380
+ }
381
+ }
382
+ }
257
383
  async function createProject(targetDir = "", templateName = "default" /* default */) {
258
384
  const targetTemplateDir = path2.resolve(moduleDir, "../templates", templateName);
259
385
  if (!await fs2.pathExists(targetTemplateDir)) {
@@ -265,6 +391,7 @@ async function createProject(targetDir = "", templateName = "default" /* default
265
391
  const packageJsonPath = path2.resolve(targetDir, "package.json");
266
392
  await ensureDotGitignore(targetDir);
267
393
  const pkgJson = await fs2.pathExists(templatePackagePath) ? await fs2.readJSON(templatePackagePath) : createEmptyPackageJson();
394
+ normalizeTemplateDependencySpecs(pkgJson);
268
395
  if (!pkgJson.devDependencies) {
269
396
  pkgJson.devDependencies = {};
270
397
  }
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createProject
3
- } from "./chunk-AISZU6F7.js";
3
+ } from "./chunk-B5POYA3P.js";
4
4
 
5
5
  // src/cli.ts
6
6
  import path from "path";
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  TemplateName,
3
3
  createProject
4
- } from "./chunk-AISZU6F7.js";
4
+ } from "./chunk-B5POYA3P.js";
5
5
  export {
6
6
  TemplateName,
7
7
  createProject
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-weapp-vite",
3
3
  "type": "module",
4
- "version": "2.0.39",
4
+ "version": "2.0.41",
5
5
  "description": "create-weapp-vite",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -42,6 +42,7 @@
42
42
  "@weapp-core/logger": "^3.1.0"
43
43
  },
44
44
  "scripts": {
45
+ "catalog:sync": "node --import tsx scripts/generate-template-catalog.ts",
45
46
  "dev": "tsup --watch --sourcemap",
46
47
  "build": "tsup",
47
48
  "test": "vitest run",
@@ -23,9 +23,9 @@
23
23
  "g": "weapp-vite generate"
24
24
  },
25
25
  "devDependencies": {
26
- "miniprogram-api-typings": "^5.1.1",
27
- "sass": "^1.97.3",
28
- "typescript": "^5.9.3",
26
+ "miniprogram-api-typings": "catalog:",
27
+ "sass": "catalog:",
28
+ "typescript": "catalog:",
29
29
  "weapp-vite": "workspace:*"
30
30
  }
31
31
  }
@@ -24,9 +24,9 @@
24
24
  "g": "weapp-vite generate"
25
25
  },
26
26
  "devDependencies": {
27
- "miniprogram-api-typings": "^5.1.1",
28
- "sass": "^1.97.3",
29
- "typescript": "^5.9.3",
27
+ "miniprogram-api-typings": "catalog:",
28
+ "sass": "catalog:",
29
+ "typescript": "catalog:",
30
30
  "weapp-vite": "workspace:*",
31
31
  "wevu": "workspace:*"
32
32
  }
@@ -24,15 +24,15 @@
24
24
  "postinstall": "weapp-tw patch"
25
25
  },
26
26
  "devDependencies": {
27
- "@egoist/tailwindcss-icons": "^1.9.2",
28
- "@iconify-json/mdi": "^1.2.3",
29
- "autoprefixer": "^10.4.27",
30
- "miniprogram-api-typings": "^5.1.1",
31
- "postcss": "^8.5.6",
32
- "sass": "^1.97.3",
33
- "tailwindcss": "^3.4.19",
34
- "typescript": "^5.9.3",
35
- "weapp-tailwindcss": "^4.10.3",
27
+ "@egoist/tailwindcss-icons": "catalog:",
28
+ "@iconify-json/mdi": "catalog:",
29
+ "autoprefixer": "catalog:",
30
+ "miniprogram-api-typings": "catalog:",
31
+ "postcss": "catalog:",
32
+ "sass": "catalog:",
33
+ "tailwindcss": "catalog:",
34
+ "typescript": "catalog:",
35
+ "weapp-tailwindcss": "catalog:",
36
36
  "weapp-vite": "workspace:*"
37
37
  }
38
38
  }
@@ -24,18 +24,18 @@
24
24
  "postinstall": "weapp-tw patch"
25
25
  },
26
26
  "dependencies": {
27
- "tdesign-miniprogram": "^1.12.3"
27
+ "tdesign-miniprogram": "catalog:"
28
28
  },
29
29
  "devDependencies": {
30
- "@egoist/tailwindcss-icons": "^1.9.2",
31
- "@iconify-json/mdi": "^1.2.3",
32
- "autoprefixer": "^10.4.27",
33
- "miniprogram-api-typings": "^5.1.1",
34
- "postcss": "^8.5.6",
35
- "sass": "^1.97.3",
36
- "tailwindcss": "^3.4.19",
37
- "typescript": "^5.9.3",
38
- "weapp-tailwindcss": "^4.10.3",
30
+ "@egoist/tailwindcss-icons": "catalog:",
31
+ "@iconify-json/mdi": "catalog:",
32
+ "autoprefixer": "catalog:",
33
+ "miniprogram-api-typings": "catalog:",
34
+ "postcss": "catalog:",
35
+ "sass": "catalog:",
36
+ "tailwindcss": "catalog:",
37
+ "typescript": "catalog:",
38
+ "weapp-tailwindcss": "catalog:",
39
39
  "weapp-vite": "workspace:*"
40
40
  }
41
41
  }
@@ -24,18 +24,18 @@
24
24
  "postinstall": "weapp-tw patch"
25
25
  },
26
26
  "dependencies": {
27
- "@vant/weapp": "^1.11.7"
27
+ "@vant/weapp": "catalog:"
28
28
  },
29
29
  "devDependencies": {
30
- "@egoist/tailwindcss-icons": "^1.9.2",
31
- "@iconify-json/mdi": "^1.2.3",
32
- "autoprefixer": "^10.4.27",
33
- "miniprogram-api-typings": "^5.1.1",
34
- "postcss": "^8.5.6",
35
- "sass": "^1.97.3",
36
- "tailwindcss": "^3.4.19",
37
- "typescript": "^5.9.3",
38
- "weapp-tailwindcss": "^4.10.3",
30
+ "@egoist/tailwindcss-icons": "catalog:",
31
+ "@iconify-json/mdi": "catalog:",
32
+ "autoprefixer": "catalog:",
33
+ "miniprogram-api-typings": "catalog:",
34
+ "postcss": "catalog:",
35
+ "sass": "catalog:",
36
+ "tailwindcss": "catalog:",
37
+ "typescript": "catalog:",
38
+ "weapp-tailwindcss": "catalog:",
39
39
  "weapp-vite": "workspace:*"
40
40
  }
41
41
  }
@@ -23,9 +23,9 @@
23
23
  "open": "weapp-vite open"
24
24
  },
25
25
  "devDependencies": {
26
- "miniprogram-api-typings": "^5.1.1",
27
- "typescript": "^5.9.3",
28
- "vue-tsc": "^3.2.5",
26
+ "miniprogram-api-typings": "catalog:",
27
+ "typescript": "catalog:",
28
+ "vue-tsc": "catalog:",
29
29
  "weapp-vite": "workspace:*",
30
30
  "wevu": "workspace:*"
31
31
  }
@@ -24,19 +24,19 @@
24
24
  "postinstall": "weapp-tw patch"
25
25
  },
26
26
  "dependencies": {
27
- "tdesign-miniprogram": "^1.12.3"
27
+ "tdesign-miniprogram": "catalog:"
28
28
  },
29
29
  "devDependencies": {
30
- "@egoist/tailwindcss-icons": "^1.9.2",
31
- "@iconify-json/mdi": "^1.2.3",
32
- "autoprefixer": "^10.4.27",
33
- "miniprogram-api-typings": "^5.1.1",
34
- "postcss": "^8.5.6",
35
- "sass": "^1.97.3",
36
- "tailwindcss": "^3.4.19",
37
- "typescript": "^5.9.3",
38
- "vue-tsc": "^3.2.5",
39
- "weapp-tailwindcss": "^4.10.3",
30
+ "@egoist/tailwindcss-icons": "catalog:",
31
+ "@iconify-json/mdi": "catalog:",
32
+ "autoprefixer": "catalog:",
33
+ "miniprogram-api-typings": "catalog:",
34
+ "postcss": "catalog:",
35
+ "sass": "catalog:",
36
+ "tailwindcss": "catalog:",
37
+ "typescript": "catalog:",
38
+ "vue-tsc": "catalog:",
39
+ "weapp-tailwindcss": "catalog:",
40
40
  "weapp-vite": "workspace:*",
41
41
  "wevu": "workspace:*"
42
42
  }