@builder.io/sdk-svelte 0.8.0 → 0.8.1

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 +1 @@
1
- export declare const SDK_VERSION = "0.8.0";
1
+ export declare const SDK_VERSION = "0.8.1";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.8.0";
1
+ export const SDK_VERSION = "0.8.1";
@@ -1,11 +1 @@
1
- /**
2
- * Allows us to require node-specific code safely within bundlers.
3
- *
4
- * https://github.com/laverdet/isolated-vm/issues/423
5
- *
6
- * NOTE: this code should only ever run in `node`, and never in an `edge` runtime.
7
- * This is guaranteed by the fact that each SDK has separate bundles for each runtime.
8
- * However, it might still end up running in the `browser` if the `node` bundle is loaded in the
9
- * browser (which happens in many apps' dev mode, and certain other scenarios like Qwik's prod mode).
10
- */
11
1
  export declare let safeDynamicRequire: typeof require;
@@ -1,4 +1,4 @@
1
- const noop = () => null;
1
+ const noop = () => { };
2
2
  /**
3
3
  * Allows us to require node-specific code safely within bundlers.
4
4
  *
@@ -8,11 +8,18 @@ const noop = () => null;
8
8
  * This is guaranteed by the fact that each SDK has separate bundles for each runtime.
9
9
  * However, it might still end up running in the `browser` if the `node` bundle is loaded in the
10
10
  * browser (which happens in many apps' dev mode, and certain other scenarios like Qwik's prod mode).
11
+ * This is why we catch and ignore the error at the very end.
11
12
  */
13
+ import { createRequire } from 'node:module';
12
14
  export let safeDynamicRequire = noop;
13
15
  try {
14
- safeDynamicRequire = eval('require');
16
+ safeDynamicRequire = createRequire(import.meta.url);
15
17
  }
16
18
  catch (error) {
17
- /* empty */
19
+ try {
20
+ safeDynamicRequire = eval('require');
21
+ }
22
+ catch (error) {
23
+ /* empty */
24
+ }
18
25
  }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.8.0";
1
+ export declare const SDK_VERSION = "0.8.1";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.8.0";
1
+ export const SDK_VERSION = "0.8.1";
@@ -1,11 +1 @@
1
- /**
2
- * Allows us to require node-specific code safely within bundlers.
3
- *
4
- * https://github.com/laverdet/isolated-vm/issues/423
5
- *
6
- * NOTE: this code should only ever run in `node`, and never in an `edge` runtime.
7
- * This is guaranteed by the fact that each SDK has separate bundles for each runtime.
8
- * However, it might still end up running in the `browser` if the `node` bundle is loaded in the
9
- * browser (which happens in many apps' dev mode, and certain other scenarios like Qwik's prod mode).
10
- */
11
1
  export declare let safeDynamicRequire: typeof require;
@@ -1,4 +1,4 @@
1
- const noop = () => null;
1
+ const noop = () => { };
2
2
  /**
3
3
  * Allows us to require node-specific code safely within bundlers.
4
4
  *
@@ -8,11 +8,18 @@ const noop = () => null;
8
8
  * This is guaranteed by the fact that each SDK has separate bundles for each runtime.
9
9
  * However, it might still end up running in the `browser` if the `node` bundle is loaded in the
10
10
  * browser (which happens in many apps' dev mode, and certain other scenarios like Qwik's prod mode).
11
+ * This is why we catch and ignore the error at the very end.
11
12
  */
13
+ import { createRequire } from 'node:module';
12
14
  export let safeDynamicRequire = noop;
13
15
  try {
14
- safeDynamicRequire = eval('require');
16
+ safeDynamicRequire = createRequire(import.meta.url);
15
17
  }
16
18
  catch (error) {
17
- /* empty */
19
+ try {
20
+ safeDynamicRequire = eval('require');
21
+ }
22
+ catch (error) {
23
+ /* empty */
24
+ }
18
25
  }
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.8.0";
1
+ export declare const SDK_VERSION = "0.8.1";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.8.0";
1
+ export const SDK_VERSION = "0.8.1";
@@ -1,11 +1 @@
1
- /**
2
- * Allows us to require node-specific code safely within bundlers.
3
- *
4
- * https://github.com/laverdet/isolated-vm/issues/423
5
- *
6
- * NOTE: this code should only ever run in `node`, and never in an `edge` runtime.
7
- * This is guaranteed by the fact that each SDK has separate bundles for each runtime.
8
- * However, it might still end up running in the `browser` if the `node` bundle is loaded in the
9
- * browser (which happens in many apps' dev mode, and certain other scenarios like Qwik's prod mode).
10
- */
11
1
  export declare let safeDynamicRequire: typeof require;
@@ -1,4 +1,4 @@
1
- const noop = () => null;
1
+ const noop = () => { };
2
2
  /**
3
3
  * Allows us to require node-specific code safely within bundlers.
4
4
  *
@@ -8,11 +8,18 @@ const noop = () => null;
8
8
  * This is guaranteed by the fact that each SDK has separate bundles for each runtime.
9
9
  * However, it might still end up running in the `browser` if the `node` bundle is loaded in the
10
10
  * browser (which happens in many apps' dev mode, and certain other scenarios like Qwik's prod mode).
11
+ * This is why we catch and ignore the error at the very end.
11
12
  */
13
+ import { createRequire } from 'node:module';
12
14
  export let safeDynamicRequire = noop;
13
15
  try {
14
- safeDynamicRequire = eval('require');
16
+ safeDynamicRequire = createRequire(import.meta.url);
15
17
  }
16
18
  catch (error) {
17
- /* empty */
19
+ try {
20
+ safeDynamicRequire = eval('require');
21
+ }
22
+ catch (error) {
23
+ /* empty */
24
+ }
18
25
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-svelte",
3
3
  "description": "Builder.io SDK for Svelte",
4
- "version": "0.8.0",
4
+ "version": "0.8.1",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "lib",
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.8.0"
1
+ export const SDK_VERSION = "0.8.1"
@@ -1,4 +1,4 @@
1
- const noop = () => null;
1
+ const noop = () => {};
2
2
 
3
3
  /**
4
4
  * Allows us to require node-specific code safely within bundlers.
@@ -9,10 +9,16 @@ const noop = () => null;
9
9
  * This is guaranteed by the fact that each SDK has separate bundles for each runtime.
10
10
  * However, it might still end up running in the `browser` if the `node` bundle is loaded in the
11
11
  * browser (which happens in many apps' dev mode, and certain other scenarios like Qwik's prod mode).
12
+ * This is why we catch and ignore the error at the very end.
12
13
  */
14
+ import { createRequire } from 'node:module';
13
15
  export let safeDynamicRequire: typeof require = ((noop as unknown) as typeof require);
14
16
  try {
15
- safeDynamicRequire = eval('require');
17
+ safeDynamicRequire = createRequire(import.meta.url);
16
18
  } catch (error) {
17
- /* empty */
19
+ try {
20
+ safeDynamicRequire = eval('require');
21
+ } catch (error) {
22
+ /* empty */
23
+ }
18
24
  }