@builder.io/react 2.0.10-1 → 2.0.10-3
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/safe-dynamic-require.js +4 -2
- package/dist/lib/src/functions/safe-dynamic-require.js.map +1 -1
- package/dist/types/src/functions/safe-dynamic-require.d.ts +1 -2
- package/package.json +1 -1
- package/src/functions/safe-dynamic-require.ts +4 -3
package/dist/lib/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.safeDynamicRequire = void 0;
|
|
4
|
+
var sdk_1 = require("@builder.io/sdk");
|
|
4
5
|
var noop = function () { return null; };
|
|
5
6
|
/*
|
|
6
7
|
* The if condition below used to be
|
|
@@ -24,8 +25,9 @@ var noop = function () { return null; };
|
|
|
24
25
|
* 2. Client -> typeof require === 'function' does not work because of overoptimization by the compiler
|
|
25
26
|
* 3. Cloudflare edge -> only globalThis.require works
|
|
26
27
|
*/
|
|
27
|
-
if (typeof globalThis.require === 'function' || typeof require === 'function') {
|
|
28
|
-
|
|
28
|
+
if (typeof globalThis.require === 'function' || sdk_1.Builder.isServer && (typeof require === 'function')) {
|
|
29
|
+
console.log(' eval require aobut to happen ');
|
|
30
|
+
exports.safeDynamicRequire = function (str) { return eval('require')(str); };
|
|
29
31
|
}
|
|
30
32
|
exports.safeDynamicRequire !== null && exports.safeDynamicRequire !== void 0 ? exports.safeDynamicRequire : (exports.safeDynamicRequire = noop);
|
|
31
33
|
//# sourceMappingURL=safe-dynamic-require.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe-dynamic-require.js","sourceRoot":"","sources":["../../../../src/functions/safe-dynamic-require.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;
|
|
1
|
+
{"version":3,"file":"safe-dynamic-require.js","sourceRoot":"","sources":["../../../../src/functions/safe-dynamic-require.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAEb,uCAA0C;AAE1C,IAAM,IAAI,GAAG,cAAM,OAAA,IAAI,EAAJ,CAAI,CAAC;AAKxB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,IAAI,OAAO,UAAU,CAAC,OAAO,KAAK,UAAU,IAAI,aAAO,CAAC,QAAQ,IAAI,CAAC,OAAO,OAAO,KAAK,UAAU,CAAC,EAAE;IACnG,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAA;IAC7C,0BAAkB,GAAG,UAAC,GAAW,IAAK,OAAA,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,EAApB,CAAoB,CAAC;CAC5D;AAED,0BAAkB,aAAlB,0BAAkB,cAAlB,0BAAkB,IAAlB,0BAAkB,GAAK,IAAW,EAAC"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare let safeDynamicRequire: typeof require;
|
|
1
|
+
export declare let safeDynamicRequire: (id: string) => any;
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ import { Builder } from '@builder.io/sdk';
|
|
|
5
5
|
const noop = () => null;
|
|
6
6
|
// Allow us to require things dynamically safe from webpack bundling
|
|
7
7
|
|
|
8
|
-
export let safeDynamicRequire:
|
|
8
|
+
export let safeDynamicRequire: (id: string) => any;
|
|
9
9
|
|
|
10
10
|
/*
|
|
11
11
|
* The if condition below used to be
|
|
@@ -29,8 +29,9 @@ export let safeDynamicRequire: typeof require;
|
|
|
29
29
|
* 2. Client -> typeof require === 'function' does not work because of overoptimization by the compiler
|
|
30
30
|
* 3. Cloudflare edge -> only globalThis.require works
|
|
31
31
|
*/
|
|
32
|
-
if (typeof globalThis.require === 'function' || typeof require === 'function') {
|
|
33
|
-
|
|
32
|
+
if (typeof globalThis.require === 'function' || Builder.isServer && (typeof require === 'function')) {
|
|
33
|
+
console.log(' eval require aobut to happen ')
|
|
34
|
+
safeDynamicRequire = (str: string) => eval('require')(str);
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
safeDynamicRequire ??= noop as any;
|