@powerlines/plugin-i18next 0.1.566 → 0.1.568

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.
@@ -0,0 +1,23 @@
1
+ //#region src/types/i18n.d.ts
2
+ /**
3
+ * Represents a translation resource with its namespace name and content
4
+ */
5
+ interface ResourceContent {
6
+ [key: string]: string | ResourceContent;
7
+ }
8
+ /**
9
+ * Represents a translation resource with its namespace name and content
10
+ */
11
+ interface Resource {
12
+ /**
13
+ * The namespace name (filename without extension)
14
+ */
15
+ name: string;
16
+ /**
17
+ * The parsed JSON resources object
18
+ */
19
+ resources: ResourceContent;
20
+ }
21
+ //#endregion
22
+ export { ResourceContent as n, Resource as t };
23
+ //# sourceMappingURL=i18n-bWSQ51xe.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n-bWSQ51xe.d.cts","names":[],"sources":["../src/types/i18n.ts"],"mappings":";;;;UAqBiB;GACd,uBAAuB;;;;;UAMT;;;;EAIf;;;;EAKA,WAAW"}
@@ -0,0 +1,23 @@
1
+ //#region src/types/i18n.d.ts
2
+ /**
3
+ * Represents a translation resource with its namespace name and content
4
+ */
5
+ interface ResourceContent {
6
+ [key: string]: string | ResourceContent;
7
+ }
8
+ /**
9
+ * Represents a translation resource with its namespace name and content
10
+ */
11
+ interface Resource {
12
+ /**
13
+ * The namespace name (filename without extension)
14
+ */
15
+ name: string;
16
+ /**
17
+ * The parsed JSON resources object
18
+ */
19
+ resources: ResourceContent;
20
+ }
21
+ //#endregion
22
+ export { ResourceContent as n, Resource as t };
23
+ //# sourceMappingURL=i18n-bWSQ51xe.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n-bWSQ51xe.d.mts","names":[],"sources":["../src/types/i18n.ts"],"mappings":""}
package/dist/index.cjs CHANGED
@@ -1,6 +1,32 @@
1
1
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
- const require_config_utils = require('./helpers/config-utils.cjs');
2
+ //#region \0rolldown/runtime.js
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
+ key = keys[i];
13
+ if (!__hasOwnProp.call(to, key) && key !== except) {
14
+ __defProp(to, key, {
15
+ get: ((k) => from[k]).bind(null, key),
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ }
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
26
+ }) : target, mod));
27
+
28
+ //#endregion
29
+ require('./types/index.cjs');
4
30
  let _stryke_fs_list_files = require("@stryke/fs/list-files");
5
31
  let _stryke_path_append = require("@stryke/path/append");
6
32
  let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
@@ -9,10 +35,39 @@ let _stryke_type_checks_is_set = require("@stryke/type-checks/is-set");
9
35
  let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
10
36
  let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
11
37
  let defu = require("defu");
12
- defu = require_runtime.__toESM(defu, 1);
38
+ defu = __toESM(defu, 1);
13
39
  let i18next_cli = require("i18next-cli");
14
40
  let i18next_resources_for_ts = require("i18next-resources-for-ts");
41
+ let _stryke_path_correct_path = require("@stryke/path/correct-path");
15
42
 
43
+ //#region src/helpers/config-utils.ts
44
+ /**
45
+ * Resolve an output template (string or function) into an actual path string.
46
+ *
47
+ * @remarks
48
+ * - If `outputTemplate` is a function, call it with (language, namespace)
49
+ * - If it's a string, replace placeholders:
50
+ * - \{\{language\}\} or \{\{lng\}\} -\> language
51
+ * - \{\{namespace\}\} -\> namespace (or removed if namespace is undefined)
52
+ * - Normalizes duplicate slashes and returns a platform-correct path.
53
+ */
54
+ function getOutputPath(outputTemplate, language, namespace) {
55
+ if (!outputTemplate) return (0, _stryke_path_correct_path.correctPath)(`locales/${language}/${namespace ?? "translation"}.json`);
56
+ if (typeof outputTemplate === "function") try {
57
+ const result = String(outputTemplate(language, namespace));
58
+ return (0, _stryke_path_correct_path.correctPath)(result.replace(/\/{2,}/g, "/"));
59
+ } catch {
60
+ return (0, _stryke_path_correct_path.correctPath)(`locales/${language}/${namespace ?? "translation"}.json`);
61
+ }
62
+ let out = String(outputTemplate);
63
+ out = out.replace(/\{\{language\}\}|\{\{lng\}\}/g, language);
64
+ if (namespace !== void 0 && namespace !== null) out = out.replace(/\{\{namespace\}\}/g, namespace);
65
+ else out = out.replace(/\/?\{\{namespace\}\}/g, "");
66
+ out = out.replace(/\/{2,}/g, "/");
67
+ return (0, _stryke_path_correct_path.correctPath)(out);
68
+ }
69
+
70
+ //#endregion
16
71
  //#region src/index.ts
