@effect/tsgo 0.57.0 → 0.59.0

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/README.md CHANGED
@@ -3,6 +3,19 @@
3
3
  A wrapper around [TypeScript-Go](https://github.com/microsoft/TypeScript-Go) that builds the Effect Language Service, providing Effect-TS diagnostics and quick fixes.
4
4
  This project targets **Effect V4** (codename: "smol") primarily and also Effect V3.
5
5
 
6
+ <!-- supported-components:start -->
7
+ ## Supported Package Versions
8
+
9
+ The following target package versions are supported by `@effect/tsgo@0.59.0`:
10
+
11
+ | Component | Supported versions |
12
+ |---|---|
13
+ | TypeScript | `7.0.2`, `7.1.0-beta`, `7.1.0-dev.20261026.1` |
14
+ | tsrs | `0.20.0-ts7.1.0-beta` |
15
+ | Oxlint | `1.87.0`, `1.88.0`, `1.89.0` |
16
+ | oxlint-tsgolint | `7.0.2004`, `7.0.2005` |
17
+ <!-- supported-components:end -->
18
+
6
19
  ## Installation
7
20
 
8
21
  The setup of the TSGO version of the LSP can be performed via the command line interface:
@@ -23,18 +36,25 @@ This will guide you through the installation process, which includes:
23
36
  > [!NOTE]
24
37
  > At the moment, you still need a native TypeScript install alongside `@effect/tsgo`: `typescript` >= 7 (e.g. `typescript@latest` or `typescript@next`) or an alias such as `@typescript/native`. `effect-tsgo patch` tries `typescript`, then `@typescript/native`, and accepts `--typescript-package <name>` to try a custom package name first.
25
38
 
26
- ### Experimental: patch your installed tsrs
39
+ ### Run the patched tools without patching
27
40
 
28
- If you use [tsrs](https://github.com/oxc-project/tsrs), the Rust port of TypeScript-Go, `effect-tsgo patch --tsrs` patches it too: it swaps the binary of your installed `tsrs` package (`node_modules/@tsrs/<platform>/tsrs`) for an experimental Effect-patched build of the same tsrs version, so `tsrs` reports the Effect diagnostics. Your TypeScript install is patched as usual; use `effect-tsgo patch --no-typescript --tsrs` to patch only tsrs.
41
+ `effect-tsgo patch` rewrites files inside `node_modules`, which is not possible (or not desirable) with shared or read-only package stores, such as the pnpm global virtual store, Yarn PnP or Nix. Instead, `effect-tsgo` can run the Effect-patched builds it ships directly, leaving `node_modules` untouched:
29
42
 
30
43
  ```sh
31
- npm i -D tsrs@<version>
32
- effect-tsgo patch --tsrs # e.g. in the prepare script
33
- npx tsrs --noEmit # now with Effect diagnostics
34
- effect-tsgo unpatch --tsrs # restores tsrs's original binary
44
+ effect-tsgo tsc -p tsconfig.json # the Effect-patched tsc
45
+ effect-tsgo tsc@7.0.2 --lsp --stdio # a specific TypeScript version
46
+ effect-tsgo tsc@next --build # or an upstream tag: latest, beta, next
47
+ effect-tsgo tsrs --noEmit # the Effect-patched tsrs (tsrs@<version> and tsrs@latest work too)
48
+ effect-tsgo oxlint --type-aware # Oxlint with the Effect rules
35
49
  ```
36
50
 
37
- The patched build is available for macOS arm64 and Linux x64/arm64 (glibc), for the tsrs versions this `@effect/tsgo` release supports. A tsrs version or platform (such as Linux musl) without a patched build makes `patch --tsrs` fail with the reason, or skip tsrs with `--skip-missing`.
51
+ Every argument after the tool is passed through unchanged, so the commands work as drop-in replacements in `package.json` scripts and editor settings that launch `tsc`.
52
+
53
+ - `tsc` and `tsrs` run the requested version or tag; without one they run the build of the installed `typescript`/`@typescript/native` (>= 7) or `tsrs` version when this release ships it, and otherwise the latest supported version. They do not require TypeScript or tsrs to be installed.
54
+ - `oxlint` runs the CLI of the installed `oxlint` package (installed directly or through `vite-plus`) with the Effect-patched native binding and, when `oxlint-tsgolint` is installed, the Effect-patched `tsgolint` of the installed versions. It does not accept a version.
55
+ - As with `patch`, the packaged `tsrs` and `oxlint` builds do not support Linux musl.
56
+
57
+ Prefer these commands whenever you cannot or do not want to modify `node_modules`; prefer `patch` when other tools must keep launching the stock binaries (for example `npx tsc`, or editor extensions that resolve the TypeScript package). Note that the type augmentation that adds the `effecttsgo` plugin and rules to Oxlint's config types (for `oxlint.config.ts`) is applied only by `patch`.
38
58
 
39
59
  ## LSP-based linter
40
60
 
@@ -48,18 +68,6 @@ When running in `tsc` mode, the Effect diagnostics are emitted as standard TypeS
48
68
 
49
69
  When running in dedicated diagnostics mode, the Effect diagnostics can be emitted in structured formats, which can be further processed by other tools.
50
70
 
51
- <!-- supported-components:start -->
52
- ## Supported Package Versions
53
-
54
- The following target package versions are supported by `@effect/tsgo@0.57.0`:
55
-
56
- | Component | Supported versions |
57
- |---|---|
58
- | TypeScript | `7.0.2`, `7.1.0-beta`, `7.1.0-dev.20260929`, `7.1.0-dev.20261023.1` |
59
- | Oxlint | `1.87.0`, `1.88.0`, `1.89.0` |
60
- | oxlint-tsgolint | `7.0.2004`, `7.0.2005` |
61
- <!-- supported-components:end -->
62
-
63
71
  ## Diagnostic Status
64
72
 
65
73
  Some diagnostics are off by default or have a default severity of suggestion, but you can always enable them or change their default severity in the plugin options.
@@ -44,6 +44,7 @@ let node_readline = require("node:readline");
44
44
  node_readline = __toESM(node_readline);
45
45
  let node_module = require("node:module");
46
46
  node_module = __toESM(node_module);
47
+ let node_fs_promises = require("node:fs/promises");
47
48
 
48
49
  //#region ../../node_modules/.pnpm/effect@4.0.2/node_modules/effect/dist/Pipeable.js
49
50
  /**
@@ -38020,7 +38021,7 @@ const positionToNumber = (position, method) => try_({
38020
38021
  try: () => bigintToNumber(position, "position"),
38021
38022
  catch: handleBadArgument(method)
38022
38023
  });
38023
- const access = /* @__PURE__ */ (() => {
38024
+ const access$1 = /* @__PURE__ */ (() => {
38024
38025
  const nodeAccess = /* @__PURE__ */ effectify(node_fs.access, /* @__PURE__ */ handleErrnoException("FileSystem", "access"), /* @__PURE__ */ handleBadArgument("access"));
38025
38026
  return (path, options) => {
38026
38027
  let mode = node_fs.constants.F_OK;
@@ -38338,7 +38339,7 @@ const writeFile = (path, data, options) => callback$1((resume, signal) => {
38338
38339
  }
38339
38340
  });
38340
38341
  const makeFileSystem = /* @__PURE__ */ map$5(/* @__PURE__ */ serviceOption(WatchBackend), (backend) => make$19({
38341
- access,
38342
+ access: access$1,
38342
38343
  chmod,
38343
38344
  chown,
38344
38345
  copy,
@@ -52481,6 +52482,37 @@ const withDescription = /* @__PURE__ */ dual(2, (self, description) => makeComma
52481
52482
  ...toImpl(self),
52482
52483
  description
52483
52484
  }));
52485
+ /**
52486
+ * Sets usage examples for a command.
52487
+ *
52488
+ * **Details**
52489
+ *
52490
+ * Examples are exposed in structured `HelpDoc` data and rendered by the
52491
+ * default formatter in an `EXAMPLES` section.
52492
+ *
52493
+ * **Example** (Adding usage examples)
52494
+ *
52495
+ * ```ts import.meta.vitest
52496
+ * import { Command } from "effect/cli"
52497
+ *
52498
+ * const login = Command.make("login").pipe(
52499
+ * Command.withExamples([
52500
+ * { command: "myapp login", description: "Log in with browser OAuth" },
52501
+ * { command: "myapp login --token sbp_abc123", description: "Log in with a token" }
52502
+ * ])
52503
+ * )
52504
+ *
52505
+ * login.examples.map((example) => example.command) // => ["myapp login", "myapp login --token sbp_abc123"]
52506
+ * ```
52507
+ *
52508
+ * @stability unstable
52509
+ * @category combinators
52510
+ * @since 4.0.0
52511
+ */
52512
+ const withExamples = /* @__PURE__ */ dual(2, (self, examples) => makeCommand({
52513
+ ...toImpl(self),
52514
+ examples
52515
+ }));
52484
52516
  const getOutOfScopeGlobalFlagErrors = (allFlags, activeFlags, flagMap, commandPath) => {
52485
52517
  const activeSet = new Set(activeFlags);
52486
52518
  const errors = [];
@@ -52737,7 +52769,7 @@ const runWith = (command, config) => {
52737
52769
  //#endregion
52738
52770
  //#region package.json
52739
52771
  var name = "@effect/tsgo";
52740
- var version = "0.57.0";
52772
+ var version = "0.59.0";
52741
52773
 
52742
52774
  //#endregion
52743
52775
  //#region src/metadata.json
@@ -55390,11 +55422,11 @@ var tags = {
55390
55422
  "typescript": {
55391
55423
  "latest": "7.0.2",
55392
55424
  "beta": "7.1.0-beta",
55393
- "next": "7.1.0-dev.20261023.1"
55425
+ "next": "7.1.0-dev.20261026.1"
55394
55426
  },
55395
55427
  "oxlint": { "latest": "1.89.0" },
55396
55428
  "oxlint-tsgolint": { "latest": "7.0.2005" },
55397
- "tsrs": { "latest": "0.18.0-ts7.1.0-dev.20260929" }
55429
+ "tsrs": { "latest": "0.20.0-ts7.1.0-beta" }
55398
55430
  };
55399
55431
  var components = {
55400
55432
  "typescript": {
@@ -55406,12 +55438,8 @@ var components = {
55406
55438
  "gitHead": "3e9236361fa97a9e6c685f4833ac457ae2d8c50a",
55407
55439
  "provider": "typescript"
55408
55440
  },
55409
- "7.1.0-dev.20260929": {
55410
- "gitHead": "b85298b6a81f772d080b0455de0ca9d744cd6fd6",
55411
- "provider": "typescript"
55412
- },
55413
- "7.1.0-dev.20261023.1": {
55414
- "gitHead": "a91e93821feafd081641f9f5d161eba626d0b2ce",
55441
+ "7.1.0-dev.20261026.1": {
55442
+ "gitHead": "8a62bbe746909624b69b6e671026b454da2f02cf",
55415
55443
  "provider": "typescript"
55416
55444
  }
55417
55445
  },
@@ -55430,11 +55458,11 @@ var components = {
55430
55458
  "1.88.0": { "gitHead": "6941b4ed45ead21c45bc2164cb80a180eed85b43" },
55431
55459
  "1.89.0": { "gitHead": "07ed78f4abde4020ca7919381ffea4da8616b78a" }
55432
55460
  },
55433
- "tsrs": { "0.18.0-ts7.1.0-dev.20260929": {
55434
- "gitHead": "5f92808bc92bb97b06212153ab73d28d551c0b9b",
55461
+ "tsrs": { "0.20.0-ts7.1.0-beta": {
55462
+ "gitHead": "d197eeea709616d61930c2bd5eac048471e404b8",
55435
55463
  "typescript": {
55436
- "version": "7.1.0-dev.20260929",
55437
- "gitHead": "b85298b6a81f772d080b0455de0ca9d744cd6fd6"
55464
+ "version": "7.1.0-beta",
55465
+ "gitHead": "3e9236361fa97a9e6c685f4833ac457ae2d8c50a"
55438
55466
  }
55439
55467
  } }
55440
55468
  };
@@ -55474,13 +55502,16 @@ const readPackage = (require, packageName) => gen(function* () {
55474
55502
  catch: () => new DiscoveryError({ reason: `Unable to parse ${packageJsonPath}.` })
55475
55503
  });
55476
55504
  if (typeof json !== "object" || json === null || !("version" in json) || typeof json.version !== "string") return yield* new DiscoveryError({ reason: `${packageJsonPath} does not contain a version.` });
55505
+ const bin = "bin" in json ? json.bin : void 0;
55477
55506
  return {
55478
55507
  packageJsonPath,
55479
55508
  version: json.version,
55480
- ..."main" in json && typeof json.main === "string" ? { main: json.main } : {}
55509
+ ..."main" in json && typeof json.main === "string" ? { main: json.main } : {},
55510
+ ...typeof bin === "string" || typeof bin === "object" && bin !== null ? { bin } : {}
55481
55511
  };
55482
55512
  });
55483
55513
  const optionally = (effect) => effect.pipe(catchTag("DiscoveryError", (error) => error.reason.startsWith("Unable to resolve ") ? succeed$2(void 0) : fail$2(error)));
55514
+ const findInstalledPackage = (require, packageName) => optionally(readPackage(require, packageName));
55484
55515
  const isGlibc = () => {
55485
55516
  if (process.platform !== "linux") return false;
55486
55517
  return typeof ((process.report?.getReport())?.header)?.glibcVersionRuntime === "string";
@@ -55490,9 +55521,11 @@ const experimentalOxlintTarget = (platform, arch, glibc) => {
55490
55521
  if (platform !== "linux" && platform !== "darwin" && platform !== "win32") throw new DiscoveryError({ reason: `Unsupported platform ${platform}.` });
55491
55522
  const packageTarget = `${platform}-${arch}`;
55492
55523
  const codeTarget = platform === "linux" ? `${packageTarget}-${glibc ? "gnu" : "musl"}` : packageTarget;
55524
+ const oxlintTarget = platform === "win32" ? `${codeTarget}-msvc` : codeTarget;
55493
55525
  return {
55494
55526
  codeTarget,
55495
- oxlintPackage: `@oxlint/binding-${platform === "win32" ? `${codeTarget}-msvc` : codeTarget}`,
55527
+ oxlintBinding: `oxlint.${oxlintTarget}.node`,
55528
+ oxlintPackage: `@oxlint/binding-${oxlintTarget}`,
55496
55529
  tsgolintPackage: `@oxlint-tsgolint/${packageTarget}`,
55497
55530
  tsgolintExecutable: platform === "win32" ? "tsgolint.exe" : "tsgolint"
55498
55531
  };
@@ -55671,28 +55704,33 @@ const resolveOxlintDeclarations = (target) => gen(function* () {
55671
55704
  fileHash: yield* hashBytes(replacement).pipe(mapError((error) => new PatcherError({ reason: `Unable to hash generated Oxlint declarations: ${error.message}` })))
55672
55705
  };
55673
55706
  });
55674
- const resolvePlatformPackage = (target) => gen(function* () {
55707
+ const resolvePlatformPackageDirectory = gen(function* () {
55675
55708
  const path = yield* Path$2;
55676
55709
  const packageName = `@effect/tsgo-${process.platform}-${process.arch}`;
55677
55710
  const selfRequire = node_module.createRequire(require("url").pathToFileURL(__filename).href);
55678
55711
  const packageJsonPath = yield* try_({
55679
55712
  try: () => selfRequire.resolve(`${packageName}/package.json`),
55680
- catch: () => new ReplacementUnavailableError({
55681
- target,
55682
- reason: `Unable to resolve ${packageName}; no packaged replacement is available.`
55683
- })
55713
+ catch: () => new PatcherError({ reason: `Unable to resolve ${packageName}; no packaged replacement is available.` })
55684
55714
  });
55685
- return { packageDir: path.dirname(packageJsonPath) };
55715
+ return path.dirname(packageJsonPath);
55686
55716
  });
55717
+ const resolvePlatformPackage = (target) => resolvePlatformPackageDirectory.pipe(map$5((packageDir) => ({ packageDir })), mapError(({ reason }) => new ReplacementUnavailableError({
55718
+ target,
55719
+ reason
55720
+ })));
55687
55721
  const tsrsReplacementTargets = [
55688
55722
  "darwin-arm64",
55689
55723
  "linux-x64-gnu",
55690
55724
  "linux-arm64-gnu"
55691
55725
  ];
55726
+ const packagedComponentPath = (packageDir, component, version, fileName) => gen(function* () {
55727
+ const path = yield* Path$2;
55728
+ return component === "typescript" && version === tags.typescript.latest ? path.join(packageDir, "lib", fileName) : path.join(packageDir, "artifacts", component, version, fileName);
55729
+ });
55692
55730
  const packagedArtifactPath = (packageDir, target) => gen(function* () {
55693
55731
  const path = yield* Path$2;
55694
55732
  const fileName = path.basename(target.binaryPath);
55695
- return target.component === "typescript" && target.packageVersion === tags.typescript.latest ? path.join(packageDir, "lib", fileName) : path.join(packageDir, "artifacts", target.component, target.packageVersion, fileName);
55733
+ return target.component === "oxlint-dts" ? path.join(packageDir, "artifacts", target.component, target.packageVersion, fileName) : yield* packagedComponentPath(packageDir, target.component, target.packageVersion, fileName);
55696
55734
  });
55697
55735
  const resolveReplacement = (target) => gen(function* () {
55698
55736
  const fs = yield* FileSystem;
@@ -204868,6 +204906,272 @@ const integrationFlags = {
204868
204906
  };
204869
204907
  const ensureIntegrationSelected = (typescript, oxlint, tsrs = false) => typescript || oxlint || tsrs ? void_$1 : fail$2(new IntegrationSelectionError({ reason: "Select at least one integration to manage." }));
204870
204908
 
204909
+ //#endregion
204910
+ //#region src/cli/proxy/exec.ts
204911
+ const nodeExecHost = {
204912
+ platform: process.platform,
204913
+ execve: typeof process.execve === "function" ? (file, args, env) => process.execve(file, args, env) : void 0,
204914
+ spawn: (file, args, options) => node_child_process.spawn(file, args, options),
204915
+ parent: process,
204916
+ reportError: (message) => process.stderr.write(`${message}\n`)
204917
+ };
204918
+ const forwardedSignals = (platform) => platform === "win32" ? [
204919
+ "SIGINT",
204920
+ "SIGTERM",
204921
+ "SIGHUP",
204922
+ "SIGBREAK"
204923
+ ] : [
204924
+ "SIGINT",
204925
+ "SIGTERM",
204926
+ "SIGHUP",
204927
+ "SIGQUIT"
204928
+ ];
204929
+ const execProxyCommand = (command, host = nodeExecHost) => {
204930
+ if (host.platform !== "win32" && host.execve !== void 0) try {
204931
+ host.execve(command.file, [command.file, ...command.args], command.env);
204932
+ } catch {}
204933
+ const signals = forwardedSignals(host.platform);
204934
+ const listening = [];
204935
+ let settled = false;
204936
+ let child;
204937
+ const forward = (signal) => {
204938
+ try {
204939
+ child?.kill(signal);
204940
+ } catch {}
204941
+ };
204942
+ const settle = (onSettled) => {
204943
+ if (settled) return;
204944
+ settled = true;
204945
+ for (const signal of listening) host.parent.off(signal, forward);
204946
+ onSettled();
204947
+ };
204948
+ const fail = (error) => settle(() => {
204949
+ host.reportError(`Failed to run ${command.file}: ${error instanceof Error ? error.message : String(error)}`);
204950
+ host.parent.exitCode = 1;
204951
+ });
204952
+ try {
204953
+ child = host.spawn(command.file, command.args, {
204954
+ stdio: "inherit",
204955
+ env: command.env
204956
+ });
204957
+ } catch (error) {
204958
+ fail(error);
204959
+ return;
204960
+ }
204961
+ child.on("error", fail);
204962
+ child.on("exit", (status, signal) => settle(() => propagateDiagnosticsExit({
204963
+ status,
204964
+ signal
204965
+ }, host.parent)));
204966
+ for (const signal of signals) {
204967
+ if (settled) break;
204968
+ try {
204969
+ host.parent.on(signal, forward);
204970
+ listening.push(signal);
204971
+ } catch {}
204972
+ }
204973
+ };
204974
+
204975
+ //#endregion
204976
+ //#region src/cli/proxy/resolve.ts
204977
+ var ProxyError = class extends TaggedError$1("ProxyError") {
204978
+ get message() {
204979
+ return this.reason;
204980
+ }
204981
+ };
204982
+ var UnsupportedProxyVersionError = class extends TaggedError$1("UnsupportedProxyVersionError") {
204983
+ get message() {
204984
+ const tags = Object.entries(this.tags).map(([tag, version]) => `${tag} (${version})`);
204985
+ return this.source === "requested" ? `${this.packageName}@${this.version} is not supported by @effect/tsgo version ${version}. Supported versions: ${this.supportedVersions.join(", ")}` + (tags.length === 0 ? "." : `; tags: ${tags.join(", ")}.`) : `Installed ${this.packageName} version ${this.version} is not supported by @effect/tsgo version ${version}. Either change @effect/tsgo to a compatible version or set ${this.packageName} to one of the supported versions: ${this.supportedVersions.join(", ")}.`;
204986
+ }
204987
+ };
204988
+ const upstreamTags = (component) => tags[component];
204989
+ const selectVersion = (tool, component, requested, installed) => gen(function* () {
204990
+ const versions = supportedVersions(component);
204991
+ const tags = upstreamTags(component);
204992
+ if (requested !== void 0) {
204993
+ if (requested === "") return yield* new ProxyError({ reason: `Expected a version or tag after ${tool}@.` });
204994
+ const version = Object.hasOwn(tags, requested) ? tags[requested] : requested;
204995
+ if (versions.includes(version)) return version;
204996
+ return yield* new UnsupportedProxyVersionError({
204997
+ packageName: tool,
204998
+ version: requested,
204999
+ source: "requested",
205000
+ supportedVersions: versions,
205001
+ tags
205002
+ });
205003
+ }
205004
+ if (installed !== void 0 && versions.includes(installed)) return installed;
205005
+ return tags.latest;
205006
+ });
205007
+ const projectRequire = (context) => gen(function* () {
205008
+ const path = yield* Path$2;
205009
+ return node_module.createRequire(path.join(context.cwd, "noop.js"));
205010
+ });
205011
+ const toProxyError = (error) => new ProxyError({ reason: error.message });
205012
+ const installedTypescriptVersion = (context) => gen(function* () {
205013
+ const require = yield* projectRequire(context);
205014
+ for (const packageName of defaultTypescriptPackageNames$1) {
205015
+ const installed = yield* findInstalledPackage(require, packageName).pipe(mapError(toProxyError));
205016
+ if (installed !== void 0 && isNativeTypescriptVersion$1(installed.version)) return installed.version;
205017
+ }
205018
+ });
205019
+ const installedTsrsVersion = (context) => gen(function* () {
205020
+ return (yield* findInstalledPackage(yield* projectRequire(context), "tsrs").pipe(mapError(toProxyError)))?.version;
205021
+ });
205022
+ const requireArtifact = (artifactPath) => gen(function* () {
205023
+ if (!(yield* (yield* FileSystem).exists(artifactPath).pipe(mapError(toProxyError)))) return yield* new ProxyError({ reason: `Missing packaged artifact ${artifactPath}.` });
205024
+ return artifactPath;
205025
+ });
205026
+ const ensureExecutable = (filePath, platform) => gen(function* () {
205027
+ if (platform === "win32") return;
205028
+ const fs = yield* FileSystem;
205029
+ if (yield* promise(() => (0, node_fs_promises.access)(filePath, node_fs.constants.X_OK).then(() => true, () => false))) return;
205030
+ yield* fs.chmod(filePath, 493).pipe(mapError((error) => new ProxyError({ reason: `Failed to set executable permissions on ${filePath}: ${error.message}` })));
205031
+ });
205032
+ const executablePath = (filePath, platform) => platform === "win32" && filePath.length >= 248 ? node_path.win32.toNamespacedPath(filePath) : filePath;
205033
+ const tscExecutable = (context, version) => packagedComponentPath(context.packageDirectory, "typescript", version, context.platform === "win32" ? "tsc.exe" : "tsc");
205034
+ const tsrsExecutable = (context, version) => packagedComponentPath(context.packageDirectory, "tsrs", version, "tsrs");
205035
+ const resolveTsc = (context, invocation) => gen(function* () {
205036
+ const installed = invocation.version === void 0 ? yield* installedTypescriptVersion(context) : void 0;
205037
+ const executable = yield* requireArtifact(yield* tscExecutable(context, yield* selectVersion("tsc", "typescript", invocation.version, installed)));
205038
+ yield* ensureExecutable(executable, context.platform);
205039
+ return {
205040
+ file: executablePath(executable, context.platform),
205041
+ args: invocation.args,
205042
+ env: context.env
205043
+ };
205044
+ });
205045
+ const resolveTsrs = (context, invocation) => gen(function* () {
205046
+ const fs = yield* FileSystem;
205047
+ const path = yield* Path$2;
205048
+ if (context.platform === "linux" && !context.isGlibc()) return yield* new ProxyError({ reason: `Linux musl is not supported by the packaged tsrs integration; it is built for ${tsrsReplacementTargets.join(", ")}.` });
205049
+ const target = tsrsTarget(context.platform, context.arch, true);
205050
+ if (target === void 0 || !tsrsReplacementTargets.includes(target)) return yield* new ProxyError({ reason: `The packaged tsrs integration is not available for ${context.platform}-${context.arch}; it is built for ${tsrsReplacementTargets.join(", ")}.` });
205051
+ const installed = invocation.version === void 0 ? yield* installedTsrsVersion(context) : void 0;
205052
+ const executable = yield* requireArtifact(yield* tsrsExecutable(context, yield* selectVersion("tsrs", "tsrs", invocation.version, installed)));
205053
+ const libraryPath = path.join(path.dirname(executable), "lib.d.ts");
205054
+ if (!(yield* fs.exists(libraryPath).pipe(mapError(toProxyError)))) return yield* new ProxyError({ reason: `Missing ${libraryPath}: tsrs needs its lib*.d.ts files next to the packaged binary ${executable}. Reinstall @effect/tsgo-${context.platform}-${context.arch}.` });
205055
+ yield* ensureExecutable(executable, context.platform);
205056
+ return {
205057
+ file: executable,
205058
+ args: invocation.args,
205059
+ env: context.env
205060
+ };
205061
+ });
205062
+ const findOxlintInstallation = (cwd) => gen(function* () {
205063
+ const path = yield* Path$2;
205064
+ const find = (require, packageName) => findInstalledPackage(require, packageName).pipe(mapError(toProxyError));
205065
+ const cwdRequire = node_module.createRequire(path.join(cwd, "noop.js"));
205066
+ const vitePlus = yield* find(cwdRequire, "vite-plus");
205067
+ const scopes = [cwdRequire, ...vitePlus === void 0 ? [] : [node_module.createRequire(vitePlus.packageJsonPath)]];
205068
+ for (const require of scopes) {
205069
+ const oxlint = yield* find(require, "oxlint");
205070
+ if (oxlint !== void 0) return {
205071
+ oxlint,
205072
+ tsgolint: yield* find(require, "oxlint-tsgolint")
205073
+ };
205074
+ }
205075
+ });
205076
+ const oxlintBinPath = (oxlint) => gen(function* () {
205077
+ const path = yield* Path$2;
205078
+ const bin = typeof oxlint.bin === "string" ? oxlint.bin : oxlint.bin?.oxlint;
205079
+ if (bin === void 0) return yield* new ProxyError({ reason: `${oxlint.packageJsonPath} does not declare an oxlint bin entry.` });
205080
+ return path.resolve(path.dirname(oxlint.packageJsonPath), bin);
205081
+ });
205082
+ const supportedInstalledVersion = (component, installed) => {
205083
+ const versions = supportedVersions(component);
205084
+ return versions.includes(installed.version) ? succeed$2(installed.version) : fail$2(new UnsupportedProxyVersionError({
205085
+ packageName: component,
205086
+ version: installed.version,
205087
+ source: "installed",
205088
+ supportedVersions: versions,
205089
+ tags: {}
205090
+ }));
205091
+ };
205092
+ const oxlintCommand = (context, args, installation) => gen(function* () {
205093
+ const target = yield* try_({
205094
+ try: () => experimentalOxlintTarget(context.platform, context.arch, context.platform === "linux" && context.isGlibc()),
205095
+ catch: (error) => new ProxyError({ reason: error instanceof Error ? error.message : String(error) })
205096
+ });
205097
+ const oxlintVersion = yield* supportedInstalledVersion("oxlint", installation.oxlint);
205098
+ const binding = yield* requireArtifact(yield* packagedComponentPath(context.packageDirectory, "oxlint", oxlintVersion, target.oxlintBinding));
205099
+ let tsgolint;
205100
+ if (installation.tsgolint !== void 0) {
205101
+ const tsgolintVersion = yield* supportedInstalledVersion("oxlint-tsgolint", installation.tsgolint);
205102
+ tsgolint = yield* requireArtifact(yield* packagedComponentPath(context.packageDirectory, "oxlint-tsgolint", tsgolintVersion, target.tsgolintExecutable));
205103
+ yield* ensureExecutable(tsgolint, context.platform);
205104
+ }
205105
+ const bin = yield* oxlintBinPath(installation.oxlint);
205106
+ return {
205107
+ file: context.execPath,
205108
+ args: [bin, ...args],
205109
+ env: {
205110
+ ...context.env,
205111
+ NAPI_RS_NATIVE_LIBRARY_PATH: binding,
205112
+ ...tsgolint === void 0 ? {} : { OXLINT_TSGOLINT_PATH: tsgolint }
205113
+ }
205114
+ };
205115
+ });
205116
+ const resolveOxlint = (context, invocation) => gen(function* () {
205117
+ if (invocation.version !== void 0) return yield* new ProxyError({ reason: `oxlint@${invocation.version} is not supported: the packaged Oxlint build is selected by the installed oxlint version. Run effect-tsgo oxlint instead.` });
205118
+ if (context.platform === "linux" && !context.isGlibc()) return yield* new ProxyError({ reason: "Linux musl is not supported by the packaged Oxlint integration." });
205119
+ const installation = yield* findOxlintInstallation(context.cwd);
205120
+ if (installation === void 0) return yield* new ProxyError({ reason: `Unable to resolve oxlint from ${context.cwd}. Install oxlint (or vite-plus) in the project.` });
205121
+ return yield* oxlintCommand(context, invocation.args, installation);
205122
+ });
205123
+ const resolveProxyCommand = (invocation, context) => {
205124
+ switch (invocation.tool) {
205125
+ case "tsc": return resolveTsc(context, invocation);
205126
+ case "tsrs": return resolveTsrs(context, invocation);
205127
+ case "oxlint": return resolveOxlint(context, invocation);
205128
+ }
205129
+ };
205130
+
205131
+ //#endregion
205132
+ //#region src/cli/proxy/argv.ts
205133
+ const proxyTools = [
205134
+ "tsc",
205135
+ "tsrs",
205136
+ "oxlint"
205137
+ ];
205138
+ const isProxyTool = (value) => proxyTools.includes(value);
205139
+ const parseProxyInvocation = (argv) => {
205140
+ const [first, ...args] = argv;
205141
+ if (first === void 0) return void 0;
205142
+ const separator = first.indexOf("@");
205143
+ const tool = separator === -1 ? first : first.slice(0, separator);
205144
+ if (!isProxyTool(tool)) return void 0;
205145
+ return {
205146
+ tool,
205147
+ version: separator === -1 ? void 0 : first.slice(separator + 1),
205148
+ args
205149
+ };
205150
+ };
205151
+
205152
+ //#endregion
205153
+ //#region src/cli/proxy/index.ts
205154
+ const runProxy = (invocation, host = nodeExecHost) => {
205155
+ const program = gen(function* () {
205156
+ const packageDirectory = yield* resolvePlatformPackageDirectory.pipe(mapError(({ reason }) => new ProxyError({ reason })));
205157
+ return yield* resolveProxyCommand(invocation, {
205158
+ cwd: process.cwd(),
205159
+ env: process.env,
205160
+ execPath: process.execPath,
205161
+ platform: process.platform,
205162
+ arch: process.arch,
205163
+ isGlibc,
205164
+ packageDirectory
205165
+ });
205166
+ }).pipe(provide(layer));
205167
+ return runPromiseExit(program).then((exit) => {
205168
+ if (isSuccess$1(exit)) return execProxyCommand(exit.value, host);
205169
+ const error = squash(exit.cause);
205170
+ host.reportError(`effect-tsgo ${invocation.tool}: ${error instanceof Error ? error.message : String(error)}`);
205171
+ host.parent.exitCode = 1;
205172
+ });
205173
+ };
205174
+
204871
205175
  //#endregion
204872
205176
  //#region src/cli/presets.ts
204873
205177
  const metadata = metadata_default;
@@ -205230,13 +205534,37 @@ const diagnosticsCommand = make("diagnostics", {
205230
205534
  listFiles
205231
205535
  }));
205232
205536
  })));
205233
- make("tsgo").pipe(withSubcommands([
205537
+ const rootCommand = make("tsgo").pipe(withDescription("Effect Language Service for TypeScript-Go. Besides the commands below, `effect-tsgo tsc[@<version|tag>] [args...]`, `effect-tsgo tsrs[@<version|tag>] [args...]` and `effect-tsgo oxlint [args...]` run the Effect-patched tsc, tsrs and Oxlint straight from @effect/tsgo without patching node_modules, passing every argument after the tool through unchanged. Without a version, tsc and tsrs use the installed version when supported, else the latest supported one; oxlint uses the build of the installed oxlint."), withExamples([
205538
+ {
205539
+ command: "effect-tsgo tsc -p tsconfig.json",
205540
+ description: "Type check with the Effect-patched tsc"
205541
+ },
205542
+ {
205543
+ command: "effect-tsgo tsc@7.0.2 --lsp --stdio",
205544
+ description: "Start the language server of a given TypeScript version"
205545
+ },
205546
+ {
205547
+ command: "effect-tsgo tsc@next --build",
205548
+ description: "Use the version behind an upstream tag (latest, beta, next)"
205549
+ },
205550
+ {
205551
+ command: "effect-tsgo tsrs --noEmit",
205552
+ description: "Type check with the Effect-patched tsrs"
205553
+ },
205554
+ {
205555
+ command: "effect-tsgo oxlint --type-aware",
205556
+ description: "Lint with the Effect-patched Oxlint and tsgolint"
205557
+ }
205558
+ ]), withSubcommands([
205234
205559
  patchCommand,
205235
205560
  unpatchCommand,
205236
205561
  getExePathCommand,
205237
205562
  diagnosticsCommand,
205238
205563
  setupCommand,
205239
205564
  configCommand
205240
- ])).pipe(run({ version }), provide(layer), runMain());
205565
+ ]));
205566
+ const proxyInvocation = parseProxyInvocation(process.argv.slice(2));
205567
+ if (proxyInvocation !== void 0) runProxy(proxyInvocation);
205568
+ else rootCommand.pipe(run({ version }), provide(layer), runMain());
205241
205569
 
205242
205570
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect/tsgo",
3
- "version": "0.57.0",
3
+ "version": "0.59.0",
4
4
  "type": "module",
5
5
  "description": "Effect Language Service for TypeScript-Go — Effect-specific diagnostics and hover features.",
6
6
  "license": "MIT",
@@ -41,13 +41,13 @@
41
41
  "schema.json"
42
42
  ],
43
43
  "optionalDependencies": {
44
- "@effect/tsgo-win32-arm64": "0.57.0",
45
- "@effect/tsgo-linux-x64": "0.57.0",
46
- "@effect/tsgo-linux-arm64": "0.57.0",
47
- "@effect/tsgo-linux-arm": "0.57.0",
48
- "@effect/tsgo-darwin-x64": "0.57.0",
49
- "@effect/tsgo-win32-x64": "0.57.0",
50
- "@effect/tsgo-darwin-arm64": "0.57.0"
44
+ "@effect/tsgo-win32-x64": "0.59.0",
45
+ "@effect/tsgo-win32-arm64": "0.59.0",
46
+ "@effect/tsgo-linux-x64": "0.59.0",
47
+ "@effect/tsgo-linux-arm64": "0.59.0",
48
+ "@effect/tsgo-linux-arm": "0.59.0",
49
+ "@effect/tsgo-darwin-x64": "0.59.0",
50
+ "@effect/tsgo-darwin-arm64": "0.59.0"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@effect/platform-node": "^4.0.2",
package/schema.json CHANGED
@@ -567,6 +567,20 @@
567
567
  "markdownDescription": "Enables [experimental support for decorators](https://github.com/tc39/proposal-decorators), which is a version of decorators that predates the TC39 standardization process.\n\nDecorators are a language feature which hasn't yet been fully ratified into the JavaScript specification.\nThis means that the implementation version in TypeScript may differ from the implementation in JavaScript when it is decided by TC39.\n\nYou can find out more about decorator support in TypeScript in [the handbook](https://typescriptlang.org/docs/handbook/decorators.html).",
568
568
  "x-intellij-html-description": "\u003cp\u003eEnables \u003ca href=\"https://github.com/tc39/proposal-decorators\"\u003eexperimental support for decorators\u003c/a\u003e, which is a version of decorators that predates the TC39 standardization process.\u003c/p\u003e\n\u003cp\u003eDecorators are a language feature which hasn\u0026#39;t yet been fully ratified into the JavaScript specification.\nThis means that the implementation version in TypeScript may differ from the implementation in JavaScript when it is decided by TC39.\u003c/p\u003e\n\u003cp\u003eYou can find out more about decorator support in TypeScript in \u003ca href=\"https://typescriptlang.org/docs/handbook/decorators.html\"\u003ethe handbook\u003c/a\u003e.\u003c/p\u003e\n"
569
569
  },
570
+ "explainFiles": {
571
+ "anyOf": [
572
+ {
573
+ "type": "boolean"
574
+ },
575
+ {
576
+ "type": "null"
577
+ }
578
+ ],
579
+ "default": false,
580
+ "description": "Print files read during the compilation including why it was included.",
581
+ "markdownDescription": "Print files read during the compilation including why it was included.",
582
+ "x-intellij-html-description": "\u003cp\u003ePrint files read during the compilation including why it was included.\u003c/p\u003e\n"
583
+ },
570
584
  "extendedDiagnostics": {
571
585
  "anyOf": [
572
586
  {
@@ -621,6 +635,19 @@
621
635
  "markdownDescription": "This option gives you the chance to have TypeScript emit a v8 CPU profile during the compiler run. The CPU profile can provide insight into why your builds may be slow.\n\nThis option can only be used from the CLI via: `--generateCpuProfile tsc-output.cpuprofile`.\n\n```sh\nnpm run tsc --generateCpuProfile tsc-output.cpuprofile\n```\n\nThis file can be opened in a chromium based browser like Chrome or Edge Developer in [the CPU profiler](https://developers.google.com/web/tools/chrome-devtools/rendering-tools/js-execution) section.\nYou can learn more about understanding the compilers performance in the [TypeScript wiki section on performance](https://github.com/microsoft/TypeScript/wiki/Performance).",
622
636
  "x-intellij-html-description": "\u003cp\u003eThis option gives you the chance to have TypeScript emit a v8 CPU profile during the compiler run. The CPU profile can provide insight into why your builds may be slow.\u003c/p\u003e\n\u003cp\u003eThis option can only be used from the CLI via: \u003ccode\u003e--generateCpuProfile tsc-output.cpuprofile\u003c/code\u003e.\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"language-sh\"\u003enpm run tsc --generateCpuProfile tsc-output.cpuprofile\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eThis file can be opened in a chromium based browser like Chrome or Edge Developer in \u003ca href=\"https://developers.google.com/web/tools/chrome-devtools/rendering-tools/js-execution\"\u003ethe CPU profiler\u003c/a\u003e section.\nYou can learn more about understanding the compilers performance in the \u003ca href=\"https://github.com/microsoft/TypeScript/wiki/Performance\"\u003eTypeScript wiki section on performance\u003c/a\u003e.\u003c/p\u003e\n"
623
637
  },
638
+ "generateTrace": {
639
+ "anyOf": [
640
+ {
641
+ "type": "string"
642
+ },
643
+ {
644
+ "type": "null"
645
+ }
646
+ ],
647
+ "description": "Generates an event trace and a list of types in the given directory.",
648
+ "markdownDescription": "Generates an event trace and a list of types in the given directory.",
649
+ "x-intellij-html-description": "\u003cp\u003eGenerates an event trace and a list of types in the given directory.\u003c/p\u003e\n"
650
+ },
624
651
  "ignoreDeprecations": {
625
652
  "description": "Can be used to silence deprecation warnings about features, that are slated for removal in a future release. For example, if you are using a feature that is deprecated in TypeScript 6.0 but you want to continue using it without seeing warnings until it is removed in TypeScript 7.0, you can set `ignoreDeprecations` to `6.0`.",
626
653
  "enum": [
@@ -1978,6 +2005,20 @@
1978
2005
  "markdownDescription": "Specify the location where a debugger should locate TypeScript files instead of relative source locations.\nThis string is treated verbatim inside the source-map where you can use a path or a URL:\n\n```json tsconfig\n{\n \"compilerOptions\": {\n \"sourceMap\": true,\n \"sourceRoot\": \"https://my-website.com/debug/source/\"\n }\n}\n```\n\nWould declare that `index.js` will have a source file at `https://my-website.com/debug/source/index.ts`.",
1979
2006
  "x-intellij-html-description": "\u003cp\u003eSpecify the location where a debugger should locate TypeScript files instead of relative source locations.\nThis string is treated verbatim inside the source-map where you can use a path or a URL:\u003c/p\u003e\n\u003cpre\u003e\u003ccode class=\"language-json\"\u003e{\n \u0026quot;compilerOptions\u0026quot;: {\n \u0026quot;sourceMap\u0026quot;: true,\n \u0026quot;sourceRoot\u0026quot;: \u0026quot;https://my-website.com/debug/source/\u0026quot;\n }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\u003cp\u003eWould declare that \u003ccode\u003eindex.js\u003c/code\u003e will have a source file at \u003ccode\u003ehttps://my-website.com/debug/source/index.ts\u003c/code\u003e.\u003c/p\u003e\n"
1980
2007
  },
2008
+ "stableTypeOrdering": {
2009
+ "anyOf": [
2010
+ {
2011
+ "type": "boolean"
2012
+ },
2013
+ {
2014
+ "type": "null"
2015
+ }
2016
+ ],
2017
+ "default": false,
2018
+ "description": "Ensure types are ordered stably and deterministically across compilations.",
2019
+ "markdownDescription": "Ensure types are ordered stably and deterministically across compilations.",
2020
+ "x-intellij-html-description": "\u003cp\u003eEnsure types are ordered stably and deterministically across compilations.\u003c/p\u003e\n"
2021
+ },
1981
2022
  "strict": {
1982
2023
  "anyOf": [
1983
2024
  {