@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.
@@ -43,6 +43,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
43
43
  mod
44
44
  ));
45
45
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
46
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
46
47
  var __async = (__this, __arguments, generator) => {
47
48
  return new Promise((resolve, reject) => {
48
49
  var fulfilled = (value) => {
@@ -367,8 +368,8 @@ function getFirstCompMeta(metas, lookup) {
367
368
  }
368
369
  var ComponentLookup = class {
369
370
  constructor(bundle, registry) {
370
- this.bundle = bundle;
371
- this.registry = registry;
371
+ __publicField(this, "bundle", bundle);
372
+ __publicField(this, "registry", registry);
372
373
  }
373
374
  getComponentMeta(spec) {
374
375
  const compMeta = getFirstCompMeta(this.bundle.components, spec);
@@ -508,10 +509,14 @@ function parseFetchComponentDataArgs(...args) {
508
509
  }
509
510
  var BaseInternalPlasmicComponentLoader = class {
510
511
  constructor(args) {
511
- this.registry = new import_loader_core2.Registry();
512
- this.globalVariants = [];
513
- this.subs = [];
514
- this.bundle = {
512
+ __publicField(this, "opts");
513
+ __publicField(this, "registry", new import_loader_core2.Registry());
514
+ __publicField(this, "fetcher");
515
+ __publicField(this, "onBundleMerged");
516
+ __publicField(this, "onBundleFetched");
517
+ __publicField(this, "globalVariants", []);
518
+ __publicField(this, "subs", []);
519
+ __publicField(this, "bundle", {
515
520
  modules: {
516
521
  browser: [],
517
522
  server: []
@@ -524,7 +529,7 @@ var BaseInternalPlasmicComponentLoader = class {
524
529
  deferChunksByDefault: false,
525
530
  disableRootLoadingBoundaryByDefault: false,
526
531
  filteredIds: {}
527
- };
532
+ });
528
533
  this.opts = args.opts;
529
534
  this.fetcher = args.fetcher;
530
535
  this.onBundleMerged = args.onBundleMerged;
@@ -756,6 +761,7 @@ ${this.bundle.bundleKey}`
756
761
  };
757
762
  var PlasmicComponentLoader = class {
758
763
  constructor(internal) {
764
+ __publicField(this, "__internal");
759
765
  this.__internal = internal;
760
766
  }
761
767
  /**
@@ -866,7 +872,7 @@ var PlasmicComponentLoader = class {
866
872
  }
867
873
  return this.__internal.loadServerQueriesModule(fileName);
868
874
  }
869
- unstable__getServerQueriesData(renderData, $ctx) {
875
+ unstable__getServerQueriesData(renderData, $ctx, $props) {
870
876
  return __async(this, null, function* () {
871
877
  var _a2;
872
878
  const module2 = this.getExecFuncModule(
@@ -878,7 +884,7 @@ var PlasmicComponentLoader = class {
878
884
  (_a2 = renderData.entryCompMetas[0]) == null ? void 0 : _a2.displayName
879
885
  );
880
886
  try {
881
- const $serverQueries = yield module2 == null ? void 0 : module2.executeServerQueries($ctx);
887
+ const $serverQueries = yield module2 == null ? void 0 : module2.executeServerQueries($ctx, $props);
882
888
  return $serverQueries;
883
889
  } catch (err) {
884
890
  console.error("Error executing server queries function", err);
@@ -944,8 +950,7 @@ function stableHash(arg) {
944
950
  let index;
945
951
  if (Object(arg) === arg && !isDate && constructor != RegExp) {
946
952
  result = table.get(arg);
947
- if (result)
948
- return result;
953
+ if (result) return result;
949
954
  result = ++counter + "~";
950
955
  table.set(arg, result);
951
956
  if (constructor == Array) {
@@ -979,7 +984,7 @@ var unreachable = () => {
979
984
  debugger;
980
985
  throw new Error("Unreachable code");
981
986
  };
982
- var REACT_PROVIDER_TYPE = typeof Symbol === "function" && Symbol.for ? Symbol.for("react.provider") : 60109;
987
+ var REACT_PROVIDER_TYPE = typeof Symbol === "function" && Symbol.for ? /* @__PURE__ */ Symbol.for("react.provider") : 60109;
983
988
  var FakeRootProviderContext = {
984
989
  _currentValue: void 0
985
990
  // default value
@@ -1051,8 +1056,8 @@ var fakeUseMutablePlasmicQueryData = (unserializedKey, fetcher) => {
1051
1056
  if (!key) {
1052
1057
  return {
1053
1058
  isValidating: false,
1054
- mutate: () => __async(void 0, null, function* () {
1055
- }),
1059
+ mutate: (() => __async(null, null, function* () {
1060
+ })),
1056
1061
  data: void 0
1057
1062
  };
1058
1063
  }
@@ -1060,8 +1065,8 @@ var fakeUseMutablePlasmicQueryData = (unserializedKey, fetcher) => {
1060
1065
  if (cache.has(key)) {
1061
1066
  return {
1062
1067
  isValidating: false,
1063
- mutate: () => __async(void 0, null, function* () {
1064
- }),
1068
+ mutate: (() => __async(null, null, function* () {
1069
+ })),
1065
1070
  data: cache.get(key)
1066
1071
  };
1067
1072
  }
@@ -1072,8 +1077,8 @@ var fakeUseMutablePlasmicQueryData = (unserializedKey, fetcher) => {
1072
1077
  cache.set(key, response);
1073
1078
  return {
1074
1079
  isValidating: false,
1075
- mutate: () => __async(void 0, null, function* () {
1076
- }),
1080
+ mutate: (() => __async(null, null, function* () {
1081
+ })),
1077
1082
  data: cache.get(key)
1078
1083
  };
1079
1084
  }
@@ -1081,13 +1086,13 @@ var fakeUseMutablePlasmicQueryData = (unserializedKey, fetcher) => {
1081
1086
  var _a;
1082
1087
  var FakeReactComponent = (_a = class {
1083
1088
  constructor() {
1084
- this.context = void 0;
1085
- this.props = {};
1086
- this.setState = (v) => void (this.state = v);
1087
- this.forceUpdate = noop;
1088
- this.render = () => null;
1089
- this.state = {};
1090
- this.refs = {};
1089
+ __publicField(this, "context");
1090
+ __publicField(this, "props", {});
1091
+ __publicField(this, "setState", (v) => void (this.state = v));
1092
+ __publicField(this, "forceUpdate", noop);
1093
+ __publicField(this, "render", () => null);
1094
+ __publicField(this, "state", {});
1095
+ __publicField(this, "refs", {});
1091
1096
  }
1092
1097
  initRender(props) {
1093
1098
  this.props = props;
@@ -1101,8 +1106,8 @@ var FakeReactComponent = (_a = class {
1101
1106
  );
1102
1107
  }
1103
1108
  }
1104
- }, _a.contextType = void 0, _a);
1105
- var fakeCreateElement = (originalCreateElement) => (type, ...args) => {
1109
+ }, __publicField(_a, "contextType"), _a);
1110
+ var fakeCreateElement = ((originalCreateElement) => (type, ...args) => {
1106
1111
  if (Object.prototype.isPrototypeOf.call(FakeReactComponent, type)) {
1107
1112
  return originalCreateElement((props) => {
1108
1113
  const instance = new type();
@@ -1111,7 +1116,7 @@ var fakeCreateElement = (originalCreateElement) => (type, ...args) => {
1111
1116
  }, ...args);
1112
1117
  }
1113
1118
  return originalCreateElement(type, ...args);
1114
- };
1119
+ });
1115
1120
  var InternalPrepassPlasmicLoader = class extends BaseInternalPlasmicComponentLoader {
1116
1121
  constructor(opts) {
1117
1122
  super({
@@ -1229,7 +1234,7 @@ var InternalPrepassPlasmicLoader = class extends BaseInternalPlasmicComponentLoa
1229
1234
  }
1230
1235
  };
1231
1236
  })(),
1232
- "@plasmicapp/host": (() => {
1237
+ "@plasmicapp/host": /* @__PURE__ */ (() => {
1233
1238
  return {
1234
1239
  applySelector: fakeApplySelector,
1235
1240
  DataContext: FakeDataContext,
@@ -1278,8 +1283,8 @@ var InternalPrepassPlasmicLoader = class extends BaseInternalPlasmicComponentLoa
1278
1283
  }
1279
1284
  }
1280
1285
  });
1281
- this.registerTrait = noop;
1282
- this.registerToken = noop;
1286
+ __publicField(this, "registerTrait", noop);
1287
+ __publicField(this, "registerToken", noop);
1283
1288
  }
1284
1289
  registerComponent(component, meta) {
1285
1290
  var _a2;