weapp-vite 6.21.0 → 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 +3 -3
- package/dist/compatibility.d.mts +2 -0
- package/dist/compatibility.mjs +2 -0
- package/dist/{config-Pi3hdn_g.d.mts → config-6l-p3o-C.d.mts} +12 -1
- package/dist/config.d.mts +3 -2
- package/dist/{createContext-BE57_Xi7.mjs → createContext-PBWMhrli.mjs} +393 -69
- package/dist/docs/README.md +21 -0
- package/dist/docs/i18n.md +44 -0
- package/dist/docs/index.md +7 -5
- package/dist/docs/uni-app-component-libraries.md +4 -4
- package/dist/docs/vue-sfc.md +43 -0
- package/dist/docs/weapp-config.md +62 -2
- package/dist/docs/wevu-authoring.md +8 -0
- package/dist/eslint.d.mts +2 -0
- package/dist/eslint.mjs +2 -0
- package/dist/{file-Byldwig4.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 +28 -14
- package/dist/file-C-jjrMsb.mjs +0 -2
- package/dist/getInstance-yJ2CpeL9.mjs +0 -2
package/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`
|
package/dist/auto-routes.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as getCompilerContext, v as getRouteRuntimeGlobalKeys } from "./createContext-
|
|
1
|
+
import { n as getCompilerContext, v as getRouteRuntimeGlobalKeys } from "./createContext-PBWMhrli.mjs";
|
|
2
2
|
//#region src/auto-routes.ts
|
|
3
3
|
const ROUTE_RUNTIME_OVERRIDE_KEY = Symbol.for("weapp-vite.route-runtime");
|
|
4
4
|
function createGetter(resolver) {
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as shouldPassPlatformArgToIdeOpen, C as findPreloadRuleKey, D as parseCommentJson, E as loadViteConfigFile, O as createCjsConfigLoadError, S as collectPreloadPages, T as suggestPreloadRules, _ as resolveHmrProfileJsonPath, a as formatBytes, b as checkRuntime, d as getBackendForCapability, f as resolveBackendExecution, g as SHARED_CHUNK_VIRTUAL_PREFIX, h as createSharedBuildConfig, j as isPathInside, k as getDefaultIdeProjectRoot, m as syncManagedTsconfigBootstrapFiles, p as syncProjectSupportFiles, t as createCompilerContext, w as resolvePreloadPackageIdentifier, x as getProjectConfigFileName, y as resolveWeappConfigFile } from "./createContext-
|
|
1
|
+
import { A as shouldPassPlatformArgToIdeOpen, C as findPreloadRuleKey, D as parseCommentJson, E as loadViteConfigFile, O as createCjsConfigLoadError, S as collectPreloadPages, T as suggestPreloadRules, _ as resolveHmrProfileJsonPath, a as formatBytes, b as checkRuntime, d as getBackendForCapability, f as resolveBackendExecution, g as SHARED_CHUNK_VIRTUAL_PREFIX, h as createSharedBuildConfig, j as isPathInside, k as getDefaultIdeProjectRoot, m as syncManagedTsconfigBootstrapFiles, p as syncProjectSupportFiles, t as createCompilerContext, w as resolvePreloadPackageIdentifier, x as getProjectConfigFileName, y as resolveWeappConfigFile } from "./createContext-PBWMhrli.mjs";
|
|
2
2
|
import { r as logger_default, t as colors } from "./logger-mt4mSTqV.mjs";
|
|
3
|
-
import { h as VERSION, i as findJsEntry, o as findTemplateEntry, s as findVueEntry } from "./file-
|
|
3
|
+
import { h as VERSION, i as findJsEntry, o as findTemplateEntry, s as findVueEntry } from "./file-D0n-Q1ra.mjs";
|
|
4
4
|
import { c as startWeappViteMcpServer, l as detectAiDevelopmentEnvironment, s as resolveWeappMcpConfig } from "./mcp-BG6TliEg.mjs";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import fs from "node:fs";
|
|
@@ -4945,7 +4945,7 @@ function resolveRunnableHotkeyDefinition(input) {
|
|
|
4945
4945
|
}
|
|
4946
4946
|
//#endregion
|
|
4947
4947
|
//#region package.json
|
|
4948
|
-
var version = "6.
|
|
4948
|
+
var version = "6.22.0";
|
|
4949
4949
|
//#endregion
|
|
4950
4950
|
//#region src/cli/devHotkeys/format.ts
|
|
4951
4951
|
const FULLWIDTH_ASCII_START = 65281;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { WevuCompatibilityDiagnostic, WevuCompatibilityEntry, WevuCompatibilityLevel, WevuCompatibilitySurface, WevuCompatibilityUpstream, findWevuCompatibilityEntry, wevuCompatibilityCatalog } from "@weapp-vite/eslint";
|
|
2
|
+
export { type WevuCompatibilityDiagnostic, type WevuCompatibilityEntry, type WevuCompatibilityLevel, type WevuCompatibilitySurface, type WevuCompatibilityUpstream, findWevuCompatibilityEntry, wevuCompatibilityCatalog };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { d as ResolvedValue, f as Resolver } from "./index-CaXAtb9e.mjs";
|
|
2
2
|
import { t as AutoRoutes } from "./routes-C7fCmf92.mjs";
|
|
3
|
+
import { t as WeappI18nConfig } from "./types-CgZn5X6j.mjs";
|
|
3
4
|
import { MpPlatform, OutputExtensions } from "@weapp-core/shared";
|
|
4
5
|
import { WeappAstConfig } from "@weapp-vite/ast";
|
|
5
6
|
import "@weapp-vite/ast/operations/onPageScroll";
|
|
@@ -159,7 +160,7 @@ interface StyleConfigObject {
|
|
|
159
160
|
* @description 作用范围快捷配置
|
|
160
161
|
*/
|
|
161
162
|
scope?: StyleScope;
|
|
162
|
-
/** 自定义包含路径,支持传入单个 glob
|
|
163
|
+
/** 自定义包含路径,支持传入单个 glob 或数组;主包默认不包含 app,需显式匹配 `app.vue` 等应用入口 */
|
|
163
164
|
include?: string | string[];
|
|
164
165
|
/** 自定义排除路径,支持传入单个 glob 或数组 */
|
|
165
166
|
exclude?: string | string[];
|
|
@@ -804,6 +805,10 @@ interface WeappViteConfig {
|
|
|
804
805
|
* - `object`: 启用自动路由并允许细粒度控制
|
|
805
806
|
*/
|
|
806
807
|
autoRoutes?: boolean | WeappAutoRoutesConfig;
|
|
808
|
+
/**
|
|
809
|
+
* 小程序 i18n 构建与运行时配置。
|
|
810
|
+
*/
|
|
811
|
+
i18n?: WeappI18nConfig;
|
|
807
812
|
/**
|
|
808
813
|
* 插件入口目录(`plugin.json` 所在目录)。
|
|
809
814
|
*/
|
|
@@ -1586,6 +1591,11 @@ interface WxmlToken {
|
|
|
1586
1591
|
removalRanges: RemovalRange[];
|
|
1587
1592
|
commentTokens: Token[];
|
|
1588
1593
|
inlineWxsTokens: Token[];
|
|
1594
|
+
scriptModules?: Array<{
|
|
1595
|
+
attrs: Record<string, string>;
|
|
1596
|
+
tagName: string;
|
|
1597
|
+
}>;
|
|
1598
|
+
templateTokens?: Token[];
|
|
1589
1599
|
wxsImportNormalizeTokens: Token[];
|
|
1590
1600
|
removeWxsLangAttrTokens: Token[];
|
|
1591
1601
|
templateImportNormalizeTokens: Token[];
|
|
@@ -1657,6 +1667,7 @@ interface RuntimeState {
|
|
|
1657
1667
|
npmBuilt: boolean;
|
|
1658
1668
|
independent: {
|
|
1659
1669
|
outputs: Map<string, RolldownOutput>;
|
|
1670
|
+
pendingOutputs: Promise<RolldownOutput>[];
|
|
1660
1671
|
};
|
|
1661
1672
|
output: {
|
|
1662
1673
|
emittedSource: Map<string, string>;
|
package/dist/config.d.mts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { $n as isWeappViteHost, Qn as createWeappViteHostMeta, 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, d as Component, er as resolveWeappViteHostMeta, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, l as defineConfig, m as Theme, n as UserConfigExport, o as UserConfigFnObject, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, u as App, v as defineSitemapJson, y as defineThemeJson } from "./config-
|
|
2
|
-
|
|
1
|
+
import { $n as isWeappViteHost, Qn as createWeappViteHostMeta, 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, d as Component, er as resolveWeappViteHostMeta, f as Page, g as defineComponentJson, h as defineAppJson, i as UserConfigFnNoEnv, l as defineConfig, m as Theme, n as UserConfigExport, o as UserConfigFnObject, p as Sitemap, r as UserConfigFn, s as UserConfigFnObjectPlain, t as UserConfig, u as App, v as defineSitemapJson, y as defineThemeJson } from "./config-6l-p3o-C.mjs";
|
|
2
|
+
import { t as WeappI18nConfig } from "./types-CgZn5X6j.mjs";
|
|
3
|
+
export { type App, type Component, type Page, type Sitemap, type Theme, UserConfig, UserConfigExport, UserConfigFn, UserConfigFnNoEnv, UserConfigFnNoEnvPlain, UserConfigFnObject, UserConfigFnObjectPlain, UserConfigFnPromise, WEAPP_VITE_HOST_NAME, type WeappI18nConfig, type WeappViteConfig, WeappViteHostMeta, type WeappViteRuntime, applyWeappViteHostMeta, createWeappViteHostMeta, defineAppJson, defineComponentJson, defineConfig, definePageJson, defineSitemapJson, defineThemeJson, isWeappViteHost, resolveWeappViteHostMeta };
|