@stacksjs/stx 0.2.155 → 0.2.156
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/a11y.d.ts +87 -46
- package/dist/animation.d.ts +96 -42
- package/dist/appearance-bootstrap.d.ts +49 -15
- package/dist/asset-roots.d.ts +32 -0
- package/dist/asset-roots.js +7 -0
- package/dist/assets.d.ts +9 -7
- package/dist/async-components.d.ts +78 -56
- package/dist/auth.d.ts +3 -0
- package/dist/build-externalize.d.ts +40 -0
- package/dist/build-externalize.js +63 -0
- package/dist/build-id.d.ts +22 -22
- package/dist/build-message.d.ts +73 -2
- package/dist/build-message.js +47 -8
- package/dist/builtins/attrs.d.ts +14 -0
- package/dist/builtins/drawer.d.ts +22 -0
- package/dist/builtins/icon.d.ts +16 -2
- package/dist/builtins/index.d.ts +5 -15
- package/dist/builtins/modal.d.ts +24 -0
- package/dist/builtins/safe-image.d.ts +42 -0
- package/dist/builtins/stx-image.d.ts +27 -0
- package/dist/builtins/stx-link.d.ts +9 -0
- package/dist/builtins/stx-loading-indicator.d.ts +11 -0
- package/dist/builtins/suspense.d.ts +28 -0
- package/dist/builtins/toast.d.ts +17 -0
- package/dist/builtins/transition-group.d.ts +25 -0
- package/dist/caching.d.ts +12 -15
- package/dist/cli.js +1798 -908
- package/dist/client/directive.d.ts +7 -0
- package/dist/client/index.d.ts +0 -1
- package/dist/client-script-bundler.d.ts +63 -5
- package/dist/client-script-bundler.js +30 -2
- package/dist/client-script.d.ts +102 -47
- package/dist/client-script.js +15 -3
- package/dist/codemod.d.ts +56 -0
- package/dist/codemod.js +192 -0
- package/dist/color-mode-boot.d.ts +83 -65
- package/dist/component-client-factories.d.ts +1 -6
- package/dist/component-processing.d.ts +58 -49
- package/dist/component-processing.js +1 -1
- package/dist/component-registry.d.ts +94 -31
- package/dist/component-renderer.d.ts +18 -0
- package/dist/composable-loader.d.ts +24 -0
- package/dist/composable-loader.js +12 -9
- package/dist/composables/index.d.ts +7 -0
- package/dist/composables/index.js +1 -0
- package/dist/composables/use-fetch.js +30 -2
- package/dist/composables/use-form.d.ts +91 -0
- package/dist/composables/use-form.js +112 -0
- package/dist/composables.d.ts +64 -60
- package/dist/computed.d.ts +86 -92
- package/dist/conditionals.d.ts +24 -8
- package/dist/conditionals.js +16 -0
- package/dist/config.d.ts +34 -21
- package/dist/config.js +35 -14
- package/dist/craft.js +1476 -768
- package/dist/crosswind-config.d.ts +58 -0
- package/dist/crosswind-config.js +40 -0
- package/dist/csp.d.ts +107 -41
- package/dist/defer.d.ts +24 -0
- package/dist/dev-server/crosswind.d.ts +35 -26
- package/dist/dev-server/crosswind.js +2 -18
- package/dist/dev-server/serve-app.js +4 -3
- package/dist/dev-server/terminal-colors.d.ts +32 -32
- package/dist/directive-api.d.ts +86 -43
- package/dist/document-shell.d.ts +54 -41
- package/dist/dynamic-components.d.ts +9 -0
- package/dist/error-boundaries.d.ts +47 -41
- package/dist/error-handling.d.ts +1 -1
- package/dist/errors/codes.d.ts +51 -43
- package/dist/errors/formatter.d.ts +58 -38
- package/dist/errors/index.d.ts +5 -61
- package/dist/errors/logger.d.ts +114 -40
- package/dist/errors/sanitizer.d.ts +53 -23
- package/dist/errors/types.d.ts +44 -31
- package/dist/events.d.ts +86 -25
- package/dist/expressions.d.ts +50 -42
- package/dist/forms-validation.d.ts +138 -123
- package/dist/forms-validation.js +1 -90
- package/dist/forms.d.ts +120 -66
- package/dist/forms.js +31 -11
- package/dist/fragment-container.d.ts +57 -0
- package/dist/fragment-container.js +109 -0
- package/dist/framework-composables.d.ts +32 -0
- package/dist/head.d.ts +156 -114
- package/dist/heatmap.d.ts +152 -72
- package/dist/html-masking.d.ts +40 -34
- package/dist/hydration-runtime.d.ts +20 -24
- package/dist/i18n.d.ts +93 -32
- package/dist/image-optimization/auto-sibling.d.ts +32 -4
- package/dist/includes.d.ts +69 -7
- package/dist/index.d.ts +66 -0
- package/dist/index.js +23 -0
- package/dist/internal-markdown.d.ts +12 -8
- package/dist/island-chunking.d.ts +30 -13
- package/dist/keep-alive.d.ts +72 -52
- package/dist/layout-types.d.ts +45 -0
- package/dist/layout-types.js +56 -0
- package/dist/lazy-module.d.ts +10 -0
- package/dist/loops.d.ts +66 -0
- package/dist/loops.js +47 -6
- package/dist/markdown.d.ts +0 -1
- package/dist/media/image/component.d.ts +25 -9
- package/dist/media/image/directive.d.ts +15 -1
- package/dist/media/image/placeholder.d.ts +20 -9
- package/dist/media/image/processor/cache.d.ts +40 -18
- package/dist/media/image/processor/index.d.ts +1 -10
- package/dist/media/image/processor/optimizer.d.ts +12 -1
- package/dist/media/image/processor/responsive.d.ts +16 -6
- package/dist/media/image/srcset.d.ts +47 -50
- package/dist/media/shared/cache.d.ts +51 -31
- package/dist/media/shared/hash.d.ts +7 -0
- package/dist/media/types.d.ts +1235 -754
- package/dist/media/video/directive.d.ts +15 -1
- package/dist/media/video/index.d.ts +39 -17
- package/dist/media/video/processor/cache.d.ts +42 -19
- package/dist/media/video/processor/index.d.ts +1 -18
- package/dist/media/video/processor/streaming.d.ts +17 -10
- package/dist/media/video/processor/thumbnail.d.ts +21 -15
- package/dist/media/video/processor/transcoder.d.ts +11 -1
- package/dist/method-spoofing.d.ts +7 -0
- package/dist/middleware.d.ts +60 -0
- package/dist/owned-routes.d.ts +42 -0
- package/dist/owned-routes.js +26 -0
- package/dist/page-meta.d.ts +38 -0
- package/dist/page-meta.js +16 -0
- package/dist/parser/directive-parser.d.ts +57 -45
- package/dist/parser/expression-parser.d.ts +33 -35
- package/dist/parser/index.d.ts +4 -39
- package/dist/parser/tokenizer.d.ts +61 -49
- package/dist/partial-hydration.d.ts +82 -50
- package/dist/performance-utils.d.ts +217 -124
- package/dist/placeholder.d.ts +18 -9
- package/dist/plugin-system.d.ts +264 -115
- package/dist/process.d.ts +11 -6
- package/dist/process.js +21 -4
- package/dist/production-builder.js +7 -0
- package/dist/prop-sentinels.d.ts +11 -11
- package/dist/public-env.d.ts +14 -0
- package/dist/pwa/directives.d.ts +12 -3
- package/dist/pwa/inject.d.ts +10 -0
- package/dist/pwa/precache.d.ts +22 -16
- package/dist/pwa/service-worker.d.ts +12 -0
- package/dist/pwa.js +1318 -610
- package/dist/reactive-bindings.d.ts +34 -11
- package/dist/reactive.d.ts +58 -30
- package/dist/reactive.js +56 -31
- package/dist/render.js +1 -0
- package/dist/route-middleware.d.ts +2 -35
- package/dist/route-types.d.ts +134 -0
- package/dist/route-types.js +24 -0
- package/dist/router.d.ts +5 -7
- package/dist/routes.d.ts +1 -3
- package/dist/runtime-globals.d.ts +147 -24
- package/dist/runtime-globals.js +16 -1
- package/dist/runtime-injection.d.ts +8 -0
- package/dist/runtime-injection.js +33 -24
- package/dist/script-emit.d.ts +30 -0
- package/dist/script-json.d.ts +36 -0
- package/dist/script-json.js +6 -0
- package/dist/script-validation.d.ts +21 -4
- package/dist/seo.d.ts +118 -47
- package/dist/server-bindings.d.ts +21 -0
- package/dist/sfc-template.d.ts +8 -8
- package/dist/signal-processing.d.ts +35 -15
- package/dist/signals-api.d.ts +117 -58
- package/dist/signals-api.js +7 -4
- package/dist/signals.d.ts +24 -17
- package/dist/signals.js +765 -60
- package/dist/site-builder/build.js +8 -0
- package/dist/site-url.d.ts +46 -0
- package/dist/site-url.js +70 -0
- package/dist/slots.d.ts +86 -20
- package/dist/source-signature.d.ts +45 -0
- package/dist/source-signature.js +20 -0
- package/dist/ssg.d.ts +285 -142
- package/dist/ssg.js +1268 -556
- package/dist/state-dir.d.ts +4 -4
- package/dist/state-management.d.ts +0 -12
- package/dist/state-management.js +8 -25
- package/dist/store-imports.d.ts +23 -0
- package/dist/store-imports.js +3 -0
- package/dist/store-loader.d.ts +10 -0
- package/dist/store-loader.js +10 -9
- package/dist/story/analytics.d.ts +138 -60
- package/dist/story/bookmarks.d.ts +87 -34
- package/dist/story/cli.d.ts +123 -69
- package/dist/story/collect/scanner.d.ts +4 -0
- package/dist/story/collect/tree.d.ts +8 -1
- package/dist/story/commands/build.d.ts +11 -6
- package/dist/story/commands/dev.d.ts +15 -8
- package/dist/story/commands/preview.d.ts +13 -7
- package/dist/story/config-watcher.d.ts +20 -13
- package/dist/story/config.d.ts +11 -8
- package/dist/story/context.d.ts +14 -8
- package/dist/story/hmr.d.ts +24 -26
- package/dist/story/hot-swap.d.ts +34 -23
- package/dist/story/keyboard-shortcuts.d.ts +23 -18
- package/dist/story/output.d.ts +46 -44
- package/dist/story/performance.d.ts +107 -45
- package/dist/story/presets.d.ts +107 -41
- package/dist/story/renderer.d.ts +41 -27
- package/dist/story/search.d.ts +23 -12
- package/dist/story/server.d.ts +21 -11
- package/dist/story/setup.d.ts +23 -15
- package/dist/story/testing.d.ts +65 -40
- package/dist/story/types.d.ts +262 -160
- package/dist/streaming.d.ts +119 -57
- package/dist/stx-virtual-ts.d.ts +165 -0
- package/dist/stx-virtual-ts.js +372 -0
- package/dist/stx.d.ts +78 -1
- package/dist/style-scoping.d.ts +17 -4
- package/dist/suspense.d.ts +67 -52
- package/dist/teleport.d.ts +22 -0
- package/dist/template-tag-balance.d.ts +22 -6
- package/dist/transitions.d.ts +66 -55
- package/dist/typecheck.d.ts +77 -0
- package/dist/typecheck.js +156 -0
- package/dist/types/component-types.d.ts +187 -122
- package/dist/types/config-types.d.ts +758 -297
- package/dist/types/context-types.d.ts +46 -24
- package/dist/types/csp-types.d.ts +70 -66
- package/dist/types/directive-types.d.ts +211 -155
- package/dist/types/index.d.ts +6 -109
- package/dist/types/pwa-types.d.ts +273 -148
- package/dist/types.d.ts +0 -1
- package/dist/typescript-templates.d.ts +11 -0
- package/dist/unresolved-identifiers.d.ts +24 -22
- package/dist/unresolved-identifiers.js +2 -0
- package/dist/utils.d.ts +24 -21
- package/dist/validator.d.ts +28 -26
- package/dist/variable-extractor.d.ts +48 -13
- package/dist/variable-extractor.js +27 -4
- package/dist/view-composers.d.ts +80 -81
- package/dist/virtual-scrolling.d.ts +101 -81
- package/dist/vue-template.d.ts +23 -0
- package/dist/web-components/css-scoping.d.ts +21 -11
- package/dist/web-components.d.ts +81 -58
- package/dist/x-element.d.ts +0 -1
- package/package.json +5 -5
- package/stx.d.ts +78 -1
package/dist/ssg.d.ts
CHANGED
|
@@ -1,160 +1,303 @@
|
|
|
1
|
-
/// <reference path="./stx.d.ts" />
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
*
|
|
2
|
+
* Static Site Generation (SSG) with Incremental Static Regeneration (ISR)
|
|
3
|
+
*
|
|
4
|
+
* Pre-renders pages at build time for optimal performance and SEO.
|
|
5
|
+
* Supports on-demand revalidation for dynamic content.
|
|
6
|
+
*
|
|
7
|
+
* ## Features
|
|
8
|
+
*
|
|
9
|
+
* - Build-time page generation from file-based routes
|
|
10
|
+
* - Dynamic route handling with getStaticPaths()
|
|
11
|
+
* - Incremental Static Regeneration (ISR)
|
|
12
|
+
* - Automatic sitemap generation
|
|
13
|
+
* - RSS feed generation
|
|
14
|
+
* - Content source integrations (Markdown, CMS, API)
|
|
15
|
+
* - Parallel page generation
|
|
16
|
+
* - Build caching for faster rebuilds
|
|
17
|
+
*
|
|
18
|
+
* ## Usage
|
|
19
|
+
*
|
|
20
|
+
* ```typescript
|
|
21
|
+
* import { generateStaticSite, defineStaticPaths } from 'stx/ssg'
|
|
22
|
+
*
|
|
23
|
+
* // Generate entire site
|
|
24
|
+
* await generateStaticSite({
|
|
25
|
+
* pagesDir: 'pages',
|
|
26
|
+
* outputDir: 'dist',
|
|
27
|
+
* revalidate: 3600, // ISR: revalidate every hour
|
|
28
|
+
* })
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* For dynamic routes, export getStaticPaths in your template:
|
|
32
|
+
* ```html
|
|
33
|
+
* <script server>
|
|
34
|
+
* export async function getStaticPaths() {
|
|
35
|
+
* const posts = await fetchPosts()
|
|
36
|
+
* return posts.map(post => ({
|
|
37
|
+
* params: { slug: post.slug },
|
|
38
|
+
* props: { post }
|
|
39
|
+
* }))
|
|
40
|
+
* }
|
|
41
|
+
* </script>
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @module ssg
|
|
16
45
|
*/
|
|
17
|
-
export
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
export interface SSGConfig {
|
|
47
|
+
/** Directory containing pages (default: 'pages') */
|
|
48
|
+
pagesDir?: string;
|
|
49
|
+
/** Output directory for generated files (default: 'dist') */
|
|
50
|
+
outputDir?: string;
|
|
51
|
+
/** Base URL for the site (default: '/') */
|
|
52
|
+
baseUrl?: string;
|
|
53
|
+
/** Site domain for absolute URLs */
|
|
54
|
+
domain?: string;
|
|
55
|
+
/** Enable ISR with revalidation time in seconds */
|
|
56
|
+
revalidate?: number | false;
|
|
57
|
+
/** Generate sitemap.xml */
|
|
58
|
+
sitemap?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Routes to keep out of sitemap.xml (#1866).
|
|
61
|
+
*
|
|
62
|
+
* Strings match a URL exactly or as a `/prefix/` when they end in `/`;
|
|
63
|
+
* RegExps are tested against the URL. A page can also exclude itself with
|
|
64
|
+
* `definePageMeta({ sitemap: false })` or by declaring a `noindex` robots
|
|
65
|
+
* meta, which is checked without needing this list.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* sitemapExclude: ['/login', '/account/', /^\/admin/]
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
sitemapExclude?: (string | RegExp)[];
|
|
73
|
+
/**
|
|
74
|
+
* Generate robots.txt (default: true).
|
|
75
|
+
*
|
|
76
|
+
* Written from the same resolved site URL as the sitemap, with a `Sitemap:`
|
|
77
|
+
* line pointing at it, and a `Disallow` for every `sitemapExclude` entry —
|
|
78
|
+
* so the two files cannot disagree about what is public.
|
|
79
|
+
*/
|
|
80
|
+
robots?: boolean | RobotsConfig;
|
|
81
|
+
/** Generate RSS feed */
|
|
82
|
+
rss?: boolean | RSSConfig;
|
|
83
|
+
/** Parallel page generation limit (default: 10) */
|
|
84
|
+
concurrency?: number;
|
|
85
|
+
/** Enable build caching (default: true) */
|
|
86
|
+
cache?: boolean;
|
|
87
|
+
/** Cache directory (default: `ssg-cache` inside the state directory) */
|
|
88
|
+
cacheDir?: string;
|
|
89
|
+
/** Custom content loaders */
|
|
90
|
+
contentLoaders?: ContentLoader[];
|
|
91
|
+
/** Pre-render hooks */
|
|
92
|
+
hooks?: SSGHooks;
|
|
93
|
+
/** Minify HTML output (default: true in production) */
|
|
94
|
+
minify?: boolean;
|
|
95
|
+
/** Generate 404 page */
|
|
96
|
+
generate404?: boolean;
|
|
97
|
+
/** Additional files to copy to output */
|
|
98
|
+
publicDir?: string;
|
|
99
|
+
/** Trailing slash behavior */
|
|
100
|
+
trailingSlash?: boolean;
|
|
101
|
+
/** Clean output directory before build */
|
|
102
|
+
cleanOutput?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Per-island chunking (#1746): lift each `client="<trigger>"` island's inline
|
|
105
|
+
* setup script into a content-hashed chunk under `_stx/islands/` that the
|
|
106
|
+
* runtime fetches only on the hydration trigger. Default `false` (opt-in) —
|
|
107
|
+
* when off, builds are byte-identical and islands stay inline.
|
|
108
|
+
*/
|
|
109
|
+
chunkIslands?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Emit `<link rel="prefetch" as="script">` hints for `visible`/`idle` island
|
|
112
|
+
* chunks so they warm in cache before the trigger fires (instant hydration,
|
|
113
|
+
* still no inline JS). `interaction`/`media:` islands are skipped. Requires
|
|
114
|
+
* `chunkIslands`. Default `false` — trades some idle bandwidth for latency.
|
|
115
|
+
*/
|
|
116
|
+
prefetchIslands?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Stamp Subresource Integrity (`sha384`) on island chunks so the runtime pins
|
|
119
|
+
* them against tampering and a strict CSP can require SRI. Requires
|
|
120
|
+
* `chunkIslands`. Default `false` — only enable when chunks are served
|
|
121
|
+
* byte-for-byte unchanged (no CDN/proxy transform).
|
|
122
|
+
*/
|
|
123
|
+
integrityIslands?: boolean;
|
|
46
124
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
125
|
+
/** robots.txt options for the static build (#1866). */
|
|
126
|
+
export interface RobotsConfig {
|
|
127
|
+
/** Extra paths to disallow, on top of `sitemapExclude`. */
|
|
128
|
+
disallow?: string[];
|
|
129
|
+
/** Paths to explicitly allow. Defaults to `['/']`. */
|
|
130
|
+
allow?: string[];
|
|
131
|
+
/** User agent the rules apply to. Defaults to `*`. */
|
|
132
|
+
userAgent?: string;
|
|
133
|
+
/** Emit the `Sitemap:` line (default: true when a sitemap is generated). */
|
|
134
|
+
sitemap?: boolean;
|
|
54
135
|
}
|
|
55
|
-
export
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
136
|
+
export interface RSSConfig {
|
|
137
|
+
title: string;
|
|
138
|
+
description: string;
|
|
139
|
+
link: string;
|
|
140
|
+
language?: string;
|
|
141
|
+
copyright?: string;
|
|
142
|
+
/** Function to get items for RSS feed */
|
|
143
|
+
getItems?: () => Promise<RSSItem[]>;
|
|
63
144
|
}
|
|
64
|
-
export
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
145
|
+
export interface RSSItem {
|
|
146
|
+
title: string;
|
|
147
|
+
link: string;
|
|
148
|
+
description?: string;
|
|
149
|
+
pubDate?: Date;
|
|
150
|
+
author?: string;
|
|
151
|
+
categories?: string[];
|
|
152
|
+
guid?: string;
|
|
68
153
|
}
|
|
69
|
-
export
|
|
70
|
-
|
|
71
|
-
|
|
154
|
+
export interface StaticPath {
|
|
155
|
+
/** Route parameters */
|
|
156
|
+
params: Record<string, string>;
|
|
157
|
+
/** Props to pass to the page */
|
|
158
|
+
props?: Record<string, unknown>;
|
|
159
|
+
/** Page-specific revalidation time (overrides global) */
|
|
160
|
+
revalidate?: number | false;
|
|
72
161
|
}
|
|
73
|
-
export
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
162
|
+
export interface StaticPathsResult {
|
|
163
|
+
paths: StaticPath[];
|
|
164
|
+
/** Fallback behavior for paths not returned */
|
|
165
|
+
fallback?: 'blocking' | 'static' | false;
|
|
77
166
|
}
|
|
78
|
-
export
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
167
|
+
export interface ContentLoader {
|
|
168
|
+
/** Name of the loader */
|
|
169
|
+
name: string;
|
|
170
|
+
/** File extensions this loader handles */
|
|
171
|
+
extensions: string[];
|
|
172
|
+
/** Load content from file */
|
|
173
|
+
load: (filePath: string) => Promise<ContentResult>;
|
|
82
174
|
}
|
|
83
|
-
export
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
175
|
+
export interface ContentResult {
|
|
176
|
+
/** Rendered HTML content */
|
|
177
|
+
content: string;
|
|
178
|
+
/** Frontmatter/metadata */
|
|
179
|
+
data: Record<string, unknown>;
|
|
180
|
+
/** Table of contents (for markdown) */
|
|
181
|
+
toc?: TocItem[];
|
|
88
182
|
}
|
|
89
|
-
export
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
onError?: (error: Error, route?: string) => void | Promise<void>
|
|
183
|
+
export interface TocItem {
|
|
184
|
+
id: string;
|
|
185
|
+
text: string;
|
|
186
|
+
level: number;
|
|
187
|
+
children?: TocItem[];
|
|
95
188
|
}
|
|
96
|
-
export
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
189
|
+
export interface SSGHooks {
|
|
190
|
+
/** Called before build starts */
|
|
191
|
+
onBuildStart?: () => void | Promise<void>;
|
|
192
|
+
/** Called after build completes */
|
|
193
|
+
onBuildEnd?: (result: SSGResult) => void | Promise<void>;
|
|
194
|
+
/** Called before each page is rendered */
|
|
195
|
+
onPageStart?: (route: string) => void | Promise<void>;
|
|
196
|
+
/** Called after each page is rendered */
|
|
197
|
+
onPageEnd?: (route: string, html: string) => void | Promise<void>;
|
|
198
|
+
/** Called on build error */
|
|
199
|
+
onError?: (error: Error, route?: string) => void | Promise<void>;
|
|
107
200
|
}
|
|
108
|
-
export
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
201
|
+
export interface SSGResult {
|
|
202
|
+
/** Total pages generated */
|
|
203
|
+
totalPages: number;
|
|
204
|
+
/** Successfully generated pages */
|
|
205
|
+
successCount: number;
|
|
206
|
+
/** Failed pages */
|
|
207
|
+
failedCount: number;
|
|
208
|
+
/** Pages that were cached */
|
|
209
|
+
cachedCount: number;
|
|
210
|
+
/** Build time in milliseconds */
|
|
211
|
+
buildTime: number;
|
|
212
|
+
/** Generated sitemap path */
|
|
213
|
+
sitemapPath?: string;
|
|
214
|
+
/** Generated RSS path */
|
|
215
|
+
rssPath?: string;
|
|
216
|
+
/** Individual page results */
|
|
217
|
+
pages: PageResult[];
|
|
218
|
+
/** Errors encountered */
|
|
219
|
+
errors: PageError[];
|
|
220
|
+
/**
|
|
221
|
+
* Per-island chunking stats (#1746), present only when `chunkIslands` emitted
|
|
222
|
+
* any chunks: `count` unique (content-addressed) chunk files and `totalBytes`
|
|
223
|
+
* of island JS moved out of inline HTML into lazily-fetched chunks.
|
|
224
|
+
*/
|
|
225
|
+
islandChunks?: {
|
|
226
|
+
count: number;
|
|
227
|
+
totalBytes: number;
|
|
228
|
+
};
|
|
114
229
|
}
|
|
115
|
-
export
|
|
116
|
-
|
|
117
|
-
|
|
230
|
+
export interface PageResult {
|
|
231
|
+
route: string;
|
|
232
|
+
outputPath: string;
|
|
233
|
+
size: number;
|
|
234
|
+
cached: boolean;
|
|
235
|
+
revalidateAt?: number;
|
|
118
236
|
}
|
|
119
|
-
export
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
invalidate: (route: string) => Promise<void>
|
|
123
|
-
invalidatePattern: (pattern: RegExp) => Promise<void>
|
|
124
|
-
needsRevalidation: (route: string) => Promise<boolean>
|
|
237
|
+
export interface PageError {
|
|
238
|
+
route: string;
|
|
239
|
+
error: Error;
|
|
125
240
|
}
|
|
126
|
-
export
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
241
|
+
export interface ISRCache {
|
|
242
|
+
/** Get cached page */
|
|
243
|
+
get: (route: string) => Promise<CachedPage | null>;
|
|
244
|
+
/** Set cached page */
|
|
245
|
+
set: (route: string, page: CachedPage) => Promise<void>;
|
|
246
|
+
/** Invalidate cached page */
|
|
247
|
+
invalidate: (route: string) => Promise<void>;
|
|
248
|
+
/** Invalidate all pages matching pattern */
|
|
249
|
+
invalidatePattern: (pattern: RegExp) => Promise<void>;
|
|
250
|
+
/** Check if page needs revalidation */
|
|
251
|
+
needsRevalidation: (route: string) => Promise<boolean>;
|
|
132
252
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
set(route: string, filePath: string, dependencies: string[], html: string): void;
|
|
253
|
+
export interface CachedPage {
|
|
254
|
+
html: string;
|
|
255
|
+
generatedAt: number;
|
|
256
|
+
revalidateAfter: number;
|
|
257
|
+
etag: string;
|
|
258
|
+
headers?: Record<string, string>;
|
|
140
259
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
260
|
+
/**
|
|
261
|
+
* Generate sitemap.xml
|
|
262
|
+
*/
|
|
263
|
+
/**
|
|
264
|
+
* Whether a generated page should stay out of sitemap.xml (#1866).
|
|
265
|
+
*
|
|
266
|
+
* Three independent ways to say no, because they are declared in three
|
|
267
|
+
* different places: the build config (`sitemapExclude`), the page itself
|
|
268
|
+
* (`definePageMeta({ sitemap: false })`), and the page's own robots meta — a
|
|
269
|
+
* page already marked `noindex` asking to be listed in a sitemap is a
|
|
270
|
+
* contradiction, and apps were adding that meta by hand precisely because the
|
|
271
|
+
* sitemap ignored them.
|
|
272
|
+
*/
|
|
273
|
+
export declare function isExcludedFromSitemap(url: string, html: string, pageMeta: Record<string, any> | null | undefined, exclude: (string | RegExp)[]): boolean;
|
|
274
|
+
/**
|
|
275
|
+
* Generate static site
|
|
276
|
+
*/
|
|
277
|
+
export declare function generateStaticSite(options?: SSGConfig): Promise<SSGResult>;
|
|
278
|
+
/**
|
|
279
|
+
* Create ISR handler for runtime revalidation
|
|
280
|
+
*/
|
|
281
|
+
export declare function createISRHandler(options?: SSGConfig): {
|
|
282
|
+
get: (route: string) => Promise<{
|
|
283
|
+
html: string;
|
|
284
|
+
headers: Record<string, string>;
|
|
285
|
+
} | null>;
|
|
286
|
+
revalidate: (route: string) => Promise<void>;
|
|
287
|
+
invalidate: (route: string | RegExp) => Promise<void>;
|
|
288
|
+
};
|
|
289
|
+
/**
|
|
290
|
+
* Define static paths for dynamic routes (used in templates)
|
|
291
|
+
*/
|
|
292
|
+
export declare function defineStaticPaths(pathsFn: () => Promise<StaticPath[]> | StaticPath[]): () => Promise<StaticPathsResult>;
|
|
293
|
+
/**
|
|
294
|
+
* Create a markdown content loader
|
|
295
|
+
*/
|
|
296
|
+
export declare function createMarkdownLoader(): ContentLoader;
|
|
297
|
+
declare const _default: {
|
|
298
|
+
generateStaticSite: typeof generateStaticSite;
|
|
299
|
+
createISRHandler: typeof createISRHandler;
|
|
300
|
+
defineStaticPaths: typeof defineStaticPaths;
|
|
301
|
+
createMarkdownLoader: typeof createMarkdownLoader;
|
|
160
302
|
};
|
|
303
|
+
export default _default;
|