sample-piral 0.14.14-beta.3765 → 0.14.14-beta.3767

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.
@@ -3611,7 +3611,7 @@ function createInstance() {
3611
3611
  var createApi = apiFactory(context, usedPlugins);
3612
3612
  var root = createApi({
3613
3613
  name: 'root',
3614
- version: "0.14.14-beta.3765" || 0,
3614
+ version: "0.14.14-beta.3767" || 0,
3615
3615
  spec: ''
3616
3616
  });
3617
3617
  var options = (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.createPiletOptions)({
@@ -9488,11 +9488,11 @@ function installPiralDebug(options) {
9488
9488
  debug: debugApiVersion,
9489
9489
  instance: {
9490
9490
  name: "sample-piral",
9491
- version: "0.14.14-beta.3765",
9491
+ version: "0.14.14-beta.3767",
9492
9492
  dependencies: "reactstrap,react,react-dom,react-router,react-router-dom,history,tslib,path-to-regexp,@libre/atom,@dbeining/react-atom"
9493
9493
  },
9494
9494
  build: {
9495
- date: "2022-03-02T17:59:28.793Z",
9495
+ date: "2022-03-02T21:15:45.925Z",
9496
9496
  cli: "0.14.13",
9497
9497
  compat: "0.14"
9498
9498
  },
@@ -9821,7 +9821,7 @@ function decycle(obj) {
9821
9821
  "use strict";
9822
9822
  __webpack_require__.r(__webpack_exports__);
9823
9823
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9824
- /* harmony export */ "installPiletsEmulator": () => (/* binding */ installPiletsEmulator)
9824
+ /* harmony export */ "withEmulatorPilets": () => (/* binding */ withEmulatorPilets)
9825
9825
  /* harmony export */ });
9826
9826
  /* harmony import */ var piral_base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! piral-base */ "../../framework/piral-base/esm/utils.js");
9827
9827
  /* harmony import */ var piral_base__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! piral-base */ "../../framework/piral-base/esm/setup.js");
@@ -9840,7 +9840,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
9840
9840
 
9841
9841
 
9842
9842
 
9843
- function installPiletsEmulator(requestPilets, options) {
9843
+ function withEmulatorPilets(requestPilets, options) {
9844
9844
  var loadPilet = options.loadPilet,
9845
9845
  createApi = options.createApi,
9846
9846
  injectPilet = options.injectPilet,
@@ -9854,85 +9854,83 @@ function installPiletsEmulator(requestPilets, options) {
9854
9854
  return Promise.resolve([]);
9855
9855
  };
9856
9856
 
9857
- var _requester = loadPilets ? requestPilets : noPilets;
9858
-
9859
- integrate({
9857
+ var requester = loadPilets ? requestPilets : noPilets;
9858
+ integrate === null || integrate === void 0 ? void 0 : integrate({
9860
9859
  components: {
9861
9860
  RouteSwitch: _DebugRouteSwitch__WEBPACK_IMPORTED_MODULE_0__.DebugRouteSwitch
9862
- },
9863
- requester: function requester() {
9864
- var promise = _requester(); // the window['dbg:pilet-api'] should point to an API address used as a proxy, fall back to '/$pilet-api' if unavailable
9865
-
9861
+ }
9862
+ });
9863
+ return function () {
9864
+ var promise = requester(); // the window['dbg:pilet-api'] should point to an API address used as a proxy, fall back to '/$pilet-api' if unavailable
9866
9865
 
9867
- var piletApi = window['dbg:pilet-api'] || piletApiFallback; // either take a full URI or make it an absolute path relative to the current origin
9866
+ var piletApi = window['dbg:pilet-api'] || piletApiFallback; // either take a full URI or make it an absolute path relative to the current origin
9868
9867
 
9869
- var initialTarget = /^https?:/.test(piletApi) ? piletApi : "".concat(location.origin).concat(piletApi[0] === '/' ? '' : '/').concat(piletApi);
9870
- var updateTarget = initialTarget.replace('http', 'ws');
9871
- var ws = new WebSocket(updateTarget);
9872
- var timeoutCache = {};
9873
- var timeout = 150;
9874
- var appendix = fetch(initialTarget).then(function (res) {
9875
- return res.json();
9876
- }).then(function (item) {
9877
- return Array.isArray(item) ? item : [item];
9878
- });
9868
+ var initialTarget = /^https?:/.test(piletApi) ? piletApi : "".concat(location.origin).concat(piletApi[0] === '/' ? '' : '/').concat(piletApi);
9869
+ var updateTarget = initialTarget.replace('http', 'ws');
9870
+ var ws = new WebSocket(updateTarget);
9871
+ var timeoutCache = {};
9872
+ var timeout = 150;
9873
+ var appendix = fetch(initialTarget).then(function (res) {
9874
+ return res.json();
9875
+ }).then(function (item) {
9876
+ return Array.isArray(item) ? item : [item];
9877
+ });
9879
9878
 
9880
- ws.onmessage = function (_ref) {
9881
- var data = _ref.data;
9882
- var hardRefresh = sessionStorage.getItem('dbg:hard-refresh') === 'on';
9879
+ ws.onmessage = function (_ref) {
9880
+ var data = _ref.data;
9881
+ var hardRefresh = sessionStorage.getItem('dbg:hard-refresh') === 'on';
9883
9882
 
9884
- if (!hardRefresh) {
9885
- // standard setting is to just perform an inject
9886
- var meta = JSON.parse(data);
9887
- var name = meta.name; // like a debounce; only one change of the current pilet should be actively processed
9883
+ if (!hardRefresh) {
9884
+ // standard setting is to just perform an inject
9885
+ var meta = JSON.parse(data);
9886
+ var name = meta.name; // like a debounce; only one change of the current pilet should be actively processed
9888
9887
 
9889
- clearTimeout(timeoutCache[name]); // some bundlers may have fired before writing to the disk
9890
- // so we give them a bit of time before actually loading the pilet
9888
+ clearTimeout(timeoutCache[name]); // some bundlers may have fired before writing to the disk
9889
+ // so we give them a bit of time before actually loading the pilet
9891
9890
 
9892
- timeoutCache[name] = setTimeout(function () {
9893
- // we should make sure to only refresh the page / router if pilets have been loaded
9894
- var unfreeze = (0,_DebugRouteSwitch__WEBPACK_IMPORTED_MODULE_0__.freezeRouteRefresh)(); // tear down pilet
9891
+ timeoutCache[name] = setTimeout(function () {
9892
+ // we should make sure to only refresh the page / router if pilets have been loaded
9893
+ var unfreeze = (0,_DebugRouteSwitch__WEBPACK_IMPORTED_MODULE_0__.freezeRouteRefresh)(); // tear down pilet
9895
9894
 
9896
- injectPilet({
9897
- name: name
9898
- }); // load and evaluate pilet
9895
+ injectPilet({
9896
+ name: name
9897
+ }); // load and evaluate pilet
9899
9898
 
9900
- loadPilet(meta).then(function (pilet) {
9901
- try {
9902
- if ((0,piral_base__WEBPACK_IMPORTED_MODULE_1__.isfunc)(injectPilet)) {
9903
- injectPilet(pilet);
9904
- } // setup actual pilet
9899
+ loadPilet(meta).then(function (pilet) {
9900
+ try {
9901
+ if ((0,piral_base__WEBPACK_IMPORTED_MODULE_1__.isfunc)(injectPilet)) {
9902
+ injectPilet(pilet);
9903
+ } // setup actual pilet
9905
9904
 
9906
9905
 
9907
- (0,piral_base__WEBPACK_IMPORTED_MODULE_2__.setupPilet)(pilet, createApi); // disable route cache, should be zero again and lead to route refresh
9906
+ (0,piral_base__WEBPACK_IMPORTED_MODULE_2__.setupPilet)(pilet, createApi); // disable route cache, should be zero again and lead to route refresh
9908
9907
 
9909
- unfreeze();
9910
- } catch (error) {
9911
- console.error(error);
9912
- }
9913
- });
9914
- }, timeout);
9915
- } else {
9916
- location.reload();
9917
- }
9918
- };
9919
-
9920
- return promise["catch"](function (err) {
9921
- console.error("Requesting the pilets failed. We'll continue loading without pilets (DEBUG only).", err);
9922
- return [];
9923
- }).then(function (pilets) {
9924
- return appendix.then(function (debugPilets) {
9925
- var debugPiletNames = debugPilets.map(function (m) {
9926
- return m.name;
9927
- });
9928
- var feedPilets = pilets.filter(function (m) {
9929
- return !debugPiletNames.includes(m.name);
9908
+ unfreeze();
9909
+ } catch (error) {
9910
+ console.error(error);
9911
+ }
9930
9912
  });
9931
- return [].concat(_toConsumableArray(feedPilets), _toConsumableArray(debugPilets));
9913
+ }, timeout);
9914
+ } else {
9915
+ location.reload();
9916
+ }
9917
+ };
9918
+
9919
+ return promise["catch"](function (err) {
9920
+ console.error("Requesting the pilets failed. We'll continue loading without pilets (DEBUG only).", err);
9921
+ return [];
9922
+ }).then(function (pilets) {
9923
+ return appendix.then(function (debugPilets) {
9924
+ var debugPiletNames = debugPilets.map(function (m) {
9925
+ return m.name;
9932
9926
  });
9927
+ var feedPilets = pilets.filter(function (m) {
9928
+ return !debugPiletNames.includes(m.name);
9929
+ });
9930
+ return [].concat(_toConsumableArray(feedPilets), _toConsumableArray(debugPilets));
9933
9931
  });
9934
- }
9935
- });
9932
+ });
9933
+ };
9936
9934
  }
9937
9935
 
9938
9936
  /***/ }),
@@ -9947,7 +9945,7 @@ function installPiletsEmulator(requestPilets, options) {
9947
9945
  __webpack_require__.r(__webpack_exports__);
9948
9946
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9949
9947
  /* harmony export */ "installPiralDebug": () => (/* reexport safe */ _debug__WEBPACK_IMPORTED_MODULE_0__.installPiralDebug),
9950
- /* harmony export */ "installPiletsEmulator": () => (/* reexport safe */ _emulator__WEBPACK_IMPORTED_MODULE_1__.installPiletsEmulator)
9948
+ /* harmony export */ "withEmulatorPilets": () => (/* reexport safe */ _emulator__WEBPACK_IMPORTED_MODULE_1__.withEmulatorPilets)
9951
9949
  /* harmony export */ });
9952
9950
  /* harmony import */ var _debug__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./debug */ "../../utilities/piral-debug-utils/esm/debug.js");
9953
9951
  /* harmony import */ var _emulator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./emulator */ "../../utilities/piral-debug-utils/esm/emulator.js");
@@ -10075,7 +10073,7 @@ exports.integrate = void 0;
10075
10073
  var piral_debug_utils_1 = __webpack_require__(/*! piral-debug-utils */ "../../utilities/piral-debug-utils/esm/index.js");
10076
10074
 
10077
10075
  function integrate(context, options) {
10078
- (0, piral_debug_utils_1.installPiletsEmulator)(options.fetchPilets, {
10076
+ options.fetchPilets = (0, piral_debug_utils_1.withEmulatorPilets)(options.fetchPilets, {
10079
10077
  injectPilet: context.injectPilet,
10080
10078
  createApi: options.createApi,
10081
10079
  loadPilet: options.loadPilet,
@@ -10085,7 +10083,6 @@ function integrate(context, options) {
10085
10083
  components: Object.assign(Object.assign({}, s.components), emulator.components)
10086
10084
  });
10087
10085
  });
10088
- options.fetchPilets = emulator.requester;
10089
10086
  }
10090
10087
  });
10091
10088
  }
@@ -80896,4 +80893,4 @@ var layout_1 = __webpack_require__(/*! ./layout */ "./src/layout.tsx");
80896
80893
 
80897
80894
  /******/ })()
80898
80895
  ;
80899
- //# sourceMappingURL=index.2d688d.js.map
80896
+ //# sourceMappingURL=index.e77abf.js.map