@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.
package/dist/index.d.ts CHANGED
@@ -487,7 +487,7 @@ export declare class PlasmicComponentLoader {
487
487
  getActiveSplits(): Split[];
488
488
  clearCache(): void;
489
489
  getExecFuncModule(renderData: ComponentRenderData, fileNameKey: "serverQueriesExecFuncFileName"): any;
490
- unstable__getServerQueriesData(renderData: ComponentRenderData, $ctx: Record<string, any>): Promise<any>;
490
+ unstable__getServerQueriesData(renderData: ComponentRenderData, $ctx: Record<string, any>, $props?: Record<string, any>): Promise<any>;
491
491
  unstable__generateMetadata(renderData: ComponentRenderData, props: {
492
492
  params: Promise<ParamsRecord> | ParamsRecord;
493
493
  query: Promise<ParamsRecord> | ParamsRecord;
package/dist/index.esm.js CHANGED
@@ -30,6 +30,7 @@ var __objRest = (source, exclude) => {
30
30
  }
31
31
  return target;
32
32
  };
33
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
33
34
  var __async = (__this, __arguments, generator) => {
34
35
  return new Promise((resolve, reject) => {
35
36
  var fulfilled = (value) => {
@@ -660,8 +661,8 @@ function getFirstCompMeta(metas, lookup) {
660
661
  }
661
662
  var ComponentLookup = class {
662
663
  constructor(bundle, registry) {
663
- this.bundle = bundle;
664
- this.registry = registry;
664
+ __publicField(this, "bundle", bundle);
665
+ __publicField(this, "registry", registry);
665
666
  }
666
667
  getComponentMeta(spec) {
667
668
  const compMeta = getFirstCompMeta(this.bundle.components, spec);
@@ -791,10 +792,14 @@ function parseFetchComponentDataArgs(...args) {
791
792
  }
792
793
  var BaseInternalPlasmicComponentLoader = class {
793
794
  constructor(args) {
794
- this.registry = new Registry();
795
- this.globalVariants = [];
796
- this.subs = [];
797
- this.bundle = {
795
+ __publicField(this, "opts");
796
+ __publicField(this, "registry", new Registry());
797
+ __publicField(this, "fetcher");
798
+ __publicField(this, "onBundleMerged");
799
+ __publicField(this, "onBundleFetched");
800
+ __publicField(this, "globalVariants", []);
801
+ __publicField(this, "subs", []);
802
+ __publicField(this, "bundle", {
798
803
  modules: {
799
804
  browser: [],
800
805
  server: []
@@ -807,7 +812,7 @@ var BaseInternalPlasmicComponentLoader = class {
807
812
  deferChunksByDefault: false,
808
813
  disableRootLoadingBoundaryByDefault: false,
809
814
  filteredIds: {}
810
- };
815
+ });
811
816
  this.opts = args.opts;
812
817
  this.fetcher = args.fetcher;
813
818
  this.onBundleMerged = args.onBundleMerged;
@@ -1039,6 +1044,7 @@ ${this.bundle.bundleKey}`
1039
1044
  };
1040
1045
  var PlasmicComponentLoader = class {
1041
1046
  constructor(internal) {
1047
+ __publicField(this, "__internal");
1042
1048
  this.__internal = internal;
1043
1049
  }
1044
1050
  /**
@@ -1149,7 +1155,7 @@ var PlasmicComponentLoader = class {
1149
1155
  }
1150
1156
  return this.__internal.loadServerQueriesModule(fileName);
1151
1157
  }
1152
- unstable__getServerQueriesData(renderData, $ctx) {
1158
+ unstable__getServerQueriesData(renderData, $ctx, $props) {
1153
1159
  return __async(this, null, function* () {
1154
1160
  var _a;
1155
1161
  const module = this.getExecFuncModule(
@@ -1161,7 +1167,7 @@ var PlasmicComponentLoader = class {
1161
1167
  (_a = renderData.entryCompMetas[0]) == null ? void 0 : _a.displayName
1162
1168
  );
1163
1169
  try {
1164
- const $serverQueries = yield module == null ? void 0 : module.executeServerQueries($ctx);
1170
+ const $serverQueries = yield module == null ? void 0 : module.executeServerQueries($ctx, $props);
1165
1171
  return $serverQueries;
1166
1172
  } catch (err) {
1167
1173
  console.error("Error executing server queries function", err);
@@ -1224,7 +1230,7 @@ var InternalPlasmicComponentLoader = class extends BaseInternalPlasmicComponentL
1224
1230
  }
1225
1231
  }
1226
1232
  });
1227
- this.roots = [];
1233
+ __publicField(this, "roots", []);
1228
1234
  }
1229
1235
  registerComponent(component, meta) {
1230
1236
  var _a, _b;
@@ -1333,7 +1339,7 @@ function usePlasmicComponent(spec, opts = {}) {
1333
1339
  const forceUpdate = useForceUpdate();
1334
1340
  React4.useEffect(() => {
1335
1341
  if (!component) {
1336
- (() => __async(this, null, function* () {
1342
+ (() => __async(null, null, function* () {
1337
1343
  yield loader.fetchComponentData(stableSpec);
1338
1344
  if (isMounted()) {
1339
1345
  forceUpdate();