Initial commit: New MoreminiMore website with fresh design
This commit is contained in:
25
node_modules/astro/dist/runtime/prerender/static-paths.d.ts
generated
vendored
Normal file
25
node_modules/astro/dist/runtime/prerender/static-paths.d.ts
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
import type { SSRManifest } from '../../core/app/types.js';
|
||||
import type { Pipeline } from '../../core/base-pipeline.js';
|
||||
import type { PathWithRoute } from '../../types/public/integrations.js';
|
||||
export type { PathWithRoute } from '../../types/public/integrations.js';
|
||||
/**
|
||||
* Minimal interface for what StaticPaths needs from an App.
|
||||
* This allows adapters to pass any App-like object (BuildApp, NodeApp, etc).
|
||||
*/
|
||||
export interface StaticPathsApp {
|
||||
manifest: SSRManifest;
|
||||
pipeline: Pick<Pipeline, 'routeCache' | 'getComponentByRoute'>;
|
||||
}
|
||||
/**
|
||||
* Collects all static paths for prerendering.
|
||||
* Handles calling getStaticPaths on each route and populating the route cache.
|
||||
*/
|
||||
export declare class StaticPaths {
|
||||
#private;
|
||||
constructor(app: StaticPathsApp);
|
||||
/**
|
||||
* Get all static paths for prerendering with their associated routes.
|
||||
* This avoids needing to re-match routes later, which can be incorrect due to route priority.
|
||||
*/
|
||||
getAll(): Promise<PathWithRoute[]>;
|
||||
}
|
||||
77
node_modules/astro/dist/runtime/prerender/static-paths.js
generated
vendored
Normal file
77
node_modules/astro/dist/runtime/prerender/static-paths.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
import { stringifyParams } from "../../core/routing/params.js";
|
||||
import { getFallbackRoute, routeIsFallback, routeIsRedirect } from "../../core/routing/helpers.js";
|
||||
import { callGetStaticPaths } from "../../core/render/route-cache.js";
|
||||
class StaticPaths {
|
||||
#app;
|
||||
constructor(app) {
|
||||
this.#app = app;
|
||||
}
|
||||
/**
|
||||
* Get all static paths for prerendering with their associated routes.
|
||||
* This avoids needing to re-match routes later, which can be incorrect due to route priority.
|
||||
*/
|
||||
async getAll() {
|
||||
const allPaths = [];
|
||||
const manifest = this.#app.manifest;
|
||||
const routesToGenerate = [];
|
||||
for (const { routeData } of manifest.routes) {
|
||||
if (!routeData.prerender) continue;
|
||||
if (routeIsRedirect(routeData)) {
|
||||
routesToGenerate.push(routeData);
|
||||
continue;
|
||||
}
|
||||
if (routeIsFallback(routeData) && manifest.i18n?.fallback) {
|
||||
routesToGenerate.push(routeData);
|
||||
continue;
|
||||
}
|
||||
routesToGenerate.push(routeData);
|
||||
}
|
||||
for (const route of routesToGenerate) {
|
||||
for (const currentRoute of eachRouteInRouteData(route)) {
|
||||
const paths = await this.#getPathsForRoute(currentRoute);
|
||||
for (const path of paths) {
|
||||
allPaths.push(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
return allPaths;
|
||||
}
|
||||
/**
|
||||
* Get paths for a single route.
|
||||
* Note: Does not filter duplicates - that's handled by generate.ts with conflict detection.
|
||||
*/
|
||||
async #getPathsForRoute(route) {
|
||||
const paths = [];
|
||||
const manifest = this.#app.manifest;
|
||||
const routeCache = this.#app.pipeline.routeCache;
|
||||
if (route.pathname) {
|
||||
paths.push({ pathname: route.pathname, route });
|
||||
return paths;
|
||||
}
|
||||
const componentInstance = await this.#app.pipeline.getComponentByRoute(route);
|
||||
const routeToProcess = routeIsRedirect(route) ? route.redirectRoute : routeIsFallback(route) ? getFallbackRoute(route, manifest.routes) : route;
|
||||
const actualRoute = routeToProcess ?? route;
|
||||
const staticPaths = await callGetStaticPaths({
|
||||
mod: componentInstance,
|
||||
route: actualRoute,
|
||||
routeCache,
|
||||
ssr: manifest.serverLike,
|
||||
base: manifest.base,
|
||||
trailingSlash: manifest.trailingSlash
|
||||
});
|
||||
for (const staticPath of staticPaths) {
|
||||
const pathname = stringifyParams(staticPath.params, route, manifest.trailingSlash);
|
||||
paths.push({ pathname, route });
|
||||
}
|
||||
return paths;
|
||||
}
|
||||
}
|
||||
function* eachRouteInRouteData(route) {
|
||||
yield route;
|
||||
for (const fallbackRoute of route.fallbackRoutes) {
|
||||
yield fallbackRoute;
|
||||
}
|
||||
}
|
||||
export {
|
||||
StaticPaths
|
||||
};
|
||||
Reference in New Issue
Block a user