@ampless/runtime 0.2.0-alpha.1 → 0.2.0-alpha.3
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/dispatchers/index.d.ts +4 -7
- package/dist/middleware.d.ts +12 -6
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
import { Metadata } from 'next';
|
|
2
3
|
import { Ampless } from '../index.js';
|
|
3
4
|
import 'ampless';
|
|
@@ -7,16 +8,12 @@ interface Props$2 {
|
|
|
7
8
|
siteId: string;
|
|
8
9
|
}>;
|
|
9
10
|
}
|
|
10
|
-
type ThemeHomeDispatcher = (props: Props$2) => Promise<
|
|
11
|
+
type ThemeHomeDispatcher = (props: Props$2) => Promise<ReactNode>;
|
|
11
12
|
type ThemeHomeMetadata = (props: Props$2) => Promise<Metadata>;
|
|
12
13
|
/**
|
|
13
14
|
* Home page dispatcher. Resolves the active theme for the request's
|
|
14
15
|
* siteId and renders the theme's `components.Home` server component
|
|
15
16
|
* with the same `params` Promise it was passed.
|
|
16
|
-
*
|
|
17
|
-
* The return type is `unknown` (cast at the route boundary) because
|
|
18
|
-
* Next.js page-component prop types vary by route shape and the
|
|
19
|
-
* underlying theme components are arbitrary server components.
|
|
20
17
|
*/
|
|
21
18
|
declare function createThemeHomeDispatcher(ampless: Ampless): ThemeHomeDispatcher;
|
|
22
19
|
/** generateMetadata factory for the home dispatcher. */
|
|
@@ -28,7 +25,7 @@ interface Props$1 {
|
|
|
28
25
|
slug: string;
|
|
29
26
|
}>;
|
|
30
27
|
}
|
|
31
|
-
type ThemePostDispatcher = (props: Props$1) => Promise<
|
|
28
|
+
type ThemePostDispatcher = (props: Props$1) => Promise<ReactNode>;
|
|
32
29
|
type ThemePostMetadata = (props: Props$1) => Promise<Metadata>;
|
|
33
30
|
/**
|
|
34
31
|
* Post page dispatcher. Resolves the active theme and renders the
|
|
@@ -45,7 +42,7 @@ interface Props {
|
|
|
45
42
|
tag: string;
|
|
46
43
|
}>;
|
|
47
44
|
}
|
|
48
|
-
type ThemeTagDispatcher = (props: Props) => Promise<
|
|
45
|
+
type ThemeTagDispatcher = (props: Props) => Promise<ReactNode>;
|
|
49
46
|
type ThemeTagMetadata = (props: Props) => Promise<Metadata>;
|
|
50
47
|
/**
|
|
51
48
|
* Tag page dispatcher. Resolves the active theme and renders the
|
package/dist/middleware.d.ts
CHANGED
|
@@ -21,14 +21,20 @@ type MiddlewareFn = (request: NextRequest) => NextResponse;
|
|
|
21
21
|
*/
|
|
22
22
|
declare function createAmplessMiddleware({ cmsConfig }: CreateMiddlewareOpts): MiddlewareFn;
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
24
|
+
* Reference matcher config — admin / api / login / static assets /
|
|
25
|
+
* amplify_outputs.json are excluded so middleware doesn't rewrite
|
|
26
|
+
* legitimate non-blog routes into the public site tree.
|
|
26
27
|
*
|
|
27
|
-
*
|
|
28
|
+
* **You can't re-export this directly.** Next.js 16's Turbopack
|
|
29
|
+
* requires `export const config` in `proxy.ts` (or `middleware.ts`)
|
|
30
|
+
* to be a statically analysable object literal — referencing an
|
|
31
|
+
* imported variable fails the build with:
|
|
32
|
+
* "Next.js can't recognize the exported `config` field in route.
|
|
33
|
+
* It needs to be a static object."
|
|
28
34
|
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* non-
|
|
35
|
+
* So the scaffold inlines the matcher into the user's `proxy.ts`.
|
|
36
|
+
* This export is kept as a reference for documentation and for
|
|
37
|
+
* non-Next.js callers that want to inspect the canonical matcher.
|
|
32
38
|
*/
|
|
33
39
|
declare const defaultMatcherConfig: {
|
|
34
40
|
matcher: string[];
|
package/package.json
CHANGED