@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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/react",
3
- "version": "2.0.10-3",
3
+ "version": "2.0.10-4",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "main": "dist/builder-react.cjs.js",
@@ -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. Client -> typeof require === 'function' does not work because of overoptimization by the compiler
26
- * 3. Cloudflare edge -> only globalThis.require works
25
+ * 2. Cloudflare edge -> only globalThis.require works
27
26
  */
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) {
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;;;;;;;;;;;;;;;;;;;;;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;QAC/B,IAAM,CAAC,GAAG,IAAI,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE,GAAG,CAAC,CAAC;QACtC,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAA;IAC1B,CAAC,CAAC;CACH;AAED,0BAAkB,aAAlB,0BAAkB,cAAlB,0BAAkB,IAAlB,0BAAkB,GAAK,IAAW,EAAC"}
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
- export declare let safeDynamicRequire: (id: string) => any;
1
+ /// <reference types="@types/node" />
2
+ export declare let safeDynamicRequire: typeof require;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/react",
3
- "version": "2.0.10-4",
3
+ "version": "2.0.10-5",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "main": "dist/builder-react.cjs.js",
@@ -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: (id: string) => any;
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. Client -> typeof require === 'function' does not work because of overoptimization by the compiler
30
- * 3. Cloudflare edge -> only globalThis.require works
29
+ * 2. Cloudflare edge -> only globalThis.require works
31
30
  */
32
- if (typeof globalThis.require === 'function' || Builder.isServer && (typeof require === 'function')) {
33
- console.log(' eval require aobut to happen ')
34
- safeDynamicRequire = (str: string) => {
35
- const t = eval;
36
- console.log(' requireing eval ', str);
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;