@torpor/build 0.2.0 → 0.3.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.
Files changed (157) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/RouteType-g8Ce5gOd.js +107 -0
  3. package/dist/RouteType-g8Ce5gOd.js.map +1 -0
  4. package/dist/Server-CSpY_-Ba.d.ts +78 -0
  5. package/dist/Server-CSpY_-Ba.d.ts.map +1 -0
  6. package/dist/ServerEvent-2-CnAy1W.js +74 -0
  7. package/dist/ServerEvent-2-CnAy1W.js.map +1 -0
  8. package/dist/Site-D4x1l0p5.d.ts +67 -0
  9. package/dist/Site-D4x1l0p5.d.ts.map +1 -0
  10. package/dist/_page-CsdPubw4.js +33 -0
  11. package/dist/_page-CsdPubw4.js.map +1 -0
  12. package/dist/bin/index.d.ts +1 -1
  13. package/dist/bin/index.js +14 -19
  14. package/dist/bin/index.js.map +1 -1
  15. package/dist/connectMiddleware-DbLj0St1.js +252 -0
  16. package/dist/connectMiddleware-DbLj0St1.js.map +1 -0
  17. package/dist/index.d.ts +188 -179
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.js +109 -145
  20. package/dist/index.js.map +1 -1
  21. package/dist/nav.d.ts +14 -0
  22. package/dist/nav.d.ts.map +1 -0
  23. package/dist/nav.js +184 -0
  24. package/dist/nav.js.map +1 -0
  25. package/dist/pathToRegex-CTgx7hQP.js +11 -0
  26. package/dist/pathToRegex-CTgx7hQP.js.map +1 -0
  27. package/dist/response-D-XpIuMH.js +307 -0
  28. package/dist/response-D-XpIuMH.js.map +1 -0
  29. package/dist/response.d.ts +336 -151
  30. package/dist/response.d.ts.map +1 -0
  31. package/dist/response.js +4 -37
  32. package/dist/run-CNdaKSPR.js +331 -0
  33. package/dist/run-CNdaKSPR.js.map +1 -0
  34. package/dist/run.d.ts +11 -8
  35. package/dist/run.d.ts.map +1 -0
  36. package/dist/run.js +8 -18
  37. package/dist/seeOther-BmehiI4C.js +110 -0
  38. package/dist/seeOther-BmehiI4C.js.map +1 -0
  39. package/dist/server.d.ts +12 -11
  40. package/dist/server.d.ts.map +1 -0
  41. package/dist/server.js +5 -18
  42. package/dist/state.d.ts +14 -10
  43. package/dist/state.d.ts.map +1 -0
  44. package/dist/state.js +3 -7
  45. package/dist/test.d.ts +12 -11
  46. package/dist/test.d.ts.map +1 -0
  47. package/dist/test.js +152 -225
  48. package/dist/test.js.map +1 -1
  49. package/package.json +25 -29
  50. package/src/bin/index.ts +9 -11
  51. package/src/index.ts +3 -0
  52. package/src/nav/load.ts +9 -0
  53. package/src/nav/loadData.ts +121 -0
  54. package/src/nav/navigate.ts +154 -0
  55. package/src/nav/reload.ts +9 -0
  56. package/src/nav.ts +4 -0
  57. package/src/response/badRequest.ts +9 -4
  58. package/src/response/created.ts +10 -3
  59. package/src/response/forbidden.ts +11 -4
  60. package/src/response/found.ts +30 -0
  61. package/src/response/methodNotAllowed.ts +8 -4
  62. package/src/response/movedPermanently.ts +25 -0
  63. package/src/response/notFound.ts +14 -7
  64. package/src/response/notModified.ts +24 -4
  65. package/src/response/ok.ts +19 -10
  66. package/src/response/permanentRedirect.ts +30 -0
  67. package/src/response/seeOther.ts +9 -3
  68. package/src/response/serverError.ts +14 -2
  69. package/src/response/temporaryRedirect.ts +31 -0
  70. package/src/response/unauthorized.ts +11 -4
  71. package/src/response/unprocessable.ts +8 -2
  72. package/src/response.ts +8 -4
  73. package/src/{site → run}/prepareTemplate.ts +1 -1
  74. package/src/{site → run}/run.ts +1 -1
  75. package/src/{site → run}/runBuild.ts +2 -2
  76. package/src/{site → run}/runDev.ts +2 -2
  77. package/src/{site → run}/runPreview.ts +1 -1
  78. package/src/run.ts +4 -4
  79. package/src/server/Routerx.ts +3 -3
  80. package/src/server/Server.ts +3 -3
  81. package/src/server/connect/connectMiddleware.ts +2 -1
  82. package/src/server/connect/nodeMessageToNodeResponse.ts +2 -2
  83. package/src/site/Router.ts +3 -3
  84. package/src/site/clientEntry.ts +11 -269
  85. package/src/site/defaultAdapter.ts +1 -1
  86. package/src/site/serverEntry.ts +67 -44
  87. package/src/state/$page.ts +3 -12
  88. package/src/state/client.ts +6 -0
  89. package/src/state/internal.ts +45 -0
  90. package/src/test/runTest.ts +1 -1
  91. package/src/types/Adapter.ts +2 -4
  92. package/src/types/ClientState.ts +8 -0
  93. package/src/types/InternalState.ts +7 -0
  94. package/src/types/LayoutHandler.ts +2 -4
  95. package/src/types/LayoutPath.ts +10 -0
  96. package/src/types/ManifestRoute.ts +2 -4
  97. package/src/types/PageEndPoint.ts +2 -4
  98. package/src/types/PageLoadEvent.ts +2 -4
  99. package/src/types/PageServerEndPoint.ts +2 -4
  100. package/src/types/PageState.ts +8 -0
  101. package/src/types/RouteHandler.ts +2 -4
  102. package/src/types/RouteLayoutHandler.ts +2 -4
  103. package/src/types/RouteMatchResult.ts +2 -4
  104. package/src/types/ServerHook.ts +3 -7
  105. package/src/types/ServerLoadEvent.ts +2 -4
  106. package/src/{site → utils}/pathToRegex.ts +1 -1
  107. package/{tsup.config.ts → tsdown.config.ts} +3 -4
  108. package/dist/Server-CNZWh5ca.d.cts +0 -71
  109. package/dist/Server-CNZWh5ca.d.ts +0 -71
  110. package/dist/Site-C2020GV_.d.ts +0 -63
  111. package/dist/Site-DQojGpE-.d.cts +0 -63
  112. package/dist/bin/index.cjs +0 -778
  113. package/dist/bin/index.cjs.map +0 -1
  114. package/dist/bin/index.d.cts +0 -1
  115. package/dist/chunk-565UOT3F.js +0 -18
  116. package/dist/chunk-565UOT3F.js.map +0 -1
  117. package/dist/chunk-B2UNTYN5.js +0 -68
  118. package/dist/chunk-B2UNTYN5.js.map +0 -1
  119. package/dist/chunk-CZHJQCPI.js +0 -286
  120. package/dist/chunk-CZHJQCPI.js.map +0 -1
  121. package/dist/chunk-PTVHEJZ5.js +0 -152
  122. package/dist/chunk-PTVHEJZ5.js.map +0 -1
  123. package/dist/chunk-SJVHHGVW.js +0 -13
  124. package/dist/chunk-SJVHHGVW.js.map +0 -1
  125. package/dist/chunk-TDOXEXG6.js +0 -85
  126. package/dist/chunk-TDOXEXG6.js.map +0 -1
  127. package/dist/chunk-WVXAN4IV.js +0 -50
  128. package/dist/chunk-WVXAN4IV.js.map +0 -1
  129. package/dist/chunk-YRBEYKQM.js +0 -372
  130. package/dist/chunk-YRBEYKQM.js.map +0 -1
  131. package/dist/index.cjs +0 -322
  132. package/dist/index.cjs.map +0 -1
  133. package/dist/index.d.cts +0 -199
  134. package/dist/metafile-cjs.json +0 -1
  135. package/dist/metafile-esm.json +0 -1
  136. package/dist/response.cjs +0 -150
  137. package/dist/response.cjs.map +0 -1
  138. package/dist/response.d.cts +0 -166
  139. package/dist/response.js.map +0 -1
  140. package/dist/run.cjs +0 -787
  141. package/dist/run.cjs.map +0 -1
  142. package/dist/run.d.cts +0 -14
  143. package/dist/run.js.map +0 -1
  144. package/dist/server.cjs +0 -398
  145. package/dist/server.cjs.map +0 -1
  146. package/dist/server.d.cts +0 -17
  147. package/dist/server.js.map +0 -1
  148. package/dist/state.cjs +0 -44
  149. package/dist/state.cjs.map +0 -1
  150. package/dist/state.d.cts +0 -11
  151. package/dist/state.js.map +0 -1
  152. package/dist/test.cjs +0 -538
  153. package/dist/test.cjs.map +0 -1
  154. package/dist/test.d.cts +0 -15
  155. package/src/response/moved.ts +0 -16
  156. package/src/response/redirect.ts +0 -17
  157. package/src/state/Page.ts +0 -8
