@intlayer/unmerged-dictionaries-entry 5.8.1 → 6.0.0-canary.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 +5 -5
- package/dist/cjs/index.cjs +21 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.mjs +21 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -52,26 +52,26 @@
|
|
|
52
52
|
</p>
|
|
53
53
|
</div>
|
|
54
54
|
|
|
55
|
-
# @intlayer/dictionary-entry: Retrieve Intlayer dictionaries
|
|
55
|
+
# @intlayer/unmerged-dictionary-entry: Retrieve Intlayer dictionaries
|
|
56
56
|
|
|
57
57
|
**Intlayer** is a suite of packages designed specifically for JavaScript developers. It is compatible with frameworks like React, React, and Express.js.
|
|
58
58
|
|
|
59
|
-
The **`@intlayer/dictionary-entry`** package is a NPM package that only returns the entry path of the intlayer dictionaries. Since the filesystem search is impossible from the browser, using bundlers like Webpack or Rollup to retrieve the entry path of the dictionaries is not possible. This package aims to be aliased.
|
|
59
|
+
The **`@intlayer/unmerged-dictionary-entry`** package is a NPM package that only returns the entry path of the intlayer dictionaries. Since the filesystem search is impossible from the browser, using bundlers like Webpack or Rollup to retrieve the entry path of the dictionaries is not possible. This package aims to be aliased.
|
|
60
60
|
|
|
61
61
|
## Installation
|
|
62
62
|
|
|
63
63
|
Install the necessary package using your preferred package manager:
|
|
64
64
|
|
|
65
65
|
```bash packageManager="npm"
|
|
66
|
-
npm install @intlayer/dictionary-entry
|
|
66
|
+
npm install @intlayer/unmerged-dictionary-entry
|
|
67
67
|
```
|
|
68
68
|
|
|
69
69
|
```bash packageManager="pnpm"
|
|
70
|
-
pnpm add @intlayer/dictionary-entry
|
|
70
|
+
pnpm add @intlayer/unmerged-dictionary-entry
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
```bash packageManager="yarn"
|
|
74
|
-
yarn add @intlayer/dictionary-entry
|
|
74
|
+
yarn add @intlayer/unmerged-dictionary-entry
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
## Read about Intlayer
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -25,12 +25,32 @@ module.exports = __toCommonJS(index_exports);
|
|
|
25
25
|
var import_config = require("@intlayer/config");
|
|
26
26
|
var import_fs = require("fs");
|
|
27
27
|
var import_path = require("path");
|
|
28
|
+
const clearModuleCache = (modulePath, visited = /* @__PURE__ */ new Set()) => {
|
|
29
|
+
if (visited.has(modulePath)) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
visited.add(modulePath);
|
|
33
|
+
try {
|
|
34
|
+
const resolvedPath = import_config.ESMxCJSRequire.resolve(modulePath);
|
|
35
|
+
const cachedModule = import_config.ESMxCJSRequire.cache[resolvedPath];
|
|
36
|
+
if (cachedModule) {
|
|
37
|
+
if (cachedModule.children) {
|
|
38
|
+
cachedModule.children.forEach((child) => {
|
|
39
|
+
clearModuleCache(child.filename, visited);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
delete import_config.ESMxCJSRequire.cache[resolvedPath];
|
|
43
|
+
}
|
|
44
|
+
} catch (error) {
|
|
45
|
+
console.warn(`Could not clear cache for module: ${modulePath}`, error);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
28
48
|
const getUnmergedDictionaries = () => {
|
|
29
49
|
const { content } = (0, import_config.getConfiguration)();
|
|
30
50
|
const dictionariesPath = (0, import_path.join)(content.mainDir, "unmerged_dictionaries.cjs");
|
|
31
51
|
let dictionaries = {};
|
|
32
52
|
if ((0, import_fs.existsSync)(dictionariesPath)) {
|
|
33
|
-
|
|
53
|
+
clearModuleCache(dictionariesPath);
|
|
34
54
|
dictionaries = (0, import_config.ESMxCJSRequire)(dictionariesPath);
|
|
35
55
|
}
|
|
36
56
|
return dictionaries;
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/**\n * @intlayer/unmerged-dictionaries-entry is a package that only returns the unmerged 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 { ESMxCJSRequire, getConfiguration } from '@intlayer/config';\nimport { existsSync } from 'fs';\nimport { join } from 'path';\n// @ts-ignore intlayer declared for module augmentation\nimport type { Dictionary, IntlayerDictionaryTypesConnector } from 'intlayer';\n\nexport const getUnmergedDictionaries = () => {\n const { content } = getConfiguration();\n\n const dictionariesPath = join(content.mainDir, 'unmerged_dictionaries.cjs');\n let dictionaries: Record<\n IntlayerDictionaryTypesConnector['key'],\n Dictionary[]\n > = {};\n\n if (existsSync(dictionariesPath)) {\n
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/**\n * @intlayer/unmerged-dictionaries-entry is a package that only returns the unmerged 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 { ESMxCJSRequire, getConfiguration } from '@intlayer/config';\nimport { existsSync } from 'fs';\nimport { join } from 'path';\n// @ts-ignore intlayer declared for module augmentation\nimport type { Dictionary, IntlayerDictionaryTypesConnector } from 'intlayer';\n\n/**\n * Recursively clears the require cache for a module and all its dependencies\n */\nconst clearModuleCache = (modulePath: string, visited = new Set<string>()) => {\n // Avoid infinite loops\n if (visited.has(modulePath)) {\n return;\n }\n visited.add(modulePath);\n\n try {\n const resolvedPath = ESMxCJSRequire.resolve(modulePath);\n\n // Get the cached module\n const cachedModule = ESMxCJSRequire.cache[resolvedPath];\n\n if (cachedModule) {\n // Clear cache for all children (dependencies) first\n if (cachedModule.children) {\n cachedModule.children.forEach((child) => {\n clearModuleCache(child.filename, visited);\n });\n }\n\n // Clear the cache for this module\n delete ESMxCJSRequire.cache[resolvedPath];\n }\n } catch (error) {\n // Module might not exist or be resolvable, skip it\n console.warn(`Could not clear cache for module: ${modulePath}`, error);\n }\n};\n\nexport const getUnmergedDictionaries = () => {\n const { content } = getConfiguration();\n\n const dictionariesPath = join(content.mainDir, 'unmerged_dictionaries.cjs');\n let dictionaries: Record<\n IntlayerDictionaryTypesConnector['key'],\n Dictionary[]\n > = {};\n\n if (existsSync(dictionariesPath)) {\n // Clear cache for unmerged_dictionaries.cjs and all its dependencies (JSON files)\n clearModuleCache(dictionariesPath);\n dictionaries = ESMxCJSRequire(dictionariesPath);\n }\n\n return dictionaries;\n};\n\nexport default (() => getUnmergedDictionaries())();\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,oBAAiD;AACjD,gBAA2B;AAC3B,kBAAqB;AAOrB,MAAM,mBAAmB,CAAC,YAAoB,UAAU,oBAAI,IAAY,MAAM;AAE5E,MAAI,QAAQ,IAAI,UAAU,GAAG;AAC3B;AAAA,EACF;AACA,UAAQ,IAAI,UAAU;AAEtB,MAAI;AACF,UAAM,eAAe,6BAAe,QAAQ,UAAU;AAGtD,UAAM,eAAe,6BAAe,MAAM,YAAY;AAEtD,QAAI,cAAc;AAEhB,UAAI,aAAa,UAAU;AACzB,qBAAa,SAAS,QAAQ,CAAC,UAAU;AACvC,2BAAiB,MAAM,UAAU,OAAO;AAAA,QAC1C,CAAC;AAAA,MACH;AAGA,aAAO,6BAAe,MAAM,YAAY;AAAA,IAC1C;AAAA,EACF,SAAS,OAAO;AAEd,YAAQ,KAAK,qCAAqC,UAAU,IAAI,KAAK;AAAA,EACvE;AACF;AAEO,MAAM,0BAA0B,MAAM;AAC3C,QAAM,EAAE,QAAQ,QAAI,gCAAiB;AAErC,QAAM,uBAAmB,kBAAK,QAAQ,SAAS,2BAA2B;AAC1E,MAAI,eAGA,CAAC;AAEL,UAAI,sBAAW,gBAAgB,GAAG;AAEhC,qBAAiB,gBAAgB;AACjC,uBAAe,8BAAe,gBAAgB;AAAA,EAChD;AAEA,SAAO;AACT;AAEA,IAAO,iBAAS,MAAM,wBAAwB,GAAG;","names":[]}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
import { ESMxCJSRequire, getConfiguration } from "@intlayer/config";
|
|
2
2
|
import { existsSync } from "fs";
|
|
3
3
|
import { join } from "path";
|
|
4
|
+
const clearModuleCache = (modulePath, visited = /* @__PURE__ */ new Set()) => {
|
|
5
|
+
if (visited.has(modulePath)) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
visited.add(modulePath);
|
|
9
|
+
try {
|
|
10
|
+
const resolvedPath = ESMxCJSRequire.resolve(modulePath);
|
|
11
|
+
const cachedModule = ESMxCJSRequire.cache[resolvedPath];
|
|
12
|
+
if (cachedModule) {
|
|
13
|
+
if (cachedModule.children) {
|
|
14
|
+
cachedModule.children.forEach((child) => {
|
|
15
|
+
clearModuleCache(child.filename, visited);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
delete ESMxCJSRequire.cache[resolvedPath];
|
|
19
|
+
}
|
|
20
|
+
} catch (error) {
|
|
21
|
+
console.warn(`Could not clear cache for module: ${modulePath}`, error);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
4
24
|
const getUnmergedDictionaries = () => {
|
|
5
25
|
const { content } = getConfiguration();
|
|
6
26
|
const dictionariesPath = join(content.mainDir, "unmerged_dictionaries.cjs");
|
|
7
27
|
let dictionaries = {};
|
|
8
28
|
if (existsSync(dictionariesPath)) {
|
|
9
|
-
|
|
29
|
+
clearModuleCache(dictionariesPath);
|
|
10
30
|
dictionaries = ESMxCJSRequire(dictionariesPath);
|
|
11
31
|
}
|
|
12
32
|
return dictionaries;
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/**\n * @intlayer/unmerged-dictionaries-entry is a package that only returns the unmerged 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 { ESMxCJSRequire, getConfiguration } from '@intlayer/config';\nimport { existsSync } from 'fs';\nimport { join } from 'path';\n// @ts-ignore intlayer declared for module augmentation\nimport type { Dictionary, IntlayerDictionaryTypesConnector } from 'intlayer';\n\nexport const getUnmergedDictionaries = () => {\n const { content } = getConfiguration();\n\n const dictionariesPath = join(content.mainDir, 'unmerged_dictionaries.cjs');\n let dictionaries: Record<\n IntlayerDictionaryTypesConnector['key'],\n Dictionary[]\n > = {};\n\n if (existsSync(dictionariesPath)) {\n
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/**\n * @intlayer/unmerged-dictionaries-entry is a package that only returns the unmerged 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 { ESMxCJSRequire, getConfiguration } from '@intlayer/config';\nimport { existsSync } from 'fs';\nimport { join } from 'path';\n// @ts-ignore intlayer declared for module augmentation\nimport type { Dictionary, IntlayerDictionaryTypesConnector } from 'intlayer';\n\n/**\n * Recursively clears the require cache for a module and all its dependencies\n */\nconst clearModuleCache = (modulePath: string, visited = new Set<string>()) => {\n // Avoid infinite loops\n if (visited.has(modulePath)) {\n return;\n }\n visited.add(modulePath);\n\n try {\n const resolvedPath = ESMxCJSRequire.resolve(modulePath);\n\n // Get the cached module\n const cachedModule = ESMxCJSRequire.cache[resolvedPath];\n\n if (cachedModule) {\n // Clear cache for all children (dependencies) first\n if (cachedModule.children) {\n cachedModule.children.forEach((child) => {\n clearModuleCache(child.filename, visited);\n });\n }\n\n // Clear the cache for this module\n delete ESMxCJSRequire.cache[resolvedPath];\n }\n } catch (error) {\n // Module might not exist or be resolvable, skip it\n console.warn(`Could not clear cache for module: ${modulePath}`, error);\n }\n};\n\nexport const getUnmergedDictionaries = () => {\n const { content } = getConfiguration();\n\n const dictionariesPath = join(content.mainDir, 'unmerged_dictionaries.cjs');\n let dictionaries: Record<\n IntlayerDictionaryTypesConnector['key'],\n Dictionary[]\n > = {};\n\n if (existsSync(dictionariesPath)) {\n // Clear cache for unmerged_dictionaries.cjs and all its dependencies (JSON files)\n clearModuleCache(dictionariesPath);\n dictionaries = ESMxCJSRequire(dictionariesPath);\n }\n\n return dictionaries;\n};\n\nexport default (() => getUnmergedDictionaries())();\n"],"mappings":"AAMA,SAAS,gBAAgB,wBAAwB;AACjD,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AAOrB,MAAM,mBAAmB,CAAC,YAAoB,UAAU,oBAAI,IAAY,MAAM;AAE5E,MAAI,QAAQ,IAAI,UAAU,GAAG;AAC3B;AAAA,EACF;AACA,UAAQ,IAAI,UAAU;AAEtB,MAAI;AACF,UAAM,eAAe,eAAe,QAAQ,UAAU;AAGtD,UAAM,eAAe,eAAe,MAAM,YAAY;AAEtD,QAAI,cAAc;AAEhB,UAAI,aAAa,UAAU;AACzB,qBAAa,SAAS,QAAQ,CAAC,UAAU;AACvC,2BAAiB,MAAM,UAAU,OAAO;AAAA,QAC1C,CAAC;AAAA,MACH;AAGA,aAAO,eAAe,MAAM,YAAY;AAAA,IAC1C;AAAA,EACF,SAAS,OAAO;AAEd,YAAQ,KAAK,qCAAqC,UAAU,IAAI,KAAK;AAAA,EACvE;AACF;AAEO,MAAM,0BAA0B,MAAM;AAC3C,QAAM,EAAE,QAAQ,IAAI,iBAAiB;AAErC,QAAM,mBAAmB,KAAK,QAAQ,SAAS,2BAA2B;AAC1E,MAAI,eAGA,CAAC;AAEL,MAAI,WAAW,gBAAgB,GAAG;AAEhC,qBAAiB,gBAAgB;AACjC,mBAAe,eAAe,gBAAgB;AAAA,EAChD;AAEA,SAAO;AACT;AAEA,IAAO,iBAAS,MAAM,wBAAwB,GAAG;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAoC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAoC,MAAM,UAAU,CAAC;AAmC7E,eAAO,MAAM,uBAAuB,8DAgBnC,CAAC;;AAEF,wBAAmD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/unmerged-dictionaries-entry",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0-canary.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Provides the entry path for Intlayer dictionaries, solving filesystem retrieval issues for bundlers like Webpack and Rollup.",
|
|
6
6
|
"keywords": [
|
|
@@ -53,27 +53,27 @@
|
|
|
53
53
|
"./package.json"
|
|
54
54
|
],
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@intlayer/config": "
|
|
56
|
+
"@intlayer/config": "6.0.0-canary.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/node": "^24.2.1",
|
|
60
60
|
"@typescript-eslint/parser": "^8.33.1",
|
|
61
61
|
"concurrently": "^9.1.2",
|
|
62
|
-
"eslint": "^9.
|
|
63
|
-
"prettier": "^3.
|
|
62
|
+
"eslint": "^9.34.0",
|
|
63
|
+
"prettier": "^3.6.2",
|
|
64
64
|
"rimraf": "^6.0.1",
|
|
65
65
|
"tsc-alias": "^1.8.16",
|
|
66
66
|
"tsup": "^8.5.0",
|
|
67
67
|
"typescript": "^5.9.2",
|
|
68
|
-
"vitest": "^3.2.
|
|
68
|
+
"vitest": "^3.2.4",
|
|
69
69
|
"@utils/eslint-config": "1.0.4",
|
|
70
70
|
"@utils/ts-config-types": "1.0.4",
|
|
71
71
|
"@utils/ts-config": "1.0.4",
|
|
72
72
|
"@utils/tsup-config": "1.0.4"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
|
-
"@intlayer/config": "
|
|
76
|
-
"intlayer": "
|
|
75
|
+
"@intlayer/config": "6.0.0-canary.0",
|
|
76
|
+
"intlayer": "6.0.0-canary.0"
|
|
77
77
|
},
|
|
78
78
|
"engines": {
|
|
79
79
|
"node": ">=14.18"
|