@primate/go 0.8.0 → 0.10.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/private/default.js +23 -21
- package/lib/private/vendored/wasm_exec.d.ts +1 -1
- package/package.json +12 -12
package/lib/private/default.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import E from "#errors";
|
|
2
2
|
import module from "#module";
|
|
3
3
|
import server from "@primate/core/server";
|
|
4
|
-
import assert from "@rcompat/assert";
|
|
5
4
|
import env from "@rcompat/env";
|
|
6
5
|
import { CodeError } from "@rcompat/error";
|
|
7
6
|
import io from "@rcompat/io";
|
|
@@ -67,26 +66,29 @@ export default function default_module(input = {}) {
|
|
|
67
66
|
setup({ onBuild }) {
|
|
68
67
|
onBuild(async (app) => {
|
|
69
68
|
await check_version(app);
|
|
70
|
-
app.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
app.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
69
|
+
app.register(module.name, {
|
|
70
|
+
type: "backend",
|
|
71
|
+
extensions: [extension],
|
|
72
|
+
async onLoad(route) {
|
|
73
|
+
const relative = route.debase(app.path.routes);
|
|
74
|
+
const route_id = relative.path.slice(1, -relative.extension.length);
|
|
75
|
+
const build_file = app.runpath("wasm", `${route_id}.go`);
|
|
76
|
+
await build_file.directory.create();
|
|
77
|
+
await build_file.write(postlude(app, await route.text(), route_id));
|
|
78
|
+
const wasm = app.runpath("wasm", `${route_id}.wasm`);
|
|
79
|
+
try {
|
|
80
|
+
app.log.info `compiling ${(route.debase(app.root))} to WebAssembly`;
|
|
81
|
+
await io.run(run(wasm, build_file), {
|
|
82
|
+
cwd: build_file.directory.path,
|
|
83
|
+
env: ENV,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
throw E.backend_error(route, error);
|
|
88
|
+
}
|
|
89
|
+
await build_file.remove();
|
|
90
|
+
return wrap(route_id);
|
|
91
|
+
},
|
|
90
92
|
});
|
|
91
93
|
});
|
|
92
94
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primate/go",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Go backend for Primate",
|
|
5
5
|
"homepage": "https://primate.run/docs/backend/go",
|
|
6
6
|
"bugs": "https://github.com/primate-run/primate/issues",
|
|
@@ -17,20 +17,20 @@
|
|
|
17
17
|
"!/**/*.spec.*"
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@
|
|
21
|
-
"@rcompat/
|
|
22
|
-
"@rcompat/
|
|
23
|
-
"@rcompat/
|
|
24
|
-
"@rcompat/
|
|
25
|
-
"@rcompat/
|
|
26
|
-
"@
|
|
27
|
-
"pema": "^0.
|
|
20
|
+
"@primate/core": "^0.10.0",
|
|
21
|
+
"@rcompat/assert": "^0.14.0",
|
|
22
|
+
"@rcompat/env": "^0.23.0",
|
|
23
|
+
"@rcompat/error": "^0.9.0",
|
|
24
|
+
"@rcompat/fs": "^0.35.1",
|
|
25
|
+
"@rcompat/io": "^0.11.0",
|
|
26
|
+
"@rcompat/is": "^0.12.1",
|
|
27
|
+
"pema": "^0.10.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@rcompat/type": "^0.
|
|
30
|
+
"@rcompat/type": "^0.18.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"primate": "^0.
|
|
33
|
+
"primate": "^0.41.0"
|
|
34
34
|
},
|
|
35
35
|
"imports": {
|
|
36
36
|
"#vendored/wasm_exec": "./src/private/vendored/wasm_exec.js",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
|
-
"build": "
|
|
54
|
+
"build": "pnpm run clean && tsc",
|
|
55
55
|
"clean": "rm -rf ./lib",
|
|
56
56
|
"lint": "eslint ."
|
|
57
57
|
}
|