@powerlines/plugin-i18next 0.1.134 → 0.1.136

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.
Files changed (39) hide show
  1. package/dist/i18n-C5zfq1YM.d.mts +23 -0
  2. package/dist/i18n-C5zfq1YM.d.mts.map +1 -0
  3. package/dist/i18n-CUSH-jI_.mjs +1 -0
  4. package/dist/i18n-ComTDYPk.d.cts +23 -0
  5. package/dist/i18n-ComTDYPk.d.cts.map +1 -0
  6. package/dist/i18n-Ctazdbgs.cjs +0 -0
  7. package/dist/index-CA4VvAY_.d.mts +1 -0
  8. package/dist/index-CmCelmEL.d.cts +1 -0
  9. package/dist/index.cjs +241 -13
  10. package/dist/index.d.cts +5 -4
  11. package/dist/index.d.cts.map +1 -0
  12. package/dist/index.d.mts +5 -4
  13. package/dist/index.d.mts.map +1 -0
  14. package/dist/index.mjs +208 -5
  15. package/dist/index.mjs.map +1 -0
  16. package/dist/plugin-2ZxcgDXs.d.cts +26 -0
  17. package/dist/plugin-2ZxcgDXs.d.cts.map +1 -0
  18. package/dist/plugin-B-8QVe28.cjs +0 -0
  19. package/dist/plugin-B6BWQgT4.d.mts +26 -0
  20. package/dist/plugin-B6BWQgT4.d.mts.map +1 -0
  21. package/dist/plugin-B7p8VtjC.mjs +1 -0
  22. package/dist/types/i18n.cjs +1 -0
  23. package/dist/types/i18n.d.cts +1 -21
  24. package/dist/types/i18n.d.mts +1 -21
  25. package/dist/types/i18n.mjs +2 -0
  26. package/dist/types/index.cjs +3 -0
  27. package/dist/types/index.d.cts +3 -2
  28. package/dist/types/index.d.mts +3 -2
  29. package/dist/types/index.mjs +4 -0
  30. package/dist/types/plugin.cjs +1 -0
  31. package/dist/types/plugin.d.cts +1 -24
  32. package/dist/types/plugin.d.mts +1 -24
  33. package/dist/types/plugin.mjs +2 -0
  34. package/dist/types-BReKsBV6.mjs +1 -0
  35. package/dist/types-CBTc19th.cjs +0 -0
  36. package/package.json +4 -4
  37. package/dist/_virtual/rolldown_runtime.cjs +0 -29
  38. package/dist/helpers/config-utils.cjs +0 -31
  39. package/dist/helpers/config-utils.mjs +0 -30
@@ -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-C5zfq1YM.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n-C5zfq1YM.d.mts","names":[],"sources":["../src/types/i18n.ts"],"sourcesContent":[],"mappings":";;AAqBA;AAOA;UAPiB,eAAA;0BACS;;;;;UAMT,QAAA;;;;;;;;aASJ"}
@@ -0,0 +1 @@
1
+ export { };
@@ -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-ComTDYPk.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n-ComTDYPk.d.cts","names":[],"sources":["../src/types/i18n.ts"],"sourcesContent":[],"mappings":";;AAqBA;AAOA;UAPiB,eAAA;0BACS;;;;;UAMT,QAAA;;;;;;;;aASJ"}
File without changes
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };
package/dist/index.cjs CHANGED
@@ -1,18 +1,246 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
- const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
3
- const require_config_utils = require('./helpers/config-utils.cjs');
2
+ //#region rolldown:runtime
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 ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
26
+ }) : target, mod));
27
+
28
+ //#endregion
29
+ require('./i18n-Ctazdbgs.cjs');
30
+ require('./plugin-B-8QVe28.cjs');
31
+ require('./types-CBTc19th.cjs');
4
32
  let __stryke_fs_list_files = require("@stryke/fs/list-files");
5
33
  let __stryke_path_append = require("@stryke/path/append");
6
34
  let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
7
35
  let __stryke_path_join = require("@stryke/path/join");
8
- let __stryke_type_checks_is_set = require("@stryke/type-checks/is-set");
9
- let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
10
- let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
11
36
  let defu = require("defu");
12
- defu = require_rolldown_runtime.__toESM(defu);
37
+ defu = __toESM(defu);
13
38
  let i18next_cli = require("i18next-cli");
14
39
  let i18next_resources_for_ts = require("i18next-resources-for-ts");
40
+ let __stryke_path_correct_path = require("@stryke/path/correct-path");
41
+
42
+ //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/get-object-tag.mjs
43
+ /**
44
+ * Gets the `toStringTag` of `obj`.
45
+ *
46
+ * @param value - The obj to query.
47
+ * @returns Returns the `toStringTag`.
48
+ */
49
+ const getObjectTag = (value) => {
50
+ if (value == null) return value === void 0 ? "[object Undefined]" : "[object Null]";
51
+ return Object.prototype.toString.call(value);
52
+ };
15
53
 
