vite-plugin-html-pages 1.3.7 → 1.4.1
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/index.js +70 -37
- package/dist/index.js.map +1 -1
- package/dist/jsx-runtime.d.ts +18 -0
- package/dist/jsx-runtime.js +44 -0
- package/dist/jsx-runtime.js.map +1 -0
- package/package.json +13 -4
- package/TODO +0 -1
- package/src/constants.ts +0 -6
- package/src/dev-server.ts +0 -131
- package/src/discover.ts +0 -84
- package/src/env.d.ts +0 -11
- package/src/errors.ts +0 -32
- package/src/fetch-cache.ts +0 -141
- package/src/html-asset-validator.ts +0 -176
- package/src/index.ts +0 -12
- package/src/module-loader.ts +0 -58
- package/src/page-helper-generator.ts +0 -43
- package/src/page-index.ts +0 -67
- package/src/path-utils.ts +0 -30
- package/src/plugin.ts +0 -513
- package/src/render-runtime.ts +0 -36
- package/src/route-params.ts +0 -38
- package/src/route-utils.ts +0 -176
- package/src/static-assets.ts +0 -206
- package/src/types.ts +0 -73
- package/tsconfig.json +0 -14
- package/tsup.config.ts +0 -18
package/src/route-params.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { RouteParamDefinition } from './types';
|
|
2
|
-
|
|
3
|
-
export function parseRouteParamSegment(
|
|
4
|
-
segment: string,
|
|
5
|
-
): RouteParamDefinition | null {
|
|
6
|
-
if (segment.startsWith('[...') && segment.endsWith(']?')) {
|
|
7
|
-
return {
|
|
8
|
-
name: segment.slice(4, -2),
|
|
9
|
-
type: 'optional-catch-all',
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (segment.startsWith('[...') && segment.endsWith(']')) {
|
|
14
|
-
return {
|
|
15
|
-
name: segment.slice(4, -1),
|
|
16
|
-
type: 'catch-all',
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (segment.startsWith('[') && segment.endsWith(']')) {
|
|
21
|
-
return {
|
|
22
|
-
name: segment.slice(1, -1),
|
|
23
|
-
type: 'single',
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function extractRouteParamDefinitions(
|
|
31
|
-
routePattern: string,
|
|
32
|
-
): RouteParamDefinition[] {
|
|
33
|
-
return routePattern
|
|
34
|
-
.split('/')
|
|
35
|
-
.filter(Boolean)
|
|
36
|
-
.map((segment) => parseRouteParamSegment(segment))
|
|
37
|
-
.filter((value): value is RouteParamDefinition => value != null);
|
|
38
|
-
}
|
package/src/route-utils.ts
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { normalizeRoutePath, stripPageSuffix, toPosix } from './path-utils';
|
|
2
|
-
import type { HtPageInfo, StaticParamRecord } from './types';
|
|
3
|
-
|
|
4
|
-
const DYNAMIC_SEGMENT_RE = /\[([A-Za-z0-9_]+)\]/g;
|
|
5
|
-
const CATCH_ALL_SEGMENT_RE = /\[\.\.\.([A-Za-z0-9_]+)\]/g;
|
|
6
|
-
const OPTIONAL_CATCH_ALL_SEGMENT_RE = /\[\.\.\.([A-Za-z0-9_]+)\]\?/g;
|
|
7
|
-
const ANY_PARAM_RE = /\[(?:\.\.\.)?([A-Za-z0-9_]+)\]\??/g;
|
|
8
|
-
const ROUTE_GROUP_RE = /(^|\/)\(([^)]+)\)(?=\/|$)/g;
|
|
9
|
-
|
|
10
|
-
export function getParamNames(relativeFromPagesDir: string): string[] {
|
|
11
|
-
return [...relativeFromPagesDir.matchAll(ANY_PARAM_RE)].map((m) => m[1]);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function isDynamicPage(relativeFromPagesDir: string): boolean {
|
|
15
|
-
return /\[(?:\.\.\.)?[A-Za-z0-9_]+\]\??/.test(relativeFromPagesDir);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function toRoutePattern(
|
|
19
|
-
relativeFromPagesDir: string,
|
|
20
|
-
extensions: string[],
|
|
21
|
-
): string {
|
|
22
|
-
const noExt = stripPageSuffix(toPosix(relativeFromPagesDir), extensions);
|
|
23
|
-
|
|
24
|
-
const withoutGroups = noExt.replace(ROUTE_GROUP_RE, '$1');
|
|
25
|
-
const withoutIndex = withoutGroups.replace(/\/index$/i, '').replace(/^index$/i, '');
|
|
26
|
-
|
|
27
|
-
const raw = withoutIndex
|
|
28
|
-
.replace(OPTIONAL_CATCH_ALL_SEGMENT_RE, '*?:$1')
|
|
29
|
-
.replace(CATCH_ALL_SEGMENT_RE, '*:$1')
|
|
30
|
-
.replace(DYNAMIC_SEGMENT_RE, ':$1');
|
|
31
|
-
|
|
32
|
-
return normalizeRoutePath(raw || '/');
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function fillParams(
|
|
36
|
-
pattern: string,
|
|
37
|
-
params: Record<string, string>,
|
|
38
|
-
): string {
|
|
39
|
-
const result = pattern
|
|
40
|
-
.replace(/\*\?:([A-Za-z0-9_]+)/g, (_, key) => {
|
|
41
|
-
const value = params[key];
|
|
42
|
-
if (value == null || value === '') {
|
|
43
|
-
return '';
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return String(value)
|
|
47
|
-
.split('/')
|
|
48
|
-
.map((part) => encodeURIComponent(part))
|
|
49
|
-
.join('/');
|
|
50
|
-
})
|
|
51
|
-
.replace(/\*:([A-Za-z0-9_]+)/g, (_, key) => {
|
|
52
|
-
if (!(key in params)) {
|
|
53
|
-
throw new Error(`Missing catch-all route param "${key}"`);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return String(params[key])
|
|
57
|
-
.split('/')
|
|
58
|
-
.map((part) => encodeURIComponent(part))
|
|
59
|
-
.join('/');
|
|
60
|
-
})
|
|
61
|
-
.replace(/:([A-Za-z0-9_]+)/g, (_, key) => {
|
|
62
|
-
if (!(key in params)) {
|
|
63
|
-
throw new Error(`Missing route param "${key}"`);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return encodeURIComponent(params[key]);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
return normalizeRoutePath(result || '/');
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export function fileNameFromRoute(
|
|
73
|
-
routePath: string,
|
|
74
|
-
cleanUrls: boolean,
|
|
75
|
-
): string {
|
|
76
|
-
const normalized = normalizeRoutePath(routePath);
|
|
77
|
-
|
|
78
|
-
if (normalized === '/') return 'index.html';
|
|
79
|
-
|
|
80
|
-
const base = normalized.slice(1);
|
|
81
|
-
return cleanUrls ? `${base}/index.html` : `${base}.html`;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export function expandStaticPaths(
|
|
85
|
-
basePage: Omit<HtPageInfo, 'routePath' | 'fileName' | 'params'>,
|
|
86
|
-
rows: StaticParamRecord[],
|
|
87
|
-
cleanUrls: boolean,
|
|
88
|
-
): HtPageInfo[] {
|
|
89
|
-
return rows.map((row) => {
|
|
90
|
-
const params = Object.fromEntries(
|
|
91
|
-
Object.entries(row).map(([k, v]) => [k, String(v)]),
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
const routePath = fillParams(basePage.routePattern, params);
|
|
95
|
-
|
|
96
|
-
return {
|
|
97
|
-
...basePage,
|
|
98
|
-
routePath,
|
|
99
|
-
fileName: fileNameFromRoute(routePath, cleanUrls),
|
|
100
|
-
params,
|
|
101
|
-
};
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export function routeMatch(
|
|
106
|
-
pattern: string,
|
|
107
|
-
urlPath: string,
|
|
108
|
-
): Record<string, string> | null {
|
|
109
|
-
const a = normalizeRoutePath(pattern).split('/').filter(Boolean);
|
|
110
|
-
const b = normalizeRoutePath(urlPath).split('/').filter(Boolean);
|
|
111
|
-
const params: Record<string, string> = {};
|
|
112
|
-
|
|
113
|
-
for (let i = 0; i < a.length; i++) {
|
|
114
|
-
const patternSeg = a[i];
|
|
115
|
-
const urlSeg = b[i];
|
|
116
|
-
|
|
117
|
-
if (patternSeg.startsWith('*?:')) {
|
|
118
|
-
params[patternSeg.slice(3)] =
|
|
119
|
-
i < b.length ? b.slice(i).map(decodeURIComponent).join('/') : '';
|
|
120
|
-
return params;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if (patternSeg.startsWith('*:')) {
|
|
124
|
-
const rest = b.slice(i);
|
|
125
|
-
if (rest.length === 0) return null;
|
|
126
|
-
|
|
127
|
-
params[patternSeg.slice(2)] = rest.map(decodeURIComponent).join('/');
|
|
128
|
-
return params;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (!urlSeg) return null;
|
|
132
|
-
|
|
133
|
-
if (patternSeg.startsWith(':')) {
|
|
134
|
-
params[patternSeg.slice(1)] = decodeURIComponent(urlSeg);
|
|
135
|
-
continue;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (patternSeg !== urlSeg) return null;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return a.length === b.length ? params : null;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export function compareRoutePriority(a: string, b: string): number {
|
|
145
|
-
const aSegs = normalizeRoutePath(a).split('/').filter(Boolean);
|
|
146
|
-
const bSegs = normalizeRoutePath(b).split('/').filter(Boolean);
|
|
147
|
-
const len = Math.max(aSegs.length, bSegs.length);
|
|
148
|
-
|
|
149
|
-
for (let i = 0; i < len; i++) {
|
|
150
|
-
const aa = aSegs[i];
|
|
151
|
-
const bb = bSegs[i];
|
|
152
|
-
|
|
153
|
-
if (aa == null) return 1;
|
|
154
|
-
if (bb == null) return -1;
|
|
155
|
-
|
|
156
|
-
const aOptionalCatchAll = aa.startsWith('*?:');
|
|
157
|
-
const bOptionalCatchAll = bb.startsWith('*?:');
|
|
158
|
-
if (aOptionalCatchAll !== bOptionalCatchAll) {
|
|
159
|
-
return aOptionalCatchAll ? 1 : -1;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
const aCatchAll = aa.startsWith('*:');
|
|
163
|
-
const bCatchAll = bb.startsWith('*:');
|
|
164
|
-
if (aCatchAll !== bCatchAll) {
|
|
165
|
-
return aCatchAll ? 1 : -1;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
const aDynamic = aa.startsWith(':');
|
|
169
|
-
const bDynamic = bb.startsWith(':');
|
|
170
|
-
if (aDynamic !== bDynamic) {
|
|
171
|
-
return aDynamic ? 1 : -1;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
return bSegs.length - aSegs.length;
|
|
176
|
-
}
|
package/src/static-assets.ts
DELETED
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs/promises';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import fg from 'fast-glob';
|
|
4
|
-
import * as esbuild from 'esbuild';
|
|
5
|
-
import fsSync from 'node:fs';
|
|
6
|
-
|
|
7
|
-
export interface StaticAssetFile {
|
|
8
|
-
absolutePath: string;
|
|
9
|
-
relativePathFromSrc: string;
|
|
10
|
-
outputFileName: string;
|
|
11
|
-
kind: 'copy' | 'process';
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface CollectStaticAssetsArgs {
|
|
15
|
-
root: string;
|
|
16
|
-
pagesDir: string;
|
|
17
|
-
pageExtensions: string[];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function normalizeSlashes(value: string): string {
|
|
21
|
-
return value.replace(/\\/g, '/');
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function hasAnySuffix(value: string, suffixes: string[]): boolean {
|
|
25
|
-
return suffixes.some((suffix) => value.endsWith(suffix));
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function shouldIgnoreFile(rel: string): boolean {
|
|
29
|
-
return (
|
|
30
|
-
rel.endsWith('.d.ts') ||
|
|
31
|
-
rel.endsWith('.map') ||
|
|
32
|
-
rel.endsWith('.tsbuildinfo') ||
|
|
33
|
-
rel.startsWith('.') ||
|
|
34
|
-
rel.includes('/.')
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function isProcessableAsset(rel: string): boolean {
|
|
39
|
-
return (
|
|
40
|
-
rel.endsWith('.js') ||
|
|
41
|
-
rel.endsWith('.mjs') ||
|
|
42
|
-
rel.endsWith('.ts') ||
|
|
43
|
-
rel.endsWith('.css')
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function toOutputFileName(relativePathFromSrc: string): string {
|
|
48
|
-
if (relativePathFromSrc.endsWith('.ts')) {
|
|
49
|
-
return relativePathFromSrc.slice(0, -3) + '.js';
|
|
50
|
-
}
|
|
51
|
-
return relativePathFromSrc;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export async function collectStaticAssets(
|
|
55
|
-
args: CollectStaticAssetsArgs,
|
|
56
|
-
): Promise<StaticAssetFile[]> {
|
|
57
|
-
const { root, pagesDir, pageExtensions } = args;
|
|
58
|
-
const srcDir = path.join(root, pagesDir);
|
|
59
|
-
|
|
60
|
-
const entries = await fg('**/*', {
|
|
61
|
-
cwd: srcDir,
|
|
62
|
-
onlyFiles: true,
|
|
63
|
-
dot: false,
|
|
64
|
-
absolute: false,
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
const assets: StaticAssetFile[] = [];
|
|
68
|
-
|
|
69
|
-
for (const entry of entries) {
|
|
70
|
-
const rel = normalizeSlashes(entry);
|
|
71
|
-
|
|
72
|
-
if (shouldIgnoreFile(rel)) continue;
|
|
73
|
-
if (hasAnySuffix(rel, pageExtensions)) continue;
|
|
74
|
-
|
|
75
|
-
const absolutePath = path.join(srcDir, rel);
|
|
76
|
-
|
|
77
|
-
assets.push({
|
|
78
|
-
absolutePath,
|
|
79
|
-
relativePathFromSrc: rel,
|
|
80
|
-
outputFileName: normalizeSlashes(toOutputFileName(rel)),
|
|
81
|
-
kind: isProcessableAsset(rel) ? 'process' : 'copy',
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
return assets;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export async function copyStaticAssetSource(
|
|
89
|
-
asset: StaticAssetFile,
|
|
90
|
-
): Promise<Uint8Array> {
|
|
91
|
-
return fs.readFile(asset.absolutePath);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export async function buildProcessedStaticAssets(args: {
|
|
95
|
-
root: string;
|
|
96
|
-
pagesDir: string;
|
|
97
|
-
assets: StaticAssetFile[];
|
|
98
|
-
minify?: boolean;
|
|
99
|
-
sourcemap?: boolean;
|
|
100
|
-
}): Promise<Map<string, string | Uint8Array>> {
|
|
101
|
-
const { root, pagesDir, assets, minify = true, sourcemap = false } = args;
|
|
102
|
-
|
|
103
|
-
const processable = assets.filter((a) => a.kind === 'process');
|
|
104
|
-
const out = new Map<string, string | Uint8Array>();
|
|
105
|
-
|
|
106
|
-
if (processable.length === 0) {
|
|
107
|
-
return out;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const srcDir = path.join(root, pagesDir);
|
|
111
|
-
const distDir = path.join(root, 'dist');
|
|
112
|
-
const warnedMissingAssets = new Set<string>();
|
|
113
|
-
const result = await esbuild.build({
|
|
114
|
-
entryPoints: processable.map((a) => a.absolutePath),
|
|
115
|
-
absWorkingDir: root,
|
|
116
|
-
outbase: srcDir,
|
|
117
|
-
outdir: distDir,
|
|
118
|
-
bundle: true,
|
|
119
|
-
splitting: true,
|
|
120
|
-
treeShaking: true,
|
|
121
|
-
minify,
|
|
122
|
-
sourcemap,
|
|
123
|
-
format: 'esm',
|
|
124
|
-
target: 'es2020',
|
|
125
|
-
platform: 'browser',
|
|
126
|
-
write: false,
|
|
127
|
-
entryNames: '[dir]/[name]',
|
|
128
|
-
assetNames: '[dir]/[name]',
|
|
129
|
-
loader: {
|
|
130
|
-
'.css': 'css',
|
|
131
|
-
'.png': 'file',
|
|
132
|
-
'.jpg': 'file',
|
|
133
|
-
'.jpeg': 'file',
|
|
134
|
-
'.gif': 'file',
|
|
135
|
-
'.svg': 'file',
|
|
136
|
-
'.webp': 'file',
|
|
137
|
-
'.woff': 'file',
|
|
138
|
-
'.woff2': 'file',
|
|
139
|
-
'.ttf': 'file',
|
|
140
|
-
'.otf': 'file',
|
|
141
|
-
},
|
|
142
|
-
plugins: [
|
|
143
|
-
{
|
|
144
|
-
name: 'html-pages-root-url-resolver',
|
|
145
|
-
setup(build) {
|
|
146
|
-
build.onResolve({ filter: /^\// }, (resolveArgs) => {
|
|
147
|
-
// Leave real filesystem absolute paths alone
|
|
148
|
-
if (
|
|
149
|
-
path.isAbsolute(resolveArgs.path) &&
|
|
150
|
-
fsSync.existsSync(resolveArgs.path)
|
|
151
|
-
) {
|
|
152
|
-
return { path: resolveArgs.path };
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
const cleanPath = resolveArgs.path.slice(1);
|
|
156
|
-
|
|
157
|
-
const fromSrc = path.join(srcDir, cleanPath);
|
|
158
|
-
if (fsSync.existsSync(fromSrc)) {
|
|
159
|
-
return { path: fromSrc };
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
const fromPublic = path.join(root, 'public', cleanPath);
|
|
163
|
-
if (fsSync.existsSync(fromPublic)) {
|
|
164
|
-
return {
|
|
165
|
-
path: resolveArgs.path,
|
|
166
|
-
external: true,
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
const isCssUrlToken = resolveArgs.kind === 'url-token';
|
|
171
|
-
|
|
172
|
-
if (isCssUrlToken) {
|
|
173
|
-
if (!warnedMissingAssets.has(resolveArgs.path)) {
|
|
174
|
-
warnedMissingAssets.add(resolveArgs.path);
|
|
175
|
-
console.warn(
|
|
176
|
-
`[vite-plugin-html-pages] ⚠️ Missing CSS asset: ${resolveArgs.path}\n` +
|
|
177
|
-
` Looked in:\n` +
|
|
178
|
-
` - ${fromSrc}\n` +
|
|
179
|
-
` - ${fromPublic}`
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
// Keep the original root-relative URL in output CSS
|
|
184
|
-
return {
|
|
185
|
-
path: resolveArgs.path,
|
|
186
|
-
external: true,
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// JS/CSS entry imports remain strict
|
|
191
|
-
return {
|
|
192
|
-
path: fromSrc,
|
|
193
|
-
};
|
|
194
|
-
});
|
|
195
|
-
},
|
|
196
|
-
},
|
|
197
|
-
],
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
for (const file of result.outputFiles) {
|
|
201
|
-
const rel = normalizeSlashes(path.relative(distDir, file.path));
|
|
202
|
-
out.set(rel, file.text ?? file.contents);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
return out;
|
|
206
|
-
}
|
package/src/types.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import type { Plugin as RollupPlugin } from 'rollup';
|
|
2
|
-
|
|
3
|
-
export interface StaticParamRecord {
|
|
4
|
-
[key: string]: string | number | boolean;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export type HtPageParams = Record<string, string | string[] | undefined>;
|
|
8
|
-
|
|
9
|
-
export interface HtPageInfo {
|
|
10
|
-
id: string;
|
|
11
|
-
entryPath: string;
|
|
12
|
-
absolutePath: string;
|
|
13
|
-
relativePath: string;
|
|
14
|
-
routePattern: string;
|
|
15
|
-
routePath: string;
|
|
16
|
-
fileName: string;
|
|
17
|
-
dynamic: boolean;
|
|
18
|
-
paramNames: string[];
|
|
19
|
-
paramDefinitions: RouteParamDefinition[];
|
|
20
|
-
params: HtPageParams;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export type HtPageRenderContext = {
|
|
24
|
-
page: HtPageInfo;
|
|
25
|
-
params: HtPageParams;
|
|
26
|
-
data?: unknown;
|
|
27
|
-
dev: boolean;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export interface HtPageModule {
|
|
31
|
-
default?: ((ctx: {
|
|
32
|
-
page: HtPageInfo;
|
|
33
|
-
params: Record<string, string | string[] | undefined>;
|
|
34
|
-
data?: unknown;
|
|
35
|
-
dev: boolean;
|
|
36
|
-
}) => string | Promise<string>) | string;
|
|
37
|
-
data?: (ctx: {
|
|
38
|
-
page: HtPageInfo;
|
|
39
|
-
params: Record<string, string | string[] | undefined>;
|
|
40
|
-
dev: boolean;
|
|
41
|
-
}) => unknown | Promise<unknown>;
|
|
42
|
-
generateStaticParams?: () =>
|
|
43
|
-
| Array<Record<string, string | number | boolean>>
|
|
44
|
-
| Promise<Array<Record<string, string | number | boolean>>>;
|
|
45
|
-
dynamic?: boolean;
|
|
46
|
-
prerender?: boolean;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export interface HtPagesPluginOptions {
|
|
50
|
-
root?: string;
|
|
51
|
-
include?: string | string[];
|
|
52
|
-
exclude?: string | string[];
|
|
53
|
-
pagesDir?: string;
|
|
54
|
-
pageExtensions?: string[];
|
|
55
|
-
cleanUrls?: boolean;
|
|
56
|
-
debug?: boolean;
|
|
57
|
-
renderConcurrency?: number;
|
|
58
|
-
renderBatchSize?: number;
|
|
59
|
-
site?: string;
|
|
60
|
-
missingAssets?: 'error' | 'warn';
|
|
61
|
-
rss?: {
|
|
62
|
-
site: string;
|
|
63
|
-
title?: string;
|
|
64
|
-
description?: string;
|
|
65
|
-
routePrefix?: string;
|
|
66
|
-
};
|
|
67
|
-
mapOutputPath?: (page: HtPageInfo) => string;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export type RouteParamDefinition = {
|
|
71
|
-
name: string;
|
|
72
|
-
type: 'single' | 'catch-all' | 'optional-catch-all';
|
|
73
|
-
};
|
package/tsconfig.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "Bundler",
|
|
6
|
-
"strict": true,
|
|
7
|
-
"declaration": true,
|
|
8
|
-
"outDir": "dist",
|
|
9
|
-
"skipLibCheck": true,
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"types": ["node"]
|
|
12
|
-
},
|
|
13
|
-
"include": ["src"]
|
|
14
|
-
}
|
package/tsup.config.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'tsup';
|
|
2
|
-
|
|
3
|
-
export default defineConfig({
|
|
4
|
-
entry: ['src/index.ts'],
|
|
5
|
-
format: ['esm'],
|
|
6
|
-
dts: true,
|
|
7
|
-
sourcemap: true,
|
|
8
|
-
clean: true,
|
|
9
|
-
target: 'node18',
|
|
10
|
-
platform: 'node',
|
|
11
|
-
splitting: false,
|
|
12
|
-
external: [
|
|
13
|
-
'vite',
|
|
14
|
-
'fast-glob',
|
|
15
|
-
'p-limit',
|
|
16
|
-
'esbuild'
|
|
17
|
-
],
|
|
18
|
-
});
|