vite-plugin-html-pages 1.5.4 → 1.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/page.d.ts +30 -4
- package/dist/page.js +8 -0
- package/dist/page.js.map +1 -1
- package/package.json +1 -1
package/dist/page.d.ts
CHANGED
|
@@ -1,17 +1,43 @@
|
|
|
1
1
|
type PageParams = Record<string, string | string[] | undefined>;
|
|
2
|
+
type StaticParams = PageParams[];
|
|
2
3
|
|
|
3
|
-
type
|
|
4
|
+
type DataContext = {
|
|
4
5
|
params: PageParams;
|
|
5
|
-
data?: unknown;
|
|
6
6
|
dev: boolean;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
+
type RenderContext<TData = unknown> = {
|
|
10
|
+
params: PageParams;
|
|
11
|
+
data: TData;
|
|
12
|
+
dev: boolean;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type PageContext<TData = unknown> = {
|
|
16
|
+
params: PageParams;
|
|
17
|
+
data?: TData;
|
|
18
|
+
dev: boolean;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
type PageModule<TData = unknown> = {
|
|
22
|
+
generateStaticParams?: () => StaticParams | Promise<StaticParams>;
|
|
23
|
+
data?: (ctx: DataContext) => TData | Promise<TData>;
|
|
24
|
+
render: (ctx: RenderContext<TData>) => any;
|
|
25
|
+
};
|
|
26
|
+
|
|
9
27
|
declare function definePage<T extends (ctx: PageContext) => any>(
|
|
10
28
|
fn: T,
|
|
11
29
|
): T;
|
|
12
30
|
|
|
31
|
+
declare function defineData<T extends (ctx: DataContext) => any>(
|
|
32
|
+
fn: T,
|
|
33
|
+
): T;
|
|
34
|
+
|
|
13
35
|
declare function defineStaticParams<
|
|
14
|
-
T extends () =>
|
|
36
|
+
T extends () => StaticParams | Promise<StaticParams>
|
|
15
37
|
>(fn: T): T;
|
|
16
38
|
|
|
17
|
-
|
|
39
|
+
declare function definePageModule<TData>(
|
|
40
|
+
mod: PageModule<TData>,
|
|
41
|
+
): PageModule<TData>;
|
|
42
|
+
|
|
43
|
+
export { type DataContext, type PageContext, type PageModule, type PageParams, type RenderContext, type StaticParams, defineData, definePage, definePageModule, defineStaticParams };
|
package/dist/page.js
CHANGED
|
@@ -2,11 +2,19 @@
|
|
|
2
2
|
function definePage(fn) {
|
|
3
3
|
return fn;
|
|
4
4
|
}
|
|
5
|
+
function defineData(fn) {
|
|
6
|
+
return fn;
|
|
7
|
+
}
|
|
5
8
|
function defineStaticParams(fn) {
|
|
6
9
|
return fn;
|
|
7
10
|
}
|
|
11
|
+
function definePageModule(mod) {
|
|
12
|
+
return mod;
|
|
13
|
+
}
|
|
8
14
|
export {
|
|
15
|
+
defineData,
|
|
9
16
|
definePage,
|
|
17
|
+
definePageModule,
|
|
10
18
|
defineStaticParams
|
|
11
19
|
};
|
|
12
20
|
//# sourceMappingURL=page.js.map
|
package/dist/page.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/page.ts"],"sourcesContent":["export type PageParams = Record<string, string | string[] | undefined>;\n\nexport type PageContext = {\n params: PageParams;\n data?:
|
|
1
|
+
{"version":3,"sources":["../src/page.ts"],"sourcesContent":["export type PageParams = Record<string, string | string[] | undefined>;\nexport type StaticParams = PageParams[];\n\nexport type DataContext = {\n params: PageParams;\n dev: boolean;\n};\n\nexport type RenderContext<TData = unknown> = {\n params: PageParams;\n data: TData;\n dev: boolean;\n};\n\nexport type PageContext<TData = unknown> = {\n params: PageParams;\n data?: TData;\n dev: boolean;\n};\n\nexport type PageModule<TData = unknown> = {\n generateStaticParams?: () => StaticParams | Promise<StaticParams>;\n data?: (ctx: DataContext) => TData | Promise<TData>;\n render: (ctx: RenderContext<TData>) => any;\n};\n\nexport function definePage<T extends (ctx: PageContext) => any>(fn: T): T {\n return fn;\n}\n\nexport function defineData<T extends (ctx: DataContext) => any>(fn: T): T {\n return fn;\n}\n\nexport function defineStaticParams<\n T extends () => StaticParams | Promise<StaticParams>\n>(fn: T): T {\n return fn;\n}\n\nexport function definePageModule<TData>(\n mod: PageModule<TData>,\n): PageModule<TData> {\n return mod;\n}"],"mappings":";AA0BO,SAAS,WAAgD,IAAU;AACxE,SAAO;AACT;AAEO,SAAS,WAAgD,IAAU;AACxE,SAAO;AACT;AAEO,SAAS,mBAEd,IAAU;AACV,SAAO;AACT;AAEO,SAAS,iBACd,KACmB;AACnB,SAAO;AACT;","names":[]}
|