@intlayer/config 5.2.3 → 5.2.5
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.
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,24 +15,21 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
var getSandboxContext_exports = {};
|
|
30
20
|
__export(getSandboxContext_exports, {
|
|
31
21
|
getSandBoxContext: () => getSandBoxContext
|
|
32
22
|
});
|
|
33
23
|
module.exports = __toCommonJS(getSandboxContext_exports);
|
|
34
|
-
var import_react = __toESM(require("react"));
|
|
35
24
|
var import_loadEnvFile = require('./envVariables/loadEnvFile.cjs');
|
|
36
25
|
var import_ESMxCJSRequire = require('./utils/ESMxCJSRequire.cjs');
|
|
37
26
|
const getSandBoxContext = (envVarOptions) => {
|
|
27
|
+
let ReactModule;
|
|
28
|
+
try {
|
|
29
|
+
ReactModule = (0, import_ESMxCJSRequire.ESMxCJSRequire)("react");
|
|
30
|
+
} catch (err) {
|
|
31
|
+
ReactModule = void 0;
|
|
32
|
+
}
|
|
38
33
|
const sandboxContext = {
|
|
39
34
|
exports: {
|
|
40
35
|
default: {}
|
|
@@ -42,14 +37,20 @@ const getSandBoxContext = (envVarOptions) => {
|
|
|
42
37
|
module: {
|
|
43
38
|
exports: {}
|
|
44
39
|
},
|
|
45
|
-
React: import_react.default,
|
|
46
40
|
process: {
|
|
47
41
|
...process,
|
|
48
42
|
env: { ...process.env, ...(0, import_loadEnvFile.loadEnvFile)(envVarOptions) }
|
|
49
43
|
},
|
|
50
44
|
console,
|
|
51
|
-
require: import_ESMxCJSRequire.ESMxCJSRequire
|
|
45
|
+
require: import_ESMxCJSRequire.ESMxCJSRequire,
|
|
46
|
+
...ReactModule ? { React: ReactModule } : {}
|
|
47
|
+
// Only inject React if found
|
|
52
48
|
};
|
|
49
|
+
Object.getOwnPropertyNames(globalThis).forEach((key) => {
|
|
50
|
+
if (!(key in sandboxContext)) {
|
|
51
|
+
sandboxContext[key] = globalThis[key];
|
|
52
|
+
}
|
|
53
|
+
});
|
|
53
54
|
return sandboxContext;
|
|
54
55
|
};
|
|
55
56
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/getSandboxContext.ts"],"sourcesContent":["import type { Context } from 'vm';\nimport
|
|
1
|
+
{"version":3,"sources":["../../src/getSandboxContext.ts"],"sourcesContent":["import type { Context } from 'vm';\nimport {\n type LoadEnvFileOptions,\n loadEnvFile,\n} from './envVariables/loadEnvFile';\nimport { ESMxCJSRequire } from './utils/ESMxCJSRequire';\n\nexport const getSandBoxContext = (\n envVarOptions?: LoadEnvFileOptions\n): Context => {\n let ReactModule;\n\n try {\n // Dynamically try to require React if it's installed in the project\n ReactModule = ESMxCJSRequire('react');\n } catch (err) {\n // React is not installed, so we don't inject it\n ReactModule = undefined;\n }\n\n const sandboxContext: Context = {\n exports: {\n default: {},\n },\n module: {\n exports: {},\n },\n process: {\n ...process,\n env: { ...process.env, ...loadEnvFile(envVarOptions) },\n },\n console,\n require: ESMxCJSRequire,\n ...(ReactModule ? { React: ReactModule } : {}), // Only inject React if found\n };\n\n // Dynamically inject all global variables\n Object.getOwnPropertyNames(globalThis).forEach((key) => {\n if (!(key in sandboxContext)) {\n sandboxContext[key] = globalThis[key as keyof typeof globalThis];\n }\n });\n\n return sandboxContext;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,yBAGO;AACP,4BAA+B;AAExB,MAAM,oBAAoB,CAC/B,kBACY;AACZ,MAAI;AAEJ,MAAI;AAEF,sBAAc,sCAAe,OAAO;AAAA,EACtC,SAAS,KAAK;AAEZ,kBAAc;AAAA,EAChB;AAEA,QAAM,iBAA0B;AAAA,IAC9B,SAAS;AAAA,MACP,SAAS,CAAC;AAAA,IACZ;AAAA,IACA,QAAQ;AAAA,MACN,SAAS,CAAC;AAAA,IACZ;AAAA,IACA,SAAS;AAAA,MACP,GAAG;AAAA,MACH,KAAK,EAAE,GAAG,QAAQ,KAAK,OAAG,gCAAY,aAAa,EAAE;AAAA,IACvD;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,GAAI,cAAc,EAAE,OAAO,YAAY,IAAI,CAAC;AAAA;AAAA,EAC9C;AAGA,SAAO,oBAAoB,UAAU,EAAE,QAAQ,CAAC,QAAQ;AACtD,QAAI,EAAE,OAAO,iBAAiB;AAC5B,qBAAe,GAAG,IAAI,WAAW,GAA8B;AAAA,IACjE;AAAA,EACF,CAAC;AAED,SAAO;AACT;","names":[]}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import {
|
|
3
2
|
loadEnvFile
|
|
4
3
|
} from "./envVariables/loadEnvFile.mjs";
|
|
5
4
|
import { ESMxCJSRequire } from "./utils/ESMxCJSRequire.mjs";
|
|
6
5
|
const getSandBoxContext = (envVarOptions) => {
|
|
6
|
+
let ReactModule;
|
|
7
|
+
try {
|
|
8
|
+
ReactModule = ESMxCJSRequire("react");
|
|
9
|
+
} catch (err) {
|
|
10
|
+
ReactModule = void 0;
|
|
11
|
+
}
|
|
7
12
|
const sandboxContext = {
|
|
8
13
|
exports: {
|
|
9
14
|
default: {}
|
|
@@ -11,14 +16,20 @@ const getSandBoxContext = (envVarOptions) => {
|
|
|
11
16
|
module: {
|
|
12
17
|
exports: {}
|
|
13
18
|
},
|
|
14
|
-
React,
|
|
15
19
|
process: {
|
|
16
20
|
...process,
|
|
17
21
|
env: { ...process.env, ...loadEnvFile(envVarOptions) }
|
|
18
22
|
},
|
|
19
23
|
console,
|
|
20
|
-
require: ESMxCJSRequire
|
|
24
|
+
require: ESMxCJSRequire,
|
|
25
|
+
...ReactModule ? { React: ReactModule } : {}
|
|
26
|
+
// Only inject React if found
|
|
21
27
|
};
|
|
28
|
+
Object.getOwnPropertyNames(globalThis).forEach((key) => {
|
|
29
|
+
if (!(key in sandboxContext)) {
|
|
30
|
+
sandboxContext[key] = globalThis[key];
|
|
31
|
+
}
|
|
32
|
+
});
|
|
22
33
|
return sandboxContext;
|
|
23
34
|
};
|
|
24
35
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/getSandboxContext.ts"],"sourcesContent":["import type { Context } from 'vm';\nimport
|
|
1
|
+
{"version":3,"sources":["../../src/getSandboxContext.ts"],"sourcesContent":["import type { Context } from 'vm';\nimport {\n type LoadEnvFileOptions,\n loadEnvFile,\n} from './envVariables/loadEnvFile';\nimport { ESMxCJSRequire } from './utils/ESMxCJSRequire';\n\nexport const getSandBoxContext = (\n envVarOptions?: LoadEnvFileOptions\n): Context => {\n let ReactModule;\n\n try {\n // Dynamically try to require React if it's installed in the project\n ReactModule = ESMxCJSRequire('react');\n } catch (err) {\n // React is not installed, so we don't inject it\n ReactModule = undefined;\n }\n\n const sandboxContext: Context = {\n exports: {\n default: {},\n },\n module: {\n exports: {},\n },\n process: {\n ...process,\n env: { ...process.env, ...loadEnvFile(envVarOptions) },\n },\n console,\n require: ESMxCJSRequire,\n ...(ReactModule ? { React: ReactModule } : {}), // Only inject React if found\n };\n\n // Dynamically inject all global variables\n Object.getOwnPropertyNames(globalThis).forEach((key) => {\n if (!(key in sandboxContext)) {\n sandboxContext[key] = globalThis[key as keyof typeof globalThis];\n }\n });\n\n return sandboxContext;\n};\n"],"mappings":"AACA;AAAA,EAEE;AAAA,OACK;AACP,SAAS,sBAAsB;AAExB,MAAM,oBAAoB,CAC/B,kBACY;AACZ,MAAI;AAEJ,MAAI;AAEF,kBAAc,eAAe,OAAO;AAAA,EACtC,SAAS,KAAK;AAEZ,kBAAc;AAAA,EAChB;AAEA,QAAM,iBAA0B;AAAA,IAC9B,SAAS;AAAA,MACP,SAAS,CAAC;AAAA,IACZ;AAAA,IACA,QAAQ;AAAA,MACN,SAAS,CAAC;AAAA,IACZ;AAAA,IACA,SAAS;AAAA,MACP,GAAG;AAAA,MACH,KAAK,EAAE,GAAG,QAAQ,KAAK,GAAG,YAAY,aAAa,EAAE;AAAA,IACvD;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,GAAI,cAAc,EAAE,OAAO,YAAY,IAAI,CAAC;AAAA;AAAA,EAC9C;AAGA,SAAO,oBAAoB,UAAU,EAAE,QAAQ,CAAC,QAAQ;AACtD,QAAI,EAAE,OAAO,iBAAiB;AAC5B,qBAAe,GAAG,IAAI,WAAW,GAA8B;AAAA,IACjE;AAAA,EACF,CAAC;AAED,SAAO;AACT;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSandboxContext.d.ts","sourceRoot":"","sources":["../../src/getSandboxContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"getSandboxContext.d.ts","sourceRoot":"","sources":["../../src/getSandboxContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EACL,KAAK,kBAAkB,EAExB,MAAM,4BAA4B,CAAC;AAGpC,eAAO,MAAM,iBAAiB,GAC5B,gBAAgB,kBAAkB,KACjC,OAmCF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/config",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Retrieve Intlayer configurations and manage environment variables for both server-side and client-side environments.",
|
|
6
6
|
"keywords": [
|
|
@@ -83,12 +83,11 @@
|
|
|
83
83
|
"typescript": "^5.7.3",
|
|
84
84
|
"@utils/eslint-config": "1.0.4",
|
|
85
85
|
"@utils/ts-config": "1.0.4",
|
|
86
|
-
"@utils/
|
|
87
|
-
"@utils/
|
|
86
|
+
"@utils/ts-config-types": "1.0.4",
|
|
87
|
+
"@utils/tsup-config": "1.0.4"
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
|
-
"
|
|
91
|
-
"intlayer": "5.2.3"
|
|
90
|
+
"intlayer": "5.2.5"
|
|
92
91
|
},
|
|
93
92
|
"engines": {
|
|
94
93
|
"node": ">=14.18"
|