@intlayer/remote-dictionaries-entry 6.0.0-canary.3 → 6.0.1
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
CHANGED
|
@@ -19,7 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var index_exports = {};
|
|
20
20
|
__export(index_exports, {
|
|
21
21
|
default: () => index_default,
|
|
22
|
-
|
|
22
|
+
getRemoteDictionaries: () => getRemoteDictionaries
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(index_exports);
|
|
25
25
|
var import_config = require("@intlayer/config");
|
|
@@ -45,8 +45,8 @@ const clearModuleCache = (modulePath, visited = /* @__PURE__ */ new Set()) => {
|
|
|
45
45
|
console.warn(`Could not clear cache for module: ${modulePath}`, error);
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
const
|
|
49
|
-
const { content } =
|
|
48
|
+
const getRemoteDictionaries = (configuration = (0, import_config.getConfiguration)()) => {
|
|
49
|
+
const { content } = configuration;
|
|
50
50
|
const dictionariesPath = (0, import_path.join)(content.mainDir, "remote_dictionaries.cjs");
|
|
51
51
|
let dictionaries = {};
|
|
52
52
|
if ((0, import_fs.existsSync)(dictionariesPath)) {
|
|
@@ -55,9 +55,9 @@ const getDynamicDictionaries = () => {
|
|
|
55
55
|
}
|
|
56
56
|
return dictionaries;
|
|
57
57
|
};
|
|
58
|
-
var index_default = (() =>
|
|
58
|
+
var index_default = (() => getRemoteDictionaries())();
|
|
59
59
|
// Annotate the CommonJS export names for ESM import in node:
|
|
60
60
|
0 && (module.exports = {
|
|
61
|
-
|
|
61
|
+
getRemoteDictionaries
|
|
62
62
|
});
|
|
63
63
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// @ts-nocheck intlayer declared for module augmentation\n\n/**\n * @intlayer/dynamic-dictionaries-entry is a package that only returns the dynamic 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 {
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// @ts-nocheck intlayer declared for module augmentation\n\n/**\n * @intlayer/dynamic-dictionaries-entry is a package that only returns the dynamic 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 {\n ESMxCJSRequire,\n getConfiguration,\n type IntlayerConfig,\n} from '@intlayer/config';\nimport { existsSync } from 'fs';\nimport {\n Dictionary,\n IntlayerDictionaryTypesConnector,\n LanguageContent,\n} from 'intlayer';\nimport { join } from 'path';\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 getRemoteDictionaries = (\n configuration: IntlayerConfig = getConfiguration()\n) => {\n const { content } = configuration;\n\n const dictionariesPath = join(content.mainDir, 'remote_dictionaries.cjs');\n let dictionaries: Record<\n IntlayerDictionaryTypesConnector['key'],\n LanguageContent<Dictionary>\n > = {};\n\n if (existsSync(dictionariesPath)) {\n // Clear cache for dynamic_dictionaries.cjs and all its dependencies (JSON files)\n clearModuleCache(dictionariesPath);\n dictionaries = ESMxCJSRequire(dictionariesPath);\n }\n\n return dictionaries;\n};\n\nexport default (() => getRemoteDictionaries())();\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,oBAIO;AACP,gBAA2B;AAM3B,kBAAqB;AAKrB,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,wBAAwB,CACnC,oBAAgC,gCAAiB,MAC9C;AACH,QAAM,EAAE,QAAQ,IAAI;AAEpB,QAAM,uBAAmB,kBAAK,QAAQ,SAAS,yBAAyB;AACxE,MAAI,eAGA,CAAC;AAEL,UAAI,sBAAW,gBAAgB,GAAG;AAEhC,qBAAiB,gBAAgB;AACjC,uBAAe,8BAAe,gBAAgB;AAAA,EAChD;AAEA,SAAO;AACT;AAEA,IAAO,iBAAS,MAAM,sBAAsB,GAAG;","names":[]}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ESMxCJSRequire,
|
|
3
|
+
getConfiguration
|
|
4
|
+
} from "@intlayer/config";
|
|
2
5
|
import { existsSync } from "fs";
|
|
3
6
|
import { join } from "path";
|
|
4
7
|
const clearModuleCache = (modulePath, visited = /* @__PURE__ */ new Set()) => {
|
|
@@ -21,8 +24,8 @@ const clearModuleCache = (modulePath, visited = /* @__PURE__ */ new Set()) => {
|
|
|
21
24
|
console.warn(`Could not clear cache for module: ${modulePath}`, error);
|
|
22
25
|
}
|
|
23
26
|
};
|
|
24
|
-
const
|
|
25
|
-
const { content } =
|
|
27
|
+
const getRemoteDictionaries = (configuration = getConfiguration()) => {
|
|
28
|
+
const { content } = configuration;
|
|
26
29
|
const dictionariesPath = join(content.mainDir, "remote_dictionaries.cjs");
|
|
27
30
|
let dictionaries = {};
|
|
28
31
|
if (existsSync(dictionariesPath)) {
|
|
@@ -31,9 +34,9 @@ const getDynamicDictionaries = () => {
|
|
|
31
34
|
}
|
|
32
35
|
return dictionaries;
|
|
33
36
|
};
|
|
34
|
-
var index_default = (() =>
|
|
37
|
+
var index_default = (() => getRemoteDictionaries())();
|
|
35
38
|
export {
|
|
36
39
|
index_default as default,
|
|
37
|
-
|
|
40
|
+
getRemoteDictionaries
|
|
38
41
|
};
|
|
39
42
|
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// @ts-nocheck intlayer declared for module augmentation\n\n/**\n * @intlayer/dynamic-dictionaries-entry is a package that only returns the dynamic 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 {
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["// @ts-nocheck intlayer declared for module augmentation\n\n/**\n * @intlayer/dynamic-dictionaries-entry is a package that only returns the dynamic 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 {\n ESMxCJSRequire,\n getConfiguration,\n type IntlayerConfig,\n} from '@intlayer/config';\nimport { existsSync } from 'fs';\nimport {\n Dictionary,\n IntlayerDictionaryTypesConnector,\n LanguageContent,\n} from 'intlayer';\nimport { join } from 'path';\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 getRemoteDictionaries = (\n configuration: IntlayerConfig = getConfiguration()\n) => {\n const { content } = configuration;\n\n const dictionariesPath = join(content.mainDir, 'remote_dictionaries.cjs');\n let dictionaries: Record<\n IntlayerDictionaryTypesConnector['key'],\n LanguageContent<Dictionary>\n > = {};\n\n if (existsSync(dictionariesPath)) {\n // Clear cache for dynamic_dictionaries.cjs and all its dependencies (JSON files)\n clearModuleCache(dictionariesPath);\n dictionaries = ESMxCJSRequire(dictionariesPath);\n }\n\n return dictionaries;\n};\n\nexport default (() => getRemoteDictionaries())();\n"],"mappings":"AAQA;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP,SAAS,kBAAkB;AAM3B,SAAS,YAAY;AAKrB,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,wBAAwB,CACnC,gBAAgC,iBAAiB,MAC9C;AACH,QAAM,EAAE,QAAQ,IAAI;AAEpB,QAAM,mBAAmB,KAAK,QAAQ,SAAS,yBAAyB;AACxE,MAAI,eAGA,CAAC;AAEL,MAAI,WAAW,gBAAgB,GAAG;AAEhC,qBAAiB,gBAAgB;AACjC,mBAAe,eAAe,gBAAgB;AAAA,EAChD;AAEA,SAAO;AACT;AAEA,IAAO,iBAAS,MAAM,sBAAsB,GAAG;","names":[]}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @intlayer/dynamic-dictionaries-entry is a package that only returns the dynamic dictionary entry file.
|
|
3
|
+
* Using an external package allow to alias it in the bundle configuration (such as webpack).
|
|
4
|
+
* The alias allow hot reload the app (such as nextjs) on any dictionary change.
|
|
5
|
+
*/
|
|
6
|
+
import { type IntlayerConfig } from '@intlayer/config';
|
|
7
|
+
export declare const getRemoteDictionaries: (configuration?: IntlayerConfig) => Record<IntlayerDictionaryTypesConnector, IConfigLocales<Content>>;
|
|
2
8
|
declare const _default: Record<IntlayerDictionaryTypesConnector, IConfigLocales<Content>>;
|
|
3
9
|
export default _default;
|
|
4
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,kBAAkB,CAAC;AA0C1B,eAAO,MAAM,qBAAqB,GAChC,gBAAe,cAAmC,sEAiBnD,CAAC;;AAEF,wBAAiD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/remote-dictionaries-entry",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Provides the entry path for Intlayer remote dictionaries, solving filesystem retrieval issues for bundlers like Webpack and Rollup.",
|
|
6
6
|
"keywords": [
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"./package.json"
|
|
59
59
|
],
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@intlayer/config": "6.0.
|
|
61
|
+
"@intlayer/config": "6.0.1"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@types/node": "^24.2.1",
|
|
@@ -71,14 +71,14 @@
|
|
|
71
71
|
"tsup": "^8.5.0",
|
|
72
72
|
"typescript": "^5.9.2",
|
|
73
73
|
"vitest": "^3.2.4",
|
|
74
|
-
"@utils/ts-config-types": "1.0.4",
|
|
75
74
|
"@utils/ts-config": "1.0.4",
|
|
76
75
|
"@utils/eslint-config": "1.0.4",
|
|
76
|
+
"@utils/ts-config-types": "1.0.4",
|
|
77
77
|
"@utils/tsup-config": "1.0.4"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
80
|
-
"@intlayer/config": "6.0.
|
|
81
|
-
"intlayer": "6.0.
|
|
80
|
+
"@intlayer/config": "6.0.1",
|
|
81
|
+
"intlayer": "6.0.1"
|
|
82
82
|
},
|
|
83
83
|
"engines": {
|
|
84
84
|
"node": ">=14.18"
|