@primate/go 0.1.1 → 0.1.3

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.1",
3
+ "version": "0.1.3",
4
4
  "description": "Primate Go backend",
5
5
  "homepage": "https://primatejs.com/modules/go",
6
6
  "bugs": "https://github.com/primatejs/primate/issues",
@@ -19,25 +19,26 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "@rcompat/cli": "^0.5.1",
22
- "@rcompat/env": "^0.3.0",
23
- "@rcompat/fs": "^0.4.1",
22
+ "@rcompat/env": "^0.4.0",
23
+ "@rcompat/fs": "^0.6.0",
24
24
  "@rcompat/invariant": "^0.5.0",
25
25
  "@rcompat/object": "^0.5.0",
26
- "@rcompat/platform": "^0.3.0",
26
+ "@rcompat/runtime": "^0.1.0",
27
27
  "@rcompat/stdio": "^0.5.0",
28
- "@primate/core": "^0.1.1"
28
+ "@rcompat/string": "^0.4.0",
29
+ "@primate/core": "^0.1.8"
29
30
  },
30
31
  "peerDependencies": {
31
- "primate": "^0.32.1"
32
+ "primate": "^0.32.3"
32
33
  },
33
34
  "type": "module",
34
35
  "imports": {
35
36
  "#*": {
36
- "@primate/lt": "./src/private/*.js",
37
+ "livetypes": "./src/private/*.js",
37
38
  "default": "./src/private/*.js"
38
39
  },
39
40
  "#error/*": {
40
- "@primate/lt": "./src/private/error/*.js",
41
+ "livetypes": "./src/private/error/*.js",
41
42
  "default": "./src/private/error/*.js"
42
43
  }
43
44
  },
@@ -4,13 +4,16 @@ import log from "@primate/core/log";
4
4
  import dim from "@rcompat/cli/color/dim";
5
5
  import { user } from "@rcompat/env";
6
6
  import file from "@rcompat/fs/file";
7
- import platform from "@rcompat/platform";
7
+ import runtime from "@rcompat/runtime";
8
8
  import execute from "@rcompat/stdio/execute";
9
+ import upperfirst from "@rcompat/string/upperfirst";
10
+ import verbs from "@primate/core/http/verbs";
9
11
 
10
12
  const command = "go";
11
13
  const run = (wasm, go, includes = "request.go") =>
12
14
  `${command} build -o ${wasm} ${go} ${includes}`;
13
- const routes_re = /func (?<route>Get|Post|Put|Delete)/gu;
15
+ const verbs_string = verbs.map(upperfirst).join("|");
16
+ const routes_re = new RegExp(`func (?<route>${verbs_string})`, "gu");
14
17
  const add_setter = route => `
15
18
  var cb${route} js.Func;
16
19
  cb${route} = js.FuncOf(func(this js.Value, args[]js.Value) any {
@@ -34,12 +37,12 @@ import env from "@primate/go/env";
34
37
  import to_request from "@primate/go/to-request";
35
38
  import to_response from "@primate/go/to-response";
36
39
  ${
37
- platform === "bun" ? `
40
+ runtime === "bun" ? `
38
41
  import route_path from "${path}" with { type: "file" };
39
42
  const route = await Bun.file(route_path).arrayBuffer();
40
43
  ` : `
41
- import file from "@rcompat/fs/file";
42
- const route = new Uint8Array(await file(import.meta.dirname+"/${path}")
44
+ import file from "primate/runtime/file";
45
+ const route = new Uint8Array(await file(import.meta.url+"/../${path}")
43
46
  .arrayBuffer());
44
47
  `
45
48
  }