54
+ //#endregion
55
+ //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/is-plain-object.mjs
56
+ /**
57
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
58
+ * and has a `typeof` result of "object".
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * isObjectLike({})
63
+ * // => true
64
+ *
65
+ * isObjectLike([1, 2, 3])
66
+ * // => true
67
+ *
68
+ * isObjectLike(Function)
69
+ * // => false
70
+ *
71
+ * isObjectLike(null)
72
+ * // => false
73
+ * ```
74
+ *
75
+ * @param value - The value to check.
76
+ * @returns Returns `true` if `value` is object-like, else `false`.
77
+ */
78
+ const isObjectLike = (obj) => {
79
+ return typeof obj === "object" && obj !== null;
80
+ };
81
+ /**
82
+ * Checks if `obj` is a plain object, that is, an object created by the `Object` constructor or one with a `[[Prototype]]` of `null`.
83
+ *
84
+ * @example
85
+ * ```typescript
86
+ * function Foo() {
87
+ * this.a = 1
88
+ * }
89
+ *
90
+ * isPlainObject(new Foo)
91
+ * // => false
92
+ *
93
+ * isPlainObject([1, 2, 3])
94
+ * // => false
95
+ *
96
+ * isPlainObject({ 'x': 0, 'y': 0 })
97
+ * // => true
98
+ *
99
+ * isPlainObject(Object.create(null))
100
+ * // => true
101
+ * ```
102
+ *
103
+ * @param obj - The value to check.
104
+ * @returns Returns `true` if `obj` is a plain object, else `false`.
105
+ */
106
+ const isPlainObject = (obj) => {
107
+ if (!isObjectLike(obj) || getObjectTag(obj) !== "[object Object]") return false;
108
+ if (Object.getPrototypeOf(obj) === null) return true;
109
+ let proto = obj;
110
+ while (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto);
111
+ return Object.getPrototypeOf(obj) === proto;
112
+ };
113
+
114
+ //#endregion
115
+ //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/is-null.mjs
116
+ const isNull = (value) => {
117
+ try {
118
+ return value === null;
119
+ } catch {
120
+ return false;
121
+ }
122
+ };
123
+
124
+ //#endregion
125
+ //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/is-undefined.mjs
126
+ const isUndefined = (value) => {
127
+ return value === void 0;
128
+ };
129
+
130
+ //#endregion
131
+ //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/is-empty.mjs
132
+ /**
133
+ * Check if the provided value's type is `null` or `undefined`
134
+ *
135
+ * @param value - The value to type check
136
+ * @returns An indicator specifying if the value provided is of type `null` or `undefined`
137
+ */
138
+ const isEmpty = (value) => {
139
+ try {
140
+ return isUndefined(value) || isNull(value);
141
+ } catch {
142
+ return false;
143
+ }
144
+ };
145
+
146
+ //#endregion
147
+ //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/is-set.mjs
148
+ /**
149
+ * The inverse of the `isEmpty` function
150
+ *
151
+ * @param value - The value to type check
152
+ * @returns An indicator specifying if the value provided is **NOT** of type `null` or `undefined`
153
+ */
154
+ const isSet = (value) => {
155
+ try {
156
+ return !isEmpty(value);
157
+ } catch {
158
+ return false;
159
+ }
160
+ };
161
+
162
+ //#endregion
163
+ //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/is-object.mjs
164
+ /**
165
+ * Check if the provided value's type is `Object`
166
+ *
167
+ * @param value - The value to type check
168
+ * @returns An indicator specifying if the value provided is of type `Object`
169
+ */
170
+ const isObject = (value) => {
171
+ try {
172
+ return typeof value === "object" || Boolean(value) && value?.constructor === Object || isPlainObject(value);
173
+ } catch {
174
+ return false;
175
+ }
176
+ };
177
+
178
+ //#endregion
179
+ //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/is-non-null-object.mjs
180
+ /**
181
+ * Check if the provided value's type is `Object` and is not `null` or `undefined`
182
+ *
183
+ * @param value - The value to type check
184
+ * @returns An indicator specifying if the value provided is of type `Object` and is not `null` or `undefined`
185
+ */
186
+ const isNonNullObject = (value) => {
187
+ return isSet(value) && isObject(value);
188
+ };
189
+
190
+ //#endregion
191
+ //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/is-set-object.mjs
192
+ /**
193
+ * Check if the provided value's type is an object with some fields set
194
+ *
195
+ * @param value - The value to type check
196
+ * @returns An indicator specifying if the value provided is an object with some fields se
197
+ */
198
+ const isSetObject = (value) => {
199
+ try {
200
+ return isNonNullObject(value) && Object.keys(value).length > 0;
201
+ } catch {
202
+ return false;
203
+ }
204
+ };
205
+
206
+ //#endregion
207
+ //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/is-string.mjs
208
+ const isString = (value) => {
209
+ try {
210
+ return typeof value === "string";
211
+ } catch {
212
+ return false;
213
+ }
214
+ };
215
+
216
+ //#endregion
217
+ //#region src/helpers/config-utils.ts
218
+ /**
219
+ * Resolve an output template (string or function) into an actual path string.
220
+ *
221
+ * @remarks
222
+ * - If `outputTemplate` is a function, call it with (language, namespace)
223
+ * - If it's a string, replace placeholders:
224
+ * - \{\{language\}\} or \{\{lng\}\} -\> language
225
+ * - \{\{namespace\}\} -\> namespace (or removed if namespace is undefined)
226
+ * - Normalizes duplicate slashes and returns a platform-correct path.
227
+ */
228
+ function getOutputPath(outputTemplate, language, namespace) {
229
+ if (!outputTemplate) return (0, __stryke_path_correct_path.correctPath)(`locales/${language}/${namespace ?? "translation"}.json`);
230
+ if (typeof outputTemplate === "function") try {
231
+ return (0, __stryke_path_correct_path.correctPath)(String(outputTemplate(language, namespace)).replace(/\/{2,}/g, "/"));
232
+ } catch {
233
+ return (0, __stryke_path_correct_path.correctPath)(`locales/${language}/${namespace ?? "translation"}.json`);
234
+ }
235
+ let out = String(outputTemplate);
236
+ out = out.replace(/\{\{language\}\}|\{\{lng\}\}/g, language);
237
+ if (namespace !== void 0 && namespace !== null) out = out.replace(/\{\{namespace\}\}/g, namespace);
238
+ else out = out.replace(/\/?\{\{namespace\}\}/g, "");
239
+ out = out.replace(/\/{2,}/g, "/");
240
+ return (0, __stryke_path_correct_path.correctPath)(out);
241
+ }
242
+
243
+ //#endregion
16
244
  //#region src/index.ts
17
245
  /**
18
246
  * i18next Plugin
@@ -51,7 +279,7 @@ const plugin = (options = {}) => {
51
279
  locales: []
52
280
  });
53
281
  if (!i18next.locales || i18next.locales.length === 0) i18next.locales = [i18next.extract.primaryLanguage || "en"];
54
- if (!(0, __stryke_type_checks_is_set.isSet)(i18next.types.indentation)) i18next.types.indentation = i18next.extract.indentation;
282
+ if (!isSet(i18next.types.indentation)) i18next.types.indentation = i18next.extract.indentation;
55
283
  return { i18next };
56
284
  },
57
285
  async configResolved() {},
@@ -75,16 +303,16 @@ const plugin = (options = {}) => {
75
303
  },
76
304
  async types(code) {
77
305
  const resources = [];
78
- 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, "*"))) {
306
+ for (const file of await (0, __stryke_fs_list_files.listFiles)(getOutputPath(this.config.i18next.extract.output, this.config.i18next.extract.primaryLanguage, "*"))) {
79
307
  const namespace = (0, __stryke_path_file_path_fns.findFileName)(file, { withExtension: false });
80
308
  const parsedContent = await this.resolver.import(file);
81
- if (this.config.i18next.extract.mergeNamespaces && (0, __stryke_type_checks_is_set_object.isSetObject)(parsedContent)) {
82
- if (Object.keys(parsedContent).filter((k) => (0, __stryke_type_checks_is_set_object.isSetObject)(parsedContent[k])).length > 0) {
83
- for (const nsName of Object.keys(parsedContent).filter((k) => (0, __stryke_type_checks_is_set_object.isSetObject)(parsedContent[k]))) resources.push({
309
+ if (this.config.i18next.extract.mergeNamespaces && isSetObject(parsedContent)) {
310
+ if (Object.keys(parsedContent).filter((k) => isSetObject(parsedContent[k])).length > 0) {
311
+ for (const nsName of Object.keys(parsedContent).filter((k) => isSetObject(parsedContent[k]))) resources.push({
84
312
  name: nsName,
85
313
  resources: parsedContent[nsName]
86
314
  });
87
- if (Object.keys(parsedContent).filter((k) => !(0, __stryke_type_checks_is_set_object.isSetObject)(parsedContent[k])).length > 0) this.warn(`The file ${file} contains top-level keys that are not objects (${Object.keys(parsedContent).filter((k) => !(0, __stryke_type_checks_is_set_object.isSetObject)(parsedContent[k])).join(", ")}). When 'mergeNamespaces' is enabled, top-level keys are treated as namespaces. These keys will be ignored.`);
315
+ if (Object.keys(parsedContent).filter((k) => !isSetObject(parsedContent[k])).length > 0) this.warn(`The file ${file} contains top-level keys that are not objects (${Object.keys(parsedContent).filter((k) => !isSetObject(parsedContent[k])).join(", ")}). When 'mergeNamespaces' is enabled, top-level keys are treated as namespaces. These keys will be ignored.`);
88
316
  continue;
89
317
  }
90
318
  }
@@ -112,7 +340,7 @@ ${(0, i18next_resources_for_ts.mergeResourcesAsInterface)(resources, {
112
340
  */
