@builder.io/sdk-solid 2.0.22 → 2.0.23

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/node/dev.js CHANGED
@@ -145,6 +145,12 @@ var logger = {
145
145
  debug: (...message) => console.debug(MSG_PREFIX, ...message)
146
146
  };
147
147
 
148
+ // src/functions/get.ts
149
+ var get = (obj, path, defaultValue) => {
150
+ const result = String.prototype.split.call(path, /[,[\].]+?/).filter(Boolean).reduce((res, key) => res !== null && res !== void 0 ? res[key] : res, obj);
151
+ return result === void 0 || result === obj ? defaultValue : result;
152
+ };
153
+
148
154
  // src/functions/is-browser.ts
149
155
  function isBrowser() {
150
156
  return typeof window !== "undefined" && typeof document !== "undefined";
@@ -532,30 +538,10 @@ var chooseBrowserOrServerEval = (args) => isBrowser() || shouldForceBrowserRunti
532
538
  }) ? runInBrowser(args) : runInNode(args);
533
539
 
534
540
  // src/functions/evaluate/evaluate.ts
535
- var DISABLE_CACHE = true;
536
- var EvalCache = class _EvalCache {
537
- static cacheLimit = 20;
538
- static cache = /* @__PURE__ */ new Map();
539
- static getCacheKey(args) {
540
- return JSON.stringify({
541
- ...args,
542
- // replace the event with a random number to break cache
543
- // thats because we can't serialize the event object due to circular refs in DOM node refs.
544
- event: args.event ? Math.random() : void 0
545
- });
546
- }
547
- static getCachedValue(key) {
548
- const cachedVal = _EvalCache.cache.get(key);
549
- return cachedVal;
550
- }
551
- static setCachedValue(key, value) {
552
- if (_EvalCache.cache.size > 20) {
553
- _EvalCache.cache.delete(_EvalCache.cache.keys().next().value);
554
- }
555
- _EvalCache.cache.set(key, {
556
- value
557
- });
558
- }
541
+ var STATE_GETTER_REGEX = /^(return )?(\s*)?state(?<getPath>(\.\w+)+)(\s*);?$/;
542
+ var VIRTUAL_INDEX_REGEX = /(\s)*var(\s)+_virtual_index(\s)*=(\s)*state(?<getPath>(\.\w+)+)(\s*);?(\s)*return(\s)*_virtual_index(\s)*/;
543
+ var getSimpleExpressionGetPath = (code) => {
544
+ return STATE_GETTER_REGEX.exec(code.trim())?.groups?.getPath?.slice(1) || VIRTUAL_INDEX_REGEX.exec(code.trim())?.groups?.getPath?.slice(1);
559
545
  };
560
546
  function evaluate({
561
547
  code,
@@ -564,12 +550,18 @@ function evaluate({
564
550
  rootState,
565
551
  rootSetState,
566
552
  event,
567
- isExpression = true,
568
- enableCache
553
+ isExpression = true
569
554
  }) {
570
- if (code === "") {
555
+ if (code.trim() === "") {
571
556
  return void 0;
572
557
  }
558
+ const getPath = getSimpleExpressionGetPath(code.trim());
559
+ if (getPath) {
560
+ return get({
561
+ ...rootState,
562
+ ...localState
563
+ }, getPath);
564
+ }
573
565
  const args = {
574
566
  code: parseCode(code, {
575
567
  isExpression
@@ -581,19 +573,8 @@ function evaluate({
581
573
  rootState,
582
574
  localState
583
575
  };
584
- if (enableCache && !DISABLE_CACHE) {
585
- const cacheKey = EvalCache.getCacheKey(args);
586
- const cachedValue = EvalCache.getCachedValue(cacheKey);
587
- if (cachedValue) {
588
- return cachedValue.value;
589
- }
590
- }
591
576
  try {
592
577
  const newEval = chooseBrowserOrServerEval(args);
593
- if (enableCache) {
594
- const cacheKey = EvalCache.getCacheKey(args);
595
- EvalCache.setCachedValue(cacheKey, newEval);
596
- }
597
578
  return newEval;
598
579
  } catch (e) {
599
580
  logger.error("Failed code evaluation: " + e.message, {
@@ -674,8 +655,7 @@ var evaluateBindings = ({
674
655
  localState,
675
656
  rootState,
676
657
  rootSetState,
677
- context,
678
- enableCache: true
658
+ context
679
659
  });
680
660
  set(copied, binding, value);
681
661
  }
@@ -981,8 +961,7 @@ var getRepeatItemData = ({
981
961
  localState: context.localState,
982
962
  rootState: context.rootState,
983
963
  rootSetState: context.rootSetState,
984
- context: context.context,
985
- enableCache: true
964
+ context: context.context
986
965
  });
987
966
  if (!Array.isArray(itemsArray)) {
988
967
  return void 0;
@@ -1187,8 +1166,7 @@ var createEventHandler = (value, options) => (event) => evaluate({
1187
1166
  rootState: options.rootState,
1188
1167
  rootSetState: options.rootSetState,
1189
1168
  event,
1190
- isExpression: false,
1191
- enableCache: true
1169
+ isExpression: false
1192
1170
  });
1193
1171
 
1194
1172
  // src/functions/get-block-actions.ts
@@ -3576,8 +3554,7 @@ function Text(props) {
3576
3554
  context: contextContext,
3577
3555
  localState,
3578
3556
  rootState,
3579
- rootSetState,
3580
- enableCache: false
3557
+ rootSetState
3581
3558
  }));
3582
3559
  });
3583
3560
  return (() => {
@@ -3982,12 +3959,6 @@ var getEnv = () => {
3982
3959
  return validEnvList.includes(env) ? env : "production";
3983
3960
  };
3984
3961
 
3985
- // src/functions/get.ts
3986
- var get = (obj, path, defaultValue) => {
3987
- const result = String.prototype.split.call(path, /[,[\].]+?/).filter(Boolean).reduce((res, key) => res !== null && res !== void 0 ? res[key] : res, obj);
3988
- return result === void 0 || result === obj ? defaultValue : result;
3989
- };
3990
-
3991
3962
  // src/blocks/form/form/form.tsx
3992
3963
  var _tmpl$13 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-2e825338">`);
3993
3964
  var _tmpl$26 = /* @__PURE__ */ template(`<form>`);
@@ -5455,7 +5426,7 @@ function isFromTrustedHost(trustedHosts, e) {
5455
5426
  }
5456
5427
 
5457
5428
  // src/constants/sdk-version.ts
5458
- var SDK_VERSION = "2.0.22";
5429
+ var SDK_VERSION = "2.0.23";
5459
5430
 
5460
5431
  // src/functions/register.ts
5461
5432
  var registry = {};
@@ -5842,8 +5813,7 @@ function EnableEditor(props) {
5842
5813
  context: props.context || {},
5843
5814
  localState: void 0,
5844
5815
  rootState: props.builderContextSignal.rootState,
5845
- rootSetState: props.builderContextSignal.rootSetState,
5846
- enableCache: true
5816
+ rootSetState: props.builderContextSignal.rootSetState
5847
5817
  })));
5848
5818
  fetch(evaluatedUrl).then((response) => response.json()).then((json) => {
5849
5819
  mergeNewRootState({
@@ -6137,11 +6107,7 @@ function ContentComponent(props) {
6137
6107
  rootState: newState
6138
6108
  }));
6139
6109
  },
6140
- isExpression: false,
6141
- /**
6142
- * We don't want to cache the result of the JS code, since it's arbitrary side effect code.
6143
- */
6144
- enableCache: false
6110
+ isExpression: false
6145
6111
  });
6146
6112
  }
6147
6113
  return createComponent(components_context_default.Provider, {
package/lib/node/dev.jsx CHANGED
@@ -137,6 +137,12 @@ var logger = {
137
137
  debug: (...message) => console.debug(MSG_PREFIX, ...message)
138
138
  };
139
139
 
140
+ // src/functions/get.ts
141
+ var get = (obj, path, defaultValue) => {
142
+ const result = String.prototype.split.call(path, /[,[\].]+?/).filter(Boolean).reduce((res, key) => res !== null && res !== void 0 ? res[key] : res, obj);
143
+ return result === void 0 || result === obj ? defaultValue : result;
144
+ };
145
+
140
146
  // src/functions/is-browser.ts
141
147
  function isBrowser() {
142
148
  return typeof window !== "undefined" && typeof document !== "undefined";
@@ -527,30 +533,10 @@ var chooseBrowserOrServerEval = (args) => isBrowser() || shouldForceBrowserRunti
527
533
  }) ? runInBrowser(args) : runInNode(args);
528
534
 
529
535
  // src/functions/evaluate/evaluate.ts
530
- var DISABLE_CACHE = true;
531
- var EvalCache = class _EvalCache {
532
- static cacheLimit = 20;
533
- static cache = /* @__PURE__ */ new Map();
534
- static getCacheKey(args) {
535
- return JSON.stringify({
536
- ...args,
537
- // replace the event with a random number to break cache
538
- // thats because we can't serialize the event object due to circular refs in DOM node refs.
539
- event: args.event ? Math.random() : void 0
540
- });
541
- }
542
- static getCachedValue(key) {
543
- const cachedVal = _EvalCache.cache.get(key);
544
- return cachedVal;
545
- }
546
- static setCachedValue(key, value) {
547
- if (_EvalCache.cache.size > 20) {
548
- _EvalCache.cache.delete(_EvalCache.cache.keys().next().value);
549
- }
550
- _EvalCache.cache.set(key, {
551
- value
552
- });
553
- }
536
+ var STATE_GETTER_REGEX = /^(return )?(\s*)?state(?<getPath>(\.\w+)+)(\s*);?$/;
537
+ var VIRTUAL_INDEX_REGEX = /(\s)*var(\s)+_virtual_index(\s)*=(\s)*state(?<getPath>(\.\w+)+)(\s*);?(\s)*return(\s)*_virtual_index(\s)*/;
538
+ var getSimpleExpressionGetPath = (code) => {
539
+ return STATE_GETTER_REGEX.exec(code.trim())?.groups?.getPath?.slice(1) || VIRTUAL_INDEX_REGEX.exec(code.trim())?.groups?.getPath?.slice(1);
554
540
  };
555
541
  function evaluate({
556
542
  code,
@@ -559,12 +545,18 @@ function evaluate({
559
545
  rootState,
560
546
  rootSetState,
561
547
  event,
562
- isExpression = true,
563
- enableCache
548
+ isExpression = true
564
549
  }) {
565
- if (code === "") {
550
+ if (code.trim() === "") {
566
551
  return void 0;
567
552
  }
553
+ const getPath = getSimpleExpressionGetPath(code.trim());
554
+ if (getPath) {
555
+ return get({
556
+ ...rootState,
557
+ ...localState
558
+ }, getPath);
559
+ }
568
560
  const args = {
569
561
  code: parseCode(code, {
570
562
  isExpression
@@ -576,19 +568,8 @@ function evaluate({
576
568
  rootState,
577
569
  localState
578
570
  };
579
- if (enableCache && !DISABLE_CACHE) {
580
- const cacheKey = EvalCache.getCacheKey(args);
581
- const cachedValue = EvalCache.getCachedValue(cacheKey);
582
- if (cachedValue) {
583
- return cachedValue.value;
584
- }
585
- }
586
571
  try {
587
572
  const newEval = chooseBrowserOrServerEval(args);
588
- if (enableCache) {
589
- const cacheKey = EvalCache.getCacheKey(args);
590
- EvalCache.setCachedValue(cacheKey, newEval);
591
- }
592
573
  return newEval;
593
574
  } catch (e) {
594
575
  logger.error("Failed code evaluation: " + e.message, {
@@ -669,8 +650,7 @@ var evaluateBindings = ({
669
650
  localState,
670
651
  rootState,
671
652
  rootSetState,
672
- context,
673
- enableCache: true
653
+ context
674
654
  });
675
655
  set(copied, binding, value);
676
656
  }
@@ -976,8 +956,7 @@ var getRepeatItemData = ({
976
956
  localState: context.localState,
977
957
  rootState: context.rootState,
978
958
  rootSetState: context.rootSetState,
979
- context: context.context,
980
- enableCache: true
959
+ context: context.context
981
960
  });
982
961
  if (!Array.isArray(itemsArray)) {
983
962
  return void 0;
@@ -1180,8 +1159,7 @@ var createEventHandler = (value, options) => (event) => evaluate({
1180
1159
  rootState: options.rootState,
1181
1160
  rootSetState: options.rootSetState,
1182
1161
  event,
1183
- isExpression: false,
1184
- enableCache: true
1162
+ isExpression: false
1185
1163
  });
1186
1164
 
1187
1165
  // src/functions/get-block-actions.ts
@@ -3221,8 +3199,7 @@ function Text(props) {
3221
3199
  context: contextContext,
3222
3200
  localState,
3223
3201
  rootState,
3224
- rootSetState,
3225
- enableCache: false
3202
+ rootSetState
3226
3203
  })
3227
3204
  );
3228
3205
  });
@@ -3626,12 +3603,6 @@ var getEnv = () => {
3626
3603
  return validEnvList.includes(env) ? env : "production";
3627
3604
  };
3628
3605
 
3629
- // src/functions/get.ts
3630
- var get = (obj, path, defaultValue) => {
3631
- const result = String.prototype.split.call(path, /[,[\].]+?/).filter(Boolean).reduce((res, key) => res !== null && res !== void 0 ? res[key] : res, obj);
3632
- return result === void 0 || result === obj ? defaultValue : result;
3633
- };
3634
-
3635
3606
  // src/blocks/form/form/form.tsx
3636
3607
  function FormComponent(props) {
3637
3608
  const [formState, setFormState] = createSignal14("unsubmitted");
@@ -4943,7 +4914,7 @@ function isFromTrustedHost(trustedHosts, e) {
4943
4914
  }
4944
4915
 
4945
4916
  // src/constants/sdk-version.ts
4946
- var SDK_VERSION = "2.0.22";
4917
+ var SDK_VERSION = "2.0.23";
4947
4918
 
4948
4919
  // src/functions/register.ts
4949
4920
  var registry = {};
@@ -5332,8 +5303,7 @@ function EnableEditor(props) {
5332
5303
  context: props.context || {},
5333
5304
  localState: void 0,
5334
5305
  rootState: props.builderContextSignal.rootState,
5335
- rootSetState: props.builderContextSignal.rootSetState,
5336
- enableCache: true
5306
+ rootSetState: props.builderContextSignal.rootSetState
5337
5307
  })
5338
5308
  )
5339
5309
  );
@@ -5633,11 +5603,7 @@ function ContentComponent(props) {
5633
5603
  rootState: newState
5634
5604
  }));
5635
5605
  },
5636
- isExpression: false,
5637
- /**
5638
- * We don't want to cache the result of the JS code, since it's arbitrary side effect code.
5639
- */
5640
- enableCache: false
5606
+ isExpression: false
5641
5607
  });
5642
5608
  }
5643
5609
  return <><components_context_default.Provider
package/lib/node/index.js CHANGED
@@ -145,6 +145,12 @@ var logger = {
145
145
  debug: (...message) => void 0
146
146
  };
147
147
 
148
+ // src/functions/get.ts
149
+ var get = (obj, path, defaultValue) => {
150
+ const result = String.prototype.split.call(path, /[,[\].]+?/).filter(Boolean).reduce((res, key) => res !== null && res !== void 0 ? res[key] : res, obj);
151
+ return result === void 0 || result === obj ? defaultValue : result;
152
+ };
153
+
148
154
  // src/functions/is-browser.ts
149
155
  function isBrowser() {
150
156
  return typeof window !== "undefined" && typeof document !== "undefined";
@@ -530,30 +536,10 @@ var chooseBrowserOrServerEval = (args) => isBrowser() || shouldForceBrowserRunti
530
536
  }) ? runInBrowser(args) : runInNode(args);
531
537
 
532
538
  // src/functions/evaluate/evaluate.ts
533
- var DISABLE_CACHE = true;
534
- var EvalCache = class _EvalCache {
535
- static cacheLimit = 20;
536
- static cache = /* @__PURE__ */ new Map();
537
- static getCacheKey(args) {
538
- return JSON.stringify({
539
- ...args,
540
- // replace the event with a random number to break cache
541
- // thats because we can't serialize the event object due to circular refs in DOM node refs.
542
- event: args.event ? Math.random() : void 0
543
- });
544
- }
545
- static getCachedValue(key) {
546
- const cachedVal = _EvalCache.cache.get(key);
547
- return cachedVal;
548
- }
549
- static setCachedValue(key, value) {
550
- if (_EvalCache.cache.size > 20) {
551
- _EvalCache.cache.delete(_EvalCache.cache.keys().next().value);
552
- }
553
- _EvalCache.cache.set(key, {
554
- value
555
- });
556
- }
539
+ var STATE_GETTER_REGEX = /^(return )?(\s*)?state(?<getPath>(\.\w+)+)(\s*);?$/;
540
+ var VIRTUAL_INDEX_REGEX = /(\s)*var(\s)+_virtual_index(\s)*=(\s)*state(?<getPath>(\.\w+)+)(\s*);?(\s)*return(\s)*_virtual_index(\s)*/;
541
+ var getSimpleExpressionGetPath = (code) => {
542
+ return STATE_GETTER_REGEX.exec(code.trim())?.groups?.getPath?.slice(1) || VIRTUAL_INDEX_REGEX.exec(code.trim())?.groups?.getPath?.slice(1);
557
543
  };
558
544
  function evaluate({
559
545
  code,
@@ -562,12 +548,18 @@ function evaluate({
562
548
  rootState,
563
549
  rootSetState,
564
550
  event,
565
- isExpression = true,
566
- enableCache
551
+ isExpression = true
567
552
  }) {
568
- if (code === "") {
553
+ if (code.trim() === "") {
569
554
  return void 0;
570
555
  }
556
+ const getPath = getSimpleExpressionGetPath(code.trim());
557
+ if (getPath) {
558
+ return get({
559
+ ...rootState,
560
+ ...localState
561
+ }, getPath);
562
+ }
571
563
  const args = {
572
564
  code: parseCode(code, {
573
565
  isExpression
@@ -579,19 +571,8 @@ function evaluate({
579
571
  rootState,
580
572
  localState
581
573
  };
582
- if (enableCache && !DISABLE_CACHE) {
583
- const cacheKey = EvalCache.getCacheKey(args);
584
- const cachedValue = EvalCache.getCachedValue(cacheKey);
585
- if (cachedValue) {
586
- return cachedValue.value;
587
- }
588
- }
589
574
  try {
590
575
  const newEval = chooseBrowserOrServerEval(args);
591
- if (enableCache) {
592
- const cacheKey = EvalCache.getCacheKey(args);
593
- EvalCache.setCachedValue(cacheKey, newEval);
594
- }
595
576
  return newEval;
596
577
  } catch (e) {
597
578
  logger.error("Failed code evaluation: " + e.message, {
@@ -672,8 +653,7 @@ var evaluateBindings = ({
672
653
  localState,
673
654
  rootState,
674
655
  rootSetState,
675
- context,
676
- enableCache: true
656
+ context
677
657
  });
678
658
  set(copied, binding, value);
679
659
  }
@@ -975,8 +955,7 @@ var getRepeatItemData = ({
975
955
  localState: context.localState,
976
956
  rootState: context.rootState,
977
957
  rootSetState: context.rootSetState,
978
- context: context.context,
979
- enableCache: true
958
+ context: context.context
980
959
  });
981
960
  if (!Array.isArray(itemsArray)) {
982
961
  return void 0;
@@ -1181,8 +1160,7 @@ var createEventHandler = (value, options) => (event) => evaluate({
1181
1160
  rootState: options.rootState,
1182
1161
  rootSetState: options.rootSetState,
1183
1162
  event,
1184
- isExpression: false,
1185
- enableCache: true
1163
+ isExpression: false
1186
1164
  });
1187
1165
 
1188
1166
  // src/functions/get-block-actions.ts
@@ -3568,8 +3546,7 @@ function Text(props) {
3568
3546
  context: contextContext,
3569
3547
  localState,
3570
3548
  rootState,
3571
- rootSetState,
3572
- enableCache: false
3549
+ rootSetState
3573
3550
  }));
3574
3551
  });
3575
3552
  return (() => {
@@ -3972,12 +3949,6 @@ var getEnv = () => {
3972
3949
  return validEnvList.includes(env) ? env : "production";
3973
3950
  };
3974
3951
 
3975
- // src/functions/get.ts
3976
- var get = (obj, path, defaultValue) => {
3977
- const result = String.prototype.split.call(path, /[,[\].]+?/).filter(Boolean).reduce((res, key) => res !== null && res !== void 0 ? res[key] : res, obj);
3978
- return result === void 0 || result === obj ? defaultValue : result;
3979
- };
3980
-
3981
3952
  // src/blocks/form/form/form.tsx
3982
3953
  var _tmpl$13 = /* @__PURE__ */ template(`<pre class="builder-form-error-text pre-2e825338">`);
3983
3954
  var _tmpl$26 = /* @__PURE__ */ template(`<form>`);
@@ -5440,7 +5411,7 @@ function isFromTrustedHost(trustedHosts, e) {
5440
5411
  }
5441
5412
 
5442
5413
  // src/constants/sdk-version.ts
5443
- var SDK_VERSION = "2.0.22";
5414
+ var SDK_VERSION = "2.0.23";
5444
5415
 
5445
5416
  // src/functions/register.ts
5446
5417
  var registry = {};
@@ -5826,8 +5797,7 @@ function EnableEditor(props) {
5826
5797
  context: props.context || {},
5827
5798
  localState: void 0,
5828
5799
  rootState: props.builderContextSignal.rootState,
5829
- rootSetState: props.builderContextSignal.rootSetState,
5830
- enableCache: true
5800
+ rootSetState: props.builderContextSignal.rootSetState
5831
5801
  })));
5832
5802
  fetch(evaluatedUrl).then((response) => response.json()).then((json) => {
5833
5803
  mergeNewRootState({
@@ -6120,11 +6090,7 @@ function ContentComponent(props) {
6120
6090
  rootState: newState
6121
6091
  }));
6122
6092
  },
6123
- isExpression: false,
6124
- /**
6125
- * We don't want to cache the result of the JS code, since it's arbitrary side effect code.
6126
- */
6127
- enableCache: false
6093
+ isExpression: false
6128
6094
  });
6129
6095
  }
6130
6096
  return createComponent(components_context_default.Provider, {
@@ -137,6 +137,12 @@ var logger = {
137
137
  debug: (...message) => void 0
138
138
  };
139
139
 
140
+ // src/functions/get.ts
141
+ var get = (obj, path, defaultValue) => {
142
+ const result = String.prototype.split.call(path, /[,[\].]+?/).filter(Boolean).reduce((res, key) => res !== null && res !== void 0 ? res[key] : res, obj);
143
+ return result === void 0 || result === obj ? defaultValue : result;
144
+ };
145
+
140
146
  // src/functions/is-browser.ts
141
147
  function isBrowser() {
142
148
  return typeof window !== "undefined" && typeof document !== "undefined";
@@ -525,30 +531,10 @@ var chooseBrowserOrServerEval = (args) => isBrowser() || shouldForceBrowserRunti
525
531
  }) ? runInBrowser(args) : runInNode(args);
526
532
 
527
533
  // src/functions/evaluate/evaluate.ts
528
- var DISABLE_CACHE = true;
529
- var EvalCache = class _EvalCache {
530
- static cacheLimit = 20;
531
- static cache = /* @__PURE__ */ new Map();
532
- static getCacheKey(args) {
533
- return JSON.stringify({
534
- ...args,
535
- // replace the event with a random number to break cache
536
- // thats because we can't serialize the event object due to circular refs in DOM node refs.
537
- event: args.event ? Math.random() : void 0
538
- });
539
- }
540
- static getCachedValue(key) {
541
- const cachedVal = _EvalCache.cache.get(key);
542
- return cachedVal;
543
- }
544
- static setCachedValue(key, value) {
545
- if (_EvalCache.cache.size > 20) {
546
- _EvalCache.cache.delete(_EvalCache.cache.keys().next().value);
547
- }
548
- _EvalCache.cache.set(key, {
549
- value
550
- });
551
- }
534
+ var STATE_GETTER_REGEX = /^(return )?(\s*)?state(?<getPath>(\.\w+)+)(\s*);?$/;
535
+ var VIRTUAL_INDEX_REGEX = /(\s)*var(\s)+_virtual_index(\s)*=(\s)*state(?<getPath>(\.\w+)+)(\s*);?(\s)*return(\s)*_virtual_index(\s)*/;
536
+ var getSimpleExpressionGetPath = (code) => {
537
+ return STATE_GETTER_REGEX.exec(code.trim())?.groups?.getPath?.slice(1) || VIRTUAL_INDEX_REGEX.exec(code.trim())?.groups?.getPath?.slice(1);
552
538
  };
553
539
  function evaluate({
554
540
  code,
@@ -557,12 +543,18 @@ function evaluate({
557
543
  rootState,
558
544
  rootSetState,
559
545
  event,
560
- isExpression = true,
561
- enableCache
546
+ isExpression = true
562
547
  }) {
563
- if (code === "") {
548
+ if (code.trim() === "") {
564
549
  return void 0;
565
550
  }
551
+ const getPath = getSimpleExpressionGetPath(code.trim());
552
+ if (getPath) {
553
+ return get({
554
+ ...rootState,
555
+ ...localState
556
+ }, getPath);
557
+ }
566
558
  const args = {
567
559
  code: parseCode(code, {
568
560
  isExpression
@@ -574,19 +566,8 @@ function evaluate({
574
566
  rootState,
575
567
  localState
576
568
  };
577
- if (enableCache && !DISABLE_CACHE) {
578
- const cacheKey = EvalCache.getCacheKey(args);
579
- const cachedValue = EvalCache.getCachedValue(cacheKey);
580
- if (cachedValue) {
581
- return cachedValue.value;
582
- }
583
- }
584
569
  try {
585
570
  const newEval = chooseBrowserOrServerEval(args);
586
- if (enableCache) {
587
- const cacheKey = EvalCache.getCacheKey(args);
588
- EvalCache.setCachedValue(cacheKey, newEval);
589
- }
590
571
  return newEval;
591
572
  } catch (e) {
592
573
  logger.error("Failed code evaluation: " + e.message, {
@@ -667,8 +648,7 @@ var evaluateBindings = ({
667
648
  localState,
668
649
  rootState,
669
650
  rootSetState,
670
- context,
671
- enableCache: true
651
+ context
672
652
  });
673
653
  set(copied, binding, value);
674
654
  }
@@ -970,8 +950,7 @@ var getRepeatItemData = ({
970
950
  localState: context.localState,
971
951
  rootState: context.rootState,
972
952
  rootSetState: context.rootSetState,
973
- context: context.context,
974
- enableCache: true
953
+ context: context.context
975
954
  });
976
955
  if (!Array.isArray(itemsArray)) {
977
956
  return void 0;
@@ -1174,8 +1153,7 @@ var createEventHandler = (value, options) => (event) => evaluate({
1174
1153
  rootState: options.rootState,
1175
1154
  rootSetState: options.rootSetState,
1176
1155
  event,
1177
- isExpression: false,
1178
- enableCache: true
1156
+ isExpression: false
1179
1157
  });
1180
1158
 
1181
1159
  // src/functions/get-block-actions.ts
@@ -3213,8 +3191,7 @@ function Text(props) {
3213
3191
  context: contextContext,
3214
3192
  localState,
3215
3193
  rootState,
3216
- rootSetState,
3217
- enableCache: false
3194
+ rootSetState
3218
3195
  })
3219
3196
  );
3220
3197
  });
@@ -3616,12 +3593,6 @@ var getEnv = () => {
3616
3593
  return validEnvList.includes(env) ? env : "production";
3617
3594
  };
3618
3595
 
3619
- // src/functions/get.ts
3620
- var get = (obj, path, defaultValue) => {
3621
- const result = String.prototype.split.call(path, /[,[\].]+?/).filter(Boolean).reduce((res, key) => res !== null && res !== void 0 ? res[key] : res, obj);
3622
- return result === void 0 || result === obj ? defaultValue : result;
3623
- };
3624
-
3625
3596
  // src/blocks/form/form/form.tsx
3626
3597
  function FormComponent(props) {
3627
3598
  const [formState, setFormState] = createSignal14("unsubmitted");
@@ -4928,7 +4899,7 @@ function isFromTrustedHost(trustedHosts, e) {
4928
4899
  }
4929
4900
 
4930
4901
  // src/constants/sdk-version.ts
4931
- var SDK_VERSION = "2.0.22";
4902
+ var SDK_VERSION = "2.0.23";
4932
4903
 
4933
4904
  // src/functions/register.ts
4934
4905
  var registry = {};
@@ -5316,8 +5287,7 @@ function EnableEditor(props) {
5316
5287
  context: props.context || {},
5317
5288
  localState: void 0,
5318
5289
  rootState: props.builderContextSignal.rootState,
5319
- rootSetState: props.builderContextSignal.rootSetState,
5320
- enableCache: true
5290
+ rootSetState: props.builderContextSignal.rootSetState
5321
5291
  })
5322
5292
  )
5323
5293
  );
@@ -5616,11 +5586,7 @@ function ContentComponent(props) {
5616
5586
  rootState: newState
5617
5587
  }));
5618
5588
  },
5619
- isExpression: false,
5620
- /**
5621
- * We don't want to cache the result of the JS code, since it's arbitrary side effect code.
5622
- */
5623
- enableCache: false
5589
+ isExpression: false
5624
5590
  });
5625
5591
  }
5626
5592
  return <><components_context_default.Provider
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-solid",
3
- "version": "2.0.22",
3
+ "version": "2.0.23",
4
4
  "description": "",
5
5
  "files": [
6
6
  "dist",