@builder.io/sdk-vue 2.0.26 → 2.0.28
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/{awaiter-vuM8zQLf.js → awaiter-uzRVzcZ6.js} +1 -1
- package/lib/browser/{awaiter-a3wvmfgP.cjs → awaiter-zCZ9DAMz.cjs} +1 -1
- package/lib/browser/{block-styles-n4l-jUSQ.js → block-styles-6qY_TBFM.js} +1 -1
- package/lib/browser/{block-styles-kJHBzLSK.cjs → block-styles-rFxKY8To.cjs} +1 -1
- package/lib/browser/{block-wrapper-s8-kAmNG.js → block-wrapper-3wYQPVms.js} +3 -3
- package/lib/browser/{block-wrapper-ctT8deUt.cjs → block-wrapper-uWJvqmnk.cjs} +1 -1
- package/lib/browser/blocks/columns/columns.vue.d.ts +6 -5
- package/lib/browser/{component-ref-xouuKyIf.cjs → component-ref-hBhFYTso.cjs} +1 -1
- package/lib/browser/{component-ref-gRCzH9eX.js → component-ref-xP2Elmh1.js} +3 -3
- package/lib/browser/constants/sdk-version.d.ts +1 -1
- package/lib/browser/functions/evaluate/node-runtime/setIvm.d.ts +1 -0
- package/lib/browser/{get-block-properties-W8HK92DF.js → get-block-properties-F4OIxBfF.js} +1 -1
- package/lib/browser/{get-block-properties-pZHbg-st.cjs → get-block-properties-UMUMlzuS.cjs} +1 -1
- package/lib/browser/{index-0riickyt.js → index-InL0mFtx.js} +21 -14
- package/lib/browser/{index-mN28DUmZ.cjs → index-xPtbXnZX.cjs} +3 -3
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +1 -1
- package/lib/browser/{repeated-block-VILFVYYO.cjs → repeated-block-ICKJlLUh.cjs} +1 -1
- package/lib/browser/{repeated-block-jXsbtR-B.js → repeated-block-h6wP7nUB.js} +2 -2
- package/lib/browser/style.css +1 -1
- package/lib/edge/{awaiter-S2gRZf62.cjs → awaiter-54l-bppu.cjs} +1 -1
- package/lib/edge/{awaiter-301eY6Ji.js → awaiter-hAyK-uXB.js} +1 -1
- package/lib/edge/{block-styles-za8wsXaz.js → block-styles-DQQzKxS2.js} +1 -1
- package/lib/edge/{block-styles-2W4KGVcA.cjs → block-styles-gYcphkPV.cjs} +1 -1
- package/lib/edge/{block-wrapper-Zfe24aWY.cjs → block-wrapper-MiIe7noC.cjs} +1 -1
- package/lib/edge/{block-wrapper-P1pYQvMU.js → block-wrapper-tTIzEleC.js} +3 -3
- package/lib/edge/blocks/columns/columns.vue.d.ts +6 -5
- package/lib/edge/{component-ref-W6YjT1Dn.cjs → component-ref-UwiRkPk2.cjs} +1 -1
- package/lib/edge/{component-ref-rDKU2T85.js → component-ref-kz3Obd_4.js} +3 -3
- package/lib/edge/constants/sdk-version.d.ts +1 -1
- package/lib/edge/functions/evaluate/node-runtime/setIvm.d.ts +1 -0
- package/lib/edge/{get-block-properties-ebtXorCd.js → get-block-properties-A2Pw1eVE.js} +1 -1
- package/lib/edge/{get-block-properties-HZMO7-fh.cjs → get-block-properties-mpbl9Lr0.cjs} +1 -1
- package/lib/edge/{index-PHR0gNDj.cjs → index--uXyZwlg.cjs} +3 -3
- package/lib/edge/{index-iPWGaLPH.js → index-uWdUvOrU.js} +21 -14
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +1 -1
- package/lib/{node/repeated-block-uNMQH3Ja.cjs → edge/repeated-block-AqmVXbtt.cjs} +1 -1
- package/lib/edge/{repeated-block-wucps8KR.js → repeated-block-ssAazECV.js} +2 -2
- package/lib/edge/style.css +1 -1
- package/lib/node/{awaiter-cY6UQpX_.js → awaiter-IbJnWTiA.js} +1 -1
- package/lib/node/{awaiter-hdxdo8Pj.cjs → awaiter-QAGy1jxt.cjs} +1 -1
- package/lib/node/{block-styles-lmv8e1Ze.js → block-styles-a1lNlhp2.js} +2 -2
- package/lib/node/{block-styles-2HjbBX_l.cjs → block-styles-wKqB4Ory.cjs} +1 -1
- package/lib/node/{block-wrapper-gvp5A8sk.cjs → block-wrapper-o1F5OSiJ.cjs} +1 -1
- package/lib/node/{block-wrapper-Qt2nAP7r.js → block-wrapper-qugtJ04Q.js} +3 -3
- package/lib/node/blocks/columns/columns.vue.d.ts +6 -5
- package/lib/node/{component-ref-s26PV5wr.cjs → component-ref-5Yhh77fb.cjs} +1 -1
- package/lib/node/{component-ref-3UFoBY2-.js → component-ref-NKhHeKN1.js} +3 -3
- package/lib/node/constants/sdk-version.d.ts +1 -1
- package/lib/node/functions/evaluate/node-runtime/setIvm.d.ts +1 -0
- package/lib/node/{get-block-properties-f3jVlPtG.js → get-block-properties-AIgDBI_j.js} +2 -2
- package/lib/node/{get-block-properties-xjBCy99O.cjs → get-block-properties-zbCXU1Ay.cjs} +1 -1
- package/lib/node/{index-uIW0jJ9R.cjs → index-FrElABeq.cjs} +3 -3
- package/lib/node/{index-r5J6VLgi.js → index-fGw0CDsj.js} +22 -15
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +2 -2
- package/lib/node/init.cjs +1 -1
- package/lib/node/init.mjs +1 -1
- package/lib/{edge/repeated-block-ysJic0XG.cjs → node/repeated-block-N0xlT-99.cjs} +1 -1
- package/lib/node/{repeated-block-jcwaWUEy.js → repeated-block-dqm2sVo0.js} +2 -2
- package/lib/node/{should-force-browser-runtime-in-node-k58tZzl7.cjs → should-force-browser-runtime-in-node-1vTKsoso.cjs} +3 -3
- package/lib/node/{should-force-browser-runtime-in-node-o45oecPI.js → should-force-browser-runtime-in-node-ikxWrCvn.js} +36 -34
- package/lib/node/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const node_module=require("node:module");var _documentCurrentScript=typeof document<"u"?document.currentScript:null;const TARGET="vue",MSG_PREFIX="[Builder.io]: ",logger={log:(...e)=>console.log(MSG_PREFIX,...e),error:(...e)=>console.error(MSG_PREFIX,...e),warn:(...e)=>console.warn(MSG_PREFIX,...e),debug:(...e)=>console.debug(MSG_PREFIX,...e)};function isBrowser(){return typeof window<"u"&&typeof document<"u"}const convertSearchParamsToQueryObject=e=>{const t={};return e.forEach((o,n)=>{t[n]=o}),t},normalizeSearchParams=e=>e instanceof URLSearchParams?convertSearchParamsToQueryObject(e):e,getSearchString=e=>typeof e=="string"?e:e instanceof URLSearchParams?e.toString():new URLSearchParams(e).toString();function isIframe(){return isBrowser()&&window.self!==window.top}function isEditing(e){return isIframe()&&getSearchString(e||window.location.search).indexOf("builder.frameEditing=")!==-1}const getLocation=()=>{if(isBrowser()){const e=new URL(location.href);return e.pathname===""&&(e.pathname="/"),e}else return console.warn("Cannot get location for tracking in non-browser environment"),null},getUserAgent=()=>typeof navigator=="object"&&navigator.userAgent||"",getUserAttributes=()=>{const e=getUserAgent(),t={Android(){return e.match(/Android/i)},BlackBerry(){return e.match(/BlackBerry/i)},iOS(){return e.match(/iPhone|iPod/i)},Opera(){return e.match(/Opera Mini/i)},Windows(){return e.match(/IEMobile/i)||e.match(/WPDesktop/i)},any(){return t.Android()||t.BlackBerry()||t.iOS()||t.Opera()||t.Windows()||TARGET==="reactNative"}},o=e.match(/Tablet|iPad/i),n=getLocation();return{urlPath:n==null?void 0:n.pathname,host:(n==null?void 0:n.host)||(n==null?void 0:n.hostname),device:o?"tablet":t.any()?"mobile":"desktop"}},getFunctionArguments=({builder:e,context:t,event:o,state:n})=>Object.entries({state:n,Builder:e,builder:e,context:t,event:o}),getBuilderGlobals=()=>({isEditing:isEditing(),isBrowser:isBrowser(),isServer:!isBrowser(),getUserAttributes:()=>getUserAttributes()}),parseCode=(e,{isExpression:t=!0})=>t&&!(e.includes(";")||e.includes(" return ")||e.trim().startsWith("return "))?`return (${e});`:e;function flattenState({rootState:e,localState:t,rootSetState:o}){return new Proxy(e,{get:(n,r)=>{if(t&&r in t)return t[r];const s=n[r];return typeof s=="object"&&s!==null?flattenState({rootState:s,localState:void 0,rootSetState:o?i=>{n[r]=i,o(n)}:void 0}):s},set:(n,r,s)=>{if(t&&r in t)throw new Error("Writing to local state is not allowed as it is read-only.");return n[r]=s,o==null||o(n),!0}})}const SDK_NAME_FOR_TARGET=(()=>{switch(TARGET){case"rsc":return"react-nextjs";case"reactNative":return"react-native";default:return TARGET}})(),SDK_NAME=`@builder.io/sdk-${SDK_NAME_FOR_TARGET}`,fastClone=e=>JSON.parse(JSON.stringify(e)),set=(e,t,o)=>{if(Object(e)!==e)return e;const n=Array.isArray(t)?t:t.toString().match(/[^.[\]]+/g);return n.slice(0,-1).reduce((r,s,i)=>Object(r[s])===r[s]?r[s]:r[s]=Math.abs(Number(n[i+1]))>>0===+n[i+1]?[]:{},e)[n[n.length-1]]=o,e},noop=()=>{};let safeDynamicRequire=noop;try{safeDynamicRequire=node_module.createRequire(typeof document>"u"?require("url").pathToFileURL(__filename).href:_documentCurrentScript&&_documentCurrentScript.src||new URL("should-force-browser-runtime-in-node-
|
|
1
|
+
"use strict";const node_module=require("node:module");var _documentCurrentScript=typeof document<"u"?document.currentScript:null;const TARGET="vue",MSG_PREFIX="[Builder.io]: ",logger={log:(...e)=>console.log(MSG_PREFIX,...e),error:(...e)=>console.error(MSG_PREFIX,...e),warn:(...e)=>console.warn(MSG_PREFIX,...e),debug:(...e)=>console.debug(MSG_PREFIX,...e)};function isBrowser(){return typeof window<"u"&&typeof document<"u"}const convertSearchParamsToQueryObject=e=>{const t={};return e.forEach((o,n)=>{t[n]=o}),t},normalizeSearchParams=e=>e instanceof URLSearchParams?convertSearchParamsToQueryObject(e):e,getSearchString=e=>typeof e=="string"?e:e instanceof URLSearchParams?e.toString():new URLSearchParams(e).toString();function isIframe(){return isBrowser()&&window.self!==window.top}function isEditing(e){return isIframe()&&getSearchString(e||window.location.search).indexOf("builder.frameEditing=")!==-1}const getLocation=()=>{if(isBrowser()){const e=new URL(location.href);return e.pathname===""&&(e.pathname="/"),e}else return console.warn("Cannot get location for tracking in non-browser environment"),null},getUserAgent=()=>typeof navigator=="object"&&navigator.userAgent||"",getUserAttributes=()=>{const e=getUserAgent(),t={Android(){return e.match(/Android/i)},BlackBerry(){return e.match(/BlackBerry/i)},iOS(){return e.match(/iPhone|iPod/i)},Opera(){return e.match(/Opera Mini/i)},Windows(){return e.match(/IEMobile/i)||e.match(/WPDesktop/i)},any(){return t.Android()||t.BlackBerry()||t.iOS()||t.Opera()||t.Windows()||TARGET==="reactNative"}},o=e.match(/Tablet|iPad/i),n=getLocation();return{urlPath:n==null?void 0:n.pathname,host:(n==null?void 0:n.host)||(n==null?void 0:n.hostname),device:o?"tablet":t.any()?"mobile":"desktop"}},getFunctionArguments=({builder:e,context:t,event:o,state:n})=>Object.entries({state:n,Builder:e,builder:e,context:t,event:o}),getBuilderGlobals=()=>({isEditing:isEditing(),isBrowser:isBrowser(),isServer:!isBrowser(),getUserAttributes:()=>getUserAttributes()}),parseCode=(e,{isExpression:t=!0})=>t&&!(e.includes(";")||e.includes(" return ")||e.trim().startsWith("return "))?`return (${e});`:e;function flattenState({rootState:e,localState:t,rootSetState:o}){return new Proxy(e,{get:(n,r)=>{if(t&&r in t)return t[r];const s=n[r];return typeof s=="object"&&s!==null?flattenState({rootState:s,localState:void 0,rootSetState:o?i=>{n[r]=i,o(n)}:void 0}):s},set:(n,r,s)=>{if(t&&r in t)throw new Error("Writing to local state is not allowed as it is read-only.");return n[r]=s,o==null||o(n),!0}})}const SDK_NAME_FOR_TARGET=(()=>{switch(TARGET){case"rsc":return"react-nextjs";case"reactNative":return"react-native";default:return TARGET}})(),SDK_NAME=`@builder.io/sdk-${SDK_NAME_FOR_TARGET}`,fastClone=e=>JSON.parse(JSON.stringify(e)),set=(e,t,o)=>{if(Object(e)!==e)return e;const n=Array.isArray(t)?t:t.toString().match(/[^.[\]]+/g);return n.slice(0,-1).reduce((r,s,i)=>Object(r[s])===r[s]?r[s]:r[s]=Math.abs(Number(n[i+1]))>>0===+n[i+1]?[]:{},e)[n[n.length-1]]=o,e},noop=()=>{};let safeDynamicRequire=noop;try{safeDynamicRequire=node_module.createRequire(typeof document>"u"?require("url").pathToFileURL(__filename).href:_documentCurrentScript&&_documentCurrentScript.src||new URL("should-force-browser-runtime-in-node-1vTKsoso.cjs",document.baseURI).href)}catch(error){try{safeDynamicRequire=eval("require")}catch(e){}}const getSyncValName=e=>`bldr_${e}_sync`,BUILDER_SET_STATE_NAME="BUILDER_SET_STATE",INJECTED_IVM_GLOBAL="BUILDER_IVM",REF_TO_PROXY_FN=`
|
|
2
2
|
var refToProxy = (obj) => {
|
|
3
3
|
if (typeof obj !== 'object' || obj === null) {
|
|
4
4
|
return obj;
|
|
@@ -38,11 +38,11 @@ if (typeof output === 'object' && output !== null) {
|
|
|
38
38
|
} else {
|
|
39
39
|
return output;
|
|
40
40
|
}
|
|
41
|
-
`};let IVM_INSTANCE=null,IVM_CONTEXT=null;const setIvm=(e,t={})=>{IVM_INSTANCE=e,setIsolateContext(t)},SHOULD_MENTION_INITIALIZE_SCRIPT=SDK_NAME==="@builder.io/sdk-react-nextjs"||SDK_NAME==="@builder.io/sdk-react"||SDK_NAME==="@builder.io/sdk-qwik"||SDK_NAME==="@builder.io/sdk-vue",getIvm=()=>{try{if(IVM_INSTANCE)return IVM_INSTANCE;const t=safeDynamicRequire("isolated-vm");if(t)return t}catch(t){logger.error("isolated-vm import error.",t)}const e=`${MSG_PREFIX}could not import \`isolated-vm\` module for safe script execution on a Node server.
|
|
41
|
+
`};let IVM_INSTANCE=null,IVM_CONTEXT=null;const setIvm=(e,t={})=>{IVM_INSTANCE||(IVM_INSTANCE=e,setIsolateContext(t))},SHOULD_MENTION_INITIALIZE_SCRIPT=SDK_NAME==="@builder.io/sdk-react-nextjs"||SDK_NAME==="@builder.io/sdk-react"||SDK_NAME==="@builder.io/sdk-qwik"||SDK_NAME==="@builder.io/sdk-vue",getIvm=()=>{try{if(IVM_INSTANCE)return IVM_INSTANCE;const t=safeDynamicRequire("isolated-vm");if(t)return t}catch(t){logger.error("isolated-vm import error.",t)}const e=`${MSG_PREFIX}could not import \`isolated-vm\` module for safe script execution on a Node server.
|
|
42
42
|
|
|
43
43
|
SOLUTION: In a server-only execution path within your application, do one of the following:
|
|
44
44
|
|
|
45
45
|
${SHOULD_MENTION_INITIALIZE_SCRIPT?`- import and call \`initializeNodeRuntime()\` from "${SDK_NAME}/node/init".`:""}
|
|
46
46
|
- add the following import: \`await import('isolated-vm')\`.
|
|
47
47
|
|
|
48
|
-
For more information, visit https://builder.io/c/docs/integration-tips#enabling-data-bindings-in-node-environments`;throw new Error(e)};function setIsolateContext(e={memoryLimit:128}){const t=getIvm(),n=new t.Isolate(e).createContextSync(),r=n.global;return r.setSync("global",r.derefInto()),r.setSync("log",function(...s){console.log(...s)}),r.setSync(INJECTED_IVM_GLOBAL,t),IVM_CONTEXT=n,n}const getIsolateContext=()=>
|
|
48
|
+
For more information, visit https://builder.io/c/docs/integration-tips#enabling-data-bindings-in-node-environments`;throw new Error(e)};function setIsolateContext(e={memoryLimit:128}){if(IVM_CONTEXT)return IVM_CONTEXT;const t=getIvm(),n=new t.Isolate(e).createContextSync(),r=n.global;return r.setSync("global",r.derefInto()),r.setSync("log",function(...s){console.log(...s)}),r.setSync(INJECTED_IVM_GLOBAL,t),IVM_CONTEXT=n,n}const getIsolateContext=()=>setIsolateContext(),runInNode=({code:e,builder:t,context:o,event:n,localState:r,rootSetState:s,rootState:i})=>{const m=getIvm(),g=fastClone({...i,...r}),a=getFunctionArguments({builder:t,context:o,event:n,state:g}),l=getIsolateContext(),d=l.global;d.setSync(BUILDER_SET_STATE_NAME,function(c,u){set(i,c,u),s==null||s(i)}),a.forEach(([c,u])=>{const I=typeof u=="object"?new m.Reference(c==="builder"?{...u,getUserAttributes:()=>u.getUserAttributes()}:u):null;d.setSync(getSyncValName(c),I)});const p=processCode({code:e,args:a}),f=l.evalClosureSync(p);try{return JSON.parse(f)}catch{return f}},checkIsDefined=e=>e!=null;function isNodeRuntime(){var e;return typeof process<"u"&&checkIsDefined((e=process==null?void 0:process.versions)==null?void 0:e.node)}const shouldForceBrowserRuntimeInNode=({shouldLogWarning:e})=>{var r;if(!isNodeRuntime())return!1;const t=process.arch==="arm64",o=process.version.startsWith("v20"),n=(r=process.env.NODE_OPTIONS)==null?void 0:r.includes("--no-node-snapshot");return t&&o&&!n?(e&&logger.log("Skipping usage of `isolated-vm` to avoid crashes in Node v20 on an arm64 machine.\n 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.\n See https://github.com/BuilderIO/builder/blob/main/packages/sdks/README.md#node-v20--m1-macs-apple-silicon-support for more information.\n "),!0):!1};exports.TARGET=TARGET;exports.checkIsDefined=checkIsDefined;exports.fastClone=fastClone;exports.flattenState=flattenState;exports.getBuilderGlobals=getBuilderGlobals;exports.getFunctionArguments=getFunctionArguments;exports.getSearchString=getSearchString;exports.getUserAttributes=getUserAttributes;exports.isBrowser=isBrowser;exports.isEditing=isEditing;exports.logger=logger;exports.normalizeSearchParams=normalizeSearchParams;exports.parseCode=parseCode;exports.runInNode=runInNode;exports.set=set;exports.setIvm=setIvm;exports.shouldForceBrowserRuntimeInNode=shouldForceBrowserRuntimeInNode;
|
|
@@ -10,8 +10,8 @@ function isBrowser() {
|
|
|
10
10
|
}
|
|
11
11
|
const convertSearchParamsToQueryObject = (e) => {
|
|
12
12
|
const t = {};
|
|
13
|
-
return e.forEach((
|
|
14
|
-
t[n] =
|
|
13
|
+
return e.forEach((o, n) => {
|
|
14
|
+
t[n] = o;
|
|
15
15
|
}), t;
|
|
16
16
|
}, normalizeSearchParams = (e) => e instanceof URLSearchParams ? convertSearchParamsToQueryObject(e) : e, getSearchString = (e) => typeof e == "string" ? e : e instanceof URLSearchParams ? e.toString() : new URLSearchParams(e).toString();
|
|
17
17
|
function isIframe() {
|
|
@@ -47,16 +47,16 @@ const getLocation = () => {
|
|
|
47
47
|
any() {
|
|
48
48
|
return t.Android() || t.BlackBerry() || t.iOS() || t.Opera() || t.Windows() || TARGET === "reactNative";
|
|
49
49
|
}
|
|
50
|
-
},
|
|
50
|
+
}, o = e.match(/Tablet|iPad/i), n = getLocation();
|
|
51
51
|
return {
|
|
52
52
|
urlPath: n == null ? void 0 : n.pathname,
|
|
53
53
|
host: (n == null ? void 0 : n.host) || (n == null ? void 0 : n.hostname),
|
|
54
|
-
device:
|
|
54
|
+
device: o ? "tablet" : t.any() ? "mobile" : "desktop"
|
|
55
55
|
};
|
|
56
56
|
}, getFunctionArguments = ({
|
|
57
57
|
builder: e,
|
|
58
58
|
context: t,
|
|
59
|
-
event:
|
|
59
|
+
event: o,
|
|
60
60
|
state: n
|
|
61
61
|
}) => Object.entries({
|
|
62
62
|
state: n,
|
|
@@ -64,7 +64,7 @@ const getLocation = () => {
|
|
|
64
64
|
// legacy
|
|
65
65
|
builder: e,
|
|
66
66
|
context: t,
|
|
67
|
-
event:
|
|
67
|
+
event: o
|
|
68
68
|
}), getBuilderGlobals = () => ({
|
|
69
69
|
isEditing: isEditing(),
|
|
70
70
|
isBrowser: isBrowser(),
|
|
@@ -76,25 +76,25 @@ const getLocation = () => {
|
|
|
76
76
|
function flattenState({
|
|
77
77
|
rootState: e,
|
|
78
78
|
localState: t,
|
|
79
|
-
rootSetState:
|
|
79
|
+
rootSetState: o
|
|
80
80
|
}) {
|
|
81
81
|
return new Proxy(e, {
|
|
82
|
-
get: (n,
|
|
83
|
-
if (t &&
|
|
84
|
-
return t[
|
|
85
|
-
const s = n[
|
|
82
|
+
get: (n, r) => {
|
|
83
|
+
if (t && r in t)
|
|
84
|
+
return t[r];
|
|
85
|
+
const s = n[r];
|
|
86
86
|
return typeof s == "object" && s !== null ? flattenState({
|
|
87
87
|
rootState: s,
|
|
88
88
|
localState: void 0,
|
|
89
|
-
rootSetState:
|
|
90
|
-
n[
|
|
89
|
+
rootSetState: o ? (i) => {
|
|
90
|
+
n[r] = i, o(n);
|
|
91
91
|
} : void 0
|
|
92
92
|
}) : s;
|
|
93
93
|
},
|
|
94
|
-
set: (n,
|
|
95
|
-
if (t &&
|
|
94
|
+
set: (n, r, s) => {
|
|
95
|
+
if (t && r in t)
|
|
96
96
|
throw new Error("Writing to local state is not allowed as it is read-only.");
|
|
97
|
-
return n[
|
|
97
|
+
return n[r] = s, o == null || o(n), !0;
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
100
|
}
|
|
@@ -107,11 +107,11 @@ const SDK_NAME_FOR_TARGET = (() => {
|
|
|
107
107
|
default:
|
|
108
108
|
return TARGET;
|
|
109
109
|
}
|
|
110
|
-
})(), SDK_NAME = `@builder.io/sdk-${SDK_NAME_FOR_TARGET}`, fastClone = (e) => JSON.parse(JSON.stringify(e)), set = (e, t,
|
|
110
|
+
})(), SDK_NAME = `@builder.io/sdk-${SDK_NAME_FOR_TARGET}`, fastClone = (e) => JSON.parse(JSON.stringify(e)), set = (e, t, o) => {
|
|
111
111
|
if (Object(e) !== e)
|
|
112
112
|
return e;
|
|
113
113
|
const n = Array.isArray(t) ? t : t.toString().match(/[^.[\]]+/g);
|
|
114
|
-
return n.slice(0, -1).reduce((
|
|
114
|
+
return n.slice(0, -1).reduce((r, s, i) => Object(r[s]) === r[s] ? r[s] : r[s] = Math.abs(Number(n[i + 1])) >> 0 === +n[i + 1] ? [] : {}, e)[n[n.length - 1]] = o, e;
|
|
115
115
|
}, noop = () => {
|
|
116
116
|
};
|
|
117
117
|
let safeDynamicRequire = noop;
|
|
@@ -153,10 +153,10 @@ var refToProxy = (obj) => {
|
|
|
153
153
|
code: e,
|
|
154
154
|
args: t
|
|
155
155
|
}) => {
|
|
156
|
-
const
|
|
156
|
+
const o = t.map(([n]) => `var ${n} = refToProxy(${getSyncValName(n)}); `).join("");
|
|
157
157
|
return `
|
|
158
158
|
${REF_TO_PROXY_FN}
|
|
159
|
-
${
|
|
159
|
+
${o}
|
|
160
160
|
function theFunction() {
|
|
161
161
|
${e}
|
|
162
162
|
}
|
|
@@ -172,7 +172,7 @@ if (typeof output === 'object' && output !== null) {
|
|
|
172
172
|
};
|
|
173
173
|
let IVM_INSTANCE = null, IVM_CONTEXT = null;
|
|
174
174
|
const setIvm = (e, t = {}) => {
|
|
175
|
-
IVM_INSTANCE = e, setIsolateContext(t);
|
|
175
|
+
IVM_INSTANCE || (IVM_INSTANCE = e, setIsolateContext(t));
|
|
176
176
|
}, SHOULD_MENTION_INITIALIZE_SCRIPT = SDK_NAME === "@builder.io/sdk-react-nextjs" || SDK_NAME === "@builder.io/sdk-react" || SDK_NAME === "@builder.io/sdk-qwik" || SDK_NAME === "@builder.io/sdk-vue", getIvm = () => {
|
|
177
177
|
try {
|
|
178
178
|
if (IVM_INSTANCE)
|
|
@@ -196,40 +196,42 @@ const setIvm = (e, t = {}) => {
|
|
|
196
196
|
function setIsolateContext(e = {
|
|
197
197
|
memoryLimit: 128
|
|
198
198
|
}) {
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
if (IVM_CONTEXT)
|
|
200
|
+
return IVM_CONTEXT;
|
|
201
|
+
const t = getIvm(), n = new t.Isolate(e).createContextSync(), r = n.global;
|
|
202
|
+
return r.setSync("global", r.derefInto()), r.setSync("log", function(...s) {
|
|
201
203
|
console.log(...s);
|
|
202
|
-
}),
|
|
204
|
+
}), r.setSync(INJECTED_IVM_GLOBAL, t), IVM_CONTEXT = n, n;
|
|
203
205
|
}
|
|
204
|
-
const getIsolateContext = () =>
|
|
206
|
+
const getIsolateContext = () => setIsolateContext(), runInNode = ({
|
|
205
207
|
code: e,
|
|
206
208
|
builder: t,
|
|
207
|
-
context:
|
|
209
|
+
context: o,
|
|
208
210
|
event: n,
|
|
209
|
-
localState:
|
|
211
|
+
localState: r,
|
|
210
212
|
rootSetState: s,
|
|
211
213
|
rootState: i
|
|
212
214
|
}) => {
|
|
213
215
|
const g = getIvm(), m = fastClone({
|
|
214
216
|
...i,
|
|
215
|
-
...
|
|
217
|
+
...r
|
|
216
218
|
}), u = getFunctionArguments({
|
|
217
219
|
builder: t,
|
|
218
|
-
context:
|
|
220
|
+
context: o,
|
|
219
221
|
event: n,
|
|
220
222
|
state: m
|
|
221
223
|
}), l = getIsolateContext(), d = l.global;
|
|
222
224
|
d.setSync(BUILDER_SET_STATE_NAME, function(c, a) {
|
|
223
225
|
set(i, c, a), s == null || s(i);
|
|
224
226
|
}), u.forEach(([c, a]) => {
|
|
225
|
-
const
|
|
227
|
+
const I = typeof a == "object" ? new g.Reference(
|
|
226
228
|
// workaround: methods with default values for arguments is not being cloned over
|
|
227
229
|
c === "builder" ? {
|
|
228
230
|
...a,
|
|
229
231
|
getUserAttributes: () => a.getUserAttributes()
|
|
230
232
|
} : a
|
|
231
233
|
) : null;
|
|
232
|
-
d.setSync(getSyncValName(c),
|
|
234
|
+
d.setSync(getSyncValName(c), I);
|
|
233
235
|
});
|
|
234
236
|
const E = processCode({
|
|
235
237
|
code: e,
|
|
@@ -248,11 +250,11 @@ function isNodeRuntime() {
|
|
|
248
250
|
const shouldForceBrowserRuntimeInNode = ({
|
|
249
251
|
shouldLogWarning: e
|
|
250
252
|
}) => {
|
|
251
|
-
var
|
|
253
|
+
var r;
|
|
252
254
|
if (!isNodeRuntime())
|
|
253
255
|
return !1;
|
|
254
|
-
const t = process.arch === "arm64",
|
|
255
|
-
return t &&
|
|
256
|
+
const t = process.arch === "arm64", o = process.version.startsWith("v20"), n = (r = process.env.NODE_OPTIONS) == null ? void 0 : r.includes("--no-node-snapshot");
|
|
257
|
+
return t && o && !n ? (e && logger.log("Skipping usage of `isolated-vm` to avoid crashes in Node v20 on an arm64 machine.\n 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.\n See https://github.com/BuilderIO/builder/blob/main/packages/sdks/README.md#node-v20--m1-macs-apple-silicon-support for more information.\n "), !0) : !1;
|
|
256
258
|
};
|
|
257
259
|
export {
|
|
258
260
|
TARGET as T,
|
package/lib/node/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.component-1k2igrjdg3x[data-v-e241e088]{display:flex;flex-direction:column;align-items:stretch}.div-4wbls88y960[data-v-
|
|
1
|
+
.component-1k2igrjdg3x[data-v-e241e088]{display:flex;flex-direction:column;align-items:stretch}.div-4wbls88y960[data-v-f68a6aa7]{display:flex;line-height:normal}.img-29wpyomtntv[data-v-77f8a6c4]{opacity:1;transition:opacity .2s ease-in-out}.div-29wpyomtntv[data-v-77f8a6c4]{width:100%;pointer-events:none;font-size:0}.div-29wpyomtntv-2[data-v-77f8a6c4]{display:flex;flex-direction:column;align-items:stretch;position:absolute;top:0;left:0;width:100%;height:100%}.pre-3q96myty4lk[data-v-6e18f21b]{padding:10px;color:red;text-align:center}
|