ttsc 0.4.3-dev.20260426-2 → 0.4.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.
@@ -0,0 +1,118 @@
1
+ package main
2
+
3
+ import (
4
+ "flag"
5
+ "fmt"
6
+ "io"
7
+ "os"
8
+ "runtime"
9
+ "strings"
10
+ )
11
+
12
+ var (
13
+ version = "0.0.0-dev"
14
+ commit = "dev"
15
+ date = "unknown"
16
+ )
17
+
18
+ var (
19
+ stdout io.Writer = os.Stdout
20
+ stderr io.Writer = os.Stderr
21
+ )
22
+
23
+ func main() {
24
+ os.Exit(run(os.Args[1:]))
25
+ }
26
+
27
+ func run(args []string) int {
28
+ if len(args) == 0 {
29
+ printHelp(stdout)
30
+ return 0
31
+ }
32
+
33
+ switch args[0] {
34
+ case "-h", "--help", "help":
35
+ printHelp(stdout)
36
+ return 0
37
+ case "-v", "--version", "version":
38
+ printVersion(stdout)
39
+ return 0
40
+ case "demo":
41
+ return runDemo(args[1:])
42
+ case "build", "check", "transform":
43
+ fmt.Fprintf(
44
+ stderr,
45
+ "ttsc platform helper: %s is provided by the JavaScript ttsc CLI using the consuming project's @typescript/native-preview, or by a plugin-selected native sidecar.\n",
46
+ args[0],
47
+ )
48
+ return 2
49
+ default:
50
+ fmt.Fprintf(stderr, "ttsc platform helper: unknown command %q\n", args[0])
51
+ fmt.Fprintln(stderr, `ttsc platform helper: run "ttsc --help" through the JavaScript CLI for compiler usage.`)
52
+ return 2
53
+ }
54
+ }
55
+
56
+ func printVersion(w io.Writer) {
57
+ fmt.Fprintf(
58
+ w,
59
+ "ttsc platform helper %s (commit %s, built %s, %s/%s, go %s)\n",
60
+ version,
61
+ commit,
62
+ date,
63
+ runtime.GOOS,
64
+ runtime.GOARCH,
65
+ runtime.Version(),
66
+ )
67
+ }
68
+
69
+ func printHelp(w io.Writer) {
70
+ fmt.Fprintln(w, strings.TrimSpace(`
71
+ ttsc platform helper.
72
+
73
+ This binary is a small compatibility helper shipped by @ttsc platform packages.
74
+ Compiler and runner commands are provided by the JavaScript ttsc/ttsx launchers,
75
+ which resolve the consuming project's @typescript/native-preview binary and any
76
+ plugin-selected native sidecar.
77
+
78
+ Usage:
79
+ ttsc --version
80
+ ttsc demo --type=string
81
+ `))
82
+ }
83
+
84
+ func runDemo(args []string) int {
85
+ fs := flag.NewFlagSet("demo", flag.ContinueOnError)
86
+ fs.SetOutput(stderr)
87
+ typ := fs.String("type", "string", "atomic type to simulate")
88
+ if err := fs.Parse(args); err != nil {
89
+ return 2
90
+ }
91
+
92
+ arrow, err := demoArrow(*typ)
93
+ if err != nil {
94
+ fmt.Fprintf(stderr, "ttsc platform helper demo: %v\n", err)
95
+ return 2
96
+ }
97
+
98
+ fmt.Fprintf(stdout, "// demo<%s> -> emitted by ttsc platform helper %s\n", *typ, version)
99
+ fmt.Fprintln(stdout, arrow)
100
+ return 0
101
+ }
102
+
103
+ func demoArrow(name string) (string, error) {
104
+ switch strings.ToLower(name) {
105
+ case "any":
106
+ return "(input) => true", nil
107
+ case "boolean":
108
+ return `(input) => "boolean" === typeof input`, nil
109
+ case "number":
110
+ return `(input) => "number" === typeof input`, nil
111
+ case "bigint":
112
+ return `(input) => "bigint" === typeof input`, nil
113
+ case "string", "":
114
+ return `(input) => "string" === typeof input`, nil
115
+ default:
116
+ return "", fmt.Errorf("unknown --type value %q (want: string|number|boolean|bigint|any)", name)
117
+ }
118
+ }
package/lib/index.d.ts CHANGED
@@ -4,8 +4,8 @@
4
4
  * Exports:
