sample-piral 0.14.14-beta.3765 → 0.14.15-beta.3790

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.
@@ -842,8 +842,9 @@ __webpack_require__.r(__webpack_exports__);
842
842
  /* harmony export */ "includeDependency": () => (/* binding */ includeDependency),
843
843
  /* harmony export */ "includeBundle": () => (/* binding */ includeBundle)
844
844
  /* harmony export */ });
845
- function requireModule(name) {
846
- var dependency = System.get(name);
845
+ function requireModule(name, parent) {
846
+ var moduleId = System.resolve(name, parent);
847
+ var dependency = moduleId && System.get(moduleId);
847
848
 
848
849
  if (!dependency) {
849
850
  var error = new Error("Cannot find module '".concat(name, "'"));
@@ -891,7 +892,13 @@ function evalDependency(name, content) {
891
892
  try {
892
893
  var sourceUrl = link && "\n//# sourceURL=".concat(link);
893
894
  var importer = new Function('module', 'exports', 'require', content + sourceUrl);
894
- importer(mod, mod.exports, requireModule);
895
+ var parent = link || name;
896
+
897
+ var require = function require(moduleId) {
898
+ return requireModule(moduleId, parent);
899
+ };
900
+
901
+ importer(mod, mod.exports, require);
895
902
  } catch (e) {
896
903
  console.error("Error while evaluating ".concat(name, "."), e);
897
904
  }
@@ -913,7 +920,10 @@ function compileDependency(name, content) {
913
920
  }
914
921
 
915
922
  function includeScript(piletName, depName, link, integrity, crossOrigin) {
916
- window[depName] = requireModule;
923
+ window[depName] = function (moduleId) {
924
+ return requireModule(moduleId, link);
925
+ };
926
+
917
927
  return includeScriptDependency(link, integrity, crossOrigin).then(function (s) {
918
928
  return checkPiletAppAsync(piletName, s.app);
919
929
  }, function () {
@@ -3611,7 +3621,7 @@ function createInstance() {
3611
3621
  var createApi = apiFactory(context, usedPlugins);
3612
3622
  var root = createApi({
3613
3623
  name: 'root',
3614
- version: "0.14.14-beta.3765" || 0,
3624
+ version: "0.14.15-beta.3790" || 0,
3615
3625
  spec: ''
3616
3626
  });
3617
3627
  var options = (0,_helpers__WEBPACK_IMPORTED_MODULE_6__.createPiletOptions)({
@@ -9488,12 +9498,12 @@ function installPiralDebug(options) {
9488
9498
  debug: debugApiVersion,
9489
9499
  instance: {
9490
9500
  name: "sample-piral",
9491
- version: "0.14.14-beta.3765",
9501
+ version: "0.14.15-beta.3790",
9492
9502
  dependencies: "reactstrap,react,react-dom,react-router,react-router-dom,history,tslib,path-to-regexp,@libre/atom,@dbeining/react-atom"
9493
9503
  },
9494
9504
  build: {
9495
- date: "2022-03-02T17:59:28.793Z",
9496
- cli: "0.14.13",
9505
+ date: "2022-03-04T13:50:19.633Z",
9506
+ cli: "0.14.14",
9497
9507
  compat: "0.14"
9498
9508
  },
9499
9509
  pilets: {
@@ -9549,13 +9559,11 @@ function installPiralDebug(options) {
9549
9559
  var dependencyMap = {};
9550
9560
 
9551
9561
  var addDeps = function addDeps(pilet, dependencies) {
9552
- var _dependencyMap$pilet;
9553
-
9554
- if (!(pilet in dependencyMap)) {
9555
- dependencyMap[pilet] = [];
9556
- }
9557
-
9558
- (_dependencyMap$pilet = dependencyMap[pilet]).push.apply(_dependencyMap$pilet, _toConsumableArray(dependencies));
9562
+ var oldDeps = dependencyMap[pilet] || [];
9563
+ var newDeps = Object.keys(dependencies).filter(function (depName) {
9564
+ return !oldDeps.includes(depName);
9565
+ });
9566
+ dependencyMap[pilet] = [].concat(_toConsumableArray(oldDeps), _toConsumableArray(newDeps));
9559
9567
  };
9560
9568
 
9561
9569
  var pilets = getPilets().map(function (pilet) {
@@ -9821,7 +9829,7 @@ function decycle(obj) {
9821
9829
  "use strict";
9822
9830
  __webpack_require__.r(__webpack_exports__);
9823
9831
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9824
- /* harmony export */ "installPiletsEmulator": () => (/* binding */ installPiletsEmulator)
9832
+ /* harmony export */ "withEmulatorPilets": () => (/* binding */ withEmulatorPilets)
9825
9833
  /* harmony export */ });
9826
9834
  /* harmony import */ var piral_base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! piral-base */ "../../framework/piral-base/esm/utils.js");
9827
9835
  /* harmony import */ var piral_base__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! piral-base */ "../../framework/piral-base/esm/setup.js");
@@ -9840,7 +9848,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
9840
9848
 
9841
9849
 
9842
9850
 
9843
- function installPiletsEmulator(requestPilets, options) {
9851
+ function withEmulatorPilets(requestPilets, options) {
9844
9852
  var loadPilet = options.loadPilet,
9845
9853
  createApi = options.createApi,
9846
9854
  injectPilet = options.injectPilet,
@@ -9854,85 +9862,83 @@ function installPiletsEmulator(requestPilets, options) {
9854
9862
  return Promise.resolve([]);
9855
9863
  };
9856
9864
 
9857
- var _requester = loadPilets ? requestPilets : noPilets;
9858
-
9859
- integrate({
9865
+ var requester = loadPilets ? requestPilets : noPilets;
9866
+ integrate === null || integrate === void 0 ? void 0 : integrate({
9860
9867
  components: {
9861
9868
  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
-
9866
-
9867
- var piletApi = window['dbg:pilet-api'] || piletApiFallback; // either take a full URI or make it an absolute path relative to the current origin
9869
+ }
9870
+ });
9871
+ return function () {
9872
+ 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
9868
9873
 
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
- });
9874
+ var piletApi = window['dbg:pilet-api'] || piletApiFallback; // either take a full URI or make it an absolute path relative to the current origin
9879
9875
 
9880
- ws.onmessage = function (_ref) {
9881
- var data = _ref.data;
9882
- var hardRefresh = sessionStorage.getItem('dbg:hard-refresh') === 'on';
9876
+ var initialTarget = /^https?:/.test(piletApi) ? piletApi : "".concat(location.origin).concat(piletApi[0] === '/' ? '' : '/').concat(piletApi);
9877
+ var updateTarget = initialTarget.replace('http', 'ws');
9878
+ var ws = new WebSocket(updateTarget);
9879
+ var timeoutCache = {};
9880
+ var timeout = 150;
9881
+ var appendix = fetch(initialTarget).then(function (res) {
9882
+ return res.json();
9883
+ }).then(function (item) {
9884
+ return Array.isArray(item) ? item : [item];
9885
+ });
9883
9886
 
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
9887
+ ws.onmessage = function (_ref) {
9888
+ var data = _ref.data;
9889
+ var hardRefresh = sessionStorage.getItem('dbg:hard-refresh') === 'on';
9888
9890
 
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
9891
+ if (!hardRefresh) {
9892
+ // standard setting is to just perform an inject
9893
+ var meta = JSON.parse(data);
9894
+ var name = meta.name; // like a debounce; only one change of the current pilet should be actively processed
9891
9895
 
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
9896
+ clearTimeout(timeoutCache[name]); // some bundlers may have fired before writing to the disk
9897
+ // so we give them a bit of time before actually loading the pilet
9895
9898
 
9896
- injectPilet({
9897
- name: name
9898
- }); // load and evaluate pilet
9899
+ timeoutCache[name] = setTimeout(function () {
9900
+ // we should make sure to only refresh the page / router if pilets have been loaded
9901
+ var unfreeze = (0,_DebugRouteSwitch__WEBPACK_IMPORTED_MODULE_0__.freezeRouteRefresh)(); // tear down pilet
9899
9902
 
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
9903
+ injectPilet({
9904
+ name: name
9905
+ }); // load and evaluate pilet
9905
9906
 
9907
+ loadPilet(meta).then(function (pilet) {
9908
+ try {
9909
+ if ((0,piral_base__WEBPACK_IMPORTED_MODULE_1__.isfunc)(injectPilet)) {
9910
+ injectPilet(pilet);
9911
+ } // setup actual pilet
9906
9912
 
9907
- (0,piral_base__WEBPACK_IMPORTED_MODULE_2__.setupPilet)(pilet, createApi); // disable route cache, should be zero again and lead to route refresh
9908
9913
 
9909
- unfreeze();
9910
- } catch (error) {
9911
- console.error(error);
9912
- }
9913
- });
9914
- }, timeout);
9915
- } else {
9916
- location.reload();
9917
- }
9918
- };
9914
+ (0,piral_base__WEBPACK_IMPORTED_MODULE_2__.setupPilet)(pilet, createApi); // disable route cache, should be zero again and lead to route refresh
9919
9915
 
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);
9916
+ unfreeze();
9917
+ } catch (error) {
9918
+ console.error(error);
9919
+ }
9930
9920
  });
9931
- return [].concat(_toConsumableArray(feedPilets), _toConsumableArray(debugPilets));
9921
+ }, timeout);
9922
+ } else {
9923
+ location.reload();
9924
+ }
9925
+ };
9926
+
9927
+ return promise["catch"](function (err) {
9928
+ console.error("Requesting the pilets failed. We'll continue loading without pilets (DEBUG only).", err);
9929
+ return [];
9930
+ }).then(function (pilets) {
9931
+ return appendix.then(function (debugPilets) {
9932
+ var debugPiletNames = debugPilets.map(function (m) {
9933
+ return m.name;
9932
9934
  });
9935
+ var feedPilets = pilets.filter(function (m) {
9936
+ return !debugPiletNames.includes(m.name);
9937
+ });
9938
+ return [].concat(_toConsumableArray(feedPilets), _toConsumableArray(debugPilets));
9933
9939
  });
9934
- }
9935
- });
9940
+ });
9941
+ };
9936
9942
  }
9937
9943
 
9938
9944
  /***/ }),
@@ -9947,7 +9953,7 @@ function installPiletsEmulator(requestPilets, options) {
9947
9953
  __webpack_require__.r(__webpack_exports__);
9948
9954
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9949
9955
  /* harmony export */ "installPiralDebug": () => (/* reexport safe */ _debug__WEBPACK_IMPORTED_MODULE_0__.installPiralDebug),
9950
- /* harmony export */ "installPiletsEmulator": () => (/* reexport safe */ _emulator__WEBPACK_IMPORTED_MODULE_1__.installPiletsEmulator)
9956
+ /* harmony export */ "withEmulatorPilets": () => (/* reexport safe */ _emulator__WEBPACK_IMPORTED_MODULE_1__.withEmulatorPilets)
9951
9957
  /* harmony export */ });