17
72
  /**
18
73
  * i18next Plugin
@@ -83,7 +138,7 @@ const plugin = (options = {}) => {
83
138
  },
84
139
  async types(code) {
85
140
  const resources = [];
86
- for (const file of await (0, _stryke_fs_list_files.listFiles)(require_config_utils.getOutputPath(this.config.i18next.extract.output, this.config.i18next.extract.primaryLanguage, "*"))) {
141
+ for (const file of await (0, _stryke_fs_list_files.listFiles)(getOutputPath(this.config.i18next.extract.output, this.config.i18next.extract.primaryLanguage, "*"))) {
87
142
  const namespace = (0, _stryke_path_file_path_fns.findFileName)(file, { withExtension: false });
88
143
  const parsedContent = await this.resolver.import(file);
89
144
  if (this.config.i18next.extract.mergeNamespaces && (0, _stryke_type_checks_is_set_object.isSetObject)(parsedContent)) {
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig } from "./types/plugin.cjs";
2
- import { Resource, ResourceContent } from "./types/i18n.cjs";
2
+ import { n as ResourceContent, t as Resource } from "./i18n-bWSQ51xe.cjs";
3
3
  import "./types/index.cjs";
4
4
  import { Plugin } from "powerlines";
5
5
  //#region src/index.d.ts
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig } from "./types/plugin.mjs";
2
- import { Resource, ResourceContent } from "./types/i18n.mjs";
2
+ import { n as ResourceContent, t as Resource } from "./i18n-bWSQ51xe.mjs";
3
3
  import "./types/index.mjs";
4
4
  import { Plugin } from "powerlines";
5
5
  //#region src/index.d.ts
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { getOutputPath } from "./helpers/config-utils.mjs";
1
+ import "./types/index.mjs";
2
2
  import { listFiles } from "@stryke/fs/list-files";
3
3
  import { appendPath } from "@stryke/path/append";
4
4
  import { findFileName } from "@stryke/path/file-path-fns";
@@ -9,7 +9,36 @@ import { isString } from "@stryke/type-checks/is-string";
9
9
  import defu from "defu";
10
10
  import { runExtractor } from "i18next-cli";
11
11
  import { mergeResourcesAsInterface } from "i18next-resources-for-ts";
12
+ import { correctPath } from "@stryke/path/correct-path";
12
13
 
14
+ //#region src/helpers/config-utils.ts
15
+ /**
16
+ * Resolve an output template (string or function) into an actual path string.
17
+ *
18
+ * @remarks
19
+ * - If `outputTemplate` is a function, call it with (language, namespace)
20
+ * - If it's a string, replace placeholders:
21
+ * - \{\{language\}\} or \{\{lng\}\} -\> language
22
+ * - \{\{namespace\}\} -\> namespace (or removed if namespace is undefined)
23
+ * - Normalizes duplicate slashes and returns a platform-correct path.
24
+ */
25
+ function getOutputPath(outputTemplate, language, namespace) {
26
+ if (!outputTemplate) return correctPath(`locales/${language}/${namespace ?? "translation"}.json`);
27
+ if (typeof outputTemplate === "function") try {
28
+ const result = String(outputTemplate(language, namespace));
29
+ return correctPath(result.replace(/\/{2,}/g, "/"));
30
+ } catch {
31
+ return correctPath(`locales/${language}/${namespace ?? "translation"}.json`);
32
+ }
33
+ let out = String(outputTemplate);
34
+ out = out.replace(/\{\{language\}\}|\{\{lng\}\}/g, language);
35
+ if (namespace !== void 0 && namespace !== null) out = out.replace(/\{\{namespace\}\}/g, namespace);
36
+ else out = out.replace(/\/?\{\{namespace\}\}/g, "");
37
+ out = out.replace(/\/{2,}/g, "/");
38
+ return correctPath(out);
39
+ }
40
+
41
+ //#endregion
13
42
  //#region src/index.ts
