@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.
@@ -1,3 +1,4 @@
1
+ //#region ../../@weapp-core/constants/dist/index.js
1
2
  const WEAPP_I18N_RUNTIME_MARKER = "__WEAPP_VITE_I18N__";
2
3
  const WEAPP_I18N_LOCALE_DATA_KEY = "__wv_i18n_locale";
3
4
  //#endregion
package/dist/cli.mjs CHANGED
File without changes
@@ -1,3 +1,4 @@
1
+ //#region ../../@weapp-core/constants/dist/index.js
1
2
  const WEAPP_I18N_RUNTIME_MARKER = "__WEAPP_VITE_I18N__";
2
3
  const WEAPP_I18N_LOCALE_DATA_KEY = "__wv_i18n_locale";
3
4
  //#endregion
@@ -1,4 +1,4 @@
1
- import { _ as I18nPlaceholderToken, a as I18nCompileOptions, d as I18nLocaleFileInput, h as I18nMessages, i as I18nCatalog, n as CompileNativeI18nResult, o as I18nCompiledMessages, p as I18nMessageToken, t as CompileNativeI18nOptions } from "./types.mjs";
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 "./compiler2.mjs";
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/types.d.ts
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 { I18nPlaceholderToken as _, I18nCompileOptions as a, I18nHost as c, I18nLocaleFileInput as d, I18nLocaleMessages as f, I18nOptions as g, I18nMessages as h, I18nCatalog as i, I18nInstance as l, I18nMessageValue as m, CompileNativeI18nResult as n, I18nCompiledMessages as o, I18nMessageToken as p, I18nBehavior as r, I18nGlobal as s, CompileNativeI18nOptions as t, I18nLocaleChangeSubscription as u };
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 { _ as I18nPlaceholderToken, c as I18nHost, f as I18nLocaleMessages, g as I18nOptions, h as I18nMessages, i as I18nCatalog, l as I18nInstance, m as I18nMessageValue, o as I18nCompiledMessages, p as I18nMessageToken, r as I18nBehavior, s as I18nGlobal, u as I18nLocaleChangeSubscription } from "./types.mjs";
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
- import { createI18n } from "./runtime.mjs";
2
- export { createI18n };
1
+ export { createI18n } from "./runtime.mjs";
@@ -1,4 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region ../../@weapp-core/constants/dist/index.js
2
3
  const WEAPP_I18N_LOCALE_DATA_KEY = "__wv_i18n_locale";
3
4
  //#endregion
4
5
  //#region src/compiler.ts
@@ -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 };
@@ -1,5 +1,3 @@
1
- import { c as I18nHost, g as I18nOptions, i as I18nCatalog, l as I18nInstance, r as I18nBehavior, s as I18nGlobal, u as I18nLocaleChangeSubscription } from "./types.mjs";
2
- //#region src/runtime.d.ts
3
- export declare function createI18n(options: I18nOptions | I18nCatalog, host?: Partial<I18nHost>): I18nInstance;
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 "./compiler2.mjs";
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.8",
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.3.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 && tsd",
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
  }