@tiara-stack/tsgo-effect 0.1.0 → 0.1.2

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.
@@ -1,11 +1,17 @@
1
1
  #!/usr/bin/env node
2
2
  import { spawnSync } from "node:child_process";
3
3
  import { existsSync } from "node:fs";
4
+ import { createRequire } from "node:module";
4
5
  import { dirname, join, resolve } from "node:path";
5
6
  import { fileURLToPath } from "node:url";
6
7
 
7
8
  const executableName = process.platform === "win32" ? "tsgo.exe" : "tsgo";
8
9
  const packageRoot = findPackageRoot(fileURLToPath(import.meta.url));
10
+ const require = createRequire(import.meta.url);
11
+ const platformPackageName =
12
+ process.platform === "linux" && process.arch === "x64"
13
+ ? "@tiara-stack/tsgo-effect-linux-x64"
14
+ : undefined;
9
15
 
10
16
  const binaryPath = resolveBinary();
11
17
 
@@ -31,6 +37,7 @@ function resolveBinary() {
31
37
  for (const candidate of [
32
38
  process.env.TIARA_TSGO_EFFECT_PATH,
33
39
  process.env.TIARA_TSGO_PATH,
40
+ platformPackageName ? resolvePackageBinary(platformPackageName) : undefined,
34
41
  join(packageRoot, "vendor", `${process.platform}-${process.arch}`, executableName),
35
42
  findUp(process.cwd(), join("native", "typescript-go", "built", "local", executableName)),
36
43
  findUp(packageRoot, join("native", "typescript-go", "built", "local", executableName)),
@@ -45,7 +52,7 @@ function resolveBinary() {
45
52
  console.error(
46
53
  [
47
54
  "Unable to locate tsgo-effect.",
48
- "Build native/typescript-go/built/local/tsgo or install a platform package that provides vendor binaries.",
55
+ "Build native/typescript-go/built/local/tsgo or install @tiara-stack/tsgo-effect-linux-x64.",
49
56
  "Set TIARA_TSGO_EFFECT_PATH to override the binary path.",
50
57
  ].join(" "),
51
58
  );
@@ -55,6 +62,18 @@ function resolveBinary() {
55
62
  return binaryPath;
56
63
  }
57
64
 
65
+ /**
66
+ * @param {string} packageName
67
+ * @returns {string | undefined}
68
+ */
69
+ function resolvePackageBinary(packageName) {
70
+ try {
71
+ return join(dirname(require.resolve(`${packageName}/package.json`)), "vendor", executableName);
72
+ } catch {
73
+ return undefined;
74
+ }
75
+ }
76
+
58
77
  /**
59
78
  * @param {string} start
60
79
  * @returns {string}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiara-stack/tsgo-effect",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Patched tsgo compiler binary for Tiara Stack tooling.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -13,8 +13,7 @@
13
13
  },
14
14
  "files": [
15
15
  "bin",
16
- "dist",
17
- "vendor"
16
+ "dist"
18
17
  ],
19
18
  "type": "module",
20
19
  "exports": {
@@ -39,5 +38,8 @@
39
38
  "@types/node": "catalog:",
40
39
  "vite": "catalog:",
41
40
  "vite-plus": "catalog:"
41
+ },
42
+ "optionalDependencies": {
43
+ "@tiara-stack/tsgo-effect-linux-x64": "0.1.0"
42
44
  }
43
45
  }
Binary file