@plasmicapp/loader-react 1.0.117 → 1.0.120

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.
@@ -4,9 +4,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
6
 
7
- var host = require('@plasmicapp/host');
7
+ var PlasmicHost = require('@plasmicapp/host');
8
8
  var PlasmicQuery = require('@plasmicapp/query');
9
9
  var loaderCore = require('@plasmicapp/loader-core');
10
+ var plasmicHostRegisterComponent = require('@plasmicapp/host/registerComponent');
10
11
  var loaderSplits = require('@plasmicapp/loader-splits');
11
12
  var React = require('react');
12
13
  var React__default = _interopDefault(React);
@@ -396,9 +397,11 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
396
397
 
397
398
 
398
399
  var IteratorPrototype = {};
399
- define(IteratorPrototype, iteratorSymbol, function () {
400
+
401
+ IteratorPrototype[iteratorSymbol] = function () {
400
402
  return this;
401
- });
403
+ };
404
+
402
405
  var getProto = Object.getPrototypeOf;
403
406
  var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
404
407
 
@@ -409,9 +412,8 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
409
412
  }
410
413
 
411
414
  var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
412
- GeneratorFunction.prototype = GeneratorFunctionPrototype;
413
- define(Gp, "constructor", GeneratorFunctionPrototype);
414
- define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
415
+ GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
416
+ GeneratorFunctionPrototype.constructor = GeneratorFunction;
415
417
  GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
416
418
  // Iterator interface in terms of a single ._invoke method.
417
419
 
@@ -516,9 +518,11 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
516
518
  }
517
519
 
518
520
  defineIteratorMethods(AsyncIterator.prototype);
519
- define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
521
+
522
+ AsyncIterator.prototype[asyncIteratorSymbol] = function () {
520
523
  return this;
521
- });
524
+ };
525
+
522
526
  exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
523
527
  // AsyncIterator objects; they just return a Promise for the value of
524
528
  // the final result produced by the iterator.
@@ -695,12 +699,13 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
695
699
  // object to not be returned from this call. This ensures that doesn't happen.
696
700
  // See https://github.com/facebook/regenerator/issues/274 for more details.
697
701
 
698
- define(Gp, iteratorSymbol, function () {
702
+ Gp[iteratorSymbol] = function () {
699
703
  return this;
700
- });
701
- define(Gp, "toString", function () {
704
+ };
705
+
706
+ Gp.toString = function () {
702
707
  return "[object Generator]";
703
- });
708
+ };
704
709
 
705
710
  function pushTryEntry(locs) {
706
711
  var entry = {
@@ -1012,19 +1017,14 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
1012
1017
  } catch (accidentalStrictMode) {
1013
1018
  // This module should not be running in strict mode, so the above
1014
1019
  // assignment should always work unless something is misconfigured. Just
1015
- // in case runtime.js accidentally runs in strict mode, in modern engines
1016
- // we can explicitly access globalThis. In older engines we can escape
1020
+ // in case runtime.js accidentally runs in strict mode, we can escape
1017
1021
  // strict mode using a global Function call. This could conceivably fail
1018
1022
  // if a Content Security Policy forbids using Function, but in that case
1019
1023
  // the proper solution is to fix the accidental strict mode problem. If
1020
1024
  // you've misconfigured your bundler to force strict mode and applied a
1021
1025
  // CSP to forbid Function, and you're not willing to fix either of those
1022
1026
  // problems, please detail your unique predicament in a GitHub issue.
1023
- if (typeof globalThis === "object") {
1024
- globalThis.regeneratorRuntime = runtime;
1025
- } else {
1026
- Function("r", "regeneratorRuntime = r")(runtime);
1027
- }
1027
+ Function("r", "regeneratorRuntime = r")(runtime);
1028
1028
  }
1029
1029
  });
1030
1030
 
