weapp-vite 6.20.5 → 6.22.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 +21 -0
- package/dist/auto-routes.mjs +1 -1
- package/dist/cli.mjs +124 -24
- package/dist/compatibility.d.mts +2 -0
- package/dist/compatibility.mjs +2 -0
- package/dist/{config-B1H1OqnR.d.mts → config-6l-p3o-C.d.mts} +39 -11
- package/dist/config.d.mts +3 -2
- package/dist/{createContext-Ryo4nfbU.mjs → createContext-PBWMhrli.mjs} +646 -108
- package/dist/docs/README.md +21 -0
- package/dist/docs/ai-workflows.md +2 -0
- package/dist/docs/getting-started.md +1 -1
- package/dist/docs/i18n.md +44 -0
- package/dist/docs/index.md +7 -5
- package/dist/docs/testing.md +3 -1
- package/dist/docs/uni-app-component-libraries.md +4 -4
- package/dist/docs/vue-sfc.md +43 -0
- package/dist/docs/weapp-config.md +100 -1
- package/dist/docs/wevu-authoring.md +8 -0
- package/dist/eslint.d.mts +2 -0
- package/dist/eslint.mjs +2 -0
- package/dist/{file-CWbsTVPm.mjs → file-D0n-Q1ra.mjs} +1 -1
- package/dist/file-DPQbjCzZ.mjs +2 -0
- package/dist/getInstance-DxCSOpxw.mjs +2 -0
- package/dist/i18n.d.mts +9 -0
- package/dist/i18n.mjs +15 -0
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +1 -1
- package/dist/json.d.mts +1 -1
- package/dist/mcp.d.mts +1 -1
- package/dist/test.mjs +1 -1
- package/dist/types-CgZn5X6j.d.mts +12 -0
- package/dist/types.d.mts +3 -2
- package/package.json +30 -16
- package/dist/file-BjrPjC70.mjs +0 -2
- package/dist/getInstance-CJAXp9db.mjs +0 -2
package/dist/docs/README.md
CHANGED
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
- 🧩 **实验性 uni-app 组件库兼容**:通过显式依赖白名单与 `WotUiResolver()` 在微信小程序和 Web 中使用 Wot UI Vue SFC
|
|
33
33
|
- 🧰 **IDE 命令增强**:可直接透传 `weapp-ide-cli` 全量命令(`preview/upload/config/automator` 等)
|
|
34
34
|
- 🧪 **真实产物单测**:`weapp-vite/test` 提供不启动 CLI 的程序化测试构建入口,可配合 `@mpcore/test` 测试页面和组件
|
|
35
|
+
- 🌍 **内置 i18n**:构建期编译 locale JSON,通过 WXS 翻译模板,并在逻辑层安全切换已构建语言
|
|
35
36
|
|
|
36
37
|
## 快速开始
|
|
37
38
|
|
|
@@ -122,6 +123,25 @@ function handleClick() {
|
|
|
122
123
|
|
|
123
124
|
📚 **完整文档**: [Vue 支持文档](./test/vue/README.md)
|
|
124
125
|
|
|
126
|
+
### 一方维护的 i18n
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
import { defineConfig } from 'weapp-vite/config'
|
|
130
|
+
|
|
131
|
+
export default defineConfig({
|
|
132
|
+
weapp: {
|
|
133
|
+
i18n: {
|
|
134
|
+
defaultLocale: 'zh-CN',
|
|
135
|
+
fallbackLocale: 'en-US',
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
})
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
默认扫描 `src/**/i18n/*.json`。Native Component 和使用 Component 构造的 Page 通过 `behaviors: [i18n.behavior]` 接入;传统 `Page({...})` 使用 `i18n.page(options)` 适配生命周期。Vue/Wevu 使用 `defineOptions({ behaviors: [i18n.behavior] })`。模板中的 `t('key', params)` 会在构建时改写为 WXS 调用;逻辑层从 `weapp-vite/i18n` 导入构建实例,并通过 `i18n.global` 访问翻译和 locale。
|
|
142
|
+
|
|
143
|
+
底层运行时与 catalog 编译器由独立包 `@weapp-vite/i18n` 提供,也可以在完全不使用 Vite 的原生微信小程序中安装。v1 只支持 `{name}` / `{user.name}` 占位符,不自动持久化语言,也不包含 ICU、复数和日期/数字格式化。完整配置见 [i18n 配置](https://vite.icebreaker.top/config/i18n)。
|
|
144
|
+
|
|
125
145
|
- 配置智能提示文档:[docs/volar.md](./docs/volar.md)
|
|
126
146
|
- defineConfig 重载说明:[docs/define-config-overloads.md](./docs/define-config-overloads.md)
|
|
127
147
|
- Vite 插件识别 weapp-vite 宿主:https://vite.icebreaker.top/guide/vite-plugin-host
|
|
@@ -158,6 +178,7 @@ function handleClick() {
|
|
|
158
178
|
- `ai-workflows.md`
|
|
159
179
|
- `project-structure.md`
|
|
160
180
|
- `weapp-config.md`
|
|
181
|
+
- `i18n.md`
|
|
161
182
|
- `uni-app-component-libraries.md`
|
|
162
183
|
- `wevu-authoring.md`
|
|
163
184
|
- `vue-sfc.md`
|
|
@@ -65,6 +65,8 @@ wv mcp init codex
|
|
|
65
65
|
wv mcp doctor codex
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
+
`wv analyze --preload` 会识别宿主导航 API 与由 `useRouter()` / `createRouter()` 创建的路由 binding,输出静态跨分包跳转证据,并通过不写盘的分析构建按触发包汇总实际体积和 2 MB 预下载额度。它不会把普通对象的同名 `push` / `replace` 当作路由,也不会根据静态可达性自动改写业务配置。
|
|
69
|
+
|
|
68
70
|
`wv mcp` 既可以启动服务,也可以管理 AI 客户端配置:
|
|
69
71
|
|
|
70
72
|
- `wv mcp init <codex|claude-code|cursor>`:写入客户端配置。
|
|
@@ -48,7 +48,7 @@ wv analyze --preload
|
|
|
48
48
|
wv analyze --preload --json --output reports/preload.json
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
该命令只读扫描原生模板、Vue SFC
|
|
51
|
+
该命令只读扫描原生模板、Vue SFC 和可证明来源的路由调用,不会修改源码;同时通过不写盘的分析构建读取实际分包体积,按触发页所属包汇总共享的 2 MB 额度。动态路由、业务守卫和真实访问频率仍需人工确认。构建时的显式规则见 `weapp-config.md` 中的 `weapp.routeRules.<pattern>.preload`。
|
|
52
52
|
|
|
53
53
|
### Web 预览与构建
|
|
54
54
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# First-party i18n
|
|
2
|
+
|
|
3
|
+
`weapp.i18n` 提供微信小程序构建期 locale 编译、WXS 模板查询和逻辑层语言切换。运行时与 catalog 编译语义来自独立包 `@weapp-vite/i18n`,weapp-vite 负责扫描、模板改写、分包归属、Vite/Rolldown emit 和 HMR。
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { defineConfig } from 'weapp-vite/config'
|
|
7
|
+
|
|
8
|
+
export default defineConfig({
|
|
9
|
+
weapp: {
|
|
10
|
+
i18n: {
|
|
11
|
+
defaultLocale: 'zh-CN',
|
|
12
|
+
fallbackLocale: 'en-US',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
})
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
默认扫描 `srcRoot` 下的 `**/i18n/*.json`,按文件名识别 locale。嵌套对象会展开为点路径;重复叶子 key、非字符串叶子、缺失 default/fallback locale 会直接构建失败。
|
|
19
|
+
|
|
20
|
+
Native Component 和使用 Component 构造的 Page 都直接使用 `i18n.behavior`:
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { i18n } from 'weapp-vite/i18n'
|
|
24
|
+
|
|
25
|
+
Component({ behaviors: [i18n.behavior] })
|
|
26
|
+
|
|
27
|
+
// 仅用于传统 Page({...}) 项目
|
|
28
|
+
i18n.page({})
|
|
29
|
+
i18n.global.locale = 'en-US'
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Vue/Wevu 组件使用 `defineOptions({ behaviors: [i18n.behavior] })`。模板直接调用:
|
|
33
|
+
|
|
34
|
+
```wxml
|
|
35
|
+
<view>{{ t('common.greeting', { user }) }}</view>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
运行时导出构建实例 `i18n`,并提供 `i18n.global.t()`、`i18n.global.locale`、`i18n.global.fallbackLocale`、`i18n.global.availableLocales` 和 `i18n.global.onLocaleChange()`。写入未构建语言会抛出 `RangeError`;主包和普通分包共享实例,独立分包使用自己的实例。该能力不自动持久化 storage;`i18n.page()` 会显式组合传统 Page 的 `onLoad` / `onUnload`。
|
|
39
|
+
|
|
40
|
+
## 不使用 weapp-vite
|
|
41
|
+
|
|
42
|
+
原生微信小程序可以直接安装 `@weapp-vite/i18n`,运行 `weapp-i18n compile` 生成 `i18n/locales.js` 与 `i18n/locales.wxs`,再通过 `createI18n({ locale, fallbackLocale, messages })` 创建应用内实例。独立包同时提供 CommonJS、ESM、类型、`miniprogram` 入口和 `@weapp-vite/i18n/compiler`;完整示例见 [@weapp-vite/i18n](https://vite.icebreaker.top/packages/i18n)。
|
|
43
|
+
|
|
44
|
+
v1 只编译 `{name}` 与 `{user.name}` 占位符,不支持 ICU/MessageFormat、复数、select、日期或数字格式化。当前只支持微信平台。
|
package/dist/docs/index.md
CHANGED
|
@@ -10,11 +10,12 @@
|
|
|
10
10
|
2. 涉及 AI / MCP / screenshot / DevTools logs 时读 `ai-workflows.md` 与 `mcp.md`。
|
|
11
11
|
3. 涉及项目目录、`AGENTS.md`、`.weapp-vite` 时读 `project-structure.md`。
|
|
12
12
|
4. 涉及 `vite.config.ts`、`weapp` 配置与 chunk 策略时读 `weapp-config.md`。
|
|
13
|
-
5.
|
|
14
|
-
6.
|
|
15
|
-
7. 涉及
|
|
16
|
-
8.
|
|
17
|
-
9.
|
|
13
|
+
5. 接入内置国际化时读 `i18n.md`。
|
|
14
|
+
6. 接入 uni-app Vue 组件库或 Wot UI 时读 `uni-app-component-libraries.md`。
|
|
15
|
+
7. 涉及 wevu 运行时与页面/组件/store 约束时读 `wevu-authoring.md`。
|
|
16
|
+
8. 涉及 Vue SFC 宏、模板约束与编辑器提示时读 `vue-sfc.md`、`volar.md` 与 `define-config-overloads.md`。
|
|
17
|
+
9. 编写页面或组件单测时读 `testing.md`。
|
|
18
|
+
10. 遇到告警、prepare、截图、日志、依赖异常时读 `troubleshooting.md`。
|
|
18
19
|
|
|
19
20
|
## Included Docs
|
|
20
21
|
|
|
@@ -26,6 +27,7 @@
|
|
|
26
27
|
- `ai-workflows.md`: AI 代理在其他仓库里使用 weapp-vite 的推荐工作流。
|
|
27
28
|
- `project-structure.md`: AGENTS.md、.weapp-vite、dist 与源码目录的职责说明。
|
|
28
29
|
- `weapp-config.md`: weapp 配置、autoRoutes、autoImportComponents、routeRules 与 chunk 策略。
|
|
30
|
+
- `i18n.md`: 内置 locale 编译、WXS 模板翻译、运行时切换与分包实例边界。
|
|
29
31
|
- `uni-app-component-libraries.md`: 实验性的 uni-app 组件库转换、Wot UI 配置、99 组件矩阵与双端边界。
|
|
30
32
|
- `wevu-authoring.md`: wevu 页面、组件、store、router 与事件契约的推荐写法。
|
|
31
33
|
- `vue-sfc.md`: definePageJson、definePageMeta、v-model 与模板兼容约束。
|
package/dist/docs/testing.md
CHANGED
|
@@ -13,7 +13,9 @@ export default defineConfig({
|
|
|
13
13
|
})
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
每次 `mountComponent()` 都会创建独立的 Wevu app context,因此 `global.provide`、插件、mocks、全局属性和卸载状态不会在 wrapper 之间共享。
|
|
17
|
+
|
|
18
|
+
该入口只编译并执行 SFC script,不渲染模板、WXML、CSS 或 DOM;`app.vue` 和页面组件也不属于测试对象。默认页面判定允许 `pages/**/components/**` 中的普通组件;使用自定义页面目录时,可通过 `wevuSfc({ isPage: filename => boolean })` 提供同步或异步判定。完整编译产物、WXML 查询、组件树、宿主 mock 和用户交互仍使用 `@mpcore/test`。
|
|
17
19
|
|
|
18
20
|
## 接入
|
|
19
21
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# uni-app 组件库兼容(实验性)
|
|
2
2
|
|
|
3
3
|
> [!WARNING]
|
|
4
|
-
> 这是实验性能力,当前兼容基线固定为 `@wot-ui/ui@2.2.0` 与 `uview-plus@3.8.
|
|
4
|
+
> 这是实验性能力,当前兼容基线固定为 `@wot-ui/ui@2.2.0` 与 `uview-plus@3.8.112`。默认完全关闭;只有项目源码和 `weapp.uniApp.include` 明确列出的 npm 包会进入 uni-app 方言转换。
|
|
5
5
|
|
|
6
6
|
## uview-plus
|
|
7
7
|
|
|
8
8
|
```bash
|
|
9
|
-
pnpm add weapp-vite wevu uview-plus@3.8.
|
|
9
|
+
pnpm add weapp-vite wevu uview-plus@3.8.112
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
```ts
|
|
@@ -36,9 +36,9 @@ export default defineConfig({
|
|
|
36
36
|
|
|
37
37
|
应用启动时调用 `mount$u()`,再把 `uni.$u` 同步到 `app.config.globalProperties.$u`;全局样式引入 `uview-plus/index.scss`。不要使用会在 Web 调用 `Vue.component` 的默认插件注册流程。
|
|
38
38
|
|
|
39
|
-
仓库兼容矩阵通过 `patches/uview-plus@3.8.
|
|
39
|
+
仓库兼容矩阵通过 `patches/uview-plus@3.8.112.patch` 保留 9 项小程序选择器与微信组件主题变量兼容调整。3.8.86 基线中的 `u-slider` 和 `u-tabbar-item` 补丁已经由上游修复,新版不再重复应用。
|
|
40
40
|
|
|
41
|
-
`UviewPlusResolver()` 同时解析 `u-*` 与 `up-*` 标签。静态清单以 3.8.
|
|
41
|
+
`UviewPlusResolver()` 同时解析 `u-*` 与 `up-*` 标签。静态清单以 3.8.112 npm 发布包中的 139 个顶层 SFC 为准,双前缀共 278 个标签;137 个具名组件各有独立测试页。`u-action-sheet-data` 与 `u-column-notice` 没有组件名,分别由 action-sheet 和 notice-bar 页面覆盖。
|
|
42
42
|
|
|
43
43
|
`supportFilesStrategy` 默认为 `'used'`;需要生成全量组件辅助文件时可传入 `UviewPlusResolver({ supportFilesStrategy: 'full' })`。
|
|
44
44
|
|
package/dist/docs/vue-sfc.md
CHANGED
|
@@ -34,10 +34,53 @@
|
|
|
34
34
|
<input v-model="x + y" />
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
+
## SFC 样式
|
|
38
|
+
|
|
39
|
+
微信目标稳定支持 `<style scoped>`、默认/命名 CSS Modules、`useCssModule()` 和 CSS `v-bind()`。CSS 变量会合并到所有模板根节点的 style,不覆盖用户已有 style;`:deep()`、`:global()`、`:slotted()` 只支持可安全映射到小程序选择器的形式。
|
|
40
|
+
|
|
41
|
+
```vue
|
|
42
|
+
<script setup lang="ts">
|
|
43
|
+
import { ref, useCssModule } from 'wevu'
|
|
44
|
+
|
|
45
|
+
const color = ref('red')
|
|
46
|
+
const classes = useCssModule('theme')
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<template>
|
|
50
|
+
<view :class="classes.card" style="padding: 8px" />
|
|
51
|
+
</template>
|
|
52
|
+
|
|
53
|
+
<style scoped module="theme">
|
|
54
|
+
.card {
|
|
55
|
+
color: v-bind(color);
|
|
56
|
+
}
|
|
57
|
+
</style>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
其他小程序平台使用相同编译实现,但在完成对应 IDE/真机验证前视为实验性。
|
|
61
|
+
|
|
37
62
|
## `usingComponents`
|
|
38
63
|
|
|
39
64
|
当你在页面或组件里需要显式注册原生小程序组件时,优先明确当前文件使用的 JSON 宏与配置来源,避免多个入口互相覆盖。
|
|
40
65
|
|
|
66
|
+
## i18n Behavior
|
|
67
|
+
|
|
68
|
+
启用 `weapp.i18n` 后,Vue/Wevu 页面或组件需要显式接入 Behavior:
|
|
69
|
+
|
|
70
|
+
```vue
|
|
71
|
+
<script setup lang="ts">
|
|
72
|
+
import { i18n } from 'weapp-vite/i18n'
|
|
73
|
+
|
|
74
|
+
defineOptions({ behaviors: [i18n.behavior] })
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<template>
|
|
78
|
+
<view>{{ t('common.greeting', { user }) }}</view>
|
|
79
|
+
</template>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
编译器只保留当前配置的 i18n 直接调用;其他函数调用仍回退逻辑线程。完整限制见 `i18n.md`。
|
|
83
|
+
|
|
41
84
|
## HTML 标签迁移辅助
|
|
42
85
|
|
|
43
86
|
如果你把偏 Web 风格的模板迁到 `.vue`,可以优先关注这两个配置:
|
|
@@ -48,6 +48,61 @@ export default defineConfig({
|
|
|
48
48
|
|
|
49
49
|
`main` 表示主包,`packages/order` 匹配 `app.json.subPackages[].root`。启用后,产物 `app.json.subPackages` 只保留参与 scope 的分包,`preloadRule`、`tabBar`、`entryPagePath`、自动路由和 typed router 也会按同一注册图裁剪。`preloadRule.packages` 支持分包 `root`、`name` 和主包标记 `__APP__`;`tabBar.list` 不足微信要求的 2 项时会删除整个 `tabBar`。发布前建议再跑不带 scope 的完整构建。
|
|
50
50
|
|
|
51
|
+
### `chunks.preserveModules`
|
|
52
|
+
|
|
53
|
+
按 `srcRoot` 相对路径匹配源码模块,并为命中的模块保留独立输出文件和目录边界:
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
export default defineConfig({
|
|
57
|
+
weapp: {
|
|
58
|
+
chunks: {
|
|
59
|
+
preserveModules: ['utils/**', 'services/**'],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
})
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
例如 `src/utils/request.ts` 会输出到 `utils/request.js`,引用方会保留对该文件的引用;barrel 模块的静态依赖也会保持独立。该配置用于调试定位和产物审计,不保证减少总包体积或提升冷启动;构建会自动选择兼容的 entry signature。
|
|
66
|
+
|
|
67
|
+
例如一个已经手动分包、包含大量 `utils` 和 `services` 模块的原生项目,可以这样配置:
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
import { defineConfig } from 'weapp-vite'
|
|
71
|
+
|
|
72
|
+
export default defineConfig({
|
|
73
|
+
weapp: {
|
|
74
|
+
srcRoot: 'src',
|
|
75
|
+
chunks: {
|
|
76
|
+
preserveModules: [
|
|
77
|
+
'utils/**',
|
|
78
|
+
'services/**',
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
})
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
规则相对于 `srcRoot`,因此不要添加 `src/` 前缀。构建后,已进入依赖图的 `src/utils/request.ts` 和 `src/services/user.ts` 会分别输出为 `utils/request.js` 和 `services/user.js`;页面保留对这些文件的引用。CJS 和 ESM 均支持该配置。
|
|
86
|
+
|
|
87
|
+
`preserveModules` 保留的是构建后的文件和目录边界。源码仍会经过模块解析、TypeScript 转换并由构建器写入,不会被原样复制;未被入口引用的文件也不会仅因匹配规则而输出。如果只需要改变共享模块的输出位置,不要求单次引用模块保持独立,请使用 `chunks.sharedMode: 'path'`。
|
|
88
|
+
|
|
89
|
+
需要保留 `srcRoot` 下所有已引用源码模块时,使用 `**`:
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
export default defineConfig({
|
|
93
|
+
weapp: {
|
|
94
|
+
srcRoot: 'src',
|
|
95
|
+
chunks: {
|
|
96
|
+
preserveModules: ['**'],
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
})
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`**` 同时匹配 `src/helper.ts` 这样的顶层模块和 `src/utils/request.ts` 这样的嵌套模块。不要使用 `*/**` 代替,因为它不会匹配 `srcRoot` 顶层文件。该配置已通过 CJS、ESM 构建回归,顶层模块和嵌套模块都会按相对路径生成独立文件,引用方保留对应文件引用。
|
|
103
|
+
|
|
104
|
+
页面、组件等逻辑入口仍走各自的入口构建流程,`srcRoot` 外部依赖和未引用文件不会被强制输出。全量保留会增加文件数量,建议结合 `wv analyze` 检查实际包体积;只需要固定目录时优先使用更具体的 glob。
|
|
105
|
+
|
|
51
106
|
### 分包异步模块
|
|
52
107
|
|
|
53
108
|
跨分包 JS 使用微信官方 callback 或 Promise API:
|
|
@@ -81,6 +136,50 @@ const moduleExport = await import('../../packages/order/modules/price.ts')
|
|
|
81
136
|
|
|
82
137
|
适合用目录扫描自动注册组件的项目。组件重名时要先解决命名冲突,不要让自动引入规则长期处于歧义状态。
|
|
83
138
|
|
|
139
|
+
### `i18n`
|
|
140
|
+
|
|
141
|
+
微信项目可以通过 `weapp.i18n` 启用由 `@weapp-vite/i18n` 提供核心语义的 locale 编译与运行时切换:
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
export default defineConfig({
|
|
145
|
+
weapp: {
|
|
146
|
+
i18n: {
|
|
147
|
+
defaultLocale: 'zh-CN',
|
|
148
|
+
fallbackLocale: 'en-US',
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
})
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
默认扫描 `**/i18n/*.json`。Component Page、传统 Page、分包实例边界、原生无 Vite 用法和 v1 占位符限制见 `i18n.md`。
|
|
155
|
+
|
|
156
|
+
### `styles`
|
|
157
|
+
|
|
158
|
+
用于生成主包独立样式入口,并按规则向主包与普通分包的样式注入相对 `@import`。默认不会修改 `app.wxss`;对象配置的 `include` 显式匹配 `app.vue` 等应用入口时,可以向 `app.wxss` 注入:
|
|
159
|
+
|
|
160
|
+
```ts
|
|
161
|
+
export default defineConfig({
|
|
162
|
+
weapp: {
|
|
163
|
+
styles: [
|
|
164
|
+
{
|
|
165
|
+
source: 'styles/theme.scss',
|
|
166
|
+
include: ['pages/**', 'components/**', 'packages/*/**'],
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
source: 'styles/manual.less',
|
|
170
|
+
inject: false,
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
source: 'styles/app-theme.scss',
|
|
174
|
+
include: 'app.vue',
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
},
|
|
178
|
+
})
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
`inject: false` 只生成目标平台样式文件,适合由源码手动 `@import`。未显式配置 `include` 时仍默认排除 app,避免意外把共享样式提升为全局样式。独立分包不能依赖主包资源,不会收到 `weapp.styles` 的自动注入;需要在 `weapp.subPackages.<root>.styles` 中声明分包自己的入口。
|
|
182
|
+
|
|
84
183
|
### `routeRules`
|
|
85
184
|
|
|
86
185
|
用于给页面路由追加规则,例如 layout、微信分包预下载等。它属于项目级编排,而不是组件内部语义。
|
|
@@ -100,7 +199,7 @@ export default defineConfig({
|
|
|
100
199
|
})
|
|
101
200
|
```
|
|
102
201
|
|
|
103
|
-
微信构建会把 `preload` 合成为 `app.json.preloadRule`;手写的同一路由规则优先,其他平台不会生成微信专属字段。多条 glob 命中时选择具体程度最高的一条。需要检查静态跨分包跳转时,运行 `wv analyze --preload
|
|
202
|
+
微信构建会把 `preload` 合成为 `app.json.preloadRule`;手写的同一路由规则优先,其他平台不会生成微信专属字段。多条 glob 命中时选择具体程度最高的一条。需要检查静态跨分包跳转时,运行 `wv analyze --preload`;它只输出建议,不修改源码,并按触发页所属包汇总实际分包体积与共享的 2 MB 额度。
|
|
104
203
|
|
|
105
204
|
### `vue.template.htmlTagToWxml`
|
|
106
205
|
|
|
@@ -30,10 +30,18 @@
|
|
|
30
30
|
- `storeToRefs`
|
|
31
31
|
- 避免巨型跨页面全局 store
|
|
32
32
|
|
|
33
|
+
`createStore()` 只设置全局活动 manager,插件必须在 Store 第一次创建前注册;`install()` 是 no-op,`useXxx()` 不接收 manager 参数。Wevu Store 不提供 Pinia SSR、HMR 或 devtools 契约。
|
|
34
|
+
|
|
33
35
|
## router
|
|
34
36
|
|
|
35
37
|
如果项目使用 `wevu/router`,优先把导航、route、参数解析看成小程序运行时约束下的路由抽象,而不是浏览器路由。
|
|
36
38
|
|
|
39
|
+
`currentRoute` 是 readonly 响应式对象而不是 `Ref`,`isReady()` 创建后立即完成;没有 Web history、`RouterView` 或 `RouterLink`,页面栈前进和 tabBar query 受宿主限制。
|
|
40
|
+
|
|
41
|
+
## 静态兼容检查
|
|
42
|
+
|
|
43
|
+
Wevu 模板默认接入 `@weapp-vite/eslint` 的 `wevuCompatibilityRecommended`,用于禁止静态可确定的不支持 API,并警告同名但参数、时序或宿主语义不同的 API。动态访问和第三方依赖内部代码不在完整判定范围内;旧项目可继续使用 `weapp-vite/eslint` 兼容入口。
|
|
44
|
+
|
|
37
45
|
## 什么时候看这篇
|
|
38
46
|
|
|
39
47
|
适用于:
|
package/dist/eslint.mjs
ADDED
|
@@ -134,7 +134,7 @@ function resolveAutoRoutesMacroImportPath() {
|
|
|
134
134
|
}
|
|
135
135
|
async function resolveAutoRoutesInlineSnapshot() {
|
|
136
136
|
try {
|
|
137
|
-
const { getCompilerContext } = await import("./getInstance-
|
|
137
|
+
const { getCompilerContext } = await import("./getInstance-DxCSOpxw.mjs");
|
|
138
138
|
const compilerContext = getCompilerContext();
|
|
139
139
|
const service = compilerContext.autoRoutesService;
|
|
140
140
|
const reference = service?.getReference?.();
|
package/dist/i18n.d.mts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { t as WeappI18nConfig } from "./types-CgZn5X6j.mjs";
|
|
2
|
+
import { I18nGlobal, I18nGlobal as I18nGlobal$1, I18nInstance, I18nInstance as I18nInstance$1, I18nLocaleChangeSubscription } from "@weapp-vite/i18n";
|
|
3
|
+
//#region src/i18n.d.ts
|
|
4
|
+
declare const behavior: I18nInstance$1["behavior"];
|
|
5
|
+
declare const i18n: I18nInstance$1;
|
|
6
|
+
declare const global: I18nGlobal$1;
|
|
7
|
+
declare const page: typeof Page;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { type I18nGlobal, type I18nInstance, type I18nLocaleChangeSubscription, type WeappI18nConfig, behavior, global, i18n, page };
|
package/dist/i18n.mjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { WEAPP_I18N_RUNTIME_MARKER } from "@weapp-core/constants";
|
|
2
|
+
//#region src/i18n.ts
|
|
3
|
+
function unavailable() {
|
|
4
|
+
throw new Error("weapp-vite/i18n 只能在启用 weapp.i18n 的小程序构建中使用。");
|
|
5
|
+
}
|
|
6
|
+
const behavior = { [WEAPP_I18N_RUNTIME_MARKER]: true };
|
|
7
|
+
const i18n = {
|
|
8
|
+
behavior,
|
|
9
|
+
global: unavailable,
|
|
10
|
+
page: unavailable
|
|
11
|
+
};
|
|
12
|
+
const global = unavailable;
|
|
13
|
+
const page = unavailable;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { behavior, global, i18n, page };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { $n as
|
|
1
|
+
import { $n as isWeappViteHost, A as Ref, C as LoadConfigOptions, D as MethodDefinitions, E as InlineConfig, F as RolldownPlugin, I as RolldownPluginOption, L as RolldownWatchOptions, M as RolldownBuild, N as RolldownOptions, O as Plugin, P as RolldownOutput, Qn as createWeappViteHostMeta, R as RolldownWatcher, S as CompilerContext, T as ConfigEnv, Xn as WeappViteHostMeta, Yn as WEAPP_VITE_HOST_NAME, Zn as applyWeappViteHostMeta, _ as definePageJson, a as UserConfigFnNoEnvPlain, ar as WeappViteRuntime, at as WeappViteConfig, c as UserConfigFnPromise, cr as WeappViteTargetKind, d as Component, dr as getSupportedWeappViteTargetDescriptors, er as resolveWeappViteHostMeta, f as Page, fr as isWebPlatform, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, ir as WeappVitePlatform, j as ResolvedConfig, k as PluginOption, l as defineConfig, lr as WebPlatform, m as Theme, n as UserConfigExport, nr as ResolvedWeappViteTarget, o as UserConfigFnObject, or as WeappViteTargetDescriptor, p as Sitemap, pr as resolveWeappViteTarget, r as UserConfigFn, rr as WEB_PLATFORM_ALIASES, s as UserConfigFnObjectPlain, sr as WeappViteTargetInput, t as UserConfig, tr as ResolveWeappViteTargetOptions, u as App, ur as getSupportedWeappVitePlatforms, v as defineSitemapJson, w as ComputedDefinitions, y as defineThemeJson, z as ViteDevServer } from "./config-6l-p3o-C.mjs";
|
|
2
|
+
import { t as WeappI18nConfig } from "./types-CgZn5X6j.mjs";
|
|
2
3
|
import { a as LayoutHostContext, c as LayoutHostResolver, d as unregisterLayoutHosts, f as waitForLayoutHost, i as LayoutHostBridge, l as registerLayoutHosts, m as createWevuComponent, n as defineProps, o as LayoutHostEntry, p as WevuComponentOptions, r as setPageLayout, s as LayoutHostResolveOptions, t as defineEmits, u as resolveLayoutHost } from "./runtime-Ee2HY6gR.mjs";
|
|
3
4
|
//#region src/createContext.d.ts
|
|
4
5
|
interface CreateCompilerContextOptions extends Partial<LoadConfigOptions> {
|
|
@@ -12,4 +13,4 @@ interface CreateCompilerContextOptions extends Partial<LoadConfigOptions> {
|
|
|
12
13
|
*/
|
|
13
14
|
declare function createCompilerContext(options?: CreateCompilerContextOptions): Promise<CompilerContext>;
|
|
14
15
|
//#endregion
|
|
15
|
-
export { type App, type Component, type ComputedDefinitions, type ConfigEnv, type InlineConfig, type LayoutHostBridge, type LayoutHostContext, type LayoutHostEntry, type LayoutHostResolveOptions, type LayoutHostResolver, type MethodDefinitions, type Page, type Plugin, type PluginOption, type Ref, ResolveWeappViteTargetOptions, type ResolvedConfig, ResolvedWeappViteTarget, type RolldownBuild, type RolldownOptions, type RolldownOutput, type RolldownPlugin, type RolldownPluginOption, type RolldownWatchOptions, type RolldownWatcher, type Sitemap, type Theme, UserConfig, UserConfigExport, UserConfigFn, UserConfigFnNoEnv, UserConfigFnNoEnvPlain, UserConfigFnObject, UserConfigFnObjectPlain, UserConfigFnPromise, type ViteDevServer, WEAPP_VITE_HOST_NAME, WEB_PLATFORM_ALIASES, type WeappViteConfig, WeappViteHostMeta, WeappVitePlatform, WeappViteRuntime, WeappViteTargetDescriptor, WeappViteTargetInput, WeappViteTargetKind, WebPlatform, type WevuComponentOptions, applyWeappViteHostMeta, createCompilerContext, createWeappViteHostMeta, createWevuComponent, defineAppJson, defineComponentJson, defineConfig, defineEmits, definePageJson, defineProps, defineSitemapJson, defineThemeJson, getSupportedWeappVitePlatforms, getSupportedWeappViteTargetDescriptors, isWeappViteHost, isWebPlatform, registerLayoutHosts, resolveLayoutHost, resolveWeappViteHostMeta, resolveWeappViteTarget, setPageLayout, unregisterLayoutHosts, waitForLayoutHost };
|
|
16
|
+
export { type App, type Component, type ComputedDefinitions, type ConfigEnv, type InlineConfig, type LayoutHostBridge, type LayoutHostContext, type LayoutHostEntry, type LayoutHostResolveOptions, type LayoutHostResolver, type MethodDefinitions, type Page, type Plugin, type PluginOption, type Ref, ResolveWeappViteTargetOptions, type ResolvedConfig, ResolvedWeappViteTarget, type RolldownBuild, type RolldownOptions, type RolldownOutput, type RolldownPlugin, type RolldownPluginOption, type RolldownWatchOptions, type RolldownWatcher, type Sitemap, type Theme, UserConfig, UserConfigExport, UserConfigFn, UserConfigFnNoEnv, UserConfigFnNoEnvPlain, UserConfigFnObject, UserConfigFnObjectPlain, UserConfigFnPromise, type ViteDevServer, WEAPP_VITE_HOST_NAME, WEB_PLATFORM_ALIASES, type WeappI18nConfig, type WeappViteConfig, WeappViteHostMeta, WeappVitePlatform, WeappViteRuntime, WeappViteTargetDescriptor, WeappViteTargetInput, WeappViteTargetKind, WebPlatform, type WevuComponentOptions, applyWeappViteHostMeta, createCompilerContext, createWeappViteHostMeta, createWevuComponent, defineAppJson, defineComponentJson, defineConfig, defineEmits, definePageJson, defineProps, defineSitemapJson, defineThemeJson, getSupportedWeappVitePlatforms, getSupportedWeappViteTargetDescriptors, isWeappViteHost, isWebPlatform, registerLayoutHosts, resolveLayoutHost, resolveWeappViteHostMeta, resolveWeappViteTarget, setPageLayout, unregisterLayoutHosts, waitForLayoutHost };
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as defineThemeJson, i as defineSitemapJson, n as defineComponentJson, r as definePageJson, t as defineAppJson } from "./json-BL8Dhhk6.mjs";
|
|
2
2
|
import { a as resolveWeappViteHostMeta, i as isWeappViteHost, n as applyWeappViteHostMeta, r as createWeappViteHostMeta, t as WEAPP_VITE_HOST_NAME } from "./pluginHost--CaeyWpA.mjs";
|
|
3
3
|
import { t as defineConfig } from "./config-DRGcCi3h.mjs";
|
|
4
|
-
import { c as getSupportedWeappViteTargetDescriptors, l as isWebPlatform, o as WEB_PLATFORM_ALIASES, s as getSupportedWeappVitePlatforms, t as createCompilerContext, u as resolveWeappViteTarget } from "./createContext-
|
|
4
|
+
import { c as getSupportedWeappViteTargetDescriptors, l as isWebPlatform, o as WEB_PLATFORM_ALIASES, s as getSupportedWeappVitePlatforms, t as createCompilerContext, u as resolveWeappViteTarget } from "./createContext-PBWMhrli.mjs";
|
|
5
5
|
import { a as resolveLayoutHost, c as createWevuComponent, i as registerLayoutHosts, n as defineProps, o as unregisterLayoutHosts, r as setPageLayout, s as waitForLayoutHost, t as defineEmits } from "./runtime-D6VCNhNY.mjs";
|
|
6
6
|
export { WEAPP_VITE_HOST_NAME, WEB_PLATFORM_ALIASES, applyWeappViteHostMeta, createCompilerContext, createWeappViteHostMeta, createWevuComponent, defineAppJson, defineComponentJson, defineConfig, defineEmits, definePageJson, defineProps, defineSitemapJson, defineThemeJson, getSupportedWeappVitePlatforms, getSupportedWeappViteTargetDescriptors, isWeappViteHost, isWebPlatform, registerLayoutHosts, resolveLayoutHost, resolveWeappViteHostMeta, resolveWeappViteTarget, setPageLayout, unregisterLayoutHosts, waitForLayoutHost };
|
package/dist/json.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as definePageJson, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, m as Theme, p as Sitemap, u as App, v as defineSitemapJson, y as defineThemeJson } from "./config-
|
|
1
|
+
import { _ as definePageJson, d as Component, f as Page, g as defineComponentJson, h as defineAppJson, m as Theme, p as Sitemap, u as App, v as defineSitemapJson, y as defineThemeJson } from "./config-6l-p3o-C.mjs";
|
|
2
2
|
export { type App, type Component, type Page, type Sitemap, type Theme, defineAppJson, defineComponentJson, definePageJson, defineSitemapJson, defineThemeJson };
|
package/dist/mcp.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Et as WeappMcpConfig } from "./config-
|
|
1
|
+
import { Et as WeappMcpConfig } from "./config-6l-p3o-C.mjs";
|
|
2
2
|
import { CreateServerOptions, DEFAULT_MCP_ENDPOINT, DEFAULT_MCP_HOST, DEFAULT_MCP_PORT, DEFAULT_RUNTIME_REST_ENDPOINT, McpServerHandle, StartMcpServerOptions, createWeappViteMcpServer } from "@weapp-vite/mcp";
|
|
3
3
|
//#region src/mcp.d.ts
|
|
4
4
|
interface ResolvedWeappMcpConfig {
|
package/dist/test.mjs
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import "@weapp-vite/i18n/compiler";
|
|
2
|
+
import "@weapp-vite/i18n";
|
|
3
|
+
//#region src/i18n/types.d.ts
|
|
4
|
+
interface WeappI18nConfig {
|
|
5
|
+
defaultLocale: string;
|
|
6
|
+
fallbackLocale?: string;
|
|
7
|
+
include?: string | string[];
|
|
8
|
+
functionName?: string;
|
|
9
|
+
moduleName?: string;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { WeappI18nConfig as t };
|
package/dist/types.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { f as Resolver } from "./index-CaXAtb9e.mjs";
|
|
2
2
|
import { n as AutoRoutesSubPackage, t as AutoRoutes } from "./routes-C7fCmf92.mjs";
|
|
3
|
-
import { $ as WeappAnalyzeBudgetConfig, $t as GenerateFilenamesOptions, A as Ref, An as
|
|
4
|
-
|
|
3
|
+
import { $ as WeappAnalyzeBudgetConfig, $t as GenerateFilenamesOptions, A as Ref, An as StyleScope, At as WeappReactCompilerConfig, B as BindingErrorLike, Bn as WeappLibFileName, Bt as WeappWevuConfig, Cn as SharedChunkDynamicImports, Ct as WeappInjectWeapiConfig, D as MethodDefinitions, Dn as StyleConfigEntry, Dt as WeappNpmConfig, E as InlineConfig, En as SharedChunkStrategy, Et as WeappMcpConfig, F as RolldownPlugin, Fn as SubPackageStyleScope, Ft as WeappSubPackageConfig, G as EntryJsonFragment, Gn as WeappManagedServerTsconfigConfig, Gt as BuildNpmPackageMeta, H as BaseEntry, Hn as WeappLibVueTscOptions, Ht as Alias, I as RolldownPluginOption, In as WeappLibComponentJson, It as WeappUniAppConfig, J as ScanComponentItem, Jn as WeappWebConfig, Jt as CopyOptions, K as PageEntry, Kn as WeappManagedSharedTsconfigConfig, Kt as ChunksConfig, L as RolldownWatchOptions, Ln as WeappLibConfig, Lt as WeappVueConfig, M as RolldownBuild, Mn as SubPackageStyleConfigEntry, Mt as WeappRequestRuntimeConfig, N as RolldownOptions, Nn as SubPackageStyleConfigObject, Nt as WeappRouteRule, O as Plugin, On as StyleConfigObject, Ot as WeappPreloadNetwork, P as RolldownOutput, Pn as SubPackageStyleEntry, Pt as WeappRouteRules, Q as UserConfig, Qt as GenerateFileType, R as RolldownWatcher, Rn as WeappLibDtsOptions, Rt as WeappVueTemplateConfig, Sn as ResolvedAlias, St as WeappInjectRequestGlobalsTarget, T as ConfigEnv, Tn as SharedChunkOverride, Tt as WeappInjectWebRuntimeGlobalsTarget, U as ComponentEntry, Un as WeappManagedAppTsconfigConfig, Ut as AliasOptions, V as AppEntry, Vn as WeappLibInternalDtsOptions, Vt as WeappWorkerConfig, W as Entry, Wn as WeappManagedNodeTsconfigConfig, Wt as AlipayNpmMode, X as ProjectConfig, Xn as WeappViteHostMeta, Xt as GenerateDirsOptions, Y as WxmlDep, Yt as DeprecatedInlineDynamicImports, Z as SubPackageMetaValue, Zt as GenerateExtensionsOptions, _n as NpmDependencyPattern, _t as WeappAutoRoutesIncludePattern, an as GenerateTemplateFileSource, ar as WeappViteRuntime, at as WeappViteConfig, b as ChangeEvent, bn as NpmStrategy, bt as WeappHmrConfig, cn as GenerateTemplatesConfig, ct as EnhanceOptions, dn as JsonMergeContext, dt as MultiPlatformConfig, en as GenerateOptions, et as WeappAnalyzeConfig, fn as JsonMergeFunction, ft as ScanWxmlOptions, gn as NpmBuildOptions, gt as WeappAutoRoutesInclude, hn as MpPlatform, ht as WeappAutoRoutesConfig, in as GenerateTemplateFactory, it as WeappForwardConsoleLogLevel, j as ResolvedConfig, jn as SubPackage, jt as WeappReactConfig, k as PluginOption, kn as StyleEntry, kt as WeappPreloadRule, ln as JsFormat, lt as EnhanceWxmlOptions, mn as JsonMergeStrategy, mt as WeappAppPreludeMode, nn as GenerateTemplateContext, nt as WeappDebugConfig, on as GenerateTemplateInlineSource, ot as AutoImportComponents, pn as JsonMergeStage, pt as WeappAppPreludeConfig, q as ComponentsMap, qn as WeappManagedTypeScriptConfig, qt as CopyGlobs, rn as GenerateTemplateEntry, rt as WeappForwardConsoleConfig, sn as GenerateTemplateScope, st as AutoImportComponentsOption, tn as GenerateTemplate, tt as WeappAnalyzeHistoryConfig, un as JsonConfig, ut as HandleWxmlOptions, vn as NpmMainPackageConfig, vt as WeappBuildScopeConfig, w as ComputedDefinitions, wn as SharedChunkMode, wt as WeappInjectWebRuntimeGlobalsConfig, x as WeappVitePluginApi, xn as NpmSubPackageConfig, xt as WeappInjectRequestGlobalsConfig, yn as NpmPluginPackageConfig, yt as WeappBuildScopeObjectConfig, z as ViteDevServer, zn as WeappLibEntryContext, zt as WeappWebRuntimeConfig } from "./config-6l-p3o-C.mjs";
|
|
4
|
+
import { t as WeappI18nConfig } from "./types-CgZn5X6j.mjs";
|
|
5
|
+
export { Alias, AliasOptions, AlipayNpmMode, AppEntry, AutoImportComponents, AutoImportComponentsOption, AutoRoutes, AutoRoutesSubPackage, BaseEntry, BindingErrorLike, BuildNpmPackageMeta, ChangeEvent, ChunksConfig, ComponentEntry, ComponentsMap, type ComputedDefinitions, type ConfigEnv, CopyGlobs, CopyOptions, DeprecatedInlineDynamicImports, EnhanceOptions, EnhanceWxmlOptions, Entry, EntryJsonFragment, GenerateDirsOptions, GenerateExtensionsOptions, GenerateFileType, GenerateFilenamesOptions, GenerateOptions, GenerateTemplate, GenerateTemplateContext, GenerateTemplateEntry, GenerateTemplateFactory, GenerateTemplateFileSource, GenerateTemplateInlineSource, GenerateTemplateScope, GenerateTemplatesConfig, HandleWxmlOptions, type InlineConfig, JsFormat, JsonConfig, JsonMergeContext, JsonMergeFunction, JsonMergeStage, JsonMergeStrategy, type MethodDefinitions, MpPlatform, MultiPlatformConfig, NpmBuildOptions, NpmDependencyPattern, NpmMainPackageConfig, NpmPluginPackageConfig, NpmStrategy, NpmSubPackageConfig, PageEntry, type Plugin, type PluginOption, ProjectConfig, type Ref, ResolvedAlias, type ResolvedConfig, type Resolver, type RolldownBuild, type RolldownOptions, type RolldownOutput, type RolldownPlugin, type RolldownPluginOption, type RolldownWatchOptions, type RolldownWatcher, ScanComponentItem, ScanWxmlOptions, SharedChunkDynamicImports, SharedChunkMode, SharedChunkOverride, SharedChunkStrategy, StyleConfigEntry, StyleConfigObject, StyleEntry, StyleScope, SubPackage, SubPackageMetaValue, SubPackageStyleConfigEntry, SubPackageStyleConfigObject, SubPackageStyleEntry, SubPackageStyleScope, UserConfig, type ViteDevServer, WeappAnalyzeBudgetConfig, WeappAnalyzeConfig, WeappAnalyzeHistoryConfig, WeappAppPreludeConfig, WeappAppPreludeMode, WeappAutoRoutesConfig, WeappAutoRoutesInclude, WeappAutoRoutesIncludePattern, WeappBuildScopeConfig, WeappBuildScopeObjectConfig, WeappDebugConfig, WeappForwardConsoleConfig, WeappForwardConsoleLogLevel, WeappHmrConfig, type WeappI18nConfig, WeappInjectRequestGlobalsConfig, WeappInjectRequestGlobalsTarget, WeappInjectWeapiConfig, WeappInjectWebRuntimeGlobalsConfig, WeappInjectWebRuntimeGlobalsTarget, WeappLibComponentJson, WeappLibConfig, WeappLibDtsOptions, WeappLibEntryContext, WeappLibFileName, WeappLibInternalDtsOptions, WeappLibVueTscOptions, WeappManagedAppTsconfigConfig, WeappManagedNodeTsconfigConfig, WeappManagedServerTsconfigConfig, WeappManagedSharedTsconfigConfig, WeappManagedTypeScriptConfig, WeappMcpConfig, WeappNpmConfig, WeappPreloadNetwork, WeappPreloadRule, WeappReactCompilerConfig, WeappReactConfig, WeappRequestRuntimeConfig, WeappRouteRule, WeappRouteRules, WeappSubPackageConfig, WeappUniAppConfig, WeappViteConfig, type WeappViteHostMeta, WeappVitePluginApi, type WeappViteRuntime, WeappVueConfig, WeappVueTemplateConfig, WeappWebConfig, WeappWebRuntimeConfig, WeappWevuConfig, WeappWorkerConfig, WxmlDep };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-vite",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "6.
|
|
4
|
+
"version": "6.22.0",
|
|
5
5
|
"description": "weapp-vite 一个现代化的小程序打包工具",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -46,6 +46,10 @@
|
|
|
46
46
|
"types": "./dist/runtime.d.mts",
|
|
47
47
|
"import": "./dist/runtime.mjs"
|
|
48
48
|
},
|
|
49
|
+
"./i18n": {
|
|
50
|
+
"types": "./dist/i18n.d.mts",
|
|
51
|
+
"import": "./dist/i18n.mjs"
|
|
52
|
+
},
|
|
49
53
|
"./web-apis": {
|
|
50
54
|
"types": "./dist/web-apis.d.mts",
|
|
51
55
|
"import": "./dist/web-apis.mjs"
|
|
@@ -62,6 +66,14 @@
|
|
|
62
66
|
"types": "./dist/test.d.mts",
|
|
63
67
|
"import": "./dist/test.mjs"
|
|
64
68
|
},
|
|
69
|
+
"./compatibility": {
|
|
70
|
+
"types": "./dist/compatibility.d.mts",
|
|
71
|
+
"import": "./dist/compatibility.mjs"
|
|
72
|
+
},
|
|
73
|
+
"./eslint": {
|
|
74
|
+
"types": "./dist/eslint.d.mts",
|
|
75
|
+
"import": "./dist/eslint.mjs"
|
|
76
|
+
},
|
|
65
77
|
"./auto-import-components/resolvers": {
|
|
66
78
|
"types": "./dist/auto-import-components/resolvers.d.mts",
|
|
67
79
|
"import": "./dist/auto-import-components/resolvers.mjs"
|
|
@@ -97,13 +109,17 @@
|
|
|
97
109
|
"engines": {
|
|
98
110
|
"node": "^20.19.0 || >=22.12.0"
|
|
99
111
|
},
|
|
112
|
+
"publishConfig": {
|
|
113
|
+
"access": "public",
|
|
114
|
+
"registry": "https://registry.npmjs.org"
|
|
115
|
+
},
|
|
100
116
|
"dependencies": {
|
|
101
117
|
"@babel/preset-env": "^8.0.2",
|
|
102
118
|
"@babel/preset-typescript": "^8.0.1",
|
|
103
119
|
"@jridgewell/remapping": "^2.3.5",
|
|
104
120
|
"@vercel/detect-agent": "^1.2.5",
|
|
105
121
|
"@volar/typescript": "^2.4.28",
|
|
106
|
-
"@vue/language-core": "^3.3.
|
|
122
|
+
"@vue/language-core": "^3.3.11",
|
|
107
123
|
"cac": "^7.0.0",
|
|
108
124
|
"chokidar": "^5.0.0",
|
|
109
125
|
"comment-json": "^5.0.0",
|
|
@@ -126,27 +142,25 @@
|
|
|
126
142
|
"vite": "8.2.2",
|
|
127
143
|
"vite-tsconfig-paths": "^6.1.1",
|
|
128
144
|
"vue": "^3.5.41",
|
|
129
|
-
"vue-tsc": "^3.3.
|
|
145
|
+
"vue-tsc": "^3.3.11",
|
|
146
|
+
"@weapp-core/constants": "0.2.0",
|
|
130
147
|
"@weapp-core/init": "6.0.14",
|
|
131
|
-
"@weapp-core/schematics": "6.1.0",
|
|
132
148
|
"@weapp-core/logger": "3.1.1",
|
|
149
|
+
"@weapp-core/schematics": "6.1.0",
|
|
133
150
|
"@weapp-core/shared": "3.1.1",
|
|
151
|
+
"@weapp-vite/ast": "6.22.0",
|
|
152
|
+
"@weapp-vite/i18n": "0.2.0",
|
|
134
153
|
"@weapp-vite/mcp": "1.4.15",
|
|
135
154
|
"@weapp-vite/miniprogram-automator": "1.2.14",
|
|
155
|
+
"@weapp-vite/eslint": "0.2.0",
|
|
136
156
|
"@weapp-vite/volar": "2.1.3",
|
|
137
|
-
"@weapp-
|
|
138
|
-
"@wevu/web-apis": "1.2.34",
|
|
139
|
-
"@weapp-vite/web": "1.4.10",
|
|
140
|
-
"@weapp-vite/ast": "6.20.5",
|
|
141
|
-
"@wevu/api": "0.2.16",
|
|
157
|
+
"@weapp-vite/web": "1.4.12",
|
|
142
158
|
"rolldown-require": "2.0.26",
|
|
143
|
-
"weapp-ide-cli": "6.0.7",
|
|
144
159
|
"vite-plugin-performance": "2.0.1",
|
|
145
|
-
"wevu": "
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
"
|
|
149
|
-
"registry": "https://registry.npmjs.org"
|
|
160
|
+
"@wevu/web-apis": "1.2.35",
|
|
161
|
+
"@wevu/api": "0.2.16",
|
|
162
|
+
"weapp-ide-cli": "6.0.7",
|
|
163
|
+
"wevu": "6.22.0"
|
|
150
164
|
},
|
|
151
165
|
"optionalDependencies": {
|
|
152
166
|
"@swc/core": "^1.16.1"
|
|
@@ -170,7 +184,7 @@
|
|
|
170
184
|
"benchmark:auto-import:ci": "node --import tsx scripts/benchmark-auto-import-ci.ts",
|
|
171
185
|
"test:dev": "vitest",
|
|
172
186
|
"test": "vitest run",
|
|
173
|
-
"test:types": "cd test-d/auto-routes-define-app-json && tsd && cd ../config-define-config && tsd && cd ../internal-src-types && tsd && cd ../resolvers-public-types && tsd && cd ../runtime-public-types && tsd && cd ../test-artifact-public-types && tsd",
|
|
187
|
+
"test:types": "cd test-d/auto-routes-define-app-json && tsd && cd ../config-define-config && tsd && cd ../i18n-public-types && tsd && cd ../internal-src-types && tsd && cd ../resolvers-public-types && tsd && cd ../runtime-public-types && tsd && cd ../test-artifact-public-types && tsd",
|
|
174
188
|
"lint:src": "eslint src --ext .ts",
|
|
175
189
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
176
190
|
"sync": "cnpm sync weapp-vite"
|