ttsc 0.34.2 → 0.34.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,69 @@
1
+ // Package compileraliases discovers npm aliases by their declared package target.
2
+ package compileraliases
3
+
4
+ import (
5
+ "encoding/json"
6
+ "os"
7
+ "path/filepath"
8
+ "sort"
9
+ "strings"
10
+ )
11
+
12
+ // Names returns declared npm aliases targeting typescript, followed by the
13
+ // ordinary typescript name. The nearest ancestor manifest declaring TypeScript
14
+ // or its aliases owns discovery; installed dependency trees are not scanned.
15
+ // Callers still resolve each name and verify its installed package identity.
16
+ //
17
+ // @evidence contracts/common.md#principled-implementation npm aliases declare a real target independently of their exposed name. Ancestor manifest dependency maps supply those arbitrary names, while installed identity and native version remain with the caller.
18
+ // @evidence contracts/common.md#clear-and-simple-design This package owns declaration discovery once for all Go config evaluators; each evaluator retains its existing Node-style manifest and platform resolution.
19
+ // @evidence contracts/common.md#prohibited-implementation-shortcuts Only npm's target syntax and the real typescript identity are constants. No alias name, consumer or fixture controls selection.
20
+ // @evidence contracts/common.md#meaningful-documentation The comment defines filename anchors, ancestor traversal, output ordering and the caller's verification obligation; read or parse errors propagate except absent manifests.
21
+ // @evidence contracts/portability.md#os-neutral-implementation filepath.Abs, Dir and Join follow native paths; os.ReadFile closes its handles and no shell or filesystem case assumption is used.
22
+ // @evidence contracts/performance.md#efficient-algorithms The walk parses ancestor manifest bytes and visits D dependency declarations once; A unique aliases require O(A) retained names and O(A log A) sorting. No installed package population is traversed.
23
+ //
24
+ // @evidenceExclude contracts/performance.md#reuse-equivalent-work Mutable project declarations have no invalidation owner here, so every call reads current bytes.
25
+ // @evidenceExclude contracts/performance.md#bound-retention-and-release-resources Synchronous reads retain no handle; the returned name slice transfers to the caller.
26
+ func Names(anchor string) ([]string, error) {
27
+ absolute, err := filepath.Abs(anchor)
28
+ if err != nil {
29
+ return nil, err
30
+ }
31
+ aliases := make(map[string]struct{})
32
+ for directory := filepath.Dir(absolute); ; directory = filepath.Dir(directory) {
33
+ body, err := os.ReadFile(filepath.Join(directory, "package.json"))
34
+ if err != nil && !os.IsNotExist(err) {
35
+ return nil, err
36
+ }
37
+ if err == nil {
38
+ var project map[string]any
39
+ if err := json.Unmarshal(body, &project); err != nil {
40
+ return nil, err
41
+ }
42
+ declaresTypeScript := false
43
+ for _, field := range []string{"dependencies", "devDependencies", "optionalDependencies"} {
44
+ dependencies, _ := project[field].(map[string]any)
45
+ if _, exists := dependencies["typescript"]; exists {
46
+ declaresTypeScript = true
47
+ }
48
+ for name, value := range dependencies {
49
+ specifier, ok := value.(string)
50
+ if name != "typescript" && ok && (specifier == "npm:typescript" || strings.HasPrefix(specifier, "npm:typescript@")) {
51
+ aliases[name] = struct{}{}
52
+ }
53
+ }
54
+ }
55
+ if declaresTypeScript || len(aliases) != 0 {
56
+ break
57
+ }
58
+ }
59
+ if filepath.Dir(directory) == directory {
60
+ break
61
+ }
62
+ }
63
+ names := make([]string, 0, len(aliases)+1)
64
+ for name := range aliases {
65
+ names = append(names, name)
66
+ }
67
+ sort.Strings(names)
68
+ return append(names, "typescript"), nil
69
+ }
@@ -0,0 +1,57 @@
1
+ package compileraliases
2
+
3
+ import (
4
+ "os"
5
+ "path/filepath"
6
+ "reflect"
7
+ "testing"
8
+ )
9
+
10
+ // TestNamesUsesTheNearestCompilerDeclaration verifies npm alias discovery from
11
+ // declarations rather than a reserved exposed name.
12
+ //
13
+ // 1. Declare arbitrary aliases across all supported dependency maps.
14
+ // 2. Discover them from a nested file, excluding a different npm target.
15
+ // 3. Give the nested package its own compiler declaration and require isolation.
16
+ //
17
+ // @evidence contracts/testing.md#behavioral-verification Calls Names over authored manifests and compares the candidate names it returns; an npm target lookalike must be excluded and a workspace's own compiler declaration must stop ancestor alias discovery.
18
+ // @evidence contracts/testing.md#independent-expectations The aliases alpha, middle and zeta target typescript by literal npm syntax; the contract sorts them before the ordinary typescript fallback. A local typescript declaration independently prescribes the singleton fallback.
19
+ // @evidence contracts/testing.md#distinguishing-cases Exercises dependencies, devDependencies and optionalDependencies, an unrelated target, nested discovery, local declaration isolation, malformed metadata failure and an absent local manifest after removal.
20
+ // @evidence contracts/testing.md#execution-ownership This directly discovered Go unit calls Names in-process over t.TempDir inputs. It resolves no installed compiler and starts no process.
21
+ func TestNamesUsesTheNearestCompilerDeclaration(t *testing.T) {
22
+ root := t.TempDir()
23
+ nested := filepath.Join(root, "workspace")
24
+ if err := os.MkdirAll(nested, 0o755); err != nil {
25
+ t.Fatal(err)
26
+ }
27
+ write := func(file, body string) {
28
+ t.Helper()
29
+ if err := os.WriteFile(file, []byte(body), 0o644); err != nil {
30
+ t.Fatal(err)
31
+ }
32
+ }
33
+ write(filepath.Join(root, "package.json"), `{"dependencies":{"zeta":"npm:typescript@7","unrelated":"npm:typescript-helper@7"},"devDependencies":{"alpha":"npm:typescript@next"},"optionalDependencies":{"middle":"npm:typescript"}}`)
34
+ anchor := filepath.Join(nested, "lint.config.ts")
35
+ got, err := Names(anchor)
36
+ want := []string{"alpha", "middle", "zeta", "typescript"}
37
+ if err != nil || !reflect.DeepEqual(got, want) {
38
+ t.Fatalf("Names = %v, %v; want %v", got, err, want)
39
+ }
40
+ manifest := filepath.Join(nested, "package.json")
41
+ write(manifest, `{"devDependencies":{"typescript":"7.0.2"}}`)
42
+ got, err = Names(anchor)
43
+ if err != nil || !reflect.DeepEqual(got, []string{"typescript"}) {
44
+ t.Fatalf("local Names = %v, %v; want [typescript]", got, err)
45
+ }
46
+ write(manifest, "{")
47
+ if _, err := Names(anchor); err == nil {
48
+ t.Fatal("malformed manifest must fail discovery")
49
+ }
50
+ if err := os.Remove(manifest); err != nil {
51
+ t.Fatal(err)
52
+ }
53
+ got, err = Names(anchor)
54
+ if err != nil || !reflect.DeepEqual(got, want) {
55
+ t.Fatalf("restored Names = %v, %v; want %v", got, err, want)
56
+ }
57
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Find native TypeScript from a filename used as a Node resolution anchor.
3
+ *
4
+ * The nearest ancestor manifest declaring TypeScript or its npm aliases owns
5
+ * discovery. Its aliases targeting `typescript` precede the ordinary name. A
6
+ * manifest reporting a compiler major below 7 belongs to the JavaScript
7
+ * compiler and is skipped. Missing or nonnumeric version metadata retains the
8
+ * existing path-discovery behavior; executable availability is the caller's
9
+ * responsibility. Alias candidates must report the actual package name
10
+ * `typescript` and a native major. Multiple distinct native alias installs are
11
+ * ambiguous and require an explicit binary. Read and parse errors propagate,
12
+ * except a disappeared manifest is treated as an absent candidate.
13
+ *
14
+ * @evidence contracts/common.md#principled-implementation Project and ancestor dependency maps supply npm aliases by their declared target; Node resolves those arbitrary names from the caller's filename, and installed name/version metadata verifies native identity. Distinct native alias installs are rejected as ambiguous rather than selected by spelling or declaration order.
15
+ * @evidence contracts/common.md#clear-and-simple-design One owner selects manifest metadata for executable resolution and plugin version keys so they cannot choose different package names.
16
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The real package identity and npm alias syntax define discovery; no particular alias, consumer identity or guessed executable is embedded.
17
+ * @evidence contracts/common.md#meaningful-documentation The comment defines anchor semantics, alias precedence, legacy rejection, incomplete metadata behavior and propagated read failures.
18
+ * @evidence contracts/portability.md#os-neutral-implementation createRequire follows native Node package resolution and synchronous filesystem reads without shell commands or path case assumptions.
19
+ * @evidence contracts/performance.md#efficient-algorithms The ancestor walk parses its manifests and visits their declared dependency entries once, then resolves and reads only A distinct aliases plus the ordinary name. Sorting alias names costs O(A log A); Node lookup, realpath and manifest bytes contribute delegated costs. Installed dependency trees are never scanned.
20
+ *
21
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work Project installations can change between calls, and this operation owns no invalidation source that would justify a retained result.
22
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources Synchronous reads retain no open handles and the caller owns the returned metadata.
23
+ */
24
+ export declare function resolveNativeTypeScriptPackage(from: string): {
25
+ packageJson: string;
26
+ manifest: Record<string, unknown>;
27
+ } | undefined;
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.resolveNativeTypeScriptPackage = resolveNativeTypeScriptPackage;
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
+ const node_module_1 = require("node:module");
9
+ const node_path_1 = __importDefault(require("node:path"));
10
+ /**
11
+ * Find native TypeScript from a filename used as a Node resolution anchor.
12
+ *
13
+ * The nearest ancestor manifest declaring TypeScript or its npm aliases owns
14
+ * discovery. Its aliases targeting `typescript` precede the ordinary name. A
15
+ * manifest reporting a compiler major below 7 belongs to the JavaScript
16
+ * compiler and is skipped. Missing or nonnumeric version metadata retains the
17
+ * existing path-discovery behavior; executable availability is the caller's
18
+ * responsibility. Alias candidates must report the actual package name
19
+ * `typescript` and a native major. Multiple distinct native alias installs are
20
+ * ambiguous and require an explicit binary. Read and parse errors propagate,
21
+ * except a disappeared manifest is treated as an absent candidate.
22
+ *
23
+ * @evidence contracts/common.md#principled-implementation Project and ancestor dependency maps supply npm aliases by their declared target; Node resolves those arbitrary names from the caller's filename, and installed name/version metadata verifies native identity. Distinct native alias installs are rejected as ambiguous rather than selected by spelling or declaration order.
24
+ * @evidence contracts/common.md#clear-and-simple-design One owner selects manifest metadata for executable resolution and plugin version keys so they cannot choose different package names.
25
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The real package identity and npm alias syntax define discovery; no particular alias, consumer identity or guessed executable is embedded.
26
+ * @evidence contracts/common.md#meaningful-documentation The comment defines anchor semantics, alias precedence, legacy rejection, incomplete metadata behavior and propagated read failures.
27
+ * @evidence contracts/portability.md#os-neutral-implementation createRequire follows native Node package resolution and synchronous filesystem reads without shell commands or path case assumptions.
28
+ * @evidence contracts/performance.md#efficient-algorithms The ancestor walk parses its manifests and visits their declared dependency entries once, then resolves and reads only A distinct aliases plus the ordinary name. Sorting alias names costs O(A log A); Node lookup, realpath and manifest bytes contribute delegated costs. Installed dependency trees are never scanned.
29
+ *
30
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work Project installations can change between calls, and this operation owns no invalidation source that would justify a retained result.
31
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources Synchronous reads retain no open handles and the caller owns the returned metadata.
32
+ */
33
+ function resolveNativeTypeScriptPackage(from) {
34
+ const requireFrom = (0, node_module_1.createRequire)(from);
35
+ const aliases = new Set();
36
+ for (let directory = node_path_1.default.dirname(from);; directory = node_path_1.default.dirname(directory)) {
37
+ const project = readManifest(node_path_1.default.join(directory, "package.json"));
38
+ let declaresTypeScript = false;
39
+ for (const field of [
40
+ "dependencies",
41
+ "devDependencies",
42
+ "optionalDependencies",
43
+ ]) {
44
+ const dependencies = project?.[field];
45
+ if (dependencies === null || typeof dependencies !== "object")
46
+ continue;
47
+ declaresTypeScript ||= Object.hasOwn(dependencies, "typescript");
48
+ for (const [name, specifier] of Object.entries(dependencies))
49
+ if (name !== "typescript" &&
50
+ typeof specifier === "string" &&
51
+ /^npm:typescript(?:@|$)/.test(specifier))
52
+ aliases.add(name);
53
+ }
54
+ if (declaresTypeScript || aliases.size)
55
+ break;
56
+ if (node_path_1.default.dirname(directory) === directory)
57
+ break;
58
+ }
59
+ let selected;
60
+ for (const name of [...aliases].sort().concat("typescript")) {
61
+ if (name === "typescript" && selected)
62
+ return selected;
63
+ let packageJson;
64
+ try {
65
+ packageJson = requireFrom.resolve(`${name}/package.json`);
66
+ }
67
+ catch {
68
+ continue;
69
+ }
70
+ const manifest = readManifest(packageJson);
71
+ if (!manifest)
72
+ continue;
73
+ const majorText = typeof manifest.version === "string"
74
+ ? manifest.version.split(".")[0]
75
+ : "";
76
+ const major = /^\d+$/.test(majorText) ? Number(majorText) : NaN;
77
+ if (major < 7)
78
+ continue;
79
+ if (name !== "typescript" &&
80
+ (manifest.name !== "typescript" || !Number.isFinite(major)))
81
+ continue;
82
+ const candidate = { packageJson, manifest };
83
+ if (name === "typescript")
84
+ return candidate;
85
+ if (selected &&
86
+ node_fs_1.default.realpathSync(selected.packageJson) !== node_fs_1.default.realpathSync(packageJson))
87
+ throw new Error("ttsc: multiple native TypeScript aliases are installed; select one with --binary or TTSC_TSGO_BINARY.");
88
+ selected = candidate;
89
+ }
90
+ return selected;
91
+ }
92
+ /** Read current manifest bytes, including after Node cached an older path. */
93
+ function readManifest(file) {
94
+ try {
95
+ return JSON.parse(node_fs_1.default.readFileSync(file, "utf8"));
96
+ }
97
+ catch (error) {
98
+ if (["ENOENT", "ENOTDIR"].includes(error.code ?? ""))
99
+ return undefined;
100
+ throw error;
101
+ }
102
+ }
103
+ //# sourceMappingURL=resolveNativeTypeScriptPackage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveNativeTypeScriptPackage.js","sourceRoot":"","sources":["../../../src/compiler/internal/resolveNativeTypeScriptPackage.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,6CAA4C;AAC5C,0DAA6B;AAE7B;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wCACE,IAAY;IAEZ,MAAM,WAAW,GAAG,IAAA,2BAAa,EAAC,IAAI,CAAC,CAAC;IACxC,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,KACE,IAAI,SAAS,GAAG,mBAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAElC,SAAS,GAAG,mBAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EACnC,CAAC;QACD,MAAM,OAAO,GAAG,YAAY,CAAC,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC;QACnE,IAAI,kBAAkB,GAAG,KAAK,CAAC;QAC/B,KAAK,MAAM,KAAK,IAAI;YAClB,cAAc;YACd,iBAAiB;YACjB,sBAAsB;SACvB,EAAE,CAAC;YACF,MAAM,YAAY,GAAG,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;YACtC,IAAI,YAAY,KAAK,IAAI,IAAI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AAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;QAChE,IAAI,KAAK,GAAG,CAAC;YAAE,SAAS;QACxB,IACE,IAAI,KAAK,YAAY;YACrB,CAAC,QAAQ,CAAC,IAAI,KAAK,YAAY,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YAE3D,SAAS;QACX,MAAM,SAAS,GAAG,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC;QAC5C,IAAI,IAAI,KAAK,YAAY;YAAE,OAAO,SAAS,CAAC;QAC5C,IACE,QAAQ;YACR,iBAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,iBAAE,CAAC,YAAY,CAAC,WAAW,CAAC;YAEtE,MAAM,IAAI,KAAK,CACb,uGAAuG,CACxG,CAAC;QACJ,QAAQ,GAAG,SAAS,CAAC;IACvB,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,8EAA8E;AAC9E,SAAS,YAAY,CAAC,IAAY;IAChC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,iBAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAA4B,CAAC;IAC9E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IACE,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,QAAQ,CAC3B,KAA+B,CAAC,IAAI,IAAI,EAAE,CAC5C;YAED,OAAO,SAAS,CAAC;QACnB,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -6,13 +6,14 @@
6
6
  * 1. Select `opts.binary`, or consult `TTSC_TSGO_BINARY` only when it is absent. A
7
7
  * nonempty override must be an existing absolute path; returns `{ binary,
8
8
  * packageJson: "", packageRoot, version: "custom" }`.
9
- * 2. `typescript` resolved from the project `cwd`.
10
- * 3. `typescript` resolved from `opts.resolveFrom` (for test harnesses and
11
- * embedders that anchor to a different directory).
9
+ * 2. Declared npm aliases targeting TypeScript, then native `typescript`, from
10
+ * `cwd`.
11
+ * 3. The same discovery from `opts.resolveFrom` (for test harnesses and embedders
12
+ * that anchor to a different directory).
12
13
  *
13
14
  * Throws a descriptive error when the package or platform path is missing.
14
15
  * Manifest read/parse failures can propagate directly. Existence does not
15
- * certify a regular executable, native ABI or compiler version compatibility;
16
+ * certify a regular executable, native ABI or compiler-target compatibility;
16
17
  * this operation selects paths and metadata without executing them. Platform
17
18
  * package resolution is anchored at the chosen TypeScript manifest and can
18
19
  * follow Node's ancestor search, rather than proving both packages occupy one
@@ -23,7 +24,7 @@
23
24
  * @evidence contracts/common.md#prohibited-implementation-shortcuts Package names and lib/tsc suffixes follow the native TypeScript distribution contract. Missing dependencies remain descriptive errors rather than invented compiler paths or fixture-specific substitutes.
24
25
  * @evidence contracts/common.md#meaningful-documentation Ordered precedence, custom metadata and failures are documented separately, and the fallback anchor member explains its filename semantics following the documentation skill.
25
26
  * @evidence contracts/portability.md#os-neutral-implementation Native path APIs validate absolute overrides and select the Windows executable suffix; createRequire anchors resolution to actual package files without shell quoting or OS-derived case policy.
26
- * @evidence contracts/performance.md#efficient-algorithms A precedence sequence makes at most two TypeScript resolution attempts, one platform resolution and one manifest parse of M bytes. Node ancestor/package lookup, native existence checks and path text work have delegated costs; Windows environment override selection scans environment keys through SidecarEnvironment. Returned metadata does not retain the full parsed manifest.
27
+ * @evidence contracts/performance.md#efficient-algorithms Up to two anchors delegate ancestor manifest and alias discovery before one platform lookup. Dependency declaration counts, alias lookups, manifest bytes and path work determine cost; Windows environment selection scans environment keys through SidecarEnvironment. Returned metadata does not retain parsed manifests.
27
28
  *
28
29
  * @evidenceExclude contracts/performance.md#reuse-equivalent-work Overrides and consumer installations are mutable filesystem authority; this resolver owns no dependency invalidation source that could justify retaining a custom result across calls.
29
30
  * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources Synchronous package reads retain no handles or tasks; returned path and version strings transfer to the caller without a historical metadata table.
@@ -31,7 +32,7 @@
31
32
  export declare function resolveTsgo(opts?: {
32
33
  /** Explicit path to a native `tsc` binary; bypasses package resolution. */
33
34
  binary?: string;
34
- /** Directory from which to discover `typescript`. */
35
+ /** Directory from which to discover native TypeScript. */
35
36
  cwd?: string;
36
37
  /**
37
38
  * Complete environment for executable selection; omission reads the current
@@ -7,6 +7,7 @@ exports.resolveTsgo = resolveTsgo;
7
7
  const node_fs_1 = __importDefault(require("node:fs"));
8
8
  const node_module_1 = require("node:module");
9
9
  const node_path_1 = __importDefault(require("node:path"));
10
+ const resolveNativeTypeScriptPackage_1 = require("./resolveNativeTypeScriptPackage");
10
11
  const SidecarEnvironment_1 = require("./sharedHost/SidecarEnvironment");
11
12
  /**
12
13
  * Resolve the consumer project's native TypeScript (`tsc`) binary and metadata.
@@ -16,13 +17,14 @@ const SidecarEnvironment_1 = require("./sharedHost/SidecarEnvironment");
16
17
  * 1. Select `opts.binary`, or consult `TTSC_TSGO_BINARY` only when it is absent. A
17
18
  * nonempty override must be an existing absolute path; returns `{ binary,
18
19
  * packageJson: "", packageRoot, version: "custom" }`.
19
- * 2. `typescript` resolved from the project `cwd`.
20
- * 3. `typescript` resolved from `opts.resolveFrom` (for test harnesses and
21
- * embedders that anchor to a different directory).
20
+ * 2. Declared npm aliases targeting TypeScript, then native `typescript`, from
21
+ * `cwd`.
22
+ * 3. The same discovery from `opts.resolveFrom` (for test harnesses and embedders
23
+ * that anchor to a different directory).
22
24
  *
23
25
  * Throws a descriptive error when the package or platform path is missing.
24
26
  * Manifest read/parse failures can propagate directly. Existence does not
25
- * certify a regular executable, native ABI or compiler version compatibility;
27
+ * certify a regular executable, native ABI or compiler-target compatibility;
26
28
  * this operation selects paths and metadata without executing them. Platform
27
29
  * package resolution is anchored at the chosen TypeScript manifest and can
28
30
  * follow Node's ancestor search, rather than proving both packages occupy one
@@ -33,7 +35,7 @@ const SidecarEnvironment_1 = require("./sharedHost/SidecarEnvironment");
33
35
  * @evidence contracts/common.md#prohibited-implementation-shortcuts Package names and lib/tsc suffixes follow the native TypeScript distribution contract. Missing dependencies remain descriptive errors rather than invented compiler paths or fixture-specific substitutes.
34
36
  * @evidence contracts/common.md#meaningful-documentation Ordered precedence, custom metadata and failures are documented separately, and the fallback anchor member explains its filename semantics following the documentation skill.
35
37
  * @evidence contracts/portability.md#os-neutral-implementation Native path APIs validate absolute overrides and select the Windows executable suffix; createRequire anchors resolution to actual package files without shell quoting or OS-derived case policy.
36
- * @evidence contracts/performance.md#efficient-algorithms A precedence sequence makes at most two TypeScript resolution attempts, one platform resolution and one manifest parse of M bytes. Node ancestor/package lookup, native existence checks and path text work have delegated costs; Windows environment override selection scans environment keys through SidecarEnvironment. Returned metadata does not retain the full parsed manifest.
38
+ * @evidence contracts/performance.md#efficient-algorithms Up to two anchors delegate ancestor manifest and alias discovery before one platform lookup. Dependency declaration counts, alias lookups, manifest bytes and path work determine cost; Windows environment selection scans environment keys through SidecarEnvironment. Returned metadata does not retain parsed manifests.
37
39
  *
38
40
  * @evidenceExclude contracts/performance.md#reuse-equivalent-work Overrides and consumer installations are mutable filesystem authority; this resolver owns no dependency invalidation source that could justify retaining a custom result across calls.
39
41
  * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources Synchronous package reads retain no handles or tasks; returned path and version strings transfer to the caller without a historical metadata table.
@@ -53,23 +55,19 @@ function resolveTsgo(opts = {}) {
53
55
  };
54
56
  }
55
57
  const cwd = node_path_1.default.resolve(opts.cwd ?? process.cwd());
56
- // Resolve the package.json of typescript.
57
- // Try cwd first, then the optional resolveFrom anchor.
58
- let packageJson;
59
- packageJson =
60
- resolveTypeScriptPackageJson(node_path_1.default.join(cwd, "package.json")) ??
61
- (opts.resolveFrom
62
- ? resolveTypeScriptPackageJson(opts.resolveFrom)
63
- : undefined) ??
64
- "";
65
- if (!packageJson) {
58
+ const selected = (0, resolveNativeTypeScriptPackage_1.resolveNativeTypeScriptPackage)(node_path_1.default.join(cwd, "package.json")) ??
59
+ (opts.resolveFrom
60
+ ? (0, resolveNativeTypeScriptPackage_1.resolveNativeTypeScriptPackage)(opts.resolveFrom)
61
+ : undefined);
62
+ if (!selected) {
66
63
  throw new Error([
67
- "ttsc: typescript is required.",
64
+ "ttsc: native TypeScript 7 or newer is required.",
68
65
  "Install the native TypeScript compiler in the consuming project:",
69
66
  " npm i -D typescript",
67
+ "For legacy tooling, declare an npm:typescript@^7 alias in package.json.",
70
68
  ].join("\n"));
71
69
  }
72
- const manifest = readPackageJson(packageJson);
70
+ const { packageJson, manifest } = selected;
73
71
  const packageRoot = node_path_1.default.dirname(packageJson);
74
72
  const platformPackage = `@typescript/typescript-${process.platform}-${process.arch}`;
75
73
  const platformResolver = (0, node_module_1.createRequire)(packageJson);
@@ -80,7 +78,7 @@ function resolveTsgo(opts = {}) {
80
78
  catch {
81
79
  throw new Error([
82
80
  `ttsc: platform-specific TypeScript binary not found (${platformPackage}).`,
83
- "Reinstall typescript with optional dependencies enabled.",
81
+ "Reinstall the selected native TypeScript package with optional dependencies enabled.",
84
82
  ].join("\n"));
85
83
  }
86
84
  const platformRoot = node_path_1.default.dirname(platformPackageJson);
@@ -97,21 +95,4 @@ function resolveTsgo(opts = {}) {
97
95
  version: typeof manifest.version === "string" ? manifest.version : "unknown",
98
96
  };
99
97
  }
100
- /**
101
- * Resolve TypeScript relative to an absolute filename accepted by
102
- * createRequire. Returns undefined when the anchor or package cannot be
103
- * resolved.
104
- */
105
- function resolveTypeScriptPackageJson(from) {
106
- try {
107
- return (0, node_module_1.createRequire)(from).resolve("typescript/package.json");
108
- }
109
- catch {
110
- return undefined;
111
- }
112
- }
113
- /** Parse a JSON file and return the result as a plain object. */
114
- function readPackageJson(file) {
115
- return JSON.parse(node_fs_1.default.readFileSync(file, "utf8"));
116
- }
117
98
  //# sourceMappingURL=resolveTsgo.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolveTsgo.js","sourceRoot":"","sources":["../../../src/compiler/internal/resolveTsgo.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACz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AAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CACjD,CAAC;IACF,IAAI,CAAC,iBAAE,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,0CAA0C,MAAM,EAAE,CAAC,CAAC;IACtE,CAAC;IACD,OAAO;QACL,MAAM;QACN,OAAO,EACL,OAAO,QAAQ,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;QACrE,WAAW;QACX,WAAW;QACX,mBAAmB;QACnB,OAAO,EACL,OAAO,QAAQ,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;KACtE,CAAC;AACJ,CAAC"}
@@ -7,5 +7,9 @@
7
7
  * `@ttsc/unplugin` runs its native watch helpers, imports them from here, so
8
8
  * the helper always comes from the binary ttsc itself uses and no consumer
9
9
  * carries a copy of the rules.
10
+ *
11
+ * `resolveTsgo` selects the consumer's native TypeScript compiler, including
12
+ * npm aliases targeting TypeScript used alongside legacy tooling.
10
13
  */
11
14
  export { resolveBinary } from "../compiler/internal/resolveBinary";
15
+ export { resolveTsgo } from "../compiler/internal/resolveTsgo";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveBinary = void 0;
3
+ exports.resolveTsgo = exports.resolveBinary = void 0;
4
4
  /**
5
5
  * Public entry of `ttsc/binary`.
6
6
  *
@@ -10,7 +10,12 @@ exports.resolveBinary = void 0;
10
10
  * `@ttsc/unplugin` runs its native watch helpers, imports them from here, so
11
11
  * the helper always comes from the binary ttsc itself uses and no consumer
12
12
  * carries a copy of the rules.
13
+ *
14
+ * `resolveTsgo` selects the consumer's native TypeScript compiler, including
15
+ * npm aliases targeting TypeScript used alongside legacy tooling.
13
16
  */
14
17
  var resolveBinary_1 = require("../compiler/internal/resolveBinary");
15
18
  Object.defineProperty(exports, "resolveBinary", { enumerable: true, get: function () { return resolveBinary_1.resolveBinary; } });
19
+ var resolveTsgo_1 = require("../compiler/internal/resolveTsgo");
20
+ Object.defineProperty(exports, "resolveTsgo", { enumerable: true, get: function () { return resolveTsgo_1.resolveTsgo; } });
16
21
  //# sourceMappingURL=nativeBinary.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nativeBinary.js","sourceRoot":"","sources":["../../src/internal/nativeBinary.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;GASG;AACH,oEAAmE;AAA1D,8GAAA,aAAa,OAAA"}
1
+ {"version":3,"file":"nativeBinary.js","sourceRoot":"","sources":["../../src/internal/nativeBinary.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;GAYG;AACH,oEAAmE;AAA1D,8GAAA,aAAa,OAAA;AACtB,gEAA+D;AAAtD,0GAAA,WAAW,OAAA"}
@@ -579,7 +579,9 @@ function collectLinkDirectories(projectRoot) {
579
579
  return out.reverse();
580
580
  }
581
581
  /**
582
- * Whether mirroring `directory` would reach a filesystem or temporary root.
582
+ * Whether mirroring `directory` would reach a filesystem root, the temporary
583
+ * root or any of its ancestors. A caller can place its temporary root inside
584
+ * its project; its parents still contain shared entries outside that project.
583
585
  * Identity comparison is required on Windows, where `os.tmpdir()` can carry an
584
586
  * 8.3 component while a project created below it is returned in long spelling.
585
587
  */
@@ -587,7 +589,8 @@ function isUnsafeVirtualParent(directory, identities) {
587
589
  const resolved = identities.resolve(directory);
588
590
  const root = identities.resolve(node_path_1.default.parse(resolved.path).root);
589
591
  const temporaryRoot = identities.resolve(node_os_1.default.tmpdir());
590
- return resolved.key === root.key || resolved.key === temporaryRoot.key;
592
+ return (resolved.key === root.key ||
593
+ identities.isWithin(resolved.path, temporaryRoot.path));
591
594
  }
592
595
  /**
593
596
  * Map an absolute path into a stable, filesystem-safe subtree under `root`.
@@ -1 +1 @@
1
- {"version":3,"file":"prepareExecution.js","sourceR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CAAC,mBAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;IAChE,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,CAAC,iBAAE,CAAC,MAAM,EAAE,CAAC,CAAC;IACtD,OAAO,CACL,QAAQ,CAAC,GAAG,KAAK,IAAI,CAAC,GAAG;QACzB,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,CACvD,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAS,WAAW,CAAC,IAAY,EAAE,QAAgB;IACjD,MAAM,MAAM,GAAG,mBAAI,CAAC,KAAK,CAAC,mBAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClD,MAAM,KAAK,GACT,MAAM,CAAC,IAAI,KAAK,mBAAI,CAAC,GAAG;QACtB,CAAC,CAAC,OAAO;QACT,CAAC,CAAC,qBAAM;aACH,UAAU,CAAC,QAAQ,CAAC;aACpB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC;aAC9B,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,MAAM,QAAQ,GAAG,mBAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,mBAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IACpE,OAAO,mBAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC1C,CAAC"}
@@ -8,14 +8,15 @@
8
8
  * consumer that keeps a transform's output beyond the process that produced it,
9
9
  * as a persisted shared compile of `@ttsc/unplugin` is, names it by these
10
10
  * versions with the rule the build applies instead of a copy of it: ttsc's own
11
- * package version, and the version of the `typescript` package the project
12
- * resolves, or `"unknown"` when resolution/read/parse fails or its version is
13
- * absent. The host label falls back to `"0.0.0"` and is cached even after an
14
- * unsuccessful first read. The host installation is assumed stable for the
15
- * process lifetime; changing its manifest does not refresh that label.
11
+ * package version, and the version of the native TypeScript package the project
12
+ * selects (declared npm aliases before `typescript`), or `"unknown"` when
13
+ * resolution/read/parse fails or its version is absent. The host label falls
14
+ * back to `"0.0.0"` and is cached even after an unsuccessful first read. The
15
+ * host installation is assumed stable for the process lifetime; changing its
16
+ * manifest does not refresh that label.
16
17
  *
17
- * @param projectRoot The project base used to resolve
18
- * `typescript/package.json`.
18
+ * @param projectRoot The project base used to resolve the native TypeScript
19
+ * manifest.
19
20
  * @evidence contracts/common.md#principled-implementation Package-version labels supply the same metadata tuple used by plugin keys; absent/unreadable metadata receives the documented unknown/default label rather than an executable identity certificate.
20
21
  * @evidence contracts/common.md#clear-and-simple-design The host label comes from its own owner (`ttscPackageVersion`), which a reader needing only that label calls without this function's project resolution; the project-version reader is separate because project resolution varies per call.
21
22
  * @evidence contracts/common.md#prohibited-implementation-shortcuts Node package resolution determines the actual project dependency; no particular project or fixture version is embedded.
@@ -4,9 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.pluginBuildVersions = pluginBuildVersions;
7
- const node_fs_1 = __importDefault(require("node:fs"));
8
- const node_module_1 = require("node:module");
9
7
  const node_path_1 = __importDefault(require("node:path"));
8
+ const resolveNativeTypeScriptPackage_1 = require("../../../compiler/internal/resolveNativeTypeScriptPackage");
10
9
  const ttscPackageVersion_1 = require("./ttscPackageVersion");
11
10
  /**
12
11
  * Package-version labels used by plugin build keys (`computeCacheKey`) and
@@ -18,14 +17,15 @@ const ttscPackageVersion_1 = require("./ttscPackageVersion");
18
17
  * consumer that keeps a transform's output beyond the process that produced it,
19
18
  * as a persisted shared compile of `@ttsc/unplugin` is, names it by these
20
19
  * versions with the rule the build applies instead of a copy of it: ttsc's own
21
- * package version, and the version of the `typescript` package the project
22
- * resolves, or `"unknown"` when resolution/read/parse fails or its version is
23
- * absent. The host label falls back to `"0.0.0"` and is cached even after an
24
- * unsuccessful first read. The host installation is assumed stable for the
25
- * process lifetime; changing its manifest does not refresh that label.
20
+ * package version, and the version of the native TypeScript package the project
21
+ * selects (declared npm aliases before `typescript`), or `"unknown"` when
22
+ * resolution/read/parse fails or its version is absent. The host label falls
23
+ * back to `"0.0.0"` and is cached even after an unsuccessful first read. The
24
+ * host installation is assumed stable for the process lifetime; changing its
25
+ * manifest does not refresh that label.
26
26
  *
27
- * @param projectRoot The project base used to resolve
28
- * `typescript/package.json`.
27
+ * @param projectRoot The project base used to resolve the native TypeScript
28
+ * manifest.
29
29
  * @evidence contracts/common.md#principled-implementation Package-version labels supply the same metadata tuple used by plugin keys; absent/unreadable metadata receives the documented unknown/default label rather than an executable identity certificate.
30
30
  * @evidence contracts/common.md#clear-and-simple-design The host label comes from its own owner (`ttscPackageVersion`), which a reader needing only that label calls without this function's project resolution; the project-version reader is separate because project resolution varies per call.
31
31
  * @evidence contracts/common.md#prohibited-implementation-shortcuts Node package resolution determines the actual project dependency; no particular project or fixture version is embedded.
@@ -40,10 +40,10 @@ function pluginBuildVersions(projectRoot) {
40
40
  }
41
41
  function readTsgoVersion(projectRoot) {
42
42
  try {
43
- const projectRequire = (0, node_module_1.createRequire)(node_path_1.default.join(projectRoot, "package.json"));
44
- const pkgPath = projectRequire.resolve("typescript/package.json");
45
- const pkg = JSON.parse(node_fs_1.default.readFileSync(pkgPath, "utf8"));
46
- return pkg.version ?? "unknown";
43
+ const selected = (0, resolveNativeTypeScriptPackage_1.resolveNativeTypeScriptPackage)(node_path_1.default.join(projectRoot, "package.json"));
44
+ return typeof selected?.manifest.version === "string"
45
+ ? selected.manifest.version
46
+ : "unknown";
47
47
  }
48
48
  catch {
49
49
  return "unknown";
@@ -1 +1 @@
1
- {"version":3,"file":"pluginBuildVersions.js","sourceRoot":"","sources":["../../../../src/plugin/internal/source/pluginBuildVersions.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,6CAA4C;AAC5C,0DAA6B;AAE7B,6DAA0D;A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C,OAAO;YAC3B,CAAC,CAAC,SAAS,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ttsc",
3
- "version": "0.34.2",
3
+ "version": "0.34.3",
4
4
  "description": "General-purpose TypeScript-Go compiler, runtime, plugin host, and LSP host.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -54,7 +54,7 @@
54
54
  "cjs-module-lexer": "2.2.1"
55
55
  },
56
56
  "peerDependencies": {
57
- "typescript": ">=7.0.0 || >=7.1.0-0"
57
+ "typescript": ">=6.0.0 || >=7.1.0-0"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@wrtnlabs/evidence": "^0.5.1",
@@ -64,13 +64,13 @@
64
64
  },
65
65
  "optionalDependencies": {
66
66
  "fsevents": "^2.3.3",
67
- "@ttsc/linux-x64": "0.34.2",
68
- "@ttsc/linux-arm": "0.34.2",
69
- "@ttsc/linux-arm64": "0.34.2",
70
- "@ttsc/darwin-x64": "0.34.2",
71
- "@ttsc/win32-x64": "0.34.2",
72
- "@ttsc/darwin-arm64": "0.34.2",
73
- "@ttsc/win32-arm64": "0.34.2"
67
+ "@ttsc/linux-x64": "0.34.3",
68
+ "@ttsc/linux-arm": "0.34.3",
69
+ "@ttsc/darwin-x64": "0.34.3",
70
+ "@ttsc/darwin-arm64": "0.34.3",
71
+ "@ttsc/win32-x64": "0.34.3",
72
+ "@ttsc/win32-arm64": "0.34.3",
73
+ "@ttsc/linux-arm64": "0.34.3"
74
74
  },
75
75
  "sideEffects": [
76
76
  "./lib/register.js",
@@ -0,0 +1,110 @@
1
+ import fs from "node:fs";
2
+ import { createRequire } from "node:module";
3
+ import path from "node:path";
4
+
5
+ /**
6
+ * Find native TypeScript from a filename used as a Node resolution anchor.
7
+ *
8
+ * The nearest ancestor manifest declaring TypeScript or its npm aliases owns
9
+ * discovery. Its aliases targeting `typescript` precede the ordinary name. A
10
+ * manifest reporting a compiler major below 7 belongs to the JavaScript
11
+ * compiler and is skipped. Missing or nonnumeric version metadata retains the
12
+ * existing path-discovery behavior; executable availability is the caller's
13
+ * responsibility. Alias candidates must report the actual package name
14
+ * `typescript` and a native major. Multiple distinct native alias installs are
15
+ * ambiguous and require an explicit binary. Read and parse errors propagate,
16
+ * except a disappeared manifest is treated as an absent candidate.
17
+ *
18
+ * @evidence contracts/common.md#principled-implementation Project and ancestor dependency maps supply npm aliases by their declared target; Node resolves those arbitrary names from the caller's filename, and installed name/version metadata verifies native identity. Distinct native alias installs are rejected as ambiguous rather than selected by spelling or declaration order.
19
+ * @evidence contracts/common.md#clear-and-simple-design One owner selects manifest metadata for executable resolution and plugin version keys so they cannot choose different package names.
20
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The real package identity and npm alias syntax define discovery; no particular alias, consumer identity or guessed executable is embedded.
21
+ * @evidence contracts/common.md#meaningful-documentation The comment defines anchor semantics, alias precedence, legacy rejection, incomplete metadata behavior and propagated read failures.
22
+ * @evidence contracts/portability.md#os-neutral-implementation createRequire follows native Node package resolution and synchronous filesystem reads without shell commands or path case assumptions.
23
+ * @evidence contracts/performance.md#efficient-algorithms The ancestor walk parses its manifests and visits their declared dependency entries once, then resolves and reads only A distinct aliases plus the ordinary name. Sorting alias names costs O(A log A); Node lookup, realpath and manifest bytes contribute delegated costs. Installed dependency trees are never scanned.
24
+ *
25
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work Project installations can change between calls, and this operation owns no invalidation source that would justify a retained result.
26
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources Synchronous reads retain no open handles and the caller owns the returned metadata.
27
+ */
28
+ export function resolveNativeTypeScriptPackage(
29
+ from: string,
30
+ ): { packageJson: string; manifest: Record<string, unknown> } | undefined {
31
+ const requireFrom = createRequire(from);
32
+ const aliases = new Set<string>();
33
+ for (
34
+ let directory = path.dirname(from);
35
+ ;
36
+ directory = path.dirname(directory)
37
+ ) {
38
+ const project = readManifest(path.join(directory, "package.json"));
39
+ let declaresTypeScript = false;
40
+ for (const field of [
41
+ "dependencies",
42
+ "devDependencies",
43
+ "optionalDependencies",
44
+ ]) {
45
+ const dependencies = project?.[field];
46
+ if (dependencies === null || typeof dependencies !== "object") continue;
47
+ declaresTypeScript ||= Object.hasOwn(dependencies, "typescript");
48
+ for (const [name, specifier] of Object.entries(dependencies))
49
+ if (
50
+ name !== "typescript" &&
51
+ typeof specifier === "string" &&
52
+ /^npm:typescript(?:@|$)/.test(specifier)
53
+ )
54
+ aliases.add(name);
55
+ }
56
+ if (declaresTypeScript || aliases.size) break;
57
+ if (path.dirname(directory) === directory) break;
58
+ }
59
+ let selected:
60
+ | { packageJson: string; manifest: Record<string, unknown> }
61
+ | undefined;
62
+ for (const name of [...aliases].sort().concat("typescript")) {
63
+ if (name === "typescript" && selected) return selected;
64
+ let packageJson: string;
65
+ try {
66
+ packageJson = requireFrom.resolve(`${name}/package.json`);
67
+ } catch {
68
+ continue;
69
+ }
70
+ const manifest = readManifest(packageJson);
71
+ if (!manifest) continue;
72
+ const majorText =
73
+ typeof manifest.version === "string"
74
+ ? manifest.version.split(".")[0]!
75
+ : "";
76
+ const major = /^\d+$/.test(majorText) ? Number(majorText) : NaN;
77
+ if (major < 7) continue;
78
+ if (
79
+ name !== "typescript" &&
80
+ (manifest.name !== "typescript" || !Number.isFinite(major))
81
+ )
82
+ continue;
83
+ const candidate = { packageJson, manifest };
84
+ if (name === "typescript") return candidate;
85
+ if (
86
+ selected &&
87
+ fs.realpathSync(selected.packageJson) !== fs.realpathSync(packageJson)
88
+ )
89
+ throw new Error(
90
+ "ttsc: multiple native TypeScript aliases are installed; select one with --binary or TTSC_TSGO_BINARY.",
91
+ );
92
+ selected = candidate;
93
+ }
94
+ return selected;
95
+ }
96
+
97
+ /** Read current manifest bytes, including after Node cached an older path. */
98
+ function readManifest(file: string): Record<string, unknown> | undefined {
99
+ try {
100
+ return JSON.parse(fs.readFileSync(file, "utf8")) as Record<string, unknown>;
101
+ } catch (error) {
102
+ if (
103
+ ["ENOENT", "ENOTDIR"].includes(
104
+ (error as NodeJS.ErrnoException).code ?? "",
105
+ )
106
+ )
107
+ return undefined;
108
+ throw error;
109
+ }
110
+ }
@@ -2,6 +2,7 @@ import fs from "node:fs";
2
2
  import { createRequire } from "node:module";
3
3
  import path from "node:path";
4
4
 
5
+ import { resolveNativeTypeScriptPackage } from "./resolveNativeTypeScriptPackage";
5
6
  import { SidecarEnvironment } from "./sharedHost/SidecarEnvironment";
6
7
 
7
8
  /**
@@ -12,13 +13,14 @@ import { SidecarEnvironment } from "./sharedHost/SidecarEnvironment";
12
13
  * 1. Select `opts.binary`, or consult `TTSC_TSGO_BINARY` only when it is absent. A
13
14
  * nonempty override must be an existing absolute path; returns `{ binary,
14
15
  * packageJson: "", packageRoot, version: "custom" }`.
15
- * 2. `typescript` resolved from the project `cwd`.
16
- * 3. `typescript` resolved from `opts.resolveFrom` (for test harnesses and
17
- * embedders that anchor to a different directory).
16
+ * 2. Declared npm aliases targeting TypeScript, then native `typescript`, from
17
+ * `cwd`.
18
+ * 3. The same discovery from `opts.resolveFrom` (for test harnesses and embedders
19
+ * that anchor to a different directory).
18
20
  *
19
21
  * Throws a descriptive error when the package or platform path is missing.
20
22
  * Manifest read/parse failures can propagate directly. Existence does not
21
- * certify a regular executable, native ABI or compiler version compatibility;
23
+ * certify a regular executable, native ABI or compiler-target compatibility;
22
24
  * this operation selects paths and metadata without executing them. Platform
23
25
  * package resolution is anchored at the chosen TypeScript manifest and can
24
26
  * follow Node's ancestor search, rather than proving both packages occupy one
@@ -29,7 +31,7 @@ import { SidecarEnvironment } from "./sharedHost/SidecarEnvironment";
29
31
  * @evidence contracts/common.md#prohibited-implementation-shortcuts Package names and lib/tsc suffixes follow the native TypeScript distribution contract. Missing dependencies remain descriptive errors rather than invented compiler paths or fixture-specific substitutes.
30
32
  * @evidence contracts/common.md#meaningful-documentation Ordered precedence, custom metadata and failures are documented separately, and the fallback anchor member explains its filename semantics following the documentation skill.
31
33
  * @evidence contracts/portability.md#os-neutral-implementation Native path APIs validate absolute overrides and select the Windows executable suffix; createRequire anchors resolution to actual package files without shell quoting or OS-derived case policy.
32
- * @evidence contracts/performance.md#efficient-algorithms A precedence sequence makes at most two TypeScript resolution attempts, one platform resolution and one manifest parse of M bytes. Node ancestor/package lookup, native existence checks and path text work have delegated costs; Windows environment override selection scans environment keys through SidecarEnvironment. Returned metadata does not retain the full parsed manifest.
34
+ * @evidence contracts/performance.md#efficient-algorithms Up to two anchors delegate ancestor manifest and alias discovery before one platform lookup. Dependency declaration counts, alias lookups, manifest bytes and path work determine cost; Windows environment selection scans environment keys through SidecarEnvironment. Returned metadata does not retain parsed manifests.
33
35
  *
34
36
  * @evidenceExclude contracts/performance.md#reuse-equivalent-work Overrides and consumer installations are mutable filesystem authority; this resolver owns no dependency invalidation source that could justify retaining a custom result across calls.
35
37
  * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources Synchronous package reads retain no handles or tasks; returned path and version strings transfer to the caller without a historical metadata table.
@@ -39,7 +41,7 @@ export function resolveTsgo(
39
41
  /** Explicit path to a native `tsc` binary; bypasses package resolution. */
40
42
  binary?: string;
41
43
 
42
- /** Directory from which to discover `typescript`. */
44
+ /** Directory from which to discover native TypeScript. */
43
45
  cwd?: string;
44
46
 
45
47
  /**
@@ -75,26 +77,23 @@ export function resolveTsgo(
75
77
  }
76
78
 
77
79
  const cwd = path.resolve(opts.cwd ?? process.cwd());
78
- // Resolve the package.json of typescript.
79
- // Try cwd first, then the optional resolveFrom anchor.
80
- let packageJson: string;
81
- packageJson =
82
- resolveTypeScriptPackageJson(path.join(cwd, "package.json")) ??
80
+ const selected =
81
+ resolveNativeTypeScriptPackage(path.join(cwd, "package.json")) ??
83
82
  (opts.resolveFrom
84
- ? resolveTypeScriptPackageJson(opts.resolveFrom)
85
- : undefined) ??
86
- "";
87
- if (!packageJson) {
83
+ ? resolveNativeTypeScriptPackage(opts.resolveFrom)
84
+ : undefined);
85
+ if (!selected) {
88
86
  throw new Error(
89
87
  [
90
- "ttsc: typescript is required.",
88
+ "ttsc: native TypeScript 7 or newer is required.",
91
89
  "Install the native TypeScript compiler in the consuming project:",
92
90
  " npm i -D typescript",
91
+ "For legacy tooling, declare an npm:typescript@^7 alias in package.json.",
93
92
  ].join("\n"),
94
93
  );
95
94
  }
96
95
 
97
- const manifest = readPackageJson(packageJson);
96
+ const { packageJson, manifest } = selected;
98
97
  const packageRoot = path.dirname(packageJson);
99
98
  const platformPackage = `@typescript/typescript-${process.platform}-${process.arch}`;
100
99
  const platformResolver = createRequire(packageJson);
@@ -107,7 +106,7 @@ export function resolveTsgo(
107
106
  throw new Error(
108
107
  [
109
108
  `ttsc: platform-specific TypeScript binary not found (${platformPackage}).`,
110
- "Reinstall typescript with optional dependencies enabled.",
109
+ "Reinstall the selected native TypeScript package with optional dependencies enabled.",
111
110
  ].join("\n"),
112
111
  );
113
112
  }
@@ -132,21 +131,3 @@ export function resolveTsgo(
132
131
  typeof manifest.version === "string" ? manifest.version : "unknown",
133
132
  };
134
133
  }
135
-
136
- /**
137
- * Resolve TypeScript relative to an absolute filename accepted by
138
- * createRequire. Returns undefined when the anchor or package cannot be
139
- * resolved.
140
- */
141
- function resolveTypeScriptPackageJson(from: string): string | undefined {
142
- try {
143
- return createRequire(from).resolve("typescript/package.json");
144
- } catch {
145
- return undefined;
146
- }
147
- }
148
-
149
- /** Parse a JSON file and return the result as a plain object. */
150
- function readPackageJson(file: string): Record<string, unknown> {
151
- return JSON.parse(fs.readFileSync(file, "utf8")) as Record<string, unknown>;
152
- }
@@ -7,5 +7,9 @@
7
7
  * `@ttsc/unplugin` runs its native watch helpers, imports them from here, so
8
8
  * the helper always comes from the binary ttsc itself uses and no consumer
9
9
  * carries a copy of the rules.
10
+ *
11
+ * `resolveTsgo` selects the consumer's native TypeScript compiler, including
12
+ * npm aliases targeting TypeScript used alongside legacy tooling.
10
13
  */
11
14
  export { resolveBinary } from "../compiler/internal/resolveBinary";
15
+ export { resolveTsgo } from "../compiler/internal/resolveTsgo";
@@ -743,7 +743,9 @@ function collectLinkDirectories(projectRoot: string): string[] {
743
743
  }
744
744
 
745
745
  /**
746
- * Whether mirroring `directory` would reach a filesystem or temporary root.
746
+ * Whether mirroring `directory` would reach a filesystem root, the temporary
747
+ * root or any of its ancestors. A caller can place its temporary root inside
748
+ * its project; its parents still contain shared entries outside that project.
747
749
  * Identity comparison is required on Windows, where `os.tmpdir()` can carry an
748
750
  * 8.3 component while a project created below it is returned in long spelling.
749
751
  */
@@ -754,7 +756,10 @@ function isUnsafeVirtualParent(
754
756
  const resolved = identities.resolve(directory);
755
757
  const root = identities.resolve(path.parse(resolved.path).root);
756
758
  const temporaryRoot = identities.resolve(os.tmpdir());
757
- return resolved.key === root.key || resolved.key === temporaryRoot.key;
759
+ return (
760
+ resolved.key === root.key ||
761
+ identities.isWithin(resolved.path, temporaryRoot.path)
762
+ );
758
763
  }
759
764
 
760
765
  /**
@@ -1,7 +1,6 @@
1
- import fs from "node:fs";
2
- import { createRequire } from "node:module";
3
1
  import path from "node:path";
4
2
 
3
+ import { resolveNativeTypeScriptPackage } from "../../../compiler/internal/resolveNativeTypeScriptPackage";
5
4
  import { ttscPackageVersion } from "./ttscPackageVersion";
6
5
 
7
6
  /**
@@ -14,14 +13,15 @@ import { ttscPackageVersion } from "./ttscPackageVersion";
14
13
  * consumer that keeps a transform's output beyond the process that produced it,
15
14
  * as a persisted shared compile of `@ttsc/unplugin` is, names it by these
16
15
  * versions with the rule the build applies instead of a copy of it: ttsc's own
17
- * package version, and the version of the `typescript` package the project
18
- * resolves, or `"unknown"` when resolution/read/parse fails or its version is
19
- * absent. The host label falls back to `"0.0.0"` and is cached even after an
20
- * unsuccessful first read. The host installation is assumed stable for the
21
- * process lifetime; changing its manifest does not refresh that label.
16
+ * package version, and the version of the native TypeScript package the project
17
+ * selects (declared npm aliases before `typescript`), or `"unknown"` when
18
+ * resolution/read/parse fails or its version is absent. The host label falls
19
+ * back to `"0.0.0"` and is cached even after an unsuccessful first read. The
20
+ * host installation is assumed stable for the process lifetime; changing its
21
+ * manifest does not refresh that label.
22
22
  *
23
- * @param projectRoot The project base used to resolve
24
- * `typescript/package.json`.
23
+ * @param projectRoot The project base used to resolve the native TypeScript
24
+ * manifest.
25
25
  * @evidence contracts/common.md#principled-implementation Package-version labels supply the same metadata tuple used by plugin keys; absent/unreadable metadata receives the documented unknown/default label rather than an executable identity certificate.
26
26
  * @evidence contracts/common.md#clear-and-simple-design The host label comes from its own owner (`ttscPackageVersion`), which a reader needing only that label calls without this function's project resolution; the project-version reader is separate because project resolution varies per call.
27
27
  * @evidence contracts/common.md#prohibited-implementation-shortcuts Node package resolution determines the actual project dependency; no particular project or fixture version is embedded.
@@ -40,14 +40,12 @@ export function pluginBuildVersions(projectRoot: string): {
40
40
 
41
41
  function readTsgoVersion(projectRoot: string): string {
42
42
  try {
43
- const projectRequire = createRequire(
43
+ const selected = resolveNativeTypeScriptPackage(
44
44
  path.join(projectRoot, "package.json"),
45
45
  );
46
- const pkgPath = projectRequire.resolve("typescript/package.json");
47
- const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8")) as {
48
- version?: string;
49
- };
50
- return pkg.version ?? "unknown";
46
+ return typeof selected?.manifest.version === "string"
47
+ ? selected.manifest.version
48
+ : "unknown";
51
49
  } catch {
52
50
  return "unknown";
53
51
  }