@@ -1476,15 +1476,6 @@ function createUseGlobalVariant(name, projectId) {
1476
1476
  var isBrowser = typeof window !== 'undefined';
1477
1477
  function initPlasmicLoader(opts) {
1478
1478
  var internal = new InternalPlasmicComponentLoader(opts);
1479
- internal.registerModules({
1480
- react: React__default,
1481
- 'react-dom': ReactDOM,
1482
- 'react/jsx-runtime': jsxRuntime,
1483
- 'react/jsx-dev-runtime': jsxDevRuntime,
1484
- // Also inject @plasmicapp/query at run time, so that the same
1485
- // context is used here and in loader-downloaded code
1486
- '@plasmicapp/query': PlasmicQuery
1487
- });
1488
1479
  return new PlasmicComponentLoader(internal);
1489
1480
  }
1490
1481
  var InternalPlasmicComponentLoader = /*#__PURE__*/function () {
@@ -1506,6 +1497,17 @@ var InternalPlasmicComponentLoader = /*#__PURE__*/function () {
1506
1497
  };
1507
1498
  this.registry = loaderCore.Registry.getInstance();
1508
1499
  this.fetcher = new loaderCore.PlasmicModulesFetcher(opts);
1500
+ this.registerModules({
1501
+ react: React__default,
1502
+ 'react-dom': ReactDOM,
1503
+ 'react/jsx-runtime': jsxRuntime,
1504
+ 'react/jsx-dev-runtime': jsxDevRuntime,
1505
+ // Also inject @plasmicapp/query and @plasmicapp/host to use the
1506
+ // same contexts here and in loader-downloaded code.
1507
+ '@plasmicapp/query': PlasmicQuery,
1508
+ '@plasmicapp/host': PlasmicHost,
1509
+ '@plasmicapp/host/registerComponent': plasmicHostRegisterComponent
1510
+ });
1509
1511
  }
1510
1512
 
1511
1513
  var _proto = InternalPlasmicComponentLoader.prototype;
@@ -1556,7 +1558,7 @@ var InternalPlasmicComponentLoader = /*#__PURE__*/function () {
1556
1558
  isCode: true
1557
1559
  }); // Import path is not used as we will use component substitution
1558
1560
 
1559
- host.registerComponent(component, _extends({}, meta, {
1561
+ PlasmicHost.registerComponent(component, _extends({}, meta, {
1560
1562
  importPath: (_meta$importPath = meta.importPath) != null ? _meta$importPath : ''
1561
1563
  }));
1562
1564
  };
@@ -1569,13 +1571,13 @@ var InternalPlasmicComponentLoader = /*#__PURE__*/function () {
1569
1571
  isCode: true
1570
1572
  }); // Import path is not used as we will use component substitution
1571
1573
 
1572
- host.registerGlobalContext(context, _extends({}, meta, {
1574
+ PlasmicHost.registerGlobalContext(context, _extends({}, meta, {
1573
1575
  importPath: (_meta$importPath2 = meta.importPath) != null ? _meta$importPath2 : ''
1574
1576
  }));
1575
1577
  };
1576
1578
 
1577
1579
  _proto.registerTrait = function registerTrait(trait, meta) {
1578
- host.registerTrait(trait, meta);
1580
+ PlasmicHost.registerTrait(trait, meta);
1579
1581
  };
1580
1582
 
1581
1583
  _proto.registerPrefetchedBundle = function registerPrefetchedBundle(bundle) {
@@ -2720,25 +2722,25 @@ function makeElement(loader, lookup, opts) {
2720
2722
  Object.defineProperty(exports, 'PlasmicCanvasContext', {
2721
2723
  enumerable: true,
2722
2724
  get: function () {
2723
- return host.PlasmicCanvasContext;
2725
+ return PlasmicHost.PlasmicCanvasContext;
2724
2726
  }
2725
2727
  });
2726
2728
  Object.defineProperty(exports, 'PlasmicCanvasHost', {
2727
2729
  enumerable: true,
2728
2730
  get: function () {
2729
- return host.PlasmicCanvasHost;
2731
+ return PlasmicHost.PlasmicCanvasHost;
2730
2732
  }
2731
2733
  });
2732
2734
  Object.defineProperty(exports, 'repeatedElement', {
2733
2735
  enumerable: true,
2734
2736
  get: function () {
2735
- return host.repeatedElement;
2737
+ return PlasmicHost.repeatedElement;
2736
2738
  }
2737
2739
  });
2738
2740
  Object.defineProperty(exports, 'usePlasmicCanvasContext', {
2739
2741
  enumerable: true,
2740
2742
  get: function () {
2741
- return host.usePlasmicCanvasContext;
2743
+ return PlasmicHost.usePlasmicCanvasContext;
2742
2744
  }
2743
2745
  });
2744
2746
  Object.defineProperty(exports, 'usePlasmicQueryData', {