9952
9958
  /* harmony import */ var _debug__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./debug */ "../../utilities/piral-debug-utils/esm/debug.js");
9953
9959
  /* harmony import */ var _emulator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./emulator */ "../../utilities/piral-debug-utils/esm/emulator.js");
@@ -10075,7 +10081,7 @@ exports.integrate = void 0;
10075
10081
  var piral_debug_utils_1 = __webpack_require__(/*! piral-debug-utils */ "../../utilities/piral-debug-utils/esm/index.js");
10076
10082
 
10077
10083
  function integrate(context, options) {
10078
- (0, piral_debug_utils_1.installPiletsEmulator)(options.fetchPilets, {
10084
+ options.fetchPilets = (0, piral_debug_utils_1.withEmulatorPilets)(options.fetchPilets, {
10079
10085
  injectPilet: context.injectPilet,
10080
10086
  createApi: options.createApi,
10081
10087
  loadPilet: options.loadPilet,
@@ -10085,7 +10091,6 @@ function integrate(context, options) {
10085
10091
  components: Object.assign(Object.assign({}, s.components), emulator.components)
10086
10092
  });
10087
10093
  });
10088
- options.fetchPilets = emulator.requester;
10089
10094
  }
10090
10095
  });
10091
10096
  }
@@ -80896,4 +80901,4 @@ var layout_1 = __webpack_require__(/*! ./layout */ "./src/layout.tsx");
80896
80901
 
80897
80902
  /******/ })()
80898
80903
  ;
80899
- //# sourceMappingURL=index.2d688d.js.map
80904
+ //# sourceMappingURL=index.8d39d5.js.map