@powerlines/plugin-i18next 0.1.328 → 0.1.329

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-i18next",
3
- "version": "0.1.328",
3
+ "version": "0.1.329",
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.56.7",
113
113
  "i18next-resources-for-ts": "^2.1.0",
114
- "powerlines": "^0.43.27"
114
+ "powerlines": "^0.43.28"
115
115
  },
116
116
  "devDependencies": {
117
- "@powerlines/plugin-plugin": "^0.12.382",
117
+ "@powerlines/plugin-plugin": "^0.12.383",
118
118
  "@types/node": "^25.6.0"
119
119
  },
120
120
  "publishConfig": { "access": "public" },
121
- "gitHead": "ad851a239011b884c15b0444db518d74927fd13f"
121
+ "gitHead": "efeaec793549f37c700f2e876bf6097c37375c46"
122
122
  }
@@ -1 +0,0 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__toESM=s;
@@ -1 +0,0 @@
1
- require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`@stryke/path/correct-path`);function t(t,n,r){if(!t)return(0,e.correctPath)(`locales/${n}/${r??`translation`}.json`);if(typeof t==`function`)try{return(0,e.correctPath)(String(t(n,r)).replace(/\/{2,}/g,`/`))}catch{return(0,e.correctPath)(`locales/${n}/${r??`translation`}.json`)}let i=String(t);return i=i.replace(/\{\{language\}\}|\{\{lng\}\}/g,n),i=r==null?i.replace(/\/?\{\{namespace\}\}/g,``):i.replace(/\{\{namespace\}\}/g,r),i=i.replace(/\/{2,}/g,`/`),(0,e.correctPath)(i)}exports.getOutputPath=t;
@@ -1,2 +0,0 @@
1
- import{correctPath as e}from"@stryke/path/correct-path";function t(t,n,r){if(!t)return e(`locales/${n}/${r??`translation`}.json`);if(typeof t==`function`)try{return e(String(t(n,r)).replace(/\/{2,}/g,`/`))}catch{return e(`locales/${n}/${r??`translation`}.json`)}let i=String(t);return i=i.replace(/\{\{language\}\}|\{\{lng\}\}/g,n),i=r==null?i.replace(/\/?\{\{namespace\}\}/g,``):i.replace(/\{\{namespace\}\}/g,r),i=i.replace(/\/{2,}/g,`/`),e(i)}export{t as getOutputPath};
2
- //# sourceMappingURL=config-utils.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-utils.mjs","names":[],"sources":["../../src/helpers/config-utils.ts"],"sourcesContent":["/* -------------------------------------------------------------------\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"],"mappings":"wDA8BA,SAAgB,EACd,EAIA,EACA,EACQ,CACR,GAAI,CAAC,EAEH,OAAO,EACL,WAAW,EAAS,GAAG,GAAa,cAAc,OACnD,CAGH,GAAI,OAAO,GAAmB,WAC5B,GAAI,CAGF,OAAO,EAFQ,OAAO,EAAe,EAAU,EAAU,CAEhC,CAAC,QAAQ,UAAW,IAAI,CAAC,MAC5C,CAEN,OAAO,EACL,WAAW,EAAS,GAAG,GAAa,cAAc,OACnD,CAKL,IAAI,EAAM,OAAO,EAAe,CAYhC,MAXA,GAAM,EAAI,QAAQ,gCAAiC,EAAS,CAE5D,AACE,EADE,GAAyC,KAIrC,EAAI,QAAQ,wBAAyB,GAAG,CAHxC,EAAI,QAAQ,qBAAsB,EAAU,CAOpD,EAAM,EAAI,QAAQ,UAAW,IAAI,CAC1B,EAAY,EAAI"}
package/dist/index.cjs DELETED
@@ -1,17 +0,0 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./_virtual/_rolldown/runtime.cjs`),t=require(`./helpers/config-utils.cjs`);let n=require(`@stryke/fs/list-files`),r=require(`@stryke/path/append`),i=require(`@stryke/path/file-path-fns`),a=require(`@stryke/path/join`),o=require(`@stryke/type-checks/is-set`),s=require(`@stryke/type-checks/is-set-object`),c=require(`@stryke/type-checks/is-string`),l=require(`defu`);l=e.__toESM(l,1);let u=require(`i18next-cli`),d=require(`i18next-resources-for-ts`);const f=(e={})=>({name:`i18next`,async config(){let t=(0,l.default)(e,{extract:{output:(e,t=`translation`)=>(0,a.joinPaths)(this.config.root,`locales/${e}/${t}.json`)}},{extract:{input:[`src/**/*.ts`,`src/**/*.tsx`,`src/**/*.js`,`src/**/*.jsx`],indentation:2,defaultNS:`translation`,mergeNamespaces:!0,nsSeparator:`:`,keySeparator:`.`,primaryLanguage:e.locales&&e.locales.length>0?e.locales[0]:`en`},types:{enableSelector:!1},locales:[]});return(!t.locales||t.locales.length===0)&&(t.locales=[t.extract.primaryLanguage||`en`]),(0,o.isSet)(t.types.indentation)||(t.types.indentation=t.extract.indentation),{i18next:t}},async configResolved(){},async prepare(){await(0,u.runExtractor)(this.config.i18next,{isWatchMode:!1,isDryRun:!1,syncAll:!0,syncPrimaryWithDefaults:!0,logger:{info:e=>{this.info(e)},warn:(e,t)=>{this.warn(e)},error:e=>{this.error(e)}}})},async types(e){let a=[];for(let e of await(0,n.listFiles)(t.getOutputPath(this.config.i18next.extract.output,this.config.i18next.extract.primaryLanguage,`*`))){let t=(0,i.findFileName)(e,{withExtension:!1}),n=await this.resolver.import(e);if(this.config.i18next.extract.mergeNamespaces&&(0,s.isSetObject)(n)&&Object.keys(n).filter(e=>(0,s.isSetObject)(n[e])).length>0){for(let e of Object.keys(n).filter(e=>(0,s.isSetObject)(n[e])))a.push({name:e,resources:n[e]});Object.keys(n).filter(e=>!(0,s.isSetObject)(n[e])).length>0&&this.warn(`The file ${e} contains top-level keys that are not objects (${Object.keys(n).filter(e=>!(0,s.isSetObject)(n[e])).join(`, `)}). When 'mergeNamespaces' is enabled, top-level keys are treated as namespaces. These keys will be ignored.`);continue}a.push({name:t,resources:n})}let o;return this.config.i18next.types.resourcesFile?await this.fs.write((0,r.appendPath)(this.config.i18next.types.resourcesFile,this.config.i18next.types.output||this.config.root),(0,d.mergeResourcesAsInterface)(a,{optimize:!!this.config.i18next.types.enableSelector,indentation:this.config.i18next.types.indentation})):o=`${e}
2
-
3
- ${(0,d.mergeResourcesAsInterface)(a,{optimize:!!this.config.i18next.types.enableSelector,indentation:this.config.i18next.types.indentation})}
4
-
5
- /**
6
- * i18next Custom Type Options
7
- *
8
- * @see https://www.i18next.com/overview/typescript#custom-type-options
9
- */
10
- declare module 'i18next' {
11
- interface CustomTypeOptions {
12
- enableSelector: ${(0,c.isString)(this.config.i18next.types.enableSelector)?`"${this.config.i18next.types.enableSelector}"`:this.config.i18next.types.enableSelector};
13
- defaultNS: ${this.config.i18next.extract.defaultNS===!1?`false`:`'${this.config.i18next.extract.defaultNS||`translation`}'`};
14
- resources: Resources;
15
- }
16
- }
17
- `,o}});exports.default=f,exports.plugin=f;
package/dist/index.d.cts DELETED
@@ -1,25 +0,0 @@
1
- import { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig } from "./types/plugin.cjs";
2
- import { Resource, ResourceContent } from "./types/i18n.cjs";
3
- import { Plugin } from "powerlines";
4
-
5
- //#region src/index.d.ts
6
- declare module "powerlines" {
7
- interface Config {
8
- i18next?: I18NextPluginOptions;
9
- }
10
- }
11
- /**
12
- * i18next Plugin
13
- *
14
- * @remarks
15
- * A Powerlines plugin to use the i18next internationalization framework during the prepare task.
16
- *
17
- * @see https://i18next.com
18
- *
19
- * @param options - The plugin options.
20
- * @returns A Powerlines plugin instance.
21
- */
22
- declare const plugin: <TContext extends I18NextPluginContext = I18NextPluginContext>(options?: I18NextPluginOptions) => Plugin<TContext>;
23
- //#endregion
24
- export { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig, Resource, ResourceContent, plugin as default, plugin };
25
- //# sourceMappingURL=index.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;YAwCY,MAAA;IACR,OAAA,GAAU,oBAAA;EAAA;AAAA;;;;;;;;;AAed;;;cAAa,MAAA,oBACM,oBAAA,GAAuB,oBAAA,EAExC,OAAA,GAAS,oBAAA,KACR,MAAA,CAAO,QAAA"}
package/dist/index.d.mts DELETED
@@ -1,25 +0,0 @@
1
- import { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig } from "./types/plugin.mjs";
2
- import { Resource, ResourceContent } from "./types/i18n.mjs";
3
- import { Plugin } from "powerlines";
4
-
5
- //#region src/index.d.ts
6
- declare module "powerlines" {
7
- interface Config {
8
- i18next?: I18NextPluginOptions;
9
- }
10
- }
11
- /**
12
- * i18next Plugin
13
- *
14
- * @remarks
15
- * A Powerlines plugin to use the i18next internationalization framework during the prepare task.
16
- *
17
- * @see https://i18next.com
18
- *
19
- * @param options - The plugin options.
20
- * @returns A Powerlines plugin instance.
21
- */
22
- declare const plugin: <TContext extends I18NextPluginContext = I18NextPluginContext>(options?: I18NextPluginOptions) => Plugin<TContext>;
23
- //#endregion
24
- export { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig, Resource, ResourceContent, plugin as default, plugin };
25
- //# sourceMappingURL=index.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;YAwCY,MAAA;IACR,OAAA,GAAU,oBAAA;EAAA;AAAA;;;;;;;;;AAed;;;cAAa,MAAA,oBACM,oBAAA,GAAuB,oBAAA,EAExC,OAAA,GAAS,oBAAA,KACR,MAAA,CAAO,QAAA"}
package/dist/index.mjs DELETED
@@ -1,18 +0,0 @@
1
- import{getOutputPath as e}from"./helpers/config-utils.mjs";import{listFiles as t}from"@stryke/fs/list-files";import{appendPath as n}from"@stryke/path/append";import{findFileName as r}from"@stryke/path/file-path-fns";import{joinPaths as i}from"@stryke/path/join";import{isSet as a}from"@stryke/type-checks/is-set";import{isSetObject as o}from"@stryke/type-checks/is-set-object";import{isString as s}from"@stryke/type-checks/is-string";import c from"defu";import{runExtractor as l}from"i18next-cli";import{mergeResourcesAsInterface as u}from"i18next-resources-for-ts";const d=(d={})=>({name:`i18next`,async config(){let e=c(d,{extract:{output:(e,t=`translation`)=>i(this.config.root,`locales/${e}/${t}.json`)}},{extract:{input:[`src/**/*.ts`,`src/**/*.tsx`,`src/**/*.js`,`src/**/*.jsx`],indentation:2,defaultNS:`translation`,mergeNamespaces:!0,nsSeparator:`:`,keySeparator:`.`,primaryLanguage:d.locales&&d.locales.length>0?d.locales[0]:`en`},types:{enableSelector:!1},locales:[]});return(!e.locales||e.locales.length===0)&&(e.locales=[e.extract.primaryLanguage||`en`]),a(e.types.indentation)||(e.types.indentation=e.extract.indentation),{i18next:e}},async configResolved(){},async prepare(){await l(this.config.i18next,{isWatchMode:!1,isDryRun:!1,syncAll:!0,syncPrimaryWithDefaults:!0,logger:{info:e=>{this.info(e)},warn:(e,t)=>{this.warn(e)},error:e=>{this.error(e)}}})},async types(i){let a=[];for(let n of await t(e(this.config.i18next.extract.output,this.config.i18next.extract.primaryLanguage,`*`))){let e=r(n,{withExtension:!1}),t=await this.resolver.import(n);if(this.config.i18next.extract.mergeNamespaces&&o(t)&&Object.keys(t).filter(e=>o(t[e])).length>0){for(let e of Object.keys(t).filter(e=>o(t[e])))a.push({name:e,resources:t[e]});Object.keys(t).filter(e=>!o(t[e])).length>0&&this.warn(`The file ${n} contains top-level keys that are not objects (${Object.keys(t).filter(e=>!o(t[e])).join(`, `)}). When 'mergeNamespaces' is enabled, top-level keys are treated as namespaces. These keys will be ignored.`);continue}a.push({name:e,resources:t})}let c;return this.config.i18next.types.resourcesFile?await this.fs.write(n(this.config.i18next.types.resourcesFile,this.config.i18next.types.output||this.config.root),u(a,{optimize:!!this.config.i18next.types.enableSelector,indentation:this.config.i18next.types.indentation})):c=`${i}
2
-
3
- ${u(a,{optimize:!!this.config.i18next.types.enableSelector,indentation:this.config.i18next.types.indentation})}
4
-
5
- /**
6
- * i18next Custom Type Options
7
- *
8
- * @see https://www.i18next.com/overview/typescript#custom-type-options
9
- */
10
- declare module 'i18next' {
11
- interface CustomTypeOptions {
12
- enableSelector: ${s(this.config.i18next.types.enableSelector)?`"${this.config.i18next.types.enableSelector}"`:this.config.i18next.types.enableSelector};
13
- defaultNS: ${this.config.i18next.extract.defaultNS===!1?`false`:`'${this.config.i18next.extract.defaultNS||`translation`}'`};
14
- resources: Resources;
15
- }
16
- }
17
- `,c}});export{d as default,d as plugin};
18
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\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 type { Plugin } from \"powerlines\";\nimport { getOutputPath } from \"./helpers/config-utils\";\nimport { Resource, ResourceContent } from \"./types/i18n\";\nimport type {\n I18NextPluginContext,\n I18NextPluginOptions,\n I18NextPluginResolvedConfig\n} from \"./types/plugin\";\n\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n i18next?: I18NextPluginOptions;\n }\n}\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.root,\n `locales/${language}/${namespace}.json`\n )\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(this.config.i18next as I18nextToolkitConfig, {\n isWatchMode: false,\n isDryRun: false,\n syncAll: true,\n syncPrimaryWithDefaults: true,\n logger: {\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.root\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"],"mappings":"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"}
File without changes
@@ -1,23 +0,0 @@
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 +0,0 @@
1
- {"version":3,"file":"i18n.d.cts","names":[],"sources":["../../src/types/i18n.ts"],"mappings":";;AAqBA;;UAAiB,eAAA;EAAA,CACd,GAAA,oBAAuB,eAAA;AAAA;AAM1B;;;AAAA,UAAiB,QAAA;EAIf;;;EAAA,IAAA;EAK0B;;;EAA1B,SAAA,EAAW,eAAA;AAAA"}
@@ -1,23 +0,0 @@
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 +0,0 @@
1
- {"version":3,"file":"i18n.d.mts","names":[],"sources":["../../src/types/i18n.ts"],"mappings":";;AAqBA;;UAAiB,eAAA;EAAA,CACd,GAAA,oBAAuB,eAAA;AAAA;AAM1B;;;AAAA,UAAiB,QAAA;EAIf;;;EAAA,IAAA;EAK0B;;;EAA1B,SAAA,EAAW,eAAA;AAAA"}
@@ -1 +0,0 @@
1
- export{};
File without changes
@@ -1,3 +0,0 @@
1
- import { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig } from "./plugin.cjs";
2
- import { Resource, ResourceContent } from "./i18n.cjs";
3
- export { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig, Resource, ResourceContent };
@@ -1,3 +0,0 @@
1
- import { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig } from "./plugin.mjs";
2
- import { Resource, ResourceContent } from "./i18n.mjs";
3
- export { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig, Resource, ResourceContent };
@@ -1 +0,0 @@
1
- export{};
File without changes
@@ -1,30 +0,0 @@
1
- import { PluginContext, ResolvedConfig, UserConfig } from "powerlines";
2
- import { DeepPartial } from "@stryke/types/base";
3
- import { I18nextToolkitConfig } from "i18next-cli";
4
-
5
- //#region src/types/plugin.d.ts
6
- type I18NextPluginOptions = DeepPartial<I18nextToolkitConfig>;
7
- type I18NextPluginUserConfig = UserConfig & {
8
- /**
9
- * Configuration options for the i18next plugin.
10
- *
11
- * @remarks
12
- * This configuration is used to customize the behavior of the i18next plugin. It can include any of the options defined in the `I18nextToolkitConfig` interface, but all options are optional and will be merged with the plugin's default configuration.
13
- */
14
- i18next?: I18NextPluginOptions;
15
- };
16
- type I18NextPluginResolvedConfig = ResolvedConfig & {
17
- i18next: Omit<I18nextToolkitConfig, "extract" | "types"> & {
18
- extract: Omit<I18nextToolkitConfig["extract"], "output" | "primaryLanguage" | "indentation"> & Required<Pick<I18nextToolkitConfig["extract"], "output" | "primaryLanguage" | "indentation">>;
19
- types: Omit<NonNullable<I18nextToolkitConfig["types"]>, "input" | "output" | "enableSelector" | "indentation"> & {
20
- input?: string;
21
- output?: string;
22
- enableSelector: boolean | "optimize";
23
- indentation: number | string;
24
- };
25
- };
26
- };
27
- type I18NextPluginContext<TResolvedConfig extends I18NextPluginResolvedConfig = I18NextPluginResolvedConfig> = PluginContext<TResolvedConfig>;
28
- //#endregion
29
- export { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig };
30
- //# sourceMappingURL=plugin.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;KAsBY,oBAAA,GAAuB,WAAA,CAAY,oBAAA;AAAA,KAEnC,uBAAA,GAA0B,UAAA;EAF1B;;;;;AAEZ;EAOE,OAAA,GAAU,oBAAA;AAAA;AAAA,KAGA,2BAAA,GAA8B,cAAA;EACxC,OAAA,EAAS,IAAA,CAAK,oBAAA;IACZ,OAAA,EAAS,IAAA,CACP,oBAAA,6DAGA,QAAA,CACE,IAAA,CACE,oBAAA;IAIN,KAAA,EAAO,IAAA,CACL,WAAA,CAAY,oBAAA;MAGZ,KAAA;MACA,MAAA;MACA,cAAA;MACA,WAAA;IAAA;EAAA;AAAA;AAAA,KAKM,oBAAA,yBACc,2BAAA,GACtB,2BAAA,IACA,aAAA,CAAc,eAAA"}
@@ -1,30 +0,0 @@
1
- import { I18nextToolkitConfig } from "i18next-cli";
2
- import { PluginContext, ResolvedConfig, UserConfig } from "powerlines";
3
- import { DeepPartial } from "@stryke/types/base";
4
-
5
- //#region src/types/plugin.d.ts
6
- type I18NextPluginOptions = DeepPartial<I18nextToolkitConfig>;
7
- type I18NextPluginUserConfig = UserConfig & {
8
- /**
9
- * Configuration options for the i18next plugin.
10
- *
11
- * @remarks
12
- * This configuration is used to customize the behavior of the i18next plugin. It can include any of the options defined in the `I18nextToolkitConfig` interface, but all options are optional and will be merged with the plugin's default configuration.
13
- */
14
- i18next?: I18NextPluginOptions;
15
- };
16
- type I18NextPluginResolvedConfig = ResolvedConfig & {
17
- i18next: Omit<I18nextToolkitConfig, "extract" | "types"> & {
18
- extract: Omit<I18nextToolkitConfig["extract"], "output" | "primaryLanguage" | "indentation"> & Required<Pick<I18nextToolkitConfig["extract"], "output" | "primaryLanguage" | "indentation">>;
19
- types: Omit<NonNullable<I18nextToolkitConfig["types"]>, "input" | "output" | "enableSelector" | "indentation"> & {
20
- input?: string;
21
- output?: string;
22
- enableSelector: boolean | "optimize";
23
- indentation: number | string;
24
- };
25
- };
26
- };
27
- type I18NextPluginContext<TResolvedConfig extends I18NextPluginResolvedConfig = I18NextPluginResolvedConfig> = PluginContext<TResolvedConfig>;
28
- //#endregion
29
- export { I18NextPluginContext, I18NextPluginOptions, I18NextPluginResolvedConfig, I18NextPluginUserConfig };
30
- //# sourceMappingURL=plugin.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;KAsBY,oBAAA,GAAuB,WAAA,CAAY,oBAAA;AAAA,KAEnC,uBAAA,GAA0B,UAAA;EAF1B;;;;;AAEZ;EAOE,OAAA,GAAU,oBAAA;AAAA;AAAA,KAGA,2BAAA,GAA8B,cAAA;EACxC,OAAA,EAAS,IAAA,CAAK,oBAAA;IACZ,OAAA,EAAS,IAAA,CACP,oBAAA,6DAGA,QAAA,CACE,IAAA,CACE,oBAAA;IAIN,KAAA,EAAO,IAAA,CACL,WAAA,CAAY,oBAAA;MAGZ,KAAA;MACA,MAAA;MACA,cAAA;MACA,WAAA;IAAA;EAAA;AAAA;AAAA,KAKM,oBAAA,yBACc,2BAAA,GACtB,2BAAA,IACA,aAAA,CAAc,eAAA"}
@@ -1 +0,0 @@
1
- export{};