@flyingrobots/bijou-i18n-tools-node 4.4.1 → 5.0.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/README.md +22 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/runtime-loader.d.ts +10 -0
- package/dist/runtime-loader.d.ts.map +1 -0
- package/dist/runtime-loader.js +13 -0
- package/dist/runtime-loader.js.map +1 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -8,9 +8,31 @@ Node filesystem helpers for Bijou localization exchange workflows.
|
|
|
8
8
|
- reading and writing JSON catalog bundle files
|
|
9
9
|
- reading and writing workbook directories with a versioned manifest
|
|
10
10
|
- extension-based format inference for `.csv`, `.tsv`, and `.json`
|
|
11
|
+
- a Node catalog-bundle loader adapter for `@flyingrobots/bijou-i18n`
|
|
11
12
|
|
|
12
13
|
This package intentionally keeps Node/file concerns out of the pure `@flyingrobots/bijou-i18n-tools` package.
|
|
13
14
|
|
|
15
|
+
## Runtime Loader
|
|
16
|
+
|
|
17
|
+
`createCatalogBundleFileLoader()` turns locale-keyed bundle files into a
|
|
18
|
+
runtime loader for `createI18nRuntimeAsync()`:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { createI18nRuntimeAsync } from '@flyingrobots/bijou-i18n';
|
|
22
|
+
import { createCatalogBundleFileLoader } from '@flyingrobots/bijou-i18n-tools-node';
|
|
23
|
+
|
|
24
|
+
const runtime = await createI18nRuntimeAsync({
|
|
25
|
+
locale: 'fr',
|
|
26
|
+
direction: 'ltr',
|
|
27
|
+
loader: createCatalogBundleFileLoader({
|
|
28
|
+
resolvePath: (locale) => `./i18n/${locale}.json`,
|
|
29
|
+
}),
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
That gives Bijou a built-in Node file-loader path without coupling the
|
|
34
|
+
core runtime to filesystem APIs directly.
|
|
35
|
+
|
|
14
36
|
## Documentation
|
|
15
37
|
|
|
16
38
|
See the [Bijou repo](https://github.com/flyingrobots/bijou) for the full documentation map, architecture guide, and design system.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { readCatalogBundleFile, readExchangeSheetFile, readExchangeWorkbookDirectory, writeCatalogBundleFile, writeExchangeSheetFile, writeExchangeWorkbookDirectory, type WorkbookDirectoryManifest, type WorkbookDirectorySheet, } from './filesystem.js';
|
|
2
|
+
export { createCatalogBundleFileLoader, type CatalogBundleFileLoaderOptions, } from './runtime-loader.js';
|
|
2
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,6BAA6B,EAC7B,sBAAsB,EACtB,sBAAsB,EACtB,8BAA8B,EAC9B,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,GAC5B,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,6BAA6B,EAC7B,sBAAsB,EACtB,sBAAsB,EACtB,8BAA8B,EAC9B,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,GAC5B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,6BAA6B,EAC7B,KAAK,8BAA8B,GACpC,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { readCatalogBundleFile, readExchangeSheetFile, readExchangeWorkbookDirectory, writeCatalogBundleFile, writeExchangeSheetFile, writeExchangeWorkbookDirectory, } from './filesystem.js';
|
|
2
|
+
export { createCatalogBundleFileLoader, } from './runtime-loader.js';
|
|
2
3
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,6BAA6B,EAC7B,sBAAsB,EACtB,sBAAsB,EACtB,8BAA8B,GAG/B,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,6BAA6B,EAC7B,sBAAsB,EACtB,sBAAsB,EACtB,8BAA8B,GAG/B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,6BAA6B,GAE9B,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { I18nCatalog } from '@flyingrobots/bijou-i18n';
|
|
2
|
+
export interface CatalogBundleFileLoaderOptions {
|
|
3
|
+
readonly resolvePath: (locale: string) => string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Create a runtime loader that reads per-locale catalog bundle files and
|
|
7
|
+
* compiles them into runtime catalogs.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createCatalogBundleFileLoader(options: CatalogBundleFileLoaderOptions): (locale: string) => Promise<readonly I18nCatalog[]>;
|
|
10
|
+
//# sourceMappingURL=runtime-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-loader.d.ts","sourceRoot":"","sources":["../src/runtime-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAI5D,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CAClD;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,8BAA8B,GACtC,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,WAAW,EAAE,CAAC,CAKrD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { compileCatalogs, importCatalogBundle } from '@flyingrobots/bijou-i18n-tools';
|
|
2
|
+
import { readCatalogBundleFile } from './filesystem.js';
|
|
3
|
+
/**
|
|
4
|
+
* Create a runtime loader that reads per-locale catalog bundle files and
|
|
5
|
+
* compiles them into runtime catalogs.
|
|
6
|
+
*/
|
|
7
|
+
export function createCatalogBundleFileLoader(options) {
|
|
8
|
+
return async (locale) => {
|
|
9
|
+
const bundle = await readCatalogBundleFile(options.resolvePath(locale));
|
|
10
|
+
return compileCatalogs(importCatalogBundle(bundle));
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=runtime-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-loader.js","sourceRoot":"","sources":["../src/runtime-loader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAMxD;;;GAGG;AACH,MAAM,UAAU,6BAA6B,CAC3C,OAAuC;IAEvC,OAAO,KAAK,EAAE,MAAc,EAAE,EAAE;QAC9B,MAAM,MAAM,GAAG,MAAM,qBAAqB,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;QACxE,OAAO,eAAe,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC;IACtD,CAAC,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flyingrobots/bijou-i18n-tools-node",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Node filesystem helpers for Bijou localization exchange workflows.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"lint": "tsc --noEmit"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@flyingrobots/bijou-i18n
|
|
27
|
+
"@flyingrobots/bijou-i18n": "5.0.0",
|
|
28
|
+
"@flyingrobots/bijou-i18n-tools": "5.0.0"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
31
|
"@types/node": "^22.0.0",
|