@bobtail.software/b-ssr 1.0.8 → 1.0.9
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/vite-rpc-plugin.js +6 -5
- package/package.json +1 -1
package/dist/vite-rpc-plugin.js
CHANGED
|
@@ -603,16 +603,17 @@ node_modules`),!r)return;let i=(0,Isr.default)({allowRelativePaths:!0}).add(r);r
|
|
|
603
603
|
if (fn.isMultipart) throw new Error('RPC multipart no soportado en SSR.');
|
|
604
604
|
await getOptionsMaps();
|
|
605
605
|
const options = rpcOptionsMap.get('${f.url}');
|
|
606
|
-
if (!options?.handler) throw new Error('Handler no encontrado para RPC: ${f.name}');
|
|
607
|
-
|
|
608
|
-
|
|
606
|
+
if (!options?.handler) throw new Error('Handler no encontrado para RPC: ${f.name}');
|
|
607
|
+
const augmentedReq = Object.assign(Object.create(ssrContext.req), args);
|
|
608
|
+
return await options.handler.call(ssrContext.req.server, augmentedReq, ssrContext.reply);
|
|
609
609
|
`:`
|
|
610
610
|
await getOptionsMaps();
|
|
611
611
|
const options = renderOptionsMap.get('${f.url}');
|
|
612
612
|
if (!options) throw new Error('Opciones loader no encontradas para: ${f.name}');
|
|
613
|
+
const augmentedReq = Object.assign(Object.create(ssrContext.req), args || {});
|
|
613
614
|
let customData = {};
|
|
614
|
-
if (options.handler) customData = (await options.handler.call(ssrContext.req.server,
|
|
615
|
-
|
|
615
|
+
if (options.handler) customData = (await options.handler.call(ssrContext.req.server, augmentedReq, ssrContext.reply)) || {};
|
|
616
|
+
if (ssrContext.reply.sent) return;
|
|
616
617
|
return { ...customData };
|
|
617
618
|
`;return`exports.${f.name} = async (${v.join(", ")}) => {
|
|
618
619
|
try {
|
package/package.json
CHANGED