@plasmicapp/loader-react 1.0.113 → 1.0.118

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