@builder.io/react 2.0.8-4 → 2.0.8

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.8-3",
3
+ "version": "2.0.8",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "main": "dist/builder-react.cjs.js",
@@ -1,29 +1,13 @@
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");
5
4
  var noop = function () { return null; };
6
- // Allow us to require things dynamically safe from webpack bundling
7
- var localSafeDynamicRequire;
8
5
  /*
9
6
  * The if condition below used to be if (typeof globalThis.require === "function"
10
7
  * That broke in case Builder was running on the server (Next, SSR use-cases) where
11
8
  * globalThis.require was undefined. Avoiding use of Builder.isServer for Cloudflare worker cases
12
- * That said, if we have change it to
13
- *
14
- * if (typeof require === 'function') {
15
- * localSafeDynamicRequire = eval('require');
16
- * }
17
- *
18
- * Then the TSC compiler over-optimizes and replaces the if condition with true always
19
- * causing it to blow up on the client side. Hence this convoluted way of doing it.
20
9
  */
21
- if (typeof globalThis.require === 'function') {
22
- localSafeDynamicRequire = eval('globalThis.require');
23
- }
24
- if (localSafeDynamicRequire === undefined && sdk_1.Builder.isServer) {
25
- localSafeDynamicRequire = eval('require');
26
- }
27
- localSafeDynamicRequire !== null && localSafeDynamicRequire !== void 0 ? localSafeDynamicRequire : (localSafeDynamicRequire = noop);
28
- exports.safeDynamicRequire = localSafeDynamicRequire;
10
+ if (typeof require === 'function')
11
+ exports.safeDynamicRequire = eval('require');
12
+ exports.safeDynamicRequire !== null && exports.safeDynamicRequire !== void 0 ? exports.safeDynamicRequire : (exports.safeDynamicRequire = noop);
29
13
  //# 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;AACxB,oEAAoE;AAEpE,IAAI,uBAAmD,CAAC;AAExD;;;;;;;;;;;;GAYG;AACH,IAAI,OAAO,UAAU,CAAC,OAAO,KAAK,UAAU,EAAE;IAC5C,uBAAuB,GAAG,IAAI,CAAC,oBAAoB,CAAC,CAAC;CACtD;AAED,IAAI,uBAAuB,KAAK,SAAS,IAAI,aAAO,CAAC,QAAQ,EAAE;IAC7D,uBAAuB,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;CAC3C;AAED,uBAAuB,aAAvB,uBAAuB,cAAvB,uBAAuB,IAAvB,uBAAuB,GAAK,IAAW,EAAC;AAE7B,QAAA,kBAAkB,GAAoB,uBAAyB,CAAC"}
1
+ {"version":3,"file":"safe-dynamic-require.js","sourceRoot":"","sources":["../../../../src/functions/safe-dynamic-require.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAIb,IAAM,IAAI,GAAG,cAAM,OAAA,IAAI,EAAJ,CAAI,CAAC;AAKxB;;;;GAIG;AACH,IAAI,OAAO,OAAO,KAAK,UAAU;IAAE,0BAAkB,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;AACxE,0BAAkB,aAAlB,0BAAkB,cAAlB,0BAAkB,IAAlB,0BAAkB,GAAK,IAAW,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/react",
3
- "version": "2.0.8-4",
3
+ "version": "2.0.8",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "main": "dist/builder-react.cjs.js",
@@ -5,30 +5,12 @@ 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
- let localSafeDynamicRequire: typeof require | undefined;
8
+ export let safeDynamicRequire: typeof require;
9
9
 
10
10
  /*
11
11
  * The if condition below used to be if (typeof globalThis.require === "function"
12
12
  * That broke in case Builder was running on the server (Next, SSR use-cases) where
13
13
  * globalThis.require was undefined. Avoiding use of Builder.isServer for Cloudflare worker cases
14
- * That said, if we have change it to
15
- *
16
- * if (typeof require === 'function') {
17
- * localSafeDynamicRequire = eval('require');
18
- * }
19
- *
20
- * Then the TSC compiler over-optimizes and replaces the if condition with true always
21
- * causing it to blow up on the client side. Hence this convoluted way of doing it.
22
14
  */
23
- if (typeof globalThis.require === 'function') {
24
- localSafeDynamicRequire = eval('globalThis.require');
25
- }
26
-
27
- if (localSafeDynamicRequire === undefined && Builder.isServer) {
28
- localSafeDynamicRequire = eval('require');
29
- }
30
-
31
- localSafeDynamicRequire ??= noop as any;
32
-
33
- export let safeDynamicRequire : typeof require = localSafeDynamicRequire!!;
34
-
15
+ if (typeof require === 'function') safeDynamicRequire = eval('require');
16
+ safeDynamicRequire ??= noop as any;