5
5
  * - tsgo helpers (`resolveTsgo`, …) — resolve the consuming project's
6
6
  * `@typescript/native-preview` compiler binary.
7
- * - platform helpers (`resolveBinary`, `installHint`, …) — legacy helpers
8
- * for plugin-selected native sidecars.
7
+ * - platform helpers (`resolveBinary`, `installHint`, …) — compatibility
8
+ * helper resolution for commands such as `ttsc demo`.
9
9
  * - programmatic API (`transform`, `build`, `check`, `version`) — a thin
10
10
  * TS wrapper around the consumer `tsgo` binary plus JS output-plugin
11
11
  * hooks. Adapters never have to shell out themselves; they call these
package/lib/index.js CHANGED
@@ -5,8 +5,8 @@
5
5
  * Exports:
6
6
  * - tsgo helpers (`resolveTsgo`, …) — resolve the consuming project's
7
7
  * `@typescript/native-preview` compiler binary.
8
- * - platform helpers (`resolveBinary`, `installHint`, …) — legacy helpers
9
- * for plugin-selected native sidecars.
8
+ * - platform helpers (`resolveBinary`, `installHint`, …) — compatibility
9
+ * helper resolution for commands such as `ttsc demo`.
10
10
  * - programmatic API (`transform`, `build`, `check`, `version`) — a thin
11
11
  * TS wrapper around the consumer `tsgo` binary plus JS output-plugin
12
12
  * hooks. Adapters never have to shell out themselves; they call these
package/lib/platform.d.ts CHANGED
@@ -1,18 +1,22 @@
1
1
  /**
2
- * Platform detection and binary resolution for ttsc.
2
+ * Platform detection and helper-binary resolution for ttsc.
3
3
  *
4
4
  * This is the tested implementation used by the ttsc launcher after build.
5
5
  * Keep it pure and dependency-free so it can be unit-tested without spawning
6
6
  * any child process.
7
7
  *
8
- * Resolution order:
8
+ * The platform packages now ship a small compatibility helper, not the
9
+ * TypeScript-Go compiler. Compiler calls resolve the consuming project's
10
+ * `@typescript/native-preview` through `tsgo.ts`.
11
+ *
12
+ * Helper resolution order:
9
13
  *
10
14
  * 1. `TTSC_BINARY` environment variable (absolute path). Highest priority —
11
15
  * lets local devs or CI point at an ad-hoc build without touching
12
16
  * node_modules.
13
17
  * 2. `@ttsc/{platform}-{arch}/bin/ttsc{.exe}` optional dependency.
14
- * Standard distribution path.
15
- * 3. A package-local `native/ttsc-native` binary. Used by this
18
+ * Standard distribution path for compatibility helper commands.
19
+ * 3. A package-local `native/ttsc-native` helper. Used by this
16
20
  * repository's local `pnpm run build` output before the
17
21
  * platform packages exist on npm.
18
22
  *
@@ -41,7 +45,7 @@ export interface ResolveOptions {
41
45
  }
42
46
  /** Canonical key `{platform}-{arch}` used in the binary package name. */
43
47
  export declare function platformKey(opts?: ResolveOptions): string;
44
- /** Binary filename for the current platform (`.exe` on Windows, else none). */
48
+ /** Helper binary filename for the current platform (`.exe` on Windows, else none). */
45
49
  export declare function binaryName(opts?: ResolveOptions): string;
46
50
  /**
47
51
  * Resolve the optional-dependency module request string for the current
@@ -54,7 +58,7 @@ export declare const SUPPORTED_PLATFORMS: readonly string[];
54
58
  /** True if the given platform key is in the supported list. */
55
59
  export declare function isSupported(key: string): boolean;
56
60
  /**
57
- * Resolve an absolute path to the ttsc binary using the documented priority
61
+ * Resolve an absolute path to the ttsc helper using the documented priority
58
62
  * order. Returns `null` when every strategy fails — the launcher then prints
59
63
  * the install hint and exits non-zero.
60
64
  */
package/lib/platform.js CHANGED
@@ -1,19 +1,23 @@
1
1
  "use strict";