package/dist/index.cjs DELETED
@@ -1,322 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // src/index.ts
31
- var index_exports = {};
32
- __export(index_exports, {
33
- Router: () => Router,
34
- Site: () => Site
35
- });
36
- module.exports = __toCommonJS(index_exports);
37
-
38
- // src/site/pathToRegex.ts
39
- function pathToRegex(path) {
40
- const pattern = path.split("/").map((p) => {
41
- return p.replace(/\[([^\/]+?)\]/, "(?<$1>[^\\/]+?)");
42
- }).join("\\/").replaceAll("*", ".*") + // Ignore trailing slashes -- `/path` should be treated the same as `/path/`
43
- "/*";
44
- return new RegExp(`^${pattern}/*$`);
45
- }
46
-
47
- // src/site/Router.ts
48
- var Router = class {
49
- routes = [];
50
- constructor() {
51
- }
52
- //add(path: string, file: string) {
53
- // // TODO: Call the specific addX method based on the file path
54
- // this.addPage(route, file);
55
- //}
56
- addPages(routes) {
57
- for (let r of routes) {
58
- this.routes.push(
59
- new Route(r.path, {
60
- path: r.path,
61
- type: r.type,
62
- endPoint: r.endPoint
63
- })
64
- );
65
- }
66
- this.#sortRoutes();
67
- return this;
68
- }
69
- // TODO: Allow calling with the endpoint itself, so that you can setup an app with no scaffold
70
- addPage(path, type, endPoint) {
71
- this.routes.push(
72
- new Route(path, {
73
- path,
74
- type,
75
- endPoint
76
- })
77
- );
78
- this.#sortRoutes();
79
- return this;
80
- }
81
- /*
82
- loadPage(ev: ServerEvent, file: string): Response {
83
- let page = this.pages.get(file);
84
- if (!page) {
85
- page = {};
86
- this.pages.set(file, page);
87
- }
88
- }
89
- */
90
- match(path, query) {
91
- for (let route of this.routes) {
92
- let match = path.match(route.regex);
93
- if (match) {
94
- if (!route.handler.loaded) {
95
- this.#loadHandler(route.handler, route.path);
96
- }
97
- return {
98
- handler: route.handler,
99
- params: match.groups,
100
- query
101
- };
102
- }
103
- }
104
- console.log(`not found: '${path}'`);
105
- }
106
- #loadHandler(handler, path) {
107
- handler.layouts = this.#findLayouts(path);
108
- handler.serverEndPoint = this.#findServer(path);
109
- handler.serverHook = this.#findServerHook(path);
110
- }
111
- #findLayouts(path) {
112
- let layouts = [];
113
- let parts = path.replace(/\/~server$/, "").split("/");
114
- let basePath = "";
115
- for (let i = 0; i < parts.length; i++) {
116
- if (i > 0) {
117
- basePath += "/" + parts[i];
118
- }
119
- const layoutPath = basePath + "/_layout";
120
- const layoutRoute = this.routes.find((r) => r.path === layoutPath);
121
- if (layoutRoute) {
122
- layouts.push({
123
- path: layoutPath,
124
- endPoint: layoutRoute.handler.endPoint,
125
- serverEndPoint: this.#findServer(layoutPath)
126
- });
127
- }
128
- }
129
- return layouts.length ? layouts : void 0;
130
- }
131
- #findServer(path) {
132
- const serverPath = path.replace(/\/$/, "") + "/~server";
133
- const serverRoute = this.routes.find((r) => r.path === serverPath);
134
- return serverRoute && serverRoute.handler.endPoint;
135
- }
136
- #findServerHook(path) {
137
- let serverHookPath = "/_hook/~server";
138
- if (path.startsWith("/api/")) {
139
- serverHookPath = "/api" + serverHookPath;
140
- }
141
- const serverHookRoute = this.routes.find((r) => r.path === serverHookPath);
142
- return serverHookRoute && serverHookRoute.handler.endPoint;
143
- }
144
- // HACK: We're doing this here as well as in Site, so that you can use the
145
- // Router externally without Site
146
- #sortRoutes() {
147
- this.routes = this.routes.sort((a, b) => {
148
- for (let i = 0; i < Math.min(a.path.length, b.path.length); i++) {
149
- if (a.path[i] === "[" && b.path[i] !== "[") {
150
- return 1;
151
- } else if (b.path[i] === "[" && a.path[i] !== "[") {
152
- return -1;
153
- } else if (a.path[i] === b.path[i]) {
154
- } else {
155
- return a.path[i].localeCompare(b.path[i]);
156
- }
157
- }
158
- return a.path.length - b.path.length;
159
- });
160
- }
161
- };
162
- var Route = class {
163
- path;
164
- regex;
165
- handler;
166
- constructor(path, handler) {
167
- this.path = path;
168
- this.regex = pathToRegex(path);
169
- this.handler = handler;
170
- }
171
- };
172
-
173
- // src/site/Site.ts
174
- var import_node_fs = require("fs");
175
- var import_node_path = __toESM(require("path"), 1);
176
- var import_vite_tsconfig_paths = __toESM(require("vite-tsconfig-paths"), 1);
177
-
178
- // src/types/RouteType.ts
179
- var PAGE_ROUTE = 0;
180
- var PAGE_SERVER_ROUTE = 1;
181
- var SERVER_ROUTE = 3;
182
- var LAYOUT_ROUTE = 4;
183
- var LAYOUT_SERVER_ROUTE = 5;
184
- var HOOK_ROUTE = 6;
185
- var HOOK_SERVER_ROUTE = 7;
186
- var ERROR_ROUTE = 8;
187
-
188
- // src/site/defaultAdapter.ts
189
- var defaultAdapter = {
190
- serve: () => {
191
- console.log("An adapter needs to be set in site.config");
192
- }
193
- };
194
- var defaultAdapter_default = defaultAdapter;
195
-
196
- // src/site/Site.ts
197
- var Site = class {
198
- root;
199
- routes = [];
200
- // Is default plugins a bad idea?
201
- // HACK: Set loose because otherwise it uses a list of allowed extensions
202
- // TODO: Should probably just do this ourselves and let the user pass in
203
- // tsconfigPaths themselves if they want to do something funky
204
- plugins = [(0, import_vite_tsconfig_paths.default)({ loose: true })];
205
- // Is default adapter a bad idea?
206
- adapter = defaultAdapter_default;
207
- /**
208
- * Extra inputs, as absolute file paths, that will be compiled with the
209
- * output. What you do with them after that is up to you. File paths ending
210
- * with server.ts/js will only be compiled with the server output
211
- */
212
- inputs = [];
213
- /**
214
- * Vite config options to merge with the standard Torpor build options.
215
- * `plugins` and `build.rollupOptions.input` will be overridden, so you
216
- * should set `Site.plugins` and `Site.inputs` instead. Other options may be
217
- * overridden or incompatible, so experimentation may be required
218
- */
219
- viteConfig;
220
- constructor() {
221
- this.root = process.cwd();
222
- }
223
- /**
224
- * Adds a folder of routes, based on the names of the files in the folder
225
- * @param folder The folder containing the routes
226
- */
227
- async addRouteFolder(folder) {
228
- const routeFolder = import_node_path.default.join(this.root, folder);
229
- const routeFiles = await import_node_fs.promises.readdir(routeFolder, { recursive: true });
230
- for (let file of routeFiles) {
231
- if (/^(\+|_).+(\.js|\.ts)$/.test(import_node_path.default.basename(file))) {
232
- let routePath = this.#routePath(file);
233
- let type = this.#routeType(file);
234
- file = import_node_path.default.relative(this.root, import_node_path.default.resolve(routeFolder, file));
235
- this.routes.push({ path: routePath, file, type });
236
- }
237
- }
238
- this.#sortRoutes();
239
- }
240
- /**
241
- * Adds a file route, which can have a standard name (e.g. +page.ts) or any
242
- * name if you pass the type
243
- * @param path The route path
244
- * @param file The file
245
- * @param type The file type (if the file name is non-standard)
246
- */
247
- addRouteFile(path, file, type) {
248
- let routePath = this.#routePath(import_node_path.default.join(path, type ?? import_node_path.default.basename(file)));
249
- let routeType = type ? this.#routeTypeFromString(type) : this.#routeType(file);
250
- this.routes.push({ path: routePath, file, type: routeType });
251
- this.#sortRoutes();
252
- }
253
- #routePath(file) {
254
- let routePath = file.replace(/^\//, "").replace(/(\.ts|\.js)$/, "").replace(/_hook.server$/, "_hook/~server").replace(/_layout.server$/, "_layout/~server").replace(/\+page.server$/, "~server").replace(/\+server$/, "").replace(/\+page$/, "").replace(/\/$/, "");
255
- return routePath.length > 0 ? `/${routePath}` : "/";
256
- }
257
- #routeType(file) {
258
- let routePath = file.replace(/^\//, "").replace(/(\.ts|\.js)$/, "");
259
- if (routePath.endsWith("+page")) {
260
- return PAGE_ROUTE;
261
- } else if (routePath.endsWith("+page.server")) {
262
- return PAGE_SERVER_ROUTE;
263
- } else if (routePath.endsWith("+server")) {
264
- return SERVER_ROUTE;
265
- } else if (routePath.endsWith("_layout")) {
266
- return LAYOUT_ROUTE;
267
- } else if (routePath.endsWith("_layout.server")) {
268
- return LAYOUT_SERVER_ROUTE;
269
- } else if (routePath.endsWith("_hook")) {
270
- return HOOK_ROUTE;
271
- } else if (routePath.endsWith("_hook.server")) {
272
- return HOOK_SERVER_ROUTE;
273
- } else if (routePath.endsWith("_error")) {
274
- return ERROR_ROUTE;
275
- }
276
- return -1;
277
- }
278
- #routeTypeFromString(type) {
279
- switch (type) {
280
- case "+page":
281
- return PAGE_ROUTE;
282
- case "+page.server":
283
- return PAGE_SERVER_ROUTE;
284
- case "+server":
285
- return SERVER_ROUTE;
286
- case "_layout":
287
- return LAYOUT_ROUTE;
288
- case "_layout.server":
289
- return LAYOUT_SERVER_ROUTE;
290
- case "_hook":
291
- return HOOK_ROUTE;
292
- case "_hook.server":
293
- return HOOK_SERVER_ROUTE;
294
- case "_error":
295
- return ERROR_ROUTE;
296
- }
297
- }
298
- // TODO: You could make your site in a single file, like e.g. Hono...
299
- //addPage(path: string, endPoint: PageEndPoint, serverEndPoint?: PageServerEndPoint) {}
300
- //addEndPoint(path: string, endPoint: ServerEndPoint) {}
301
- #sortRoutes() {
302
- this.routes = this.routes.sort((a, b) => {
303
- for (let i = 0; i < Math.min(a.path.length, b.path.length); i++) {
304
- if (a.path[i] === "[" && b.path[i] !== "[") {
305
- return 1;
306
- } else if (b.path[i] === "[" && a.path[i] !== "[") {
307
- return -1;
308
- } else if (a.path[i] === b.path[i]) {
309
- } else {
310
- return a.path[i].localeCompare(b.path[i]);
311
- }
312
- }
313
- return a.path.length - b.path.length;
314
- });
315
- }
316
- };
317
- // Annotate the CommonJS export names for ESM import in node:
318
- 0 && (module.exports = {
319
- Router,
320
- Site
321
- });
322
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.ts","../src/site/pathToRegex.ts","../src/site/Router.ts","../src/site/Site.ts","../src/types/RouteType.ts","../src/site/defaultAdapter.ts"],"sourcesContent":["import Router from \"./site/Router\";\nimport Site from \"./site/Site\";\nimport type Adapter from \"./types/Adapter\";\nimport type PageEndPoint from \"./types/PageEndPoint\";\nimport type PageLoadEvent from \"./types/PageLoadEvent\";\nimport type PageServerAction from \"./types/PageServerAction\";\nimport type PageServerEndPoint from \"./types/PageServerEndPoint\";\nimport type PageServerLoad from \"./types/PageServerLoad\";\nimport type ServerEndPoint from \"./types/ServerEndPoint\";\nimport type ServerHook from \"./types/ServerHook\";\nimport type ServerLoadEvent from \"./types/ServerLoadEvent\";\nimport type ServerRequest from \"./types/ServerRequest\";\n\nexport { Site, Router };\n\nexport type {\n\tAdapter,\n\tPageEndPoint,\n\tPageServerEndPoint,\n\tPageServerLoad,\n\tPageServerAction,\n\tServerEndPoint,\n\tServerRequest,\n\tServerHook,\n\tPageLoadEvent,\n\tServerLoadEvent,\n};\n","export default function pathToRegex(path: string): RegExp {\n\tconst pattern =\n\t\tpath\n\t\t\t.split(\"/\")\n\t\t\t// Replace `[slug]` with a grouped match so we can pull out params\n\t\t\t.map((p) => {\n\t\t\t\treturn p.replace(/\\[([^\\/]+?)\\]/, \"(?<$1>[^\\\\/]+?)\");\n\t\t\t})\n\t\t\t.join(\"\\\\/\")\n\t\t\t// Replace globs with regex syntax\n\t\t\t.replaceAll(\"*\", \".*\") +\n\t\t// Ignore trailing slashes -- `/path` should be treated the same as `/path/`\n\t\t\"/*\";\n\treturn new RegExp(`^${pattern}/*$`);\n}\n","import type LayoutHandler from \"../types/LayoutHandler\";\nimport type ManifestRoute from \"../types/ManifestRoute\";\nimport type RouteHandler from \"../types/RouteHandler\";\nimport pathToRegex from \"./pathToRegex\";\n\n/**\n * A router that handles file routes with layouts, hooks, etc.\n */\nexport default class Router {\n\troutes: Route[] = [];\n\n\tconstructor() {}\n\n\t//add(path: string, file: string) {\n\t//\t// TODO: Call the specific addX method based on the file path\n\t//\tthis.addPage(route, file);\n\t//}\n\n\taddPages(routes: ManifestRoute[]): this {\n\t\tfor (let r of routes) {\n\t\t\tthis.routes.push(\n\t\t\t\tnew Route(r.path, {\n\t\t\t\t\tpath: r.path,\n\t\t\t\t\ttype: r.type,\n\t\t\t\t\tendPoint: r.endPoint,\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t\tthis.#sortRoutes();\n\t\treturn this;\n\t}\n\n\t// TODO: Allow calling with the endpoint itself, so that you can setup an app with no scaffold\n\taddPage(path: string, type: number, endPoint: () => Promise<any>): this {\n\t\tthis.routes.push(\n\t\t\tnew Route(path, {\n\t\t\t\tpath,\n\t\t\t\ttype,\n\t\t\t\tendPoint,\n\t\t\t}),\n\t\t);\n\t\tthis.#sortRoutes();\n\t\treturn this;\n\t}\n\n\t/*\n\tloadPage(ev: ServerEvent, file: string): Response {\n\t\tlet page = this.pages.get(file);\n\t\tif (!page) {\n\t\t\tpage = {};\n\t\t\tthis.pages.set(file, page);\n\t\t}\n\t}\n\t*/\n\n\tmatch(path: string, query: URLSearchParams): Match | undefined {\n\t\tfor (let route of this.routes) {\n\t\t\tlet match = path.match(route.regex);\n\t\t\tif (match) {\n\t\t\t\t// Lazy load server endpoints and layouts\n\t\t\t\tif (!route.handler.loaded) {\n\t\t\t\t\tthis.#loadHandler(route.handler, route.path);\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\thandler: route.handler,\n\t\t\t\t\tparams: match.groups,\n\t\t\t\t\tquery,\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\tconsole.log(`not found: '${path}'`);\n\t}\n\n\t#loadHandler(handler: RouteHandler, path: string) {\n\t\thandler.layouts = this.#findLayouts(path);\n\t\thandler.serverEndPoint = this.#findServer(path);\n\t\thandler.serverHook = this.#findServerHook(path);\n\t}\n\n\t#findLayouts(path: string): LayoutHandler[] | undefined {\n\t\tlet layouts: LayoutHandler[] = [];\n\t\tlet parts = path\n\t\t\t// Strip the trailing`~/server` (so we don't look for `~/server/_layout`\n\t\t\t// which will never exist)\n\t\t\t.replace(/\\/~server$/, \"\")\n\t\t\t// The path will always start with / so splitting e.g. `/first/second`\n\t\t\t// will result in ['', 'first', 'second'] and checks for `/_layout`,\n\t\t\t// `/first/_layout` and `/second/_layout`\n\t\t\t.split(\"/\");\n\t\tlet basePath = \"\";\n\t\tfor (let i = 0; i < parts.length; i++) {\n\t\t\tif (i > 0) {\n\t\t\t\tbasePath += \"/\" + parts[i];\n\t\t\t}\n\t\t\tconst layoutPath = basePath + \"/_layout\";\n\t\t\tconst layoutRoute = this.routes.find((r) => r.path === layoutPath);\n\t\t\tif (layoutRoute) {\n\t\t\t\tlayouts.push({\n\t\t\t\t\tpath: layoutPath,\n\t\t\t\t\tendPoint: layoutRoute.handler.endPoint,\n\t\t\t\t\tserverEndPoint: this.#findServer(layoutPath),\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn layouts.length ? layouts : undefined;\n\t}\n\n\t#findServer(path: string): (() => Promise<any>) | undefined {\n\t\tconst serverPath = path.replace(/\\/$/, \"\") + \"/~server\";\n\t\tconst serverRoute = this.routes.find((r) => r.path === serverPath);\n\t\treturn serverRoute && serverRoute.handler.endPoint;\n\t}\n\n\t#findServerHook(path: string): (() => Promise<any>) | undefined {\n\t\t// TODO: Should this be a collection, like layouts?\n\t\tlet serverHookPath = \"/_hook/~server\";\n\t\t// HACK: Generalise this\n\t\tif (path.startsWith(\"/api/\")) {\n\t\t\tserverHookPath = \"/api\" + serverHookPath;\n\t\t}\n\t\tconst serverHookRoute = this.routes.find((r) => r.path === serverHookPath);\n\t\treturn serverHookRoute && serverHookRoute.handler.endPoint;\n\t}\n\n\t// HACK: We're doing this here as well as in Site, so that you can use the\n\t// Router externally without Site\n\t#sortRoutes() {\n\t\tthis.routes = this.routes.sort((a, b) => {\n\t\t\t// Sort [param]s after paths\n\t\t\t// There might be a quicker/easier way to do this\n\t\t\tfor (let i = 0; i < Math.min(a.path.length, b.path.length); i++) {\n\t\t\t\tif (a.path[i] === \"[\" && b.path[i] !== \"[\") {\n\t\t\t\t\treturn 1;\n\t\t\t\t} else if (b.path[i] === \"[\" && a.path[i] !== \"[\") {\n\t\t\t\t\treturn -1;\n\t\t\t\t} else if (a.path[i] === b.path[i]) {\n\t\t\t\t\t// Keep going...\n\t\t\t\t} else {\n\t\t\t\t\treturn a.path[i].localeCompare(b.path[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn a.path.length - b.path.length;\n\t\t});\n\t}\n}\n\nclass Route {\n\tpath: string;\n\tregex: RegExp;\n\thandler: RouteHandler;\n\n\tconstructor(path: string, handler: RouteHandler) {\n\t\tthis.path = path;\n\t\tthis.regex = pathToRegex(path);\n\t\tthis.handler = handler;\n\t}\n}\n\ntype Match = {\n\thandler: RouteHandler;\n\tparams?: Record<string, string>;\n\tquery: URLSearchParams;\n};\n","import { promises as fs } from \"node:fs\";\nimport fpath from \"node:path\";\nimport { type Plugin, type UserConfig } from \"vite\";\nimport tsconfigPaths from \"vite-tsconfig-paths\";\nimport type Adapter from \"../types/Adapter\";\nimport {\n\tERROR_ROUTE,\n\tHOOK_ROUTE,\n\tHOOK_SERVER_ROUTE,\n\tLAYOUT_ROUTE,\n\tLAYOUT_SERVER_ROUTE,\n\tPAGE_ROUTE,\n\tPAGE_SERVER_ROUTE,\n\tRouteType,\n\tSERVER_ROUTE,\n} from \"../types/RouteType\";\nimport defaultAdapter from \"./defaultAdapter\";\n\n// 1. The user sets this up\n// 2. It is passed into serverEntry and clientEntry through a Vite plugin\n// (defined in manifest.ts)\n// 3. In those files, it is used to build a Router\n\n/**\n * The Site class contains the information necessary to setup a @torpor/build\n * site, including routes, plugins, and options.\n */\nexport default class Site {\n\troot: string;\n\troutes: { path: string; file: string; type: RouteType }[] = [];\n\t// Is default plugins a bad idea?\n\t// HACK: Set loose because otherwise it uses a list of allowed extensions\n\t// TODO: Should probably just do this ourselves and let the user pass in\n\t// tsconfigPaths themselves if they want to do something funky\n\tplugins: Plugin[] = [tsconfigPaths({ loose: true })];\n\t// Is default adapter a bad idea?\n\tadapter: Adapter = defaultAdapter;\n\t/**\n\t * Extra inputs, as absolute file paths, that will be compiled with the\n\t * output. What you do with them after that is up to you. File paths ending\n\t * with server.ts/js will only be compiled with the server output\n\t */\n\tinputs: string[] = [];\n\t/**\n\t * Vite config options to merge with the standard Torpor build options.\n\t * `plugins` and `build.rollupOptions.input` will be overridden, so you\n\t * should set `Site.plugins` and `Site.inputs` instead. Other options may be\n\t * overridden or incompatible, so experimentation may be required\n\t */\n\tviteConfig?: UserConfig;\n\n\tconstructor() {\n\t\tthis.root = process.cwd();\n\t}\n\n\t/**\n\t * Adds a folder of routes, based on the names of the files in the folder\n\t * @param folder The folder containing the routes\n\t */\n\tasync addRouteFolder(folder: string): Promise<void> {\n\t\tconst routeFolder = fpath.join(this.root, folder);\n\t\tconst routeFiles = await fs.readdir(routeFolder, { recursive: true });\n\t\tfor (let file of routeFiles) {\n\t\t\t// The file must start with `+` or `_` and end with `.js` or `.ts`\n\t\t\tif (/^(\\+|_).+(\\.js|\\.ts)$/.test(fpath.basename(file))) {\n\t\t\t\tlet routePath = this.#routePath(file);\n\t\t\t\tlet type = this.#routeType(file);\n\t\t\t\tfile = fpath.relative(this.root, fpath.resolve(routeFolder, file));\n\t\t\t\tthis.routes.push({ path: routePath, file, type });\n\t\t\t}\n\t\t}\n\t\tthis.#sortRoutes();\n\t}\n\n\t/**\n\t * Adds a file route, which can have a standard name (e.g. +page.ts) or any\n\t * name if you pass the type\n\t * @param path The route path\n\t * @param file The file\n\t * @param type The file type (if the file name is non-standard)\n\t */\n\taddRouteFile(\n\t\tpath: string,\n\t\tfile: string,\n\t\ttype?:\n\t\t\t| \"+page\"\n\t\t\t| \"+page.server\"\n\t\t\t| \"+server\"\n\t\t\t| \"_layout\"\n\t\t\t| \"_layout.server\"\n\t\t\t| \"_hook\"\n\t\t\t| \"_hook.server\"\n\t\t\t| \"_error\",\n\t): void {\n\t\tlet routePath = this.#routePath(fpath.join(path, type ?? fpath.basename(file)));\n\t\tlet routeType = type ? this.#routeTypeFromString(type) : this.#routeType(file);\n\t\tthis.routes.push({ path: routePath, file, type: routeType });\n\t\tthis.#sortRoutes();\n\t}\n\n\t#routePath(file: string): string {\n\t\tlet routePath = file\n\t\t\t.replace(/^\\//, \"\")\n\t\t\t.replace(/(\\.ts|\\.js)$/, \"\")\n\t\t\t.replace(/_hook.server$/, \"_hook/~server\")\n\t\t\t.replace(/_layout.server$/, \"_layout/~server\")\n\t\t\t.replace(/\\+page.server$/, \"~server\")\n\t\t\t.replace(/\\+server$/, \"\")\n\t\t\t.replace(/\\+page$/, \"\")\n\t\t\t.replace(/\\/$/, \"\");\n\t\treturn routePath.length > 0 ? `/${routePath}` : \"/\";\n\t}\n\n\t#routeType(file: string): RouteType {\n\t\tlet routePath = file.replace(/^\\//, \"\").replace(/(\\.ts|\\.js)$/, \"\");\n\t\tif (routePath.endsWith(\"+page\")) {\n\t\t\treturn PAGE_ROUTE;\n\t\t} else if (routePath.endsWith(\"+page.server\")) {\n\t\t\treturn PAGE_SERVER_ROUTE;\n\t\t} else if (routePath.endsWith(\"+server\")) {\n\t\t\treturn SERVER_ROUTE;\n\t\t} else if (routePath.endsWith(\"_layout\")) {\n\t\t\treturn LAYOUT_ROUTE;\n\t\t} else if (routePath.endsWith(\"_layout.server\")) {\n\t\t\treturn LAYOUT_SERVER_ROUTE;\n\t\t} else if (routePath.endsWith(\"_hook\")) {\n\t\t\treturn HOOK_ROUTE;\n\t\t} else if (routePath.endsWith(\"_hook.server\")) {\n\t\t\treturn HOOK_SERVER_ROUTE;\n\t\t} else if (routePath.endsWith(\"_error\")) {\n\t\t\treturn ERROR_ROUTE;\n\t\t}\n\t\treturn -1;\n\t}\n\n\t#routeTypeFromString(\n\t\ttype:\n\t\t\t| \"+page\"\n\t\t\t| \"+page.server\"\n\t\t\t| \"+server\"\n\t\t\t| \"_layout\"\n\t\t\t| \"_layout.server\"\n\t\t\t| \"_hook\"\n\t\t\t| \"_hook.server\"\n\t\t\t| \"_error\",\n\t) {\n\t\tswitch (type) {\n\t\t\tcase \"+page\":\n\t\t\t\treturn PAGE_ROUTE;\n\t\t\tcase \"+page.server\":\n\t\t\t\treturn PAGE_SERVER_ROUTE;\n\t\t\tcase \"+server\":\n\t\t\t\treturn SERVER_ROUTE;\n\t\t\tcase \"_layout\":\n\t\t\t\treturn LAYOUT_ROUTE;\n\t\t\tcase \"_layout.server\":\n\t\t\t\treturn LAYOUT_SERVER_ROUTE;\n\t\t\tcase \"_hook\":\n\t\t\t\treturn HOOK_ROUTE;\n\t\t\tcase \"_hook.server\":\n\t\t\t\treturn HOOK_SERVER_ROUTE;\n\t\t\tcase \"_error\":\n\t\t\t\treturn ERROR_ROUTE;\n\t\t}\n\t}\n\n\t// TODO: You could make your site in a single file, like e.g. Hono...\n\t//addPage(path: string, endPoint: PageEndPoint, serverEndPoint?: PageServerEndPoint) {}\n\t//addEndPoint(path: string, endPoint: ServerEndPoint) {}\n\n\t#sortRoutes() {\n\t\tthis.routes = this.routes.sort((a, b) => {\n\t\t\t// Sort [param]s after paths\n\t\t\t// There might be a quicker/easier way to do this\n\t\t\tfor (let i = 0; i < Math.min(a.path.length, b.path.length); i++) {\n\t\t\t\tif (a.path[i] === \"[\" && b.path[i] !== \"[\") {\n\t\t\t\t\treturn 1;\n\t\t\t\t} else if (b.path[i] === \"[\" && a.path[i] !== \"[\") {\n\t\t\t\t\treturn -1;\n\t\t\t\t} else if (a.path[i] === b.path[i]) {\n\t\t\t\t\t// Keep going...\n\t\t\t\t} else {\n\t\t\t\t\treturn a.path[i].localeCompare(b.path[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn a.path.length - b.path.length;\n\t\t});\n\t}\n}\n","export const PAGE_ROUTE = 0;\nexport const PAGE_SERVER_ROUTE = 1;\nexport const SERVER_ROUTE = 3;\nexport const LAYOUT_ROUTE = 4;\nexport const LAYOUT_SERVER_ROUTE = 5;\nexport const HOOK_ROUTE = 6;\nexport const HOOK_SERVER_ROUTE = 7;\nexport const ERROR_ROUTE = 8;\n\nexport type RouteType =\n\t| typeof PAGE_ROUTE\n\t| typeof PAGE_SERVER_ROUTE\n\t| typeof SERVER_ROUTE\n\t| typeof LAYOUT_ROUTE\n\t| typeof LAYOUT_SERVER_ROUTE\n\t| typeof HOOK_ROUTE\n\t| typeof HOOK_SERVER_ROUTE\n\t| typeof ERROR_ROUTE\n\t| -1;\n","import Adapter from \"../types/Adapter\";\n\n// TODO: This should be an adapter-auto package that conditionally loads other packages...\n\nconst defaultAdapter: Adapter = {\n\tserve: () => {\n\t\tconsole.log(\"An adapter needs to be set in site.config\");\n\t},\n};\n\nexport default defaultAdapter;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAe,SAAR,YAA6B,MAAsB;AACzD,QAAM,UACL,KACE,MAAM,GAAG,EAET,IAAI,CAAC,MAAM;AACX,WAAO,EAAE,QAAQ,iBAAiB,iBAAiB;AAAA,EACpD,CAAC,EACA,KAAK,KAAK,EAEV,WAAW,KAAK,IAAI;AAAA,EAEtB;AACD,SAAO,IAAI,OAAO,IAAI,OAAO,KAAK;AACnC;;;ACNA,IAAqB,SAArB,MAA4B;AAAA,EAC3B,SAAkB,CAAC;AAAA,EAEnB,cAAc;AAAA,EAAC;AAAA;AAAA;AAAA;AAAA;AAAA,EAOf,SAAS,QAA+B;AACvC,aAAS,KAAK,QAAQ;AACrB,WAAK,OAAO;AAAA,QACX,IAAI,MAAM,EAAE,MAAM;AAAA,UACjB,MAAM,EAAE;AAAA,UACR,MAAM,EAAE;AAAA,UACR,UAAU,EAAE;AAAA,QACb,CAAC;AAAA,MACF;AAAA,IACD;AACA,SAAK,YAAY;AACjB,WAAO;AAAA,EACR;AAAA;AAAA,EAGA,QAAQ,MAAc,MAAc,UAAoC;AACvE,SAAK,OAAO;AAAA,MACX,IAAI,MAAM,MAAM;AAAA,QACf;AAAA,QACA;AAAA,QACA;AAAA,MACD,CAAC;AAAA,IAC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AACJ,eAAO;AAAA,MACR,KAAK;AACJ,eAAO;AAAA,MACR,KAAK;AACJ,eAAO;AAAA,MACR,KAAK;AACJ,eAAO;AAAA,MACR,KAAK;AACJ,eAAO;AAAA,MACR,KAAK;AACJ,eAAO;AAAA,IACT;AAAA,EACD;AAAA;AAAA;AAAA;AAAA,EAMA,cAAc;AACb,SAAK,SAAS,KAAK,OAAO,KAAK,CAAC,GAAG,MAAM;AAGxC,eAAS,IAAI,GAAG,IAAI,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,KAAK,MAAM,GAAG,KAAK;AAChE,YAAI,EAAE,KAAK,CAAC,MAAM,OAAO,EAAE,KAAK,CAAC,MAAM,KAAK;AAC3C,iBAAO;AAAA,QACR,WAAW,EAAE,KAAK,CAAC,MAAM,OAAO,EAAE,KAAK,CAAC,MAAM,KAAK;AAClD,iBAAO;AAAA,QACR,WAAW,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG;AAAA,QAEpC,OAAO;AACN,iBAAO,EAAE,KAAK,CAAC,EAAE,cAAc,EAAE,KAAK,CAAC,CAAC;AAAA,QACzC;AAAA,MACD;AACA,aAAO,EAAE,KAAK,SAAS,EAAE,KAAK;AAAA,IAC/B,CAAC;AAAA,EACF;AACD;","names":["tsconfigPaths","fpath","fs"]}
package/dist/index.d.cts DELETED
@@ -1,199 +0,0 @@
1
- export { A as Adapter, S as Site } from './Site-DQojGpE-.cjs';
2
- import { Component } from '@torpor/view';
3
- import { C as CookieHelper, H as HeaderHelper } from './Server-CNZWh5ca.cjs';
4
- import 'vite';
5
- import 'cookie';
6
-
7
- type ManifestRoute = {
8
- path: string;
9
- type: number;
10
- endPoint: () => Promise<any>;
11
- };
12
-
13
- type RouteLayoutHandler = {
14
- path: string;
15
- endPoint: () => Promise<any>;
16
- serverEndPoint?: () => Promise<any>;
17
- };
18
-
19
- type RouteHandler = {
20
- path: string;
21
- type: number;
22
- endPoint: () => Promise<any>;
23
- loaded?: boolean;
24
- layouts?: RouteLayoutHandler[];
25
- serverEndPoint?: () => Promise<any>;
26
- serverHook?: () => Promise<any>;
27
- };
28
-
29
- /**
30
- * A router that handles file routes with layouts, hooks, etc.
31
- */
32
- declare class Router {
33
- #private;
34
- routes: Route[];
35
- constructor();
36
- addPages(routes: ManifestRoute[]): this;
37
- addPage(path: string, type: number, endPoint: () => Promise<any>): this;
38
- match(path: string, query: URLSearchParams): Match | undefined;
39
- }
40
- declare class Route {
41
- path: string;
42
- regex: RegExp;
43
- handler: RouteHandler;
44
- constructor(path: string, handler: RouteHandler);
45
- }
46
- type Match = {
47
- handler: RouteHandler;
48
- params?: Record<string, string>;
49
- query: URLSearchParams;
50
- };
51
-
52
- type PageLoadEvent = {
53
- /**
54
- * The URL for the server function.
55
- */
56
- url: URL;
57
- /**
58
- * Route params from the URL and route path.
59
- */
60
- params: Record<string, string>;
61
- /**
62
- * Data that is (optionally) loaded from the load function and passed into the page as $props.data.
63
- */
64
- data: Record<string, any>;
65
- };
66
-
67
- /**
68
- * For +page.
69
- */
70
- type PageEndPoint = {
71
- /**
72
- * Builds the route path for the page in a type-safe manner.
73
- * TODO: Not sure this is actually the best way to do it...
74
- */
75
- route?: (...args: any[]) => string;
76
- /**
77
- * Loads data for the page.
78
- */
79
- load?: (event: PageLoadEvent) => Response | undefined | void | Promise<Response | undefined | void>;
80
- /**
81
- * The component that is displayed for the page.
82
- */
83
- component?: Component;
84
- /**
85
- * The head element data for the page, which may include a <title> and <meta> elements.
86
- */
87
- head?: HeadElement[] | ((event: PageLoadEvent) => HeadElement[]);
88
- };
89
-
90
- type HeadElement = TitleElement | MetaElement;
91
- interface TitleElement {
92
- title: string;
93
- }
94
- interface MetaElement {
95
- name: string;
96
- content: string;
97
- }
98
-
99
- type ServerLoadEvent = {
100
- /**
101
- * The URL for the server function.
102
- */
103
- url: URL;
104
- /**
105
- * Route params from the URL and route path.
106
- */
107
- params: Record<string, string>;
108
- /**
109
- * Data that is available to functions in +server hooks, layouts, endpoints
110
- * and pages. It flows down in that order.
111
- */
112
- appData: Record<string, any>;
113
- /**
114
- * The server request.
115
- */
116
- request: Request;
117
- /**
118
- * A helper for getting and setting cookie data.
119
- */
120
- cookies: CookieHelper;
121
- /**
122
- * A helper for getting and setting headers.
123
- */
124
- headers: HeaderHelper;
125
- /**
126
- * An optional adapter object, containing adapter-specific functionality.
127
- */
128
- adapter: Record<PropertyKey, any>;
129
- };
130
-
131
- type PageServerAction = (event: ServerLoadEvent) => Response | undefined | void | Promise<Response | undefined | void>;
132
-
133
- type PageServerLoad = (event: ServerLoadEvent) => Response | undefined | void | Promise<Response | undefined | void>;
134
-
135
- /**
136
- * For +page.server.
137
- */
138
- type PageServerEndPoint = {
139
- /**
140
- * Loads data from the server for a page.
141
- */
142
- load?: PageServerLoad;
143
- /**
144
- * A map of actions that can be performed on the server for a page, generally from a form submit.
145
- */
146
- actions?: Record<string, PageServerAction>;
147
- };
148
-
149
- type ServerRequest = (event: ServerLoadEvent) => Response | undefined | void | Promise<Response | undefined | void>;
150
-
151
- /**
152
- * For +server.
153
- */
154
- type ServerEndPoint = {
155
- [key: string]: ServerRequest;
156
- } & {
157
- /**
158
- * Performs a GET.
159
- */
160
- get?: ServerRequest;
161
- /**
162
- * Performs a POST.
163
- */
164
- post?: ServerRequest;
165
- /**
166
- * Performs a PATCH.
167
- */
168
- patch?: ServerRequest;
169
- /**
170
- * Performs a PUT.
171
- */
172
- put?: ServerRequest;
173
- /**
174
- * Performs a DELETE.
175
- */
176
- del?: ServerRequest;
177
- /**
178
- * Performs an OPTIONS request.
179
- */
180
- options?: ServerRequest;
181
- /**
182
- * Performs a HEAD request.
183
- */
184
- head?: ServerRequest;
185
- };
186
-
187
- /**
188
- * For _hook.server.
189
- */
190
- type ServerHook = {
191
- /**
192
- * Called on each server request.
193
- */
194
- handle?: ServerLoad;
195
- };
196
-
197
- type ServerLoad = (event: ServerLoadEvent) => Promise<void> | void;
198
-
199
- export { type PageEndPoint, type PageLoadEvent, type PageServerAction, type PageServerEndPoint, type PageServerLoad, Router, type ServerEndPoint, type ServerHook, type ServerLoadEvent, type ServerRequest };
@@ -1 +0,0 @@
1
- {"inputs":{"src/site/pathToRegex.ts":{"bytes":459,"imports":[],"format":"esm"},"src/site/Router.ts":{"bytes":4384,"imports":[{"path":"src/site/pathToRegex.ts","kind":"import-statement","original":"./pathToRegex"}],"format":"esm"},"src/types/RouteType.ts":{"bytes":488,"imports":[],"format":"esm"},"src/site/defaultAdapter.ts":{"bytes":282,"imports":[{"path":"../types/Adapter","kind":"import-statement","external":true}],"format":"esm"},"src/site/Site.ts":{"bytes":5729,"imports":[{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"vite","kind":"import-statement","external":true},{"path":"vite-tsconfig-paths","kind":"import-statement","external":true},{"path":"src/types/RouteType.ts","kind":"import-statement","original":"../types/RouteType"},{"path":"src/site/defaultAdapter.ts","kind":"import-statement","original":"./defaultAdapter"}],"format":"esm"},"src/index.ts":{"bytes":838,"imports":[{"path":"src/site/Router.ts","kind":"import-statement","original":"./site/Router"},{"path":"src/site/Site.ts","kind":"import-statement","original":"./site/Site"}],"format":"esm"},"src/response/response.ts":{"bytes":691,"imports":[],"format":"esm"},"src/response/badRequest.ts":{"bytes":468,"imports":[{"path":"src/response/response.ts","kind":"import-statement","original":"./response"}],"format":"esm"},"src/response/created.ts":{"bytes":384,"imports":[{"path":"src/response/response.ts","kind":"import-statement","original":"./response"}],"format":"esm"},"src/response/forbidden.ts":{"bytes":473,"imports":[{"path":"src/response/response.ts","kind":"import-statement","original":"./response"}],"format":"esm"},"src/response/methodNotAllowed.ts":{"bytes":443,"imports":[{"path":"src/response/response.ts","kind":"import-statement","original":"./response"}],"format":"esm"},"src/response/transfer.ts":{"bytes":264,"imports":[],"format":"esm"},"src/response/moved.ts":{"bytes":613,"imports":[{"path":"src/response/transfer.ts","kind":"import-statement","original":"./transfer"}],"format":"esm"},"src/response/notFound.ts":{"bytes":686,"imports":[{"path":"src/response/response.ts","kind":"import-statement","original":"./response"}],"format":"esm"},"src/response/notModified.ts":{"bytes":419,"imports":[{"path":"src/response/transfer.ts","kind":"import-statement","original":"./transfer"}],"format":"esm"},"src/response/ok.ts":{"bytes":684,"imports":[{"path":"src/response/response.ts","kind":"import-statement","original":"./response"}],"format":"esm"},"src/response/redirect.ts":{"bytes":640,"imports":[{"path":"src/response/transfer.ts","kind":"import-statement","original":"./transfer"}],"format":"esm"},"src/response/seeOther.ts":{"bytes":355,"imports":[{"path":"src/response/transfer.ts","kind":"import-statement","original":"./transfer"}],"format":"esm"},"src/response/serverError.ts":{"bytes":333,"imports":[{"path":"src/response/response.ts","kind":"import-statement","original":"./response"}],"format":"esm"},"src/response/unauthorized.ts":{"bytes":450,"imports":[{"path":"src/response/response.ts","kind":"import-statement","original":"./response"}],"format":"esm"},"src/response/unprocessable.ts":{"bytes":356,"imports":[{"path":"src/response/response.ts","kind":"import-statement","original":"./response"}],"format":"esm"},"src/response.ts":{"bytes":886,"imports":[{"path":"src/response/badRequest.ts","kind":"import-statement","original":"./response/badRequest"},{"path":"src/response/created.ts","kind":"import-statement","original":"./response/created"},{"path":"src/response/forbidden.ts","kind":"import-statement","original":"./response/forbidden"},{"path":"src/response/methodNotAllowed.ts","kind":"import-statement","original":"./response/methodNotAllowed"},{"path":"src/response/moved.ts","kind":"import-statement","original":"./response/moved"},{"path":"src/response/notFound.ts","kind":"import-statement","original":"./response/notFound"},{"path":"src/response/notModified.ts","kind":"import-statement","original":"./response/notModified"},{"path":"src/response/ok.ts","kind":"import-statement","original":"./response/ok"},{"path":"src/response/redirect.ts","kind":"import-statement","original":"./response/redirect"},{"path":"src/response/response.ts","kind":"import-statement","original":"./response/response"},{"path":"src/response/seeOther.ts","kind":"import-statement","original":"./response/seeOther"},{"path":"src/response/serverError.ts","kind":"import-statement","original":"./response/serverError"},{"path":"src/response/transfer.ts","kind":"import-statement","original":"./response/transfer"},{"path":"src/response/unauthorized.ts","kind":"import-statement","original":"./response/unauthorized"},{"path":"src/response/unprocessable.ts","kind":"import-statement","original":"./response/unprocessable"}],"format":"esm"},"src/site/manifest.ts":{"bytes":1553,"imports":[{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"vite","kind":"import-statement","external":true},{"path":"./Site","kind":"import-statement","external":true}],"format":"esm"},"src/site/runBuild.ts":{"bytes":2902,"imports":[{"path":"@torpor/unplugin/vite","kind":"import-statement","external":true},{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"vite","kind":"import-statement","external":true},{"path":"./Site.ts","kind":"import-statement","external":true},{"path":"src/site/manifest.ts","kind":"import-statement","original":"./manifest.ts"}],"format":"esm"},"src/server/CookieHelper.ts":{"bytes":1078,"imports":[{"path":"cookie","kind":"import-statement","external":true}],"format":"esm"},"src/server/HeaderHelper.ts":{"bytes":571,"imports":[],"format":"esm"},"src/server/ServerEvent.ts":{"bytes":974,"imports":[{"path":"src/server/CookieHelper.ts","kind":"import-statement","original":"./CookieHelper"},{"path":"src/server/HeaderHelper.ts","kind":"import-statement","original":"./HeaderHelper"}],"format":"esm"},"src/server/Server.ts":{"bytes":3639,"imports":[{"path":"src/site/pathToRegex.ts","kind":"import-statement","original":"../site/pathToRegex"},{"path":"src/server/ServerEvent.ts","kind":"import-statement","original":"./ServerEvent"}],"format":"esm"},"src/server/connect/bufferToArrayBuffer.ts":{"bytes":260,"imports":[],"format":"esm"},"src/server/connect/flattenHeaders.ts":{"bytes":1017,"imports":[{"path":"node:http","kind":"import-statement","external":true},{"path":"node:http2","kind":"import-statement","external":true}],"format":"esm"},"src/server/connect/nodeMessageToNodeResponse.ts":{"bytes":2363,"imports":[{"path":"http","kind":"import-statement","external":true},{"path":"stream","kind":"import-statement","external":true}],"format":"esm"},"src/server/connect/readableToBuffer.ts":{"bytes":388,"imports":[{"path":"node:stream","kind":"import-statement","external":true}],"format":"esm"},"src/server/connect/requestToNodeMessage.ts":{"bytes":1109,"imports":[{"path":"node:http","kind":"import-statement","external":true},{"path":"stream","kind":"import-statement","external":true}],"format":"esm"},"src/server/connect/connectMiddleware.ts":{"bytes":2733,"imports":[{"path":"node:http","kind":"import-statement","external":true},{"path":"src/server/connect/bufferToArrayBuffer.ts","kind":"import-statement","original":"./bufferToArrayBuffer"},{"path":"src/server/connect/flattenHeaders.ts","kind":"import-statement","original":"./flattenHeaders"},{"path":"src/server/connect/nodeMessageToNodeResponse.ts","kind":"import-statement","original":"./nodeMessageToNodeResponse"},{"path":"src/server/connect/readableToBuffer.ts","kind":"import-statement","original":"./readableToBuffer"},{"path":"src/server/connect/requestToNodeMessage.ts","kind":"import-statement","original":"./requestToNodeMessage"}],"format":"esm"},"src/site/prepareTemplate.ts":{"bytes":1281,"imports":[],"format":"esm"},"src/site/runDev.ts":{"bytes":3655,"imports":[{"path":"@torpor/unplugin/esbuild","kind":"import-statement","external":true},{"path":"@torpor/unplugin/vite","kind":"import-statement","external":true},{"path":"dotenv","kind":"import-statement","external":true},{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"vite","kind":"import-statement","external":true},{"path":"src/response.ts","kind":"import-statement","original":"../response.ts"},{"path":"src/server/Server.ts","kind":"import-statement","original":"../server/Server.ts"},{"path":"src/server/connect/connectMiddleware.ts","kind":"import-statement","original":"../server/connect/connectMiddleware.ts"},{"path":"./Site.ts","kind":"import-statement","external":true},{"path":"src/site/manifest.ts","kind":"import-statement","original":"./manifest.ts"},{"path":"src/site/prepareTemplate.ts","kind":"import-statement","original":"./prepareTemplate.ts"}],"format":"esm"},"src/server/contentType.ts":{"bytes":2679,"imports":[],"format":"esm"},"src/site/runPreview.ts":{"bytes":2833,"imports":[{"path":"dotenv","kind":"import-statement","external":true},{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"src/response.ts","kind":"import-statement","original":"../response.ts"},{"path":"src/server/Server.ts","kind":"import-statement","original":"../server/Server.ts"},{"path":"src/server/contentType.ts","kind":"import-statement","original":"../server/contentType.ts"},{"path":"./Site","kind":"import-statement","external":true},{"path":"src/site/prepareTemplate.ts","kind":"import-statement","original":"./prepareTemplate.ts"},{"path":"src/site/runBuild.ts","kind":"import-statement","original":"./runBuild"}],"format":"esm"},"src/site/run.ts":{"bytes":1695,"imports":[{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"vite","kind":"import-statement","external":true},{"path":"./Site","kind":"import-statement","external":true},{"path":"src/site/runBuild.ts","kind":"import-statement","original":"./runBuild"},{"path":"src/site/runDev.ts","kind":"import-statement","original":"./runDev"},{"path":"src/site/runPreview.ts","kind":"import-statement","original":"./runPreview"}],"format":"esm"},"src/run.ts":{"bytes":197,"imports":[{"path":"src/site/run.ts","kind":"import-statement","original":"./site/run"},{"path":"src/site/runBuild.ts","kind":"import-statement","original":"./site/runBuild"},{"path":"src/site/runDev.ts","kind":"import-statement","original":"./site/runDev"},{"path":"src/site/runPreview.ts","kind":"import-statement","original":"./site/runPreview"}],"format":"esm"},"src/server.ts":{"bytes":334,"imports":[{"path":"src/server/CookieHelper.ts","kind":"import-statement","original":"./server/CookieHelper"},{"path":"src/server/HeaderHelper.ts","kind":"import-statement","original":"./server/HeaderHelper"},{"path":"src/server/Server.ts","kind":"import-statement","original":"./server/Server"},{"path":"src/server/ServerEvent.ts","kind":"import-statement","original":"./server/ServerEvent"},{"path":"src/server/connect/connectMiddleware.ts","kind":"import-statement","original":"./server/connect/connectMiddleware"}],"format":"esm"},"src/state/$page.ts":{"bytes":231,"imports":[{"path":"@torpor/view","kind":"import-statement","external":true},{"path":"./Page","kind":"import-statement","external":true}],"format":"esm"},"src/state.ts":{"bytes":54,"imports":[{"path":"src/state/$page.ts","kind":"import-statement","original":"./state/$page"}],"format":"esm"},"src/test/runTest.ts":{"bytes":9879,"imports":[{"path":"@torpor/view","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"src/response/notFound.ts","kind":"import-statement","original":"../response/notFound.ts"},{"path":"src/response/ok.ts","kind":"import-statement","original":"../response/ok.ts"},{"path":"src/response/seeOther.ts","kind":"import-statement","original":"../response/seeOther.ts"},{"path":"src/server/ServerEvent.ts","kind":"import-statement","original":"../server/ServerEvent.ts"},{"path":"src/site/Router.ts","kind":"import-statement","original":"../site/Router.ts"},{"path":"../site/Site","kind":"import-statement","external":true},{"path":"src/state/$page.ts","kind":"import-statement","original":"../state/$page.ts"},{"path":"../types/RouteHandler.ts","kind":"import-statement","external":true},{"path":"src/types/RouteType.ts","kind":"import-statement","original":"../types/RouteType"}],"format":"esm"},"src/test.ts":{"bytes":59,"imports":[{"path":"src/test/runTest.ts","kind":"import-statement","original":"./test/runTest"}],"format":"esm"},"src/bin/index.ts":{"bytes":351,"imports":[{"path":"src/site/run.ts","kind":"import-statement","original":"../site/run"}],"format":"esm"}},"outputs":{"dist/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":19419},"dist/index.cjs":{"imports":[{"path":"fs","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"vite-tsconfig-paths","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":143},"src/site/pathToRegex.ts":{"bytesInOutput":301},"src/site/Router.ts":{"bytesInOutput":3398},"src/site/Site.ts":{"bytesInOutput":4854},"src/types/RouteType.ts":{"bytesInOutput":188},"src/site/defaultAdapter.ts":{"bytesInOutput":154}},"bytes":10710},"dist/response.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":10490},"dist/response.cjs":{"imports":[],"exports":[],"entryPoint":"src/response.ts","inputs":{"src/response.ts":{"bytesInOutput":560},"src/response/response.ts":{"bytesInOutput":334},"src/response/badRequest.ts":{"bytesInOutput":77},"src/response/created.ts":{"bytesInOutput":57},"src/response/forbidden.ts":{"bytesInOutput":74},"src/response/methodNotAllowed.ts":{"bytesInOutput":90},"src/response/transfer.ts":{"bytesInOutput":124},"src/response/moved.ts":{"bytesInOutput":63},"src/response/notFound.ts":{"bytesInOutput":73},"src/response/notModified.ts":{"bytesInOutput":69},"src/response/ok.ts":{"bytesInOutput":52},"src/response/redirect.ts":{"bytesInOutput":66},"src/response/seeOther.ts":{"bytesInOutput":66},"src/response/serverError.ts":{"bytesInOutput":79},"src/response/unauthorized.ts":{"bytesInOutput":80},"src/response/unprocessable.ts":{"bytesInOutput":82}},"bytes":3502},"dist/run.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":52188},"dist/run.cjs":{"imports":[{"path":"fs","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"vite","kind":"require-call","external":true},{"path":"@torpor/unplugin/vite","kind":"require-call","external":true},{"path":"fs","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"vite","kind":"require-call","external":true},{"path":"fs","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"@torpor/unplugin/esbuild","kind":"require-call","external":true},{"path":"@torpor/unplugin/vite","kind":"require-call","external":true},{"path":"dotenv","kind":"require-call","external":true},{"path":"fs","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"vite","kind":"require-call","external":true},{"path":"cookie","kind":"require-call","external":true},{"path":"http","kind":"require-call","external":true},{"path":"stream","kind":"require-call","external":true},{"path":"stream","kind":"require-call","external":true},{"path":"dotenv","kind":"require-call","external":true},{"path":"fs","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/run.ts","inputs":{"src/run.ts":{"bytesInOutput":195},"src/site/run.ts":{"bytesInOutput":1556},"src/site/runBuild.ts":{"bytesInOutput":2616},"src/site/manifest.ts":{"bytesInOutput":1256},"src/site/runDev.ts":{"bytesInOutput":1960},"src/response/response.ts":{"bytesInOutput":334},"src/response/serverError.ts":{"bytesInOutput":79},"src/site/pathToRegex.ts":{"bytesInOutput":303},"src/server/CookieHelper.ts":{"bytesInOutput":819},"src/server/HeaderHelper.ts":{"bytesInOutput":397},"src/server/ServerEvent.ts":{"bytesInOutput":696},"src/server/Server.ts":{"bytesInOutput":2764},"src/server/connect/bufferToArrayBuffer.ts":{"bytesInOutput":141},"src/server/connect/flattenHeaders.ts":{"bytesInOutput":472},"src/server/connect/nodeMessageToNodeResponse.ts":{"bytesInOutput":1430},"src/server/connect/readableToBuffer.ts":{"bytesInOutput":304},"src/server/connect/requestToNodeMessage.ts":{"bytesInOutput":529},"src/server/connect/connectMiddleware.ts":{"bytesInOutput":1402},"src/site/prepareTemplate.ts":{"bytesInOutput":938},"src/site/runPreview.ts":{"bytesInOutput":2130},"src/server/contentType.ts":{"bytesInOutput":2608}},"bytes":25229},"dist/server.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":23944},"dist/server.cjs":{"imports":[{"path":"cookie","kind":"require-call","external":true},{"path":"http","kind":"require-call","external":true},{"path":"stream","kind":"require-call","external":true},{"path":"stream","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/server.ts","inputs":{"src/server.ts":{"bytesInOutput":278},"src/server/CookieHelper.ts":{"bytesInOutput":819},"src/server/HeaderHelper.ts":{"bytesInOutput":397},"src/site/pathToRegex.ts":{"bytesInOutput":301},"src/server/ServerEvent.ts":{"bytesInOutput":696},"src/server/Server.ts":{"bytesInOutput":2756},"src/server/connect/bufferToArrayBuffer.ts":{"bytesInOutput":141},"src/server/connect/flattenHeaders.ts":{"bytesInOutput":472},"src/server/connect/nodeMessageToNodeResponse.ts":{"bytesInOutput":1430},"src/server/connect/readableToBuffer.ts":{"bytesInOutput":304},"src/server/connect/requestToNodeMessage.ts":{"bytesInOutput":529},"src/server/connect/connectMiddleware.ts":{"bytesInOutput":1402}},"bytes":10928},"dist/state.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":698},"dist/state.cjs":{"imports":[{"path":"@torpor/view","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/state.ts","inputs":{"src/state.ts":{"bytesInOutput":128},"src/state/$page.ts":{"bytesInOutput":230}},"bytes":1296},"dist/test.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":33283},"dist/test.cjs":{"imports":[{"path":"path","kind":"require-call","external":true},{"path":"cookie","kind":"require-call","external":true},{"path":"@torpor/view","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/test.ts","inputs":{"src/test.ts":{"bytesInOutput":122},"src/test/runTest.ts":{"bytesInOutput":6587},"src/response/response.ts":{"bytesInOutput":334},"src/response/notFound.ts":{"bytesInOutput":73},"src/response/ok.ts":{"bytesInOutput":52},"src/response/transfer.ts":{"bytesInOutput":124},"src/response/seeOther.ts":{"bytesInOutput":66},"src/server/CookieHelper.ts":{"bytesInOutput":819},"src/server/HeaderHelper.ts":{"bytesInOutput":397},"src/server/ServerEvent.ts":{"bytesInOutput":696},"src/site/pathToRegex.ts":{"bytesInOutput":303},"src/site/Router.ts":{"bytesInOutput":3423},"src/state/$page.ts":{"bytesInOutput":230},"src/types/RouteType.ts":{"bytesInOutput":167}},"bytes":15286},"dist/bin/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":52645},"dist/bin/index.cjs":{"imports":[{"path":"fs","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"vite","kind":"require-call","external":true},{"path":"@torpor/unplugin/vite","kind":"require-call","external":true},{"path":"fs","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"vite","kind":"require-call","external":true},{"path":"fs","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"@torpor/unplugin/esbuild","kind":"require-call","external":true},{"path":"@torpor/unplugin/vite","kind":"require-call","external":true},{"path":"dotenv","kind":"require-call","external":true},{"path":"fs","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"vite","kind":"require-call","external":true},{"path":"cookie","kind":"require-call","external":true},{"path":"http","kind":"require-call","external":true},{"path":"stream","kind":"require-call","external":true},{"path":"stream","kind":"require-call","external":true},{"path":"dotenv","kind":"require-call","external":true},{"path":"fs","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/bin/index.ts","inputs":{"src/site/run.ts":{"bytesInOutput":1556},"src/site/runBuild.ts":{"bytesInOutput":2616},"src/site/manifest.ts":{"bytesInOutput":1256},"src/site/runDev.ts":{"bytesInOutput":1960},"src/response/response.ts":{"bytesInOutput":334},"src/response/serverError.ts":{"bytesInOutput":79},"src/site/pathToRegex.ts":{"bytesInOutput":303},"src/server/CookieHelper.ts":{"bytesInOutput":819},"src/server/HeaderHelper.ts":{"bytesInOutput":397},"src/server/ServerEvent.ts":{"bytesInOutput":696},"src/server/Server.ts":{"bytesInOutput":2764},"src/server/connect/bufferToArrayBuffer.ts":{"bytesInOutput":141},"src/server/connect/flattenHeaders.ts":{"bytesInOutput":472},"src/server/connect/nodeMessageToNodeResponse.ts":{"bytesInOutput":1430},"src/server/connect/readableToBuffer.ts":{"bytesInOutput":304},"src/server/connect/requestToNodeMessage.ts":{"bytesInOutput":529},"src/server/connect/connectMiddleware.ts":{"bytesInOutput":1402},"src/site/prepareTemplate.ts":{"bytesInOutput":938},"src/site/runPreview.ts":{"bytesInOutput":2130},"src/server/contentType.ts":{"bytesInOutput":2608},"src/bin/index.ts":{"bytesInOutput":309}},"bytes":25017}}}