@torpor/build 0.0.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.
Files changed (71) hide show
  1. package/LICENSE.md +5 -0
  2. package/README.md +55 -0
  3. package/dist/bin/index.cjs +137 -0
  4. package/dist/bin/index.cjs.map +1 -0
  5. package/dist/bin/index.d.cts +1 -0
  6. package/dist/bin/index.d.ts +1 -0
  7. package/dist/bin/index.js +114 -0
  8. package/dist/bin/index.js.map +1 -0
  9. package/dist/index.cjs +55 -0
  10. package/dist/index.cjs.map +1 -0
  11. package/dist/index.d.cts +150 -0
  12. package/dist/index.d.ts +150 -0
  13. package/dist/index.js +27 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/metafile-cjs.json +1 -0
  16. package/dist/metafile-esm.json +1 -0
  17. package/dist/response.cjs +150 -0
  18. package/dist/response.cjs.map +1 -0
  19. package/dist/response.d.cts +162 -0
  20. package/dist/response.d.ts +162 -0
  21. package/dist/response.js +109 -0
  22. package/dist/response.js.map +1 -0
  23. package/dist/state.cjs +41 -0
  24. package/dist/state.cjs.map +1 -0
  25. package/dist/state.d.cts +6 -0
  26. package/dist/state.d.ts +6 -0
  27. package/dist/state.js +14 -0
  28. package/dist/state.js.map +1 -0
  29. package/package.json +49 -0
  30. package/src/bin/index.ts +41 -0
  31. package/src/index.ts +24 -0
  32. package/src/response/badRequest.ts +14 -0
  33. package/src/response/created.ts +13 -0
  34. package/src/response/forbidden.ts +14 -0
  35. package/src/response/methodNotAllowed.ts +14 -0
  36. package/src/response/moved.ts +16 -0
  37. package/src/response/notFound.ts +17 -0
  38. package/src/response/notModified.ts +14 -0
  39. package/src/response/ok.ts +20 -0
  40. package/src/response/redirect.ts +17 -0
  41. package/src/response/response.ts +22 -0
  42. package/src/response/seeOther.ts +13 -0
  43. package/src/response/serverError.ts +10 -0
  44. package/src/response/transfer.ts +14 -0
  45. package/src/response/unauthorized.ts +12 -0
  46. package/src/response/unprocessable.ts +12 -0
  47. package/src/response.ts +33 -0
  48. package/src/site/FileSystemRouter.ts +24 -0
  49. package/src/site/buildRoutePath.ts +25 -0
  50. package/src/site/clientEntry.ts +191 -0
  51. package/src/site/defineConfig.ts +5 -0
  52. package/src/site/defineSite.ts +74 -0
  53. package/src/site/lazyRoute.ts +72 -0
  54. package/src/site/routeHandlers.ts +113 -0
  55. package/src/site/serverEntry.ts +384 -0
  56. package/src/state/$page.ts +11 -0
  57. package/src/state.ts +3 -0
  58. package/src/types/CookieHelper.ts +7 -0
  59. package/src/types/PageEndPoint.ts +37 -0
  60. package/src/types/PageEvent.ts +14 -0
  61. package/src/types/PageServerEndPoint.ts +18 -0
  62. package/src/types/RouteHandler.ts +12 -0
  63. package/src/types/RouteHandlerCollection.ts +7 -0
  64. package/src/types/RouteLayoutHandler.ts +5 -0
  65. package/src/types/RouteMatchResult.ts +7 -0
  66. package/src/types/ServerEndPoint.ts +37 -0
  67. package/src/types/ServerEvent.ts +27 -0
  68. package/src/types/ServerHook.ts +13 -0
  69. package/src/types/UserConfig.ts +3 -0
  70. package/tsconfig.json +4 -0
  71. package/tsup.config.ts +10 -0
