@builder.io/react 2.0.10-4 → 2.0.10-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.
- 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 -9
- package/dist/lib/src/functions/safe-dynamic-require.js.map +1 -1
- package/dist/types/src/functions/safe-dynamic-require.d.ts +2 -1
- package/package.json +1 -1
- package/src/functions/safe-dynamic-require.ts +7 -10
package/dist/lib/package.json
CHANGED
|
@@ -22,16 +22,11 @@ var noop = function () { return null; };
|
|
|
22
22
|
* In Summary:
|
|
23
23
|
*
|
|
24
24
|
* 1. Node -> globalThis.require does not work
|
|
25
|
-
* 2.
|
|
26
|
-
* 3. Cloudflare edge -> only globalThis.require works
|
|
25
|
+
* 2. Cloudflare edge -> only globalThis.require works
|
|
27
26
|
*/
|
|
28
|
-
if (typeof globalThis.require === 'function' ||
|
|
29
|
-
|
|
30
|
-
exports.safeDynamicRequire =
|
|
31
|
-
var t = eval;
|
|
32
|
-
console.log(' requireing eval ', str);
|
|
33
|
-
return t('require')(str);
|
|
34
|
-
};
|
|
27
|
+
if (typeof globalThis.require === 'function' ||
|
|
28
|
+
(sdk_1.Builder.isServer && typeof require === 'function')) {
|
|
29
|
+
exports.safeDynamicRequire = eval('require');
|
|
35
30
|
}
|
|
36
31
|
exports.safeDynamicRequire !== null && exports.safeDynamicRequire !== void 0 ? exports.safeDynamicRequire : (exports.safeDynamicRequire = noop);
|
|
37
32
|
//# 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;;;AAEb,uCAA0C;AAE1C,IAAM,IAAI,GAAG,cAAM,OAAA,IAAI,EAAJ,CAAI,CAAC;AAKxB
|
|
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;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,IACE,OAAO,UAAU,CAAC,OAAO,KAAK,UAAU;IACxC,CAAC,aAAO,CAAC,QAAQ,IAAI,OAAO,OAAO,KAAK,UAAU,CAAC,EACnD;IACA,0BAAkB,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;CACtC;AAED,0BAAkB,aAAlB,0BAAkB,cAAlB,0BAAkB,IAAlB,0BAAkB,GAAK,IAAW,EAAC"}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="@types/node" />
|
|
2
|
+
export declare let safeDynamicRequire: typeof require;
|
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: typeof require;
|
|
9
9
|
|
|
10
10
|
/*
|
|
11
11
|
* The if condition below used to be
|
|
@@ -26,16 +26,13 @@ export let safeDynamicRequire: (id: string) => any;
|
|
|
26
26
|
* In Summary:
|
|
27
27
|
*
|
|
28
28
|
* 1. Node -> globalThis.require does not work
|
|
29
|
-
* 2.
|
|
30
|
-
* 3. Cloudflare edge -> only globalThis.require works
|
|
29
|
+
* 2. Cloudflare edge -> only globalThis.require works
|
|
31
30
|
*/
|
|
32
|
-
if (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return t('require')(str)
|
|
38
|
-
};
|
|
31
|
+
if (
|
|
32
|
+
typeof globalThis.require === 'function' ||
|
|
33
|
+
(Builder.isServer && typeof require === 'function')
|
|
34
|
+
) {
|
|
35
|
+
safeDynamicRequire = eval('require');
|
|
39
36
|
}
|
|
40
37
|
|
|
41
38
|
safeDynamicRequire ??= noop as any;
|