primate 0.36.0 → 0.37.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.d.ts +10 -0
- package/lib/bin.js +2 -2
- package/lib/commands/build.d.ts +2 -2
- package/lib/commands/build.js +12 -4
- package/lib/commands/index.d.ts +4 -4
- package/lib/commands/index.js +41 -7
- package/lib/commands/init.js +0 -7
- package/lib/commands/migrate-apply.d.ts +2 -0
- package/lib/commands/migrate-apply.js +12 -0
- package/lib/commands/migrate-create.d.ts +2 -0
- package/lib/commands/migrate-create.js +23 -0
- package/lib/commands/migrate-status.d.ts +2 -0
- package/lib/commands/migrate-status.js +12 -0
- package/lib/commands/test.js +1 -1
- package/lib/index.d.ts +2 -9
- package/lib/init.js +0 -5
- package/lib/public/build.d.ts +2 -0
- package/lib/public/build.js +2 -0
- package/lib/public/http/Status.d.ts +1 -1
- package/lib/public/http/Status.js +1 -1
- package/lib/public/index.d.ts +2 -0
- package/lib/public/index.js +2 -0
- package/lib/public/orm/store.d.ts +1 -3
- package/lib/public/orm/store.js +1 -2
- package/lib/public/request.d.ts +1 -1
- package/lib/public/response.d.ts +2 -2
- package/package.json +22 -22
- package/lib/public/Module.d.ts +0 -2
- package/lib/public/Module.js +0 -2
- package/lib/public/orm/wrap.d.ts +0 -2
- package/lib/public/orm/wrap.js +0 -2
- package/lib/runtime/FileRef.d.ts +0 -3
- package/lib/runtime/FileRef.js +0 -4
package/lib/app.d.ts
ADDED
package/lib/bin.js
CHANGED
package/lib/commands/build.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type Mode from "@primate/core
|
|
2
|
-
export default function
|
|
1
|
+
import type { Mode } from "@primate/core";
|
|
2
|
+
export default function command_build(flags: string[], mode?: Mode): Promise<true | undefined>;
|
|
3
3
|
//# sourceMappingURL=build.d.ts.map
|
package/lib/commands/build.js
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import build from "@primate/core/build";
|
|
2
|
+
import c from "@rcompat/cli/color";
|
|
3
|
+
import print from "@rcompat/cli/print";
|
|
4
|
+
import fs from "@rcompat/fs";
|
|
2
5
|
import get_flag from "./get-flag.js";
|
|
3
|
-
|
|
4
|
-
|
|
6
|
+
function orange(x) {
|
|
7
|
+
return `\x1b[38;2;255;165;0m${x}\x1b[0m`;
|
|
8
|
+
}
|
|
9
|
+
export default async function command_build(flags, mode) {
|
|
10
|
+
const { name, version, } = await (await fs.project.package(import.meta.dirname)).json();
|
|
11
|
+
print(c.bold(orange((name.toUpperCase()))), orange(version), "\n\n");
|
|
12
|
+
const root = await fs.project.root();
|
|
5
13
|
const build_flags = {
|
|
6
|
-
mode: mode,
|
|
14
|
+
mode: mode ?? "production",
|
|
7
15
|
target: get_flag(flags, "target"),
|
|
8
16
|
dir: get_flag(flags, "dir"),
|
|
9
17
|
};
|
|
10
|
-
return build(build_flags);
|
|
18
|
+
return build(root, build_flags);
|
|
11
19
|
}
|
|
12
20
|
;
|
|
13
21
|
//# sourceMappingURL=build.js.map
|
package/lib/commands/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
export default
|
|
1
|
+
import build from "./build.js";
|
|
2
|
+
import migrate_create from "./migrate-create.js";
|
|
3
|
+
import serve from "./serve.js";
|
|
4
|
+
export default function run_command(command_flag?: string): typeof build | typeof serve | typeof migrate_create | (() => void);
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/commands/index.js
CHANGED
|
@@ -1,13 +1,47 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
1
|
+
import c from "@rcompat/cli/color";
|
|
2
|
+
import print from "@rcompat/cli/print";
|
|
3
|
+
import build from "./build.js";
|
|
4
|
+
import dev from "./dev.js";
|
|
5
|
+
import init from "./init.js";
|
|
6
|
+
import migrate_apply from "./migrate-apply.js";
|
|
7
|
+
import migrate_create from "./migrate-create.js";
|
|
8
|
+
import migrate_status from "./migrate-status.js";
|
|
9
|
+
import serve from "./serve.js";
|
|
10
|
+
import test from "./test.js";
|
|
11
|
+
const commands = {
|
|
7
12
|
build,
|
|
8
13
|
dev,
|
|
9
14
|
init,
|
|
10
15
|
serve,
|
|
11
16
|
test,
|
|
12
|
-
|
|
17
|
+
migrate_apply,
|
|
18
|
+
migrate_create,
|
|
19
|
+
migrate_status,
|
|
20
|
+
};
|
|
21
|
+
function unknown(command) {
|
|
22
|
+
return () => {
|
|
23
|
+
print(`Unknown command ${c.dim(command)}\n`);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
;
|
|
27
|
+
function in_commands(command) {
|
|
28
|
+
return Object.keys(commands).find(key => key === command || key.startsWith(command)) !== undefined;
|
|
29
|
+
}
|
|
30
|
+
export default function run_command(command_flag = "") {
|
|
31
|
+
const [command, action = ""] = command_flag.trim().split(":");
|
|
32
|
+
if (command === "")
|
|
33
|
+
return dev;
|
|
34
|
+
if (in_commands(command)) {
|
|
35
|
+
if (action === "")
|
|
36
|
+
return commands[command];
|
|
37
|
+
else {
|
|
38
|
+
const subcommand = `${command}_${action}`;
|
|
39
|
+
if (in_commands(subcommand))
|
|
40
|
+
return commands[subcommand];
|
|
41
|
+
return unknown(subcommand.replace("_", ":"));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return unknown(command);
|
|
45
|
+
}
|
|
46
|
+
;
|
|
13
47
|
//# sourceMappingURL=index.js.map
|
package/lib/commands/init.js
CHANGED
|
@@ -164,13 +164,7 @@ async function gitignore(root) {
|
|
|
164
164
|
const content = [
|
|
165
165
|
"node_modules",
|
|
166
166
|
"build",
|
|
167
|
-
"dist",
|
|
168
|
-
".DS_Store",
|
|
169
167
|
"*.log",
|
|
170
|
-
"npm-debug.log*",
|
|
171
|
-
"yarn-debug.log*",
|
|
172
|
-
"yarn-error.log*",
|
|
173
|
-
"pnpm-debug.log*",
|
|
174
168
|
"",
|
|
175
169
|
].join("\n");
|
|
176
170
|
await gi.write(content);
|
|
@@ -191,7 +185,6 @@ async function app_config(root, c) {
|
|
|
191
185
|
const body = `import config from "primate/config";
|
|
192
186
|
${frontend_imports}
|
|
193
187
|
${backend_imports}
|
|
194
|
-
|
|
195
188
|
export default config({
|
|
196
189
|
modules: [
|
|
197
190
|
${modules.join(",\n ")}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import migrate from "@primate/core/db/migrate";
|
|
2
|
+
import log from "@primate/core/log";
|
|
3
|
+
export default async function command_migrate_apply() {
|
|
4
|
+
try {
|
|
5
|
+
await migrate.apply();
|
|
6
|
+
}
|
|
7
|
+
catch (cause) {
|
|
8
|
+
log.error(cause);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
;
|
|
12
|
+
//# sourceMappingURL=migrate-apply.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import migrate from "@primate/core/db/migrate";
|
|
2
|
+
import log from "@primate/core/log";
|
|
3
|
+
import error from "@rcompat/error";
|
|
4
|
+
const n = "--name";
|
|
5
|
+
function create_requires_name_flag() {
|
|
6
|
+
return error.template `migrate:create requires a ${n} flag`;
|
|
7
|
+
}
|
|
8
|
+
const errors = error.coded({
|
|
9
|
+
create_requires_name_flag,
|
|
10
|
+
});
|
|
11
|
+
export default async function command_migrate_create(flags) {
|
|
12
|
+
const name = flags.find(f => f.startsWith(`${n}=`))?.slice(`${n}=`.length);
|
|
13
|
+
try {
|
|
14
|
+
if (name === undefined)
|
|
15
|
+
throw errors.create_requires_name_flag();
|
|
16
|
+
await migrate.create(name);
|
|
17
|
+
}
|
|
18
|
+
catch (cause) {
|
|
19
|
+
log.error(cause);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
;
|
|
23
|
+
//# sourceMappingURL=migrate-create.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import migrate from "@primate/core/db/migrate";
|
|
2
|
+
import log from "@primate/core/log";
|
|
3
|
+
export default async function command_migrate_status() {
|
|
4
|
+
try {
|
|
5
|
+
await migrate.status();
|
|
6
|
+
}
|
|
7
|
+
catch (cause) {
|
|
8
|
+
log.error(cause);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
;
|
|
12
|
+
//# sourceMappingURL=migrate-status.js.map
|
package/lib/commands/test.js
CHANGED
|
@@ -17,7 +17,7 @@ const first_error = (left, right) => {
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
export default async () => {
|
|
20
|
-
await build({ mode: "testing" });
|
|
20
|
+
await build(await fs.project.root(), { mode: "testing" });
|
|
21
21
|
const app = (await serve()).default;
|
|
22
22
|
const files = await (await fs.project.root()).join(directory)
|
|
23
23
|
.list({ filter: f => f.path.endsWith(".ts") || f.path.endsWith(".js") });
|
package/lib/index.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
const views: [string, Record<string, unknown>][];
|
|
3
|
-
export default views;
|
|
4
|
-
}
|
|
1
|
+
import "./app.d.ts";
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
import type AppFacade from "primate/AppFacade";
|
|
8
|
-
const facade: AppFacade;
|
|
9
|
-
export default facade;
|
|
10
|
-
}
|
|
3
|
+
export type * from "./public/index";
|
package/lib/init.js
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import c from "@rcompat/cli/color";
|
|
2
|
-
import print from "@rcompat/cli/print";
|
|
3
|
-
import fs from "@rcompat/fs";
|
|
4
1
|
import find from "./commands/index.js";
|
|
5
2
|
function orange(x) {
|
|
6
3
|
return `\x1b[38;2;255;165;0m${x}\x1b[0m`;
|
|
7
4
|
}
|
|
8
5
|
export default async (...args) => {
|
|
9
6
|
const [command, ...flags] = args;
|
|
10
|
-
const { name, version, } = await (await fs.project.package(import.meta.dirname)).json();
|
|
11
|
-
print(c.bold(orange((name.toUpperCase()))), orange(version), "\n\n");
|
|
12
7
|
find(command)(flags);
|
|
13
8
|
};
|
|
14
9
|
//# sourceMappingURL=init.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from "@rcompat/http
|
|
1
|
+
export { Status as default } from "@rcompat/http";
|
|
2
2
|
//# sourceMappingURL=Status.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default } from "@rcompat/http
|
|
1
|
+
export { Status as default } from "@rcompat/http";
|
|
2
2
|
//# sourceMappingURL=Status.js.map
|
package/lib/public/orm/store.js
CHANGED
package/lib/public/request.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export type { RequestFacade } from "@primate/core";
|
|
2
2
|
//# sourceMappingURL=request.d.ts.map
|
package/lib/public/response.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type {
|
|
2
|
-
export type {
|
|
1
|
+
export type { ServeApp } from "@primate/core";
|
|
2
|
+
export type { ViewResponse } from "@primate/core/client";
|
|
3
3
|
export { default, type ResponseFunction } from "@primate/core/response";
|
|
4
4
|
//# sourceMappingURL=response.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "primate",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"description": "The universal web framework",
|
|
5
5
|
"homepage": "https://primate.run",
|
|
6
6
|
"bugs": "https://github.com/primate-run/primate/issues",
|
|
@@ -20,47 +20,47 @@
|
|
|
20
20
|
"bin": "lib/bin.js",
|
|
21
21
|
"types": "lib/index.d.ts",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@rcompat/
|
|
24
|
-
"@rcompat/
|
|
25
|
-
"@rcompat/
|
|
26
|
-
"@rcompat/fs": "^0.
|
|
27
|
-
"@rcompat/http": "~0.
|
|
28
|
-
"@rcompat/
|
|
29
|
-
"@
|
|
23
|
+
"@rcompat/cli": "^0.18.1",
|
|
24
|
+
"@rcompat/dict": "^0.5.1",
|
|
25
|
+
"@rcompat/error": "^0.3.1",
|
|
26
|
+
"@rcompat/fs": "^0.28.1",
|
|
27
|
+
"@rcompat/http": "~0.25.1",
|
|
28
|
+
"@rcompat/runtime": "^0.11.1",
|
|
29
|
+
"@rcompat/test": "^0.12.2",
|
|
30
|
+
"@primate/core": "^0.6.0"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
|
-
"@rcompat/type": "^0.
|
|
33
|
+
"@rcompat/type": "^0.11.1"
|
|
33
34
|
},
|
|
34
35
|
"engines": {
|
|
35
|
-
"node": ">=
|
|
36
|
+
"node": ">=24"
|
|
36
37
|
},
|
|
37
38
|
"imports": {
|
|
38
39
|
"#*": {
|
|
39
|
-
"
|
|
40
|
+
"@primate/source": "./src/private/*.ts",
|
|
40
41
|
"default": "./lib/private/*.js"
|
|
41
42
|
}
|
|
42
43
|
},
|
|
43
44
|
"exports": {
|
|
44
|
-
".": {
|
|
45
|
-
"types": "./lib/index.d.ts"
|
|
46
|
-
},
|
|
47
45
|
"./tsconfig": "./lib/app.tsconfig.json",
|
|
48
|
-
"./runtime/*": {
|
|
49
|
-
"apekit": "./src/runtime/*.ts",
|
|
50
|
-
"default": "./lib/runtime/*.js"
|
|
51
|
-
},
|
|
52
46
|
"./http/*": {
|
|
53
|
-
"
|
|
47
|
+
"@primate/source": "./src/public/http/*.ts",
|
|
54
48
|
"default": "./lib/public/http/*.js"
|
|
55
49
|
},
|
|
56
50
|
"./*": {
|
|
57
|
-
"
|
|
51
|
+
"@primate/source": "./src/public/*.ts",
|
|
58
52
|
"default": "./lib/public/*.js"
|
|
53
|
+
},
|
|
54
|
+
".": {
|
|
55
|
+
"types": "./lib/index.d.ts",
|
|
56
|
+
"@primate/source": "./src/public/index.ts",
|
|
57
|
+
"default": "./lib/public/index.js"
|
|
59
58
|
}
|
|
60
59
|
},
|
|
61
60
|
"scripts": {
|
|
62
|
-
"build": "npm run clean && tsc && cp src/
|
|
61
|
+
"build": "npm run clean && tsc && cp src/app.tsconfig.json lib && cp src/types/app.d.ts lib && cp src/types/index.d.ts lib",
|
|
63
62
|
"clean": "rm -rf ./lib",
|
|
64
|
-
"lint": "eslint ."
|
|
63
|
+
"lint": "eslint .",
|
|
64
|
+
"test": "npx proby"
|
|
65
65
|
}
|
|
66
66
|
}
|
package/lib/public/Module.d.ts
DELETED
package/lib/public/Module.js
DELETED
package/lib/public/orm/wrap.d.ts
DELETED
package/lib/public/orm/wrap.js
DELETED
package/lib/runtime/FileRef.d.ts
DELETED
package/lib/runtime/FileRef.js
DELETED