@@ -0,0 +1,150 @@
1
+ import { Component } from '@torpor/view';
2
+ import { ServerResponse } from 'node:http';
3
+ import { CookieSerializeOptions } from 'vinxi/http';
4
+
5
+ type ParamsType = Record<PropertyKey, any>;
6
+ declare function buildRoutePath<RP extends ParamsType, UP extends ParamsType>(path: string, routeParams: RP, urlParams?: UP): string;
7
+
8
+ interface UserConfig {
9
+ port?: number;
10
+ }
11
+
12
+ declare function defineConfig(config: UserConfig): UserConfig;
13
+
14
+ interface PageEvent {
15
+ /**
16
+ * The URL for the server function.
17
+ */
18
+ url: URL;
19
+ /**
20
+ * Route params from the URL and route path.
21
+ */
22
+ params: Record<string, string>;
23
+ /**
24
+ * Data that is (optionally) loaded from the load function and passed into the page as $props.data.
25
+ */
26
+ data: Record<string, any>;
27
+ }
28
+
29
+ /**
30
+ * For +page.
31
+ */
32
+ interface PageEndPoint {
33
+ /**
34
+ * Builds the route path for the page in a type-safe manner.
35
+ * TODO: Not sure this is actually the best way to do it...
36
+ */
37
+ route?: (...args: any[]) => string;
38
+ /**
39
+ * Loads data for the page.
40
+ */
41
+ load?: (event: PageEvent) => any;
42
+ /**
43
+ * The component that is displayed for the page.
44
+ */
45
+ component?: Component;
46
+ /**
47
+ * The head element data for the page, which may include a <title> and <meta> elements.
48
+ */
49
+ head?: HeadElement[] | ((event: PageEvent) => HeadElement[]);
50
+ }
51
+ type HeadElement = TitleElement | MetaElement;
52
+ interface TitleElement {
53
+ title: string;
54
+ }
55
+ interface MetaElement {
56
+ name: string;
57
+ content: string;
58
+ }
59
+
60
+ interface CookieHelper {
61
+ get: (name: string) => string | undefined;
62
+ set: (name: string, value: string, options?: CookieSerializeOptions) => void;
63
+ delete: (name: string, options?: CookieSerializeOptions) => void;
64
+ }
65
+
66
+ interface ServerEvent {
67
+ /**
68
+ * The URL for the server function.
69
+ */
70
+ url: URL;
71
+ /**
72
+ * Route params from the URL and route path.
73
+ */
74
+ params: Record<string, string>;
75
+ /**
76
+ * Data that is available to functions in +server hooks, layouts, endpoints
77
+ * and pages. It flows down in that order.
78
+ */
79
+ appData: Record<string, any>;
80
+ request: Request;
81
+ response: ServerResponse;
82
+ /**
83
+ * A helper for getting and setting cookie data.
84
+ */
85
+ cookies: CookieHelper;
86
+ }
87
+
88
+ /**
89
+ * For +page.server.
90
+ */
91
+ interface PageServerEndPoint {
92
+ /**
93
+ * Loads data from the server for a page.
94
+ */
95
+ load?: ServerLoad$1;
96
+ /**
97
+ * A map of actions that can be performed on the server for a page, generally from a form submit.
98
+ */
99
+ actions?: Record<string, ServerAction>;
100
+ }
101
+ type ServerLoad$1 = (event: ServerEvent) => Response | Promise<Response | undefined> | void;
102
+ type ServerAction = (event: ServerEvent) => Response | Promise<Response | undefined> | void;
103
+
104
+ /**
105
+ * For +server.
106
+ */
107
+ interface ServerEndPoint {
108
+ /**
109
+ * Performs a GET.
110
+ */
111
+ get?: ServerRequest;
112
+ /**
113
+ * Perfroms a POST.
114
+ */
115
+ post?: ServerRequest;
116
+ /**
117
+ * Perfroms a PATCH.
118
+ */
119
+ patch?: ServerRequest;
120
+ /**
121
+ * Perfroms a PUT.
122
+ */
123
+ put?: ServerRequest;
124
+ /**
125
+ * Perfroms a DELETE.
126
+ */
127
+ del?: ServerRequest;
128
+ /**
129
+ * Perfroms an OPTIONS request.
130
+ */
131
+ options?: ServerRequest;
132
+ /**
133
+ * Perfroms a HEAD request.
134
+ */
135
+ head?: ServerRequest;
136
+ }
137
+ type ServerRequest = (event: ServerEvent) => Response | Promise<Response | undefined> | void;
138
+
139
+ /**
140
+ * For _hook.server.
141
+ */
142
+ interface ServerHook {
143
+ /**
144
+ * Called on each server request.
145
+ */
146
+ handle?: ServerLoad;
147
+ }
148
+ type ServerLoad = (event: ServerEvent) => Promise<void> | void;
149
+
150
+ export { type PageEndPoint, type PageEvent, type PageServerEndPoint, type ServerEndPoint, type ServerEvent, type ServerHook, type UserConfig, buildRoutePath, defineConfig };
package/dist/index.js ADDED
@@ -0,0 +1,27 @@
1
+ // src/site/buildRoutePath.ts
2
+ function buildRoutePath(path, routeParams, urlParams) {
3
+ for (let [key, value] of Object.entries(routeParams)) {
4
+ path = path.replace(`[${key}]`, value);
5
+ }
6
+ if (urlParams) {
7
+ let params = Object.entries(urlParams).map(([key, value]) => {
8
+ if (value != null) {
9
+ return `${key}=${value}`;
10
+ }
11
+ }).filter(Boolean);
12
+ if (params.length) {
13
+ path += `?${params.join("&")}`;
14
+ }
15
+ }
16
+ return path;
17
+ }
18
+
19
+ // src/site/defineConfig.ts
20
+ function defineConfig(config) {
21
+ return config;
22
+ }
23
+ export {
24
+ buildRoutePath,
25
+ defineConfig
26
+ };
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/site/buildRoutePath.ts","../src/site/defineConfig.ts"],"sourcesContent":["type ParamsType = Record<PropertyKey, any>;\n\nexport default function buildRoutePath<RP extends ParamsType, UP extends ParamsType>(\n\tpath: string,\n\trouteParams: RP,\n\turlParams?: UP,\n) {\n\tfor (let [key, value] of Object.entries(routeParams)) {\n\t\tpath = path.replace(`[${key}]`, value);\n\t}\n\tif (urlParams) {\n\t\t// TODO: More sophisticated url params serialization\n\t\tlet params = Object.entries(urlParams)\n\t\t\t.map(([key, value]) => {\n\t\t\t\tif (value != null) {\n\t\t\t\t\treturn `${key}=${value}`;\n\t\t\t\t}\n\t\t\t})\n\t\t\t.filter(Boolean);\n\t\tif (params.length) {\n\t\t\tpath += `?${params.join(\"&\")}`;\n\t\t}\n\t}\n\treturn path;\n}\n","import type UserConfig from \"../types/UserConfig\";\n\nexport default function defineConfig(config: UserConfig): UserConfig {\n\treturn config;\n}\n"],"mappings":";AAEe,SAAR,eACN,MACA,aACA,WACC;AACD,WAAS,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,WAAW,GAAG;AACrD,WAAO,KAAK,QAAQ,IAAI,GAAG,KAAK,KAAK;AAAA,EACtC;AACA,MAAI,WAAW;AAEd,QAAI,SAAS,OAAO,QAAQ,SAAS,EACnC,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AACtB,UAAI,SAAS,MAAM;AAClB,eAAO,GAAG,GAAG,IAAI,KAAK;AAAA,MACvB;AAAA,IACD,CAAC,EACA,OAAO,OAAO;AAChB,QAAI,OAAO,QAAQ;AAClB,cAAQ,IAAI,OAAO,KAAK,GAAG,CAAC;AAAA,IAC7B;AAAA,EACD;AACA,SAAO;AACR;;;ACtBe,SAAR,aAA8B,QAAgC;AACpE,SAAO;AACR;","names":[]}
@@ -0,0 +1 @@
1
+ {"inputs":{"src/site/buildRoutePath.ts":{"bytes":599,"imports":[],"format":"esm"},"src/site/defineConfig.ts":{"bytes":141,"imports":[],"format":"esm"},"src/index.ts":{"bytes":798,"imports":[{"path":"src/site/buildRoutePath.ts","kind":"import-statement","original":"./site/buildRoutePath"},{"path":"src/site/defineConfig.ts","kind":"import-statement","original":"./site/defineConfig"}],"format":"esm"},"src/response/response.ts":{"bytes":681,"imports":[],"format":"esm"},"src/response/badRequest.ts":{"bytes":451,"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":458,"imports":[{"path":"src/response/response.ts","kind":"import-statement","original":"./response"}],"format":"esm"},"src/response/methodNotAllowed.ts":{"bytes":419,"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":671,"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":292,"imports":[{"path":"src/response/response.ts","kind":"import-statement","original":"./response"}],"format":"esm"},"src/response/unauthorized.ts":{"bytes":409,"imports":[{"path":"src/response/response.ts","kind":"import-statement","original":"./response"}],"format":"esm"},"src/response/unprocessable.ts":{"bytes":337,"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/state/$page.ts":{"bytes":166,"imports":[{"path":"@torpor/view","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/site/FileSystemRouter.ts":{"bytes":605,"imports":[{"path":"vinxi/fs-router","kind":"import-statement","external":true}],"format":"esm"},"src/site/defineSite.ts":{"bytes":1883,"imports":[{"path":"@torpor/unplugin/vite","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"vinxi","kind":"import-statement","external":true},{"path":"vinxi/plugins/config","kind":"import-statement","external":true},{"path":"src/site/FileSystemRouter.ts","kind":"import-statement","original":"./FileSystemRouter"}],"format":"esm"},"src/bin/index.ts":{"bytes":1336,"imports":[{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"src/site/defineSite.ts","kind":"import-statement","original":"../site/defineSite"}],"format":"esm"}},"outputs":{"dist/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":2341},"dist/index.cjs":{"imports":[],"exports":[],"entryPoint":"src/index.ts","inputs":{"src/index.ts":{"bytesInOutput":169},"src/site/buildRoutePath.ts":{"bytesInOutput":431},"src/site/defineConfig.ts":{"bytesInOutput":51}},"bytes":1651},"dist/response.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":10253},"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":60},"src/response/created.ts":{"bytesInOutput":57},"src/response/forbidden.ts":{"bytesInOutput":59},"src/response/methodNotAllowed.ts":{"bytesInOutput":66},"src/response/transfer.ts":{"bytesInOutput":124},"src/response/moved.ts":{"bytesInOutput":63},"src/response/notFound.ts":{"bytesInOutput":58},"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":61},"src/response/unauthorized.ts":{"bytesInOutput":62},"src/response/unprocessable.ts":{"bytesInOutput":63}},"bytes":3376},"dist/state.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":577},"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":192}},"bytes":1258},"dist/bin/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":6462},"dist/bin/index.cjs":{"imports":[{"path":"fs","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"@torpor/unplugin/vite","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"vinxi","kind":"require-call","external":true},{"path":"vinxi/plugins/config","kind":"require-call","external":true},{"path":"vinxi/fs-router","kind":"require-call","external":true}],"exports":[],"entryPoint":"src/bin/index.ts","inputs":{"src/bin/index.ts":{"bytesInOutput":790},"src/site/defineSite.ts":{"bytesInOutput":1959},"src/site/FileSystemRouter.ts":{"bytesInOutput":605}},"bytes":4680}}}
@@ -0,0 +1 @@
1
+ {"inputs":{"src/site/buildRoutePath.ts":{"bytes":599,"imports":[],"format":"esm"},"src/site/defineConfig.ts":{"bytes":141,"imports":[],"format":"esm"},"src/index.ts":{"bytes":798,"imports":[{"path":"src/site/buildRoutePath.ts","kind":"import-statement","original":"./site/buildRoutePath"},{"path":"src/site/defineConfig.ts","kind":"import-statement","original":"./site/defineConfig"}],"format":"esm"},"src/response/response.ts":{"bytes":681,"imports":[],"format":"esm"},"src/response/badRequest.ts":{"bytes":451,"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":458,"imports":[{"path":"src/response/response.ts","kind":"import-statement","original":"./response"}],"format":"esm"},"src/response/methodNotAllowed.ts":{"bytes":419,"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":671,"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":292,"imports":[{"path":"src/response/response.ts","kind":"import-statement","original":"./response"}],"format":"esm"},"src/response/unauthorized.ts":{"bytes":409,"imports":[{"path":"src/response/response.ts","kind":"import-statement","original":"./response"}],"format":"esm"},"src/response/unprocessable.ts":{"bytes":337,"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/state/$page.ts":{"bytes":166,"imports":[{"path":"@torpor/view","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/site/FileSystemRouter.ts":{"bytes":605,"imports":[{"path":"vinxi/fs-router","kind":"import-statement","external":true}],"format":"esm"},"src/site/defineSite.ts":{"bytes":1883,"imports":[{"path":"@torpor/unplugin/vite","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"vinxi","kind":"import-statement","external":true},{"path":"vinxi/plugins/config","kind":"import-statement","external":true},{"path":"src/site/FileSystemRouter.ts","kind":"import-statement","original":"./FileSystemRouter"}],"format":"esm"},"src/bin/index.ts":{"bytes":1336,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"src/site/defineSite.ts","kind":"import-statement","original":"../site/defineSite"}],"format":"esm"}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":1420},"dist/index.js":{"imports":[],"exports":["buildRoutePath","defineConfig"],"entryPoint":"src/index.ts","inputs":{"src/site/buildRoutePath.ts":{"bytesInOutput":431},"src/site/defineConfig.ts":{"bytesInOutput":51},"src/index.ts":{"bytesInOutput":0}},"bytes":586},"dist/response.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":9147},"dist/response.js":{"imports":[],"exports":["badRequest","created","forbidden","methodNotAllowed","moved","notFound","notModified","ok","redirect","response","seeOther","serverError","transfer","unauthorized","unprocessable"],"entryPoint":"src/response.ts","inputs":{"src/response/response.ts":{"bytesInOutput":334},"src/response/badRequest.ts":{"bytesInOutput":60},"src/response/created.ts":{"bytesInOutput":57},"src/response/forbidden.ts":{"bytesInOutput":59},"src/response/methodNotAllowed.ts":{"bytesInOutput":66},"src/response/transfer.ts":{"bytesInOutput":124},"src/response/moved.ts":{"bytesInOutput":63},"src/response/notFound.ts":{"bytesInOutput":58},"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":61},"src/response/unauthorized.ts":{"bytesInOutput":62},"src/response/unprocessable.ts":{"bytesInOutput":63},"src/response.ts":{"bytesInOutput":0}},"bytes":1917},"dist/state.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":452},"dist/state.js":{"imports":[{"path":"@torpor/view","kind":"import-statement","external":true}],"exports":["$page"],"entryPoint":"src/state.ts","inputs":{"src/state/$page.ts":{"bytesInOutput":171},"src/state.ts":{"bytesInOutput":0}},"bytes":229},"dist/bin/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":6381},"dist/bin/index.js":{"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"@torpor/unplugin/vite","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"vinxi","kind":"import-statement","external":true},{"path":"vinxi/plugins/config","kind":"import-statement","external":true},{"path":"vinxi/fs-router","kind":"import-statement","external":true}],"exports":[],"entryPoint":"src/bin/index.ts","inputs":{"src/bin/index.ts":{"bytesInOutput":656},"src/site/defineSite.ts":{"bytesInOutput":1787},"src/site/FileSystemRouter.ts":{"bytesInOutput":582}},"bytes":3175}}}
@@ -0,0 +1,150 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/response.ts
21
+ var response_exports = {};
22
+ __export(response_exports, {
23
+ badRequest: () => badRequest,
24
+ created: () => created,
25
+ forbidden: () => forbidden,
26
+ methodNotAllowed: () => methodNotAllowed,
27
+ moved: () => moved,
28
+ notFound: () => notFound,
29
+ notModified: () => notModified,
30
+ ok: () => ok,
31
+ redirect: () => redirect,
32
+ response: () => response,
33
+ seeOther: () => seeOther,
34
+ serverError: () => serverError,
35
+ transfer: () => transfer,
36
+ unauthorized: () => unauthorized,
37
+ unprocessable: () => unprocessable
38
+ });
39
+ module.exports = __toCommonJS(response_exports);
40
+
41
+ // src/response/response.ts
42
+ function response(status, body) {
43
+ let headers = void 0;
44
+ if (body) {
45
+ if (typeof body === "object") {
46
+ headers = { "content-type": "application/json" };
47
+ body = JSON.stringify(body);
48
+ } else {
49
+ headers = { "content-type": "text/plain" };
50
+ }
51
+ }
52
+ return new Response(body, {
53
+ status,
54
+ headers
55
+ });
56
+ }
57
+
58
+ // src/response/badRequest.ts
59
+ function badRequest(body) {
60
+ return response(400, body);
61
+ }
62
+
63
+ // src/response/created.ts
64
+ function created(body) {
65
+ return response(201, body);
66
+ }
67
+
68
+ // src/response/forbidden.ts
69
+ function forbidden(body) {
70
+ return response(403, body);
71
+ }
72
+
73
+ // src/response/methodNotAllowed.ts
74
+ function methodNotAllowed(body) {
75
+ return response(405, body);
76
+ }
77
+
78
+ // src/response/transfer.ts
79
+ function transfer(status, location) {
80
+ return new Response(null, {
81
+ status,
82
+ headers: {
83
+ location
84
+ }
85
+ });
86
+ }
87
+
88
+ // src/response/moved.ts
89
+ function moved(location) {
90
+ return transfer(308, location);
91
+ }
92
+
93
+ // src/response/notFound.ts
94
+ function notFound(body) {
95
+ return response(404, body);
96
+ }
97
+
98
+ // src/response/notModified.ts
99
+ function notModified(location) {
100
+ return transfer(304, location);
101
+ }
102
+
103
+ // src/response/ok.ts
104
+ function ok(body) {
105
+ return response(200, body);
106
+ }
107
+
108
+ // src/response/redirect.ts
109
+ function redirect(location) {
110
+ return transfer(307, location);
111
+ }
112
+
113
+ // src/response/seeOther.ts
114
+ function seeOther(location) {
115
+ return transfer(303, location);
116
+ }
117
+
118
+ // src/response/serverError.ts
119
+ function serverError(body) {
120
+ return response(500, body);
121
+ }
122
+
123
+ // src/response/unauthorized.ts
124
+ function unauthorized(body) {
125
+ return response(401, body);
126
+ }
127
+
128
+ // src/response/unprocessable.ts
129
+ function unprocessable(body) {
130
+ return response(422, body);
131
+ }
132
+ // Annotate the CommonJS export names for ESM import in node:
133
+ 0 && (module.exports = {
134
+ badRequest,
135
+ created,
136
+ forbidden,
137
+ methodNotAllowed,
138
+ moved,
139
+ notFound,
140
+ notModified,
141
+ ok,
142
+ redirect,
143
+ response,
144
+ seeOther,
145
+ serverError,
146
+ transfer,
147
+ unauthorized,
148
+ unprocessable
149
+ });
150
+ //# sourceMappingURL=response.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/response.ts","../src/response/response.ts","../src/response/badRequest.ts","../src/response/created.ts","../src/response/forbidden.ts","../src/response/methodNotAllowed.ts","../src/response/transfer.ts","../src/response/moved.ts","../src/response/notFound.ts","../src/response/notModified.ts","../src/response/ok.ts","../src/response/redirect.ts","../src/response/seeOther.ts","../src/response/serverError.ts","../src/response/unauthorized.ts","../src/response/unprocessable.ts"],"sourcesContent":["import badRequest from \"./response/badRequest\";\nimport created from \"./response/created\";\nimport forbidden from \"./response/forbidden\";\nimport methodNotAllowed from \"./response/methodNotAllowed\";\nimport moved from \"./response/moved\";\nimport notFound from \"./response/notFound\";\nimport notModified from \"./response/notModified\";\nimport ok from \"./response/ok\";\nimport redirect from \"./response/redirect\";\nimport response from \"./response/response\";\nimport seeOther from \"./response/seeOther\";\nimport serverError from \"./response/serverError\";\nimport transfer from \"./response/transfer\";\nimport unauthorized from \"./response/unauthorized\";\nimport unprocessable from \"./response/unprocessable\";\n\nexport {\n\tresponse,\n\tok,\n\tcreated,\n\ttransfer,\n\tseeOther,\n\tnotModified,\n\tredirect,\n\tmoved,\n\tbadRequest,\n\tunauthorized,\n\tforbidden,\n\tnotFound,\n\tmethodNotAllowed,\n\tunprocessable,\n\tserverError,\n};\n","/**\n * Creates a response with the supplied status code and optional body.\n *\n * If the body is an object, it will be converted to JSON and the content-type\n * header set to \"application/json\". Otherwise, if the body is a string, the\n * content-type header will be set to \"text/plain\".\n */\nexport default function response(status: number, body?: object | string) {\n\tlet headers: Record<string, string> | undefined = undefined;\n\tif (body) {\n\t\tif (typeof body === \"object\") {\n\t\t\theaders = { \"content-type\": \"application/json\" };\n\t\t\tbody = JSON.stringify(body);\n\t\t} else {\n\t\t\theaders = { \"content-type\": \"text/plain\" };\n\t\t}\n\t}\n\treturn new Response(body, {\n\t\tstatus,\n\t\theaders,\n\t});\n}\n","import response from \"./response\";\n\n/**\n * 400 Bad Request\n *\n * The server cannot or will not process the request due to something that is\n * perceived to be a client error (e.g., malformed request syntax, invalid\n * request message framing, or deceptive request routing).\n *\n * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400\n */\nexport default function badRequest(body?: object | string): Response {\n\treturn response(400, body);\n}\n","import response from \"./response\";\n\n/**\n * 201 Created\n *\n * The request succeeded, and a new resource was created as a result. This is\n * typically the response sent after POST requests, or some PUT requests.\n *\n * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201\n */\nexport default function created(body?: object | string): Response {\n\treturn response(201, body);\n}\n","import response from \"./response\";\n\n/**\n * 403 Forbidden\n *\n * The client does not have access rights to the content; that is, it is\n * unauthorized, so the server is refusing to give the requested resource.\n * Unlike 401 Unauthorized, the client's identity is known to the server.\n *\n * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403\n */\nexport default function forbidden(body?: object | string): Response {\n\treturn response(403, body);\n}\n","import response from \"./response\";\n\n/**\n * 405 Method Not Allowed\n *\n * The request method is known by the server but is not supported by the target\n * resource. For example, an API may not allow calling DELETE to remove a\n * resource.\n *\n * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405\n */\nexport default function methodNotAllowed(body?: object | string): Response {\n\treturn response(405, body);\n}\n","/**\n * Creates a redirect response with the supplied status code.\n */\nexport default function transfer(\n\tstatus: 300 | 301 | 302 | 303 | 304 | 307 | 308,\n\tlocation: string,\n): Response {\n\treturn new Response(null, {\n\t\tstatus,\n\t\theaders: {\n\t\t\tlocation,\n\t\t},\n\t});\n}\n","import transfer from \"./transfer\";\n\n/**\n * 308 Permanent Redirect\n *\n * This means that the resource is now permanently located at another URI,\n * specified by the Location: HTTP Response header. This has the same semantics\n * as the 301 Moved Permanently HTTP response code, with the exception that the\n * user agent must not change the HTTP method used: if a POST was used in the\n * first request, a POST must be used in the second request.\n *\n * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/308\n */\nexport default function moved(location: string): Response {\n\treturn transfer(308, location);\n}\n","import response from \"./response\";\n\n/**\n * 404 Not Found\n *\n * The server cannot find the requested resource. In the browser, this means the\n * URL is not recognized. In an API, this can also mean that the endpoint is\n * valid but the resource itself does not exist. Servers may also send this\n * response instead of 403 Forbidden to hide the existence of a resource from an\n * unauthorized client. This response code is probably the most well known due\n * to its frequent occurrence on the web.\n *\n * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404\n */\nexport default function notFound(body?: object | string): Response {\n\treturn response(404, body);\n}\n","import transfer from \"./transfer\";\n\n/**\n * 304 Not Modified\n *\n * This is used for caching purposes. It tells the client that the response has\n * not been modified, so the client can continue to use the same cached version\n * of the response.\n *\n * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/304\n */\nexport default function notModified(location: string): Response {\n\treturn transfer(304, location);\n}\n","import response from \"./response\";\n\n/**\n * 200 OK\n *\n * The request succeeded. The result meaning of \"success\" depends on the HTTP\n * method:\n * - GET: The resource has been fetched and transmitted in the message body.\n * - HEAD: The representation headers are included in the response without any\n * message body.\n * - PUT or POST: The resource describing the result of the action is\n * transmitted in the message body.\n * - TRACE: The message body contains the request message as received by the\n * server.\n *\n * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200\n */\nexport default function ok(body?: object | string): Response {\n\treturn response(200, body);\n}\n","import transfer from \"./transfer\";\n\n/**\n * 307 Temporary Redirect\n *\n * The server sends this response to direct the client to get the requested\n * resource at another URI with the same method that was used in the prior\n * request. This has the same semantics as the 302 Found HTTP response code,\n * with the exception that the user agent must not change the HTTP method used:\n * if a POST was used in the first request, a POST must be used in the second\n * request.\n *\n * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/307\n */\nexport default function redirect(location: string): Response {\n\treturn transfer(307, location);\n}\n","import transfer from \"./transfer\";\n\n/**\n * 303 See Other\n *\n * The server sent this response to direct the client to get the requested\n * resource at another URI with a GET request.\n *\n * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/303\n */\nexport default function seeOther(location: string): Response {\n\treturn transfer(303, location);\n}\n","import response from \"./response\";\n\n/**\n * The server has encountered a situation it does not know how to handle.\n *\n * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500\n */\nexport default function serverError(body?: object | string): Response {\n\treturn response(500, body);\n}\n","import response from \"./response\";\n\n/**\n * Although the HTTP standard specifies \"unauthorized\", semantically this\n * response means \"unauthenticated\". That is, the client must authenticate\n * itself to get the requested response.\n *\n * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401\n */\nexport default function unauthorized(body?: object | string): Response {\n\treturn response(401, body);\n}\n","import response from \"./response\";\n\n/**\n * 422 Unprocessable Content\n *\n * The request was well-formed but was unable to be followed due to semantic errors.\n *\n * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422\n */\nexport default function unprocessable(body?: object | string): Response {\n\treturn response(422, body);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACOe,SAAR,SAA0B,QAAgB,MAAwB;AACxE,MAAI,UAA8C;AAClD,MAAI,MAAM;AACT,QAAI,OAAO,SAAS,UAAU;AAC7B,gBAAU,EAAE,gBAAgB,mBAAmB;AAC/C,aAAO,KAAK,UAAU,IAAI;AAAA,IAC3B,OAAO;AACN,gBAAU,EAAE,gBAAgB,aAAa;AAAA,IAC1C;AAAA,EACD;AACA,SAAO,IAAI,SAAS,MAAM;AAAA,IACzB;AAAA,IACA;AAAA,EACD,CAAC;AACF;;;ACVe,SAAR,WAA4B,MAAkC;AACpE,SAAO,SAAS,KAAK,IAAI;AAC1B;;;ACHe,SAAR,QAAyB,MAAkC;AACjE,SAAO,SAAS,KAAK,IAAI;AAC1B;;;ACDe,SAAR,UAA2B,MAAkC;AACnE,SAAO,SAAS,KAAK,IAAI;AAC1B;;;ACFe,SAAR,iBAAkC,MAAkC;AAC1E,SAAO,SAAS,KAAK,IAAI;AAC1B;;;ACVe,SAAR,SACN,QACA,UACW;AACX,SAAO,IAAI,SAAS,MAAM;AAAA,IACzB;AAAA,IACA,SAAS;AAAA,MACR;AAAA,IACD;AAAA,EACD,CAAC;AACF;;;ACAe,SAAR,MAAuB,UAA4B;AACzD,SAAO,SAAS,KAAK,QAAQ;AAC9B;;;ACDe,SAAR,SAA0B,MAAkC;AAClE,SAAO,SAAS,KAAK,IAAI;AAC1B;;;ACLe,SAAR,YAA6B,UAA4B;AAC/D,SAAO,SAAS,KAAK,QAAQ;AAC9B;;;ACIe,SAAR,GAAoB,MAAkC;AAC5D,SAAO,SAAS,KAAK,IAAI;AAC1B;;;ACLe,SAAR,SAA0B,UAA4B;AAC5D,SAAO,SAAS,KAAK,QAAQ;AAC9B;;;ACNe,SAAR,SAA0B,UAA4B;AAC5D,SAAO,SAAS,KAAK,QAAQ;AAC9B;;;ACLe,SAAR,YAA6B,MAAkC;AACrE,SAAO,SAAS,KAAK,IAAI;AAC1B;;;ACAe,SAAR,aAA8B,MAAkC;AACtE,SAAO,SAAS,KAAK,IAAI;AAC1B;;;ACFe,SAAR,cAA+B,MAAkC;AACvE,SAAO,SAAS,KAAK,IAAI;AAC1B;","names":[]}
@@ -0,0 +1,162 @@
1
+ /**
2
+ * 400 Bad Request
3
+ *
4
+ * The server cannot or will not process the request due to something that is
5
+ * perceived to be a client error (e.g., malformed request syntax, invalid
6
+ * request message framing, or deceptive request routing).
7
+ *
8
+ * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400
9
+ */
10
+ declare function badRequest(body?: object | string): Response;
11
+
12
+ /**
13
+ * 201 Created
14
+ *
15
+ * The request succeeded, and a new resource was created as a result. This is
16
+ * typically the response sent after POST requests, or some PUT requests.
17
+ *
18
+ * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201
19
+ */
20
+ declare function created(body?: object | string): Response;
21
+
22
+ /**
23
+ * 403 Forbidden
24
+ *
25
+ * The client does not have access rights to the content; that is, it is
26
+ * unauthorized, so the server is refusing to give the requested resource.
27
+ * Unlike 401 Unauthorized, the client's identity is known to the server.
28
+ *
29
+ * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403
30
+ */
31
+ declare function forbidden(body?: object | string): Response;
32
+
33
+ /**
34
+ * 405 Method Not Allowed
35
+ *
36
+ * The request method is known by the server but is not supported by the target
37
+ * resource. For example, an API may not allow calling DELETE to remove a
38
+ * resource.
39
+ *
40
+ * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405
41
+ */
42
+ declare function methodNotAllowed(body?: object | string): Response;
43
+
44
+ /**
45
+ * 308 Permanent Redirect
46
+ *
47
+ * This means that the resource is now permanently located at another URI,
48
+ * specified by the Location: HTTP Response header. This has the same semantics
49
+ * as the 301 Moved Permanently HTTP response code, with the exception that the
50
+ * user agent must not change the HTTP method used: if a POST was used in the
51
+ * first request, a POST must be used in the second request.
52
+ *
53
+ * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/308
54
+ */
55
+ declare function moved(location: string): Response;
56
+
57
+ /**
58
+ * 404 Not Found
59
+ *
60
+ * The server cannot find the requested resource. In the browser, this means the
61
+ * URL is not recognized. In an API, this can also mean that the endpoint is
62
+ * valid but the resource itself does not exist. Servers may also send this
63
+ * response instead of 403 Forbidden to hide the existence of a resource from an
64
+ * unauthorized client. This response code is probably the most well known due
65
+ * to its frequent occurrence on the web.
66
+ *
67
+ * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404
68
+ */
69
+ declare function notFound(body?: object | string): Response;
70
+
71
+ /**
72
+ * 304 Not Modified
73
+ *
74
+ * This is used for caching purposes. It tells the client that the response has
75
+ * not been modified, so the client can continue to use the same cached version
76
+ * of the response.
77
+ *
78
+ * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/304
79
+ */
80
+ declare function notModified(location: string): Response;
81
+
82
+ /**
83
+ * 200 OK
84
+ *
85
+ * The request succeeded. The result meaning of "success" depends on the HTTP
86
+ * method:
87
+ * - GET: The resource has been fetched and transmitted in the message body.
88
+ * - HEAD: The representation headers are included in the response without any
89
+ * message body.
90
+ * - PUT or POST: The resource describing the result of the action is
91
+ * transmitted in the message body.
92
+ * - TRACE: The message body contains the request message as received by the
93
+ * server.
94
+ *
95
+ * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200
96
+ */
97
+ declare function ok(body?: object | string): Response;
98
+
99
+ /**
100
+ * 307 Temporary Redirect
101
+ *
102
+ * The server sends this response to direct the client to get the requested
103
+ * resource at another URI with the same method that was used in the prior
104
+ * request. This has the same semantics as the 302 Found HTTP response code,
105
+ * with the exception that the user agent must not change the HTTP method used:
106
+ * if a POST was used in the first request, a POST must be used in the second
107
+ * request.
108
+ *
109
+ * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/307
110
+ */
111
+ declare function redirect(location: string): Response;
112
+
113
+ /**
114
+ * Creates a response with the supplied status code and optional body.
115
+ *
116
+ * If the body is an object, it will be converted to JSON and the content-type
117
+ * header set to "application/json". Otherwise, if the body is a string, the
118
+ * content-type header will be set to "text/plain".
119
+ */
120
+ declare function response(status: number, body?: object | string): Response;
121
+
122
+ /**
123
+ * 303 See Other
124
+ *
125
+ * The server sent this response to direct the client to get the requested
126
+ * resource at another URI with a GET request.
127
+ *
128
+ * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/303
129
+ */
130
+ declare function seeOther(location: string): Response;
131
+
132
+ /**
133
+ * The server has encountered a situation it does not know how to handle.
134
+ *
135
+ * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500
136
+ */
137
+ declare function serverError(body?: object | string): Response;
138
+
139
+ /**
140
+ * Creates a redirect response with the supplied status code.
141
+ */
142
+ declare function transfer(status: 300 | 301 | 302 | 303 | 304 | 307 | 308, location: string): Response;
143
+
144
+ /**
145
+ * Although the HTTP standard specifies "unauthorized", semantically this
146
+ * response means "unauthenticated". That is, the client must authenticate
147
+ * itself to get the requested response.
148
+ *
149
+ * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401
150
+ */
151
+ declare function unauthorized(body?: object | string): Response;
152
+
153
+ /**
154
+ * 422 Unprocessable Content
155
+ *
156
+ * The request was well-formed but was unable to be followed due to semantic errors.
157
+ *
158
+ * See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422
159
+ */
160
+ declare function unprocessable(body?: object | string): Response;
161
+
162
+ export { badRequest, created, forbidden, methodNotAllowed, moved, notFound, notModified, ok, redirect, response, seeOther, serverError, transfer, unauthorized, unprocessable };