@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.esm.js
CHANGED
|
@@ -759,6 +759,24 @@ function customFunctionImportAlias(meta) {
|
|
|
759
759
|
function internalSetRegisteredFunction(fn, meta) {
|
|
760
760
|
REGISTERED_CUSTOM_FUNCTIONS[customFunctionImportAlias(meta)] = fn;
|
|
761
761
|
}
|
|
762
|
+
function checkRequiredQueryFunctions(module, componentDisplayName) {
|
|
763
|
+
const required = module == null ? void 0 : module.requiredServerQueryFunctions;
|
|
764
|
+
const missing = required == null ? void 0 : required.filter(
|
|
765
|
+
(f) => !REGISTERED_CUSTOM_FUNCTIONS[f.alias]
|
|
766
|
+
);
|
|
767
|
+
if (!missing || missing.length === 0) {
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
770
|
+
const missingNames = missing.map((f) => f.namespace ? `${f.namespace}.${f.name}` : f.name).join(", ");
|
|
771
|
+
const componentInfo = componentDisplayName ? `
|
|
772
|
+
Component: ${componentDisplayName}` : "";
|
|
773
|
+
throw new Error(
|
|
774
|
+
`Missing custom functions for Plasmic data queries: ${missingNames}${componentInfo}
|
|
775
|
+
|
|
776
|
+
In app-router projects, functions used in SSR'd queries must be registered in
|
|
777
|
+
plasmic-init.ts, not plasmic-init-client.tsx`
|
|
778
|
+
);
|
|
779
|
+
}
|
|
762
780
|
function parseFetchComponentDataArgs(...args) {
|
|
763
781
|
let specs;
|
|
764
782
|
let opts;
|
|
@@ -1133,10 +1151,15 @@ var PlasmicComponentLoader = class {
|
|
|
1133
1151
|
}
|
|
1134
1152
|
unstable__getServerQueriesData(renderData, $ctx) {
|
|
1135
1153
|
return __async(this, null, function* () {
|
|
1154
|
+
var _a;
|
|
1136
1155
|
const module = this.getExecFuncModule(
|
|
1137
1156
|
renderData,
|
|
1138
1157
|
"serverQueriesExecFuncFileName"
|
|
1139
1158
|
);
|
|
1159
|
+
checkRequiredQueryFunctions(
|
|
1160
|
+
module,
|
|
1161
|
+
(_a = renderData.entryCompMetas[0]) == null ? void 0 : _a.displayName
|
|
1162
|
+
);
|
|
1140
1163
|
try {
|
|
1141
1164
|
const $serverQueries = yield module == null ? void 0 : module.executeServerQueries($ctx);
|
|
1142
1165
|
return $serverQueries;
|
|
@@ -1148,15 +1171,16 @@ var PlasmicComponentLoader = class {
|
|
|
1148
1171
|
}
|
|
1149
1172
|
unstable__generateMetadata(renderData, props) {
|
|
1150
1173
|
return __async(this, null, function* () {
|
|
1151
|
-
var _a;
|
|
1152
1174
|
const module = this.getExecFuncModule(
|
|
1153
1175
|
renderData,
|
|
1154
1176
|
"serverQueriesExecFuncFileName"
|
|
1155
1177
|
);
|
|
1156
|
-
const
|
|
1178
|
+
const component = renderData.entryCompMetas[0];
|
|
1179
|
+
const fallback = (component == null ? void 0 : component.pageMetadata) || {};
|
|
1157
1180
|
if (!module) {
|
|
1158
1181
|
return fallback;
|
|
1159
1182
|
}
|
|
1183
|
+
checkRequiredQueryFunctions(module, component == null ? void 0 : component.displayName);
|
|
1160
1184
|
try {
|
|
1161
1185
|
const metadata = yield module.generateMetadata(props);
|
|
1162
1186
|
return metadata;
|