@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.
@@ -471,6 +471,9 @@ function customFunctionImportAlias(meta) {
471
471
  const customFunctionPrefix = `__fn_`;
472
472
  return meta.namespace ? `${customFunctionPrefix}${meta.namespace}__${meta.name}` : `${customFunctionPrefix}${meta.name}`;
473
473
  }
474
+ function internalSetRegisteredFunction(fn, meta) {
475
+ REGISTERED_CUSTOM_FUNCTIONS[customFunctionImportAlias(meta)] = fn;
476
+ }
474
477
  function parseFetchComponentDataArgs(...args) {
475
478
  let specs;
476
479
  let opts;
@@ -735,6 +738,9 @@ ${this.bundle.bundleKey}`
735
738
  trackRender(opts) {
736
739
  this.tracker.trackRender(opts);
737
740
  }
741
+ loadServerQueriesModule(fileName) {
742
+ return this.registry.load(fileName);
743
+ }
738
744
  };
739
745
  var PlasmicComponentLoader = class {
740
746
  constructor(internal) {
@@ -852,6 +858,26 @@ var PlasmicComponentLoader = class {
852
858
  clearCache() {
853
859
  return this.__internal.clearCache();
854
860
  }
861
+ unstable__getServerQueriesData(renderData, $ctx) {
862
+ return __async(this, null, function* () {
863
+ if (renderData.entryCompMetas.length === 0) {
864
+ return {};
865
+ }
866
+ const fileName = renderData.entryCompMetas[0].serverQueriesExecFuncFileName;
867
+ if (!fileName) {
868
+ return {};
869
+ }
870
+ const module = this.__internal.loadServerQueriesModule(fileName);
871
+ const { executeServerQueries } = module;
872
+ try {
873
+ const $serverQueries = yield executeServerQueries($ctx);
874
+ return $serverQueries;
875
+ } catch (err) {
876
+ console.error("Error executing server queries function", err);
877
+ return {};
878
+ }
879
+ });
880
+ }
855
881
  };
856
882
 
857
883
  // src/swr-util.ts
@@ -1204,6 +1230,7 @@ var InternalPrepassPlasmicLoader = class extends BaseInternalPlasmicComponentLoa
1204
1230
  usePlasmicCanvasComponentInfo: () => null
1205
1231
  };
1206
1232
  })(),
1233
+ "@plasmicapp/host/registerFunction": internalSetRegisteredFunction,
1207
1234
  "@plasmicapp/loader-runtime-registry": {
1208
1235
  components: SUBSTITUTED_COMPONENTS,
1209
1236
  globalVariantHooks: SUBSTITUTED_GLOBAL_VARIANT_HOOKS,