113
341
  declare module 'i18next' {
114
342
  interface CustomTypeOptions {
115
- enableSelector: ${(0, __stryke_type_checks_is_string.isString)(this.config.i18next.types.enableSelector) ? `"${this.config.i18next.types.enableSelector}"` : this.config.i18next.types.enableSelector};
343
+ enableSelector: ${isString(this.config.i18next.types.enableSelector) ? `"${this.config.i18next.types.enableSelector}"` : this.config.i18next.types.enableSelector};
116
344
  defaultNS: ${this.config.i18next.extract.defaultNS === false ? "false" : `'${this.config.i18next.extract.defaultNS || "translation"}'`};
117
345
  resources: Resources;
118
346
  }
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- import { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig } from "./types/plugin.cjs";
2
- import { Resource, ResourceContent } from "./types/i18n.cjs";
3
- import "./types/index.cjs";
1
+ import { i as I18NextPluginUserConfig, n as I18NextPluginOptions, r as I18NextPluginResolvedConfig, t as I18NextPluginContext } from "./plugin-2ZxcgDXs.cjs";
2
+ import { n as ResourceContent, t as Resource } from "./i18n-ComTDYPk.cjs";
3
+ import "./index-CmCelmEL.cjs";
4
4
  import { Plugin } from "powerlines/types/plugin";
5
5
 
6
6
  //#region src/index.d.ts
@@ -18,4 +18,5 @@ import { Plugin } from "powerlines/types/plugin";
18
18
  */
19
19
  declare const plugin: <TContext extends I18NextPluginContext = I18NextPluginContext>(options?: I18NextPluginOptions) => Plugin<TContext>;
20
20
  //#endregion
21
- export { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig, Resource, ResourceContent, plugin as default, plugin };
21
+ export { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig, Resource, ResourceContent, plugin as default, plugin };
22
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAkDA;;;;;;;;cAAa,0BACM,uBAAuB,gCAE/B,yBACR,OAAO"}
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig } from "./types/plugin.mjs";
2
- import { Resource, ResourceContent } from "./types/i18n.mjs";
3
- import "./types/index.mjs";
1
+ import { i as I18NextPluginUserConfig, n as I18NextPluginOptions, r as I18NextPluginResolvedConfig, t as I18NextPluginContext } from "./plugin-B6BWQgT4.mjs";
2
+ import { n as ResourceContent, t as Resource } from "./i18n-C5zfq1YM.mjs";
3
+ import "./index-CA4VvAY_.mjs";
4
4
  import { Plugin } from "powerlines/types/plugin";
5
5
 
6
6
  //#region src/index.d.ts
@@ -18,4 +18,5 @@ import { Plugin } from "powerlines/types/plugin";
18
18
  */
19
19
  declare const plugin: <TContext extends I18NextPluginContext = I18NextPluginContext>(options?: I18NextPluginOptions) => Plugin<TContext>;
20
20
  //#endregion
21
- export { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig, Resource, ResourceContent, plugin as default, plugin };
21
+ export { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig, Resource, ResourceContent, plugin as default, plugin };
22
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAkDA;;;;;;;;cAAa,0BACM,uBAAuB,gCAE/B,yBACR,OAAO"}
package/dist/index.mjs CHANGED
@@ -1,15 +1,217 @@
1
- import { getOutputPath } from "./helpers/config-utils.mjs";
1
+ import "./i18n-CUSH-jI_.mjs";
2
+ import "./plugin-B7p8VtjC.mjs";
3
+ import "./types-BReKsBV6.mjs";
2
4
  import { listFiles } from "@stryke/fs/list-files";
3
5
  import { appendPath } from "@stryke/path/append";
4
6
  import { findFileName } from "@stryke/path/file-path-fns";
5
7
  import { joinPaths } from "@stryke/path/join";
6
- import { isSet } from "@stryke/type-checks/is-set";
7
- import { isSetObject } from "@stryke/type-checks/is-set-object";
8
- import { isString } from "@stryke/type-checks/is-string";
9
8
  import defu from "defu";
10
9
  import { runExtractor } from "i18next-cli";
11
10
  import { mergeResourcesAsInterface } from "i18next-resources-for-ts";
11
+ import { correctPath } from "@stryke/path/correct-path";
12
12
 
