@weapp-vite/i18n 0.2.8 → 0.2.10
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/dist/cjs/compiler2.cjs +1 -0
- package/dist/cli.mjs +0 -0
- package/dist/{compiler2.mjs → compiler-CgvzedKT.mjs} +1 -0
- package/dist/compiler.d.mts +1 -1
- package/dist/compiler.mjs +1 -1
- package/dist/config-types.d.mts +2 -0
- package/dist/config-types.mjs +1 -0
- package/dist/{types.d.mts → configTypes-CwpxEiy4.d.mts} +2 -12
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -2
- package/dist/miniprogram/index.js +1 -0
- package/dist/runtime-B_Jl9Usn.d.mts +17 -0
- package/dist/runtime.d.mts +3 -5
- package/dist/runtime.mjs +1 -1
- package/package.json +16 -5
package/dist/cjs/compiler2.cjs
CHANGED
package/dist/cli.mjs
CHANGED
|
File without changes
|
package/dist/compiler.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as I18nCompiledMessages, c as I18nLocaleFileInput, f as I18nMessages, i as I18nCompileOptions, m as I18nPlaceholderToken, n as CompileNativeI18nResult, r as I18nCatalog, t as CompileNativeI18nOptions, u as I18nMessageToken } from "./configTypes-CwpxEiy4.mjs";
|
|
2
2
|
//#region src/compiler.d.ts
|
|
3
3
|
export declare function compileI18nMessage(message: string): I18nMessageToken[];
|
|
4
4
|
export declare function compileI18nMessages(messages: I18nMessages): I18nCompiledMessages;
|
package/dist/compiler.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as generateI18nRuntimeSource, i as generateI18nCatalogModuleSource, n as compileI18nMessage, o as generateI18nWxsSource, r as compileI18nMessages, t as compileI18nCatalog } from "./
|
|
1
|
+
import { a as generateI18nRuntimeSource, i as generateI18nCatalogModuleSource, n as compileI18nMessage, o as generateI18nWxsSource, r as compileI18nMessages, t as compileI18nCatalog } from "./compiler-CgvzedKT.mjs";
|
|
2
2
|
import { promises } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
//#region src/native.ts
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as I18nCompiledMessages, c as I18nLocaleFileInput, d as I18nMessageValue, f as I18nMessages, i as I18nCompileOptions, l as I18nLocaleMessages, m as I18nPlaceholderToken, n as CompileNativeI18nResult, o as I18nGlobal, p as I18nOptions, r as I18nCatalog, s as I18nLocaleChangeSubscription, t as CompileNativeI18nOptions, u as I18nMessageToken } from "./configTypes-CwpxEiy4.mjs";
|
|
2
|
+
export { CompileNativeI18nOptions, CompileNativeI18nResult, I18nCatalog, I18nCompileOptions, I18nCompiledMessages, I18nGlobal, I18nLocaleChangeSubscription, I18nLocaleFileInput, I18nLocaleMessages, I18nMessageToken, I18nMessageValue, I18nMessages, I18nOptions, I18nPlaceholderToken };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region src/
|
|
1
|
+
//#region src/configTypes.d.ts
|
|
2
2
|
interface I18nPlaceholderToken {
|
|
3
3
|
key: string;
|
|
4
4
|
source: string;
|
|
@@ -33,7 +33,6 @@ interface I18nCompileOptions {
|
|
|
33
33
|
interface I18nLocaleChangeSubscription {
|
|
34
34
|
off: () => void;
|
|
35
35
|
}
|
|
36
|
-
type I18nBehavior = WechatMiniprogram.Behavior.Identifier<WechatMiniprogram.IAnyObject, WechatMiniprogram.IAnyObject, WechatMiniprogram.IAnyObject, []>;
|
|
37
36
|
interface I18nGlobal {
|
|
38
37
|
t: (key: string, params?: Record<string, unknown>) => string;
|
|
39
38
|
locale: string;
|
|
@@ -41,15 +40,6 @@ interface I18nGlobal {
|
|
|
41
40
|
readonly availableLocales: readonly string[];
|
|
42
41
|
onLocaleChange: (handler: (locale: string) => void) => I18nLocaleChangeSubscription;
|
|
43
42
|
}
|
|
44
|
-
interface I18nHost {
|
|
45
|
-
Behavior: typeof Behavior;
|
|
46
|
-
Page: typeof Page;
|
|
47
|
-
}
|
|
48
|
-
interface I18nInstance {
|
|
49
|
-
global: I18nGlobal;
|
|
50
|
-
behavior: I18nBehavior;
|
|
51
|
-
page: typeof Page;
|
|
52
|
-
}
|
|
53
43
|
interface CompileNativeI18nOptions extends I18nCompileOptions {
|
|
54
44
|
outDir?: string;
|
|
55
45
|
srcRoot: string;
|
|
@@ -61,4 +51,4 @@ interface CompileNativeI18nResult {
|
|
|
61
51
|
wxsFile: string;
|
|
62
52
|
}
|
|
63
53
|
//#endregion
|
|
64
|
-
export {
|
|
54
|
+
export { I18nCompiledMessages as a, I18nLocaleFileInput as c, I18nMessageValue as d, I18nMessages as f, I18nCompileOptions as i, I18nLocaleMessages as l, I18nPlaceholderToken as m, CompileNativeI18nResult as n, I18nGlobal as o, I18nOptions as p, I18nCatalog as r, I18nLocaleChangeSubscription as s, CompileNativeI18nOptions as t, I18nMessageToken as u };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createI18n } from "./runtime.mjs";
|
|
1
|
+
import { a as I18nCompiledMessages, d as I18nMessageValue, f as I18nMessages, l as I18nLocaleMessages, m as I18nPlaceholderToken, o as I18nGlobal, p as I18nOptions, r as I18nCatalog, s as I18nLocaleChangeSubscription, u as I18nMessageToken } from "./configTypes-CwpxEiy4.mjs";
|
|
2
|
+
import { i as I18nInstance, n as I18nBehavior, r as I18nHost, t as createI18n } from "./runtime-B_Jl9Usn.mjs";
|
|
3
3
|
export { type I18nBehavior, type I18nCatalog, type I18nCompiledMessages, type I18nGlobal, type I18nHost, type I18nInstance, type I18nLocaleChangeSubscription, type I18nLocaleMessages, type I18nMessageToken, type I18nMessageValue, type I18nMessages, type I18nOptions, type I18nPlaceholderToken, createI18n };
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { createI18n };
|
|
1
|
+
export { createI18n } from "./runtime.mjs";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { o as I18nGlobal, p as I18nOptions, r as I18nCatalog } from "./configTypes-CwpxEiy4.mjs";
|
|
2
|
+
//#region src/types.d.ts
|
|
3
|
+
type I18nBehavior = WechatMiniprogram.Behavior.Identifier<WechatMiniprogram.IAnyObject, WechatMiniprogram.IAnyObject, WechatMiniprogram.IAnyObject, []>;
|
|
4
|
+
interface I18nHost {
|
|
5
|
+
Behavior: typeof Behavior;
|
|
6
|
+
Page: typeof Page;
|
|
7
|
+
}
|
|
8
|
+
interface I18nInstance {
|
|
9
|
+
global: I18nGlobal;
|
|
10
|
+
behavior: I18nBehavior;
|
|
11
|
+
page: typeof Page;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/runtime.d.ts
|
|
15
|
+
declare function createI18n(options: I18nOptions | I18nCatalog, host?: Partial<I18nHost>): I18nInstance;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { I18nInstance as i, I18nBehavior as n, I18nHost as r, createI18n as t };
|
package/dist/runtime.d.mts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
//#endregion
|
|
5
|
-
export type { I18nBehavior, I18nCatalog, I18nGlobal, I18nHost, I18nInstance, I18nLocaleChangeSubscription, I18nOptions };
|
|
1
|
+
import { o as I18nGlobal, p as I18nOptions, r as I18nCatalog, s as I18nLocaleChangeSubscription } from "./configTypes-CwpxEiy4.mjs";
|
|
2
|
+
import { i as I18nInstance, n as I18nBehavior, r as I18nHost, t as createI18n } from "./runtime-B_Jl9Usn.mjs";
|
|
3
|
+
export { type I18nBehavior, type I18nCatalog, type I18nGlobal, type I18nHost, type I18nInstance, type I18nLocaleChangeSubscription, type I18nOptions, createI18n };
|
package/dist/runtime.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as compileI18nMessages, s as WEAPP_I18N_LOCALE_DATA_KEY } from "./
|
|
1
|
+
import { r as compileI18nMessages, s as WEAPP_I18N_LOCALE_DATA_KEY } from "./compiler-CgvzedKT.mjs";
|
|
2
2
|
//#region src/runtime.ts
|
|
3
3
|
function hasOwn(object, key) {
|
|
4
4
|
return object != null && Object.prototype.hasOwnProperty.call(object, key);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-vite/i18n",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.10",
|
|
5
5
|
"description": "First-party i18n runtime and compiler for native WeChat mini programs",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"homepage": "https://github.com/weapp-vite/weapp-vite#readme",
|
|
@@ -41,7 +41,10 @@
|
|
|
41
41
|
"import": "./dist/compiler.mjs",
|
|
42
42
|
"require": "./dist/cjs/compiler.cjs"
|
|
43
43
|
},
|
|
44
|
-
"./package.json": "./package.json"
|
|
44
|
+
"./package.json": "./package.json",
|
|
45
|
+
"./types": {
|
|
46
|
+
"types": "./dist/config-types.d.mts"
|
|
47
|
+
}
|
|
45
48
|
},
|
|
46
49
|
"main": "./dist/cjs/index.cjs",
|
|
47
50
|
"module": "./dist/index.mjs",
|
|
@@ -71,19 +74,27 @@
|
|
|
71
74
|
}
|
|
72
75
|
},
|
|
73
76
|
"dependencies": {
|
|
74
|
-
"@weapp-core/constants": "0.
|
|
77
|
+
"@weapp-core/constants": "0.4.0"
|
|
75
78
|
},
|
|
76
79
|
"devDependencies": {
|
|
77
80
|
"miniprogram-api-typings": "^5.2.3"
|
|
78
81
|
},
|
|
82
|
+
"tsd": {
|
|
83
|
+
"compilerOptions": {
|
|
84
|
+
"module": "NodeNext",
|
|
85
|
+
"moduleResolution": "NodeNext"
|
|
86
|
+
}
|
|
87
|
+
},
|
|
79
88
|
"scripts": {
|
|
80
89
|
"pretest": "pnpm build",
|
|
81
90
|
"dev": "tsdown -w --sourcemap",
|
|
82
91
|
"build": "tsdown",
|
|
83
92
|
"test": "vitest run",
|
|
84
|
-
"test:types": "pnpm build &&
|
|
93
|
+
"test:types": "pnpm build && pnpm run test:types:check",
|
|
94
|
+
"test:types:check": "tsd --files \"test-d/**/*.test-d.ts\" && pnpm run test:types:pure",
|
|
85
95
|
"typecheck": "tsc --noEmit",
|
|
86
96
|
"lint": "eslint .",
|
|
87
|
-
"lint:fix": "eslint . --fix"
|
|
97
|
+
"lint:fix": "eslint . --fix",
|
|
98
|
+
"test:types:pure": "cd test-d-pure && tsd --files \"**/*.test-d.ts\""
|
|
88
99
|
}
|
|
89
100
|
}
|