@torpor/build 0.4.8 → 0.4.10
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/dist/nav.mjs +3 -1
- package/dist/nav.mjs.map +1 -1
- package/package.json +7 -3
- package/CHANGELOG.md +0 -467
- package/scripts/postbuild.ts +0 -12
- package/src/bin/index.ts +0 -11
- package/src/index.ts +0 -30
- package/src/nav/formSubmit.ts +0 -49
- package/src/nav/load.ts +0 -9
- package/src/nav/loadData.ts +0 -134
- package/src/nav/navigate.ts +0 -164
- package/src/nav/reload.ts +0 -9
- package/src/nav.ts +0 -4
- package/src/response/badRequest.ts +0 -19
- package/src/response/created.ts +0 -20
- package/src/response/forbidden.ts +0 -21
- package/src/response/found.ts +0 -30
- package/src/response/methodNotAllowed.ts +0 -18
- package/src/response/movedPermanently.ts +0 -25
- package/src/response/notFound.ts +0 -24
- package/src/response/notModified.ts +0 -34
- package/src/response/ok.ts +0 -29
- package/src/response/permanentRedirect.ts +0 -30
- package/src/response/response.ts +0 -22
- package/src/response/seeOther.ts +0 -19
- package/src/response/serverError.ts +0 -24
- package/src/response/temporaryRedirect.ts +0 -31
- package/src/response/transfer.ts +0 -14
- package/src/response/unauthorized.ts +0 -21
- package/src/response/unprocessable.ts +0 -18
- package/src/response.ts +0 -37
- package/src/run/prepareTemplate.ts +0 -39
- package/src/run/run.ts +0 -62
- package/src/run/runBuild.ts +0 -77
- package/src/run/runDev.ts +0 -89
- package/src/run/runPreview.ts +0 -93
- package/src/run.ts +0 -6
- package/src/server/CookieHelper.ts +0 -36
- package/src/server/HeaderHelper.ts +0 -25
- package/src/server/Routerx.ts +0 -72
- package/src/server/Server.ts +0 -144
- package/src/server/ServerEvent.ts +0 -39
- package/src/server/connect/bufferToArrayBuffer.ts +0 -8
- package/src/server/connect/connectMiddleware.ts +0 -81
- package/src/server/connect/flattenHeaders.ts +0 -44
- package/src/server/connect/nodeMessageToNodeResponse.ts +0 -89
- package/src/server/connect/readableToBuffer.ts +0 -16
- package/src/server/connect/requestToNodeMessage.ts +0 -26
- package/src/server/contentType.ts +0 -85
- package/src/server/types/HttpMethod.ts +0 -12
- package/src/server/types/MiddlewareFunction.ts +0 -8
- package/src/server/types/ServerFunction.ts +0 -7
- package/src/server.ts +0 -7
- package/src/site/Router.ts +0 -164
- package/src/site/Site.ts +0 -214
- package/src/site/clientEntry.ts +0 -108
- package/src/site/clientEntryDev.ts +0 -3
- package/src/site/defaultAdapter.ts +0 -11
- package/src/site/manifest.ts +0 -54
- package/src/site/serverEntry.ts +0 -417
- package/src/state/$page.ts +0 -24
- package/src/state/client.ts +0 -15
- package/src/state.ts +0 -3
- package/src/test/runTest.ts +0 -350
- package/src/test.ts +0 -3
- package/src/types/Adapter.ts +0 -8
- package/src/types/ClientState.ts +0 -8
- package/src/types/InternalState.ts +0 -7
- package/src/types/LayoutHandler.ts +0 -5
- package/src/types/LayoutPath.ts +0 -10
- package/src/types/ManifestRoute.ts +0 -6
- package/src/types/PageEndPoint.ts +0 -39
- package/src/types/PageLoadEvent.ts +0 -14
- package/src/types/PageServerAction.ts +0 -7
- package/src/types/PageServerEndPoint.ts +0 -16
- package/src/types/PageServerLoad.ts +0 -7
- package/src/types/PageState.ts +0 -8
- package/src/types/Route.ts +0 -11
- package/src/types/RouteHandler.ts +0 -16
- package/src/types/RouteLayoutHandler.ts +0 -5
- package/src/types/RouteMatchResult.ts +0 -7
- package/src/types/RouteType.ts +0 -19
- package/src/types/ServerEndPoint.ts +0 -37
- package/src/types/ServerHook.ts +0 -11
- package/src/types/ServerLoadEvent.ts +0 -37
- package/src/types/ServerRequest.ts +0 -7
- package/src/utils/pathToRegex.ts +0 -15
- package/src/vite-env.d.ts +0 -2
- package/test/api/_hook.server.ts +0 -3
- package/test/api/posts/+page.server.ts +0 -3
- package/test/api/posts/[id]/+page.server.ts +0 -3
- package/test/app.test.ts +0 -47
- package/test/router.test.ts +0 -78
- package/test/routes/+page.server.ts +0 -3
- package/test/routes/+page.ts +0 -3
- package/test/routes/_error.ts +0 -3
- package/test/routes/_hook.server.ts +0 -3
- package/test/routes/_layout.server.ts +0 -3
- package/test/routes/_layout.ts +0 -3
- package/test/routes/posts/+page.ts +0 -3
- package/test/routes/posts/[id]/+page.ts +0 -3
- package/test/site.test.ts +0 -40
- package/tsconfig.json +0 -9
- package/tsdown.config.ts +0 -18
- package/vitest.config.ts +0 -3
package/src/vite-env.d.ts
DELETED
package/test/api/_hook.server.ts
DELETED
package/test/app.test.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { expect, test } from "vitest";
|
|
2
|
-
import Server from "../src/server/Server";
|
|
3
|
-
|
|
4
|
-
test("app router methods", () => {
|
|
5
|
-
let app = new Server();
|
|
6
|
-
expect(app).not.toBeUndefined();
|
|
7
|
-
/*
|
|
8
|
-
app.add("GET", "/blah", () => "hi there");
|
|
9
|
-
expect(app.match("GET", "/blah")).not.toBeUndefined();
|
|
10
|
-
expect(app.match("POST", "/blah")).toBeUndefined();
|
|
11
|
-
|
|
12
|
-
app.get("/", () => "hi there");
|
|
13
|
-
app.head("/", () => "hi there");
|
|
14
|
-
app.patch("/", () => "hi there");
|
|
15
|
-
app.post("/", () => "hi there");
|
|
16
|
-
app.put("/", () => "hi there");
|
|
17
|
-
app.delete("/", () => "hi there");
|
|
18
|
-
app.options("/", () => "hi there");
|
|
19
|
-
app.connect("/", () => "hi there");
|
|
20
|
-
app.trace("/", () => "hi there");
|
|
21
|
-
|
|
22
|
-
expect(app.match("GET", "/")).not.toBeUndefined();
|
|
23
|
-
expect(app.match("HEAD", "/")).not.toBeUndefined();
|
|
24
|
-
expect(app.match("PATCH", "/")).not.toBeUndefined();
|
|
25
|
-
expect(app.match("POST", "/")).not.toBeUndefined();
|
|
26
|
-
expect(app.match("PUT", "/")).not.toBeUndefined();
|
|
27
|
-
expect(app.match("DELETE", "/")).not.toBeUndefined();
|
|
28
|
-
expect(app.match("OPTIONS", "/")).not.toBeUndefined();
|
|
29
|
-
expect(app.match("CONNECT", "/")).not.toBeUndefined();
|
|
30
|
-
expect(app.match("TRACE", "/")).not.toBeUndefined();
|
|
31
|
-
*/
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
test("app router params", () => {
|
|
35
|
-
let app = new Server();
|
|
36
|
-
expect(app).not.toBeUndefined();
|
|
37
|
-
/*
|
|
38
|
-
app.add("GET", "/posts/[id]", () => "hi there");
|
|
39
|
-
|
|
40
|
-
let route = app.match("GET", "/posts/5");
|
|
41
|
-
|
|
42
|
-
expect(route).not.toBeUndefined();
|
|
43
|
-
expect(route!.handler).not.toBeUndefined();
|
|
44
|
-
expect(route!.params).not.toBeUndefined();
|
|
45
|
-
expect(route!.params!.id).toBe("5");
|
|
46
|
-
*/
|
|
47
|
-
});
|
package/test/router.test.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { assert, expect, test } from "vitest";
|
|
2
|
-
import Router from "../src/site/Router";
|
|
3
|
-
import { HOOK_SERVER_ROUTE, LAYOUT_ROUTE, PAGE_ROUTE } from "../src/types/RouteType";
|
|
4
|
-
|
|
5
|
-
test("router method sorting", () => {
|
|
6
|
-
let r = new Router();
|
|
7
|
-
r.addPage("/posts/[id]", PAGE_ROUTE, async () => {});
|
|
8
|
-
r.addPage("/posts/drafts/[id]", PAGE_ROUTE, async () => {});
|
|
9
|
-
expect(r.routes.map((r) => r.path).join(",")).toBe("/posts/drafts/[id],/posts/[id]");
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
test("router matching", () => {
|
|
13
|
-
let r = new Router();
|
|
14
|
-
r.addPage("/posts", PAGE_ROUTE, async () => {});
|
|
15
|
-
const match = r.match("/posts", new URLSearchParams());
|
|
16
|
-
assert(match, "no match");
|
|
17
|
-
expect(match.params).toBeUndefined();
|
|
18
|
-
assert(match.handler, "no handler");
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
test("router matching with param", () => {
|
|
22
|
-
let r = new Router();
|
|
23
|
-
r.addPage("/posts/[id]", PAGE_ROUTE, async () => {});
|
|
24
|
-
r.addPage("/posts/drafts/[id]", PAGE_ROUTE, async () => {});
|
|
25
|
-
const match = r.match("/posts/5", new URLSearchParams());
|
|
26
|
-
assert(match, "no match");
|
|
27
|
-
assert(match.params, "no params");
|
|
28
|
-
expect(match.params["id"]).toBe("5");
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
test("router matching not found", () => {
|
|
32
|
-
let r = new Router();
|
|
33
|
-
r.addPage("/posts/[id]", PAGE_ROUTE, async () => {});
|
|
34
|
-
r.addPage("/posts/drafts/[id]", PAGE_ROUTE, async () => {});
|
|
35
|
-
const match = r.match("/postss/5", new URLSearchParams());
|
|
36
|
-
expect(match).toBeUndefined();
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
test("router matching layouts", () => {
|
|
40
|
-
let r = new Router();
|
|
41
|
-
r.addPage("/_layout", LAYOUT_ROUTE, async () => {});
|
|
42
|
-
r.addPage("/posts/_layout", LAYOUT_ROUTE, async () => {});
|
|
43
|
-
r.addPage("/posts/[id]", PAGE_ROUTE, async () => {});
|
|
44
|
-
r.addPage("/posts/drafts/[id]", PAGE_ROUTE, async () => {});
|
|
45
|
-
const match = r.match("/posts/5", new URLSearchParams());
|
|
46
|
-
assert(match, "no match");
|
|
47
|
-
assert(match.handler.layouts, "no layouts");
|
|
48
|
-
expect(match.handler.layouts.length).toBe(2);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
test("router matching hook", () => {
|
|
52
|
-
let r = new Router();
|
|
53
|
-
r.addPage("/_hook/~server", HOOK_SERVER_ROUTE, async () => {});
|
|
54
|
-
r.addPage("/posts/[id]", PAGE_ROUTE, async () => {});
|
|
55
|
-
const match = r.match("/posts/5", new URLSearchParams());
|
|
56
|
-
assert(match, "no match");
|
|
57
|
-
assert(match.handler.serverHook, "no hook");
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
test("router matching base folder", async () => {
|
|
61
|
-
let r = new Router();
|
|
62
|
-
r.addPage("/_hook/~server", HOOK_SERVER_ROUTE, async () => {});
|
|
63
|
-
r.addPage("/_layout", LAYOUT_ROUTE, async () => {});
|
|
64
|
-
r.addPage("/posts/_layout", LAYOUT_ROUTE, async () => {});
|
|
65
|
-
r.addPage("/posts/[id]", PAGE_ROUTE, async () => {});
|
|
66
|
-
r.addPage("/api/posts/[id]", PAGE_ROUTE, async () => {}, "/api");
|
|
67
|
-
r.addPage("/api/_hook/~server", HOOK_SERVER_ROUTE, async () => "api hook", "/api");
|
|
68
|
-
const match = r.match("/api/posts/5", new URLSearchParams());
|
|
69
|
-
assert(match, "no match");
|
|
70
|
-
assert(match.params, "no params");
|
|
71
|
-
expect(match.params["id"]).toBe("5");
|
|
72
|
-
|
|
73
|
-
expect(match.handler.path).toBe("/api/posts/[id]");
|
|
74
|
-
assert(match.handler.serverHook, "no hook");
|
|
75
|
-
expect(await match.handler.serverHook()).toBe("api hook");
|
|
76
|
-
|
|
77
|
-
expect(match.handler.layouts).toBeUndefined();
|
|
78
|
-
});
|
package/test/routes/+page.ts
DELETED
package/test/routes/_error.ts
DELETED
package/test/routes/_layout.ts
DELETED
package/test/site.test.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { expect, test } from "vitest";
|
|
2
|
-
import Site from "../src/site/Site";
|
|
3
|
-
|
|
4
|
-
test("site routes", async () => {
|
|
5
|
-
let site = new Site();
|
|
6
|
-
await site.addRouteFolder("./test/routes");
|
|
7
|
-
expect(site.routes.map((r) => r.path).join("\n")).toBe(
|
|
8
|
-
`
|
|
9
|
-
/
|
|
10
|
-
/_error
|
|
11
|
-
/_hook/~server
|
|
12
|
-
/_layout
|
|
13
|
-
/_layout/~server
|
|
14
|
-
/~server
|
|
15
|
-
/posts
|
|
16
|
-
/posts/[id]
|
|
17
|
-
`.trim(),
|
|
18
|
-
);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
test("site routes with base folder", async () => {
|
|
22
|
-
let site = new Site();
|
|
23
|
-
await site.addRouteFolder("./test/routes");
|
|
24
|
-
await site.addRouteFolder("./test/api", "api");
|
|
25
|
-
expect(site.routes.map((r) => r.path).join("\n")).toBe(
|
|
26
|
-
`
|
|
27
|
-
/
|
|
28
|
-
/_error
|
|
29
|
-
/_hook/~server
|
|
30
|
-
/_layout
|
|
31
|
-
/_layout/~server
|
|
32
|
-
/~server
|
|
33
|
-
/api/_hook/~server
|
|
34
|
-
/api/posts/~server
|
|
35
|
-
/api/posts/[id]/~server
|
|
36
|
-
/posts
|
|
37
|
-
/posts/[id]
|
|
38
|
-
`.trim(),
|
|
39
|
-
);
|
|
40
|
-
});
|
package/tsconfig.json
DELETED
package/tsdown.config.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { type UserConfig, defineConfig } from "tsdown";
|
|
2
|
-
|
|
3
|
-
export default defineConfig({
|
|
4
|
-
entry: [
|
|
5
|
-
"src/index.ts",
|
|
6
|
-
"src/nav.ts",
|
|
7
|
-
"src/response.ts",
|
|
8
|
-
"src/run.ts",
|
|
9
|
-
"src/server.ts",
|
|
10
|
-
"src/state.ts",
|
|
11
|
-
"src/test.ts",
|
|
12
|
-
"src/bin/index.ts",
|
|
13
|
-
],
|
|
14
|
-
// Put this in here to stop issues with bundling Vite from bin/index.ts
|
|
15
|
-
// I'm not sure if this will cause further issues down the line?
|
|
16
|
-
external: ["vite"],
|
|
17
|
-
onSuccess: "npm run build:fix",
|
|
18
|
-
}) satisfies UserConfig as UserConfig;
|
package/vitest.config.ts
DELETED