13
+ //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/get-object-tag.mjs
14
+ /**
15
+ * Gets the `toStringTag` of `obj`.
16
+ *
17
+ * @param value - The obj to query.
18
+ * @returns Returns the `toStringTag`.
19
+ */
20
+ const getObjectTag = (value) => {
21
+ if (value == null) return value === void 0 ? "[object Undefined]" : "[object Null]";
22
+ return Object.prototype.toString.call(value);
23
+ };
24
+
25
+ //#endregion
26
+ //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/is-plain-object.mjs
27
+ /**
28
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
29
+ * and has a `typeof` result of "object".
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * isObjectLike({})
34
+ * // => true
35
+ *
36
+ * isObjectLike([1, 2, 3])
37
+ * // => true
38
+ *
39
+ * isObjectLike(Function)
40
+ * // => false
41
+ *
42
+ * isObjectLike(null)
43
+ * // => false
44
+ * ```
45
+ *
46
+ * @param value - The value to check.
47
+ * @returns Returns `true` if `value` is object-like, else `false`.
48
+ */
49
+ const isObjectLike = (obj) => {
50
+ return typeof obj === "object" && obj !== null;
51
+ };
52
+ /**
53
+ * Checks if `obj` is a plain object, that is, an object created by the `Object` constructor or one with a `[[Prototype]]` of `null`.
54
+ *
55
+ * @example
56
+ * ```typescript
57
+ * function Foo() {
58
+ * this.a = 1
59
+ * }
60
+ *
61
+ * isPlainObject(new Foo)
62
+ * // => false
63
+ *
64
+ * isPlainObject([1, 2, 3])
65
+ * // => false
66
+ *
67
+ * isPlainObject({ 'x': 0, 'y': 0 })
68
+ * // => true
69
+ *
70
+ * isPlainObject(Object.create(null))
71
+ * // => true
72
+ * ```
73
+ *
74
+ * @param obj - The value to check.
75
+ * @returns Returns `true` if `obj` is a plain object, else `false`.
76
+ */
77
+ const isPlainObject = (obj) => {
78
+ if (!isObjectLike(obj) || getObjectTag(obj) !== "[object Object]") return false;
79
+ if (Object.getPrototypeOf(obj) === null) return true;
80
+ let proto = obj;
81
+ while (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto);
82
+ return Object.getPrototypeOf(obj) === proto;
83
+ };
84
+
85
+ //#endregion
86
+ //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/is-null.mjs
87
+ const isNull = (value) => {
88
+ try {
89
+ return value === null;
90
+ } catch {
91
+ return false;
92
+ }
93
+ };
94
+
95
+ //#endregion
96
+ //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/is-undefined.mjs
97
+ const isUndefined = (value) => {
98
+ return value === void 0;
99
+ };
100
+
101
+ //#endregion
102
+ //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/is-empty.mjs
103
+ /**
104
+ * Check if the provided value's type is `null` or `undefined`
105
+ *
106
+ * @param value - The value to type check
107
+ * @returns An indicator specifying if the value provided is of type `null` or `undefined`
108
+ */
109
+ const isEmpty = (value) => {
110
+ try {
111
+ return isUndefined(value) || isNull(value);
112
+ } catch {
113
+ return false;
114
+ }
115
+ };
116
+
117
+ //#endregion
118
+ //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/is-set.mjs
119
+ /**
120
+ * The inverse of the `isEmpty` function
121
+ *
122
+ * @param value - The value to type check
123
+ * @returns An indicator specifying if the value provided is **NOT** of type `null` or `undefined`
124
+ */
125
+ const isSet = (value) => {
126
+ try {
127
+ return !isEmpty(value);
128
+ } catch {
129
+ return false;
130
+ }
131
+ };
132
+
133
+ //#endregion
134
+ //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/is-object.mjs
135
+ /**
136
+ * Check if the provided value's type is `Object`
137
+ *
138
+ * @param value - The value to type check
139
+ * @returns An indicator specifying if the value provided is of type `Object`
140
+ */
141
+ const isObject = (value) => {
142
+ try {
143
+ return typeof value === "object" || Boolean(value) && value?.constructor === Object || isPlainObject(value);
144
+ } catch {
145
+ return false;
146
+ }
147
+ };
148
+
149
+ //#endregion
150
+ //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/is-non-null-object.mjs
151
+ /**
152
+ * Check if the provided value's type is `Object` and is not `null` or `undefined`
153
+ *
154
+ * @param value - The value to type check
155
+ * @returns An indicator specifying if the value provided is of type `Object` and is not `null` or `undefined`
156
+ */
157
+ const isNonNullObject = (value) => {
158
+ return isSet(value) && isObject(value);
159
+ };
160
+
161
+ //#endregion
162
+ //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/is-set-object.mjs
163
+ /**
164
+ * Check if the provided value's type is an object with some fields set
165
+ *
166
+ * @param value - The value to type check
167
+ * @returns An indicator specifying if the value provided is an object with some fields se
168
+ */
169
+ const isSetObject = (value) => {
170
+ try {
171
+ return isNonNullObject(value) && Object.keys(value).length > 0;
172
+ } catch {
173
+ return false;
174
+ }
175
+ };
176
+
177
+ //#endregion
178
+ //#region ../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/is-string.mjs
179
+ const isString = (value) => {
180
+ try {
181
+ return typeof value === "string";
182
+ } catch {
183
+ return false;
184
+ }
185
+ };
186
+
187
+ //#endregion
188
+ //#region src/helpers/config-utils.ts
189
+ /**
190
+ * Resolve an output template (string or function) into an actual path string.
191
+ *
192
+ * @remarks
193
+ * - If `outputTemplate` is a function, call it with (language, namespace)
194
+ * - If it's a string, replace placeholders:
195
+ * - \{\{language\}\} or \{\{lng\}\} -\> language
196
+ * - \{\{namespace\}\} -\> namespace (or removed if namespace is undefined)
197
+ * - Normalizes duplicate slashes and returns a platform-correct path.
198
+ */
199
+ function getOutputPath(outputTemplate, language, namespace) {
200
+ if (!outputTemplate) return correctPath(`locales/${language}/${namespace ?? "translation"}.json`);
201
+ if (typeof outputTemplate === "function") try {
202
+ return correctPath(String(outputTemplate(language, namespace)).replace(/\/{2,}/g, "/"));
203
+ } catch {
204
+ return correctPath(`locales/${language}/${namespace ?? "translation"}.json`);
205
+ }
206
+ let out = String(outputTemplate);
207
+ out = out.replace(/\{\{language\}\}|\{\{lng\}\}/g, language);
208
+ if (namespace !== void 0 && namespace !== null) out = out.replace(/\{\{namespace\}\}/g, namespace);
209
+ else out = out.replace(/\/?\{\{namespace\}\}/g, "");
210
+ out = out.replace(/\/{2,}/g, "/");
211
+ return correctPath(out);
212
+ }
213
+
214
+ //#endregion
13
215
  //#region src/index.ts
