hyperspan 1.0.0-alpha.8 → 1.0.0-alpha.9
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/package.json +1 -1
- package/src/index.ts +4 -2
- package/src/server.ts +9 -0
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -73,7 +73,9 @@ program
|
|
|
73
73
|
|
|
74
74
|
const routes: Record<string, (request: Request) => Promise<Response>> = {};
|
|
75
75
|
for (const route of server._routes) {
|
|
76
|
-
routes[route._path()] = (request: Request) =>
|
|
76
|
+
routes[route._path()] = (request: Request) => {
|
|
77
|
+
return route.fetch(request);
|
|
78
|
+
}
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
const httpServer = Bun.serve({
|
|
@@ -118,7 +120,7 @@ program
|
|
|
118
120
|
|
|
119
121
|
const server = await import(serverFile);
|
|
120
122
|
|
|
121
|
-
|
|
123
|
+
// @TODO: Build the project for SSG...
|
|
122
124
|
});
|
|
123
125
|
|
|
124
126
|
program.parse();
|
package/src/server.ts
CHANGED
|
@@ -128,6 +128,15 @@ export async function addDirectoryAsRoutes(
|
|
|
128
128
|
// Set route path based on the file path (if not already set)
|
|
129
129
|
if (!route._config.path) {
|
|
130
130
|
route._config.path = path;
|
|
131
|
+
|
|
132
|
+
// Initialize params object if it doesn't exist
|
|
133
|
+
if (parsedPath.params.length > 0) {
|
|
134
|
+
const params = route._config.params ?? {};
|
|
135
|
+
parsedPath.params.forEach(param => {
|
|
136
|
+
params[param] = undefined;
|
|
137
|
+
});
|
|
138
|
+
route._config.params = params;
|
|
139
|
+
}
|
|
131
140
|
}
|
|
132
141
|
|
|
133
142
|
if (cssFiles.length > 0) {
|