@taujs/server 0.5.4 → 0.5.5
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.js +0 -43
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2160,32 +2160,6 @@ var handleNotFound = async (req, reply, processedConfigs, maps, opts = {}) => {
|
|
|
2160
2160
|
}
|
|
2161
2161
|
};
|
|
2162
2162
|
|
|
2163
|
-
// src/core/routes/ResolveRouteData.ts
|
|
2164
|
-
async function resolveRouteDataCore(url, opts) {
|
|
2165
|
-
const match2 = matchRoute(url, opts.routeMatchers);
|
|
2166
|
-
if (!match2) {
|
|
2167
|
-
throw AppError.notFound("route_not_found", { details: { url } });
|
|
2168
|
-
}
|
|
2169
|
-
const { route, params } = match2;
|
|
2170
|
-
if (!route.attr?.data) {
|
|
2171
|
-
throw AppError.notFound("no_data_handler", {
|
|
2172
|
-
details: { url, path: route.path, appId: route.appId }
|
|
2173
|
-
});
|
|
2174
|
-
}
|
|
2175
|
-
const ctx = opts.getCtx();
|
|
2176
|
-
return fetchInitialData(route.attr, params, opts.serviceRegistry, ctx);
|
|
2177
|
-
}
|
|
2178
|
-
|
|
2179
|
-
// src/utils/ResolveRouteData.ts
|
|
2180
|
-
async function resolveRouteData(url, opts) {
|
|
2181
|
-
const { req, reply, routeMatchers, serviceRegistry, logger } = opts;
|
|
2182
|
-
return resolveRouteDataCore(url, {
|
|
2183
|
-
routeMatchers,
|
|
2184
|
-
serviceRegistry,
|
|
2185
|
-
getCtx: () => createRequestContext(req, reply, logger)
|
|
2186
|
-
});
|
|
2187
|
-
}
|
|
2188
|
-
|
|
2189
2163
|
// src/utils/StaticAssets.ts
|
|
2190
2164
|
function normaliseStaticAssets(reg) {
|
|
2191
2165
|
if (!reg) return [];
|
|
@@ -2295,23 +2269,6 @@ var SSRServer = fp3(
|
|
|
2295
2269
|
viteDevServer = await setupDevServer(app, clientRoot, alias, opts.debug, opts.devNet, plugins);
|
|
2296
2270
|
}
|
|
2297
2271
|
app.addHook("onRequest", createAuthHook(routeMatchers, logger));
|
|
2298
|
-
app.get("/__taujs/route", async (req, reply) => {
|
|
2299
|
-
const query = req.query;
|
|
2300
|
-
const url = typeof query.url === "string" ? query.url : "";
|
|
2301
|
-
if (!url) {
|
|
2302
|
-
throw AppError.badRequest("url query param required", {
|
|
2303
|
-
details: { query }
|
|
2304
|
-
});
|
|
2305
|
-
}
|
|
2306
|
-
const data = await resolveRouteData(url, {
|
|
2307
|
-
req,
|
|
2308
|
-
reply,
|
|
2309
|
-
routeMatchers,
|
|
2310
|
-
serviceRegistry,
|
|
2311
|
-
logger
|
|
2312
|
-
});
|
|
2313
|
-
return reply.status(200).send({ data });
|
|
2314
|
-
});
|
|
2315
2272
|
app.get("/*", async (req, reply) => {
|
|
2316
2273
|
await handleRender(req, reply, routeMatchers, processedConfigs, serviceRegistry, maps, {
|
|
2317
2274
|
debug: opts.debug,
|