@builder.io/react 2.0.10-9 → 2.0.11-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/builder-react-lite.cjs.js +1 -1
- package/dist/builder-react-lite.cjs.js.map +1 -1
- package/dist/builder-react-lite.esm.js +1 -1
- package/dist/builder-react-lite.esm.js.map +1 -1
- package/dist/builder-react.browser.js +1 -1
- package/dist/builder-react.browser.js.map +1 -1
- package/dist/builder-react.cjs.js +1 -1
- package/dist/builder-react.cjs.js.map +1 -1
- package/dist/builder-react.es5.js +1 -1
- package/dist/builder-react.es5.js.map +1 -1
- package/dist/builder-react.unpkg.js +1 -1
- package/dist/builder-react.unpkg.js.map +1 -1
- package/dist/lib/package.json +1 -1
- package/dist/lib/src/functions/is-eval-supported.js +18 -0
- package/dist/lib/src/functions/is-eval-supported.js.map +1 -0
- package/dist/lib/src/functions/safe-dynamic-require.js +3 -2
- package/dist/lib/src/functions/safe-dynamic-require.js.map +1 -1
- package/dist/types/src/functions/is-eval-supported.d.ts +1 -0
- package/package.json +1 -1
- package/src/functions/is-eval-supported.ts +13 -0
- package/src/functions/safe-dynamic-require.ts +3 -2
package/dist/lib/package.json
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isEvalSupported = void 0;
|
|
4
|
+
var supportsEval = null;
|
|
5
|
+
var isEvalSupported = function () {
|
|
6
|
+
if (supportsEval === null) {
|
|
7
|
+
try {
|
|
8
|
+
eval('true');
|
|
9
|
+
supportsEval = true;
|
|
10
|
+
}
|
|
11
|
+
catch (_a) {
|
|
12
|
+
supportsEval = false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return supportsEval;
|
|
16
|
+
};
|
|
17
|
+
exports.isEvalSupported = isEvalSupported;
|
|
18
|
+
//# sourceMappingURL=is-eval-supported.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-eval-supported.js","sourceRoot":"","sources":["../../../../src/functions/is-eval-supported.ts"],"names":[],"mappings":";;;AAAA,IAAI,YAAY,GAAmB,IAAI,CAAC;AAEjC,IAAM,eAAe,GAAG;IAC3B,IAAI,YAAY,KAAK,IAAI,EAAE;QACvB,IAAI;YACA,IAAI,CAAC,MAAM,CAAC,CAAC;YACb,YAAY,GAAG,IAAI,CAAC;SACnB;QAAC,WAAM;YACR,YAAY,GAAG,KAAK,CAAC;SACxB;KACJ;IACD,OAAO,YAAY,CAAC;AACxB,CAAC,CAAA;AAVY,QAAA,eAAe,mBAU3B"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.safeDynamicRequire = void 0;
|
|
4
4
|
var sdk_1 = require("@builder.io/sdk");
|
|
5
|
+
var is_eval_supported_1 = require("./is-eval-supported");
|
|
5
6
|
var noop = function () { return null; };
|
|
6
7
|
/*
|
|
7
8
|
* The if condition below used to be
|
|
@@ -24,8 +25,8 @@ var noop = function () { return null; };
|
|
|
24
25
|
* 1. Node -> globalThis.require does not work
|
|
25
26
|
* 2. Cloudflare edge -> only globalThis.require works
|
|
26
27
|
*/
|
|
27
|
-
if (typeof (globalThis === null || globalThis === void 0 ? void 0 : globalThis.require) === 'function' ||
|
|
28
|
-
(sdk_1.Builder.isServer && typeof require === 'function')) {
|
|
28
|
+
if ((0, is_eval_supported_1.isEvalSupported)() && (typeof (globalThis === null || globalThis === void 0 ? void 0 : globalThis.require) === 'function' ||
|
|
29
|
+
(sdk_1.Builder.isServer && typeof require === 'function'))) {
|
|
29
30
|
exports.safeDynamicRequire = eval('require');
|
|
30
31
|
}
|
|
31
32
|
exports.safeDynamicRequire !== null && exports.safeDynamicRequire !== void 0 ? exports.safeDynamicRequire : (exports.safeDynamicRequire = noop);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe-dynamic-require.js","sourceRoot":"","sources":["../../../../src/functions/safe-dynamic-require.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,uCAA0C;
|
|
1
|
+
{"version":3,"file":"safe-dynamic-require.js","sourceRoot":"","sources":["../../../../src/functions/safe-dynamic-require.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,uCAA0C;AAC1C,yDAAsD;AAEtD,IAAM,IAAI,GAAG,cAAM,OAAA,IAAI,EAAJ,CAAI,CAAC;AAKxB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,IAAK,IAAA,mCAAe,GAAE,IAAI,CACxB,OAAO,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,OAAO,CAAA,KAAK,UAAU;IACzC,CAAC,aAAO,CAAC,QAAQ,IAAI,OAAO,OAAO,KAAK,UAAU,CAAC,CACpD,EAAE;IACD,0BAAkB,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;CACtC;AAED,0BAAkB,aAAlB,0BAAkB,cAAlB,0BAAkB,IAAlB,0BAAkB,GAAK,IAAW,EAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isEvalSupported: () => boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
import { Builder } from '@builder.io/sdk';
|
|
4
|
+
import { isEvalSupported } from './is-eval-supported';
|
|
4
5
|
|
|
5
6
|
const noop = () => null;
|
|
6
7
|
// Allow us to require things dynamically safe from webpack bundling
|
|
@@ -28,10 +29,10 @@ export let safeDynamicRequire: typeof require;
|
|
|
28
29
|
* 1. Node -> globalThis.require does not work
|
|
29
30
|
* 2. Cloudflare edge -> only globalThis.require works
|
|
30
31
|
*/
|
|
31
|
-
if (
|
|
32
|
+
if ( isEvalSupported() && (
|
|
32
33
|
typeof globalThis?.require === 'function' ||
|
|
33
34
|
(Builder.isServer && typeof require === 'function')
|
|
34
|
-
) {
|
|
35
|
+
)) {
|
|
35
36
|
safeDynamicRequire = eval('require');
|
|
36
37
|
}
|
|
37
38
|
|