@builder.io/sdk 6.0.7 → 6.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @builder.io/sdk
2
2
 
3
+ ## 6.0.8
4
+
5
+ ### Patch Changes
6
+
7
+ - a6eee0e: Fix: Functions in plugins will be selectively serialized
8
+
3
9
  ## 6.0.7
4
10
 
5
11
  ### Patch Changes
@@ -1052,7 +1052,7 @@
1052
1052
 
1053
1053
  var DEFAULT_API_VERSION = 'v3';
1054
1054
 
1055
- var SDK_VERSION = '6.0.7';
1055
+ var SDK_VERSION = '6.0.8';
1056
1056
 
1057
1057
  function datePlusMinutes(minutes) {
1058
1058
  if (minutes === void 0) { minutes = 30; }
@@ -1323,7 +1323,7 @@
1323
1323
  }
1324
1324
  Builder.register = function (type, info) {
1325
1325
  if (type === 'plugin') {
1326
- info = this.serializeIncludingFunctions(info);
1326
+ info = this.serializeIncludingFunctions(info, true);
1327
1327
  }
1328
1328
  // TODO: all must have name and can't conflict?
1329
1329
  var typeList = this.registry[type];
@@ -1454,7 +1454,7 @@
1454
1454
  enumerable: false,
1455
1455
  configurable: true
1456
1456
  });
1457
- Builder.serializeIncludingFunctions = function (info) {
1457
+ Builder.serializeIncludingFunctions = function (info, isForPlugin) {
1458
1458
  var serializeFn = function (fnValue) {
1459
1459
  var fnStr = fnValue.toString().trim();
1460
1460
  // we need to account for a few different fn syntaxes:
@@ -1472,12 +1472,17 @@
1472
1472
  !isArrowWithoutParens;
1473
1473
  return "return (".concat(appendFunction ? 'function ' : '').concat(fnStr, ").apply(this, arguments)");
1474
1474
  };
1475
- return JSON.parse(JSON.stringify(info, function (key, value) {
1476
- if (typeof value === 'function') {
1475
+ var objToReturn = JSON.parse(JSON.stringify(info, function (key, value) {
1476
+ var shouldNotSerializeFn = isForPlugin && key === 'onSave';
1477
+ if (typeof value === 'function' && !shouldNotSerializeFn) {
1477
1478
  return serializeFn(value);
1478
1479
  }
1479
1480
  return value;
1480
1481
  }));
1482
+ if (isForPlugin) {
1483
+ objToReturn.onSave = info.onSave;
1484
+ }
1485
+ return objToReturn;
1481
1486
  };
1482
1487
  Builder.prepareComponentSpecToSend = function (spec) {
1483
1488
  return __assign(__assign({}, this.serializeIncludingFunctions(spec)), { class: undefined });