@plasmicapp/loader-react 1.0.183 → 1.0.185

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.
@@ -168,11 +168,7 @@ function getUsedComps(allComponents, entryCompIds) {
168
168
  return usedComps;
169
169
  }
170
170
 
171
- function prepComponentData(bundle) {
172
- for (var _len = arguments.length, compMetas = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
173
- compMetas[_key - 1] = arguments[_key];
174
- }
175
-
171
+ function prepComponentData(bundle, compMetas, opts) {
176
172
  if (compMetas.length === 0) {
177
173
  return {
178
174
  entryCompMetas: bundle.components,
@@ -187,7 +183,7 @@ function prepComponentData(bundle) {
187
183
  var compPaths = usedComps.map(function (compMeta) {
188
184
  return compMeta.entry;
189
185
  });
190
- var subBundle = getBundleSubset.apply(void 0, [bundle, 'entrypoint.css'].concat(compPaths, ['root-provider.js'], bundle.projects.map(function (x) {
186
+ var subBundle = getBundleSubset(bundle, ['entrypoint.css'].concat(compPaths, ['root-provider.js'], bundle.projects.map(function (x) {
191
187
  return x.globalContextsProviderFileName;
192
188
  }).filter(function (x) {
193
189
  return !!x;
@@ -197,7 +193,7 @@ function prepComponentData(bundle) {
197
193
  return c.entry;
198
194
  }), bundle.globalGroups.map(function (g) {
199
195
  return g.contextFile;
200
- })));
196
+ })), opts);
201
197
  var remoteFontUrls = [];
202
198
  subBundle.projects.forEach(function (p) {
203
199
  return remoteFontUrls.push.apply(remoteFontUrls, p.remoteFonts.map(function (f) {
@@ -312,7 +308,7 @@ var convertBundlesToComponentRenderData = function convertBundlesToComponentRend
312
308
  var mergedBundles = bundles.reduce(function (prev, cur) {
313
309
  return mergeBundles(prev, cur);
314
310
  });
315
- return prepComponentData.apply(void 0, [mergedBundles].concat(compMetas));
311
+ return prepComponentData(mergedBundles, compMetas);
316
312
  };
317
313
 
318
314
  function createCommonjsModule(fn, module) {
@@ -1749,9 +1745,9 @@ var InternalPlasmicComponentLoader = /*#__PURE__*/function () {
1749
1745
  var _maybeFetchComponentData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
1750
1746
  var _this2 = this;
1751
1747
 
1752
- var _len2,
1748
+ var _parseFetchComponentD,
1753
1749
  specs,
1754
- _key2,
1750
+ opts,
1755
1751
  returnWithSpecsToFetch,
1756
1752
  _this$maybeGetCompMet,
1757
1753
  existingMetas,
@@ -1762,9 +1758,7 @@ var InternalPlasmicComponentLoader = /*#__PURE__*/function () {
1762
1758
  while (1) {
1763
1759
  switch (_context2.prev = _context2.next) {
1764
1760
  case 0:
1765
- for (_len2 = _args2.length, specs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1766
- specs[_key2] = _args2[_key2];
1767
- }
1761
+ _parseFetchComponentD = parseFetchComponentDataArgs.apply(void 0, _args2), specs = _parseFetchComponentD.specs, opts = _parseFetchComponentD.opts;
1768
1762
 
1769
1763
  returnWithSpecsToFetch = /*#__PURE__*/function () {
1770
1764
  var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(specsToFetch) {
@@ -1790,7 +1784,7 @@ var InternalPlasmicComponentLoader = /*#__PURE__*/function () {
1790
1784
  return _context.abrupt("return", null);
1791
1785
 
1792
1786
  case 5:
1793
- return _context.abrupt("return", prepComponentData.apply(void 0, [_this2.bundle].concat(existingMetas2)));
1787
+ return _context.abrupt("return", prepComponentData(_this2.bundle, existingMetas2, opts));
1794
1788
 
1795
1789
  case 6:
1796
1790
  case "end":
@@ -1825,7 +1819,7 @@ var InternalPlasmicComponentLoader = /*#__PURE__*/function () {
1825
1819
  break;
1826
1820
  }
1827
1821
 
1828
- return _context2.abrupt("return", prepComponentData.apply(void 0, [this.bundle].concat(existingMetas)));
1822
+ return _context2.abrupt("return", prepComponentData(this.bundle, existingMetas, opts));
1829
1823
 
1830
1824
  case 9:
1831
1825
  _context2.next = 11;
@@ -1851,7 +1845,10 @@ var InternalPlasmicComponentLoader = /*#__PURE__*/function () {
1851
1845
 
1852
1846
  _proto.fetchComponentData = /*#__PURE__*/function () {
1853
1847
  var _fetchComponentData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
1854
- var data,
1848
+ var _parseFetchComponentD2,
1849
+ specs,
1850
+ opts,
1851
+ data,
1855
1852
  _this$maybeGetCompMet2,
1856
1853
  missingSpecs,
1857
1854
  _args3 = arguments;
@@ -1860,24 +1857,25 @@ var InternalPlasmicComponentLoader = /*#__PURE__*/function () {
1860
1857
  while (1) {
1861
1858
  switch (_context3.prev = _context3.next) {
1862
1859
  case 0:
1863
- _context3.next = 2;
1864
- return this.maybeFetchComponentData.apply(this, _args3);
1860
+ _parseFetchComponentD2 = parseFetchComponentDataArgs.apply(void 0, _args3), specs = _parseFetchComponentD2.specs, opts = _parseFetchComponentD2.opts;
1861
+ _context3.next = 3;
1862
+ return this.maybeFetchComponentData(specs, opts);
1865
1863
 
1866
- case 2:
1864
+ case 3:
1867
1865
  data = _context3.sent;
1868
1866
 
1869
1867
  if (data) {
1870
- _context3.next = 6;
1868
+ _context3.next = 7;
1871
1869
  break;
1872
1870
  }
1873
1871
 
1874
- _this$maybeGetCompMet2 = this.maybeGetCompMetas.apply(this, _args3), missingSpecs = _this$maybeGetCompMet2.missing;
1872
+ _this$maybeGetCompMet2 = this.maybeGetCompMetas.apply(this, specs), missingSpecs = _this$maybeGetCompMet2.missing;
1875
1873
  throw new Error("Unable to find components " + missingSpecs.map(getLookupSpecName).join(', '));
1876
1874
 
1877
- case 6:
1875
+ case 7:
1878
1876
  return _context3.abrupt("return", data);
1879
1877
 
1880
- case 7:
1878
+ case 8:
1881
1879
  case "end":
1882
1880
  return _context3.stop();
1883
1881
  }
@@ -2457,6 +2455,28 @@ var PlasmicComponentLoader = /*#__PURE__*/function () {
2457
2455
  return PlasmicComponentLoader;
2458
2456
  }();
2459
2457
 
2458
+ function parseFetchComponentDataArgs() {
2459
+ var specs;
2460
+ var opts;
2461
+
2462
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
2463
+ args[_key2] = arguments[_key2];
2464
+ }
2465
+
2466
+ if (Array.isArray(args[0])) {
2467
+ specs = args[0];
2468
+ opts = args[1];
2469
+ } else {
2470
+ specs = args;
2471
+ opts = undefined;
2472
+ }
2473
+
2474
+ return {
2475
+ specs: specs,
2476
+ opts: opts
2477
+ };
2478
+ }
2479
+
2460
2480
  /**
2461
2481
  * Hook that fetches and returns a React component for rendering the argument
2462
2482
  * Plasmic component. Returns undefined if the component data is still