primate 0.35.1 → 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/app.tsconfig.json +4 -1
- 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 +14 -23
- 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/serve.js +3 -4
- package/lib/commands/test.js +11 -12
- package/lib/index.d.ts +3 -0
- package/lib/init.js +3 -6
- package/lib/private/test.d.ts +1 -2
- package/lib/public/AppFacade.d.ts +2 -0
- package/lib/public/AppFacade.js +2 -0
- package/lib/public/build.d.ts +2 -0
- package/lib/public/build.js +2 -0
- package/lib/public/db.d.ts +4 -0
- package/lib/public/db.js +3 -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/key.d.ts +2 -0
- package/lib/public/orm/key.js +2 -0
- package/lib/public/orm/relation.d.ts +2 -0
- package/lib/public/orm/relation.js +2 -0
- package/lib/public/orm/store.d.ts +2 -0
- package/lib/public/orm/store.js +2 -0
- package/lib/public/request.d.ts +2 -0
- package/lib/public/request.js +2 -0
- package/lib/public/response.d.ts +3 -22
- package/lib/public/response.js +1 -18
- package/lib/public/route/hook.d.ts +2 -0
- package/lib/public/route/hook.js +2 -0
- package/package.json +31 -30
- package/lib/public/Module.d.ts +0 -2
- package/lib/public/Module.js +0 -2
- package/lib/public/RequestFacade.d.ts +0 -2
- package/lib/public/RequestFacade.js +0 -2
- package/lib/public/database/Store.d.ts +0 -2
- package/lib/public/database/Store.js +0 -2
- package/lib/public/database/default.d.ts +0 -2
- package/lib/public/database/default.js +0 -2
- package/lib/public/database/wrap.d.ts +0 -2
- package/lib/public/database/wrap.js +0 -2
- package/lib/public/fs/FileRef.d.ts +0 -2
- package/lib/public/fs/FileRef.js +0 -2
- package/lib/public/pema.d.ts +0 -2
- package/lib/public/pema.js +0 -2
- package/lib/public/request/Facade.d.ts +0 -2
- package/lib/public/request/Facade.js +0 -2
- package/lib/public/store.d.ts +0 -4
- package/lib/public/store.js +0 -3
- package/lib/public/wasm/instantiate.d.ts +0 -2
- package/lib/public/wasm/instantiate.js +0 -2
- package/lib/runtime/FileRef.d.ts +0 -2
- package/lib/runtime/FileRef.js +0 -2
package/lib/app.d.ts
ADDED
package/lib/app.tsconfig.json
CHANGED
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
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import green from "@rcompat/cli/color/green";
|
|
1
|
+
import color from "@rcompat/cli/color";
|
|
3
2
|
import cancel from "@rcompat/cli/prompts/cancel";
|
|
4
3
|
import intro from "@rcompat/cli/prompts/intro";
|
|
5
4
|
import is_cancel from "@rcompat/cli/prompts/is-cancel";
|
|
@@ -7,7 +6,7 @@ import multiselect from "@rcompat/cli/prompts/multiselect";
|
|
|
7
6
|
import outro from "@rcompat/cli/prompts/outro";
|
|
8
7
|
import select from "@rcompat/cli/prompts/select";
|
|
9
8
|
import text from "@rcompat/cli/prompts/text";
|
|
10
|
-
import
|
|
9
|
+
import fs from "@rcompat/fs";
|
|
11
10
|
function abort() {
|
|
12
11
|
return cancel("Aborted");
|
|
13
12
|
}
|
|
@@ -37,7 +36,6 @@ const DATABASE_OPTIONS = [
|
|
|
37
36
|
{ label: "PostgreSQL", value: "postgresql" },
|
|
38
37
|
{ label: "MySQL", value: "mysql" },
|
|
39
38
|
{ label: "MongoDB", value: "mongodb" },
|
|
40
|
-
{ label: "SurrealDB", value: "surrealdb" },
|
|
41
39
|
];
|
|
42
40
|
// peer deps per frontend (npm names)
|
|
43
41
|
const FRONTEND_PEER_DEPS = {
|
|
@@ -65,7 +63,7 @@ export default async function init() {
|
|
|
65
63
|
});
|
|
66
64
|
if (typeof ans === "symbol" || is_cancel(ans))
|
|
67
65
|
return abort();
|
|
68
|
-
target =
|
|
66
|
+
target = fs.ref(ans);
|
|
69
67
|
if (await empty(target)) {
|
|
70
68
|
directory = ans;
|
|
71
69
|
break; // valid directory found, exit loop
|
|
@@ -128,11 +126,11 @@ export default async function init() {
|
|
|
128
126
|
if (typeof sessions === "symbol" || is_cancel(sessions))
|
|
129
127
|
return abort();
|
|
130
128
|
const withSessions = sessions === "yes";
|
|
131
|
-
await target.create(
|
|
132
|
-
await target.join("routes").create(
|
|
133
|
-
await target.join("views").create(
|
|
129
|
+
await target.create();
|
|
130
|
+
await target.join("routes").create();
|
|
131
|
+
await target.join("views").create();
|
|
134
132
|
if (db !== undefined)
|
|
135
|
-
await target.join("stores").create(
|
|
133
|
+
await target.join("stores").create();
|
|
136
134
|
// files
|
|
137
135
|
await gitignore(target);
|
|
138
136
|
await tsconfig_json(target, { frontends });
|
|
@@ -146,7 +144,7 @@ export default async function init() {
|
|
|
146
144
|
await package_json(target, { directory, runtime });
|
|
147
145
|
const packages = compute_packages({ frontends: frontends, backends: backends, db });
|
|
148
146
|
const install = build_install_command(runtime, packages, directory);
|
|
149
|
-
outro(`${green("done, now run")} ${dim(install.print)}`);
|
|
147
|
+
outro(`${color.green("done, now run")} ${color.dim(install.print)}`);
|
|
150
148
|
process.exit();
|
|
151
149
|
}
|
|
152
150
|
async function empty(directory) {
|
|
@@ -162,24 +160,18 @@ async function empty(directory) {
|
|
|
162
160
|
}
|
|
163
161
|
async function gitignore(root) {
|
|
164
162
|
const gi = root.join(".gitignore");
|
|
165
|
-
await gi.directory.create(
|
|
163
|
+
await gi.directory.create();
|
|
166
164
|
const content = [
|
|
167
165
|
"node_modules",
|
|
168
166
|
"build",
|
|
169
|
-
"dist",
|
|
170
|
-
".DS_Store",
|
|
171
167
|
"*.log",
|
|
172
|
-
"npm-debug.log*",
|
|
173
|
-
"yarn-debug.log*",
|
|
174
|
-
"yarn-error.log*",
|
|
175
|
-
"pnpm-debug.log*",
|
|
176
168
|
"",
|
|
177
169
|
].join("\n");
|
|
178
170
|
await gi.write(content);
|
|
179
171
|
}
|
|
180
172
|
async function app_config(root, c) {
|
|
181
173
|
const config = root.join("config").join("app.ts");
|
|
182
|
-
await config.directory.create(
|
|
174
|
+
await config.directory.create();
|
|
183
175
|
const frontend_imports = c.frontends
|
|
184
176
|
.map((f) => `import ${to_ident(f)} from "@primate/${f}";`)
|
|
185
177
|
.join("\n");
|
|
@@ -193,7 +185,6 @@ async function app_config(root, c) {
|
|
|
193
185
|
const body = `import config from "primate/config";
|
|
194
186
|
${frontend_imports}
|
|
195
187
|
${backend_imports}
|
|
196
|
-
|
|
197
188
|
export default config({
|
|
198
189
|
modules: [
|
|
199
190
|
${modules.join(",\n ")}
|
|
@@ -206,8 +197,8 @@ async function i18n_config(root) {
|
|
|
206
197
|
const locales = root.join("locales");
|
|
207
198
|
const en_us = locales.join("en-US.ts");
|
|
208
199
|
const i18i = root.join("config").join("i18n.ts");
|
|
209
|
-
await en_us.directory.create(
|
|
210
|
-
await i18i.directory.create(
|
|
200
|
+
await en_us.directory.create();
|
|
201
|
+
await i18i.directory.create();
|
|
211
202
|
const locale = `import locale from "primate/i18n/locale";
|
|
212
203
|
export default locale({
|
|
213
204
|
hi: "Hello",
|
|
@@ -227,14 +218,14 @@ export default i18n({
|
|
|
227
218
|
}
|
|
228
219
|
async function session_config(root) {
|
|
229
220
|
const file = root.join("config").join("session.ts");
|
|
230
|
-
await file.directory.create(
|
|
221
|
+
await file.directory.create();
|
|
231
222
|
const body = `import session from "primate/config/session";
|
|
232
223
|
export default session({});`;
|
|
233
224
|
await file.write(body);
|
|
234
225
|
}
|
|
235
226
|
async function database_config(root, db) {
|
|
236
227
|
const file = root.join("config").join("database").join("index.ts");
|
|
237
|
-
await file.directory.create(
|
|
228
|
+
await file.directory.create();
|
|
238
229
|
const ident = to_ident(db);
|
|
239
230
|
const body = `import ${ident} from "@primate/${db}";
|
|
240
231
|
export default ${ident}();`;
|
|
@@ -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/serve.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import root from "@rcompat/fs/project/root";
|
|
1
|
+
import fs from "@rcompat/fs";
|
|
3
2
|
import get_flag from "./get-flag.js";
|
|
4
3
|
const load = async () => {
|
|
5
4
|
try {
|
|
6
|
-
return await root();
|
|
5
|
+
return await fs.project.root();
|
|
7
6
|
}
|
|
8
7
|
catch {
|
|
9
|
-
return
|
|
8
|
+
return fs.resolve();
|
|
10
9
|
}
|
|
11
10
|
};
|
|
12
11
|
// serve from build directory
|
package/lib/commands/test.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { tests } from "#test";
|
|
2
2
|
import build from "@primate/core/build";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import entries from "@rcompat/record/entries";
|
|
3
|
+
import color from "@rcompat/cli/color";
|
|
4
|
+
import entries from "@rcompat/dict/entries";
|
|
5
|
+
import fs from "@rcompat/fs";
|
|
7
6
|
import equals from "@rcompat/test/equals";
|
|
8
7
|
import includes from "@rcompat/test/includes";
|
|
9
8
|
import serve from "./serve.js";
|
|
@@ -18,10 +17,10 @@ const first_error = (left, right) => {
|
|
|
18
17
|
}
|
|
19
18
|
};
|
|
20
19
|
export default async () => {
|
|
21
|
-
await build({ mode: "testing" });
|
|
20
|
+
await build(await fs.project.root(), { mode: "testing" });
|
|
22
21
|
const app = (await serve()).default;
|
|
23
|
-
const files = await (await root()).join(directory)
|
|
24
|
-
.list(
|
|
22
|
+
const files = await (await fs.project.root()).join(directory)
|
|
23
|
+
.list({ filter: f => f.path.endsWith(".ts") || f.path.endsWith(".js") });
|
|
25
24
|
// side effects
|
|
26
25
|
await Promise.all(files.map(file => file.import()));
|
|
27
26
|
for (const test of tests) {
|
|
@@ -114,18 +113,18 @@ export default async () => {
|
|
|
114
113
|
const failed = results.find(result => !result[0]);
|
|
115
114
|
const verb = test.verb.toUpperCase();
|
|
116
115
|
if (failed !== undefined) {
|
|
117
|
-
const
|
|
116
|
+
const route_text = typeof test.route === "string"
|
|
118
117
|
? test.route
|
|
119
118
|
: new URL(test.route.url).pathname;
|
|
120
|
-
console.log(red(`${verb} ${
|
|
119
|
+
console.log(color.red(`${verb} ${route_text}`));
|
|
121
120
|
const expected = JSON.stringify(failed[1]);
|
|
122
121
|
const actual = JSON.stringify(failed[2]);
|
|
123
122
|
const n = first_error(expected, actual);
|
|
124
|
-
console.log(`expected: ${expected.slice(0, n)}${green(expected[n])}${expected.slice(n + 1)}`);
|
|
125
|
-
console.log(`actual: ${actual.slice(0, n)}${red(actual[n])}${actual.slice(n + 1)}`);
|
|
123
|
+
console.log(`expected: ${expected.slice(0, n)}${color.green(expected[n])}${expected.slice(n + 1)}`);
|
|
124
|
+
console.log(`actual: ${actual.slice(0, n)}${color.red(actual[n])}${actual.slice(n + 1)}`);
|
|
126
125
|
}
|
|
127
126
|
else {
|
|
128
|
-
console.log(green(`${verb} ${path}`));
|
|
127
|
+
console.log(color.green(`${verb} ${path}`));
|
|
129
128
|
}
|
|
130
129
|
}
|
|
131
130
|
await app.stop();
|
package/lib/index.d.ts
ADDED
package/lib/init.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
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 pkg from "@rcompat/fs/project/package";
|
|
5
1
|
import find from "./commands/index.js";
|
|
2
|
+
function orange(x) {
|
|
3
|
+
return `\x1b[38;2;255;165;0m${x}\x1b[0m`;
|
|
4
|
+
}
|
|
6
5
|
export default async (...args) => {
|
|
7
6
|
const [command, ...flags] = args;
|
|
8
|
-
const { name, version, } = await (await pkg(import.meta.url)).json();
|
|
9
|
-
print(blue(bold(name)), blue(version), "\n");
|
|
10
7
|
find(command)(flags);
|
|
11
8
|
};
|
|
12
9
|
//# sourceMappingURL=init.js.map
|
package/lib/private/test.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import verbs from "@primate/core/request/verbs";
|
|
2
|
-
import type Dict from "@rcompat/type
|
|
3
|
-
import type JSONValue from "@rcompat/type/JSONValue";
|
|
2
|
+
import type { Dict, JSONValue } from "@rcompat/type";
|
|
4
3
|
export type Body = JSONValue;
|
|
5
4
|
export type MockedResponse = {
|
|
6
5
|
body: {
|
package/lib/public/db.js
ADDED
|
@@ -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/response.d.ts
CHANGED
|
@@ -1,23 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export type { default as ViewResponse } from "@primate/core/frontend/ViewResponse";
|
|
5
|
-
export type { default as ResponseFunction } from "@primate/core/response/ResponseFunction";
|
|
6
|
-
export type { default as ServeApp } from "@primate/core/ServeApp";
|
|
7
|
-
declare const _default: {
|
|
8
|
-
binary: typeof binary;
|
|
9
|
-
error: typeof error;
|
|
10
|
-
json: (body: unknown, init?: ResponseInit) => (app: import("@primate/core/ServeApp").default) => import("@rcompat/type/MaybePromise").default<Response>;
|
|
11
|
-
redirect: (location: string, status?: 302 | 301 | 300 | 304 | 308 | 303 | 307) => import("@primate/core/response/ResponseFunction").default;
|
|
12
|
-
sse: (body: {
|
|
13
|
-
close?(): undefined;
|
|
14
|
-
open(events: {
|
|
15
|
-
send(name: string, data: unknown): undefined;
|
|
16
|
-
}): undefined;
|
|
17
|
-
}, init?: ResponseInit) => (app: import("@primate/core/ServeApp").default) => import("@rcompat/type/MaybePromise").default<Response>;
|
|
18
|
-
text: (body: string, init?: ResponseInit) => (app: import("@primate/core/ServeApp").default) => import("@rcompat/type/MaybePromise").default<Response>;
|
|
19
|
-
view: typeof view;
|
|
20
|
-
ws: (actions: import("@rcompat/http/Actions").default) => import("@primate/core/response/ResponseFunction").default;
|
|
21
|
-
};
|
|
22
|
-
export default _default;
|
|
1
|
+
export type { ServeApp } from "@primate/core";
|
|
2
|
+
export type { ViewResponse } from "@primate/core/client";
|
|
3
|
+
export { default, type ResponseFunction } from "@primate/core/response";
|
|
23
4
|
//# sourceMappingURL=response.d.ts.map
|
package/lib/public/response.js
CHANGED
|
@@ -1,19 +1,2 @@
|
|
|
1
|
-
|
|
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
|
-
};
|
|
1
|
+
export { default } from "@primate/core/response";
|
|
19
2
|
//# sourceMappingURL=response.js.map
|
package/package.json
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
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",
|
|
7
|
+
"type": "module",
|
|
7
8
|
"license": "MIT",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/primate-run/primate",
|
|
12
|
+
"directory": "packages/primate"
|
|
13
|
+
},
|
|
8
14
|
"files": [
|
|
9
15
|
"/lib/app.tsconfig.json",
|
|
10
16
|
"/lib/**/*.js",
|
|
@@ -12,54 +18,49 @@
|
|
|
12
18
|
"!/**/*.spec.*"
|
|
13
19
|
],
|
|
14
20
|
"bin": "lib/bin.js",
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
"
|
|
21
|
+
"types": "lib/index.d.ts",
|
|
22
|
+
"dependencies": {
|
|
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"
|
|
19
31
|
},
|
|
20
32
|
"devDependencies": {
|
|
21
|
-
"@rcompat/
|
|
22
|
-
"pema": "^0.4.0"
|
|
23
|
-
},
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"@rcompat/args": "^0.8.0",
|
|
26
|
-
"@rcompat/cli": "^0.11.3",
|
|
27
|
-
"@rcompat/fs": "^0.22.3",
|
|
28
|
-
"@rcompat/http": "~0.16.0",
|
|
29
|
-
"@rcompat/runtime": "^0.6.0",
|
|
30
|
-
"@rcompat/string": "^0.10.0",
|
|
31
|
-
"@rcompat/test": "^0.5.0",
|
|
32
|
-
"@primate/core": "^0.4.4"
|
|
33
|
+
"@rcompat/type": "^0.11.1"
|
|
33
34
|
},
|
|
34
35
|
"engines": {
|
|
35
|
-
"node": ">=
|
|
36
|
+
"node": ">=24"
|
|
36
37
|
},
|
|
37
|
-
"type": "module",
|
|
38
38
|
"imports": {
|
|
39
39
|
"#*": {
|
|
40
|
-
"
|
|
40
|
+
"@primate/source": "./src/private/*.ts",
|
|
41
41
|
"default": "./lib/private/*.js"
|
|
42
|
-
}
|
|
43
|
-
"#runtime/FileRef": "@rcompat/fs/FileRef"
|
|
42
|
+
}
|
|
44
43
|
},
|
|
45
44
|
"exports": {
|
|
46
45
|
"./tsconfig": "./lib/app.tsconfig.json",
|
|
47
|
-
"./runtime/*": {
|
|
48
|
-
"apekit": "./src/runtime/*.ts",
|
|
49
|
-
"default": "./lib/runtime/*.js"
|
|
50
|
-
},
|
|
51
46
|
"./http/*": {
|
|
52
|
-
"
|
|
47
|
+
"@primate/source": "./src/public/http/*.ts",
|
|
53
48
|
"default": "./lib/public/http/*.js"
|
|
54
49
|
},
|
|
55
50
|
"./*": {
|
|
56
|
-
"
|
|
51
|
+
"@primate/source": "./src/public/*.ts",
|
|
57
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"
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
|
-
"build": "npm run clean && tsc && cp src/app.tsconfig.json lib",
|
|
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",
|
|
62
62
|
"clean": "rm -rf ./lib",
|
|
63
|
-
"lint": "eslint ."
|
|
63
|
+
"lint": "eslint .",
|
|
64
|
+
"test": "npx proby"
|
|
64
65
|
}
|
|
65
66
|
}
|
package/lib/public/Module.d.ts
DELETED
package/lib/public/Module.js
DELETED
package/lib/public/fs/FileRef.js
DELETED
package/lib/public/pema.d.ts
DELETED
package/lib/public/pema.js
DELETED
package/lib/public/store.d.ts
DELETED
package/lib/public/store.js
DELETED
package/lib/runtime/FileRef.d.ts
DELETED
package/lib/runtime/FileRef.js
DELETED