@open-xchange/rolldown-plugin-i18next-gettext 1.3.0 → 1.4.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,10 @@
1
1
  # Changelog
2
2
 
3
+ ## `1.4.0` – 2026-Aug-07
4
+
5
+ - removed: deprecated option `potFiles`
6
+ - chore: bump dependencies
7
+
3
8
  ## `1.3.0` – 2026-May-14
4
9
 
5
10
  - changed: require NodeJS v22.18
package/README.md CHANGED
@@ -29,6 +29,7 @@ import i18nextPlugin from '@open-xchange/rolldown-plugin-i18next-gettext'
29
29
  export default defineConfig(() => {
30
30
  plugins: [
31
31
  i18nextPlugin({
32
+ poFiles: 'i18n/**/*.po',
32
33
  srcFiles: 'src/**/*.{js,jsx,ts,tsx}',
33
34
  potFile: '[NAMESPACE].pot',
34
35
  projectName: 'My Project',
package/dist/index.d.mts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Plugin } from "rolldown";
2
-
3
2
  //#region src/index.d.ts
4
3
  /**
5
4
  * Configuration options for the plugin '@open-xchange/rolldown-plugin-i18next-gettext'.
@@ -30,11 +29,6 @@ interface PluginI18nextGettextOptions {
30
29
  * '[NAMESPACE].pot'
31
30
  */
32
31
  potFile?: string;
33
- /**
34
- * @deprecated
35
- * Use option `potFile`.
36
- */
37
- potFiles?: string;
38
32
  /**
39
33
  * The project name to be inserted into the POT files under the key
40
34
  * 'Project-Id-Version'. May contain the placeholder `[NAMESPACE]`.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;AAUA;UAAiB,2BAAA;;;;;;;;EASf,OAAA;EA+BW;AAQb;;;;AAAyB;AAAkD;EA9BzE,QAAA;;;;;;;AA2CwF;;EAjCxF,OAAA;;;;;EAMA,QAAA;;;;;EAMA,WAAA;AAAA;;;;cAQW,YAAA;;;;;;;;;;iBAaW,oBAAA,CAAqB,OAAA,EAAS,2BAAA,GAA8B,MAAM"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;UAWiB;;;;;;;;EASf;;;;;;;;EASA;;;;;;;;;EAUA;;;;;EAMA;;;;;cAQW;;;;;;;;;;iBAaW,qBAAqB,SAAS,8BAA8B"}
package/dist/index.mjs CHANGED
@@ -15,19 +15,19 @@ const PROJECT_NAME = "@open-xchange/rolldown-plugin-i18next-gettext";
15
15
  * The rolldown plugin object.
16
16
  */
17
17
  function pluginI18nextGettext(options) {
18
- const { poFiles = "**/*.po", srcFiles = "src/**/*.{js,jsx,ts,tsx}", potFile = options.potFiles ?? "[NAMESPACE].pot", projectName } = options;
18
+ const srcFiles = options.srcFiles ?? "src/**/*.{js,jsx,ts,tsx}";
19
+ const poFiles = options.poFiles ?? "**/*.po";
20
+ const potFile = options.potFile ?? "[NAMESPACE].pot";
19
21
  return {
20
22
  name: PROJECT_NAME,
21
23
  load: {
22
24
  filter: { id: poFiles },
23
- async handler(id) {
24
- return createJsonModule(await parsePoFile(id));
25
- }
25
+ handler: async (id) => createJsonModule(await parsePoFile(id))
26
26
  },
27
27
  async generateBundle() {
28
28
  const catalogs = await parseSourceFiles({
29
29
  files: srcFiles,
30
- project: projectName
30
+ project: options.projectName
31
31
  });
32
32
  if (catalogs.size > 1 && !potFile.includes("[NAMESPACE]")) this.error("multiple POT files written to same file location (missing placeholder `[NAMESPACE]` in option potFile)");
33
33
  for (const [namespace, source] of catalogs) {
@@ -1 +1 @@
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 potFile?: string\n\n /**\n * @deprecated\n * Use option `potFile`.\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 // eslint-disable-next-line @typescript-eslint/no-deprecated\n potFile = options.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) && !potFile.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 = potFile.replaceAll('[NAMESPACE]', namespace)\n this.emitFile({ type: 'asset', fileName, source })\n }\n },\n }\n}\n"],"mappings":";;;;;;AA0DA,MAAa,eAAe;;;;;;;;;;AAa5B,SAAwB,qBAAqB,SAA8C;CAGzF,MAAM,EACJ,UAAU,WACV,WAAW,4BAEX,UAAU,QAAQ,YAAY,mBAC9B,gBACE;CAEJ,OAAO;EACL,MAAM;EAGN,MAAM;GACJ,QAAQ,EAAE,IAAI,QAA6B;GAC3C,MAAM,QAAQ,IAAI;IAChB,OAAO,iBAAiB,MAAM,YAAY,EAAE,CAAC;GAC/C;EACF;EAGA,MAAM,iBAAiB;GAGrB,MAAM,WAAW,MAAM,iBAAiB;IAAE,OAAO;IAAU,SAAS;GAAY,CAAC;GAGjF,IAAK,SAAS,OAAO,KAAM,CAAC,QAAQ,SAAS,aAAa,GACxD,KAAK,MAAM,wGAAwG;GAIrH,KAAK,MAAM,CAAC,WAAW,WAAW,UAAU;IAC1C,MAAM,WAAW,QAAQ,WAAW,eAAe,SAAS;IAC5D,KAAK,SAAS;KAAE,MAAM;KAAS;KAAU;IAAO,CAAC;GACnD;EACF;CACF;AACF"}
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'\n\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 potFile?: 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 srcFiles = options.srcFiles ?? 'src/**/*.{js,jsx,ts,tsx}'\n const poFiles = options.poFiles ?? '**/*.po'\n const potFile = options.potFile ?? '[NAMESPACE].pot'\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 handler: async id => createJsonModule(await parsePoFile(id)),\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: options.projectName })\n\n // warn when writing multiple POT files to same file location\n if ((catalogs.size > 1) && !potFile.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 = potFile.replaceAll('[NAMESPACE]', namespace)\n this.emitFile({ type: 'asset', fileName, source })\n }\n },\n }\n}\n"],"mappings":";;;;;;AAqDA,MAAa,eAAe;;;;;;;;;;AAa5B,SAAwB,qBAAqB,SAA8C;CAGzF,MAAM,WAAW,QAAQ,YAAY;CACrC,MAAM,UAAU,QAAQ,WAAW;CACnC,MAAM,UAAU,QAAQ,WAAW;CAEnC,OAAO;EACL,MAAM;EAGN,MAAM;GACJ,QAAQ,EAAE,IAAI,QAA6B;GAC3C,SAAS,OAAM,OAAM,iBAAiB,MAAM,YAAY,EAAE,CAAC;EAC7D;EAGA,MAAM,iBAAiB;GAGrB,MAAM,WAAW,MAAM,iBAAiB;IAAE,OAAO;IAAU,SAAS,QAAQ;GAAY,CAAC;GAGzF,IAAK,SAAS,OAAO,KAAM,CAAC,QAAQ,SAAS,aAAa,GACxD,KAAK,MAAM,wGAAwG;GAIrH,KAAK,MAAM,CAAC,WAAW,WAAW,UAAU;IAC1C,MAAM,WAAW,QAAQ,WAAW,eAAe,SAAS;IAC5D,KAAK,SAAS;KAAE,MAAM;KAAS;KAAU;IAAO,CAAC;GACnD;EACF;CACF;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-xchange/rolldown-plugin-i18next-gettext",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Rolldown integration of i18next using gettext PO files",
5
5
  "repository": {
6
6
  "type": "git",
@@ -19,24 +19,27 @@
19
19
  "types": "./dist/client.d.ts"
20
20
  }
21
21
  },
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
22
25
  "files": [
23
26
  "dist",
24
27
  "CHANGELOG.*"
25
28
  ],
26
29
  "dependencies": {
27
- "@open-xchange/i18next-po-parser": "^1.4.1",
28
- "@open-xchange/rolldown-utils": "^1.2.0"
30
+ "@open-xchange/rolldown-utils": "^1.2.0",
31
+ "@open-xchange/i18next-po-parser": "^1.5.0"
29
32
  },
30
33
  "devDependencies": {
31
- "@vitest/coverage-v8": "^4.1.6",
32
- "i18next": "^26.1.0",
33
- "rolldown": "^1.0.1",
34
- "tsdown": "^0.22.0",
35
- "vitest": "^4.1.6",
36
- "@open-xchange/linter-presets": "^1.24.0",
37
- "@open-xchange/vitest-plugin-extended": "^1.7.0",
34
+ "@vitest/coverage-v8": "^4.1.10",
35
+ "i18next": "^26.3.6",
36
+ "rolldown": "^1.2.2",
37
+ "tsdown": "^0.22.14",
38
+ "vitest": "^4.1.10",
38
39
  "@open-xchange/rolldown-plugin-dynamic-import-vars": "^1.2.0",
39
40
  "@open-xchange/tsconfig": "^0.1.0",
41
+ "@open-xchange/vitest-plugin-extended": "^1.7.0",
42
+ "@open-xchange/linter-presets": "^1.29.1",
40
43
  "@open-xchange/vitest-plugin-utils": "^1.2.0"
41
44
  },
42
45
  "peerDependencies": {