@intlayer/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
|
@@ -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 getDictionaries = () => {
|
|
49
|
-
const { content } =
|
|
48
|
+
const getDictionaries = (configuration = (0, import_config.getConfiguration)()) => {
|
|
49
|
+
const { content } = configuration;
|
|
50
50
|
const dictionariesPath = (0, import_path.join)(content.mainDir, "dictionaries.cjs");
|
|
51
51
|
let dictionaries = {};
|
|
52
52
|
if ((0, import_fs.existsSync)(dictionariesPath)) {
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/**\n * @intlayer/dictionaries-entry is a package that only returns the 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":["/**\n * @intlayer/dictionaries-entry is a package that only returns the 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 { join } from 'path';\n// @ts-ignore intlayer declared for module augmentation\nimport type { 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 getDictionaries = (\n configuration: IntlayerConfig = getConfiguration()\n) => {\n const { content } = configuration;\n\n const dictionariesPath = join(content.mainDir, 'dictionaries.cjs');\n\n let dictionaries = {};\n if (existsSync(dictionariesPath)) {\n // Clear cache for dictionaries.cjs and all its dependencies (JSON files)\n clearModuleCache(dictionariesPath);\n\n dictionaries = ESMxCJSRequire(dictionariesPath);\n }\n\n return (dictionaries ?? {}) as Record<\n IntlayerDictionaryTypesConnector['key'],\n IntlayerDictionaryTypesConnector\n >;\n};\n\nexport default (() => getDictionaries())();\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,oBAIO;AACP,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,kBAAkB,CAC7B,oBAAgC,gCAAiB,MAC9C;AACH,QAAM,EAAE,QAAQ,IAAI;AAEpB,QAAM,uBAAmB,kBAAK,QAAQ,SAAS,kBAAkB;AAEjE,MAAI,eAAe,CAAC;AACpB,UAAI,sBAAW,gBAAgB,GAAG;AAEhC,qBAAiB,gBAAgB;AAEjC,uBAAe,8BAAe,gBAAgB;AAAA,EAChD;AAEA,SAAQ,gBAAgB,CAAC;AAI3B;AAEA,IAAO,iBAAS,MAAM,gBAAgB,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 getDictionaries = () => {
|
|
25
|
-
const { content } =
|
|
27
|
+
const getDictionaries = (configuration = getConfiguration()) => {
|
|
28
|
+
const { content } = configuration;
|
|
26
29
|
const dictionariesPath = join(content.mainDir, "dictionaries.cjs");
|
|
27
30
|
let dictionaries = {};
|
|
28
31
|
if (existsSync(dictionariesPath)) {
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/**\n * @intlayer/dictionaries-entry is a package that only returns the 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":["/**\n * @intlayer/dictionaries-entry is a package that only returns the 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 { join } from 'path';\n// @ts-ignore intlayer declared for module augmentation\nimport type { 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 getDictionaries = (\n configuration: IntlayerConfig = getConfiguration()\n) => {\n const { content } = configuration;\n\n const dictionariesPath = join(content.mainDir, 'dictionaries.cjs');\n\n let dictionaries = {};\n if (existsSync(dictionariesPath)) {\n // Clear cache for dictionaries.cjs and all its dependencies (JSON files)\n clearModuleCache(dictionariesPath);\n\n dictionaries = ESMxCJSRequire(dictionariesPath);\n }\n\n return (dictionaries ?? {}) as Record<\n IntlayerDictionaryTypesConnector['key'],\n IntlayerDictionaryTypesConnector\n >;\n};\n\nexport default (() => getDictionaries())();\n"],"mappings":"AAMA;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP,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,kBAAkB,CAC7B,gBAAgC,iBAAiB,MAC9C;AACH,QAAM,EAAE,QAAQ,IAAI;AAEpB,QAAM,mBAAmB,KAAK,QAAQ,SAAS,kBAAkB;AAEjE,MAAI,eAAe,CAAC;AACpB,MAAI,WAAW,gBAAgB,GAAG;AAEhC,qBAAiB,gBAAgB;AAEjC,mBAAe,eAAe,gBAAgB;AAAA,EAChD;AAEA,SAAQ,gBAAgB,CAAC;AAI3B;AAEA,IAAO,iBAAS,MAAM,gBAAgB,GAAG;","names":[]}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* Using an external package allow to alias it in the bundle configuration (such as webpack).
|
|
4
4
|
* The alias allow hot reload the app (such as nextjs) on any dictionary change.
|
|
5
5
|
*/
|
|
6
|
+
import { type IntlayerConfig } from '@intlayer/config';
|
|
6
7
|
import type { IntlayerDictionaryTypesConnector } from 'intlayer';
|
|
7
|
-
export declare const getDictionaries: () => Record<IntlayerDictionaryTypesConnector["key"], IntlayerDictionaryTypesConnector>;
|
|
8
|
+
export declare const getDictionaries: (configuration?: IntlayerConfig) => Record<IntlayerDictionaryTypesConnector["key"], IntlayerDictionaryTypesConnector>;
|
|
8
9
|
declare const _default: Record<IntlayerDictionaryTypesConnector, IntlayerDictionaryTypesConnector>;
|
|
9
10
|
export default _default;
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,UAAU,CAAC;AAmCjE,eAAO,MAAM,eAAe,GAC1B,gBAAe,cAAmC,KAcnB,MAAM,CACnC,gCAAgC,CAAC,KAAK,CAAC,EACvC,gCAAgC,CAEnC,CAAC;;AAEF,wBAA2C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/dictionaries-entry",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.1",
|
|
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": [
|
|
@@ -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": "1.0.4",
|
|
75
|
-
"@utils/tsup-config": "1.0.4",
|
|
76
74
|
"@utils/eslint-config": "1.0.4",
|
|
75
|
+
"@utils/tsup-config": "1.0.4",
|
|
76
|
+
"@utils/ts-config": "1.0.4",
|
|
77
77
|
"@utils/ts-config-types": "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"
|