@intlayer/dictionaries-entry 1.0.1 → 1.2.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 +7 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.ts +2 -2
- package/dist/esm/index.d.mts +2 -2
- package/dist/esm/index.mjs +7 -2
- package/dist/esm/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +9 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -21,14 +21,19 @@ __export(src_exports, {
|
|
|
21
21
|
default: () => src_default
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(src_exports);
|
|
24
|
+
var import_fs = require("fs");
|
|
24
25
|
var import_module = require("module");
|
|
25
26
|
var import_path = require("path");
|
|
26
27
|
var import_config = require("@intlayer/config");
|
|
27
28
|
const import_meta = {};
|
|
28
29
|
const isESModule = typeof import_meta.url === "string";
|
|
30
|
+
let dictionaries = void 0;
|
|
29
31
|
const requireFunction = isESModule ? (0, import_module.createRequire)(import_meta.url) : require;
|
|
30
32
|
const { content } = (0, import_config.getConfiguration)();
|
|
31
33
|
const dictionariesPath = (0, import_path.join)(content.mainDir, "dictionaries.cjs");
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
if ((0, import_fs.existsSync)(dictionariesPath)) {
|
|
35
|
+
requireFunction(dictionariesPath);
|
|
36
|
+
dictionaries = requireFunction(dictionariesPath);
|
|
37
|
+
}
|
|
38
|
+
var src_default = dictionaries ?? {};
|
|
34
39
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-var-requires */\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\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 { createRequire } from 'module';\nimport { join } from 'path';\nimport { getConfiguration } from '@intlayer/config';\n\nconst isESModule = typeof import.meta.url === 'string';\n\nconst requireFunction = isESModule ? createRequire(import.meta.url) : require;\n\nconst { content } = getConfiguration();\nconst dictionariesPath = join(content.mainDir, 'dictionaries.cjs');\
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-var-requires */\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\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 'fs';\nimport { createRequire } from 'module';\nimport { join } from 'path';\nimport { getConfiguration } from '@intlayer/config';\n\nconst isESModule = typeof import.meta.url === 'string';\nlet dictionaries = undefined;\n\nconst requireFunction = isESModule ? createRequire(import.meta.url) : require;\n\nconst { content } = getConfiguration();\nconst dictionariesPath = join(content.mainDir, 'dictionaries.cjs');\n\n// Test if the dictionaries file exists\nif (existsSync(dictionariesPath)) {\n requireFunction(dictionariesPath);\n dictionaries = requireFunction(dictionariesPath);\n}\n\nexport default dictionaries ?? {};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,gBAA2B;AAC3B,oBAA8B;AAC9B,kBAAqB;AACrB,oBAAiC;AAVjC;AAYA,MAAM,aAAa,OAAO,YAAY,QAAQ;AAC9C,IAAI,eAAe;AAEnB,MAAM,kBAAkB,iBAAa,6BAAc,YAAY,GAAG,IAAI;AAEtE,MAAM,EAAE,QAAQ,QAAI,gCAAiB;AACrC,MAAM,uBAAmB,kBAAK,QAAQ,SAAS,kBAAkB;AAGjE,QAAI,sBAAW,gBAAgB,GAAG;AAChC,kBAAgB,gBAAgB;AAChC,iBAAe,gBAAgB,gBAAgB;AACjD;AAEA,IAAO,cAAQ,gBAAgB,CAAC;","names":[]}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
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
|
-
declare const
|
|
6
|
+
declare const _default: any;
|
|
7
7
|
|
|
8
|
-
export {
|
|
8
|
+
export { _default as default };
|
package/dist/esm/index.d.mts
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
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
|
-
declare const
|
|
6
|
+
declare const _default: any;
|
|
7
7
|
|
|
8
|
-
export {
|
|
8
|
+
export { _default as default };
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
|
+
import { existsSync } from "fs";
|
|
1
2
|
import { createRequire } from "module";
|
|
2
3
|
import { join } from "path";
|
|
3
4
|
import { getConfiguration } from "@intlayer/config";
|
|
4
5
|
const isESModule = typeof import.meta.url === "string";
|
|
6
|
+
let dictionaries = void 0;
|
|
5
7
|
const requireFunction = isESModule ? createRequire(import.meta.url) : require;
|
|
6
8
|
const { content } = getConfiguration();
|
|
7
9
|
const dictionariesPath = join(content.mainDir, "dictionaries.cjs");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
if (existsSync(dictionariesPath)) {
|
|
11
|
+
requireFunction(dictionariesPath);
|
|
12
|
+
dictionaries = requireFunction(dictionariesPath);
|
|
13
|
+
}
|
|
14
|
+
var src_default = dictionaries ?? {};
|
|
10
15
|
export {
|
|
11
16
|
src_default as default
|
|
12
17
|
};
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-var-requires */\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\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 { createRequire } from 'module';\nimport { join } from 'path';\nimport { getConfiguration } from '@intlayer/config';\n\nconst isESModule = typeof import.meta.url === 'string';\n\nconst requireFunction = isESModule ? createRequire(import.meta.url) : require;\n\nconst { content } = getConfiguration();\nconst dictionariesPath = join(content.mainDir, 'dictionaries.cjs');\
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-var-requires */\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\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 'fs';\nimport { createRequire } from 'module';\nimport { join } from 'path';\nimport { getConfiguration } from '@intlayer/config';\n\nconst isESModule = typeof import.meta.url === 'string';\nlet dictionaries = undefined;\n\nconst requireFunction = isESModule ? createRequire(import.meta.url) : require;\n\nconst { content } = getConfiguration();\nconst dictionariesPath = join(content.mainDir, 'dictionaries.cjs');\n\n// Test if the dictionaries file exists\nif (existsSync(dictionariesPath)) {\n requireFunction(dictionariesPath);\n dictionaries = requireFunction(dictionariesPath);\n}\n\nexport default dictionaries ?? {};\n"],"mappings":"AAOA,SAAS,kBAAkB;AAC3B,SAAS,qBAAqB;AAC9B,SAAS,YAAY;AACrB,SAAS,wBAAwB;AAEjC,MAAM,aAAa,OAAO,YAAY,QAAQ;AAC9C,IAAI,eAAe;AAEnB,MAAM,kBAAkB,aAAa,cAAc,YAAY,GAAG,IAAI;AAEtE,MAAM,EAAE,QAAQ,IAAI,iBAAiB;AACrC,MAAM,mBAAmB,KAAK,QAAQ,SAAS,kBAAkB;AAGjE,IAAI,WAAW,gBAAgB,GAAG;AAChC,kBAAgB,gBAAgB;AAChC,iBAAe,gBAAgB,gBAAgB;AACjD;AAEA,IAAO,cAAQ,gBAAgB,CAAC;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/dictionaries-entry",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "IntLayer - Dictionaries Entry. This package only returns the dictionary entry path. For bundle configuration, this packages should be replaced by using an alias.",
|
|
6
6
|
"keywords": [
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
"./package.json"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@intlayer/config": "^1.
|
|
45
|
+
"@intlayer/config": "^1.2.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@types/node": "^20.
|
|
48
|
+
"@types/node": "^20.12.7",
|
|
49
49
|
"rimraf": "5.0.5",
|
|
50
50
|
"tsup": "^8.0.2",
|
|
51
|
-
"typescript": "^5.4.
|
|
51
|
+
"typescript": "^5.4.5",
|
|
52
52
|
"@utils/eslint-config": "^1.0.1",
|
|
53
53
|
"@utils/ts-config": "^1.0.1"
|
|
54
54
|
},
|
package/src/index.ts
CHANGED
|
@@ -5,16 +5,23 @@
|
|
|
5
5
|
* The alias allow hot reload the app (such as nextjs) on any dictionary change.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import { existsSync } from 'fs';
|
|
8
9
|
import { createRequire } from 'module';
|
|
9
10
|
import { join } from 'path';
|
|
10
11
|
import { getConfiguration } from '@intlayer/config';
|
|
11
12
|
|
|
12
13
|
const isESModule = typeof import.meta.url === 'string';
|
|
14
|
+
let dictionaries = undefined;
|
|
13
15
|
|
|
14
16
|
const requireFunction = isESModule ? createRequire(import.meta.url) : require;
|
|
15
17
|
|
|
16
18
|
const { content } = getConfiguration();
|
|
17
19
|
const dictionariesPath = join(content.mainDir, 'dictionaries.cjs');
|
|
18
|
-
const dictionaries = requireFunction(dictionariesPath);
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
// Test if the dictionaries file exists
|
|
22
|
+
if (existsSync(dictionariesPath)) {
|
|
23
|
+
requireFunction(dictionariesPath);
|
|
24
|
+
dictionaries = requireFunction(dictionariesPath);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default dictionaries ?? {};
|