14
216
  /**
15
217
  * i18next Plugin
@@ -122,4 +324,5 @@ declare module 'i18next' {
122
324
  var src_default = plugin;
123
325
 
124
326
  //#endregion
125
- export { src_default as default, plugin };
327
+ export { src_default as default, plugin };
328
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["resources: Resource[]","result!: string"],"sources":["../../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/get-object-tag.mjs","../../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/is-plain-object.mjs","../../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/is-null.mjs","../../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/is-undefined.mjs","../../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/is-empty.mjs","../../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/is-set.mjs","../../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/is-object.mjs","../../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/is-non-null-object.mjs","../../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/is-set-object.mjs","../../../node_modules/.pnpm/@stryke+type-checks@0.5.22/node_modules/@stryke/type-checks/dist/is-string.mjs","../src/helpers/config-utils.ts","../src/index.ts"],"sourcesContent":["//#region src/get-object-tag.ts\n/**\n* Gets the `toStringTag` of `obj`.\n*\n* @param value - The obj to query.\n* @returns Returns the `toStringTag`.\n*/\nconst getObjectTag = (value) => {\n\tif (value == null) return value === void 0 ? \"[object Undefined]\" : \"[object Null]\";\n\treturn Object.prototype.toString.call(value);\n};\n\n//#endregion\nexport { getObjectTag };\n//# sourceMappingURL=get-object-tag.mjs.map","import { getObjectTag } from \"./get-object-tag.mjs\";\n\n//#region src/is-plain-object.ts\n/**\n* Checks if `value` is object-like. A value is object-like if it's not `null`\n* and has a `typeof` result of \"object\".\n*\n* @example\n* ```typescript\n* isObjectLike({})\n* // => true\n*\n* isObjectLike([1, 2, 3])\n* // => true\n*\n* isObjectLike(Function)\n* // => false\n*\n* isObjectLike(null)\n* // => false\n* ```\n*\n* @param value - The value to check.\n* @returns Returns `true` if `value` is object-like, else `false`.\n*/\nconst isObjectLike = (obj) => {\n\treturn typeof obj === \"object\" && obj !== null;\n};\n/**\n* Checks if `obj` is a plain object, that is, an object created by the `Object` constructor or one with a `[[Prototype]]` of `null`.\n*\n* @example\n* ```typescript\n* function Foo() {\n* this.a = 1\n* }\n*\n* isPlainObject(new Foo)\n* // => false\n*\n* isPlainObject([1, 2, 3])\n* // => false\n*\n* isPlainObject({ 'x': 0, 'y': 0 })\n* // => true\n*\n* isPlainObject(Object.create(null))\n* // => true\n* ```\n*\n* @param obj - The value to check.\n* @returns Returns `true` if `obj` is a plain object, else `false`.\n*/\nconst isPlainObject = (obj) => {\n\tif (!isObjectLike(obj) || getObjectTag(obj) !== \"[object Object]\") return false;\n\tif (Object.getPrototypeOf(obj) === null) return true;\n\tlet proto = obj;\n\twhile (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto);\n\treturn Object.getPrototypeOf(obj) === proto;\n};\n\n//#endregion\nexport { isObjectLike, isPlainObject };\n//# sourceMappingURL=is-plain-object.mjs.map","//#region src/is-null.ts\nconst isNull = (value) => {\n\ttry {\n\t\treturn value === null;\n\t} catch {\n\t\treturn false;\n\t}\n};\n\n//#endregion\nexport { isNull };\n//# sourceMappingURL=is-null.mjs.map","//#region src/is-undefined.ts\nconst isUndefined = (value) => {\n\treturn value === void 0;\n};\n\n//#endregion\nexport { isUndefined };\n//# sourceMappingURL=is-undefined.mjs.map","import { isDate } from \"./is-date.mjs\";\nimport { isFunction } from \"./is-function.mjs\";\nimport { isNull } from \"./is-null.mjs\";\nimport { isNumber } from \"./is-number.mjs\";\nimport { isSymbol } from \"./is-symbol.mjs\";\nimport { isUndefined } from \"./is-undefined.mjs\";\n\n//#region src/is-empty.ts\n/**\n* Check if the provided value's type is `null` or `undefined`\n*\n* @param value - The value to type check\n* @returns An indicator specifying if the value provided is of type `null` or `undefined`\n*/\nconst isEmpty = (value) => {\n\ttry {\n\t\treturn isUndefined(value) || isNull(value);\n\t} catch {\n\t\treturn false;\n\t}\n};\nconst isEmptyAnything = (value) => {\n\tif (value === true || value === false) return true;\n\tif (value === null || value === void 0) return true;\n\tif (isNumber(value)) return value === 0;\n\tif (isDate(value)) return Number.isNaN(value.getTime());\n\tif (isFunction(value)) return false;\n\tif (isSymbol(value)) return false;\n\tconst { length } = value;\n\tif (isNumber(length)) return length === 0;\n\tconst { size } = value;\n\tif (isNumber(size)) return size === 0;\n\treturn Object.keys(value).length === 0;\n};\n\n//#endregion\nexport { isEmpty, isEmptyAnything };\n//# sourceMappingURL=is-empty.mjs.map","import { isEmpty } from \"./is-empty.mjs\";\n\n//#region src/is-set.ts\n/**\n* The inverse of the `isEmpty` function\n*\n* @param value - The value to type check\n* @returns An indicator specifying if the value provided is **NOT** of type `null` or `undefined`\n*/\nconst isSet = (value) => {\n\ttry {\n\t\treturn !isEmpty(value);\n\t} catch {\n\t\treturn false;\n\t}\n};\n\n//#endregion\nexport { isSet };\n//# sourceMappingURL=is-set.mjs.map","import { isPlainObject } from \"./is-plain-object.mjs\";\n\n//#region src/is-object.ts\nconst isClassRegex = /^class\\s|^function\\s+[A-Z]/;\nconst isConventionalClassRegex = /^function\\s+[A-Z]/;\nconst isNativeClassRegex = /^class\\s/;\n/** Is ES6+ class */\nfunction isNativeClass(value) {\n\treturn typeof value === \"function\" && isNativeClassRegex.test(value.toString());\n}\n/**\n* Check if the provided value's type is a conventional class\n*\n* @remarks\n* Is Conventional Class\n* Looks for function with capital first letter MyClass\n* First letter is the 9th character\n* If changed, isClass must also be updated\n*\n* @param value - The value to type check\n* @returns An indicator specifying if the value provided is a conventional class\n*/\nfunction isConventionalClass(value) {\n\treturn typeof value === \"function\" && isConventionalClassRegex.test(value.toString());\n}\nfunction isClass(value) {\n\treturn typeof value === \"function\" && isClassRegex.test(value.toString());\n}\n/**\n* Check if the provided value's type is `Object`\n*\n* @param value - The value to type check\n* @returns An indicator specifying if the value provided is of type `Object`\n*/\nconst isObject = (value) => {\n\ttry {\n\t\treturn typeof value === \"object\" || Boolean(value) && value?.constructor === Object || isPlainObject(value);\n\t} catch {\n\t\treturn false;\n\t}\n};\n\n//#endregion\nexport { isClass, isConventionalClass, isNativeClass, isObject };\n//# sourceMappingURL=is-object.mjs.map","import { isObject } from \"./is-object.mjs\";\nimport { isSet } from \"./is-set.mjs\";\n\n//#region src/is-non-null-object.ts\n/**\n* Check if the provided value's type is `Object` and is not `null` or `undefined`\n*\n* @param value - The value to type check\n* @returns An indicator specifying if the value provided is of type `Object` and is not `null` or `undefined`\n*/\nconst isNonNullObject = (value) => {\n\treturn isSet(value) && isObject(value);\n};\n\n//#endregion\nexport { isNonNullObject };\n//# sourceMappingURL=is-non-null-object.mjs.map","import { isNonNullObject } from \"./is-non-null-object.mjs\";\n\n//#region src/is-set-object.ts\n/**\n* Check if the provided value's type is an object with some fields set\n*\n* @param value - The value to type check\n* @returns An indicator specifying if the value provided is an object with some fields se\n*/\nconst isSetObject = (value) => {\n\ttry {\n\t\treturn isNonNullObject(value) && Object.keys(value).length > 0;\n\t} catch {\n\t\treturn false;\n\t}\n};\n\n//#endregion\nexport { isSetObject };\n//# sourceMappingURL=is-set-object.mjs.map","//#region src/is-string.ts\nconst isString = (value) => {\n\ttry {\n\t\treturn typeof value === \"string\";\n\t} catch {\n\t\treturn false;\n\t}\n};\n\n//#endregion\nexport { isString };\n//# sourceMappingURL=is-string.mjs.map","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { correctPath } from \"@stryke/path/correct-path\";\n\n/**\n * Resolve an output template (string or function) into an actual path string.\n *\n * @remarks\n * - If `outputTemplate` is a function, call it with (language, namespace)\n * - If it's a string, replace placeholders:\n * - \\{\\{language\\}\\} or \\{\\{lng\\}\\} -\\> language\n * - \\{\\{namespace\\}\\} -\\> namespace (or removed if namespace is undefined)\n * - Normalizes duplicate slashes and returns a platform-correct path.\n */\nexport function getOutputPath(\n outputTemplate:\n | string\n | ((language: string, namespace?: string) => string)\n | undefined,\n language: string,\n namespace?: string\n): string {\n if (!outputTemplate) {\n // Fallback to a sensible default\n return correctPath(\n `locales/${language}/${namespace ?? \"translation\"}.json`\n );\n }\n\n if (typeof outputTemplate === \"function\") {\n try {\n const result = String(outputTemplate(language, namespace));\n\n return correctPath(result.replace(/\\/{2,}/g, \"/\"));\n } catch {\n // If user function throws, fallback to default path\n return correctPath(\n `locales/${language}/${namespace ?? \"translation\"}.json`\n );\n }\n }\n\n // It's a string template\n let out = String(outputTemplate);\n out = out.replace(/\\{\\{language\\}\\}|\\{\\{lng\\}\\}/g, language);\n\n if (namespace !== undefined && namespace !== null) {\n out = out.replace(/\\{\\{namespace\\}\\}/g, namespace);\n } else {\n // remove any occurrences of /{{namespace}} or {{namespace}} (keeping surrounding slashes tidy)\n out = out.replace(/\\/?\\{\\{namespace\\}\\}/g, \"\");\n }\n\n // collapse duplicate slashes and normalize to platform-specific separators\n out = out.replace(/\\/{2,}/g, \"/\");\n return correctPath(out);\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { listFiles } from \"@stryke/fs/list-files\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { findFileName } from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport defu from \"defu\";\nimport { I18nextToolkitConfig, runExtractor } from \"i18next-cli\";\nimport { mergeResourcesAsInterface } from \"i18next-resources-for-ts\";\nimport { Plugin } from \"powerlines/types/plugin\";\nimport { getOutputPath } from \"./helpers/config-utils\";\nimport { Resource, ResourceContent } from \"./types/i18n\";\nimport {\n I18NextPluginContext,\n I18NextPluginOptions,\n I18NextPluginResolvedConfig\n} from \"./types/plugin\";\n\nexport * from \"./types\";\n\n/**\n * i18next Plugin\n *\n * @remarks\n * A Powerlines plugin to use the i18next internationalization framework during the prepare task.\n *\n * @see https://i18next.com\n *\n * @param options - The plugin options.\n * @returns A Powerlines plugin instance.\n */\nexport const plugin = <\n TContext extends I18NextPluginContext = I18NextPluginContext\n>(\n options: I18NextPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"i18next\",\n async config() {\n const i18next = defu<\n I18NextPluginResolvedConfig[\"i18next\"],\n I18NextPluginOptions[]\n >(\n options,\n {\n extract: {\n output: (language: string, namespace = \"translation\") =>\n joinPaths(\n this.config.projectRoot,\n `locales/${language}/${namespace}.json`\n ),\n primaryLanguage: this.workspaceConfig.locale\n }\n },\n {\n extract: {\n input: [\n \"src/**/*.ts\",\n \"src/**/*.tsx\",\n \"src/**/*.js\",\n \"src/**/*.jsx\"\n ],\n indentation: 2,\n defaultNS: \"translation\",\n mergeNamespaces: true,\n nsSeparator: \":\",\n keySeparator: \".\",\n primaryLanguage:\n options.locales && options.locales.length > 0\n ? options.locales[0]\n : \"en\"\n },\n types: {\n enableSelector: false\n },\n locales: [] as string[]\n }\n );\n\n if (!i18next.locales || i18next.locales.length === 0) {\n i18next.locales = [i18next.extract.primaryLanguage || \"en\"];\n }\n\n if (!isSet(i18next.types.indentation)) {\n i18next.types.indentation = i18next.extract.indentation;\n }\n\n return {\n i18next\n };\n },\n async configResolved() {},\n async prepare() {\n await runExtractor(\n this.config.i18next as I18nextToolkitConfig,\n {\n isWatchMode: false,\n isDryRun: false,\n syncAll: true,\n syncPrimaryWithDefaults: true\n },\n {\n info: (message: string) => {\n this.info(message);\n },\n warn: (message: string, _more?: any) => {\n this.warn(message);\n },\n error: (message: string | any) => {\n this.error(message);\n }\n }\n );\n },\n async types(code: string) {\n const resources: Resource[] = [];\n for (const file of await listFiles(\n getOutputPath(\n this.config.i18next.extract.output,\n this.config.i18next.extract.primaryLanguage,\n \"*\"\n )\n )) {\n const namespace = findFileName(file, { withExtension: false });\n const parsedContent = await this.resolver.import<ResourceContent>(file);\n\n // If mergeNamespaces is used, a single file can contain multiple namespaces\n // (e.g. { \"translation\": { ... }, \"common\": { ... } } in a per-language file).\n // In that case, expose each top-level key as a namespace entry so the type\n // generator will produce top-level namespace interfaces (not a language wrapper).\n if (\n this.config.i18next.extract.mergeNamespaces &&\n isSetObject(parsedContent)\n ) {\n // If we have at least one object and we are in mergeNamespaces mode, assume it's a merged file\n if (\n Object.keys(parsedContent).filter(k =>\n isSetObject(parsedContent[k])\n ).length > 0\n ) {\n for (const nsName of Object.keys(parsedContent).filter(k =>\n isSetObject(parsedContent[k])\n )) {\n resources.push({\n name: nsName,\n resources: parsedContent[nsName] as ResourceContent\n });\n }\n\n if (\n Object.keys(parsedContent).filter(\n k => !isSetObject(parsedContent[k])\n ).length > 0\n ) {\n this.warn(\n `The file ${file} contains top-level keys that are not objects (${Object.keys(\n parsedContent\n )\n .filter(k => !isSetObject(parsedContent[k]))\n .join(\n \", \"\n )}). When 'mergeNamespaces' is enabled, top-level keys are treated as namespaces. These keys will be ignored.`\n );\n }\n\n continue;\n }\n }\n\n resources.push({ name: namespace, resources: parsedContent });\n }\n\n let result!: string;\n if (this.config.i18next.types.resourcesFile) {\n await this.fs.write(\n appendPath(\n this.config.i18next.types.resourcesFile,\n this.config.i18next.types.output || this.config.projectRoot\n ),\n mergeResourcesAsInterface(resources, {\n optimize: !!this.config.i18next.types.enableSelector,\n indentation: this.config.i18next.types.indentation\n })\n );\n } else {\n result = `${code}\n\n${mergeResourcesAsInterface(resources, {\n optimize: !!this.config.i18next.types.enableSelector,\n indentation: this.config.i18next.types.indentation\n})}\n\n/**\n * i18next Custom Type Options\n *\n * @see https://www.i18next.com/overview/typescript#custom-type-options\n */\ndeclare module 'i18next' {\n interface CustomTypeOptions {\n enableSelector: ${isString(this.config.i18next.types.enableSelector) ? `\"${this.config.i18next.types.enableSelector}\"` : this.config.i18next.types.enableSelector};\n defaultNS: ${\n this.config.i18next.extract.defaultNS === false\n ? \"false\"\n : `'${this.config.i18next.extract.defaultNS || \"translation\"}'`\n };\n resources: Resources;\n }\n}\n`;\n }\n\n return result;\n }\n };\n};\n\nexport default plugin;\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9],"mappings":"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"}
@@ -0,0 +1,26 @@
1
+ import { DeepPartial } from "@stryke/types/base";
2
+ import { I18nextToolkitConfig } from "i18next-cli";
3
+ import { UserConfig } from "powerlines/types/config";
4
+ import { PluginContext } from "powerlines/types/context";
5
+ import { ResolvedConfig } from "powerlines/types/resolved";
6
+
7
+ //#region src/types/plugin.d.ts
8
+ type I18NextPluginOptions = DeepPartial<I18nextToolkitConfig>;
9
+ type I18NextPluginUserConfig = UserConfig & {
10
+ i18next?: I18NextPluginOptions;
11
+ };
12
+ type I18NextPluginResolvedConfig = ResolvedConfig & {
13
+ i18next: Omit<I18nextToolkitConfig, "extract" | "types"> & {
14
+ extract: Omit<I18nextToolkitConfig["extract"], "output" | "primaryLanguage" | "indentation"> & Required<Pick<I18nextToolkitConfig["extract"], "output" | "primaryLanguage" | "indentation">>;
15
+ types: Omit<NonNullable<I18nextToolkitConfig["types"]>, "input" | "output" | "enableSelector" | "indentation"> & {
16
+ input?: string;
17
+ output?: string;
18
+ enableSelector: boolean | "optimize";
19
+ indentation: number | string;
20
+ };
21
+ };
22
+ };
23
+ type I18NextPluginContext<TResolvedConfig extends I18NextPluginResolvedConfig = I18NextPluginResolvedConfig> = PluginContext<TResolvedConfig>;
24
+ //#endregion
25
+ export { I18NextPluginUserConfig as i, I18NextPluginOptions as n, I18NextPluginResolvedConfig as r, I18NextPluginContext as t };
26
+ //# sourceMappingURL=plugin-2ZxcgDXs.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-2ZxcgDXs.d.cts","names":[],"sources":["../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;;KA0BY,oBAAA,GAAuB,YAAY;KAEnC,uBAAA,GAA0B;EAF1B,OAAA,CAAA,EAGA,oBAHoB;AAEhC,CAAA;AAIY,KAAA,2BAAA,GAA8B,cAAH,GAAA;EAAG,OAAA,EAC/B,IAD+B,CAC1B,oBAD0B,EAAA,SAAA,GAAA,OAAA,CAAA,GAAA;IAC1B,OAAA,EACH,IADG,CAEV,oBAFU,CAAA,SAAA,CAAA,EAAA,QAAA,GAAA,iBAAA,GAAA,aAAA,CAAA,GAKV,QALU,CAMR,IANQ,CAON,oBAPM,CAAA,SAAA,CAAA,EAAA,QAAA,GAAA,iBAAA,GAAA,aAAA,CAAA,CAAA;IAAL,KAAA,EAWA,IAXA,CAYL,WAZK,CAYO,oBAZP,CAAA,OAAA,CAAA,CAAA,EAAA,OAAA,GAAA,QAAA,GAAA,gBAAA,GAAA,aAAA,CAAA,GAAA;MAEL,KAAA,CAAA,EAAA,MAAA;MADO,MAAA,CAAA,EAAA,MAAA;MAMH,cAAA,EAAA,OAAA,GAAA,UAAA;MADF,WAAA,EAAA,MAAA,GAAA,MAAA;IADF,CAAA;EAOY,CAAA;CAAZ;AADK,KAYC,oBAZD,CAAA,wBAae,2BAbf,GAcP,2BAdO,CAAA,GAeP,aAfO,CAeO,eAfP,CAAA"}
File without changes
@@ -0,0 +1,26 @@
1
+ import { I18nextToolkitConfig } from "i18next-cli";
2
+ import { DeepPartial } from "@stryke/types/base";
3
+ import { UserConfig } from "powerlines/types/config";
4
+ import { PluginContext } from "powerlines/types/context";
5
+ import { ResolvedConfig } from "powerlines/types/resolved";
6
+
7
+ //#region src/types/plugin.d.ts
8
+ type I18NextPluginOptions = DeepPartial<I18nextToolkitConfig>;
9
+ type I18NextPluginUserConfig = UserConfig & {
10
+ i18next?: I18NextPluginOptions;
11
+ };
12
+ type I18NextPluginResolvedConfig = ResolvedConfig & {
13
+ i18next: Omit<I18nextToolkitConfig, "extract" | "types"> & {
14
+ extract: Omit<I18nextToolkitConfig["extract"], "output" | "primaryLanguage" | "indentation"> & Required<Pick<I18nextToolkitConfig["extract"], "output" | "primaryLanguage" | "indentation">>;
15
+ types: Omit<NonNullable<I18nextToolkitConfig["types"]>, "input" | "output" | "enableSelector" | "indentation"> & {
16
+ input?: string;
17
+ output?: string;
18
+ enableSelector: boolean | "optimize";
19
+ indentation: number | string;
20
+ };
21
+ };
22
+ };
23
+ type I18NextPluginContext<TResolvedConfig extends I18NextPluginResolvedConfig = I18NextPluginResolvedConfig> = PluginContext<TResolvedConfig>;
24
+ //#endregion
25
+ export { I18NextPluginUserConfig as i, I18NextPluginOptions as n, I18NextPluginResolvedConfig as r, I18NextPluginContext as t };
26
+ //# sourceMappingURL=plugin-B6BWQgT4.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-B6BWQgT4.d.mts","names":[],"sources":["../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;;KA0BY,oBAAA,GAAuB,YAAY;KAEnC,uBAAA,GAA0B;EAF1B,OAAA,CAAA,EAGA,oBAHoB;AAEhC,CAAA;AAIY,KAAA,2BAAA,GAA8B,cAAH,GAAA;EAAG,OAAA,EAC/B,IAD+B,CAC1B,oBAD0B,EAAA,SAAA,GAAA,OAAA,CAAA,GAAA;IAC1B,OAAA,EACH,IADG,CAEV,oBAFU,CAAA,SAAA,CAAA,EAAA,QAAA,GAAA,iBAAA,GAAA,aAAA,CAAA,GAKV,QALU,CAMR,IANQ,CAON,oBAPM,CAAA,SAAA,CAAA,EAAA,QAAA,GAAA,iBAAA,GAAA,aAAA,CAAA,CAAA;IAAL,KAAA,EAWA,IAXA,CAYL,WAZK,CAYO,oBAZP,CAAA,OAAA,CAAA,CAAA,EAAA,OAAA,GAAA,QAAA,GAAA,gBAAA,GAAA,aAAA,CAAA,GAAA;MAEL,KAAA,CAAA,EAAA,MAAA;MADO,MAAA,CAAA,EAAA,MAAA;MAMH,cAAA,EAAA,OAAA,GAAA,UAAA;MADF,WAAA,EAAA,MAAA,GAAA,MAAA;IADF,CAAA;EAOY,CAAA;CAAZ;AADK,KAYC,oBAZD,CAAA,wBAae,2BAbf,GAcP,2BAdO,CAAA,GAeP,aAfO,CAeO,eAfP,CAAA"}
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ require('../i18n-Ctazdbgs.cjs');
@@ -1,22 +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
1
+ import { n as ResourceContent, t as Resource } from "../i18n-ComTDYPk.cjs";
22
2
  export { Resource, ResourceContent };
@@ -1,22 +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
1
+ import { n as ResourceContent, t as Resource } from "../i18n-C5zfq1YM.mjs";
22
2
  export { Resource, ResourceContent };
@@ -1 +1,3 @@
1
+ import "../i18n-CUSH-jI_.mjs";
2
+
1
3
  export { };
@@ -0,0 +1,3 @@
1
+ require('../i18n-Ctazdbgs.cjs');
2
+ require('../plugin-B-8QVe28.cjs');
3
+ require('../types-CBTc19th.cjs');
@@ -1,3 +1,4 @@
1
- import { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig } from "./plugin.cjs";
2
- import { Resource, ResourceContent } from "./i18n.cjs";
1
+ import { i as I18NextPluginUserConfig, n as I18NextPluginOptions, r as I18NextPluginResolvedConfig, t as I18NextPluginContext } from "../plugin-2ZxcgDXs.cjs";
2
+ import { n as ResourceContent, t as Resource } from "../i18n-ComTDYPk.cjs";
3
+ import "../index-CmCelmEL.cjs";
3
4
  export { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig, Resource, ResourceContent };
@@ -1,3 +1,4 @@
1
- import { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig } from "./plugin.mjs";
2
- import { Resource, ResourceContent } from "./i18n.mjs";
1
+ import { i as I18NextPluginUserConfig, n as I18NextPluginOptions, r as I18NextPluginResolvedConfig, t as I18NextPluginContext } from "../plugin-B6BWQgT4.mjs";
2
+ import { n as ResourceContent, t as Resource } from "../i18n-C5zfq1YM.mjs";
3
+ import "../index-CA4VvAY_.mjs";
3
4
  export { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig, Resource, ResourceContent };
@@ -1 +1,5 @@
1
+ import "../i18n-CUSH-jI_.mjs";
2
+ import "../plugin-B7p8VtjC.mjs";
3
+ import "../types-BReKsBV6.mjs";
4
+
1
5
  export { };
@@ -0,0 +1 @@
1
+ require('../plugin-B-8QVe28.cjs');
@@ -1,25 +1,2 @@
1
- import { DeepPartial } from "@stryke/types/base";
2
- import { I18nextToolkitConfig } from "i18next-cli";
3
- import { UserConfig } from "powerlines/types/config";
4
- import { PluginContext } from "powerlines/types/context";
5
- import { ResolvedConfig } from "powerlines/types/resolved";
6
-
7
- //#region src/types/plugin.d.ts
8
- type I18NextPluginOptions = DeepPartial<I18nextToolkitConfig>;
9
- type I18NextPluginUserConfig = UserConfig & {
10
- i18next?: I18NextPluginOptions;
11
- };
12
- type I18NextPluginResolvedConfig = ResolvedConfig & {
13
- i18next: Omit<I18nextToolkitConfig, "extract" | "types"> & {
14
- extract: Omit<I18nextToolkitConfig["extract"], "output" | "primaryLanguage" | "indentation"> & Required<Pick<I18nextToolkitConfig["extract"], "output" | "primaryLanguage" | "indentation">>;
15
- types: Omit<NonNullable<I18nextToolkitConfig["types"]>, "input" | "output" | "enableSelector" | "indentation"> & {
16
- input?: string;
17
- output?: string;
18
- enableSelector: boolean | "optimize";
19
- indentation: number | string;
20
- };
21
- };
22
- };
23
- type I18NextPluginContext<TResolvedConfig extends I18NextPluginResolvedConfig = I18NextPluginResolvedConfig> = PluginContext<TResolvedConfig>;
24
- //#endregion
1
+ import { i as I18NextPluginUserConfig, n as I18NextPluginOptions, r as I18NextPluginResolvedConfig, t as I18NextPluginContext } from "../plugin-2ZxcgDXs.cjs";
25
2
  export { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig };
@@ -1,25 +1,2 @@
1
- import { I18nextToolkitConfig } from "i18next-cli";
2
- import { DeepPartial } from "@stryke/types/base";
3
- import { UserConfig } from "powerlines/types/config";
4
- import { PluginContext } from "powerlines/types/context";
5
- import { ResolvedConfig } from "powerlines/types/resolved";
6
-
7
- //#region src/types/plugin.d.ts
8
- type I18NextPluginOptions = DeepPartial<I18nextToolkitConfig>;
9
- type I18NextPluginUserConfig = UserConfig & {
10
- i18next?: I18NextPluginOptions;
11
- };
12
- type I18NextPluginResolvedConfig = ResolvedConfig & {
13
- i18next: Omit<I18nextToolkitConfig, "extract" | "types"> & {
14
- extract: Omit<I18nextToolkitConfig["extract"], "output" | "primaryLanguage" | "indentation"> & Required<Pick<I18nextToolkitConfig["extract"], "output" | "primaryLanguage" | "indentation">>;
15
- types: Omit<NonNullable<I18nextToolkitConfig["types"]>, "input" | "output" | "enableSelector" | "indentation"> & {
16
- input?: string;
17
- output?: string;
18
- enableSelector: boolean | "optimize";
19
- indentation: number | string;
20
- };
21
- };
22
- };
23
- type I18NextPluginContext<TResolvedConfig extends I18NextPluginResolvedConfig = I18NextPluginResolvedConfig> = PluginContext<TResolvedConfig>;
24
- //#endregion
1
+ import { i as I18NextPluginUserConfig, n as I18NextPluginOptions, r as I18NextPluginResolvedConfig, t as I18NextPluginContext } from "../plugin-B6BWQgT4.mjs";
25
2
  export { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig };
@@ -1 +1,3 @@
1
+ import "../plugin-B7p8VtjC.mjs";
2
+
1
3
  export { };
@@ -0,0 +1 @@
1
+ export { };
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-i18next",
3
- "version": "0.1.134",
3
+ "version": "0.1.136",
4
4
  "type": "module",
5
5
  "description": "A Powerlines plugin to use i18next for internationalization.",
6
6
  "repository": {
@@ -109,13 +109,13 @@
109
109
  "defu": "^6.1.4",
110
110
  "i18next-cli": "^1.38.2",
111
111
  "i18next-resources-for-ts": "^2.0.0",
112
- "powerlines": "^0.38.4"
112
+ "powerlines": "^0.38.6"
113
113
  },
114
114
  "devDependencies": {
115
- "@powerlines/plugin-plugin": "^0.12.188",
115
+ "@powerlines/plugin-plugin": "^0.12.190",
116
116
  "@types/node": "^24.10.9"
117
117
  },
118
118
  "publishConfig": { "access": "public" },
119
119
  "types": "./dist/index.d.cts",
120
- "gitHead": "6b0e05037adb26af85fec6f2aa30bcd3b1db4fe1"
120
+ "gitHead": "f90d675c44d4323d447a46c8a4c833420543cc0a"
121
121
  }