2
2
  /**
3
- * Platform detection and binary resolution for ttsc.
3
+ * Platform detection and helper-binary resolution for ttsc.
4
4
  *
5
5
  * This is the tested implementation used by the ttsc launcher after build.
6
6
  * Keep it pure and dependency-free so it can be unit-tested without spawning
7
7
  * any child process.
8
8
  *
9
- * Resolution order:
9
+ * The platform packages now ship a small compatibility helper, not the
10
+ * TypeScript-Go compiler. Compiler calls resolve the consuming project's
11
+ * `@typescript/native-preview` through `tsgo.ts`.
12
+ *
13
+ * Helper resolution order:
10
14
  *
11
15
  * 1. `TTSC_BINARY` environment variable (absolute path). Highest priority —
12
16
  * lets local devs or CI point at an ad-hoc build without touching
13
17
  * node_modules.
14
18
  * 2. `@ttsc/{platform}-{arch}/bin/ttsc{.exe}` optional dependency.
15
- * Standard distribution path.
16
- * 3. A package-local `native/ttsc-native` binary. Used by this
19
+ * Standard distribution path for compatibility helper commands.
20
+ * 3. A package-local `native/ttsc-native` helper. Used by this
17
21
  * repository's local `pnpm run build` output before the
18
22
  * platform packages exist on npm.
19
23
  *
@@ -69,7 +73,7 @@ function platformKey(opts = {}) {
69
73
  const arch = opts.arch ?? process.arch;
70
74
  return `${platform}-${arch}`;
71
75
  }
72
- /** Binary filename for the current platform (`.exe` on Windows, else none). */
76
+ /** Helper binary filename for the current platform (`.exe` on Windows, else none). */
73
77
  function binaryName(opts = {}) {
74
78
  const platform = opts.platform ?? process.platform;
75
79
  return platform === "win32" ? "ttsc.exe" : "ttsc";
@@ -99,7 +103,7 @@ function isSupported(key) {
99
103
  return exports.SUPPORTED_PLATFORMS.includes(key);
100
104
  }
101
105
  /**
102
- * Resolve an absolute path to the ttsc binary using the documented priority
106
+ * Resolve an absolute path to the ttsc helper using the documented priority
103
107
  * order. Returns `null` when every strategy fails — the launcher then prints
104
108
  * the install hint and exits non-zero.
105
109
  */
@@ -140,7 +144,7 @@ function installHint(opts = {}) {
140
144
  const pkg = `@ttsc/${key}`;
141
145
  const supported = exports.SUPPORTED_PLATFORMS.join(", ");
142
146
  return [
143
- `ttsc: platform-specific binary not found (${pkg}).`,
147
+ `ttsc: platform-specific helper binary not found (${pkg}).`,
144
148
  `Platform: ${opts.platform ?? process.platform}/${opts.arch ?? process.arch}.`,
145
149
  ``,
146
150
  `Resolution order:`,
@@ -1 +1 @@
1
- {"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,MAAY,EAAE,oCAAgB;AAC9B,MAAY,IAAI,sCAAkB;AAuBlC,yEAAyE;AACzE,qBAA4B,IAAI,GAAmB,EAAE;IACnD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC;IACnD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IACvC,OAAO,GAAG,QAAQ,IAAI,IAAI,EAAE,CAAC;AAC/B,CAAC;AAED,+EAA+E;AAC/E,oBAA2B,IAAI,GAAmB,EAAE;IAClD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC;IACnD,OAAO,QAAQ,KAAK,OAAO,CAAC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,MAAM,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACrF,CAAC;IACD,OAAO,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;AAC3E,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ttsc",
3
- "version": "0.4.3-dev.20260426-2",
3
+ "version": "0.4.3",
4
4
  "description": "General-purpose TypeScript-Go compiler, plugin host, and runtime.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -31,13 +31,13 @@
31
31
  "rimraf": "^6.1.2"
32
32
  },
33
33
  "optionalDependencies": {
34
- "@ttsc/linux-x64": "0.4.3-dev.20260426-2",
35
- "@ttsc/linux-arm": "0.4.3-dev.20260426-2",
36
- "@ttsc/linux-arm64": "0.4.3-dev.20260426-2",
37
- "@ttsc/darwin-x64": "0.4.3-dev.20260426-2",
38
- "@ttsc/darwin-arm64": "0.4.3-dev.20260426-2",
39
- "@ttsc/win32-x64": "0.4.3-dev.20260426-2",
40
- "@ttsc/win32-arm64": "0.4.3-dev.20260426-2"
34
+ "@ttsc/linux-x64": "0.4.3",
35
+ "@ttsc/linux-arm64": "0.4.3",
36
+ "@ttsc/darwin-x64": "0.4.3",
37
+ "@ttsc/darwin-arm64": "0.4.3",
38
+ "@ttsc/win32-x64": "0.4.3",
39
+ "@ttsc/linux-arm": "0.4.3",
40
+ "@ttsc/win32-arm64": "0.4.3"
41
41
  },
42
42
  "sideEffects": false,
43
43
  "files": [
package/src/index.ts CHANGED
@@ -4,8 +4,8 @@
4
4
  * Exports:
5
5
  * - tsgo helpers (`resolveTsgo`, …) — resolve the consuming project's
6
6
  * `@typescript/native-preview` compiler binary.
7
- * - platform helpers (`resolveBinary`, `installHint`, …) — legacy helpers
8
- * for plugin-selected native sidecars.
7
+ * - platform helpers (`resolveBinary`, `installHint`, …) — compatibility
8
+ * helper resolution for commands such as `ttsc demo`.
9
9
  * - programmatic API (`transform`, `build`, `check`, `version`) — a thin
10
10
  * TS wrapper around the consumer `tsgo` binary plus JS output-plugin
11
11
  * hooks. Adapters never have to shell out themselves; they call these
package/src/platform.ts CHANGED
@@ -1,18 +1,22 @@
1
1
  /**
2
- * Platform detection and binary resolution for ttsc.
2
+ * Platform detection and helper-binary resolution for ttsc.
3
3
  *
4
4
  * This is the tested implementation used by the ttsc launcher after build.
5
5
  * Keep it pure and dependency-free so it can be unit-tested without spawning
6
6
  * any child process.
7
7
  *
8
- * Resolution order:
8
+ * The platform packages now ship a small compatibility helper, not the
9
+ * TypeScript-Go compiler. Compiler calls resolve the consuming project's
10
+ * `@typescript/native-preview` through `tsgo.ts`.
11
+ *
12
+ * Helper resolution order:
9
13
  *
10
14
  * 1. `TTSC_BINARY` environment variable (absolute path). Highest priority —
11
15
  * lets local devs or CI point at an ad-hoc build without touching
12
16
  * node_modules.
13
17
  * 2. `@ttsc/{platform}-{arch}/bin/ttsc{.exe}` optional dependency.
14
- * Standard distribution path.
15
- * 3. A package-local `native/ttsc-native` binary. Used by this
18
+ * Standard distribution path for compatibility helper commands.
19
+ * 3. A package-local `native/ttsc-native` helper. Used by this
16
20
  * repository's local `pnpm run build` output before the
17
21
  * platform packages exist on npm.
18
22
  *
@@ -51,7 +55,7 @@ export function platformKey(opts: ResolveOptions = {}): string {
51
55
  return `${platform}-${arch}`;
52
56
  }
53
57
 
54
- /** Binary filename for the current platform (`.exe` on Windows, else none). */
58
+ /** Helper binary filename for the current platform (`.exe` on Windows, else none). */
55
59
  export function binaryName(opts: ResolveOptions = {}): string {
56
60
  const platform = opts.platform ?? process.platform;
57
61
  return platform === "win32" ? "ttsc.exe" : "ttsc";
@@ -85,7 +89,7 @@ export function isSupported(key: string): boolean {
85
89
  }
86
90
 
87
91
  /**
88
- * Resolve an absolute path to the ttsc binary using the documented priority
92
+ * Resolve an absolute path to the ttsc helper using the documented priority
89
93
  * order. Returns `null` when every strategy fails — the launcher then prints
90
94
  * the install hint and exits non-zero.
91
95
  */
@@ -127,7 +131,7 @@ export function installHint(opts: ResolveOptions = {}): string {
127
131
  const pkg = `@ttsc/${key}`;
128
132
  const supported = SUPPORTED_PLATFORMS.join(", ");
129
133
  return [
130
- `ttsc: platform-specific binary not found (${pkg}).`,
134
+ `ttsc: platform-specific helper binary not found (${pkg}).`,
131
135
  `Platform: ${opts.platform ?? process.platform}/${opts.arch ?? process.arch}.`,
132
136
  ``,
133
137
  `Resolution order:`,