@torpor/build 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +5 -2
- package/dist/bin/index.cjs +16 -15
- package/dist/bin/index.cjs.map +1 -1
- package/dist/bin/index.js +6 -93
- package/dist/bin/index.js.map +1 -1
- package/dist/chunk-L7GOYKUG.js +93 -0
- package/dist/chunk-L7GOYKUG.js.map +1 -0
- package/dist/index.cjs +103 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -17
- package/dist/index.d.ts +20 -17
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/dist/response.cjs.map +1 -1
- package/dist/response.d.cts +4 -0
- package/dist/response.d.ts +4 -0
- package/dist/response.js.map +1 -1
- package/package.json +10 -7
- package/src/bin/index.ts +4 -3
- package/src/index.ts +7 -7
- package/src/response/serverError.ts +2 -0
- package/src/response/unauthorized.ts +2 -0
- package/src/site/FileSystemRouter.ts +1 -0
- package/src/site/clientEntry.ts +3 -3
- package/src/site/defineConfig.ts +73 -3
- package/src/site/routeHandlers.ts +8 -6
- package/src/site/serverEntry.ts +10 -10
- package/src/types/CookieHelper.ts +3 -3
- package/src/types/PageEndPoint.ts +4 -4
- package/src/types/PageEvent.ts +2 -2
- package/src/types/PageServerEndPoint.ts +3 -3
- package/src/types/RouteHandler.ts +3 -3
- package/src/types/RouteHandlerCollection.ts +4 -4
- package/src/types/RouteLayoutHandler.ts +2 -2
- package/src/types/RouteMatchResult.ts +3 -3
- package/src/types/ServerEndPoint.ts +3 -3
- package/src/types/ServerEvent.ts +3 -3
- package/src/types/ServerHook.ts +3 -3
- package/src/types/UserConfig.ts +2 -2
- package/src/vite-env.d.ts +2 -0
- package/tsconfig.json +7 -2
- package/src/site/defineSite.ts +0 -74
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as vinxi from 'vinxi';
|
|
1
2
|
import { Component } from '@torpor/view';
|
|
2
3
|
import { ServerResponse } from 'node:http';
|
|
3
4
|
import { CookieSerializeOptions } from 'vinxi/http';
|
|
@@ -5,13 +6,13 @@ import { CookieSerializeOptions } from 'vinxi/http';
|
|
|
5
6
|
type ParamsType = Record<PropertyKey, any>;
|
|
6
7
|
declare function buildRoutePath<RP extends ParamsType, UP extends ParamsType>(path: string, routeParams: RP, urlParams?: UP): string;
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
type UserConfig = {
|
|
9
10
|
port?: number;
|
|
10
|
-
}
|
|
11
|
+
};
|
|
11
12
|
|
|
12
|
-
declare function defineConfig(
|
|
13
|
+
declare function defineConfig(options?: UserConfig): vinxi.App;
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
type PageEvent = {
|
|
15
16
|
/**
|
|
16
17
|
* The URL for the server function.
|
|
17
18
|
*/
|
|
@@ -24,12 +25,12 @@ interface PageEvent {
|
|
|
24
25
|
* Data that is (optionally) loaded from the load function and passed into the page as $props.data.
|
|
25
26
|
*/
|
|
26
27
|
data: Record<string, any>;
|
|
27
|
-
}
|
|
28
|
+
};
|
|
28
29
|
|
|
29
30
|
/**
|
|
30
31
|
* For +page.
|
|
31
32
|
*/
|
|
32
|
-
|
|
33
|
+
type PageEndPoint = {
|
|
33
34
|
/**
|
|
34
35
|
* Builds the route path for the page in a type-safe manner.
|
|
35
36
|
* TODO: Not sure this is actually the best way to do it...
|
|
@@ -47,7 +48,7 @@ interface PageEndPoint {
|
|
|
47
48
|
* The head element data for the page, which may include a <title> and <meta> elements.
|
|
48
49
|
*/
|
|
49
50
|
head?: HeadElement[] | ((event: PageEvent) => HeadElement[]);
|
|
50
|
-
}
|
|
51
|
+
};
|
|
51
52
|
type HeadElement = TitleElement | MetaElement;
|
|
52
53
|
interface TitleElement {
|
|
53
54
|
title: string;
|
|
@@ -57,13 +58,13 @@ interface MetaElement {
|
|
|
57
58
|
content: string;
|
|
58
59
|
}
|
|
59
60
|
|
|
60
|
-
|
|
61
|
+
type CookieHelper = {
|
|
61
62
|
get: (name: string) => string | undefined;
|
|
62
63
|
set: (name: string, value: string, options?: CookieSerializeOptions) => void;
|
|
63
64
|
delete: (name: string, options?: CookieSerializeOptions) => void;
|
|
64
|
-
}
|
|
65
|
+
};
|
|
65
66
|
|
|
66
|
-
|
|
67
|
+
type ServerEvent = {
|
|
67
68
|
/**
|
|
68
69
|
* The URL for the server function.
|
|
69
70
|
*/
|
|
@@ -83,12 +84,12 @@ interface ServerEvent {
|
|
|
83
84
|
* A helper for getting and setting cookie data.
|
|
84
85
|
*/
|
|
85
86
|
cookies: CookieHelper;
|
|
86
|
-
}
|
|
87
|
+
};
|
|
87
88
|
|
|
88
89
|
/**
|
|
89
90
|
* For +page.server.
|
|
90
91
|
*/
|
|
91
|
-
|
|
92
|
+
type PageServerEndPoint = {
|
|
92
93
|
/**
|
|
93
94
|
* Loads data from the server for a page.
|
|
94
95
|
*/
|
|
@@ -97,14 +98,16 @@ interface PageServerEndPoint {
|
|
|
97
98
|
* A map of actions that can be performed on the server for a page, generally from a form submit.
|
|
98
99
|
*/
|
|
99
100
|
actions?: Record<string, ServerAction>;
|
|
100
|
-
}
|
|
101
|
+
};
|
|
101
102
|
type ServerLoad$1 = (event: ServerEvent) => Response | Promise<Response | undefined> | void;
|
|
102
103
|
type ServerAction = (event: ServerEvent) => Response | Promise<Response | undefined> | void;
|
|
103
104
|
|
|
104
105
|
/**
|
|
105
106
|
* For +server.
|
|
106
107
|
*/
|
|
107
|
-
|
|
108
|
+
type ServerEndPoint = {
|
|
109
|
+
[key: string]: ServerRequest;
|
|
110
|
+
} & {
|
|
108
111
|
/**
|
|
109
112
|
* Performs a GET.
|
|
110
113
|
*/
|
|
@@ -133,18 +136,18 @@ interface ServerEndPoint {
|
|
|
133
136
|
* Perfroms a HEAD request.
|
|
134
137
|
*/
|
|
135
138
|
head?: ServerRequest;
|
|
136
|
-
}
|
|
139
|
+
};
|
|
137
140
|
type ServerRequest = (event: ServerEvent) => Response | Promise<Response | undefined> | void;
|
|
138
141
|
|
|
139
142
|
/**
|
|
140
143
|
* For _hook.server.
|
|
141
144
|
*/
|
|
142
|
-
|
|
145
|
+
type ServerHook = {
|
|
143
146
|
/**
|
|
144
147
|
* Called on each server request.
|
|
145
148
|
*/
|
|
146
149
|
handle?: ServerLoad;
|
|
147
|
-
}
|
|
150
|
+
};
|
|
148
151
|
type ServerLoad = (event: ServerEvent) => Promise<void> | void;
|
|
149
152
|
|
|
150
153
|
export { type PageEndPoint, type PageEvent, type PageServerEndPoint, type ServerEndPoint, type ServerEvent, type ServerHook, type UserConfig, buildRoutePath, defineConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as vinxi from 'vinxi';
|
|
1
2
|
import { Component } from '@torpor/view';
|
|
2
3
|
import { ServerResponse } from 'node:http';
|
|
3
4
|
import { CookieSerializeOptions } from 'vinxi/http';
|
|
@@ -5,13 +6,13 @@ import { CookieSerializeOptions } from 'vinxi/http';
|
|
|
5
6
|
type ParamsType = Record<PropertyKey, any>;
|
|
6
7
|
declare function buildRoutePath<RP extends ParamsType, UP extends ParamsType>(path: string, routeParams: RP, urlParams?: UP): string;
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
type UserConfig = {
|
|
9
10
|
port?: number;
|
|
10
|
-
}
|
|
11
|
+
};
|
|
11
12
|
|
|
12
|
-
declare function defineConfig(
|
|
13
|
+
declare function defineConfig(options?: UserConfig): vinxi.App;
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
type PageEvent = {
|
|
15
16
|
/**
|
|
16
17
|
* The URL for the server function.
|
|
17
18
|
*/
|
|
@@ -24,12 +25,12 @@ interface PageEvent {
|
|
|
24
25
|
* Data that is (optionally) loaded from the load function and passed into the page as $props.data.
|
|
25
26
|
*/
|
|
26
27
|
data: Record<string, any>;
|
|
27
|
-
}
|
|
28
|
+
};
|
|
28
29
|
|
|
29
30
|
/**
|
|
30
31
|
* For +page.
|
|
31
32
|
*/
|
|
32
|
-
|
|
33
|
+
type PageEndPoint = {
|
|
33
34
|
/**
|
|
34
35
|
* Builds the route path for the page in a type-safe manner.
|
|
35
36
|
* TODO: Not sure this is actually the best way to do it...
|
|
@@ -47,7 +48,7 @@ interface PageEndPoint {
|
|
|
47
48
|
* The head element data for the page, which may include a <title> and <meta> elements.
|
|
48
49
|
*/
|
|
49
50
|
head?: HeadElement[] | ((event: PageEvent) => HeadElement[]);
|
|
50
|
-
}
|
|
51
|
+
};
|
|
51
52
|
type HeadElement = TitleElement | MetaElement;
|
|
52
53
|
interface TitleElement {
|
|
53
54
|
title: string;
|
|
@@ -57,13 +58,13 @@ interface MetaElement {
|
|
|
57
58
|
content: string;
|
|
58
59
|
}
|
|
59
60
|
|
|
60
|
-
|
|
61
|
+
type CookieHelper = {
|
|
61
62
|
get: (name: string) => string | undefined;
|
|
62
63
|
set: (name: string, value: string, options?: CookieSerializeOptions) => void;
|
|
63
64
|
delete: (name: string, options?: CookieSerializeOptions) => void;
|
|
64
|
-
}
|
|
65
|
+
};
|
|
65
66
|
|
|
66
|
-
|
|
67
|
+
type ServerEvent = {
|
|
67
68
|
/**
|
|
68
69
|
* The URL for the server function.
|
|
69
70
|
*/
|
|
@@ -83,12 +84,12 @@ interface ServerEvent {
|
|
|
83
84
|
* A helper for getting and setting cookie data.
|
|
84
85
|
*/
|
|
85
86
|
cookies: CookieHelper;
|
|
86
|
-
}
|
|
87
|
+
};
|
|
87
88
|
|
|
88
89
|
/**
|
|
89
90
|
* For +page.server.
|
|
90
91
|
*/
|
|
91
|
-
|
|
92
|
+
type PageServerEndPoint = {
|
|
92
93
|
/**
|
|
93
94
|
* Loads data from the server for a page.
|
|
94
95
|
*/
|
|
@@ -97,14 +98,16 @@ interface PageServerEndPoint {
|
|
|
97
98
|
* A map of actions that can be performed on the server for a page, generally from a form submit.
|
|
98
99
|
*/
|
|
99
100
|
actions?: Record<string, ServerAction>;
|
|
100
|
-
}
|
|
101
|
+
};
|
|
101
102
|
type ServerLoad$1 = (event: ServerEvent) => Response | Promise<Response | undefined> | void;
|
|
102
103
|
type ServerAction = (event: ServerEvent) => Response | Promise<Response | undefined> | void;
|
|
103
104
|
|
|
104
105
|
/**
|
|
105
106
|
* For +server.
|
|
106
107
|
*/
|
|
107
|
-
|
|
108
|
+
type ServerEndPoint = {
|
|
109
|
+
[key: string]: ServerRequest;
|
|
110
|
+
} & {
|
|
108
111
|
/**
|
|
109
112
|
* Performs a GET.
|
|
110
113
|
*/
|
|
@@ -133,18 +136,18 @@ interface ServerEndPoint {
|
|
|
133
136
|
* Perfroms a HEAD request.
|
|
134
137
|
*/
|
|
135
138
|
head?: ServerRequest;
|
|
136
|
-
}
|
|
139
|
+
};
|
|
137
140
|
type ServerRequest = (event: ServerEvent) => Response | Promise<Response | undefined> | void;
|
|
138
141
|
|
|
139
142
|
/**
|
|
140
143
|
* For _hook.server.
|
|
141
144
|
*/
|
|
142
|
-
|
|
145
|
+
type ServerHook = {
|
|
143
146
|
/**
|
|
144
147
|
* Called on each server request.
|
|
145
148
|
*/
|
|
146
149
|
handle?: ServerLoad;
|
|
147
|
-
}
|
|
150
|
+
};
|
|
148
151
|
type ServerLoad = (event: ServerEvent) => Promise<void> | void;
|
|
149
152
|
|
|
150
153
|
export { type PageEndPoint, type PageEvent, type PageServerEndPoint, type ServerEndPoint, type ServerEvent, type ServerHook, type UserConfig, buildRoutePath, defineConfig };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineConfig
|
|
3
|
+
} from "./chunk-L7GOYKUG.js";
|
|
4
|
+
|
|
1
5
|
// src/site/buildRoutePath.ts
|
|
2
6
|
function buildRoutePath(path, routeParams, urlParams) {
|
|
3
7
|
for (let [key, value] of Object.entries(routeParams)) {
|
|
@@ -15,11 +19,6 @@ function buildRoutePath(path, routeParams, urlParams) {
|
|
|
15
19
|
}
|
|
16
20
|
return path;
|
|
17
21
|
}
|
|
18
|
-
|
|
19
|
-
// src/site/defineConfig.ts
|
|
20
|
-
function defineConfig(config) {
|
|
21
|
-
return config;
|
|
22
|
-
}
|
|
23
22
|
export {
|
|
24
23
|
buildRoutePath,
|
|
25
24
|
defineConfig
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/site/buildRoutePath.ts"
|
|
1
|
+
{"version":3,"sources":["../src/site/buildRoutePath.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"],"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;","names":[]}
|
package/dist/metafile-cjs.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/site/buildRoutePath.ts":{"bytes":599,"imports":[],"format":"esm"},"src/site/defineConfig.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/site/buildRoutePath.ts":{"bytes":599,"imports":[],"format":"esm"},"src/site/FileSystemRouter.ts":{"bytes":651,"imports":[{"path":"vinxi/fs-router","kind":"import-statement","external":true}],"format":"esm"},"src/site/defineConfig.ts":{"bytes":1926,"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":"../types/UserConfig","kind":"import-statement","external":true},{"path":"src/site/FileSystemRouter.ts","kind":"import-statement","original":"./FileSystemRouter"}],"format":"esm"},"src/index.ts":{"bytes":826,"imports":[{"path":"src/site/buildRoutePath.ts","kind":"import-statement","original":"./site/buildRoutePath"},{"path":"src/site/defineConfig.ts","kind":"import-statement","original":"./site/defineConfig"},{"path":"./types/PageEndPoint","kind":"import-statement","external":true},{"path":"./types/PageEvent","kind":"import-statement","external":true},{"path":"./types/PageServerEndPoint","kind":"import-statement","external":true},{"path":"./types/ServerEndPoint","kind":"import-statement","external":true},{"path":"./types/ServerEvent","kind":"import-statement","external":true},{"path":"./types/ServerHook","kind":"import-statement","external":true},{"path":"./types/UserConfig","kind":"import-statement","external":true}],"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":315,"imports":[{"path":"src/response/response.ts","kind":"import-statement","original":"./response"}],"format":"esm"},"src/response/unauthorized.ts":{"bytes":432,"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/bin/index.ts":{"bytes":1371,"imports":[{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"src/site/defineConfig.ts","kind":"import-statement","original":"../site/defineConfig"},{"path":"../types/UserConfig","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":6704},"dist/index.cjs":{"imports":[{"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/index.ts","inputs":{"src/index.ts":{"bytesInOutput":175},"src/site/buildRoutePath.ts":{"bytesInOutput":436},"src/site/defineConfig.ts":{"bytesInOutput":1996},"src/site/FileSystemRouter.ts":{"bytesInOutput":647}},"bytes":4913},"dist/response.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":10303},"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":6601},"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":779},"src/site/defineConfig.ts":{"bytesInOutput":1998},"src/site/FileSystemRouter.ts":{"bytesInOutput":647}},"bytes":4754}}}
|
package/dist/metafile-esm.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/site/buildRoutePath.ts":{"bytes":599,"imports":[],"format":"esm"},"src/site/defineConfig.ts":{"bytes":
|
|
1
|
+
{"inputs":{"src/site/buildRoutePath.ts":{"bytes":599,"imports":[],"format":"esm"},"src/site/FileSystemRouter.ts":{"bytes":651,"imports":[{"path":"vinxi/fs-router","kind":"import-statement","external":true}],"format":"esm"},"src/site/defineConfig.ts":{"bytes":1926,"imports":[{"path":"@torpor/unplugin/vite","kind":"import-statement","external":true},{"path":"node:path","kind":"import-statement","external":true},{"path":"vinxi","kind":"import-statement","external":true},{"path":"vinxi/plugins/config","kind":"import-statement","external":true},{"path":"../types/UserConfig","kind":"import-statement","external":true},{"path":"src/site/FileSystemRouter.ts","kind":"import-statement","original":"./FileSystemRouter"}],"format":"esm"},"src/index.ts":{"bytes":826,"imports":[{"path":"src/site/buildRoutePath.ts","kind":"import-statement","original":"./site/buildRoutePath"},{"path":"src/site/defineConfig.ts","kind":"import-statement","original":"./site/defineConfig"},{"path":"./types/PageEndPoint","kind":"import-statement","external":true},{"path":"./types/PageEvent","kind":"import-statement","external":true},{"path":"./types/PageServerEndPoint","kind":"import-statement","external":true},{"path":"./types/ServerEndPoint","kind":"import-statement","external":true},{"path":"./types/ServerEvent","kind":"import-statement","external":true},{"path":"./types/ServerHook","kind":"import-statement","external":true},{"path":"./types/UserConfig","kind":"import-statement","external":true}],"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":315,"imports":[{"path":"src/response/response.ts","kind":"import-statement","original":"./response"}],"format":"esm"},"src/response/unauthorized.ts":{"bytes":432,"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/bin/index.ts":{"bytes":1371,"imports":[{"path":"node:fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"src/site/defineConfig.ts","kind":"import-statement","original":"../site/defineConfig"},{"path":"../types/UserConfig","kind":"import-statement","external":true}],"format":"esm"}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":1199},"dist/index.js":{"imports":[{"path":"dist/chunk-L7GOYKUG.js","kind":"import-statement"}],"exports":["buildRoutePath","defineConfig"],"entryPoint":"src/index.ts","inputs":{"src/site/buildRoutePath.ts":{"bytesInOutput":431},"src/index.ts":{"bytesInOutput":0}},"bytes":561},"dist/response.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":9197},"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":1996},"dist/bin/index.js":{"imports":[{"path":"dist/chunk-L7GOYKUG.js","kind":"import-statement"},{"path":"node:fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true}],"exports":[],"entryPoint":"src/bin/index.ts","inputs":{"src/bin/index.ts":{"bytesInOutput":645}},"bytes":742},"dist/chunk-L7GOYKUG.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":4594},"dist/chunk-L7GOYKUG.js":{"imports":[{"path":"@torpor/unplugin/vite","kind":"import-statement","external":true},{"path":"node: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":["defineConfig"],"inputs":{"src/site/defineConfig.ts":{"bytesInOutput":1814},"src/site/FileSystemRouter.ts":{"bytesInOutput":624}},"bytes":2556}}}
|
package/dist/response.cjs.map
CHANGED
|
@@ -1 +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":[]}
|
|
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 * 500 Server Error\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 * 401 Unauthorized\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;;;ACHe,SAAR,YAA6B,MAAkC;AACrE,SAAO,SAAS,KAAK,IAAI;AAC1B;;;ACAe,SAAR,aAA8B,MAAkC;AACtE,SAAO,SAAS,KAAK,IAAI;AAC1B;;;ACJe,SAAR,cAA+B,MAAkC;AACvE,SAAO,SAAS,KAAK,IAAI;AAC1B;","names":[]}
|
package/dist/response.d.cts
CHANGED
|
@@ -130,6 +130,8 @@ declare function response(status: number, body?: object | string): Response;
|
|
|
130
130
|
declare function seeOther(location: string): Response;
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
|
+
* 500 Server Error
|
|
134
|
+
*
|
|
133
135
|
* The server has encountered a situation it does not know how to handle.
|
|
134
136
|
*
|
|
135
137
|
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500
|
|
@@ -142,6 +144,8 @@ declare function serverError(body?: object | string): Response;
|
|
|
142
144
|
declare function transfer(status: 300 | 301 | 302 | 303 | 304 | 307 | 308, location: string): Response;
|
|
143
145
|
|
|
144
146
|
/**
|
|
147
|
+
* 401 Unauthorized
|
|
148
|
+
*
|
|
145
149
|
* Although the HTTP standard specifies "unauthorized", semantically this
|
|
146
150
|
* response means "unauthenticated". That is, the client must authenticate
|
|
147
151
|
* itself to get the requested response.
|
package/dist/response.d.ts
CHANGED
|
@@ -130,6 +130,8 @@ declare function response(status: number, body?: object | string): Response;
|
|
|
130
130
|
declare function seeOther(location: string): Response;
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
|
+
* 500 Server Error
|
|
134
|
+
*
|
|
133
135
|
* The server has encountered a situation it does not know how to handle.
|
|
134
136
|
*
|
|
135
137
|
* See https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500
|
|
@@ -142,6 +144,8 @@ declare function serverError(body?: object | string): Response;
|
|
|
142
144
|
declare function transfer(status: 300 | 301 | 302 | 303 | 304 | 307 | 308, location: string): Response;
|
|
143
145
|
|
|
144
146
|
/**
|
|
147
|
+
* 401 Unauthorized
|
|
148
|
+
*
|
|
145
149
|
* Although the HTTP standard specifies "unauthorized", semantically this
|
|
146
150
|
* response means "unauthenticated". That is, the client must authenticate
|
|
147
151
|
* itself to get the requested response.
|
package/dist/response.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../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":["/**\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":";AAOe,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;;;
|
|
1
|
+
{"version":3,"sources":["../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":["/**\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 * 500 Server Error\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 * 401 Unauthorized\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":";AAOe,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;;;ACHe,SAAR,YAA6B,MAAkC;AACrE,SAAO,SAAS,KAAK,IAAI;AAC1B;;;ACAe,SAAR,aAA8B,MAAkC;AACtE,SAAO,SAAS,KAAK,IAAI;AAC1B;;;ACJe,SAAR,cAA+B,MAAkC;AACvE,SAAO,SAAS,KAAK,IAAI;AAC1B;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@torpor/build",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "A framework for building sites and apps with Torpor",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -33,17 +33,20 @@
|
|
|
33
33
|
"author": "",
|
|
34
34
|
"license": "ISC",
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"vinxi": "^0.5.
|
|
37
|
-
"@torpor/
|
|
38
|
-
"@torpor/
|
|
36
|
+
"vinxi": "^0.5.3",
|
|
37
|
+
"@torpor/view": "^0.0.3",
|
|
38
|
+
"@torpor/unplugin": "^0.0.2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@trivago/prettier-plugin-sort-imports": "^5.2.
|
|
41
|
+
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
|
|
42
42
|
"lilconfig": "^3.1.3",
|
|
43
|
-
"tsup": "^8.3.
|
|
43
|
+
"tsup": "^8.3.6",
|
|
44
|
+
"typescript": "^5.7.3",
|
|
45
|
+
"vite": "^6.1.0"
|
|
44
46
|
},
|
|
45
47
|
"scripts": {
|
|
46
48
|
"build": "tsup",
|
|
47
|
-
"build:watch": "tsup --watch"
|
|
49
|
+
"build:watch": "tsup --watch",
|
|
50
|
+
"check": "tsc -p tsconfig.json --noEmit"
|
|
48
51
|
}
|
|
49
52
|
}
|
package/src/bin/index.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
//import { existsSync, promises as fs } from "node:fs";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import path from "path";
|
|
5
|
-
import
|
|
6
|
-
import type UserConfig from "../types/UserConfig";
|
|
5
|
+
import defineConfig from "../site/defineConfig";
|
|
6
|
+
import { type UserConfig } from "../types/UserConfig";
|
|
7
7
|
|
|
8
8
|
// Check for a torpor.config.js/ts file in the working directory
|
|
9
9
|
// TODO: Make sure it's valid, try/catch, etc
|
|
@@ -31,9 +31,10 @@ if (source) {
|
|
|
31
31
|
options = eval(source);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
defineConfig(options);
|
|
35
35
|
|
|
36
36
|
// This already gets done in vinxi.createApp so we can't do it twice
|
|
37
|
+
//const app = defineConfig(options);
|
|
37
38
|
//if (process.argv.includes("--dev")) {
|
|
38
39
|
// await app.dev();
|
|
39
40
|
//} else if (process.argv.includes("--build")) {
|