-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat(next): astro:routes:resolved #12329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
621d2d2
fbb04e9
98e77c9
96f560b
65f5b60
75a84dc
3a3b083
ec16abf
ce0fc54
7e26fa4
319b405
db92a98
fc4e42c
ebb12f9
b377e0f
33b1165
5576af9
46be686
c9dcd7c
24600f0
ea9abf4
93a69e2
e837aff
7db88f9
12088d0
e1f53d5
539d40f
846c3a7
cd62268
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ import type { getToolbarServerCommunicationHelpers } from '../../integrations/ho | |
| import type { DeepPartial } from '../../type-utils.js'; | ||
| import type { AstroConfig } from './config.js'; | ||
| import type { RefreshContentOptions } from './content.js'; | ||
| import type { RouteData } from './internal.js'; | ||
| import type { InternalInjectedRoute, RouteData } from './internal.js'; | ||
| import type { DevToolbarAppEntry } from './toolbar.js'; | ||
|
|
||
| export interface RouteOptions { | ||
|
|
@@ -138,15 +138,7 @@ export type AstroAdapterFeatureMap = { | |
| */ | ||
| export type InjectedScriptStage = 'before-hydration' | 'head-inline' | 'page' | 'page-ssr'; | ||
|
|
||
| export interface InjectedRoute { | ||
| pattern: string; | ||
| entrypoint: string | URL; | ||
| prerender?: boolean; | ||
| } | ||
|
|
||
| export interface ResolvedInjectedRoute extends InjectedRoute { | ||
| resolvedEntryPoint?: URL; | ||
| } | ||
| export type InjectedRoute = Omit<InternalInjectedRoute, 'origin'>; | ||
|
|
||
| export interface InjectedType { | ||
| filename: string; | ||
|
|
@@ -225,13 +217,18 @@ export interface BaseIntegrationHooks { | |
| 'astro:build:done': (options: { | ||
| pages: { pathname: string }[]; | ||
| dir: URL; | ||
| /** @deprecated Use `routes` from `astro:routes:resolved` instead */ | ||
florian-lefebvre marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| routes: IntegrationRouteData[]; | ||
| logger: AstroIntegrationLogger; | ||
| }) => void | Promise<void>; | ||
| 'astro:route:setup': (options: { | ||
| route: RouteOptions; | ||
| logger: AstroIntegrationLogger; | ||
| }) => void | Promise<void>; | ||
| 'astro:routes:resolved': (options: { | ||
| routes: Array<IntegrationResolvedRoute>; | ||
florian-lefebvre marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| logger: AstroIntegrationLogger; | ||
| }) => void | Promise<void>; | ||
| } | ||
|
|
||
| export interface AstroIntegration { | ||
|
|
@@ -248,10 +245,41 @@ export interface AstroIntegration { | |
| */ | ||
| export type IntegrationRouteData = Omit< | ||
| RouteData, | ||
| 'isIndex' | 'fallbackRoutes' | 'redirectRoute' | ||
| 'isIndex' | 'fallbackRoutes' | 'redirectRoute' | 'origin' | ||
| > & { | ||
| /** | ||
| * {@link RouteData.redirectRoute} | ||
| */ | ||
| redirectRoute?: IntegrationRouteData; | ||
| }; | ||
|
|
||
| export interface IntegrationResolvedRoute { | ||
ematipico marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /** | ||
| * The current **pattern** of the route. For example: | ||
| * - `src/pages/index.astro` has a pattern of `/` | ||
| * - `src/pages/blog/[...slug].astro` has a pattern of `/blog/[...slug]` | ||
| * - `src/pages/site/[blog]/[...slug].astro` has a pattern of `/site/[blog]/[...slug]` | ||
| */ | ||
| pattern: RouteData['route']; | ||
|
|
||
| /** | ||
| * Source component URL | ||
| */ | ||
| entrypoint: RouteData['component']; | ||
|
||
|
|
||
| /** | ||
| * Whether the route is prerendered or not | ||
| */ | ||
| prerendered: RouteData['prerender']; | ||
florian-lefebvre marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| /** | ||
| * Dynamic and spread route params | ||
| * ex. "/pages/[lang]/[...slug].astro" will output the params ['lang', '...slug'] | ||
| */ | ||
| params: RouteData['params']; | ||
florian-lefebvre marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| /** | ||
| * Whether the route comes from Astro core, an integration or the user's project | ||
| */ | ||
| origin: RouteData['origin']; | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.