@intlayer/dictionaries-entry 8.4.6 → 8.4.7
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
|
@@ -2,9 +2,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2
2
|
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
3
|
let node_fs = require("node:fs");
|
|
4
4
|
let node_path = require("node:path");
|
|
5
|
+
let node_vm = require("node:vm");
|
|
5
6
|
let _intlayer_config_built = require("@intlayer/config/built");
|
|
6
7
|
_intlayer_config_built = require_runtime.__toESM(_intlayer_config_built);
|
|
7
|
-
let _intlayer_config_utils = require("@intlayer/config/utils");
|
|
8
8
|
|
|
9
9
|
//#region src/index.ts
|
|
10
10
|
/**
|
|
@@ -13,12 +13,14 @@ let _intlayer_config_utils = require("@intlayer/config/utils");
|
|
|
13
13
|
* The alias allow hot reload the app (such as nextjs) on any dictionary change.
|
|
14
14
|
*/
|
|
15
15
|
const getDictionaries = (configuration = _intlayer_config_built.default) => {
|
|
16
|
-
const { system
|
|
16
|
+
const { system } = configuration;
|
|
17
17
|
const dictionariesPath = (0, node_path.join)(system.mainDir, `dictionaries.cjs`);
|
|
18
18
|
let dictionaries = {};
|
|
19
19
|
if ((0, node_fs.existsSync)(dictionariesPath)) {
|
|
20
|
-
(0,
|
|
21
|
-
|
|
20
|
+
const code = (0, node_fs.readFileSync)(dictionariesPath, "utf-8");
|
|
21
|
+
const moduleObj = { exports: {} };
|
|
22
|
+
(0, node_vm.runInThisContext)(`(function(exports, require, module, __filename, __dirname) {\n${code}\n})`, { filename: dictionariesPath })(moduleObj.exports, require, moduleObj, dictionariesPath, (0, node_path.dirname)(dictionariesPath));
|
|
23
|
+
dictionaries = moduleObj.exports;
|
|
22
24
|
}
|
|
23
25
|
return dictionaries ?? {};
|
|
24
26
|
};
|
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/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 { existsSync, readFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { runInThisContext } from 'node:vm';\nimport config from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { DictionaryRegistry } from '@intlayer/types/module_augmentation';\n\ntype GetDictionaries = (configuration?: IntlayerConfig) => DictionaryRegistry;\n\nexport const getDictionaries: GetDictionaries = (\n configuration: IntlayerConfig = config\n) => {\n const { system } = configuration;\n\n const dictionariesPath = join(system.mainDir, `dictionaries.cjs`);\n\n let dictionaries = {};\n if (existsSync(dictionariesPath)) {\n // Execute directly instead of require() to avoid require.cache memory leak\n const code = readFileSync(dictionariesPath, 'utf-8');\n const moduleObj = { exports: {} as any };\n const wrappedFn = runInThisContext(\n `(function(exports, require, module, __filename, __dirname) {\\n${code}\\n})`,\n { filename: dictionariesPath }\n );\n wrappedFn(moduleObj.exports, require, moduleObj, dictionariesPath, dirname(dictionariesPath));\n dictionaries = moduleObj.exports;\n }\n\n return (dictionaries ?? {}) as DictionaryRegistry;\n};\n"],"mappings":";;;;;;;;;;;;;;AAeA,MAAa,mBACX,gBAAgCA,mCAC7B;CACH,MAAM,EAAE,WAAW;CAEnB,MAAM,uCAAwB,OAAO,SAAS,mBAAmB;CAEjE,IAAI,eAAe,EAAE;AACrB,6BAAe,iBAAiB,EAAE;EAEhC,MAAM,iCAAoB,kBAAkB,QAAQ;EACpD,MAAM,YAAY,EAAE,SAAS,EAAE,EAAS;AAKxC,gCAHE,iEAAiE,KAAK,OACtE,EAAE,UAAU,kBAAkB,CAC/B,CACS,UAAU,SAAS,SAAS,WAAW,yCAA0B,iBAAiB,CAAC;AAC7F,iBAAe,UAAU;;AAG3B,QAAQ,gBAAgB,EAAE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
|
|
3
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
4
|
+
throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
//#endregion
|
|
8
|
+
export { __require };
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { __require } from "./_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { runInThisContext } from "node:vm";
|
|
3
5
|
import config from "@intlayer/config/built";
|
|
4
|
-
import { clearModuleCache, configESMxCJSRequire } from "@intlayer/config/utils";
|
|
5
6
|
|
|
6
7
|
//#region src/index.ts
|
|
7
8
|
/**
|
|
@@ -10,12 +11,14 @@ import { clearModuleCache, configESMxCJSRequire } from "@intlayer/config/utils";
|
|
|
10
11
|
* The alias allow hot reload the app (such as nextjs) on any dictionary change.
|
|
11
12
|
*/
|
|
12
13
|
const getDictionaries = (configuration = config) => {
|
|
13
|
-
const { system
|
|
14
|
+
const { system } = configuration;
|
|
14
15
|
const dictionariesPath = join(system.mainDir, `dictionaries.cjs`);
|
|
15
16
|
let dictionaries = {};
|
|
16
17
|
if (existsSync(dictionariesPath)) {
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
const code = readFileSync(dictionariesPath, "utf-8");
|
|
19
|
+
const moduleObj = { exports: {} };
|
|
20
|
+
runInThisContext(`(function(exports, require, module, __filename, __dirname) {\n${code}\n})`, { filename: dictionariesPath })(moduleObj.exports, __require, moduleObj, dictionariesPath, dirname(dictionariesPath));
|
|
21
|
+
dictionaries = moduleObj.exports;
|
|
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/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 { existsSync } from 'node:fs';\nimport { join } from 'node:path';\nimport
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"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 { existsSync, readFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport { runInThisContext } from 'node:vm';\nimport config from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { DictionaryRegistry } from '@intlayer/types/module_augmentation';\n\ntype GetDictionaries = (configuration?: IntlayerConfig) => DictionaryRegistry;\n\nexport const getDictionaries: GetDictionaries = (\n configuration: IntlayerConfig = config\n) => {\n const { system } = configuration;\n\n const dictionariesPath = join(system.mainDir, `dictionaries.cjs`);\n\n let dictionaries = {};\n if (existsSync(dictionariesPath)) {\n // Execute directly instead of require() to avoid require.cache memory leak\n const code = readFileSync(dictionariesPath, 'utf-8');\n const moduleObj = { exports: {} as any };\n const wrappedFn = runInThisContext(\n `(function(exports, require, module, __filename, __dirname) {\\n${code}\\n})`,\n { filename: dictionariesPath }\n );\n wrappedFn(moduleObj.exports, require, moduleObj, dictionariesPath, dirname(dictionariesPath));\n dictionaries = moduleObj.exports;\n }\n\n return (dictionaries ?? {}) as DictionaryRegistry;\n};\n"],"mappings":";;;;;;;;;;;;AAeA,MAAa,mBACX,gBAAgC,WAC7B;CACH,MAAM,EAAE,WAAW;CAEnB,MAAM,mBAAmB,KAAK,OAAO,SAAS,mBAAmB;CAEjE,IAAI,eAAe,EAAE;AACrB,KAAI,WAAW,iBAAiB,EAAE;EAEhC,MAAM,OAAO,aAAa,kBAAkB,QAAQ;EACpD,MAAM,YAAY,EAAE,SAAS,EAAE,EAAS;AAKxC,EAJkB,iBAChB,iEAAiE,KAAK,OACtE,EAAE,UAAU,kBAAkB,CAC/B,CACS,UAAU,oBAAkB,WAAW,kBAAkB,QAAQ,iBAAiB,CAAC;AAC7F,iBAAe,UAAU;;AAG3B,QAAQ,gBAAgB,EAAE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/dictionaries-entry",
|
|
3
|
-
"version": "8.4.
|
|
3
|
+
"version": "8.4.7",
|
|
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": [
|
|
@@ -76,10 +76,10 @@
|
|
|
76
76
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"@intlayer/config": "8.4.
|
|
79
|
+
"@intlayer/config": "8.4.7"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"@intlayer/types": "8.4.
|
|
82
|
+
"@intlayer/types": "8.4.7",
|
|
83
83
|
"@types/node": "25.5.0",
|
|
84
84
|
"@utils/ts-config": "1.0.4",
|
|
85
85
|
"@utils/ts-config-types": "1.0.4",
|