@plasmicapp/loader-react 2.0.0 → 2.0.2
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.esm.js +26 -2
- package/dist/index.esm.js.map +2 -2
- package/dist/index.js +26 -2
- package/dist/index.js.map +2 -2
- package/dist/react-server.esm.js +26 -2
- package/dist/react-server.esm.js.map +2 -2
- package/dist/react-server.js +26 -2
- package/dist/react-server.js.map +3 -3
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -806,6 +806,24 @@ function customFunctionImportAlias(meta) {
|
|
|
806
806
|
function internalSetRegisteredFunction(fn, meta) {
|
|
807
807
|
REGISTERED_CUSTOM_FUNCTIONS[customFunctionImportAlias(meta)] = fn;
|
|
808
808
|
}
|
|
809
|
+
function checkRequiredQueryFunctions(module2, componentDisplayName) {
|
|
810
|
+
const required = module2 == null ? void 0 : module2.requiredServerQueryFunctions;
|
|
811
|
+
const missing = required == null ? void 0 : required.filter(
|
|
812
|
+
(f) => !REGISTERED_CUSTOM_FUNCTIONS[f.alias]
|
|
813
|
+
);
|
|
814
|
+
if (!missing || missing.length === 0) {
|
|
815
|
+
return;
|
|
816
|
+
}
|
|
817
|
+
const missingNames = missing.map((f) => f.namespace ? `${f.namespace}.${f.name}` : f.name).join(", ");
|
|
818
|
+
const componentInfo = componentDisplayName ? `
|
|
819
|
+
Component: ${componentDisplayName}` : "";
|
|
820
|
+
throw new Error(
|
|
821
|
+
`Missing custom functions for Plasmic data queries: ${missingNames}${componentInfo}
|
|
822
|
+
|
|
823
|
+
In app-router projects, functions used in SSR'd queries must be registered in
|
|
824
|
+
plasmic-init.ts, not plasmic-init-client.tsx`
|
|
825
|
+
);
|
|
826
|
+
}
|
|
809
827
|
function parseFetchComponentDataArgs(...args) {
|
|
810
828
|
let specs;
|
|
811
829
|
let opts;
|
|
@@ -1180,10 +1198,15 @@ var PlasmicComponentLoader = class {
|
|
|
1180
1198
|
}
|
|
1181
1199
|
unstable__getServerQueriesData(renderData, $ctx) {
|
|
1182
1200
|
return __async(this, null, function* () {
|
|
1201
|
+
var _a;
|
|
1183
1202
|
const module2 = this.getExecFuncModule(
|
|
1184
1203
|
renderData,
|
|
1185
1204
|
"serverQueriesExecFuncFileName"
|
|
1186
1205
|
);
|
|
1206
|
+
checkRequiredQueryFunctions(
|
|
1207
|
+
module2,
|
|
1208
|
+
(_a = renderData.entryCompMetas[0]) == null ? void 0 : _a.displayName
|
|
1209
|
+
);
|
|
1187
1210
|
try {
|
|
1188
1211
|
const $serverQueries = yield module2 == null ? void 0 : module2.executeServerQueries($ctx);
|
|
1189
1212
|
return $serverQueries;
|
|
@@ -1195,15 +1218,16 @@ var PlasmicComponentLoader = class {
|
|
|
1195
1218
|
}
|
|
1196
1219
|
unstable__generateMetadata(renderData, props) {
|
|
1197
1220
|
return __async(this, null, function* () {
|
|
1198
|
-
var _a;
|
|
1199
1221
|
const module2 = this.getExecFuncModule(
|
|
1200
1222
|
renderData,
|
|
1201
1223
|
"serverQueriesExecFuncFileName"
|
|
1202
1224
|
);
|
|
1203
|
-
const
|
|
1225
|
+
const component = renderData.entryCompMetas[0];
|
|
1226
|
+
const fallback = (component == null ? void 0 : component.pageMetadata) || {};
|
|
1204
1227
|
if (!module2) {
|
|
1205
1228
|
return fallback;
|
|
1206
1229
|
}
|
|
1230
|
+
checkRequiredQueryFunctions(module2, component == null ? void 0 : component.displayName);
|
|
1207
1231
|
try {
|
|
1208
1232
|
const metadata = yield module2.generateMetadata(props);
|
|
1209
1233
|
return metadata;
|