@open-xchange/rolldown-plugin-i18next-gettext 1.0.1 → 1.2.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## `1.2.0` – 2026-Apr-15
4
+
5
+ - added: switched back to direct imports of PO files
6
+ - removed: virtual modules for namespaces
7
+
8
+ ## `1.1.0` – 2026-Apr-15
9
+
10
+ - removed: direct imports of PO files
11
+ - added: allow to group PO files into different namespaces
12
+
3
13
  ## `1.0.1` – 2026-Apr-14
4
14
 
5
15
  - fixed: removed debug output
package/README.md CHANGED
@@ -1,12 +1,21 @@
1
1
  # @open-xchange/rolldown-plugin-i18next-gettext
2
2
 
3
- A [rolldown](https://rolldown.rs/) plugin that allows building libraries using [i18next](https://www.i18next.com/) in source code with gettext's `.po` and `.pot` files under the hood.
3
+ A [rolldown](https://rolldown.rs/) plugin that allows building libraries or applications using [i18next](https://www.i18next.com/) in source code with gettext's `.po` and `.pot` files under the hood.
4
4
 
5
5
  This plugin has the following responsibilities:
6
6
 
7
7
  - All `.po` files imported in source code will be converted to i18next translation catalogs.
8
- - A virtual module import makes all translation catalogs from selected `.po` files available in a single dictionary to be able to pick translation languages dynamically.
9
- - The source code will be scanned for translation strings (`t` function calls), and a `.pot` file containing all strings will be generated into the output directory.
8
+ - The source code will be scanned for translation strings (`t` function calls), and `.pot` files containing all strings will be generated into the output directory. Supports i18next namespaces (one `.pot` file per namespace).
9
+
10
+ ## Installation
11
+
12
+ ```sh
13
+ npm install -D @open-xchange/rolldown-plugin-i18next-gettext
14
+ # or
15
+ pnpm add -D @open-xchange/rolldown-plugin-i18next-gettext
16
+ # or
17
+ yarn add -D @open-xchange/rolldown-plugin-i18next-gettext
18
+ ```
10
19
 
11
20
  ## Configuration
12
21
 
@@ -20,12 +29,9 @@ import i18nextPlugin from '@open-xchange/rolldown-plugin-i18next-gettext'
20
29
  export default defineConfig(() => {
21
30
  plugins: [
22
31
  i18nextPlugin({
23
- poFiles: 'i18n/*.po',
24
- potFiles: {
25
- srcFiles: 'src/**/*.{js,jsx,ts,tsx}',
26
- outputPath: '[NAMESPACE].pot',
27
- projectName: 'My Project',
28
- },
32
+ srcFiles: 'src/**/*.{js,jsx,ts,tsx}',
33
+ potFiles: '[NAMESPACE].pot',
34
+ projectName: 'My Project',
29
35
  }),
30
36
  ],
31
37
  })
@@ -35,33 +41,32 @@ export default defineConfig(() => {
35
41
 
36
42
  | Name | Type | Default | Description |
37
43
  | - | - | - | - |
38
- | `poFiles` | `string\|string[]` | _required_ | Glob pattern(s) for all PO files containing the translations. |
39
- | `potFiles` | | | Configuration for the source code scanner and POT file generator. If omitted, no POT files will be generated. |
40
- | `potFiles.srcFiles` | `string\|string[]` | `src/**/*.{js,jsx,ts,tsx}` | Glob pattern(s) for all source files to be scanned for UI strings. |
41
- | `potFiles.outputPath` | `string` | `[NAMESPACE].pot` | Path to and filename of the generated POT files, relative to the build output directory. Should contain the placeholder `[NAMESPACE]` if the project contains translation strings in different i18next namespaces. |
42
- | `potFiles.projectName` | `string` | _required_ | The project name to be inserted into the POT file under the key 'Project-Id-Version'. May contain the placeholder `[NAMESPACE]` |
44
+ | `poFiles` | `string\|string[]` | `**/*.po` | Glob pattern(s) for all PO files to be converted when imported in source code. |
45
+ | `srcFiles` | `string\|string[]` | `src/**/*.{js,jsx,ts,tsx}` | Glob pattern(s) for all source files to be scanned for UI strings for the POT file generator. |
46
+ | `potFiles` | `string` | `[NAMESPACE].pot` | Path to and filename of the generated POT files, relative to the build output directory. Must contain the placeholder `[NAMESPACE]` if the project contains translation strings in different i18next namespaces. |
47
+ | `projectName` | `string` | _required_ | The project name to be inserted into the POT file under the key 'Project-Id-Version'. May contain the placeholder `[NAMESPACE]` |
43
48
 
44
49
  ## Usage
45
50
 
46
- Register TypeScript type definitions for the `virtual:i18next-po-catalogs` module import:
51
+ Register TypeScript type definitions for the PO file imports:
47
52
 
48
53
  ```json
49
54
  // tsconfig.json
50
55
  {
51
56
  "types": [
52
- "@open-xchange/rolldown-plugin-i18next-gettext/virtual"
57
+ "@open-xchange/rolldown-plugin-i18next-gettext/client"
53
58
  ],
54
59
  }
55
60
  ```
56
61
 
57
- Use the virtual modules in your code:
62
+ Load translation catalogs in source code on demand via i18next backend plugin:
58
63
 
59
64
  ```ts
60
- // import catalogs for all languages
61
- import catalogs from 'virtual:i18next-po-catalogs'
62
- console.log(catalogs.de_DE)
65
+ import i18next from 'i18next'
66
+ import resourcesToBackend from 'i18next-resources-to-backend'
63
67
 
64
- // import catalog for one language
65
- import catalog from 'i18n/de_DE.po'
66
- console.log(catalog)
68
+ i18next.use(resourcesToBackend(async (lang: string, namespace: string) => {
69
+ // build appropriate path to the PO files
70
+ return await import(`../i18n/${namespace}/${lang}.po`)
71
+ }))
67
72
  ```
@@ -0,0 +1,12 @@
1
+
2
+ declare module '*.po' {
3
+
4
+ /**
5
+ * Shape of an i18next JSON translation catalog (mapping from source keys to
6
+ * translations) for a single language, converted from a gettext PO file.
7
+ */
8
+ export type Catalog = Record<string, string>
9
+
10
+ const catalog: Catalog
11
+ export default catalog
12
+ }
package/dist/index.d.mts CHANGED
@@ -4,52 +4,42 @@ import { Plugin } from "rolldown";
4
4
  /**
5
5
  * Configuration options for the plugin '@open-xchange/rolldown-plugin-i18next-gettext'.
6
6
  */
7
- interface RolldownPluginI18nextGettextOptions {
7
+ interface PluginI18nextGettextOptions {
8
8
  /**
9
- * Glob pattern(s) for all PO files containing the translations. Matching PO
10
- * files will be converted to i18next translation catalogs when imported in
11
- * source code directly, and will be included in the virtual module providing
12
- * a dictionary of all translation catalogs, mapped by the base names of the
13
- * PO files.
9
+ * Glob pattern(s) for all PO files to be converted when imported in source
10
+ * code.
11
+ *
12
+ * @default
13
+ * '**\/*.po'
14
14
  */
15
- poFiles: string | readonly string[];
15
+ poFiles?: string | readonly string[];
16
16
  /**
17
- * Configuration for the source code scanner and POT file generator. If
18
- * omitted, no POT files will be generated.
17
+ * Glob pattern(s) for all source files to be scanned for UI strings for the
18
+ * POT file generator.
19
+ *
20
+ * @default
21
+ * 'src/**\/*.{js,jsx,ts,tsx}'
19
22
  */
20
- potFiles?: {
21
- /**
22
- * Glob pattern(s) for all source files to be scanned for UI strings.
23
- *
24
- * @default
25
- * 'src/**\/*.{js,jsx,ts,tsx}'
26
- */
27
- srcFiles?: string | readonly string[];
28
- /**
29
- * Path to and filename of the generated POT files, relative to the build
30
- * output directory. Should contain the placeholder `[NAMESPACE]` if the
31
- * project contains translation strings in different i18next namespaces.
32
- *
33
- * @default
34
- * '[NAMESPACE].pot'
35
- */
36
- outputPath?: string;
37
- /**
38
- * The project name to be inserted into the POT files under the key
39
- * 'Project-Id-Version'. May contain the placeholder `[NAMESPACE]`.
40
- */
41
- projectName: string;
42
- };
23
+ srcFiles?: string | readonly string[];
24
+ /**
25
+ * Path to and filename of the generated POT files, relative to the build
26
+ * output directory. Must contain the placeholder `[NAMESPACE]` if the
27
+ * project contains translation strings in different i18next namespaces.
28
+ *
29
+ * @default
30
+ * '[NAMESPACE].pot'
31
+ */
32
+ potFiles?: string;
33
+ /**
34
+ * The project name to be inserted into the POT files under the key
35
+ * 'Project-Id-Version'. May contain the placeholder `[NAMESPACE]`.
36
+ */
37
+ projectName: string;
43
38
  }
44
39
  /**
45
40
  * Identifier of this plugin.
46
41
  */
47
42
  declare const PROJECT_NAME = "@open-xchange/rolldown-plugin-i18next-gettext";
48
- /**
49
- * Identifier of the virtual module providing all translation catalogs in a
50
- * single object.
51
- */
52
- declare const VIRTUAL_MODULE_ID = "virtual:i18next-po-catalogs";
53
43
  /**
54
44
  * Rolldown plugin for using i18next with gettext `.po` files under the hood.
55
45
  *
@@ -59,7 +49,7 @@ declare const VIRTUAL_MODULE_ID = "virtual:i18next-po-catalogs";
59
49
  * @returns
60
50
  * The rolldown plugin object.
61
51
  */
62
- declare function rolldownPluginI18nextGettext(options: RolldownPluginI18nextGettextOptions): Plugin;
52
+ declare function pluginI18nextGettext(options: PluginI18nextGettextOptions): Plugin;
63
53
  //#endregion
64
- export { PROJECT_NAME, RolldownPluginI18nextGettextOptions, VIRTUAL_MODULE_ID, rolldownPluginI18nextGettext as default };
54
+ export { PROJECT_NAME, PluginI18nextGettextOptions, pluginI18nextGettext as default };
65
55
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;AAaA;UAAiB,mCAAA;;;;;;;;EASf,OAAA;EA8Ba;AASf;;;EAjCE,QAAA;IAiCuB;AAMzB;;;;;IA/BI,QAAA;IA4CgD;;;;;;;;IAlChD,UAAA;;;;;IAMA,WAAA;EAAA;AAAA;;;;cASS,YAAA;;;;;cAMA,iBAAA;;;;;;;;;;iBAaW,4BAAA,CAA6B,OAAA,EAAS,mCAAA,GAAsC,MAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;AAUA;UAAiB,2BAAA;;;;;;;;EASf,OAAA;EAiCW;;;;;AAA8D;;EAxBzE,QAAA;EAqCwF;;;;;;;;EA3BxF,QAAA;;;;;EAMA,WAAA;AAAA;;;;cAQW,YAAA;;;;;;;;;;iBAaW,oBAAA,CAAqB,OAAA,EAAS,2BAAA,GAA8B,MAAA"}
package/dist/index.mjs CHANGED
@@ -1,6 +1,4 @@
1
- import * as path from "node:path";
2
- import { createJsonModule, exactRegex, wrapArray } from "@open-xchange/rolldown-utils";
3
- import { glob } from "tinyglobby";
1
+ import { createJsonModule } from "@open-xchange/rolldown-utils";
4
2
  import { parsePoFile, parseSourceFiles } from "@open-xchange/i18next-po-parser";
5
3
  //#region src/index.ts
6
4
  /**
@@ -8,11 +6,6 @@ import { parsePoFile, parseSourceFiles } from "@open-xchange/i18next-po-parser";
8
6
  */
9
7
  const PROJECT_NAME = "@open-xchange/rolldown-plugin-i18next-gettext";
10
8
  /**
11
- * Identifier of the virtual module providing all translation catalogs in a
12
- * single object.
13
- */
14
- const VIRTUAL_MODULE_ID = "virtual:i18next-po-catalogs";
15
- /**
16
9
  * Rolldown plugin for using i18next with gettext `.po` files under the hood.
17
10
  *
18
11
  * @param options
@@ -21,38 +14,24 @@ const VIRTUAL_MODULE_ID = "virtual:i18next-po-catalogs";
21
14
  * @returns
22
15
  * The rolldown plugin object.
23
16
  */
24
- function rolldownPluginI18nextGettext(options) {
25
- const RESOLVED_MODULE_ID = `\0${VIRTUAL_MODULE_ID}`;
17
+ function pluginI18nextGettext(options) {
18
+ const { poFiles = "**/*.po", srcFiles = "src/**/*.{js,jsx,ts,tsx}", potFiles = "[NAMESPACE].pot", projectName } = options;
26
19
  return {
27
20
  name: PROJECT_NAME,
28
- resolveId: {
29
- filter: { id: exactRegex(VIRTUAL_MODULE_ID) },
30
- handler: () => RESOLVED_MODULE_ID
31
- },
32
21
  load: {
33
- filter: { id: [exactRegex(RESOLVED_MODULE_ID), ...wrapArray(options.poFiles)] },
22
+ filter: { id: poFiles },
34
23
  async handler(id) {
35
- if (id === RESOLVED_MODULE_ID) {
36
- const map = {};
37
- for (const entry of await glob(options.poFiles)) {
38
- const basename = path.parse(entry).name;
39
- map[basename] = await parsePoFile(entry);
40
- }
41
- return createJsonModule(map);
42
- }
43
24
  return createJsonModule(await parsePoFile(id));
44
25
  }
45
26
  },
46
27
  async generateBundle() {
47
- if (!options.potFiles) return;
48
- const { srcFiles = "src/**/*.{js,jsx,ts,tsx}", outputPath = "[NAMESPACE].pot", projectName } = options.potFiles;
49
28
  const catalogs = await parseSourceFiles({
50
29
  files: srcFiles,
51
30
  project: projectName
52
31
  });
53
- if (catalogs.size > 1 && !outputPath.includes("[NAMESPACE]")) this.error("multiple POT files written to same file location (missing placeholder `[NAMESPACE]` in option potFile)");
32
+ if (catalogs.size > 1 && !potFiles.includes("[NAMESPACE]")) this.error("multiple POT files written to same file location (missing placeholder `[NAMESPACE]` in option potFile)");
54
33
  for (const [namespace, source] of catalogs) {
55
- const fileName = outputPath.replaceAll("[NAMESPACE]", namespace);
34
+ const fileName = potFiles.replaceAll("[NAMESPACE]", namespace);
56
35
  this.emitFile({
57
36
  type: "asset",
58
37
  fileName,
@@ -63,6 +42,6 @@ function rolldownPluginI18nextGettext(options) {
63
42
  };
64
43
  }
65
44
  //#endregion
66
- export { PROJECT_NAME, VIRTUAL_MODULE_ID, rolldownPluginI18nextGettext as default };
45
+ export { PROJECT_NAME, pluginI18nextGettext as default };
67
46
 
68
47
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["\nimport * as path from 'node:path'\n\nimport type { Plugin } from 'rolldown'\nimport { exactRegex, wrapArray, createJsonModule } from '@open-xchange/rolldown-utils'\nimport { glob } from 'tinyglobby'\nimport { parsePoFile, parseSourceFiles } from '@open-xchange/i18next-po-parser'\n\n// types ======================================================================\n\n/**\n * Configuration options for the plugin '@open-xchange/rolldown-plugin-i18next-gettext'.\n */\nexport interface RolldownPluginI18nextGettextOptions {\n\n /**\n * Glob pattern(s) for all PO files containing the translations. Matching PO\n * files will be converted to i18next translation catalogs when imported in\n * source code directly, and will be included in the virtual module providing\n * a dictionary of all translation catalogs, mapped by the base names of the\n * PO files.\n */\n poFiles: string | readonly string[]\n\n /**\n * Configuration for the source code scanner and POT file generator. If\n * omitted, no POT files will be generated.\n */\n potFiles?: {\n\n /**\n * Glob pattern(s) for all source files to be scanned for UI strings.\n *\n * @default\n * 'src/**\\/*.{js,jsx,ts,tsx}'\n */\n srcFiles?: string | readonly string[]\n\n /**\n * Path to and filename of the generated POT files, relative to the build\n * output directory. Should contain the placeholder `[NAMESPACE]` if the\n * project contains translation strings in different i18next namespaces.\n *\n * @default\n * '[NAMESPACE].pot'\n */\n outputPath?: string\n\n /**\n * The project name to be inserted into the POT files under the key\n * 'Project-Id-Version'. May contain the placeholder `[NAMESPACE]`.\n */\n projectName: string\n }\n}\n\n// constants ==================================================================\n\n/**\n * Identifier of this plugin.\n */\nexport const PROJECT_NAME = '@open-xchange/rolldown-plugin-i18next-gettext'\n\n/**\n * Identifier of the virtual module providing all translation catalogs in a\n * single object.\n */\nexport const VIRTUAL_MODULE_ID = 'virtual:i18next-po-catalogs'\n\n// plugin =====================================================================\n\n/**\n * Rolldown plugin for using i18next with gettext `.po` files under the hood.\n *\n * @param options\n * Plugin configuration.\n *\n * @returns\n * The rolldown plugin object.\n */\nexport default function rolldownPluginI18nextGettext(options: RolldownPluginI18nextGettextOptions): Plugin {\n\n const RESOLVED_MODULE_ID = `\\0${VIRTUAL_MODULE_ID}`\n\n return {\n name: PROJECT_NAME,\n\n // recognize virtual module identifier\n resolveId: {\n filter: { id: exactRegex(VIRTUAL_MODULE_ID) },\n handler: () => RESOLVED_MODULE_ID,\n },\n\n // convert PO files to i18next JSON v4\n load: {\n filter: {\n id: [\n exactRegex(RESOLVED_MODULE_ID),\n ...wrapArray(options.poFiles),\n ],\n },\n async handler(id) {\n\n // virtual module: build single dictionary with all languages from PO files\n if (id === RESOLVED_MODULE_ID) {\n const map = {} as Record<string, Record<string, string>>\n for (const entry of await glob(options.poFiles)) {\n const basename = path.parse(entry).name\n map[basename] = await parsePoFile(entry)\n }\n return createJsonModule(map)\n }\n\n // read the PO file and convert it to i18next JSON\n return createJsonModule(await parsePoFile(id))\n },\n },\n\n // parse source files and create POT files per namespace\n async generateBundle() {\n\n // early exit if no POT files will be generated\n if (!options.potFiles) return\n const { srcFiles = 'src/**/*.{js,jsx,ts,tsx}', outputPath = '[NAMESPACE].pot', projectName } = options.potFiles\n\n // parse all source files and extract translations\n const catalogs = await parseSourceFiles({ files: srcFiles, project: projectName })\n\n // warn when writing multiple POT files to same file location\n if ((catalogs.size > 1) && !outputPath.includes('[NAMESPACE]')) {\n this.error('multiple POT files written to same file location (missing placeholder `[NAMESPACE]` in option potFile)')\n }\n\n // add all POT files as assets to the bundle\n for (const [namespace, source] of catalogs) {\n const fileName = outputPath.replaceAll('[NAMESPACE]', namespace)\n this.emitFile({ type: 'asset', fileName, source })\n }\n },\n }\n}\n"],"mappings":";;;;;;;;AA6DA,MAAa,eAAe;;;;;AAM5B,MAAa,oBAAoB;;;;;;;;;;AAajC,SAAwB,6BAA6B,SAAsD;CAEzG,MAAM,qBAAqB,KAAK;AAEhC,QAAO;EACL,MAAM;EAGN,WAAW;GACT,QAAQ,EAAE,IAAI,WAAW,kBAAkB,EAAE;GAC7C,eAAe;GAChB;EAGD,MAAM;GACJ,QAAQ,EACN,IAAI,CACF,WAAW,mBAAmB,EAC9B,GAAG,UAAU,QAAQ,QAAQ,CAC9B,EACF;GACD,MAAM,QAAQ,IAAI;AAGhB,QAAI,OAAO,oBAAoB;KAC7B,MAAM,MAAM,EAAE;AACd,UAAK,MAAM,SAAS,MAAM,KAAK,QAAQ,QAAQ,EAAE;MAC/C,MAAM,WAAW,KAAK,MAAM,MAAM,CAAC;AACnC,UAAI,YAAY,MAAM,YAAY,MAAM;;AAE1C,YAAO,iBAAiB,IAAI;;AAI9B,WAAO,iBAAiB,MAAM,YAAY,GAAG,CAAC;;GAEjD;EAGD,MAAM,iBAAiB;AAGrB,OAAI,CAAC,QAAQ,SAAU;GACvB,MAAM,EAAE,WAAW,4BAA4B,aAAa,mBAAmB,gBAAgB,QAAQ;GAGvG,MAAM,WAAW,MAAM,iBAAiB;IAAE,OAAO;IAAU,SAAS;IAAa,CAAC;AAGlF,OAAK,SAAS,OAAO,KAAM,CAAC,WAAW,SAAS,cAAc,CAC5D,MAAK,MAAM,yGAAyG;AAItH,QAAK,MAAM,CAAC,WAAW,WAAW,UAAU;IAC1C,MAAM,WAAW,WAAW,WAAW,eAAe,UAAU;AAChE,SAAK,SAAS;KAAE,MAAM;KAAS;KAAU;KAAQ,CAAC;;;EAGvD"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["\nimport type { Plugin, GeneralHookFilter } from 'rolldown'\nimport { createJsonModule } from '@open-xchange/rolldown-utils'\nimport { parsePoFile, parseSourceFiles } from '@open-xchange/i18next-po-parser'\n\n// types ======================================================================\n\n/**\n * Configuration options for the plugin '@open-xchange/rolldown-plugin-i18next-gettext'.\n */\nexport interface PluginI18nextGettextOptions {\n\n /**\n * Glob pattern(s) for all PO files to be converted when imported in source\n * code.\n *\n * @default\n * '**\\/*.po'\n */\n poFiles?: string | readonly string[]\n\n /**\n * Glob pattern(s) for all source files to be scanned for UI strings for the\n * POT file generator.\n *\n * @default\n * 'src/**\\/*.{js,jsx,ts,tsx}'\n */\n srcFiles?: string | readonly string[]\n\n /**\n * Path to and filename of the generated POT files, relative to the build\n * output directory. Must contain the placeholder `[NAMESPACE]` if the\n * project contains translation strings in different i18next namespaces.\n *\n * @default\n * '[NAMESPACE].pot'\n */\n potFiles?: string\n\n /**\n * The project name to be inserted into the POT files under the key\n * 'Project-Id-Version'. May contain the placeholder `[NAMESPACE]`.\n */\n projectName: string\n}\n\n// constants ==================================================================\n\n/**\n * Identifier of this plugin.\n */\nexport const PROJECT_NAME = '@open-xchange/rolldown-plugin-i18next-gettext'\n\n// plugin =====================================================================\n\n/**\n * Rolldown plugin for using i18next with gettext `.po` files under the hood.\n *\n * @param options\n * Plugin configuration.\n *\n * @returns\n * The rolldown plugin object.\n */\nexport default function pluginI18nextGettext(options: PluginI18nextGettextOptions): Plugin {\n\n // resolve default options\n const {\n poFiles = '**/*.po',\n srcFiles = 'src/**/*.{js,jsx,ts,tsx}',\n potFiles = '[NAMESPACE].pot',\n projectName,\n } = options\n\n return {\n name: PROJECT_NAME,\n\n // convert PO files to i18next namespace records\n load: {\n filter: { id: poFiles as GeneralHookFilter },\n async handler(id) {\n return createJsonModule(await parsePoFile(id))\n },\n },\n\n // parse source files and create POT files per namespace\n async generateBundle() {\n\n // parse all source files and extract translations\n const catalogs = await parseSourceFiles({ files: srcFiles, project: projectName })\n\n // warn when writing multiple POT files to same file location\n if ((catalogs.size > 1) && !potFiles.includes('[NAMESPACE]')) {\n this.error('multiple POT files written to same file location (missing placeholder `[NAMESPACE]` in option potFile)')\n }\n\n // add all POT files as assets to the bundle\n for (const [namespace, source] of catalogs) {\n const fileName = potFiles.replaceAll('[NAMESPACE]', namespace)\n this.emitFile({ type: 'asset', fileName, source })\n }\n },\n }\n}\n"],"mappings":";;;;;;AAoDA,MAAa,eAAe;;;;;;;;;;AAa5B,SAAwB,qBAAqB,SAA8C;CAGzF,MAAM,EACJ,UAAU,WACV,WAAW,4BACX,WAAW,mBACX,gBACE;AAEJ,QAAO;EACL,MAAM;EAGN,MAAM;GACJ,QAAQ,EAAE,IAAI,SAA8B;GAC5C,MAAM,QAAQ,IAAI;AAChB,WAAO,iBAAiB,MAAM,YAAY,GAAG,CAAC;;GAEjD;EAGD,MAAM,iBAAiB;GAGrB,MAAM,WAAW,MAAM,iBAAiB;IAAE,OAAO;IAAU,SAAS;IAAa,CAAC;AAGlF,OAAK,SAAS,OAAO,KAAM,CAAC,SAAS,SAAS,cAAc,CAC1D,MAAK,MAAM,yGAAyG;AAItH,QAAK,MAAM,CAAC,WAAW,WAAW,UAAU;IAC1C,MAAM,WAAW,SAAS,WAAW,eAAe,UAAU;AAC9D,SAAK,SAAS;KAAE,MAAM;KAAS;KAAU;KAAQ,CAAC;;;EAGvD"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@open-xchange/rolldown-plugin-i18next-gettext",
3
- "version": "1.0.1",
4
- "description": "Rolldown integration of i18next using gettext",
3
+ "version": "1.2.0",
4
+ "description": "Rolldown integration of i18next using gettext PO files",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://gitlab.open-xchange.com/fspd/commons/plugins.git",
@@ -15,8 +15,8 @@
15
15
  "exports": {
16
16
  ".": "./dist/index.mjs",
17
17
  "./package.json": "./package.json",
18
- "./virtual": {
19
- "types": "./dist/virtual.d.ts"
18
+ "./client": {
19
+ "types": "./dist/client.d.ts"
20
20
  }
21
21
  },
22
22
  "files": [
@@ -25,22 +25,31 @@
25
25
  ],
26
26
  "dependencies": {
27
27
  "@open-xchange/i18next-po-parser": "^1.4.0",
28
- "tinyglobby": "^0.2.16",
29
28
  "@open-xchange/rolldown-utils": "^1.0.0"
30
29
  },
31
30
  "devDependencies": {
31
+ "@open-xchange/rolldown-plugin-dynamic-import-vars": "^1.0.2",
32
32
  "@vitest/coverage-v8": "^4.1.3",
33
33
  "i18next": "^26.0.4",
34
34
  "rolldown": "^1.0.0-rc.15",
35
- "tsdown": "^0.21.7",
35
+ "tsdown": "^0.21.8",
36
36
  "vitest": "^4.1.3",
37
- "@open-xchange/vitest-plugin-utils": "^0.0.3",
38
- "@open-xchange/tsconfig": "^0.0.3",
37
+ "@open-xchange/vitest-plugin-extended": "^1.6.0",
38
+ "@open-xchange/vitest-plugin-utils": "^1.1.1",
39
39
  "@open-xchange/linter-presets": "^1.22.0",
40
- "@open-xchange/vitest-plugin-extended": "^1.6.0"
40
+ "@open-xchange/tsconfig": "^0.0.3"
41
41
  },
42
42
  "peerDependencies": {
43
- "rolldown": "*"
43
+ "rolldown": "*",
44
+ "tsdown": "*"
45
+ },
46
+ "peerDependenciesMeta": {
47
+ "rolldown": {
48
+ "optional": true
49
+ },
50
+ "tsdown": {
51
+ "optional": true
52
+ }
44
53
  },
45
54
  "scripts": {
46
55
  "build": "tsdown",
package/dist/virtual.d.ts DELETED
@@ -1,18 +0,0 @@
1
-
2
- declare module '*.po' {
3
-
4
- export type Catalog = Record<string, string>
5
-
6
- const catalog: Catalog
7
- export default catalog
8
- }
9
-
10
- declare module 'virtual:i18next-po-catalogs' {
11
-
12
- // eslint-disable-next-line n/no-missing-import
13
- import { Catalog } from 'test.po'
14
- export { Catalog }
15
-
16
- const catalogs: Record<string, Catalog>
17
- export default catalogs
18
- }