create-weapp-vite 3.1.0 → 3.3.0
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/README.md +4 -2
- package/dist/cli.d.ts +1 -3
- package/dist/cli.js +3 -4
- package/dist/index.d.ts +0 -8
- package/dist/index.js +1 -1
- package/dist/{src-e_dbVCCq.js → src-Dz0Mumdl.js} +72 -94
- package/package.json +8 -8
- package/templates/lib/package.json +1 -1
- package/templates/react/package.json +2 -2
- package/templates/wevu-tdesign/weapp-vite.config.ts +3 -1
package/README.md
CHANGED
|
@@ -17,9 +17,11 @@
|
|
|
17
17
|
|
|
18
18
|
推荐直接使用包管理器的 create 命令:
|
|
19
19
|
|
|
20
|
-
>
|
|
20
|
+
> 官方支持 Node.js 22(至少 `22.23.4`)、24(至少 `24.22.1`)或 26(至少 `26.12.1`)及以上版本。建议使用受支持 LTS 分支的最新安全补丁版本,再执行 `pnpm create weapp-vite`、`yarn create weapp-vite` 或 `npm create weapp-vite@latest`。
|
|
21
21
|
|
|
22
|
-
框架包 `weapp-vite`
|
|
22
|
+
框架包 `weapp-vite` 与脚手架采用相同的 Node 支持范围;Vite+ 模板要求 `^24.22.1 || >=26.12.1`。
|
|
23
|
+
|
|
24
|
+
生成项目中的 `weapp-vite` CLI(含 `prepare`)与 Tailwind 集成遇到范围外的 Node 版本时,会提示升级并继续尝试执行。Node 缺少依赖所需的语法或 API 时仍可能失败;项目或团队启用严格 engines 校验时,包管理器也可能拒绝安装。
|
|
23
25
|
|
|
24
26
|
```bash
|
|
25
27
|
pnpm create weapp-vite
|
package/dist/cli.d.ts
CHANGED
package/dist/cli.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { a as validateDependencyVersionStrategy, n as validateToolchain,
|
|
1
|
+
import { a as validateDependencyVersionStrategy, n as validateToolchain, t as createProject } from "./src-Dz0Mumdl.js";
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import logger from "@weapp-core/logger";
|
|
4
4
|
import { fs } from "@weapp-core/shared/fs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { confirm, input, select } from "@inquirer/prompts";
|
|
7
7
|
import { initConfig } from "@weapp-core/init";
|
|
8
|
-
|
|
8
|
+
// src/cli.ts
|
|
9
9
|
const cwd = process.cwd();
|
|
10
10
|
const TEMPLATE_CHOICES = [
|
|
11
11
|
{
|
|
@@ -124,7 +124,7 @@ async function run() {
|
|
|
124
124
|
default: "default"
|
|
125
125
|
});
|
|
126
126
|
const installSkills = argInstallSkills ?? (isArgMode ? false : await confirm({
|
|
127
|
-
message: `是否安装推荐的 AI skills?将执行
|
|
127
|
+
message: `是否安装推荐的 AI skills?将执行 \`npx --yes skills add sonofmagic/skills\`,也可稍后手动执行`,
|
|
128
128
|
default: false
|
|
129
129
|
}));
|
|
130
130
|
await createProject(targetDir, templateName, {
|
|
@@ -146,5 +146,4 @@ const runPromise = run().catch((err) => {
|
|
|
146
146
|
logger.error("✗ 创建失败:", message);
|
|
147
147
|
process.exitCode = 1;
|
|
148
148
|
});
|
|
149
|
-
//#endregion
|
|
150
149
|
export { run, runPromise };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import "npm-registry-fetch";
|
|
2
2
|
import "pkg-types";
|
|
3
|
-
//#region src/dependencyVersions/index.d.ts
|
|
4
3
|
type DependencyVersionStrategy = 'compatible' | 'bundled';
|
|
5
|
-
//#endregion
|
|
6
|
-
//#region src/toolchain.d.ts
|
|
7
4
|
type Toolchain = 'wv' | 'vite' | 'vite-plus';
|
|
8
|
-
//#endregion
|
|
9
|
-
//#region src/enums.d.ts
|
|
10
5
|
export declare enum TemplateName {
|
|
11
6
|
default = "default",
|
|
12
7
|
multiPlatform = "multi-platform",
|
|
@@ -20,8 +15,6 @@ export declare enum TemplateName {
|
|
|
20
15
|
react = "react",
|
|
21
16
|
lib = "lib"
|
|
22
17
|
}
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region src/createProject.d.ts
|
|
25
18
|
interface CreateProjectOptions {
|
|
26
19
|
/** 选择构建宿主,业务模板与工具链独立。 */
|
|
27
20
|
toolchain?: Toolchain;
|
|
@@ -34,5 +27,4 @@ interface CreateProjectOptions {
|
|
|
34
27
|
* @description 根据模板创建项目
|
|
35
28
|
*/
|
|
36
29
|
export declare function createProject(targetDir?: string, templateName?: TemplateName, options?: CreateProjectOptions): Promise<void>;
|
|
37
|
-
//#endregion
|
|
38
30
|
export type { CreateProjectOptions, DependencyVersionStrategy, Toolchain };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { i as TemplateName, t as createProject } from "./src-
|
|
1
|
+
export { i as TemplateName, t as createProject } from "./src-Dz0Mumdl.js";
|
|
@@ -14,7 +14,7 @@ import makeFetch from "make-fetch-happen";
|
|
|
14
14
|
import registryFetch from "npm-registry-fetch";
|
|
15
15
|
import { isIP } from "node:net";
|
|
16
16
|
import { execa } from "execa";
|
|
17
|
-
|
|
17
|
+
// src/generated/agents.ts
|
|
18
18
|
const generatedAgentGuidelines = {
|
|
19
19
|
"default": "# AGENTS Guidelines\n\n<!-- agents-generated: v1 -->\n<!-- source: template:default; manifest-version: 1; generator-version: 1 -->\n\n## Mini-program Runtime Host APIs\n\n- 小程序 AppService 不是浏览器或 Node.js。新增 `queueMicrotask`、Web API、DOM/Node 全局或现代内建前,必须先在目标平台的真实 IDE、目标基础库和 renderer 中探测存在性与最小调用语义;浏览器、Node、类型声明和 headless simulator 结果都不能替代真实 IDE 证据。\n- 微信运行时不得假定存在 `queueMicrotask`。即使某个 DevTools 版本探测为可用,也必须使用显式兼容层,或确认项目已经启用对应的 weapp-vite runtime global 注入。\n- 项目 ESLint 配置应接入 `@weapp-vite/eslint` 的 `miniProgramRuntimeRecommended` 或 `createMiniProgramRuntimeConfig()`,只检查会进入小程序运行时的 `src` 代码;config、构建脚本、测试、Web-only、WXS 和生成产物不纳入该规则。\n\n## Local Docs First\n\n- After dependencies are installed, prefer reading local package docs under `node_modules/weapp-vite/dist/docs/` first.\n- Start with `node_modules/weapp-vite/dist/docs/index.md`, then read `README.md` and `mcp.md` as needed.\n- Prefer local package docs over stale model memory or old web pages when command behavior is unclear.\n\n## CLI Entry\n\n- This project supports both `weapp-vite` and `wv` CLI commands.\n- Treat `weapp-vite dev` and `wv dev` as equivalent forms.\n- Prefer project scripts such as `pnpm dev`, `pnpm build`, `pnpm open`, and `pnpm g` before ad-hoc shell commands.\n- Use `weapp-vite prepare` or `wv prepare` when managed support files under `.weapp-vite/` need to be refreshed.\n- Prefer `weapp-vite screenshot` or `wv screenshot` for mini-program screenshot acceptance.\n- Prefer `weapp-vite compare` or `wv compare` for mini-program screenshot diff, baseline comparison, and visual regression checks.\n- Prefer `weapp-vite ide logs --open` or `wv ide logs --open` for DevTools terminal log bridging.\n- Do not default to generic browser screenshot tools when the target is the mini-program runtime in WeChat DevTools.\n\n## AI Intent Routing\n\n- When the request mentions screenshot, 截图, 页面快照, runtime screenshot, or capture the current mini-program page, default to `weapp-vite screenshot` / `wv screenshot`.\n- When the request mentions screenshot compare, 截图对比, diff, baseline, visual regression, 像素对比, or acceptance comparison, default to `weapp-vite compare` / `wv compare`.\n- Treat these commands as the primary screenshot contract for AI workflows in this project.\n- Only fall back to generic browser screenshot tools when the target is explicitly the web runtime instead of WeChat DevTools.\n\n## Weapp-vite Workflow\n\n- Keep `vite.config.ts` as the source of truth for `weapp` config, output behavior, and IDE/MCP automation.\n- Confirm `weapp.srcRoot`, routes, subpackages, and auto-import strategy before broad refactors.\n- Prefer minimal scoped verification: targeted `pnpm build`, targeted tests, then broader checks only when required.\n- If editing package source in a monorepo dependency, rebuild the touched package before validating downstream apps to avoid stale `dist`.\n- Keep CLI ownership explicit: native `weapp-vite` commands first, IDE passthrough second.\n- For Rust/native acceleration, treat JS ↔ Rust boundary crossings as a primary performance cost. Prefer batch analysis that sends source once, parses once, and returns structured results; only put fine-grained native APIs on hot paths when profiling proves a net win.\n- Keep native AST fast paths optional and explicitly enabled. They must fall back to Babel/Oxc/Vue compiler behavior on load, parse, or runtime failure, and new native coverage needs correctness tests plus real profiling.\n\n## WeChat DevTools\n\n- Before using screenshot, preview, upload, automator, or `--open`, ensure WeChat DevTools is logged in and the service port is enabled.\n- `wv open`, `wv dev -o`, and `wv build -o` use the official DevTools CLI first, then connect automator; if the IDE is open but automator is unavailable, run `wv ide doctor --json` before retrying.\n- Use `--ide-open-strategy automator` only for explicit compatibility debugging; do not treat it as the default startup path.\n- Prefer writing screenshots to workspace paths such as `.tmp/acceptance.png`.\n\n## AI Skills\n\n- Recommend installing shared skills with `npx skills add sonofmagic/skills`.\n- In Codex/Claude environments, prefer these skills first when available:\n - `$weapp-vite-best-practices` for config, build, subpackage, route, DevTools CLI orchestration, and screenshot/compare command work.\n - `$weapp-vite-vue-sfc-best-practices` for `.vue` SFC macros, JSON blocks, and template compatibility.\n - `$release-and-changeset-best-practices` for issue delivery, pnpm change intents, repoctl release decisions, and PR workflow.\n - `$docs-and-website-sync` when documentation or AI guidance must be refreshed together with code changes.\n - Use `$weapp-vite-best-practices` for stateful HMR, pluginRoot/dist-plugin, Web runtime compatibility, and native AST profiling; use `$wevu-best-practices` for `wevu/router` navigation semantics.\n - Use `$weapp-devtools-e2e-best-practices` for serialized DevTools runtime suites, shared automator sessions, and known host compatibility skips.\n - `$weapp-acceptance` for repeatable checks with `wv accept`, assertions and current-code evidence; no extra model Key.\n - `$native-to-weapp-vite-wevu-migration` when migrating native mini-program projects to `weapp-vite + native`, or further toward Vue SFC / wevu.\n\n## Native Mini-program Authoring\n\n- Keep native page/component structure consistent with the template unless there is a clear migration goal.\n- Prefer `weapp-vite generate` or `wv generate` for new app/page/component scaffolds.\n- If migrating this project, first decide whether the target is `weapp-vite + native` or a further Vue SFC / `wevu` migration, then keep each migration wave explicit.\n\n## Local Overlay\n\n- If `AGENTS.local.md` exists in this project or directory, read it after this file and apply its project-specific additions.\n- Keep generated `AGENTS.md` files managed by the repository tooling; put user-owned custom rules in `AGENTS.local.md`.\n",
|
|
20
20
|
"multi-platform": "# AGENTS Guidelines\n\n<!-- agents-generated: v1 -->\n<!-- source: template:multi-platform; manifest-version: 1; generator-version: 1 -->\n\n## Mini-program Runtime Host APIs\n\n- 小程序 AppService 不是浏览器或 Node.js。新增 `queueMicrotask`、Web API、DOM/Node 全局或现代内建前,必须先在目标平台的真实 IDE、目标基础库和 renderer 中探测存在性与最小调用语义;浏览器、Node、类型声明和 headless simulator 结果都不能替代真实 IDE 证据。\n- 微信运行时不得假定存在 `queueMicrotask`。即使某个 DevTools 版本探测为可用,也必须使用显式兼容层,或确认项目已经启用对应的 weapp-vite runtime global 注入。\n- 项目 ESLint 配置应接入 `@weapp-vite/eslint` 的 `miniProgramRuntimeRecommended` 或 `createMiniProgramRuntimeConfig()`,只检查会进入小程序运行时的 `src` 代码;config、构建脚本、测试、Web-only、WXS 和生成产物不纳入该规则。\n\n## Local Docs First\n\n- After dependencies are installed, prefer reading local package docs under `node_modules/weapp-vite/dist/docs/` first.\n- Start with `node_modules/weapp-vite/dist/docs/index.md`, then read `README.md` and `mcp.md` as needed.\n- Prefer local package docs over stale model memory or old web pages when command behavior is unclear.\n\n## CLI Entry\n\n- This project supports both `weapp-vite` and `wv` CLI commands.\n- Treat `weapp-vite dev` and `wv dev` as equivalent forms.\n- Prefer project scripts such as `pnpm dev`, `pnpm build`, `pnpm open`, and `pnpm g` before ad-hoc shell commands.\n- Use `weapp-vite prepare` or `wv prepare` when managed support files under `.weapp-vite/` need to be refreshed.\n- Prefer `weapp-vite screenshot` or `wv screenshot` for mini-program screenshot acceptance.\n- Prefer `weapp-vite compare` or `wv compare` for mini-program screenshot diff, baseline comparison, and visual regression checks.\n- Prefer `weapp-vite ide logs --open` or `wv ide logs --open` for DevTools terminal log bridging.\n- Do not default to generic browser screenshot tools when the target is the mini-program runtime in WeChat DevTools.\n\n## AI Intent Routing\n\n- When the request mentions screenshot, 截图, 页面快照, runtime screenshot, or capture the current mini-program page, default to `weapp-vite screenshot` / `wv screenshot`.\n- When the request mentions screenshot compare, 截图对比, diff, baseline, visual regression, 像素对比, or acceptance comparison, default to `weapp-vite compare` / `wv compare`.\n- Treat these commands as the primary screenshot contract for AI workflows in this project.\n- Only fall back to generic browser screenshot tools when the target is explicitly the web runtime instead of WeChat DevTools.\n\n## Weapp-vite Workflow\n\n- Keep `vite.config.ts` as the source of truth for `weapp` config, output behavior, and IDE/MCP automation.\n- Confirm `weapp.srcRoot`, routes, subpackages, and auto-import strategy before broad refactors.\n- Prefer minimal scoped verification: targeted `pnpm build`, targeted tests, then broader checks only when required.\n- If editing package source in a monorepo dependency, rebuild the touched package before validating downstream apps to avoid stale `dist`.\n- Keep CLI ownership explicit: native `weapp-vite` commands first, IDE passthrough second.\n- For Rust/native acceleration, treat JS ↔ Rust boundary crossings as a primary performance cost. Prefer batch analysis that sends source once, parses once, and returns structured results; only put fine-grained native APIs on hot paths when profiling proves a net win.\n- Keep native AST fast paths optional and explicitly enabled. They must fall back to Babel/Oxc/Vue compiler behavior on load, parse, or runtime failure, and new native coverage needs correctness tests plus real profiling.\n\n## WeChat DevTools\n\n- Before using screenshot, preview, upload, automator, or `--open`, ensure WeChat DevTools is logged in and the service port is enabled.\n- `wv open`, `wv dev -o`, and `wv build -o` use the official DevTools CLI first, then connect automator; if the IDE is open but automator is unavailable, run `wv ide doctor --json` before retrying.\n- Use `--ide-open-strategy automator` only for explicit compatibility debugging; do not treat it as the default startup path.\n- Prefer writing screenshots to workspace paths such as `.tmp/acceptance.png`.\n\n## AI Skills\n\n- Recommend installing shared skills with `npx skills add sonofmagic/skills`.\n- In Codex/Claude environments, prefer these skills first when available:\n - `$weapp-vite-best-practices` for config, build, subpackage, route, DevTools CLI orchestration, and screenshot/compare command work.\n - `$weapp-vite-vue-sfc-best-practices` for `.vue` SFC macros, JSON blocks, and template compatibility.\n - `$release-and-changeset-best-practices` for issue delivery, pnpm change intents, repoctl release decisions, and PR workflow.\n - `$docs-and-website-sync` when documentation or AI guidance must be refreshed together with code changes.\n - Use `$weapp-vite-best-practices` for stateful HMR, pluginRoot/dist-plugin, Web runtime compatibility, and native AST profiling; use `$wevu-best-practices` for `wevu/router` navigation semantics.\n - Use `$weapp-devtools-e2e-best-practices` for serialized DevTools runtime suites, shared automator sessions, and known host compatibility skips.\n - `$weapp-acceptance` for repeatable checks with `wv accept`, assertions and current-code evidence; no extra model Key.\n - `$native-to-weapp-vite-wevu-migration` when migrating native mini-program projects to `weapp-vite + native`, or further toward Vue SFC / wevu.\n\n## Native Mini-program Authoring\n\n- Keep native page/component structure consistent with the template unless there is a clear migration goal.\n- Prefer `weapp-vite generate` or `wv generate` for new app/page/component scaffolds.\n- If migrating this project, first decide whether the target is `weapp-vite + native` or a further Vue SFC / `wevu` migration, then keep each migration wave explicit.\n\n## Multi-platform Workflow\n\n- This project builds one target at a time. Always pass an explicit platform or use `pnpm dev:<platform>` / `pnpm build:<platform>`.\n- Keep platform IDE configuration under `config/<platform>` and import `dist/<platform>` into the matching mini-program IDE.\n- Use `pnpm dev:web` for browser compatibility work, but keep mini-program DevTools or device acceptance as the release authority.\n- Treat WeChat, Web, official IDE compilation, and unsupported automator targets as separate verification layers; do not report a build-only check as runtime E2E.\n\n## Local Overlay\n\n- If `AGENTS.local.md` exists in this project or directory, read it after this file and apply its project-specific additions.\n- Keep generated `AGENTS.md` files managed by the repository tooling; put user-owned custom rules in `AGENTS.local.md`.\n",
|
|
@@ -28,8 +28,7 @@ const generatedAgentGuidelines = {
|
|
|
28
28
|
"react": "# AGENTS Guidelines\n\n<!-- agents-generated: v1 -->\n<!-- source: template:react; manifest-version: 1; generator-version: 1 -->\n\n## Mini-program Runtime Host APIs\n\n- 小程序 AppService 不是浏览器或 Node.js。新增 `queueMicrotask`、Web API、DOM/Node 全局或现代内建前,必须先在目标平台的真实 IDE、目标基础库和 renderer 中探测存在性与最小调用语义;浏览器、Node、类型声明和 headless simulator 结果都不能替代真实 IDE 证据。\n- 微信运行时不得假定存在 `queueMicrotask`。即使某个 DevTools 版本探测为可用,也必须使用显式兼容层,或确认项目已经启用对应的 weapp-vite runtime global 注入。\n- 项目 ESLint 配置应接入 `@weapp-vite/eslint` 的 `miniProgramRuntimeRecommended` 或 `createMiniProgramRuntimeConfig()`,只检查会进入小程序运行时的 `src` 代码;config、构建脚本、测试、Web-only、WXS 和生成产物不纳入该规则。\n\n## Local Docs First\n\n- After dependencies are installed, prefer reading local package docs under `node_modules/weapp-vite/dist/docs/` first.\n- Start with `node_modules/weapp-vite/dist/docs/index.md`, then read `README.md` and `mcp.md` as needed.\n- Prefer local package docs over stale model memory or old web pages when command behavior is unclear.\n\n## CLI Entry\n\n- This project supports both `weapp-vite` and `wv` CLI commands.\n- Treat `weapp-vite dev` and `wv dev` as equivalent forms.\n- Prefer project scripts such as `pnpm dev`, `pnpm build`, `pnpm open`, and `pnpm g` before ad-hoc shell commands.\n- Use `weapp-vite prepare` or `wv prepare` when managed support files under `.weapp-vite/` need to be refreshed.\n- Prefer `weapp-vite screenshot` or `wv screenshot` for mini-program screenshot acceptance.\n- Prefer `weapp-vite compare` or `wv compare` for mini-program screenshot diff, baseline comparison, and visual regression checks.\n- Prefer `weapp-vite ide logs --open` or `wv ide logs --open` for DevTools terminal log bridging.\n- Do not default to generic browser screenshot tools when the target is the mini-program runtime in WeChat DevTools.\n\n## AI Intent Routing\n\n- When the request mentions screenshot, 截图, 页面快照, runtime screenshot, or capture the current mini-program page, default to `weapp-vite screenshot` / `wv screenshot`.\n- When the request mentions screenshot compare, 截图对比, diff, baseline, visual regression, 像素对比, or acceptance comparison, default to `weapp-vite compare` / `wv compare`.\n- Treat these commands as the primary screenshot contract for AI workflows in this project.\n- Only fall back to generic browser screenshot tools when the target is explicitly the web runtime instead of WeChat DevTools.\n\n## Weapp-vite Workflow\n\n- Keep `vite.config.ts` as the source of truth for `weapp` config, output behavior, and IDE/MCP automation.\n- Confirm `weapp.srcRoot`, routes, subpackages, and auto-import strategy before broad refactors.\n- Prefer minimal scoped verification: targeted `pnpm build`, targeted tests, then broader checks only when required.\n- If editing package source in a monorepo dependency, rebuild the touched package before validating downstream apps to avoid stale `dist`.\n- Keep CLI ownership explicit: native `weapp-vite` commands first, IDE passthrough second.\n- For Rust/native acceleration, treat JS ↔ Rust boundary crossings as a primary performance cost. Prefer batch analysis that sends source once, parses once, and returns structured results; only put fine-grained native APIs on hot paths when profiling proves a net win.\n- Keep native AST fast paths optional and explicitly enabled. They must fall back to Babel/Oxc/Vue compiler behavior on load, parse, or runtime failure, and new native coverage needs correctness tests plus real profiling.\n\n## WeChat DevTools\n\n- Before using screenshot, preview, upload, automator, or `--open`, ensure WeChat DevTools is logged in and the service port is enabled.\n- `wv open`, `wv dev -o`, and `wv build -o` use the official DevTools CLI first, then connect automator; if the IDE is open but automator is unavailable, run `wv ide doctor --json` before retrying.\n- Use `--ide-open-strategy automator` only for explicit compatibility debugging; do not treat it as the default startup path.\n- Prefer writing screenshots to workspace paths such as `.tmp/acceptance.png`.\n\n## AI Skills\n\n- Recommend installing shared skills with `npx skills add sonofmagic/skills`.\n- In Codex/Claude environments, prefer these skills first when available:\n - `$weapp-vite-best-practices` for config, build, subpackage, route, DevTools CLI orchestration, and screenshot/compare command work.\n - `$weapp-vite-vue-sfc-best-practices` for `.vue` SFC macros, JSON blocks, and template compatibility.\n - `$release-and-changeset-best-practices` for issue delivery, pnpm change intents, repoctl release decisions, and PR workflow.\n - `$docs-and-website-sync` when documentation or AI guidance must be refreshed together with code changes.\n - Use `$weapp-vite-best-practices` for stateful HMR, pluginRoot/dist-plugin, Web runtime compatibility, and native AST profiling; use `$wevu-best-practices` for `wevu/router` navigation semantics.\n - Use `$weapp-devtools-e2e-best-practices` for serialized DevTools runtime suites, shared automator sessions, and known host compatibility skips.\n - `$weapp-vite-react-best-practices` for React 19 JSX/TSX ownership, render modes, root lifecycle, React Compiler, and native/Wevu component bridges.\n\n## React Mini-program Authoring\n\n- Keep `weapp.react` as the project-level owner for all `.jsx` and `.tsx` modules; do not mix Wevu JSX in the same build.\n- Use the current workspace baseline of React 19.3.x, `react-reconciler` 0.34.x, and `@weapp-vite/react` without `react-dom`.\n- Start with `renderMode: 'auto'`; use `dynamic` only for reconciler-tree diagnostics and `static` for strict static-shape validation.\n- Create and unmount `createReactMiniProgramRoot` in the native page/component lifecycle, and forward host events through the root.\n- Register native or Wevu custom components in `usingComponents` before declaring a top-level `createNativeComponent()` bridge in the current TSX file.\n- Treat the current React runtime as WeChat-only; Web, Alipay, and Douyin builds are not runtime compatibility evidence.\n\n## Local Overlay\n\n- If `AGENTS.local.md` exists in this project or directory, read it after this file and apply its project-specific additions.\n- Keep generated `AGENTS.md` files managed by the repository tooling; put user-owned custom rules in `AGENTS.local.md`.\n",
|
|
29
29
|
"lib": "# AGENTS Guidelines\n\n<!-- agents-generated: v1 -->\n<!-- source: template:lib; manifest-version: 1; generator-version: 1 -->\n\n## Mini-program Runtime Host APIs\n\n- 小程序 AppService 不是浏览器或 Node.js。新增 `queueMicrotask`、Web API、DOM/Node 全局或现代内建前,必须先在目标平台的真实 IDE、目标基础库和 renderer 中探测存在性与最小调用语义;浏览器、Node、类型声明和 headless simulator 结果都不能替代真实 IDE 证据。\n- 微信运行时不得假定存在 `queueMicrotask`。即使某个 DevTools 版本探测为可用,也必须使用显式兼容层,或确认项目已经启用对应的 weapp-vite runtime global 注入。\n- 项目 ESLint 配置应接入 `@weapp-vite/eslint` 的 `miniProgramRuntimeRecommended` 或 `createMiniProgramRuntimeConfig()`,只检查会进入小程序运行时的 `src` 代码;config、构建脚本、测试、Web-only、WXS 和生成产物不纳入该规则。\n\n## Local Docs First\n\n- After dependencies are installed, prefer reading local package docs under `node_modules/weapp-vite/dist/docs/` first.\n- Start with `node_modules/weapp-vite/dist/docs/index.md`, then read `README.md` and `mcp.md` as needed.\n- Prefer local package docs over stale model memory or old web pages when command behavior is unclear.\n\n## CLI Entry\n\n- This project supports both `weapp-vite` and `wv` CLI commands.\n- Treat `weapp-vite dev` and `wv dev` as equivalent forms.\n- Prefer project scripts such as `pnpm dev`, `pnpm build`, `pnpm open`, and `pnpm g` before ad-hoc shell commands.\n- Use `weapp-vite prepare` or `wv prepare` when managed support files under `.weapp-vite/` need to be refreshed.\n- Prefer `weapp-vite screenshot` or `wv screenshot` for mini-program screenshot acceptance.\n- Prefer `weapp-vite compare` or `wv compare` for mini-program screenshot diff, baseline comparison, and visual regression checks.\n- Prefer `weapp-vite ide logs --open` or `wv ide logs --open` for DevTools terminal log bridging.\n- Do not default to generic browser screenshot tools when the target is the mini-program runtime in WeChat DevTools.\n\n## AI Intent Routing\n\n- When the request mentions screenshot, 截图, 页面快照, runtime screenshot, or capture the current mini-program page, default to `weapp-vite screenshot` / `wv screenshot`.\n- When the request mentions screenshot compare, 截图对比, diff, baseline, visual regression, 像素对比, or acceptance comparison, default to `weapp-vite compare` / `wv compare`.\n- Treat these commands as the primary screenshot contract for AI workflows in this project.\n- Only fall back to generic browser screenshot tools when the target is explicitly the web runtime instead of WeChat DevTools.\n\n## Weapp-vite Workflow\n\n- Keep `vite.config.ts` as the source of truth for `weapp` config, output behavior, and IDE/MCP automation.\n- Confirm `weapp.srcRoot`, routes, subpackages, and auto-import strategy before broad refactors.\n- Prefer minimal scoped verification: targeted `pnpm build`, targeted tests, then broader checks only when required.\n- If editing package source in a monorepo dependency, rebuild the touched package before validating downstream apps to avoid stale `dist`.\n- Keep CLI ownership explicit: native `weapp-vite` commands first, IDE passthrough second.\n- For Rust/native acceleration, treat JS ↔ Rust boundary crossings as a primary performance cost. Prefer batch analysis that sends source once, parses once, and returns structured results; only put fine-grained native APIs on hot paths when profiling proves a net win.\n- Keep native AST fast paths optional and explicitly enabled. They must fall back to Babel/Oxc/Vue compiler behavior on load, parse, or runtime failure, and new native coverage needs correctness tests plus real profiling.\n\n## WeChat DevTools\n\n- Before using screenshot, preview, upload, automator, or `--open`, ensure WeChat DevTools is logged in and the service port is enabled.\n- `wv open`, `wv dev -o`, and `wv build -o` use the official DevTools CLI first, then connect automator; if the IDE is open but automator is unavailable, run `wv ide doctor --json` before retrying.\n- Use `--ide-open-strategy automator` only for explicit compatibility debugging; do not treat it as the default startup path.\n- Prefer writing screenshots to workspace paths such as `.tmp/acceptance.png`.\n\n## AI Skills\n\n- Recommend installing shared skills with `npx skills add sonofmagic/skills`.\n- In Codex/Claude environments, prefer these skills first when available:\n - `$weapp-vite-best-practices` for config, build, subpackage, route, DevTools CLI orchestration, and screenshot/compare command work.\n - `$weapp-vite-vue-sfc-best-practices` for `.vue` SFC macros, JSON blocks, and template compatibility.\n - `$release-and-changeset-best-practices` for issue delivery, pnpm change intents, repoctl release decisions, and PR workflow.\n - `$docs-and-website-sync` when documentation or AI guidance must be refreshed together with code changes.\n - Use `$weapp-vite-best-practices` for stateful HMR, pluginRoot/dist-plugin, Web runtime compatibility, and native AST profiling; use `$wevu-best-practices` for `wevu/router` navigation semantics.\n - Use `$weapp-devtools-e2e-best-practices` for serialized DevTools runtime suites, shared automator sessions, and known host compatibility skips.\n - `$weapp-acceptance` for repeatable checks with `wv accept`, assertions and current-code evidence; no extra model Key.\n - `$native-to-weapp-vite-wevu-migration` when migrating native mini-program projects to `weapp-vite + native`, or further toward Vue SFC / wevu.\n\n## Native Mini-program Authoring\n\n- Keep native page/component structure consistent with the template unless there is a clear migration goal.\n- Prefer `weapp-vite generate` or `wv generate` for new app/page/component scaffolds.\n- If migrating this project, first decide whether the target is `weapp-vite + native` or a further Vue SFC / `wevu` migration, then keep each migration wave explicit.\n\n## Local Overlay\n\n- If `AGENTS.local.md` exists in this project or directory, read it after this file and apply its project-specific additions.\n- Keep generated `AGENTS.md` files managed by the repository tooling; put user-owned custom rules in `AGENTS.local.md`.\n"
|
|
30
30
|
};
|
|
31
|
-
|
|
32
|
-
//#region src/agents.ts
|
|
31
|
+
// src/agents.ts
|
|
33
32
|
/**
|
|
34
33
|
* @description 根据模板 profile 返回生成的 AGENTS 指引。
|
|
35
34
|
*/
|
|
@@ -39,23 +38,17 @@ function createAgentsGuidelines(templateName, toolchain = "wv") {
|
|
|
39
38
|
if (toolchain === "wv") return guidelines;
|
|
40
39
|
return guidelines.replace("- Keep `vite.config.ts` as the source of truth for `weapp` config, output behavior, and IDE/MCP automation.", "- Keep shared mini-program configuration in `weapp-vite.config.ts`; the `vite*.config.ts` host entries import it explicitly. Use project `dev`/`build` scripts for the selected host and `wv prepare/open/upload/mcp` for mini-program tooling. Do not pass `wv --platform` flags to Vite or Vite+.");
|
|
41
40
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
var version$
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
var version$2 = "0.2.10";
|
|
54
|
-
//#endregion
|
|
55
|
-
//#region ../weapp-vite/package.json
|
|
56
|
-
var version$1 = "7.5.0";
|
|
57
|
-
//#endregion
|
|
58
|
-
//#region src/pnpmBuildPolicy.ts
|
|
41
|
+
// ../../packages-runtime/react/package.json
|
|
42
|
+
var version$5 = "0.3.0";
|
|
43
|
+
// ../../packages-runtime/wevu/package.json
|
|
44
|
+
var version$4 = "7.7.0";
|
|
45
|
+
// ../dashboard/package.json
|
|
46
|
+
var version$3 = "7.7.0";
|
|
47
|
+
// ../eslint/package.json
|
|
48
|
+
var version$2 = "0.3.0";
|
|
49
|
+
// ../weapp-vite/package.json
|
|
50
|
+
var version$1 = "7.7.0";
|
|
51
|
+
// src/pnpmBuildPolicy.ts
|
|
59
52
|
const WORKSPACE_CONFIG = `packages: []
|
|
60
53
|
|
|
61
54
|
# 仅允许模板依赖中需要的安装脚本,新增依赖仍需单独审批。
|
|
@@ -103,8 +96,7 @@ async function ensurePnpmBuildPolicy(root) {
|
|
|
103
96
|
if (error.code !== "EEXIST") throw error;
|
|
104
97
|
}
|
|
105
98
|
}
|
|
106
|
-
|
|
107
|
-
//#region src/npm/config.ts
|
|
99
|
+
// src/npm/config.ts
|
|
108
100
|
const NPM_REGISTRY = "https://registry.npmjs.org/";
|
|
109
101
|
const transportKeys = [
|
|
110
102
|
"proxy",
|
|
@@ -261,8 +253,7 @@ function registryEnvironment(options) {
|
|
|
261
253
|
if (!options.cafile && options.ca) env.npm_config_ca = Array.isArray(options.ca) ? options.ca.join("\n") : String(options.ca);
|
|
262
254
|
return env;
|
|
263
255
|
}
|
|
264
|
-
|
|
265
|
-
//#region src/npm/proxy.ts
|
|
256
|
+
// src/npm/proxy.ts
|
|
266
257
|
function bypassProxy(url, noProxy) {
|
|
267
258
|
const hostname = url.hostname.replace(/^\[|\]$/g, "").toLowerCase();
|
|
268
259
|
const port = url.port || (url.protocol === "https:" ? "443" : "80");
|
|
@@ -284,8 +275,7 @@ function proxyOptions(uri, options) {
|
|
|
284
275
|
noProxy: []
|
|
285
276
|
};
|
|
286
277
|
}
|
|
287
|
-
|
|
288
|
-
//#region src/npm/transport.ts
|
|
278
|
+
// src/npm/transport.ts
|
|
289
279
|
const { getAuth } = registryFetch;
|
|
290
280
|
/** 复用 npm 的认证解析和网络传输,限制认证请求的重定向边界。 */
|
|
291
281
|
async function requestMetadata(uri, options, signal, timeout) {
|
|
@@ -336,8 +326,7 @@ async function requestMetadata(uri, options, signal, timeout) {
|
|
|
336
326
|
throw Object.assign(/* @__PURE__ */ new Error("registry HTTP request failed"), { statusCode: response.status });
|
|
337
327
|
}
|
|
338
328
|
}
|
|
339
|
-
|
|
340
|
-
//#region src/npm/index.ts
|
|
329
|
+
// src/npm/index.ts
|
|
341
330
|
const REQUEST_TIMEOUT_MS = 5e3;
|
|
342
331
|
function requestError(error, registry) {
|
|
343
332
|
const code = error && typeof error === "object" && "code" in error ? String(error.code) : "";
|
|
@@ -395,15 +384,13 @@ async function getPackageVersionsFromNpm(packageName, signal, options) {
|
|
|
395
384
|
if (!isRecord(metadata) || !isRecord(metadata.versions)) throw new Error("registry 响应缺少有效的 versions 信息");
|
|
396
385
|
return Object.keys(metadata.versions);
|
|
397
386
|
}
|
|
398
|
-
|
|
399
|
-
//#region src/dependencyVersions/compatible.ts
|
|
387
|
+
// src/dependencyVersions/compatible.ts
|
|
400
388
|
/** 仅选择所有已使用核心包共同发布、且兼容各自基线的最高稳定版本。 */
|
|
401
389
|
function findCompatibleVersion(packages) {
|
|
402
390
|
if (packages.length === 0 || packages.some((pkg) => !valid(pkg.version) || prerelease(pkg.version))) return;
|
|
403
391
|
return packages[0].versions.filter((version) => valid(version) && !prerelease(version)).filter((version) => packages.every((pkg) => pkg.versions.includes(version) && gte(version, pkg.version) && satisfies(version, `^${pkg.version}`))).sort(rcompare)[0];
|
|
404
392
|
}
|
|
405
|
-
|
|
406
|
-
//#region src/dependencyVersions/deadline.ts
|
|
393
|
+
// src/dependencyVersions/deadline.ts
|
|
407
394
|
/** 将整个查询批次约束在同一时间预算内,并清理未完成的请求。 */
|
|
408
395
|
async function queryWithDeadline(query, timeoutMs) {
|
|
409
396
|
const controller = new AbortController();
|
|
@@ -424,8 +411,7 @@ async function queryWithDeadline(query, timeoutMs) {
|
|
|
424
411
|
clearTimeout(timer);
|
|
425
412
|
}
|
|
426
413
|
}
|
|
427
|
-
|
|
428
|
-
//#region src/dependencyVersions/index.ts
|
|
414
|
+
// src/dependencyVersions/index.ts
|
|
429
415
|
const BUNDLED_VERSIONS = {
|
|
430
416
|
"weapp-vite": version$1,
|
|
431
417
|
"wevu": version$4,
|
|
@@ -513,8 +499,7 @@ async function resolveDependencyVersions(pkg, strategy = "bundled", network) {
|
|
|
513
499
|
return { strategy: "bundled" };
|
|
514
500
|
}
|
|
515
501
|
}
|
|
516
|
-
|
|
517
|
-
//#region src/enums.ts
|
|
502
|
+
// src/enums.ts
|
|
518
503
|
let TemplateName = /* @__PURE__ */ function(TemplateName) {
|
|
519
504
|
TemplateName["default"] = "default";
|
|
520
505
|
TemplateName["multiPlatform"] = "multi-platform";
|
|
@@ -529,8 +514,7 @@ let TemplateName = /* @__PURE__ */ function(TemplateName) {
|
|
|
529
514
|
TemplateName["lib"] = "lib";
|
|
530
515
|
return TemplateName;
|
|
531
516
|
}({});
|
|
532
|
-
|
|
533
|
-
//#region src/installationCommand.ts
|
|
517
|
+
// src/installationCommand.ts
|
|
534
518
|
const SAFE_REGISTRY_RE = /^https?:\/\/[\w.:/-]+$/;
|
|
535
519
|
/** 生成可复制的安装命令;Windows 的特殊地址使用明确标注的 PowerShell 语法。 */
|
|
536
520
|
function installationCommand(registry, platform = process.platform) {
|
|
@@ -539,8 +523,7 @@ function installationCommand(registry, platform = process.platform) {
|
|
|
539
523
|
const quoted = platform === "win32" ? `'${registry.replaceAll("'", "''")}'` : `'${registry.replaceAll("'", "'\\''")}'`;
|
|
540
524
|
return `${platform === "win32" ? "PowerShell: " : ""}pnpm --config.registry=${quoted} install`;
|
|
541
525
|
}
|
|
542
|
-
|
|
543
|
-
//#region src/skills.ts
|
|
526
|
+
// src/skills.ts
|
|
544
527
|
const RECOMMENDED_SKILLS_SOURCE = "sonofmagic/skills";
|
|
545
528
|
const RECOMMENDED_SKILLS_INSTALL_COMMAND = `npx --yes skills add ${RECOMMENDED_SKILLS_SOURCE}`;
|
|
546
529
|
const SKILLS_INSTALL_TIMEOUT_MS = 6e4;
|
|
@@ -611,36 +594,37 @@ async function installRecommendedSkills(cwd, options = {}) {
|
|
|
611
594
|
clearTimeout(timer);
|
|
612
595
|
}
|
|
613
596
|
}
|
|
614
|
-
|
|
615
|
-
//#region src/generated/catalog.ts
|
|
597
|
+
// src/generated/catalog.ts
|
|
616
598
|
const TEMPLATE_CATALOG = {
|
|
617
|
-
"@babel/core": "^8.0.
|
|
599
|
+
"@babel/core": "^8.0.9",
|
|
618
600
|
"@babel/generator": "^8.0.6",
|
|
619
|
-
"@babel/parser": "^8.0.
|
|
601
|
+
"@babel/parser": "^8.0.8",
|
|
620
602
|
"@babel/traverse": "^8.0.7",
|
|
621
|
-
"@babel/types": "^8.0.
|
|
603
|
+
"@babel/types": "^8.0.8",
|
|
622
604
|
"@douyin-microapp/typings": "^1.3.1",
|
|
623
605
|
"@egoist/tailwindcss-icons": "^1.9.2",
|
|
624
|
-
"@icebreakers/eslint-config": "
|
|
625
|
-
"@icebreakers/stylelint-config": "
|
|
606
|
+
"@icebreakers/eslint-config": "8.0.11",
|
|
607
|
+
"@icebreakers/stylelint-config": "5.1.5",
|
|
626
608
|
"@iconify-json/mdi": "^1.2.3",
|
|
627
609
|
"@iconify/tailwind4": "^1.2.3",
|
|
628
610
|
"@mini-types/alipay": "^3.0.14",
|
|
629
611
|
"@tailwindcss/vite": "^4.3.3",
|
|
630
612
|
"@types/d3": "^7.4.3",
|
|
631
|
-
"@types/node": "^26.6.
|
|
613
|
+
"@types/node": "^26.6.5",
|
|
632
614
|
"@types/react": "19.3.0",
|
|
633
|
-
"@types/react-reconciler": "0.
|
|
615
|
+
"@types/react-reconciler": "0.34.1",
|
|
634
616
|
"@types/semver": "^7.8.0",
|
|
635
617
|
"@vant/weapp": "^1.11.7",
|
|
636
|
-
"@vitejs/devtools": "0.
|
|
637
|
-
"@vitejs/devtools-kit": "0.
|
|
638
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
618
|
+
"@vitejs/devtools": "0.8.0",
|
|
619
|
+
"@vitejs/devtools-kit": "0.8.0",
|
|
620
|
+
"@vitejs/plugin-vue": "^6.0.10",
|
|
639
621
|
"@vue/babel-plugin-jsx": "3.0.0",
|
|
640
|
-
"@vue/compiler-core": "^3.5.
|
|
641
|
-
"@vue/compiler-dom": "^3.5.
|
|
642
|
-
"@vue/language-core": "^3.3.
|
|
643
|
-
"@
|
|
622
|
+
"@vue/compiler-core": "^3.5.44",
|
|
623
|
+
"@vue/compiler-dom": "^3.5.44",
|
|
624
|
+
"@vue/language-core": "^3.3.13",
|
|
625
|
+
"@vue/reactivity": "^3.5.44",
|
|
626
|
+
"@vue/shared": "^3.5.44",
|
|
627
|
+
"@wot-ui/ui": "2.4.0",
|
|
644
628
|
"antd-mini": "^3.4.3",
|
|
645
629
|
"bundle-require": "^5.1.0",
|
|
646
630
|
"class-variance-authority": "^0.7.1",
|
|
@@ -648,34 +632,34 @@ const TEMPLATE_CATALOG = {
|
|
|
648
632
|
"estree-walker": "^3.0.3",
|
|
649
633
|
"gm-crypto": "^0.1.12",
|
|
650
634
|
"graphql-request": "^7.4.0",
|
|
651
|
-
"happy-dom": "^
|
|
635
|
+
"happy-dom": "^21.0.4",
|
|
652
636
|
"lru-cache": "^11.5.3",
|
|
653
637
|
"magic-string": "^1.4.3",
|
|
654
638
|
"miniprogram-api-typings": "^5.2.3",
|
|
655
|
-
"oxc-parser": "^0.
|
|
639
|
+
"oxc-parser": "^0.155.0",
|
|
656
640
|
"oxc-walker": "^1.1.1",
|
|
657
|
-
"pkg-types": "^2.
|
|
658
|
-
"postcss-selector-parser": "^7.1.
|
|
641
|
+
"pkg-types": "^2.4.0",
|
|
642
|
+
"postcss-selector-parser": "^7.1.7",
|
|
659
643
|
"react-reconciler": "0.34.0",
|
|
660
|
-
"sass-embedded": "^1.
|
|
644
|
+
"sass-embedded": "^1.106.1",
|
|
661
645
|
"socket.io-client": "^4.8.4",
|
|
662
646
|
"tailwind-merge": "^3.7.0",
|
|
663
647
|
"tailwind-variants": "^3.3.1",
|
|
664
648
|
"tdesign-miniprogram": "^1.17.0",
|
|
665
649
|
"ts-morph": "^28.0.0",
|
|
666
650
|
"uview-plus": "3.8.130",
|
|
667
|
-
"vite-plugin-inspect": "^12.0
|
|
668
|
-
"vue-tsc": "^3.3.
|
|
669
|
-
"weapp-tailwindcss": "^5.6.
|
|
651
|
+
"vite-plugin-inspect": "^12.1.0",
|
|
652
|
+
"vue-tsc": "^3.3.13",
|
|
653
|
+
"weapp-tailwindcss": "^5.6.3",
|
|
670
654
|
autoprefixer: "^10.6.1",
|
|
671
655
|
axios: "^1.20.0",
|
|
672
656
|
clsx: "^2.1.1",
|
|
673
657
|
d3: "^7.9.0",
|
|
674
658
|
dayjs: "^1.11.23",
|
|
675
|
-
devframe: "1.2.
|
|
659
|
+
devframe: "1.2.6",
|
|
676
660
|
echarts: "^6.1.0",
|
|
677
661
|
esbuild: "^0.28.2",
|
|
678
|
-
eslint: "^10.
|
|
662
|
+
eslint: "^10.13.0",
|
|
679
663
|
fdir: "^6.5.0",
|
|
680
664
|
htmlparser2: "^12.0.0",
|
|
681
665
|
lodash: "^4.18.1",
|
|
@@ -683,31 +667,30 @@ const TEMPLATE_CATALOG = {
|
|
|
683
667
|
obug: "^3.0.0",
|
|
684
668
|
pathe: "^2.0.3",
|
|
685
669
|
picocolors: "^1.1.1",
|
|
686
|
-
postcss: "^8.5.
|
|
687
|
-
react: "19.3.
|
|
688
|
-
rolldown: "1.2.
|
|
689
|
-
sass: "^1.
|
|
670
|
+
postcss: "^8.5.31",
|
|
671
|
+
react: "19.3.1",
|
|
672
|
+
rolldown: "1.2.15",
|
|
673
|
+
sass: "^1.106.1",
|
|
690
674
|
sharp: "^0.35.5",
|
|
691
675
|
stylelint: "^17.16.0",
|
|
692
676
|
tailwindcss: "^4.3.3",
|
|
693
677
|
tslib: "^2.8.1",
|
|
694
678
|
tsx: "^4.23.15",
|
|
695
679
|
typescript: "^6.0.3",
|
|
696
|
-
vite: "8.3.
|
|
697
|
-
vue: "^3.5.
|
|
698
|
-
zod: "^4.6.
|
|
680
|
+
vite: "8.3.5",
|
|
681
|
+
vue: "^3.5.44",
|
|
682
|
+
zod: "^4.6.7"
|
|
699
683
|
};
|
|
700
684
|
const TEMPLATE_NAMED_CATALOG = {
|
|
701
685
|
"tdesign-miniprogram-fixed": { "tdesign-miniprogram": "1.17.0" },
|
|
702
|
-
"weapp-tailwindcss-fixed": { "weapp-tailwindcss": "5.6.
|
|
686
|
+
"weapp-tailwindcss-fixed": { "weapp-tailwindcss": "5.6.3" },
|
|
703
687
|
latest: {
|
|
704
688
|
"miniprogram-api-typings": "^5.2.3",
|
|
705
689
|
typescript: "^6.0.3"
|
|
706
690
|
},
|
|
707
691
|
tailwind4: { tailwindcss: "^4.3.3" }
|
|
708
692
|
};
|
|
709
|
-
|
|
710
|
-
//#region src/templateDependencies/index.ts
|
|
693
|
+
// src/templateDependencies/index.ts
|
|
711
694
|
const DIGIT_RE = /\d/;
|
|
712
695
|
const templateCatalogMap = { ...TEMPLATE_CATALOG };
|
|
713
696
|
const templateNamedCatalogMap = Object.fromEntries(Object.entries(TEMPLATE_NAMED_CATALOG).map(([name, deps]) => [name, { ...deps }]));
|
|
@@ -752,12 +735,12 @@ function ensureManagedTypeScriptDevDependencies(pkgJson) {
|
|
|
752
735
|
if (pkgJson.dependencies?.["@types/node"] || pkgJson.devDependencies["@types/node"] || pkgJson.peerDependencies?.["@types/node"] || pkgJson.optionalDependencies?.["@types/node"]) return;
|
|
753
736
|
pkgJson.devDependencies["@types/node"] = templateCatalogMap["@types/node"];
|
|
754
737
|
}
|
|
755
|
-
|
|
756
|
-
|
|
738
|
+
// package.json
|
|
739
|
+
var engines = { "node": "^22.23.4 || ^24.22.1 || >=26.12.1" };
|
|
740
|
+
// src/vitePlusVersions.json
|
|
757
741
|
var version = "1.0.0";
|
|
758
742
|
var vitest = "5.0.1";
|
|
759
|
-
|
|
760
|
-
//#region src/toolchain.ts
|
|
743
|
+
// src/toolchain.ts
|
|
761
744
|
const VITE_PLUS_VERSION = version;
|
|
762
745
|
const VITE_PLUS_VITEST_VERSION = vitest;
|
|
763
746
|
const VITE_PLUS_CORE = `npm:@voidzero-dev/vite-plus-core@${VITE_PLUS_VERSION}`;
|
|
@@ -803,6 +786,10 @@ export default defineConfig(async (env) => {
|
|
|
803
786
|
}
|
|
804
787
|
/** 从共享业务模板派生宿主入口,仅改写普通 build/dev,保留小程序专属命令。 */
|
|
805
788
|
async function applyToolchain(root, pkg, toolchain) {
|
|
789
|
+
pkg.engines = {
|
|
790
|
+
...pkg.engines,
|
|
791
|
+
node: engines.node
|
|
792
|
+
};
|
|
806
793
|
if (toolchain === "wv") return;
|
|
807
794
|
const source = "weapp-vite.config.ts";
|
|
808
795
|
if (!await fs.pathExists(path.join(root, source))) await fs.move(path.join(root, "vite.config.ts"), path.join(root, source));
|
|
@@ -822,10 +809,6 @@ async function applyToolchain(root, pkg, toolchain) {
|
|
|
822
809
|
}
|
|
823
810
|
for (const [fileName, config] of configurations) await fs.writeFile(path.join(root, fileName), renderConfig(toolchain, config.source, config.platform));
|
|
824
811
|
pkg.devDependencies ??= {};
|
|
825
|
-
pkg.engines = {
|
|
826
|
-
...pkg.engines,
|
|
827
|
-
node: "^22.22.2 || ^24.15.0 || >=26.0.0"
|
|
828
|
-
};
|
|
829
812
|
if (toolchain === "vite") {
|
|
830
813
|
pkg.devDependencies.vite = TEMPLATE_CATALOG.vite;
|
|
831
814
|
return;
|
|
@@ -837,7 +820,7 @@ async function applyToolchain(root, pkg, toolchain) {
|
|
|
837
820
|
vite: VITE_PLUS_CORE,
|
|
838
821
|
vitest: VITE_PLUS_VITEST_VERSION
|
|
839
822
|
};
|
|
840
|
-
pkg.engines.node = "^24.
|
|
823
|
+
pkg.engines.node = "^24.22.1 || >=26.12.1";
|
|
841
824
|
const workspace = await findPnpmWorkspaceRoot(root);
|
|
842
825
|
if (workspace && path.resolve(workspace) === path.resolve(root)) {
|
|
843
826
|
const fileName = path.join(workspace, "pnpm-workspace.yaml");
|
|
@@ -852,8 +835,7 @@ async function applyToolchain(root, pkg, toolchain) {
|
|
|
852
835
|
await fs.writeFile(fileName, document.toString());
|
|
853
836
|
}
|
|
854
837
|
}
|
|
855
|
-
|
|
856
|
-
//#region src/gitignore.ts
|
|
838
|
+
// src/gitignore.ts
|
|
857
839
|
const DEFAULT_GITIGNORE = `# dependencies
|
|
858
840
|
node_modules
|
|
859
841
|
.pnp
|
|
@@ -927,8 +909,7 @@ function mergeGitignore(existing) {
|
|
|
927
909
|
}
|
|
928
910
|
return ensureTrailingNewline(trimTrailingBlankLines(merged).join("\n"));
|
|
929
911
|
}
|
|
930
|
-
|
|
931
|
-
//#region src/utils/fs.ts
|
|
912
|
+
// src/utils/fs.ts
|
|
932
913
|
/**
|
|
933
914
|
* @description 文件读取错误
|
|
934
915
|
*/
|
|
@@ -977,8 +958,7 @@ async function writeFile$1(filepath, contents) {
|
|
|
977
958
|
throw new FsWriteError(filepath, error);
|
|
978
959
|
}
|
|
979
960
|
}
|
|
980
|
-
|
|
981
|
-
//#region src/updateGitignore.ts
|
|
961
|
+
// src/updateGitignore.ts
|
|
982
962
|
async function updateGitIgnore(options) {
|
|
983
963
|
const { root, write = true } = options;
|
|
984
964
|
const gitignorePath = path.resolve(root, ".gitignore");
|
|
@@ -990,8 +970,7 @@ async function updateGitIgnore(options) {
|
|
|
990
970
|
}
|
|
991
971
|
return merged;
|
|
992
972
|
}
|
|
993
|
-
|
|
994
|
-
//#region src/createProject.ts
|
|
973
|
+
// src/createProject.ts
|
|
995
974
|
const CRLF_RE = /\r\n/g;
|
|
996
975
|
const WINDOWS_VERBATIM_PATH_RE = /^\\\\\?\\/;
|
|
997
976
|
const TOURIST_APP_ID = "touristappid";
|
|
@@ -1163,5 +1142,4 @@ async function writeAgentsGuidelines(targetDir, templateName, toolchain = "wv")
|
|
|
1163
1142
|
}
|
|
1164
1143
|
await fs.writeFile(agentsPath, createAgentsGuidelines(templateName, toolchain));
|
|
1165
1144
|
}
|
|
1166
|
-
//#endregion
|
|
1167
1145
|
export { validateDependencyVersionStrategy as a, TemplateName as i, validateToolchain as n, RECOMMENDED_SKILLS_INSTALL_COMMAND as r, createProject as t };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-weapp-vite",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.3.0",
|
|
5
5
|
"description": "create-weapp-vite tools and runtime components for modern WeChat and multi-platform mini-program development.",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -51,24 +51,24 @@
|
|
|
51
51
|
"templates"
|
|
52
52
|
],
|
|
53
53
|
"engines": {
|
|
54
|
-
"node": "^22.
|
|
54
|
+
"node": "^22.23.4 || ^24.22.1 || >=26.12.1"
|
|
55
55
|
},
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public",
|
|
58
58
|
"registry": "https://registry.npmjs.org"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@inquirer/prompts": "^8.7.
|
|
61
|
+
"@inquirer/prompts": "^8.7.4",
|
|
62
62
|
"@npmcli/config": "^11.2.0",
|
|
63
|
-
"@weapp-core/init": "6.0
|
|
64
|
-
"@weapp-core/logger": "3.
|
|
65
|
-
"@weapp-core/shared": "3.
|
|
66
|
-
"execa": "^10.1
|
|
63
|
+
"@weapp-core/init": "6.1.0",
|
|
64
|
+
"@weapp-core/logger": "3.2.0",
|
|
65
|
+
"@weapp-core/shared": "3.4.0",
|
|
66
|
+
"execa": "^10.2.1",
|
|
67
67
|
"make-fetch-happen": "^16.0.1",
|
|
68
68
|
"npm-registry-fetch": "^20.0.1",
|
|
69
69
|
"pathe": "^2.0.3",
|
|
70
70
|
"picomatch": "^4.0.7",
|
|
71
|
-
"pkg-types": "^2.
|
|
71
|
+
"pkg-types": "^2.4.0",
|
|
72
72
|
"semver": "^7.8.5",
|
|
73
73
|
"yaml": "^2.9.1"
|
|
74
74
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-vite-react-template",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.7",
|
|
5
5
|
"private": true,
|
|
6
6
|
"weappVite": {
|
|
7
7
|
"web": false
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@icebreakers/eslint-config": "catalog:",
|
|
28
28
|
"@icebreakers/stylelint-config": "catalog:",
|
|
29
|
-
"@swc/core": "^1.16.
|
|
29
|
+
"@swc/core": "^1.16.20",
|
|
30
30
|
"@types/node": "catalog:",
|
|
31
31
|
"@types/react": "catalog:",
|
|
32
32
|
"@types/react-reconciler": "catalog:",
|
|
@@ -36,14 +36,16 @@ export default defineConfig({
|
|
|
36
36
|
'tdesign-miniprogram': {
|
|
37
37
|
exclude: [
|
|
38
38
|
'**/*.d.ts',
|
|
39
|
-
'**/type.js',
|
|
40
39
|
'common/shared/**',
|
|
41
40
|
],
|
|
42
41
|
include: [
|
|
43
42
|
'button/**',
|
|
44
43
|
'common/**',
|
|
44
|
+
'config-provider/**',
|
|
45
45
|
'icon/**',
|
|
46
46
|
'loading/**',
|
|
47
|
+
'locale/zh_CN.js',
|
|
48
|
+
'miniprogram_npm/dayjs/**',
|
|
47
49
|
'miniprogram_npm/tslib/**',
|
|
48
50
|
'mixins/**',
|
|
49
51
|
'tag/**',
|