14
43
  /**
15
44
  * i18next Plugin
@@ -1,23 +1,2 @@
1
- //#region src/types/i18n.d.ts
2
- /**
3
- * Represents a translation resource with its namespace name and content
4
- */
5
- interface ResourceContent {
6
- [key: string]: string | ResourceContent;
7
- }
8
- /**
9
- * Represents a translation resource with its namespace name and content
10
- */
11
- interface Resource {
12
- /**
13
- * The namespace name (filename without extension)
14
- */
15
- name: string;
16
- /**
17
- * The parsed JSON resources object
18
- */
19
- resources: ResourceContent;
20
- }
21
- //#endregion
22
- export { Resource, ResourceContent };
23
- //# sourceMappingURL=i18n.d.cts.map
1
+ import { n as ResourceContent, t as Resource } from "../i18n-bWSQ51xe.cjs";
2
+ export { Resource, ResourceContent };
@@ -1,23 +1,2 @@
1
- //#region src/types/i18n.d.ts
2
- /**
3
- * Represents a translation resource with its namespace name and content
4
- */
5
- interface ResourceContent {
6
- [key: string]: string | ResourceContent;
7
- }
8
- /**
9
- * Represents a translation resource with its namespace name and content
10
- */
11
- interface Resource {
12
- /**
13
- * The namespace name (filename without extension)
14
- */
15
- name: string;
16
- /**
17
- * The parsed JSON resources object
18
- */
19
- resources: ResourceContent;
20
- }
21
- //#endregion
22
- export { Resource, ResourceContent };
23
- //# sourceMappingURL=i18n.d.mts.map
1
+ import { n as ResourceContent, t as Resource } from "../i18n-bWSQ51xe.mjs";
2
+ export { Resource, ResourceContent };
@@ -1,3 +1,3 @@
1
1
  import { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig } from "./plugin.cjs";
2
- import { Resource, ResourceContent } from "./i18n.cjs";
2
+ import { n as ResourceContent, t as Resource } from "../i18n-bWSQ51xe.cjs";
3
3
  export { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig, Resource, ResourceContent };
@@ -1,3 +1,3 @@
1
1
  import { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig } from "./plugin.mjs";
2
- import { Resource, ResourceContent } from "./i18n.mjs";
2
+ import { n as ResourceContent, t as Resource } from "../i18n-bWSQ51xe.mjs";
3
3
  export { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig, Resource, ResourceContent };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-i18next",
3
- "version": "0.1.566",
3
+ "version": "0.1.568",
4
4
  "private": false,
5
5
  "description": "A Powerlines plugin to use i18next for internationalization.",
6
6
  "keywords": ["i18next", "powerlines", "storm-software", "powerlines-plugin"],
@@ -111,12 +111,12 @@
111
111
  "defu": "^6.1.7",
112
112
  "i18next-cli": "^1.67.9",
113
113
  "i18next-resources-for-ts": "^2.1.0",
114
- "powerlines": "^0.47.208"
114
+ "powerlines": "^0.47.209"
115
115
  },
116
116
  "devDependencies": {
117
- "@powerlines/plugin-plugin": "^0.12.620",
117
+ "@powerlines/plugin-plugin": "^0.12.622",
118
118
  "@types/node": "^25.9.5"
119
119
  },
120
120
  "publishConfig": { "access": "public" },
121
- "gitHead": "7f9a0df69c7021d02c29a0d0c0626465686566fa"
121
+ "gitHead": "88974b224a5cdb97dbd377373c9ed7f8a8780324"
122
122
  }
