@builder.io/sdk 6.0.7 → 6.0.9
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 +12 -0
- package/dist/index.browser.js +21 -5
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs.js +21 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +21 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +21 -5
- package/dist/index.umd.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/src/builder.class.d.ts +11 -1
- package/dist/src/builder.class.js +20 -4
- package/dist/src/builder.class.js.map +1 -1
- package/dist/src/builder.class.test.js +85 -0
- package/dist/src/builder.class.test.js.map +1 -1
- package/dist/src/sdk-version.d.ts +1 -1
- package/dist/src/sdk-version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @builder.io/sdk
|
|
2
2
|
|
|
3
|
+
## 6.0.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 1c659e9: feat: add support for register action
|
|
8
|
+
|
|
9
|
+
## 6.0.8
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- a6eee0e: Fix: Functions in plugins will be selectively serialized
|
|
14
|
+
|
|
3
15
|
## 6.0.7
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.browser.js
CHANGED
|
@@ -1052,7 +1052,7 @@
|
|
|
1052
1052
|
|
|
1053
1053
|
var DEFAULT_API_VERSION = 'v3';
|
|
1054
1054
|
|
|
1055
|
-
var SDK_VERSION = '6.0.
|
|
1055
|
+
var SDK_VERSION = '6.0.9';
|
|
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];
|
|
@@ -1368,7 +1368,18 @@
|
|
|
1368
1368
|
this.plugins.push(info);
|
|
1369
1369
|
};
|
|
1370
1370
|
Builder.registerAction = function (action) {
|
|
1371
|
+
var _a;
|
|
1371
1372
|
this.actions.push(action);
|
|
1373
|
+
if (Builder.isBrowser) {
|
|
1374
|
+
var actionClone = JSON.parse(JSON.stringify(action));
|
|
1375
|
+
if (action.action) {
|
|
1376
|
+
actionClone.action = action.action.toString();
|
|
1377
|
+
}
|
|
1378
|
+
(_a = window.parent) === null || _a === void 0 ? void 0 : _a.postMessage({
|
|
1379
|
+
type: 'builder.registerAction',
|
|
1380
|
+
data: actionClone,
|
|
1381
|
+
}, '*');
|
|
1382
|
+
}
|
|
1372
1383
|
};
|
|
1373
1384
|
Builder.registerTrustedHost = function (host) {
|
|
1374
1385
|
this.trustedHosts.push(host);
|
|
@@ -1454,7 +1465,7 @@
|
|
|
1454
1465
|
enumerable: false,
|
|
1455
1466
|
configurable: true
|
|
1456
1467
|
});
|
|
1457
|
-
Builder.serializeIncludingFunctions = function (info) {
|
|
1468
|
+
Builder.serializeIncludingFunctions = function (info, isForPlugin) {
|
|
1458
1469
|
var serializeFn = function (fnValue) {
|
|
1459
1470
|
var fnStr = fnValue.toString().trim();
|
|
1460
1471
|
// we need to account for a few different fn syntaxes:
|
|
@@ -1472,12 +1483,17 @@
|
|
|
1472
1483
|
!isArrowWithoutParens;
|
|
1473
1484
|
return "return (".concat(appendFunction ? 'function ' : '').concat(fnStr, ").apply(this, arguments)");
|
|
1474
1485
|
};
|
|
1475
|
-
|
|
1476
|
-
|
|
1486
|
+
var objToReturn = JSON.parse(JSON.stringify(info, function (key, value) {
|
|
1487
|
+
var shouldNotSerializeFn = isForPlugin && key === 'onSave';
|
|
1488
|
+
if (typeof value === 'function' && !shouldNotSerializeFn) {
|
|
1477
1489
|
return serializeFn(value);
|
|
1478
1490
|
}
|
|
1479
1491
|
return value;
|
|
1480
1492
|
}));
|
|
1493
|
+
if (isForPlugin) {
|
|
1494
|
+
objToReturn.onSave = info.onSave;
|
|
1495
|
+
}
|
|
1496
|
+
return objToReturn;
|
|
1481
1497
|
};
|
|
1482
1498
|
Builder.prepareComponentSpecToSend = function (spec) {
|
|
1483
1499
|
return __assign(__assign({}, this.serializeIncludingFunctions(spec)), { class: undefined });
|