create-weapp-vite 3.2.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 +2 -3
- package/dist/index.d.ts +0 -8
- package/dist/index.js +1 -1
- package/dist/{src-CwQw4KHz.js → src-Dz0Mumdl.js} +56 -79
- package/package.json +8 -8
- package/templates/lib/package.json +1 -1
- package/templates/react/package.json +2 -2
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, t as createProject } from "./src-
|
|
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
|
{
|
|
@@ -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.11";
|
|
54
|
-
//#endregion
|
|
55
|
-
//#region ../weapp-vite/package.json
|
|
56
|
-
var version$1 = "7.6.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,18 +594,17 @@ 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": "8.0.
|
|
625
|
-
"@icebreakers/stylelint-config": "5.1.
|
|
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",
|
|
@@ -630,7 +612,7 @@ const TEMPLATE_CATALOG = {
|
|
|
630
612
|
"@types/d3": "^7.4.3",
|
|
631
613
|
"@types/node": "^26.6.5",
|
|
632
614
|
"@types/react": "19.3.0",
|
|
633
|
-
"@types/react-reconciler": "0.34.
|
|
615
|
+
"@types/react-reconciler": "0.34.1",
|
|
634
616
|
"@types/semver": "^7.8.0",
|
|
635
617
|
"@vant/weapp": "^1.11.7",
|
|
636
618
|
"@vitejs/devtools": "0.8.0",
|
|
@@ -641,7 +623,8 @@ const TEMPLATE_CATALOG = {
|
|
|
641
623
|
"@vue/compiler-dom": "^3.5.44",
|
|
642
624
|
"@vue/language-core": "^3.3.13",
|
|
643
625
|
"@vue/reactivity": "^3.5.44",
|
|
644
|
-
"@
|
|
626
|
+
"@vue/shared": "^3.5.44",
|
|
627
|
+
"@wot-ui/ui": "2.4.0",
|
|
645
628
|
"antd-mini": "^3.4.3",
|
|
646
629
|
"bundle-require": "^5.1.0",
|
|
647
630
|
"class-variance-authority": "^0.7.1",
|
|
@@ -649,16 +632,16 @@ const TEMPLATE_CATALOG = {
|
|
|
649
632
|
"estree-walker": "^3.0.3",
|
|
650
633
|
"gm-crypto": "^0.1.12",
|
|
651
634
|
"graphql-request": "^7.4.0",
|
|
652
|
-
"happy-dom": "^21.0.
|
|
635
|
+
"happy-dom": "^21.0.4",
|
|
653
636
|
"lru-cache": "^11.5.3",
|
|
654
637
|
"magic-string": "^1.4.3",
|
|
655
638
|
"miniprogram-api-typings": "^5.2.3",
|
|
656
|
-
"oxc-parser": "^0.
|
|
639
|
+
"oxc-parser": "^0.155.0",
|
|
657
640
|
"oxc-walker": "^1.1.1",
|
|
658
|
-
"pkg-types": "^2.
|
|
659
|
-
"postcss-selector-parser": "^7.1.
|
|
641
|
+
"pkg-types": "^2.4.0",
|
|
642
|
+
"postcss-selector-parser": "^7.1.7",
|
|
660
643
|
"react-reconciler": "0.34.0",
|
|
661
|
-
"sass-embedded": "^1.
|
|
644
|
+
"sass-embedded": "^1.106.1",
|
|
662
645
|
"socket.io-client": "^4.8.4",
|
|
663
646
|
"tailwind-merge": "^3.7.0",
|
|
664
647
|
"tailwind-variants": "^3.3.1",
|
|
@@ -673,7 +656,7 @@ const TEMPLATE_CATALOG = {
|
|
|
673
656
|
clsx: "^2.1.1",
|
|
674
657
|
d3: "^7.9.0",
|
|
675
658
|
dayjs: "^1.11.23",
|
|
676
|
-
devframe: "1.2.
|
|
659
|
+
devframe: "1.2.6",
|
|
677
660
|
echarts: "^6.1.0",
|
|
678
661
|
esbuild: "^0.28.2",
|
|
679
662
|
eslint: "^10.13.0",
|
|
@@ -684,17 +667,17 @@ const TEMPLATE_CATALOG = {
|
|
|
684
667
|
obug: "^3.0.0",
|
|
685
668
|
pathe: "^2.0.3",
|
|
686
669
|
picocolors: "^1.1.1",
|
|
687
|
-
postcss: "^8.5.
|
|
670
|
+
postcss: "^8.5.31",
|
|
688
671
|
react: "19.3.1",
|
|
689
|
-
rolldown: "1.2.
|
|
690
|
-
sass: "^1.
|
|
672
|
+
rolldown: "1.2.15",
|
|
673
|
+
sass: "^1.106.1",
|
|
691
674
|
sharp: "^0.35.5",
|
|
692
675
|
stylelint: "^17.16.0",
|
|
693
676
|
tailwindcss: "^4.3.3",
|
|
694
677
|
tslib: "^2.8.1",
|
|
695
678
|
tsx: "^4.23.15",
|
|
696
679
|
typescript: "^6.0.3",
|
|
697
|
-
vite: "8.3.
|
|
680
|
+
vite: "8.3.5",
|
|
698
681
|
vue: "^3.5.44",
|
|
699
682
|
zod: "^4.6.7"
|
|
700
683
|
};
|
|
@@ -707,8 +690,7 @@ const TEMPLATE_NAMED_CATALOG = {
|
|
|
707
690
|
},
|
|
708
691
|
tailwind4: { tailwindcss: "^4.3.3" }
|
|
709
692
|
};
|
|
710
|
-
|
|
711
|
-
//#region src/templateDependencies/index.ts
|
|
693
|
+
// src/templateDependencies/index.ts
|
|
712
694
|
const DIGIT_RE = /\d/;
|
|
713
695
|
const templateCatalogMap = { ...TEMPLATE_CATALOG };
|
|
714
696
|
const templateNamedCatalogMap = Object.fromEntries(Object.entries(TEMPLATE_NAMED_CATALOG).map(([name, deps]) => [name, { ...deps }]));
|
|
@@ -753,12 +735,12 @@ function ensureManagedTypeScriptDevDependencies(pkgJson) {
|
|
|
753
735
|
if (pkgJson.dependencies?.["@types/node"] || pkgJson.devDependencies["@types/node"] || pkgJson.peerDependencies?.["@types/node"] || pkgJson.optionalDependencies?.["@types/node"]) return;
|
|
754
736
|
pkgJson.devDependencies["@types/node"] = templateCatalogMap["@types/node"];
|
|
755
737
|
}
|
|
756
|
-
|
|
757
|
-
|
|
738
|
+
// package.json
|
|
739
|
+
var engines = { "node": "^22.23.4 || ^24.22.1 || >=26.12.1" };
|
|
740
|
+
// src/vitePlusVersions.json
|
|
758
741
|
var version = "1.0.0";
|
|
759
742
|
var vitest = "5.0.1";
|
|
760
|
-
|
|
761
|
-
//#region src/toolchain.ts
|
|
743
|
+
// src/toolchain.ts
|
|
762
744
|
const VITE_PLUS_VERSION = version;
|
|
763
745
|
const VITE_PLUS_VITEST_VERSION = vitest;
|
|
764
746
|
const VITE_PLUS_CORE = `npm:@voidzero-dev/vite-plus-core@${VITE_PLUS_VERSION}`;
|
|
@@ -804,6 +786,10 @@ export default defineConfig(async (env) => {
|
|
|
804
786
|
}
|
|
805
787
|
/** 从共享业务模板派生宿主入口,仅改写普通 build/dev,保留小程序专属命令。 */
|
|
806
788
|
async function applyToolchain(root, pkg, toolchain) {
|
|
789
|
+
pkg.engines = {
|
|
790
|
+
...pkg.engines,
|
|
791
|
+
node: engines.node
|
|
792
|
+
};
|
|
807
793
|
if (toolchain === "wv") return;
|
|
808
794
|
const source = "weapp-vite.config.ts";
|
|
809
795
|
if (!await fs.pathExists(path.join(root, source))) await fs.move(path.join(root, "vite.config.ts"), path.join(root, source));
|
|
@@ -823,10 +809,6 @@ async function applyToolchain(root, pkg, toolchain) {
|
|
|
823
809
|
}
|
|
824
810
|
for (const [fileName, config] of configurations) await fs.writeFile(path.join(root, fileName), renderConfig(toolchain, config.source, config.platform));
|
|
825
811
|
pkg.devDependencies ??= {};
|
|
826
|
-
pkg.engines = {
|
|
827
|
-
...pkg.engines,
|
|
828
|
-
node: "^22.22.2 || ^24.15.0 || >=26.0.0"
|
|
829
|
-
};
|
|
830
812
|
if (toolchain === "vite") {
|
|
831
813
|
pkg.devDependencies.vite = TEMPLATE_CATALOG.vite;
|
|
832
814
|
return;
|
|
@@ -838,7 +820,7 @@ async function applyToolchain(root, pkg, toolchain) {
|
|
|
838
820
|
vite: VITE_PLUS_CORE,
|
|
839
821
|
vitest: VITE_PLUS_VITEST_VERSION
|
|
840
822
|
};
|
|
841
|
-
pkg.engines.node = "^24.
|
|
823
|
+
pkg.engines.node = "^24.22.1 || >=26.12.1";
|
|
842
824
|
const workspace = await findPnpmWorkspaceRoot(root);
|
|
843
825
|
if (workspace && path.resolve(workspace) === path.resolve(root)) {
|
|
844
826
|
const fileName = path.join(workspace, "pnpm-workspace.yaml");
|
|
@@ -853,8 +835,7 @@ async function applyToolchain(root, pkg, toolchain) {
|
|
|
853
835
|
await fs.writeFile(fileName, document.toString());
|
|
854
836
|
}
|
|
855
837
|
}
|
|
856
|
-
|
|
857
|
-
//#region src/gitignore.ts
|
|
838
|
+
// src/gitignore.ts
|
|
858
839
|
const DEFAULT_GITIGNORE = `# dependencies
|
|
859
840
|
node_modules
|
|
860
841
|
.pnp
|
|
@@ -928,8 +909,7 @@ function mergeGitignore(existing) {
|
|
|
928
909
|
}
|
|
929
910
|
return ensureTrailingNewline(trimTrailingBlankLines(merged).join("\n"));
|
|
930
911
|
}
|
|
931
|
-
|
|
932
|
-
//#region src/utils/fs.ts
|
|
912
|
+
// src/utils/fs.ts
|
|
933
913
|
/**
|
|
934
914
|
* @description 文件读取错误
|
|
935
915
|
*/
|
|
@@ -978,8 +958,7 @@ async function writeFile$1(filepath, contents) {
|
|
|
978
958
|
throw new FsWriteError(filepath, error);
|
|
979
959
|
}
|
|
980
960
|
}
|
|
981
|
-
|
|
982
|
-
//#region src/updateGitignore.ts
|
|
961
|
+
// src/updateGitignore.ts
|
|
983
962
|
async function updateGitIgnore(options) {
|
|
984
963
|
const { root, write = true } = options;
|
|
985
964
|
const gitignorePath = path.resolve(root, ".gitignore");
|
|
@@ -991,8 +970,7 @@ async function updateGitIgnore(options) {
|
|
|
991
970
|
}
|
|
992
971
|
return merged;
|
|
993
972
|
}
|
|
994
|
-
|
|
995
|
-
//#region src/createProject.ts
|
|
973
|
+
// src/createProject.ts
|
|
996
974
|
const CRLF_RE = /\r\n/g;
|
|
997
975
|
const WINDOWS_VERBATIM_PATH_RE = /^\\\\\?\\/;
|
|
998
976
|
const TOURIST_APP_ID = "touristappid";
|
|
@@ -1164,5 +1142,4 @@ async function writeAgentsGuidelines(targetDir, templateName, toolchain = "wv")
|
|
|
1164
1142
|
}
|
|
1165
1143
|
await fs.writeFile(agentsPath, createAgentsGuidelines(templateName, toolchain));
|
|
1166
1144
|
}
|
|
1167
|
-
//#endregion
|
|
1168
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.
|
|
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:",
|