@plasmicapp/loader-react 1.0.377 → 1.0.378

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.
@@ -501,6 +501,9 @@ function customFunctionImportAlias(meta) {
501
501
  const customFunctionPrefix = `__fn_`;
502
502
  return meta.namespace ? `${customFunctionPrefix}${meta.namespace}__${meta.name}` : `${customFunctionPrefix}${meta.name}`;
503
503
  }
504
+ function internalSetRegisteredFunction(fn, meta) {
505
+ REGISTERED_CUSTOM_FUNCTIONS[customFunctionImportAlias(meta)] = fn;
506
+ }
504
507
  function parseFetchComponentDataArgs(...args) {
505
508
  let specs;
506
509
  let opts;
@@ -765,6 +768,9 @@ ${this.bundle.bundleKey}`
765
768
  trackRender(opts) {
766
769
  this.tracker.trackRender(opts);
767
770
  }
771
+ loadServerQueriesModule(fileName) {
772
+ return this.registry.load(fileName);
773
+ }
768
774
  };
769
775
  var PlasmicComponentLoader = class {
770
776
  constructor(internal) {
@@ -882,6 +888,26 @@ var PlasmicComponentLoader = class {
882
888
  clearCache() {
883
889
  return this.__internal.clearCache();
884
890
  }
891
+ unstable__getServerQueriesData(renderData, $ctx) {
892
+ return __async(this, null, function* () {
893
+ if (renderData.entryCompMetas.length === 0) {
894
+ return {};
895
+ }
896
+ const fileName = renderData.entryCompMetas[0].serverQueriesExecFuncFileName;
897
+ if (!fileName) {
898
+ return {};
899
+ }
900
+ const module2 = this.__internal.loadServerQueriesModule(fileName);
901
+ const { executeServerQueries } = module2;
902
+ try {
903
+ const $serverQueries = yield executeServerQueries($ctx);
904
+ return $serverQueries;
905
+ } catch (err) {
906
+ console.error("Error executing server queries function", err);
907
+ return {};
908
+ }
909
+ });
910
+ }
885
911
  };
886
912
 
887
913
  // src/swr-util.ts
@@ -1234,6 +1260,7 @@ var InternalPrepassPlasmicLoader = class extends BaseInternalPlasmicComponentLoa
1234
1260
  usePlasmicCanvasComponentInfo: () => null
1235
1261
  };
1236
1262
  })(),
1263
+ "@plasmicapp/host/registerFunction": internalSetRegisteredFunction,
1237
1264
  "@plasmicapp/loader-runtime-registry": {
1238
1265
  components: SUBSTITUTED_COMPONENTS,
1239
1266
  globalVariantHooks: SUBSTITUTED_GLOBAL_VARIANT_HOOKS,