@@ -1,28 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
- key = keys[i];
12
- if (!__hasOwnProp.call(to, key) && key !== except) {
13
- __defProp(to, key, {
14
- get: ((k) => from[k]).bind(null, key),
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- }
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
23
- value: mod,
24
- enumerable: true
25
- }) : target, mod));
26
-
27
- //#endregion
28
- exports.__toESM = __toESM;
@@ -1,31 +0,0 @@
1
- let _stryke_path_correct_path = require("@stryke/path/correct-path");
2
-
3
- //#region src/helpers/config-utils.ts
4
- /**
5
- * Resolve an output template (string or function) into an actual path string.
6
- *
7
- * @remarks
8
- * - If `outputTemplate` is a function, call it with (language, namespace)
9
- * - If it's a string, replace placeholders:
10
- * - \{\{language\}\} or \{\{lng\}\} -\> language
11
- * - \{\{namespace\}\} -\> namespace (or removed if namespace is undefined)
12
- * - Normalizes duplicate slashes and returns a platform-correct path.
13
- */
14
- function getOutputPath(outputTemplate, language, namespace) {
15
- if (!outputTemplate) return (0, _stryke_path_correct_path.correctPath)(`locales/${language}/${namespace ?? "translation"}.json`);
16
- if (typeof outputTemplate === "function") try {
17
- const result = String(outputTemplate(language, namespace));
18
- return (0, _stryke_path_correct_path.correctPath)(result.replace(/\/{2,}/g, "/"));
19
- } catch {
20
- return (0, _stryke_path_correct_path.correctPath)(`locales/${language}/${namespace ?? "translation"}.json`);
21
- }
22
- let out = String(outputTemplate);
23
- out = out.replace(/\{\{language\}\}|\{\{lng\}\}/g, language);
24
- if (namespace !== void 0 && namespace !== null) out = out.replace(/\{\{namespace\}\}/g, namespace);
25
- else out = out.replace(/\/?\{\{namespace\}\}/g, "");
26
- out = out.replace(/\/{2,}/g, "/");
27
- return (0, _stryke_path_correct_path.correctPath)(out);
28
- }
29
-
30
- //#endregion
31
- exports.getOutputPath = getOutputPath;
@@ -1,32 +0,0 @@
1
- import { correctPath } from "@stryke/path/correct-path";
2
-
3
- //#region src/helpers/config-utils.ts
4
- /**
5
- * Resolve an output template (string or function) into an actual path string.
6
- *
7
- * @remarks
8
- * - If `outputTemplate` is a function, call it with (language, namespace)
9
- * - If it's a string, replace placeholders:
10
- * - \{\{language\}\} or \{\{lng\}\} -\> language
11
- * - \{\{namespace\}\} -\> namespace (or removed if namespace is undefined)
12
- * - Normalizes duplicate slashes and returns a platform-correct path.
13
- */
14
- function getOutputPath(outputTemplate, language, namespace) {
15
- if (!outputTemplate) return correctPath(`locales/${language}/${namespace ?? "translation"}.json`);
16
- if (typeof outputTemplate === "function") try {
17
- const result = String(outputTemplate(language, namespace));
18
- return correctPath(result.replace(/\/{2,}/g, "/"));
19
- } catch {
20
- return correctPath(`locales/${language}/${namespace ?? "translation"}.json`);
21
- }
22
- let out = String(outputTemplate);
23
- out = out.replace(/\{\{language\}\}|\{\{lng\}\}/g, language);
24
- if (namespace !== void 0 && namespace !== null) out = out.replace(/\{\{namespace\}\}/g, namespace);
25
- else out = out.replace(/\/?\{\{namespace\}\}/g, "");
26
- out = out.replace(/\/{2,}/g, "/");
27
- return correctPath(out);
28
- }
29
-
30
- //#endregion
31
- export { getOutputPath };
32
- //# sourceMappingURL=config-utils.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-utils.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"i18n.d.cts","names":[],"sources":["../../src/types/i18n.ts"],"mappings":";;;;UAqBiB;GACd,uBAAuB;;;;;UAMT;;;;EAIf;;;;EAKA,WAAW"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"i18n.d.mts","names":[],"sources":["../../src/types/i18n.ts"],"mappings":""}