@@ -1,29 +0,0 @@
1
- //#region rolldown:runtime
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 ? __defProp(target, "default", {
23
- value: mod,
24
- enumerable: true
25
- }) : target, mod));
26
-
27
- //#endregion
28
-
29
- exports.__toESM = __toESM;
@@ -1,31 +0,0 @@
1
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
- let __stryke_path_correct_path = require("@stryke/path/correct-path");
3
-
4
- //#region src/helpers/config-utils.ts
5
- /**
6
- * Resolve an output template (string or function) into an actual path string.
7
- *
8
- * @remarks
9
- * - If `outputTemplate` is a function, call it with (language, namespace)
10
- * - If it's a string, replace placeholders:
11
- * - \{\{language\}\} or \{\{lng\}\} -\> language
12
- * - \{\{namespace\}\} -\> namespace (or removed if namespace is undefined)
13
- * - Normalizes duplicate slashes and returns a platform-correct path.
14
- */
15
- function getOutputPath(outputTemplate, language, namespace) {
16
- if (!outputTemplate) return (0, __stryke_path_correct_path.correctPath)(`locales/${language}/${namespace ?? "translation"}.json`);
17
- if (typeof outputTemplate === "function") try {
18
- return (0, __stryke_path_correct_path.correctPath)(String(outputTemplate(language, namespace)).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,30 +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
- return correctPath(String(outputTemplate(language, namespace)).replace(/\/{2,}/g, "/"));
18
- } catch {
19
- return correctPath(`locales/${language}/${namespace ?? "translation"}.json`);
20
- }
21
- let out = String(outputTemplate);
22
- out = out.replace(/\{\{language\}\}|\{\{lng\}\}/g, language);
23
- if (namespace !== void 0 && namespace !== null) out = out.replace(/\{\{namespace\}\}/g, namespace);
24
- else out = out.replace(/\/?\{\{namespace\}\}/g, "");
25
- out = out.replace(/\/{2,}/g, "/");
26
- return correctPath(out);
27
- }
28
-
29
- //#endregion
30
- export { getOutputPath };