@plasmicapp/loader-react 2.0.3 → 2.0.5

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.
@@ -17,6 +17,7 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
20
21
  var __async = (__this, __arguments, generator) => {
21
22
  return new Promise((resolve, reject) => {
22
23
  var fulfilled = (value) => {
@@ -338,8 +339,8 @@ function getFirstCompMeta(metas, lookup) {
338
339
  }
339
340
  var ComponentLookup = class {
340
341
  constructor(bundle, registry) {
341
- this.bundle = bundle;
342
- this.registry = registry;
342
+ __publicField(this, "bundle", bundle);
343
+ __publicField(this, "registry", registry);
343
344
  }
344
345
  getComponentMeta(spec) {
345
346
  const compMeta = getFirstCompMeta(this.bundle.components, spec);
@@ -479,10 +480,14 @@ function parseFetchComponentDataArgs(...args) {
479
480
  }
480
481
  var BaseInternalPlasmicComponentLoader = class {
481
482
  constructor(args) {
482
- this.registry = new Registry();
483
- this.globalVariants = [];
484
- this.subs = [];
485
- this.bundle = {
483
+ __publicField(this, "opts");
484
+ __publicField(this, "registry", new Registry());
485
+ __publicField(this, "fetcher");
486
+ __publicField(this, "onBundleMerged");
487
+ __publicField(this, "onBundleFetched");
488
+ __publicField(this, "globalVariants", []);
489
+ __publicField(this, "subs", []);
490
+ __publicField(this, "bundle", {
486
491
  modules: {
487
492
  browser: [],
488
493
  server: []
@@ -495,7 +500,7 @@ var BaseInternalPlasmicComponentLoader = class {
495
500
  deferChunksByDefault: false,
496
501
  disableRootLoadingBoundaryByDefault: false,
497
502
  filteredIds: {}
498
- };
503
+ });
499
504
  this.opts = args.opts;
500
505
  this.fetcher = args.fetcher;
501
506
  this.onBundleMerged = args.onBundleMerged;
@@ -727,6 +732,7 @@ ${this.bundle.bundleKey}`
727
732
  };
728
733
  var PlasmicComponentLoader = class {
729
734
  constructor(internal) {
735
+ __publicField(this, "__internal");
730
736
  this.__internal = internal;
731
737
  }
732
738
  /**
@@ -837,7 +843,7 @@ var PlasmicComponentLoader = class {
837
843
  }
838
844
  return this.__internal.loadServerQueriesModule(fileName);
839
845
  }
840
- unstable__getServerQueriesData(renderData, $ctx) {
846
+ unstable__getServerQueriesData(renderData, $ctx, $props) {
841
847
  return __async(this, null, function* () {
842
848
  var _a2;
843
849
  const module = this.getExecFuncModule(
@@ -849,7 +855,7 @@ var PlasmicComponentLoader = class {
849
855
  (_a2 = renderData.entryCompMetas[0]) == null ? void 0 : _a2.displayName
850
856
  );
851
857
  try {
852
- const $serverQueries = yield module == null ? void 0 : module.executeServerQueries($ctx);
858
+ const $serverQueries = yield module == null ? void 0 : module.executeServerQueries($ctx, $props);
853
859
  return $serverQueries;
854
860
  } catch (err) {
855
861
  console.error("Error executing server queries function", err);
@@ -915,8 +921,7 @@ function stableHash(arg) {
915
921
  let index;
916
922
  if (Object(arg) === arg && !isDate && constructor != RegExp) {
917
923
  result = table.get(arg);
918
- if (result)
919
- return result;
924
+ if (result) return result;
920
925
  result = ++counter + "~";
921
926
  table.set(arg, result);
922
927
  if (constructor == Array) {
@@ -950,7 +955,7 @@ var unreachable = () => {
950
955
  debugger;
951
956
  throw new Error("Unreachable code");
952
957
  };
953
- var REACT_PROVIDER_TYPE = typeof Symbol === "function" && Symbol.for ? Symbol.for("react.provider") : 60109;
958
+ var REACT_PROVIDER_TYPE = typeof Symbol === "function" && Symbol.for ? /* @__PURE__ */ Symbol.for("react.provider") : 60109;
954
959
  var FakeRootProviderContext = {
955
960
  _currentValue: void 0
956
961
  // default value
@@ -1022,8 +1027,8 @@ var fakeUseMutablePlasmicQueryData = (unserializedKey, fetcher) => {
1022
1027
  if (!key) {
1023
1028
  return {
1024
1029
  isValidating: false,
1025
- mutate: () => __async(void 0, null, function* () {
1026
- }),
1030
+ mutate: (() => __async(null, null, function* () {
1031
+ })),
1027
1032
  data: void 0
1028
1033
  };
1029
1034
  }
@@ -1031,8 +1036,8 @@ var fakeUseMutablePlasmicQueryData = (unserializedKey, fetcher) => {
1031
1036
  if (cache.has(key)) {
1032
1037
  return {
1033
1038
  isValidating: false,
1034
- mutate: () => __async(void 0, null, function* () {
1035
- }),
1039
+ mutate: (() => __async(null, null, function* () {
1040
+ })),
1036
1041
  data: cache.get(key)
1037
1042
  };
1038
1043
  }
@@ -1043,8 +1048,8 @@ var fakeUseMutablePlasmicQueryData = (unserializedKey, fetcher) => {
1043
1048
  cache.set(key, response);
1044
1049
  return {
1045
1050
  isValidating: false,
1046
- mutate: () => __async(void 0, null, function* () {
1047
- }),
1051
+ mutate: (() => __async(null, null, function* () {
1052
+ })),
1048
1053
  data: cache.get(key)
1049
1054
  };
1050
1055
  }
@@ -1052,13 +1057,13 @@ var fakeUseMutablePlasmicQueryData = (unserializedKey, fetcher) => {
1052
1057
  var _a;
1053
1058
  var FakeReactComponent = (_a = class {
1054
1059
  constructor() {
1055
- this.context = void 0;
1056
- this.props = {};
1057
- this.setState = (v) => void (this.state = v);
1058
- this.forceUpdate = noop;
1059
- this.render = () => null;
1060
- this.state = {};
1061
- this.refs = {};
1060
+ __publicField(this, "context");
1061
+ __publicField(this, "props", {});
1062
+ __publicField(this, "setState", (v) => void (this.state = v));
1063
+ __publicField(this, "forceUpdate", noop);
1064
+ __publicField(this, "render", () => null);
1065
+ __publicField(this, "state", {});
1066
+ __publicField(this, "refs", {});
1062
1067
  }
1063
1068
  initRender(props) {
1064
1069
  this.props = props;
@@ -1072,8 +1077,8 @@ var FakeReactComponent = (_a = class {
1072
1077
  );
1073
1078
  }
1074
1079
  }
1075
- }, _a.contextType = void 0, _a);
1076
- var fakeCreateElement = (originalCreateElement) => (type, ...args) => {
1080
+ }, __publicField(_a, "contextType"), _a);
1081
+ var fakeCreateElement = ((originalCreateElement) => (type, ...args) => {
1077
1082
  if (Object.prototype.isPrototypeOf.call(FakeReactComponent, type)) {
1078
1083
  return originalCreateElement((props) => {
1079
1084
  const instance = new type();
@@ -1082,7 +1087,7 @@ var fakeCreateElement = (originalCreateElement) => (type, ...args) => {
1082
1087
  }, ...args);
1083
1088
  }
1084
1089
  return originalCreateElement(type, ...args);
1085
- };
1090
+ });
1086
1091
  var InternalPrepassPlasmicLoader = class extends BaseInternalPlasmicComponentLoader {
1087
1092
  constructor(opts) {
1088
1093
  super({
@@ -1200,7 +1205,7 @@ var InternalPrepassPlasmicLoader = class extends BaseInternalPlasmicComponentLoa
1200
1205
  }
1201
1206
  };
1202
1207
  })(),
1203
- "@plasmicapp/host": (() => {
1208
+ "@plasmicapp/host": /* @__PURE__ */ (() => {
1204
1209
  return {
1205
1210
  applySelector: fakeApplySelector,
1206
1211
  DataContext: FakeDataContext,
@@ -1249,8 +1254,8 @@ var InternalPrepassPlasmicLoader = class extends BaseInternalPlasmicComponentLoa
1249
1254
  }
1250
1255
  }
1251
1256
  });
1252
- this.registerTrait = noop;
1253
- this.registerToken = noop;
1257
+ __publicField(this, "registerTrait", noop);
1258
+ __publicField(this, "registerToken", noop);
1254
1259
  }
1255
1260
  registerComponent(component, meta) {
1256
1261
  var _a2;