@intlayer/dictionaries-entry 5.8.1-canary.0 → 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/dist/cjs/index.cjs +22 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.mjs +22 -2
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +14 -9
package/dist/cjs/index.cjs
CHANGED
|
@@ -25,17 +25,37 @@ 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 getDictionaries = () => {
|
|
29
49
|
const { content } = (0, import_config.getConfiguration)();
|
|
30
50
|
const dictionariesPath = (0, import_path.join)(content.mainDir, "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 ?? {};
|
|
37
57
|
};
|
|
38
|
-
var index_default = getDictionaries();
|
|
58
|
+
var index_default = (() => getDictionaries())();
|
|
39
59
|
// Annotate the CommonJS export names for ESM import in node:
|
|
40
60
|
0 && (module.exports = {
|
|
41
61
|
getDictionaries
|
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 { ESMxCJSRequire, getConfiguration } 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\nexport const getDictionaries = () => {\n const { content } = getConfiguration();\n\n const dictionariesPath = join(content.mainDir, 'dictionaries.cjs');\n\n let dictionaries = {};\n if (existsSync(dictionariesPath)) {\n
|
|
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 { ESMxCJSRequire, getConfiguration } 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 const { content } = getConfiguration();\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,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,kBAAkB,MAAM;AACnC,QAAM,EAAE,QAAQ,QAAI,gCAAiB;AAErC,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,17 +1,37 @@
|
|
|
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 getDictionaries = () => {
|
|
5
25
|
const { content } = getConfiguration();
|
|
6
26
|
const dictionariesPath = join(content.mainDir, "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 ?? {};
|
|
13
33
|
};
|
|
14
|
-
var index_default = getDictionaries();
|
|
34
|
+
var index_default = (() => getDictionaries())();
|
|
15
35
|
export {
|
|
16
36
|
index_default as default,
|
|
17
37
|
getDictionaries
|
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 { ESMxCJSRequire, getConfiguration } 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\nexport const getDictionaries = () => {\n const { content } = getConfiguration();\n\n const dictionariesPath = join(content.mainDir, 'dictionaries.cjs');\n\n let dictionaries = {};\n if (existsSync(dictionariesPath)) {\n
|
|
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 { ESMxCJSRequire, getConfiguration } 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 const { content } = getConfiguration();\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,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,kBAAkB,MAAM;AACnC,QAAM,EAAE,QAAQ,IAAI,iBAAiB;AAErC,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":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,UAAU,CAAC;AAmCjE,eAAO,MAAM,eAAe,QAaK,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": "
|
|
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": [
|
|
@@ -36,6 +36,11 @@
|
|
|
36
36
|
"require": "./dist/cjs/index.cjs",
|
|
37
37
|
"import": "./dist/esm/index.mjs"
|
|
38
38
|
},
|
|
39
|
+
"./*": {
|
|
40
|
+
"types": "./dist/types/index.d.ts",
|
|
41
|
+
"require": "./dist/cjs/index.cjs",
|
|
42
|
+
"import": "./dist/esm/index.mjs"
|
|
43
|
+
},
|
|
39
44
|
"./package.json": "./package.json"
|
|
40
45
|
},
|
|
41
46
|
"main": "dist/cjs/index.cjs",
|
|
@@ -53,27 +58,27 @@
|
|
|
53
58
|
"./package.json"
|
|
54
59
|
],
|
|
55
60
|
"dependencies": {
|
|
56
|
-
"@intlayer/config": "
|
|
61
|
+
"@intlayer/config": "6.0.0-canary.0"
|
|
57
62
|
},
|
|
58
63
|
"devDependencies": {
|
|
59
64
|
"@types/node": "^24.2.1",
|
|
60
65
|
"@typescript-eslint/parser": "^8.33.1",
|
|
61
66
|
"concurrently": "^9.1.2",
|
|
62
|
-
"eslint": "^9.
|
|
63
|
-
"prettier": "^3.
|
|
67
|
+
"eslint": "^9.34.0",
|
|
68
|
+
"prettier": "^3.6.2",
|
|
64
69
|
"rimraf": "^6.0.1",
|
|
65
70
|
"tsc-alias": "^1.8.16",
|
|
66
71
|
"tsup": "^8.5.0",
|
|
67
72
|
"typescript": "^5.9.2",
|
|
68
|
-
"vitest": "^3.2.
|
|
73
|
+
"vitest": "^3.2.4",
|
|
69
74
|
"@utils/eslint-config": "1.0.4",
|
|
70
|
-
"@utils/tsup-config": "1.0.4",
|
|
71
75
|
"@utils/ts-config": "1.0.4",
|
|
72
|
-
"@utils/ts-config-types": "1.0.4"
|
|
76
|
+
"@utils/ts-config-types": "1.0.4",
|
|
77
|
+
"@utils/tsup-config": "1.0.4"
|
|
73
78
|
},
|
|
74
79
|
"peerDependencies": {
|
|
75
|
-
"@intlayer/config": "
|
|
76
|
-
"intlayer": "
|
|
80
|
+
"@intlayer/config": "6.0.0-canary.0",
|
|
81
|
+
"intlayer": "6.0.0-canary.0"
|
|
77
82
|
},
|
|
78
83
|
"engines": {
|
|
79
84
|
"node": ">=14.18"
|