@builder.io/sdk-svelte 2.0.15 → 2.0.16
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/lib/browser/constants/sdk-version.d.ts +1 -1
- package/lib/browser/constants/sdk-version.js +1 -1
- package/lib/browser/functions/evaluate/choose-eval.js +3 -1
- package/lib/browser/functions/evaluate/node-runtime/init.js +9 -0
- package/lib/browser/functions/evaluate/should-force-browser-runtime-in-node.d.ts +3 -1
- package/lib/browser/functions/evaluate/should-force-browser-runtime-in-node.js +4 -2
- package/lib/edge/constants/sdk-version.d.ts +1 -1
- package/lib/edge/constants/sdk-version.js +1 -1
- package/lib/edge/functions/evaluate/choose-eval.js +3 -1
- package/lib/edge/functions/evaluate/node-runtime/init.js +9 -0
- package/lib/edge/functions/evaluate/should-force-browser-runtime-in-node.d.ts +3 -1
- package/lib/edge/functions/evaluate/should-force-browser-runtime-in-node.js +4 -2
- package/lib/node/constants/sdk-version.d.ts +1 -1
- package/lib/node/constants/sdk-version.js +1 -1
- package/lib/node/functions/evaluate/choose-eval.js +3 -1
- package/lib/node/functions/evaluate/node-runtime/init.js +9 -0
- package/lib/node/functions/evaluate/should-force-browser-runtime-in-node.d.ts +3 -1
- package/lib/node/functions/evaluate/should-force-browser-runtime-in-node.js +4 -2
- package/package.json +1 -1
- package/src/constants/sdk-version.ts +1 -1
- package/src/functions/evaluate/choose-eval.ts +3 -1
- package/src/functions/evaluate/node-runtime/init.ts +9 -0
- package/src/functions/evaluate/should-force-browser-runtime-in-node.ts +8 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.0.
|
|
1
|
+
export declare const SDK_VERSION = "2.0.16";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "2.0.
|
|
1
|
+
export const SDK_VERSION = "2.0.16";
|
|
@@ -21,4 +21,6 @@ import { shouldForceBrowserRuntimeInNode } from './should-force-browser-runtime-
|
|
|
21
21
|
* Even though we have separate runtimes for browser/node/edge, sometimes frameworks will
|
|
22
22
|
* end up sending the server runtime code to the browser (most notably in dev mode).
|
|
23
23
|
*/
|
|
24
|
-
export const chooseBrowserOrServerEval = (args) => isBrowser() || shouldForceBrowserRuntimeInNode(
|
|
24
|
+
export const chooseBrowserOrServerEval = (args) => isBrowser() || shouldForceBrowserRuntimeInNode({
|
|
25
|
+
shouldLogWarning: true
|
|
26
|
+
}) ? runInBrowser(args) : evaluator(args);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { shouldForceBrowserRuntimeInNode } from '../should-force-browser-runtime-in-node';
|
|
1
2
|
/**
|
|
2
3
|
* This file:
|
|
3
4
|
* - imports `isolated-vm`, which can only be made from a file that never runs
|
|
@@ -23,6 +24,14 @@ import { setIvm } from './node-runtime';
|
|
|
23
24
|
* - Qwik's `entry.ssr.tsx` file
|
|
24
25
|
*/
|
|
25
26
|
export const initializeNodeRuntime = (args) => {
|
|
27
|
+
/**
|
|
28
|
+
* skip initialization if we are on an arm64 machine and running node 20
|
|
29
|
+
*/
|
|
30
|
+
if (shouldForceBrowserRuntimeInNode({
|
|
31
|
+
shouldLogWarning: true
|
|
32
|
+
})) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
26
35
|
const { ivmIsolateOptions } = args || {};
|
|
27
36
|
setIvm(ivm, ivmIsolateOptions);
|
|
28
37
|
};
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { logger } from '../../helpers/logger';
|
|
2
2
|
import { isNodeRuntime } from '../is-node-runtime';
|
|
3
|
-
export const shouldForceBrowserRuntimeInNode = () => {
|
|
3
|
+
export const shouldForceBrowserRuntimeInNode = ({ shouldLogWarning }) => {
|
|
4
4
|
if (!isNodeRuntime())
|
|
5
5
|
return false;
|
|
6
6
|
const isArm64 = process.arch === 'arm64';
|
|
7
7
|
const isNode20 = process.version.startsWith('v20');
|
|
8
8
|
const hasNoNodeSnapshotNodeOption = process.env.NODE_OPTIONS?.includes('--no-node-snapshot');
|
|
9
9
|
if (isArm64 && isNode20 && !hasNoNodeSnapshotNodeOption) {
|
|
10
|
-
|
|
10
|
+
if (shouldLogWarning) {
|
|
11
|
+
logger.log(`Skipping usage of \`isolated-vm\` to avoid crashes in Node v20 on an arm64 machine.
|
|
11
12
|
If you would like to use the \`isolated-vm\` package on this machine, please provide the \`NODE_OPTIONS=--no-node-snapshot\` config to your Node process.
|
|
12
13
|
See https://github.com/BuilderIO/builder/blob/main/packages/sdks/README.md#node-v20--m1-macs-apple-silicon-support for more information.
|
|
13
14
|
`);
|
|
15
|
+
}
|
|
14
16
|
return true;
|
|
15
17
|
}
|
|
16
18
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.0.
|
|
1
|
+
export declare const SDK_VERSION = "2.0.16";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "2.0.
|
|
1
|
+
export const SDK_VERSION = "2.0.16";
|
|
@@ -21,4 +21,6 @@ import { shouldForceBrowserRuntimeInNode } from './should-force-browser-runtime-
|
|
|
21
21
|
* Even though we have separate runtimes for browser/node/edge, sometimes frameworks will
|
|
22
22
|
* end up sending the server runtime code to the browser (most notably in dev mode).
|
|
23
23
|
*/
|
|
24
|
-
export const chooseBrowserOrServerEval = (args) => isBrowser() || shouldForceBrowserRuntimeInNode(
|
|
24
|
+
export const chooseBrowserOrServerEval = (args) => isBrowser() || shouldForceBrowserRuntimeInNode({
|
|
25
|
+
shouldLogWarning: true
|
|
26
|
+
}) ? runInBrowser(args) : evaluator(args);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { shouldForceBrowserRuntimeInNode } from '../should-force-browser-runtime-in-node';
|
|
1
2
|
/**
|
|
2
3
|
* This file:
|
|
3
4
|
* - imports `isolated-vm`, which can only be made from a file that never runs
|
|
@@ -23,6 +24,14 @@ import { setIvm } from './node-runtime';
|
|
|
23
24
|
* - Qwik's `entry.ssr.tsx` file
|
|
24
25
|
*/
|
|
25
26
|
export const initializeNodeRuntime = (args) => {
|
|
27
|
+
/**
|
|
28
|
+
* skip initialization if we are on an arm64 machine and running node 20
|
|
29
|
+
*/
|
|
30
|
+
if (shouldForceBrowserRuntimeInNode({
|
|
31
|
+
shouldLogWarning: true
|
|
32
|
+
})) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
26
35
|
const { ivmIsolateOptions } = args || {};
|
|
27
36
|
setIvm(ivm, ivmIsolateOptions);
|
|
28
37
|
};
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { logger } from '../../helpers/logger';
|
|
2
2
|
import { isNodeRuntime } from '../is-node-runtime';
|
|
3
|
-
export const shouldForceBrowserRuntimeInNode = () => {
|
|
3
|
+
export const shouldForceBrowserRuntimeInNode = ({ shouldLogWarning }) => {
|
|
4
4
|
if (!isNodeRuntime())
|
|
5
5
|
return false;
|
|
6
6
|
const isArm64 = process.arch === 'arm64';
|
|
7
7
|
const isNode20 = process.version.startsWith('v20');
|
|
8
8
|
const hasNoNodeSnapshotNodeOption = process.env.NODE_OPTIONS?.includes('--no-node-snapshot');
|
|
9
9
|
if (isArm64 && isNode20 && !hasNoNodeSnapshotNodeOption) {
|
|
10
|
-
|
|
10
|
+
if (shouldLogWarning) {
|
|
11
|
+
logger.log(`Skipping usage of \`isolated-vm\` to avoid crashes in Node v20 on an arm64 machine.
|
|
11
12
|
If you would like to use the \`isolated-vm\` package on this machine, please provide the \`NODE_OPTIONS=--no-node-snapshot\` config to your Node process.
|
|
12
13
|
See https://github.com/BuilderIO/builder/blob/main/packages/sdks/README.md#node-v20--m1-macs-apple-silicon-support for more information.
|
|
13
14
|
`);
|
|
15
|
+
}
|
|
14
16
|
return true;
|
|
15
17
|
}
|
|
16
18
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "2.0.
|
|
1
|
+
export declare const SDK_VERSION = "2.0.16";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "2.0.
|
|
1
|
+
export const SDK_VERSION = "2.0.16";
|
|
@@ -21,4 +21,6 @@ import { shouldForceBrowserRuntimeInNode } from './should-force-browser-runtime-
|
|
|
21
21
|
* Even though we have separate runtimes for browser/node/edge, sometimes frameworks will
|
|
22
22
|
* end up sending the server runtime code to the browser (most notably in dev mode).
|
|
23
23
|
*/
|
|
24
|
-
export const chooseBrowserOrServerEval = (args) => isBrowser() || shouldForceBrowserRuntimeInNode(
|
|
24
|
+
export const chooseBrowserOrServerEval = (args) => isBrowser() || shouldForceBrowserRuntimeInNode({
|
|
25
|
+
shouldLogWarning: true
|
|
26
|
+
}) ? runInBrowser(args) : evaluator(args);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { shouldForceBrowserRuntimeInNode } from '../should-force-browser-runtime-in-node';
|
|
1
2
|
/**
|
|
2
3
|
* This file:
|
|
3
4
|
* - imports `isolated-vm`, which can only be made from a file that never runs
|
|
@@ -23,6 +24,14 @@ import { setIvm } from './node-runtime';
|
|
|
23
24
|
* - Qwik's `entry.ssr.tsx` file
|
|
24
25
|
*/
|
|
25
26
|
export const initializeNodeRuntime = (args) => {
|
|
27
|
+
/**
|
|
28
|
+
* skip initialization if we are on an arm64 machine and running node 20
|
|
29
|
+
*/
|
|
30
|
+
if (shouldForceBrowserRuntimeInNode({
|
|
31
|
+
shouldLogWarning: true
|
|
32
|
+
})) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
26
35
|
const { ivmIsolateOptions } = args || {};
|
|
27
36
|
setIvm(ivm, ivmIsolateOptions);
|
|
28
37
|
};
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { logger } from '../../helpers/logger';
|
|
2
2
|
import { isNodeRuntime } from '../is-node-runtime';
|
|
3
|
-
export const shouldForceBrowserRuntimeInNode = () => {
|
|
3
|
+
export const shouldForceBrowserRuntimeInNode = ({ shouldLogWarning }) => {
|
|
4
4
|
if (!isNodeRuntime())
|
|
5
5
|
return false;
|
|
6
6
|
const isArm64 = process.arch === 'arm64';
|
|
7
7
|
const isNode20 = process.version.startsWith('v20');
|
|
8
8
|
const hasNoNodeSnapshotNodeOption = process.env.NODE_OPTIONS?.includes('--no-node-snapshot');
|
|
9
9
|
if (isArm64 && isNode20 && !hasNoNodeSnapshotNodeOption) {
|
|
10
|
-
|
|
10
|
+
if (shouldLogWarning) {
|
|
11
|
+
logger.log(`Skipping usage of \`isolated-vm\` to avoid crashes in Node v20 on an arm64 machine.
|
|
11
12
|
If you would like to use the \`isolated-vm\` package on this machine, please provide the \`NODE_OPTIONS=--no-node-snapshot\` config to your Node process.
|
|
12
13
|
See https://github.com/BuilderIO/builder/blob/main/packages/sdks/README.md#node-v20--m1-macs-apple-silicon-support for more information.
|
|
13
14
|
`);
|
|
15
|
+
}
|
|
14
16
|
return true;
|
|
15
17
|
}
|
|
16
18
|
return false;
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "2.0.
|
|
1
|
+
export const SDK_VERSION = "2.0.16"
|
|
@@ -24,4 +24,6 @@ import { shouldForceBrowserRuntimeInNode } from './should-force-browser-runtime-
|
|
|
24
24
|
* Even though we have separate runtimes for browser/node/edge, sometimes frameworks will
|
|
25
25
|
* end up sending the server runtime code to the browser (most notably in dev mode).
|
|
26
26
|
*/
|
|
27
|
-
export const chooseBrowserOrServerEval = (args: ExecutorArgs) => isBrowser() || shouldForceBrowserRuntimeInNode(
|
|
27
|
+
export const chooseBrowserOrServerEval = (args: ExecutorArgs) => isBrowser() || shouldForceBrowserRuntimeInNode({
|
|
28
|
+
shouldLogWarning: true
|
|
29
|
+
}) ? runInBrowser(args) : evaluator(args)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { shouldForceBrowserRuntimeInNode } from '../should-force-browser-runtime-in-node';
|
|
1
2
|
/**
|
|
2
3
|
* This file:
|
|
3
4
|
* - imports `isolated-vm`, which can only be made from a file that never runs
|
|
@@ -27,6 +28,14 @@ import type { IsolateOptions } from 'isolated-vm';
|
|
|
27
28
|
export const initializeNodeRuntime = (args?: {
|
|
28
29
|
ivmIsolateOptions?: IsolateOptions;
|
|
29
30
|
}) => {
|
|
31
|
+
/**
|
|
32
|
+
* skip initialization if we are on an arm64 machine and running node 20
|
|
33
|
+
*/
|
|
34
|
+
if (shouldForceBrowserRuntimeInNode({
|
|
35
|
+
shouldLogWarning: true
|
|
36
|
+
})) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
30
39
|
const {
|
|
31
40
|
ivmIsolateOptions
|
|
32
41
|
} = args || {};
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { logger } from '../../helpers/logger';
|
|
2
2
|
import { isNodeRuntime } from '../is-node-runtime';
|
|
3
|
-
export const shouldForceBrowserRuntimeInNode = (
|
|
3
|
+
export const shouldForceBrowserRuntimeInNode = ({
|
|
4
|
+
shouldLogWarning
|
|
5
|
+
}: {
|
|
6
|
+
shouldLogWarning: boolean;
|
|
7
|
+
}) => {
|
|
4
8
|
if (!isNodeRuntime()) return false;
|
|
5
9
|
const isArm64 = process.arch === 'arm64';
|
|
6
10
|
const isNode20 = process.version.startsWith('v20');
|
|
7
11
|
const hasNoNodeSnapshotNodeOption = process.env.NODE_OPTIONS?.includes('--no-node-snapshot');
|
|
8
12
|
if (isArm64 && isNode20 && !hasNoNodeSnapshotNodeOption) {
|
|
9
|
-
|
|
13
|
+
if (shouldLogWarning) {
|
|
14
|
+
logger.log(`Skipping usage of \`isolated-vm\` to avoid crashes in Node v20 on an arm64 machine.
|
|
10
15
|
If you would like to use the \`isolated-vm\` package on this machine, please provide the \`NODE_OPTIONS=--no-node-snapshot\` config to your Node process.
|
|
11
16
|
See https://github.com/BuilderIO/builder/blob/main/packages/sdks/README.md#node-v20--m1-macs-apple-silicon-support for more information.
|
|
12
17
|
`);
|
|
18
|
+
}
|
|
13
19
|
return true;
|
|
14
20
|
}
|
|
15
21
|
return false;
|