@primate/go 0.1.4 → 0.1.6
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primate/go",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Primate Go backend",
|
|
5
5
|
"homepage": "https://primatejs.com/modules/go",
|
|
6
6
|
"bugs": "https://github.com/primatejs/primate/issues",
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"@rcompat/invariant": "^0.5.0",
|
|
25
25
|
"@rcompat/object": "^0.5.0",
|
|
26
26
|
"@rcompat/runtime": "^0.1.0",
|
|
27
|
-
"@rcompat/stdio": "^0.
|
|
27
|
+
"@rcompat/stdio": "^0.6.0",
|
|
28
28
|
"@rcompat/string": "^0.4.0",
|
|
29
|
-
"@primate/core": "^0.1.
|
|
29
|
+
"@primate/core": "^0.1.10"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"primate": "^0.32.
|
|
32
|
+
"primate": "^0.32.6"
|
|
33
33
|
},
|
|
34
34
|
"type": "module",
|
|
35
35
|
"imports": {
|
package/src/private/build.js
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
import
|
|
1
|
+
import route_error from "#error/route-error";
|
|
2
2
|
import pkgname from "#pkgname";
|
|
3
|
+
import verbs from "@primate/core/http/verbs";
|
|
3
4
|
import log from "@primate/core/log";
|
|
4
5
|
import dim from "@rcompat/cli/color/dim";
|
|
5
6
|
import { user } from "@rcompat/env";
|
|
6
7
|
import file from "@rcompat/fs/file";
|
|
7
8
|
import runtime from "@rcompat/runtime";
|
|
8
9
|
import execute from "@rcompat/stdio/execute";
|
|
10
|
+
import which from "@rcompat/stdio/which";
|
|
9
11
|
import upperfirst from "@rcompat/string/upperfirst";
|
|
10
|
-
import verbs from "@primate/core/http/verbs";
|
|
11
12
|
|
|
12
|
-
const command = "go";
|
|
13
|
+
const command = await which("go");
|
|
14
|
+
const env = {
|
|
15
|
+
GOOS: "js",
|
|
16
|
+
GOARCH: "wasm",
|
|
17
|
+
GOCACHE: (await execute(`${command} env GOCACHE`)).replaceAll("\n", ""),
|
|
18
|
+
};
|
|
19
|
+
|
|
13
20
|
const run = (wasm, go, includes = "request.go") =>
|
|
14
21
|
`${command} build -o ${wasm} ${go} ${includes}`;
|
|
15
22
|
const verbs_string = verbs.map(upperfirst).join("|");
|
|
@@ -139,8 +146,6 @@ const create_meta_files = async (directory, app) => {
|
|
|
139
146
|
;
|
|
140
147
|
};
|
|
141
148
|
|
|
142
|
-
const env = { GOOS: "js", GOARCH: "wasm" };
|
|
143
|
-
|
|
144
149
|
export default ({ extension }) => (app, next) => {
|
|
145
150
|
app.bind(extension, async (directory, file) => {
|
|
146
151
|
const path = directory.join(file);
|
|
@@ -167,7 +172,7 @@ export default ({ extension }) => (app, next) => {
|
|
|
167
172
|
await execute(run(wasm, go, includes.join(" ")),
|
|
168
173
|
{ cwd, env: { HOME: user.HOME, ...env } });
|
|
169
174
|
} catch (error) {
|
|
170
|
-
|
|
175
|
+
route_error(file, error);
|
|
171
176
|
}
|
|
172
177
|
});
|
|
173
178
|
|