primate 0.32.7 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/app.tsconfig.json +55 -0
- package/lib/bin.d.ts +3 -0
- package/{src → lib}/bin.js +1 -0
- package/lib/commands/build.d.ts +4 -0
- package/lib/commands/build.js +9 -0
- package/lib/commands/dev.d.ts +3 -0
- package/lib/commands/dev.js +8 -0
- package/lib/commands/index.d.ts +3 -0
- package/lib/commands/index.js +13 -0
- package/lib/commands/init.d.ts +2 -0
- package/lib/commands/init.js +348 -0
- package/lib/commands/serve.d.ts +3 -0
- package/lib/commands/serve.js +13 -0
- package/lib/commands/test.d.ts +3 -0
- package/lib/commands/test.js +133 -0
- package/lib/init.d.ts +3 -0
- package/lib/init.js +12 -0
- package/lib/private/test.d.ts +32 -0
- package/lib/private/test.js +8 -0
- package/lib/public/Loader.d.ts +2 -0
- package/lib/public/Loader.js +2 -0
- package/lib/public/Module.d.ts +2 -0
- package/lib/public/Module.js +2 -0
- package/lib/public/RequestFacade.d.ts +2 -0
- package/lib/public/RequestFacade.js +2 -0
- package/lib/public/client/app.d.ts +4 -0
- package/lib/public/client/app.js +3 -0
- package/lib/public/config/i18n.d.ts +2 -0
- package/lib/public/config/i18n.js +2 -0
- package/lib/public/config/session.d.ts +2 -0
- package/lib/public/config/session.js +2 -0
- package/lib/public/config.d.ts +2 -0
- package/lib/public/config.js +2 -0
- package/lib/public/database/default.d.ts +2 -0
- package/lib/public/database/default.js +2 -0
- package/lib/public/database/wrap.d.ts +2 -0
- package/lib/public/database/wrap.js +2 -0
- package/lib/public/i18n/locale.d.ts +2 -0
- package/lib/public/i18n/locale.js +2 -0
- package/lib/public/load-text.d.ts +4 -0
- package/lib/public/load-text.js +3 -0
- package/lib/public/request/Facade.d.ts +2 -0
- package/lib/public/request/Facade.js +2 -0
- package/lib/public/response/Status.d.ts +2 -0
- package/lib/public/response/Status.js +2 -0
- package/lib/public/response/binary.d.ts +2 -0
- package/lib/public/response/binary.js +2 -0
- package/lib/public/response/error.d.ts +2 -0
- package/lib/public/response/error.js +2 -0
- package/lib/public/response/json.d.ts +2 -0
- package/lib/public/response/json.js +2 -0
- package/lib/public/response/redirect.d.ts +2 -0
- package/lib/public/response/redirect.js +2 -0
- package/lib/public/response/sse.d.ts +2 -0
- package/lib/public/response/sse.js +2 -0
- package/lib/public/response/text.d.ts +2 -0
- package/lib/public/response/text.js +2 -0
- package/lib/public/response/view.d.ts +2 -0
- package/lib/public/response/view.js +2 -0
- package/lib/public/response/ws.d.ts +2 -0
- package/lib/public/response/ws.js +2 -0
- package/lib/public/response.d.ts +22 -0
- package/lib/public/response.js +19 -0
- package/lib/public/route.d.ts +3 -0
- package/lib/public/route.js +3 -0
- package/lib/public/router.d.ts +2 -0
- package/lib/public/router.js +2 -0
- package/lib/public/s/config.d.ts +2 -0
- package/lib/public/s/config.js +2 -0
- package/lib/public/s/internal.d.ts +2 -0
- package/lib/public/s/internal.js +2 -0
- package/lib/public/serve.d.ts +2 -0
- package/{src → lib}/public/serve.js +1 -0
- package/lib/public/session/Manager.d.ts +2 -0
- package/lib/public/session/Manager.js +2 -0
- package/lib/public/store.d.ts +4 -0
- package/lib/public/store.js +3 -0
- package/lib/public/symbol/config.d.ts +2 -0
- package/lib/public/symbol/config.js +2 -0
- package/lib/public/test.d.ts +2 -0
- package/lib/public/test.js +2 -0
- package/lib/public/wasm/instantiate.d.ts +2 -0
- package/lib/public/wasm/instantiate.js +2 -0
- package/lib/runtime/FileRef.d.ts +2 -0
- package/lib/runtime/FileRef.js +2 -0
- package/package.json +47 -23
- package/src/commands/build.js +0 -4
- package/src/commands/dev.js +0 -8
- package/src/commands/exports.js +0 -5
- package/src/commands/serve.js +0 -8
- package/src/handlers/error.js +0 -1
- package/src/handlers/json.js +0 -1
- package/src/handlers/redirect.js +0 -1
- package/src/handlers/sse.js +0 -1
- package/src/handlers/stream.js +0 -1
- package/src/handlers/text.js +0 -1
- package/src/handlers/view.js +0 -1
- package/src/handlers/ws.js +0 -1
- package/src/init.js +0 -12
- package/src/public/load-text.js +0 -3
- package/src/public/loader.js +0 -30
- package/src/public/serve-asset.js +0 -9
- package/src/runtime/file.js +0 -3
- package/types/index.d.ts +0 -89
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import binary from "@primate/core/response/binary";
|
|
2
|
+
import error from "@primate/core/response/error";
|
|
3
|
+
export type { default as ViewResponse } from "@primate/core/frontend/ViewResponse";
|
|
4
|
+
export type { default as ResponseFunction } from "@primate/core/response/ResponseFunction";
|
|
5
|
+
export type { default as ServeApp } from "@primate/core/ServeApp";
|
|
6
|
+
declare const _default: {
|
|
7
|
+
binary: typeof binary;
|
|
8
|
+
error: typeof error;
|
|
9
|
+
json: (body: unknown, init?: ResponseInit) => (app: import("@primate/core/ServeApp").default) => import("@rcompat/type/MaybePromise").default<Response>;
|
|
10
|
+
redirect: (location: string, status?: 302 | 301 | 300 | 304 | 308 | 303 | 307) => import("@primate/core/response/ResponseFunction").default;
|
|
11
|
+
sse: (body: {
|
|
12
|
+
close?(): undefined;
|
|
13
|
+
open(events: {
|
|
14
|
+
send(name: string, data: unknown): undefined;
|
|
15
|
+
}): undefined;
|
|
16
|
+
}, init?: ResponseInit) => (app: import("@primate/core/ServeApp").default) => import("@rcompat/type/MaybePromise").default<Response>;
|
|
17
|
+
text: (body: string, init?: ResponseInit) => (app: import("@primate/core/ServeApp").default) => import("@rcompat/type/MaybePromise").default<Response>;
|
|
18
|
+
view: import("@primate/core/frontend/ViewResponse").default;
|
|
19
|
+
ws: (actions: import("@rcompat/http/Actions").default) => import("@primate/core/response/ResponseFunction").default;
|
|
20
|
+
};
|
|
21
|
+
export default _default;
|
|
22
|
+
//# sourceMappingURL=response.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import binary from "@primate/core/response/binary";
|
|
2
|
+
import error from "@primate/core/response/error";
|
|
3
|
+
import json from "@primate/core/response/json";
|
|
4
|
+
import redirect from "@primate/core/response/redirect";
|
|
5
|
+
import sse from "@primate/core/response/sse";
|
|
6
|
+
import text from "@primate/core/response/text";
|
|
7
|
+
import view from "@primate/core/response/view";
|
|
8
|
+
import ws from "@primate/core/response/ws";
|
|
9
|
+
export default {
|
|
10
|
+
binary,
|
|
11
|
+
error,
|
|
12
|
+
json,
|
|
13
|
+
redirect,
|
|
14
|
+
sse,
|
|
15
|
+
text,
|
|
16
|
+
view,
|
|
17
|
+
ws,
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=response.js.map
|
package/package.json
CHANGED
|
@@ -1,41 +1,65 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "primate",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
5
|
-
"homepage": "https://
|
|
6
|
-
"bugs": "https://github.com/
|
|
3
|
+
"version": "0.33.0",
|
|
4
|
+
"description": "The universal web framework",
|
|
5
|
+
"homepage": "https://primate.run",
|
|
6
|
+
"bugs": "https://github.com/primate-run/primate/issues",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"files": [
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
9
|
+
"/lib/app.tsconfig.json",
|
|
10
|
+
"/lib/**/*.js",
|
|
11
|
+
"/lib/**/*.d.ts",
|
|
12
|
+
"!/**/*.spec.*"
|
|
12
13
|
],
|
|
13
|
-
"bin": "
|
|
14
|
+
"bin": "lib/bin.js",
|
|
14
15
|
"repository": {
|
|
15
16
|
"type": "git",
|
|
16
|
-
"url": "https://github.com/
|
|
17
|
+
"url": "https://github.com/primate-run/primate",
|
|
17
18
|
"directory": "packages/primate"
|
|
18
19
|
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@rcompat/record": "^0.9.1",
|
|
22
|
+
"pema": "^0.2.0"
|
|
23
|
+
},
|
|
19
24
|
"dependencies": {
|
|
20
|
-
"@rcompat/args": "^0.
|
|
21
|
-
"@rcompat/
|
|
22
|
-
"@rcompat/
|
|
23
|
-
"@rcompat/
|
|
24
|
-
"@rcompat/
|
|
25
|
-
"@rcompat/
|
|
26
|
-
"@
|
|
25
|
+
"@rcompat/args": "^0.8.0",
|
|
26
|
+
"@rcompat/cli": "^0.11.3",
|
|
27
|
+
"@rcompat/fs": "^0.21.1",
|
|
28
|
+
"@rcompat/http": "~0.15.1",
|
|
29
|
+
"@rcompat/package": "^0.22.0",
|
|
30
|
+
"@rcompat/runtime": "^0.6.0",
|
|
31
|
+
"@rcompat/string": "^0.10.0",
|
|
32
|
+
"@primate/core": "^0.2.0"
|
|
27
33
|
},
|
|
28
34
|
"engines": {
|
|
29
|
-
"node": ">=
|
|
35
|
+
"node": ">=20"
|
|
30
36
|
},
|
|
31
37
|
"type": "module",
|
|
32
|
-
"
|
|
38
|
+
"imports": {
|
|
39
|
+
"#*": {
|
|
40
|
+
"apekit": "./src/private/*.ts",
|
|
41
|
+
"default": "./lib/private/*.js"
|
|
42
|
+
},
|
|
43
|
+
"#runtime/FileRef": "@rcompat/fs/FileRef"
|
|
44
|
+
},
|
|
33
45
|
"exports": {
|
|
34
|
-
"./
|
|
35
|
-
|
|
36
|
-
"
|
|
46
|
+
"./tsconfig": "./lib/app.tsconfig.json",
|
|
47
|
+
"./runtime/*": {
|
|
48
|
+
"apekit": "./src/runtime/*.ts",
|
|
49
|
+
"default": "./lib/runtime/*.js"
|
|
37
50
|
},
|
|
38
|
-
"
|
|
39
|
-
|
|
51
|
+
"./http/*": {
|
|
52
|
+
"apekit": "./src/public/http/*.ts",
|
|
53
|
+
"default": "./lib/public/http/*.js"
|
|
54
|
+
},
|
|
55
|
+
"./*": {
|
|
56
|
+
"apekit": "./src/public/*.ts",
|
|
57
|
+
"default": "./lib/public/*.js"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"scripts": {
|
|
61
|
+
"build": "npm run clean && tsc && cp src/app.tsconfig.json lib",
|
|
62
|
+
"clean": "rm -rf ./lib",
|
|
63
|
+
"lint": "eslint ."
|
|
40
64
|
}
|
|
41
65
|
}
|
package/src/commands/build.js
DELETED
package/src/commands/dev.js
DELETED
package/src/commands/exports.js
DELETED
package/src/commands/serve.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import root from "@rcompat/package/root";
|
|
2
|
-
import tryreturn from "@rcompat/async/tryreturn";
|
|
3
|
-
import resolve from "@rcompat/fs/resolve";
|
|
4
|
-
|
|
5
|
-
// serve from build directory
|
|
6
|
-
export default async (from = "build") =>
|
|
7
|
-
(await tryreturn(_ => root()).orelse(_ => resolve()))
|
|
8
|
-
.join(`./${from}/serve.js`).import();
|
package/src/handlers/error.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "@primate/core/handler/error";
|
package/src/handlers/json.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "@primate/core/handler/json";
|
package/src/handlers/redirect.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "@primate/core/handler/redirect";
|
package/src/handlers/sse.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "@primate/core/handler/sse";
|
package/src/handlers/stream.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "@primate/core/handler/stream";
|
package/src/handlers/text.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "@primate/core/handler/text";
|
package/src/handlers/view.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "@primate/core/handler/view";
|
package/src/handlers/ws.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from "@primate/core/handler/ws";
|
package/src/init.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import blue from "@rcompat/cli/color/blue";
|
|
2
|
-
import bold from "@rcompat/cli/color/bold";
|
|
3
|
-
import print from "@rcompat/cli/print";
|
|
4
|
-
import manifest from "@rcompat/package/manifest";
|
|
5
|
-
import find from "./commands/exports.js";
|
|
6
|
-
|
|
7
|
-
export default async (...args) => {
|
|
8
|
-
const [command, ...flags] = args;
|
|
9
|
-
const primate = await manifest(import.meta.url);
|
|
10
|
-
print(blue(bold(primate.name)), blue(primate.version), "\n");
|
|
11
|
-
find(command)(...flags);
|
|
12
|
-
};
|
package/src/public/load-text.js
DELETED
package/src/public/loader.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import serve_asset from "primate/serve-asset";
|
|
2
|
-
import file from "@rcompat/fs/file";
|
|
3
|
-
|
|
4
|
-
export default ({
|
|
5
|
-
pages_app,
|
|
6
|
-
pages,
|
|
7
|
-
rootfile,
|
|
8
|
-
static_root,
|
|
9
|
-
}) => {
|
|
10
|
-
const buildroot = file(rootfile).join("..");
|
|
11
|
-
|
|
12
|
-
return {
|
|
13
|
-
page(name) {
|
|
14
|
-
return pages[name] ?? pages[pages_app];
|
|
15
|
-
},
|
|
16
|
-
async asset(pathname) {
|
|
17
|
-
const client_file = buildroot.join(`client/${pathname}`);
|
|
18
|
-
if (await client_file.isFile()) {
|
|
19
|
-
return serve_asset(client_file);
|
|
20
|
-
}
|
|
21
|
-
if (pathname.startsWith(static_root)) {
|
|
22
|
-
const assetname = pathname.slice(static_root.length);
|
|
23
|
-
const static_file = buildroot.join(`server/static/${assetname}`);
|
|
24
|
-
if (await static_file.isFile()) {
|
|
25
|
-
return serve_asset(static_file);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
};
|
package/src/runtime/file.js
DELETED