sample-piral 0.14.15-beta.3791 → 0.14.16-beta.3830

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.
@@ -1191,7 +1191,15 @@ function checkFetchPilets(fetchPilets) {
1191
1191
 
1192
1192
  function loadMetadata(fetchPilets) {
1193
1193
  if (checkFetchPilets(fetchPilets)) {
1194
- return fetchPilets();
1194
+ return fetchPilets().then(function (pilets) {
1195
+ if (!Array.isArray(pilets)) {
1196
+ throw new Error('The fetched pilets metadata is not an array.');
1197
+ }
1198
+
1199
+ return pilets.map(function (meta) {
1200
+ return Object.assign({}, meta);
1201
+ });
1202
+ });
1195
1203
  }
1196
1204
 
1197
1205
  return Promise.resolve([]);
@@ -1206,10 +1214,6 @@ function loadMetadata(fetchPilets) {
1206
1214
 
1207
1215
  function loadPilets(fetchPilets, loadPilet) {
1208
1216
  return loadMetadata(fetchPilets).then(function (pilets) {
1209
- if (!Array.isArray(pilets)) {
1210
- throw new Error('The fetched pilets metadata is not an array.');
1211
- }
1212
-
1213
1217
  return Promise.all(pilets.map(loadPilet));
1214
1218
  });
1215
1219
  }
@@ -3621,7 +3625,7 @@ function createInstance() {
3621
3625
  var createApi = apiFactory(context, usedPlugins);
3622
3626
  var root = createApi({
3623
3627
  name: 'root',
3624
- version: "0.14.15-beta.3791" || 0,
3628
+ version: "0.14.16-beta.3830" || 0,
3625
3629
  spec: ''
3626
3630
  });
3627
3631
  var options = (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.createPiletOptions)({
@@ -9382,21 +9386,34 @@ function installPiralDebug(options) {
9382
9386
  });
9383
9387
  };
9384
9388
 
9389
+ var activatePilet = function activatePilet(pilet) {
9390
+ try {
9391
+ var _createApi = options.createApi;
9392
+
9393
+ var newApi = _createApi(pilet);
9394
+
9395
+ injectPilet(pilet);
9396
+ pilet.setup(newApi);
9397
+ } catch (error) {
9398
+ console.error(error);
9399
+ }
9400
+ };
9401
+
9385
9402
  var togglePilet = function togglePilet(name) {
9386
9403
  var pilet = getPilets().find(function (m) {
9387
9404
  return m.name === name;
9388
9405
  });
9389
9406
 
9390
- if (pilet.disabled) {
9391
- try {
9392
- var _createApi = options.createApi;
9393
-
9394
- var newApi = _createApi(pilet);
9395
-
9396
- injectPilet(pilet.original);
9397
- pilet.original.setup(newApi);
9398
- } catch (error) {
9399
- console.error(error);
9407
+ if (!pilet) {// nothing to do, obviously invalid call
9408
+ } else if (pilet.disabled) {
9409
+ if (pilet.original) {
9410
+ // everything is fine, let's use the cached version
9411
+ activatePilet(pilet.original);
9412
+ } else {
9413
+ // something fishy is going on - let's just try to activate the same pilet
9414
+ activatePilet(Object.assign(Object.assign({}, pilet), {
9415
+ disabled: false
9416
+ }));
9400
9417
  }
9401
9418
  } else {
9402
9419
  injectPilet({
@@ -9418,17 +9435,8 @@ function installPiralDebug(options) {
9418
9435
  };
9419
9436
 
9420
9437
  var appendPilet = function appendPilet(meta) {
9421
- var createApi = options.createApi,
9422
- loadPilet = options.loadPilet;
9423
- loadPilet(meta).then(function (pilet) {
9424
- try {
9425
- var newApi = createApi(pilet);
9426
- injectPilet(pilet);
9427
- pilet.setup(newApi);
9428
- } catch (error) {
9429
- console.error(error);
9430
- }
9431
- });
9438
+ var loadPilet = options.loadPilet;
9439
+ loadPilet(meta).then(activatePilet);
9432
9440
  };
9433
9441
 
9434
9442
  var toggleVisualize = function toggleVisualize() {
@@ -9488,12 +9496,12 @@ function installPiralDebug(options) {
9488
9496
  debug: debugApiVersion,
9489
9497
  instance: {
9490
9498
  name: "sample-piral",
9491
- version: "0.14.15-beta.3791",
9499
+ version: "0.14.16-beta.3830",
9492
9500
  dependencies: "reactstrap,react,react-dom,react-router,react-router-dom,history,tslib,path-to-regexp,@libre/atom,@dbeining/react-atom"
9493
9501
  },
9494
9502
  build: {
9495
- date: "2022-03-04T16:03:13.328Z",
9496
- cli: "0.14.14",
9503
+ date: "2022-03-09T16:26:39.189Z",
9504
+ cli: "0.14.15",
9497
9505
  compat: "0.14"
9498
9506
  },
9499
9507
  pilets: {
@@ -80906,4 +80914,4 @@ var layout_1 = __webpack_require__(/*! ./layout */ "./src/layout.tsx");
80906
80914
 
80907
80915
  /******/ })()
80908
80916
  ;
80909
- //# sourceMappingURL=index.1ccd7e.js.map
80917
+ //# sourceMappingURL=index.423310.js.map