@pithyjs/vite-plugin 0.1.0-beta.0
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/LICENSE +21 -0
- package/README.md +237 -0
- package/dist/aotCodegen/generateBindings.d.ts +184 -0
- package/dist/aotCodegen/generateBindings.d.ts.map +1 -0
- package/dist/aotCodegen/generateBindings.js +326 -0
- package/dist/aotCodegen/generateBindings.js.map +1 -0
- package/dist/aotCodegen/generateDomFactory.d.ts +59 -0
- package/dist/aotCodegen/generateDomFactory.d.ts.map +1 -0
- package/dist/aotCodegen/generateDomFactory.js +302 -0
- package/dist/aotCodegen/generateDomFactory.js.map +1 -0
- package/dist/aotCodegen/index.d.ts +18 -0
- package/dist/aotCodegen/index.d.ts.map +1 -0
- package/dist/aotCodegen/index.js +17 -0
- package/dist/aotCodegen/index.js.map +1 -0
- package/dist/aotCodegen/serializeNode.d.ts +74 -0
- package/dist/aotCodegen/serializeNode.d.ts.map +1 -0
- package/dist/aotCodegen/serializeNode.js +169 -0
- package/dist/aotCodegen/serializeNode.js.map +1 -0
- package/dist/aotCodegen/structuralCodegen.d.ts +38 -0
- package/dist/aotCodegen/structuralCodegen.d.ts.map +1 -0
- package/dist/aotCodegen/structuralCodegen.js +56 -0
- package/dist/aotCodegen/structuralCodegen.js.map +1 -0
- package/dist/aotCodegen/utils.d.ts +38 -0
- package/dist/aotCodegen/utils.d.ts.map +1 -0
- package/dist/aotCodegen/utils.js +48 -0
- package/dist/aotCodegen/utils.js.map +1 -0
- package/dist/babelPlugin/babelPlugin.d.ts +44 -0
- package/dist/babelPlugin/babelPlugin.d.ts.map +1 -0
- package/dist/babelPlugin/babelPlugin.js +392 -0
- package/dist/babelPlugin/babelPlugin.js.map +1 -0
- package/dist/babelPlugin/extractOriginalTagNames.d.ts +20 -0
- package/dist/babelPlugin/extractOriginalTagNames.d.ts.map +1 -0
- package/dist/babelPlugin/extractOriginalTagNames.js +44 -0
- package/dist/babelPlugin/extractOriginalTagNames.js.map +1 -0
- package/dist/babelPlugin/extractUsedIdentifiers.d.ts +26 -0
- package/dist/babelPlugin/extractUsedIdentifiers.d.ts.map +1 -0
- package/dist/babelPlugin/extractUsedIdentifiers.js +206 -0
- package/dist/babelPlugin/extractUsedIdentifiers.js.map +1 -0
- package/dist/buildPlugin/plugin.d.ts +79 -0
- package/dist/buildPlugin/plugin.d.ts.map +1 -0
- package/dist/buildPlugin/plugin.js +142 -0
- package/dist/buildPlugin/plugin.js.map +1 -0
- package/dist/designSystemPlugin/collector.d.ts +63 -0
- package/dist/designSystemPlugin/collector.d.ts.map +1 -0
- package/dist/designSystemPlugin/collector.js +175 -0
- package/dist/designSystemPlugin/collector.js.map +1 -0
- package/dist/designSystemPlugin/cssTokens.d.ts +34 -0
- package/dist/designSystemPlugin/cssTokens.d.ts.map +1 -0
- package/dist/designSystemPlugin/cssTokens.js +56 -0
- package/dist/designSystemPlugin/cssTokens.js.map +1 -0
- package/dist/designSystemPlugin/enumerate.d.ts +24 -0
- package/dist/designSystemPlugin/enumerate.d.ts.map +1 -0
- package/dist/designSystemPlugin/enumerate.js +430 -0
- package/dist/designSystemPlugin/enumerate.js.map +1 -0
- package/dist/designSystemPlugin/extractor.d.ts +95 -0
- package/dist/designSystemPlugin/extractor.d.ts.map +1 -0
- package/dist/designSystemPlugin/extractor.js +150 -0
- package/dist/designSystemPlugin/extractor.js.map +1 -0
- package/dist/designSystemPlugin/generator.d.ts +33 -0
- package/dist/designSystemPlugin/generator.d.ts.map +1 -0
- package/dist/designSystemPlugin/generator.js +256 -0
- package/dist/designSystemPlugin/generator.js.map +1 -0
- package/dist/designSystemPlugin/index.d.ts +18 -0
- package/dist/designSystemPlugin/index.d.ts.map +1 -0
- package/dist/designSystemPlugin/index.js +19 -0
- package/dist/designSystemPlugin/index.js.map +1 -0
- package/dist/designSystemPlugin/patterns/a11y.d.ts +19 -0
- package/dist/designSystemPlugin/patterns/a11y.d.ts.map +1 -0
- package/dist/designSystemPlugin/patterns/a11y.js +230 -0
- package/dist/designSystemPlugin/patterns/a11y.js.map +1 -0
- package/dist/designSystemPlugin/patterns/borders.d.ts +18 -0
- package/dist/designSystemPlugin/patterns/borders.d.ts.map +1 -0
- package/dist/designSystemPlugin/patterns/borders.js +474 -0
- package/dist/designSystemPlugin/patterns/borders.js.map +1 -0
- package/dist/designSystemPlugin/patterns/colors.d.ts +18 -0
- package/dist/designSystemPlugin/patterns/colors.d.ts.map +1 -0
- package/dist/designSystemPlugin/patterns/colors.js +134 -0
- package/dist/designSystemPlugin/patterns/colors.js.map +1 -0
- package/dist/designSystemPlugin/patterns/iconography.d.ts +18 -0
- package/dist/designSystemPlugin/patterns/iconography.d.ts.map +1 -0
- package/dist/designSystemPlugin/patterns/iconography.js +61 -0
- package/dist/designSystemPlugin/patterns/iconography.js.map +1 -0
- package/dist/designSystemPlugin/patterns/index.d.ts +22 -0
- package/dist/designSystemPlugin/patterns/index.d.ts.map +1 -0
- package/dist/designSystemPlugin/patterns/index.js +44 -0
- package/dist/designSystemPlugin/patterns/index.js.map +1 -0
- package/dist/designSystemPlugin/patterns/layout.d.ts +34 -0
- package/dist/designSystemPlugin/patterns/layout.d.ts.map +1 -0
- package/dist/designSystemPlugin/patterns/layout.js +917 -0
- package/dist/designSystemPlugin/patterns/layout.js.map +1 -0
- package/dist/designSystemPlugin/patterns/motion.d.ts +19 -0
- package/dist/designSystemPlugin/patterns/motion.d.ts.map +1 -0
- package/dist/designSystemPlugin/patterns/motion.js +162 -0
- package/dist/designSystemPlugin/patterns/motion.js.map +1 -0
- package/dist/designSystemPlugin/patterns/radius.d.ts +18 -0
- package/dist/designSystemPlugin/patterns/radius.d.ts.map +1 -0
- package/dist/designSystemPlugin/patterns/radius.js +107 -0
- package/dist/designSystemPlugin/patterns/radius.js.map +1 -0
- package/dist/designSystemPlugin/patterns/shadows.d.ts +19 -0
- package/dist/designSystemPlugin/patterns/shadows.d.ts.map +1 -0
- package/dist/designSystemPlugin/patterns/shadows.js +161 -0
- package/dist/designSystemPlugin/patterns/shadows.js.map +1 -0
- package/dist/designSystemPlugin/patterns/smartContainer.d.ts +18 -0
- package/dist/designSystemPlugin/patterns/smartContainer.d.ts.map +1 -0
- package/dist/designSystemPlugin/patterns/smartContainer.js +96 -0
- package/dist/designSystemPlugin/patterns/smartContainer.js.map +1 -0
- package/dist/designSystemPlugin/patterns/spacing.d.ts +18 -0
- package/dist/designSystemPlugin/patterns/spacing.d.ts.map +1 -0
- package/dist/designSystemPlugin/patterns/spacing.js +333 -0
- package/dist/designSystemPlugin/patterns/spacing.js.map +1 -0
- package/dist/designSystemPlugin/patterns/typography.d.ts +18 -0
- package/dist/designSystemPlugin/patterns/typography.d.ts.map +1 -0
- package/dist/designSystemPlugin/patterns/typography.js +416 -0
- package/dist/designSystemPlugin/patterns/typography.js.map +1 -0
- package/dist/designSystemPlugin/plugin.d.ts +39 -0
- package/dist/designSystemPlugin/plugin.d.ts.map +1 -0
- package/dist/designSystemPlugin/plugin.js +351 -0
- package/dist/designSystemPlugin/plugin.js.map +1 -0
- package/dist/designSystemPlugin/types.d.ts +156 -0
- package/dist/designSystemPlugin/types.d.ts.map +1 -0
- package/dist/designSystemPlugin/types.js +49 -0
- package/dist/designSystemPlugin/types.js.map +1 -0
- package/dist/htmlTransform/htmlTransform.d.ts +47 -0
- package/dist/htmlTransform/htmlTransform.d.ts.map +1 -0
- package/dist/htmlTransform/htmlTransform.js +86 -0
- package/dist/htmlTransform/htmlTransform.js.map +1 -0
- package/dist/iconsPlugin/index.d.ts +18 -0
- package/dist/iconsPlugin/index.d.ts.map +1 -0
- package/dist/iconsPlugin/index.js +17 -0
- package/dist/iconsPlugin/index.js.map +1 -0
- package/dist/iconsPlugin/optimize.d.ts +54 -0
- package/dist/iconsPlugin/optimize.d.ts.map +1 -0
- package/dist/iconsPlugin/optimize.js +253 -0
- package/dist/iconsPlugin/optimize.js.map +1 -0
- package/dist/iconsPlugin/plugin.d.ts +49 -0
- package/dist/iconsPlugin/plugin.d.ts.map +1 -0
- package/dist/iconsPlugin/plugin.js +242 -0
- package/dist/iconsPlugin/plugin.js.map +1 -0
- package/dist/iconsPlugin/types.d.ts +49 -0
- package/dist/iconsPlugin/types.d.ts.map +1 -0
- package/dist/iconsPlugin/types.js +30 -0
- package/dist/iconsPlugin/types.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -0
- package/dist/pithyPlugin/plugin.d.ts +38 -0
- package/dist/pithyPlugin/plugin.d.ts.map +1 -0
- package/dist/pithyPlugin/plugin.js +119 -0
- package/dist/pithyPlugin/plugin.js.map +1 -0
- package/dist/routerPlugin/manifest.d.ts +33 -0
- package/dist/routerPlugin/manifest.d.ts.map +1 -0
- package/dist/routerPlugin/manifest.js +223 -0
- package/dist/routerPlugin/manifest.js.map +1 -0
- package/dist/routerPlugin/plugin.d.ts +51 -0
- package/dist/routerPlugin/plugin.d.ts.map +1 -0
- package/dist/routerPlugin/plugin.js +164 -0
- package/dist/routerPlugin/plugin.js.map +1 -0
- package/dist/routerPlugin/scanner.d.ts +69 -0
- package/dist/routerPlugin/scanner.d.ts.map +1 -0
- package/dist/routerPlugin/scanner.js +290 -0
- package/dist/routerPlugin/scanner.js.map +1 -0
- package/dist/ssrPlugin/plugin.d.ts +76 -0
- package/dist/ssrPlugin/plugin.d.ts.map +1 -0
- package/dist/ssrPlugin/plugin.js +439 -0
- package/dist/ssrPlugin/plugin.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
/** @codex
|
|
2
|
+
{
|
|
3
|
+
"id": "pithy.vite-plugin-router.scanner",
|
|
4
|
+
"title": "Route File System Scanner",
|
|
5
|
+
"category": "compiler",
|
|
6
|
+
"description": "Scans the file system for route files and builds a route tree with dynamic segments, catch-all routes, and route groups.",
|
|
7
|
+
"since": "0.0.1",
|
|
8
|
+
"stability": "stable",
|
|
9
|
+
"testing": {
|
|
10
|
+
"unit": { "required": true, "covered": true, "file": "scanner.test.ts" },
|
|
11
|
+
"integration": { "required": false, "covered": false },
|
|
12
|
+
"e2e": { "required": false, "covered": false }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
*/
|
|
16
|
+
import glob from 'fast-glob';
|
|
17
|
+
import { join } from 'path';
|
|
18
|
+
/**
|
|
19
|
+
* Scan the routes directory and discover route files
|
|
20
|
+
*/
|
|
21
|
+
/** @codexApi {"parent":"pithy.vite-plugin-router.scanner","name":"scanRoutes","stability":"stable","signature":"(config: ScannerConfig) => Promise<RouteFile[]>"} */
|
|
22
|
+
export async function scanRoutes(config) {
|
|
23
|
+
const { routesDir, extensions = ['ts', 'js'], typescript = true } = config;
|
|
24
|
+
// Build glob patterns for route files
|
|
25
|
+
const fileExtensions = typescript ? [...extensions, 'ts'] : extensions;
|
|
26
|
+
const patterns = [
|
|
27
|
+
`**/{page,layout,error,loading,loader,config}.{${fileExtensions.join(',')}}`,
|
|
28
|
+
];
|
|
29
|
+
try {
|
|
30
|
+
// Scan for route files
|
|
31
|
+
const files = await glob(patterns, {
|
|
32
|
+
cwd: routesDir,
|
|
33
|
+
absolute: false,
|
|
34
|
+
onlyFiles: true,
|
|
35
|
+
});
|
|
36
|
+
// Process discovered files
|
|
37
|
+
const routeFiles = [];
|
|
38
|
+
for (const file of files) {
|
|
39
|
+
const routeFile = parseRouteFile(file, routesDir);
|
|
40
|
+
if (routeFile) {
|
|
41
|
+
routeFiles.push(routeFile);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return routeFiles;
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
console.error('Failed to scan routes directory:', error);
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Parse a route file path into route information
|
|
53
|
+
*/
|
|
54
|
+
/** @codexApi {"parent":"pithy.vite-plugin-router.scanner","name":"parseRouteFile","stability":"stable","signature":"(filePath: string, routesDir: string) => RouteFile | null"} */
|
|
55
|
+
export function parseRouteFile(filePath, routesDir) {
|
|
56
|
+
// Normalize path separators
|
|
57
|
+
const normalizedPath = filePath.replace(/\\/g, '/');
|
|
58
|
+
// Extract file name and directory
|
|
59
|
+
const pathParts = normalizedPath.split('/');
|
|
60
|
+
const fileName = pathParts[pathParts.length - 1];
|
|
61
|
+
const dirPath = pathParts.slice(0, -1).join('/');
|
|
62
|
+
// Determine route type from filename
|
|
63
|
+
const routeType = getRouteType(fileName);
|
|
64
|
+
if (!routeType) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
// Build route pattern from directory structure
|
|
68
|
+
const pattern = buildRoutePattern(dirPath);
|
|
69
|
+
// Extract route segments
|
|
70
|
+
const segments = dirPath ? dirPath.split('/') : [];
|
|
71
|
+
return {
|
|
72
|
+
path: normalizedPath,
|
|
73
|
+
absolutePath: join(routesDir, filePath),
|
|
74
|
+
type: routeType,
|
|
75
|
+
pattern,
|
|
76
|
+
segments,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Determine route type from filename
|
|
81
|
+
*/
|
|
82
|
+
function getRouteType(fileName) {
|
|
83
|
+
// Remove extension
|
|
84
|
+
const baseName = fileName.replace(/\.(ts|js)$/, '');
|
|
85
|
+
switch (baseName) {
|
|
86
|
+
case 'page':
|
|
87
|
+
return 'page';
|
|
88
|
+
case 'layout':
|
|
89
|
+
return 'layout';
|
|
90
|
+
case 'error':
|
|
91
|
+
return 'error';
|
|
92
|
+
case 'loading':
|
|
93
|
+
return 'loading';
|
|
94
|
+
case 'loader':
|
|
95
|
+
return 'loader';
|
|
96
|
+
case 'config':
|
|
97
|
+
return 'config';
|
|
98
|
+
default:
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Build route pattern from directory path
|
|
104
|
+
* Converts file system path to URL pattern
|
|
105
|
+
*/
|
|
106
|
+
/** @codexApi {"parent":"pithy.vite-plugin-router.scanner","name":"buildRoutePattern","stability":"stable","signature":"(dirPath: string) => string"} */
|
|
107
|
+
export function buildRoutePattern(dirPath) {
|
|
108
|
+
if (!dirPath) {
|
|
109
|
+
return '/'; // Root route
|
|
110
|
+
}
|
|
111
|
+
// Split into segments and process each
|
|
112
|
+
const segments = dirPath.split('/');
|
|
113
|
+
const processedSegments = [];
|
|
114
|
+
for (const segment of segments) {
|
|
115
|
+
// Skip empty segments
|
|
116
|
+
if (!segment)
|
|
117
|
+
continue;
|
|
118
|
+
// Route groups: (group) - excluded from URL
|
|
119
|
+
if (segment.startsWith('(') && segment.endsWith(')')) {
|
|
120
|
+
// Groups don't contribute to the URL pattern
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
// Dynamic segments: [id] or [...slug]
|
|
124
|
+
if (segment.startsWith('[') && segment.endsWith(']')) {
|
|
125
|
+
if (segment.startsWith('[...')) {
|
|
126
|
+
// Catch-all segment
|
|
127
|
+
processedSegments.push('*');
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
// Dynamic segment
|
|
131
|
+
processedSegments.push(`:${segment.slice(1, -1)}`);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
// Static segment
|
|
136
|
+
processedSegments.push(segment);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
// Build final pattern
|
|
140
|
+
const pattern = '/' + processedSegments.join('/');
|
|
141
|
+
return pattern === '/' ? '/' : pattern.replace(/\/$/, ''); // Remove trailing slash except for root
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Build route tree from discovered route files
|
|
145
|
+
*/
|
|
146
|
+
/** @codexApi {"parent":"pithy.vite-plugin-router.scanner","name":"buildRouteTree","stability":"stable","signature":"(routeFiles: RouteFile[]) => RouteNode[]"} */
|
|
147
|
+
export function buildRouteTree(routeFiles) {
|
|
148
|
+
// Group files by route pattern
|
|
149
|
+
const routeMap = new Map();
|
|
150
|
+
for (const file of routeFiles) {
|
|
151
|
+
const existing = routeMap.get(file.pattern) || [];
|
|
152
|
+
existing.push(file);
|
|
153
|
+
routeMap.set(file.pattern, existing);
|
|
154
|
+
}
|
|
155
|
+
// Build route nodes
|
|
156
|
+
const routes = [];
|
|
157
|
+
for (const [pattern, files] of routeMap.entries()) {
|
|
158
|
+
const routeNode = createRouteNode(pattern, files);
|
|
159
|
+
if (routeNode) {
|
|
160
|
+
routes.push(routeNode);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
// Sort routes by pattern for consistent ordering
|
|
164
|
+
routes.sort((a, b) => a.pattern.localeCompare(b.pattern));
|
|
165
|
+
// Build nested structure
|
|
166
|
+
return buildNestedRoutes(routes);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Create a route node from route files
|
|
170
|
+
*/
|
|
171
|
+
function createRouteNode(pattern, files) {
|
|
172
|
+
// Find the page file (required for a valid route)
|
|
173
|
+
const pageFile = files.find(f => f.type === 'page');
|
|
174
|
+
if (!pageFile) {
|
|
175
|
+
// No page file means this isn't a complete route
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
// Create route ID from pattern
|
|
179
|
+
const routeId = pattern === '/' ? 'root' : pattern.replace(/^\//, '').replace(/\//g, '.');
|
|
180
|
+
// Build imports object
|
|
181
|
+
const imports = {};
|
|
182
|
+
// Use the original file system segments (including route groups)
|
|
183
|
+
const segments = pageFile.segments;
|
|
184
|
+
const params = [];
|
|
185
|
+
// Process pattern segments to extract parameter names
|
|
186
|
+
const patternSegments = pattern === '/' ? [] : pattern.split('/').filter(Boolean);
|
|
187
|
+
for (const segment of patternSegments) {
|
|
188
|
+
if (segment.startsWith(':')) {
|
|
189
|
+
params.push(segment.slice(1));
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
// Build imports for each file type (store as placeholder functions)
|
|
193
|
+
for (const file of files) {
|
|
194
|
+
switch (file.type) {
|
|
195
|
+
case 'page':
|
|
196
|
+
imports.page = () => Promise.resolve({}); // Placeholder - will be replaced in manifest
|
|
197
|
+
break;
|
|
198
|
+
case 'layout':
|
|
199
|
+
imports.layout = () => Promise.resolve({}); // Placeholder - will be replaced in manifest
|
|
200
|
+
break;
|
|
201
|
+
case 'error':
|
|
202
|
+
imports.error = () => Promise.resolve({}); // Placeholder - will be replaced in manifest
|
|
203
|
+
break;
|
|
204
|
+
case 'loading':
|
|
205
|
+
imports.loading = () => Promise.resolve({}); // Placeholder - will be replaced in manifest
|
|
206
|
+
break;
|
|
207
|
+
case 'loader':
|
|
208
|
+
imports.loader = () => Promise.resolve({}); // Placeholder - will be replaced in manifest
|
|
209
|
+
break;
|
|
210
|
+
case 'config':
|
|
211
|
+
imports.config = () => Promise.resolve({}); // Placeholder - will be replaced in manifest
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
// Check if this route uses groups
|
|
216
|
+
const isGroup = files.some(f => f.segments.some(s => s.startsWith('(') && s.endsWith(')')));
|
|
217
|
+
// Extract group name if present
|
|
218
|
+
let groupName;
|
|
219
|
+
if (isGroup) {
|
|
220
|
+
for (const file of files) {
|
|
221
|
+
for (const segment of file.segments) {
|
|
222
|
+
if (segment.startsWith('(') && segment.endsWith(')')) {
|
|
223
|
+
groupName = segment.slice(1, -1);
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (groupName)
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
// Determine route characteristics
|
|
232
|
+
const isDynamic = params.length > 0;
|
|
233
|
+
const isCatchAll = pattern.includes('*');
|
|
234
|
+
const isStatic = !isDynamic && !isCatchAll;
|
|
235
|
+
return {
|
|
236
|
+
id: routeId,
|
|
237
|
+
pattern,
|
|
238
|
+
path: pageFile.path,
|
|
239
|
+
segments,
|
|
240
|
+
params,
|
|
241
|
+
imports,
|
|
242
|
+
children: [],
|
|
243
|
+
metadata: {
|
|
244
|
+
isStatic,
|
|
245
|
+
isDynamic,
|
|
246
|
+
isCatchAll,
|
|
247
|
+
isGroup,
|
|
248
|
+
groupName,
|
|
249
|
+
hasLayout: !!imports.layout,
|
|
250
|
+
hasError: !!imports.error,
|
|
251
|
+
hasLoading: !!imports.loading,
|
|
252
|
+
hasLoader: !!imports.loader,
|
|
253
|
+
},
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Build nested route structure from flat route list
|
|
258
|
+
* This creates parent-child relationships based on path hierarchy
|
|
259
|
+
*/
|
|
260
|
+
function buildNestedRoutes(routes) {
|
|
261
|
+
return routes;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Validate route tree for conflicts and issues
|
|
265
|
+
*/
|
|
266
|
+
/** @codexApi {"parent":"pithy.vite-plugin-router.scanner","name":"validateRoutes","stability":"stable","signature":"(routes: RouteNode[]) => string[]"} */
|
|
267
|
+
export function validateRoutes(routes) {
|
|
268
|
+
const errors = [];
|
|
269
|
+
const patterns = new Set();
|
|
270
|
+
for (const route of routes) {
|
|
271
|
+
// Check for duplicate patterns
|
|
272
|
+
if (patterns.has(route.pattern)) {
|
|
273
|
+
errors.push(`Duplicate route pattern: ${route.pattern}`);
|
|
274
|
+
}
|
|
275
|
+
patterns.add(route.pattern);
|
|
276
|
+
// Validate dynamic segments
|
|
277
|
+
if (route.pattern.includes('[') || route.pattern.includes(']')) {
|
|
278
|
+
const segments = route.pattern.split('/');
|
|
279
|
+
for (const segment of segments) {
|
|
280
|
+
if (segment.includes('[') &&
|
|
281
|
+
!segment.match(/^\[[\w.]+\]$/) &&
|
|
282
|
+
!segment.match(/^\[\.\.\.[\w.]+\]$/)) {
|
|
283
|
+
errors.push(`Invalid dynamic segment in ${route.pattern}: ${segment}`);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
return errors;
|
|
289
|
+
}
|
|
290
|
+
//# sourceMappingURL=scanner.js.map
|
|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,4BAA4B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3D,CAAC;QACD,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAE5B,4BAA4B;QAC5B,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC/D,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC1C,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;gBAC/B,IACE,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;oBACrB,CAAC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC;oBAC9B,CAAC,OAAO,CAAC,KAAK,CAAC,oBAAoB,CAAC,EACpC,CAAC;oBACD,MAAM,CAAC,IAAI,CACT,8BAA8B,KAAK,CAAC,OAAO,KAAK,OAAO,EAAE,CAC1D,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/** @codex
|
|
2
|
+
{
|
|
3
|
+
"id": "pithy.vite-plugin-ssr",
|
|
4
|
+
"title": "Vite Plugin for PithyJS SSR",
|
|
5
|
+
"category": "plugin",
|
|
6
|
+
"description": "SSR dev server plugin with auto-mode (pithy.config.ts) and legacy mode (entry-server.ts) for server-side rendering.",
|
|
7
|
+
"since": "0.0.1",
|
|
8
|
+
"stability": "experimental",
|
|
9
|
+
"testing": {
|
|
10
|
+
"unit": { "required": true, "covered": true, "file": "ssr-plugin.test.ts" },
|
|
11
|
+
"integration": { "required": false, "covered": false },
|
|
12
|
+
"e2e": { "required": false, "covered": false }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
*/
|
|
16
|
+
import type { Plugin } from 'vite';
|
|
17
|
+
/**
|
|
18
|
+
* Options for the PithyJS SSR Vite plugin.
|
|
19
|
+
*/
|
|
20
|
+
export interface PithySSRPluginOptions {
|
|
21
|
+
/**
|
|
22
|
+
* Path to the entry-server module relative to project root.
|
|
23
|
+
* Only used in legacy mode (when pithy.config.ts is not found).
|
|
24
|
+
* Must export a `render(url: string)` function.
|
|
25
|
+
* @default 'src/entry-server.ts'
|
|
26
|
+
*/
|
|
27
|
+
entry?: string;
|
|
28
|
+
/**
|
|
29
|
+
* URL patterns to exclude from SSR (served by Vite as-is).
|
|
30
|
+
* Accepts strings (prefix match) or RegExp patterns.
|
|
31
|
+
* RegExp with the `g` (global) flag is handled safely (lastIndex is reset).
|
|
32
|
+
*
|
|
33
|
+
* Built-in exclusions are always applied:
|
|
34
|
+
* - Non-GET/HEAD methods
|
|
35
|
+
* - `/@vite/`, `/@fs/`, `/__vite*`, `/node_modules/`
|
|
36
|
+
* - URLs whose last segment contains a dot (`.js`, `.css`, `.png`, etc.)
|
|
37
|
+
* **Note:** this also skips dotted path segments like `/api/v2.0`
|
|
38
|
+
* - Requests whose `Accept` header includes neither `text/html` nor `*\/*`
|
|
39
|
+
* (i.e. `Accept: *\/*` from curl/fetch **is** SSR-rendered)
|
|
40
|
+
*/
|
|
41
|
+
exclude?: (string | RegExp)[];
|
|
42
|
+
/** Path to pithy.config module (Vite module ID). @default '/pithy.config' */
|
|
43
|
+
configPath?: string;
|
|
44
|
+
/** Client entry path for hydration script injection in auto mode. @default 'src/main.ts' */
|
|
45
|
+
entryClient?: string;
|
|
46
|
+
/** Enable debug logging */
|
|
47
|
+
debug?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Escapes HTML special characters to prevent XSS in error pages.
|
|
51
|
+
*/
|
|
52
|
+
export declare function escapeHtml(str: string): string;
|
|
53
|
+
/**
|
|
54
|
+
* Vite plugin that adds SSR middleware to the dev server.
|
|
55
|
+
*
|
|
56
|
+
* **Auto mode (recommended):** If `pithy.config.ts` exists at the project root,
|
|
57
|
+
* the plugin auto-discovers routes, renders the App shell + page components,
|
|
58
|
+
* and serves SSR'd HTML. No entry files needed — just `pithy.config.ts` and `main.ts`.
|
|
59
|
+
*
|
|
60
|
+
* **Legacy mode:** Falls back to loading `entry-server.ts` (or custom `entry`)
|
|
61
|
+
* if `pithy.config.ts` is not found.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* import { pithySSR } from '@pithyjs/vite-plugin';
|
|
66
|
+
*
|
|
67
|
+
* export default defineConfig({
|
|
68
|
+
* plugins: [
|
|
69
|
+
* pithySSR({ debug: true }),
|
|
70
|
+
* ],
|
|
71
|
+
* });
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
/** @codexApi {"parent":"pithy.vite-plugin-ssr","name":"pithySSR","stability":"experimental","signature":"(options?: PithySSRPluginOptions) => Plugin"} */
|
|
75
|
+
export declare function pithySSR(options?: PithySSRPluginOptions): Plugin;
|
|
76
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/ssrPlugin/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;EAcE;AAEF,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,MAAM,CAAC;AAKlD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAE9B,6EAA6E;IAC7E,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,4FAA4F;IAC5F,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAiED;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAO9C;AAkQD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,0JAA0J;AAC1J,wBAAgB,QAAQ,CAAC,OAAO,GAAE,qBAA0B,GAAG,MAAM,CAwLpE"}
|