intor-translator 1.2.1 → 1.2.2

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 CHANGED
@@ -38,6 +38,12 @@ yarn add intor-translator
38
38
  pnpm add intor-translator
39
39
  ```
40
40
 
41
+ Or load it directly from a CDN:
42
+
43
+ ```js
44
+ import { Translator } from "https://cdn.jsdelivr.net/npm/intor-translator/+esm";
45
+ ```
46
+
41
47
  ## Quick Start
42
48
 
43
49
  ```typescript
package/dist/index.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  var rura = require('rura');
4
4
 
5
- // src/pipeline/hooks/find-message.ts
5
+ // src/translators/core-translator/core-translator.ts
6
6
 
7
7
  // src/translators/shared/utils/find-message-in-locales.ts
8
8
  var findMessageInLocales = ({
@@ -275,6 +275,12 @@ var CoreTranslator = class extends BaseTranslator {
275
275
  }
276
276
  this.sortHooks();
277
277
  }
278
+ /** Outputs a debug overview of the active pipeline. */
279
+ debugHooks() {
280
+ return rura.rura.createPipeline(this.hooks).debugHooks(
281
+ (hooks) => `\u{1F916} Intor Translator pipeline (${hooks.length} hooks)`
282
+ );
283
+ }
278
284
  /** Check if a key exists in the specified locale or current locale. */
279
285
  hasKey = (key, targetLocale) => {
280
286
  return hasKey({
package/dist/index.d.cts CHANGED
@@ -410,6 +410,8 @@ declare class CoreTranslator<M extends LocaleMessages, L extends keyof M | "unio
410
410
  private sortHooks;
411
411
  /** Register a plugin or a raw pipeline hook. */
412
412
  use(plugin: TranslatorPlugin | TranslateHook): void;
413
+ /** Outputs a debug overview of the active pipeline. */
414
+ debugHooks(): void;
413
415
  /** Check if a key exists in the specified locale or current locale. */
414
416
  hasKey: <K extends LocalizedLeafKeys<M, L>>(key: K, targetLocale?: Locale<M>) => boolean;
415
417
  /** Get the translated message for a key, with optional replacements. */
package/dist/index.d.ts CHANGED
@@ -410,6 +410,8 @@ declare class CoreTranslator<M extends LocaleMessages, L extends keyof M | "unio
410
410
  private sortHooks;
411
411
  /** Register a plugin or a raw pipeline hook. */
412
412
  use(plugin: TranslatorPlugin | TranslateHook): void;
413
+ /** Outputs a debug overview of the active pipeline. */
414
+ debugHooks(): void;
413
415
  /** Check if a key exists in the specified locale or current locale. */
414
416
  hasKey: <K extends LocalizedLeafKeys<M, L>>(key: K, targetLocale?: Locale<M>) => boolean;
415
417
  /** Get the translated message for a key, with optional replacements. */
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { rura } from 'rura';
2
2
 
3
- // src/pipeline/hooks/find-message.ts
3
+ // src/translators/core-translator/core-translator.ts
4
4
 
5
5
  // src/translators/shared/utils/find-message-in-locales.ts
6
6
  var findMessageInLocales = ({
@@ -273,6 +273,12 @@ var CoreTranslator = class extends BaseTranslator {
273
273
  }
274
274
  this.sortHooks();
275
275
  }
276
+ /** Outputs a debug overview of the active pipeline. */
277
+ debugHooks() {
278
+ return rura.createPipeline(this.hooks).debugHooks(
279
+ (hooks) => `\u{1F916} Intor Translator pipeline (${hooks.length} hooks)`
280
+ );
281
+ }
276
282
  /** Check if a key exists in the specified locale or current locale. */
277
283
  hasKey = (key, targetLocale) => {
278
284
  return hasKey({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intor-translator",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "🤖 A modern, type-safe i18n engine.",
5
5
  "author": "Yiming Liao",
6
6
  "license": "MIT",
@@ -55,24 +55,24 @@
55
55
  "rura": "1.0.7"
56
56
  },
57
57
  "devDependencies": {
58
- "@types/node": "^24.10.1",
59
- "@vitest/coverage-v8": "4.0.15",
60
- "eslint": "^9.39.1",
61
- "eslint-config-prettier": "^10.1.8",
62
- "eslint-import-resolver-typescript": "^4.4.4",
63
- "eslint-plugin-import": "^2.32.0",
64
- "eslint-plugin-prettier": "^5.5.4",
65
- "eslint-plugin-unicorn": "^62.0.0",
66
- "eslint-plugin-unused-imports": "^4.3.0",
67
- "intl-messageformat": "^10.7.16",
68
- "knip": "^5.69.1",
69
- "prettier": "^3.6.2",
70
- "ts-node": "^10.9.2",
71
- "tsd": "^0.33.0",
72
- "tsup": "^8.4.0",
73
- "typescript": "^5.8.3",
74
- "typescript-eslint": "^8.46.4",
75
- "vite": "^7.2.6",
76
- "vitest": "^4.0.9"
58
+ "@types/node": "24.10.1",
59
+ "@vitest/coverage-v8": "4.0.16",
60
+ "eslint": "9.39.1",
61
+ "eslint-config-prettier": "10.1.8",
62
+ "eslint-import-resolver-typescript": "4.4.4",
63
+ "eslint-plugin-import": "2.32.0",
64
+ "eslint-plugin-prettier": "5.5.4",
65
+ "eslint-plugin-unicorn": "62.0.0",
66
+ "eslint-plugin-unused-imports": "4.3.0",
67
+ "intl-messageformat": "10.7.16",
68
+ "knip": "5.69.1",
69
+ "prettier": "3.6.2",
70
+ "ts-node": "10.9.2",
71
+ "tsd": "0.33.0",
72
+ "tsup": "8.4.0",
73
+ "typescript": "5.8.3",
74
+ "typescript-eslint": "8.46.4",
75
+ "vite": "7.2.6",
76
+ "vitest": "4.0.16"
77
77
  }
78
78
  }