@intlayer/fetch-dictionaries-entry 8.4.8 → 8.4.9
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/dist/cjs/index.cjs +10 -7
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.mjs +12 -9
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/cjs/index.cjs
CHANGED
|
@@ -4,7 +4,6 @@ let node_fs = require("node:fs");
|
|
|
4
4
|
let node_path = require("node:path");
|
|
5
5
|
let _intlayer_config_built = require("@intlayer/config/built");
|
|
6
6
|
_intlayer_config_built = require_runtime.__toESM(_intlayer_config_built);
|
|
7
|
-
let _intlayer_config_utils = require("@intlayer/config/utils");
|
|
8
7
|
|
|
9
8
|
//#region src/index.ts
|
|
10
9
|
/**
|
|
@@ -13,12 +12,16 @@ let _intlayer_config_utils = require("@intlayer/config/utils");
|
|
|
13
12
|
* The alias allow hot reload the app (such as nextjs) on any dictionary change.
|
|
14
13
|
*/
|
|
15
14
|
const getDynamicDictionaries = (configuration = _intlayer_config_built.default) => {
|
|
16
|
-
const { system
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
if ((0, node_fs.existsSync)(
|
|
20
|
-
(0,
|
|
21
|
-
|
|
15
|
+
const { system } = configuration;
|
|
16
|
+
const { fetchDictionariesDir } = system;
|
|
17
|
+
const dictionaries = {};
|
|
18
|
+
if ((0, node_fs.existsSync)(fetchDictionariesDir)) {
|
|
19
|
+
const files = (0, node_fs.readdirSync)(fetchDictionariesDir).filter((file) => file.endsWith(".json"));
|
|
20
|
+
for (const file of files) {
|
|
21
|
+
const key = (0, node_path.basename)(file, (0, node_path.extname)(file));
|
|
22
|
+
const content = (0, node_fs.readFileSync)((0, node_path.join)(fetchDictionariesDir, file), "utf-8");
|
|
23
|
+
dictionaries[key] = JSON.parse(content);
|
|
24
|
+
}
|
|
22
25
|
}
|
|
23
26
|
return dictionaries;
|
|
24
27
|
};
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["config"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["config"],"sources":["../../src/index.ts"],"sourcesContent":["/**\n * @intlayer/fetch-dictionaries-entry is a package that only returns the fetch dictionary entry file.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\n\nimport { existsSync, readdirSync, readFileSync } from 'node:fs';\nimport { basename, extname, join } from 'node:path';\nimport config from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type {\n DictionaryKeys,\n StrictModeLocaleMap,\n} from '@intlayer/types/module_augmentation';\n\nexport type FetchDictionaries = Record<\n DictionaryKeys,\n StrictModeLocaleMap<Dictionary>\n>;\n\ntype GetFetchDictionaries = (\n configuration?: IntlayerConfig\n) => FetchDictionaries;\n\nexport const getDynamicDictionaries: GetFetchDictionaries = (\n configuration: IntlayerConfig = config\n) => {\n const { system } = configuration;\n const { fetchDictionariesDir } = system;\n\n const dictionaries: Record<string, any> = {};\n\n if (existsSync(fetchDictionariesDir)) {\n // Read JSON files directly to avoid require.cache memory leak\n const files = readdirSync(fetchDictionariesDir).filter((file) =>\n file.endsWith('.json')\n );\n\n for (const file of files) {\n const key = basename(file, extname(file));\n const content = readFileSync(join(fetchDictionariesDir, file), 'utf-8');\n dictionaries[key] = JSON.parse(content);\n }\n }\n\n return dictionaries as FetchDictionaries;\n};\n"],"mappings":";;;;;;;;;;;;;AAyBA,MAAa,0BACX,gBAAgCA,mCAC7B;CACH,MAAM,EAAE,WAAW;CACnB,MAAM,EAAE,yBAAyB;CAEjC,MAAM,eAAoC,EAAE;AAE5C,6BAAe,qBAAqB,EAAE;EAEpC,MAAM,iCAAoB,qBAAqB,CAAC,QAAQ,SACtD,KAAK,SAAS,QAAQ,CACvB;AAED,OAAK,MAAM,QAAQ,OAAO;GACxB,MAAM,8BAAe,6BAAc,KAAK,CAAC;GACzC,MAAM,wDAA4B,sBAAsB,KAAK,EAAE,QAAQ;AACvE,gBAAa,OAAO,KAAK,MAAM,QAAQ;;;AAI3C,QAAO"}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { existsSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
1
|
+
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
2
|
+
import { basename, extname, join } from "node:path";
|
|
3
3
|
import config from "@intlayer/config/built";
|
|
4
|
-
import { clearModuleCache, configESMxCJSRequire } from "@intlayer/config/utils";
|
|
5
4
|
|
|
6
5
|
//#region src/index.ts
|
|
7
6
|
/**
|
|
@@ -10,12 +9,16 @@ import { clearModuleCache, configESMxCJSRequire } from "@intlayer/config/utils";
|
|
|
10
9
|
* The alias allow hot reload the app (such as nextjs) on any dictionary change.
|
|
11
10
|
*/
|
|
12
11
|
const getDynamicDictionaries = (configuration = config) => {
|
|
13
|
-
const { system
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
if (existsSync(
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
const { system } = configuration;
|
|
13
|
+
const { fetchDictionariesDir } = system;
|
|
14
|
+
const dictionaries = {};
|
|
15
|
+
if (existsSync(fetchDictionariesDir)) {
|
|
16
|
+
const files = readdirSync(fetchDictionariesDir).filter((file) => file.endsWith(".json"));
|
|
17
|
+
for (const file of files) {
|
|
18
|
+
const key = basename(file, extname(file));
|
|
19
|
+
const content = readFileSync(join(fetchDictionariesDir, file), "utf-8");
|
|
20
|
+
dictionaries[key] = JSON.parse(content);
|
|
21
|
+
}
|
|
19
22
|
}
|
|
20
23
|
return dictionaries;
|
|
21
24
|
};
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/index.ts"],"sourcesContent":["/**\n * @intlayer/fetch-dictionaries-entry is a package that only returns the fetch dictionary entry file.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\n\nimport { existsSync } from 'node:fs';\nimport { join } from 'node:path';\nimport config from '@intlayer/config/built';\nimport
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/index.ts"],"sourcesContent":["/**\n * @intlayer/fetch-dictionaries-entry is a package that only returns the fetch dictionary entry file.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\n\nimport { existsSync, readdirSync, readFileSync } from 'node:fs';\nimport { basename, extname, join } from 'node:path';\nimport config from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport type {\n DictionaryKeys,\n StrictModeLocaleMap,\n} from '@intlayer/types/module_augmentation';\n\nexport type FetchDictionaries = Record<\n DictionaryKeys,\n StrictModeLocaleMap<Dictionary>\n>;\n\ntype GetFetchDictionaries = (\n configuration?: IntlayerConfig\n) => FetchDictionaries;\n\nexport const getDynamicDictionaries: GetFetchDictionaries = (\n configuration: IntlayerConfig = config\n) => {\n const { system } = configuration;\n const { fetchDictionariesDir } = system;\n\n const dictionaries: Record<string, any> = {};\n\n if (existsSync(fetchDictionariesDir)) {\n // Read JSON files directly to avoid require.cache memory leak\n const files = readdirSync(fetchDictionariesDir).filter((file) =>\n file.endsWith('.json')\n );\n\n for (const file of files) {\n const key = basename(file, extname(file));\n const content = readFileSync(join(fetchDictionariesDir, file), 'utf-8');\n dictionaries[key] = JSON.parse(content);\n }\n }\n\n return dictionaries as FetchDictionaries;\n};\n"],"mappings":";;;;;;;;;;AAyBA,MAAa,0BACX,gBAAgC,WAC7B;CACH,MAAM,EAAE,WAAW;CACnB,MAAM,EAAE,yBAAyB;CAEjC,MAAM,eAAoC,EAAE;AAE5C,KAAI,WAAW,qBAAqB,EAAE;EAEpC,MAAM,QAAQ,YAAY,qBAAqB,CAAC,QAAQ,SACtD,KAAK,SAAS,QAAQ,CACvB;AAED,OAAK,MAAM,QAAQ,OAAO;GACxB,MAAM,MAAM,SAAS,MAAM,QAAQ,KAAK,CAAC;GACzC,MAAM,UAAU,aAAa,KAAK,sBAAsB,KAAK,EAAE,QAAQ;AACvE,gBAAa,OAAO,KAAK,MAAM,QAAQ;;;AAI3C,QAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/index.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/index.ts"],"mappings":";;;;;KAgBY,iBAAA,GAAoB,MAAA,CAC9B,cAAA,EACA,mBAAA,CAAoB,UAAA;AAAA,KAGjB,oBAAA,IACH,aAAA,GAAgB,cAAA,KACb,iBAAA;AAAA,cAEQ,sBAAA,EAAwB,oBAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/fetch-dictionaries-entry",
|
|
3
|
-
"version": "8.4.
|
|
3
|
+
"version": "8.4.9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Provides the entry path for Intlayer fetch dictionaries, solving filesystem retrieval issues for bundlers like Webpack and Rollup.",
|
|
6
6
|
"keywords": [
|
|
@@ -76,9 +76,9 @@
|
|
|
76
76
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"@intlayer/config": "8.4.
|
|
80
|
-
"@intlayer/core": "8.4.
|
|
81
|
-
"@intlayer/types": "8.4.
|
|
79
|
+
"@intlayer/config": "8.4.9",
|
|
80
|
+
"@intlayer/core": "8.4.9",
|
|
81
|
+
"@intlayer/types": "8.4.9"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
84
|
"@types/node": "25.5.0",
|