@effect/tsgo 0.57.0 → 0.61.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 +29 -20
- package/dist/effect-tsgo.cjs +384 -31
- package/oxlint-presets/index.js +3 -0
- package/oxlint-presets/recommended.json +1 -0
- package/oxlint-presets/strict.json +1 -0
- package/oxlint-presets/style.json +1 -0
- package/oxlint-schema.json +3 -0
- package/package.json +8 -8
- package/schema.json +49 -2
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.61.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
|
-
###
|
|
39
|
+
### Run the patched tools without patching
|
|
27
40
|
|
|
28
|
-
|
|
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
|
-
|
|
32
|
-
effect-tsgo
|
|
33
|
-
|
|
34
|
-
effect-tsgo
|
|
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
|
-
|
|
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.
|
|
@@ -165,6 +173,7 @@ Some diagnostics are off by default or have a default severity of suggestion, bu
|
|
|
165
173
|
<tr><td><a href="https://github.com/Effect-TS/tsgo/blob/main/docs/rules/effect-sleep-zero-to-yield-now.md"><code>effectSleepZeroToYieldNow</code></a></td><td>Suggests Effect.yieldNow for cooperative yielding instead of sleeping for zero duration</td></tr>
|
|
166
174
|
<tr><td><a href="https://github.com/Effect-TS/tsgo/blob/main/docs/rules/effect-succeed-with-void.md"><code>effectSucceedWithVoid</code></a></td><td>Suggests using Effect.void instead of Effect.succeed(undefined) or Effect.succeed(void 0)</td></tr>
|
|
167
175
|
<tr><td><a href="https://github.com/Effect-TS/tsgo/blob/main/docs/rules/flat-map-conditional-to-filter-or-fail.md"><code>flatMapConditionalToFilterOrFail</code></a></td><td>Suggests Effect.filterOrFail or Effect.filterOrElse when Effect.flatMap conditionally passes its input through with Effect.succeed</td></tr>
|
|
176
|
+
<tr><td><a href="https://github.com/Effect-TS/tsgo/blob/main/docs/rules/flat-map-identity-to-flatten.md"><code>flatMapIdentityToFlatten</code></a></td><td>Suggests Effect.flatten instead of Effect.flatMap when the callback is Effect's identity export referenced directly or an unannotated function returning its parameter</td></tr>
|
|
168
177
|
<tr><td><a href="https://github.com/Effect-TS/tsgo/blob/main/docs/rules/flat-map-ignored-param-to-and-then.md"><code>flatMapIgnoredParamToAndThen</code></a></td><td>Suggests using Effect.andThen instead of Effect.flatMap when a zero-parameter callback returns an existing Effect value</td></tr>
|
|
169
178
|
<tr><td><a href="https://github.com/Effect-TS/tsgo/blob/main/docs/rules/flat-map-to-map.md"><code>flatMapToMap</code></a></td><td>Suggests using Effect.map instead of Effect.flatMap when the callback only wraps its result with Effect.succeed</td></tr>
|
|
170
179
|
<tr><td><a href="https://github.com/Effect-TS/tsgo/blob/main/docs/rules/flat-map-to-tap.md"><code>flatMapToTap</code></a></td><td>Suggests Effect.tap when a flatMap or andThen callback runs an effect and returns its unchanged parameter</td></tr>
|
|
@@ -181,7 +190,7 @@ Some diagnostics are off by default or have a default severity of suggestion, bu
|
|
|
181
190
|
<tr><td><a href="https://github.com/Effect-TS/tsgo/blob/main/docs/rules/prefer-barrel-import.md"><code>preferBarrelImport</code></a></td><td>Reports imports of individual modules from packages configured in barrelImportPackages that should be named imports from the package barrel</td></tr>
|
|
182
191
|
<tr><td><a href="https://github.com/Effect-TS/tsgo/blob/main/docs/rules/prefer-namespace-import.md"><code>preferNamespaceImport</code></a></td><td>Reports named imports from packages configured in namespaceImportPackages that should be namespace imports</td></tr>
|
|
183
192
|
<tr><td><a href="https://github.com/Effect-TS/tsgo/blob/main/docs/rules/prefer-schema-tagged-error.md"><code>preferSchemaTaggedError</code></a></td><td>Suggests using Schema.TaggedError instead of Data.TaggedError</td></tr>
|
|
184
|
-
<tr><td><a href="https://github.com/Effect-TS/tsgo/blob/main/docs/rules/prefer-schema-type-property.md"><code>preferSchemaTypeProperty</code></a></td><td>Disallows Schema.Schema.Type<typeof X> in favor of typeof X.Type</td></tr>
|
|
193
|
+
<tr><td><a href="https://github.com/Effect-TS/tsgo/blob/main/docs/rules/prefer-schema-type-property.md"><code>preferSchemaTypeProperty</code></a></td><td>Disallows Schema.Schema.Type<typeof X> and Schema.Codec.Encoded<typeof X>-style helpers in favor of typeof X.Type and typeof X.Encoded</td></tr>
|
|
185
194
|
<tr><td><a href="https://github.com/Effect-TS/tsgo/blob/main/docs/rules/prefer-succeed-some-or-none.md"><code>preferSucceedSomeOrNone</code></a></td><td>Suggests using Effect.succeedNone or Effect.succeedSome instead of wrapping Option.none or Option.some with Effect.succeed</td></tr>
|
|
186
195
|
<tr><td><a href="https://github.com/Effect-TS/tsgo/blob/main/docs/rules/prefer-typed-schema-decoder.md"><code>preferTypedSchemaDecoder</code></a></td><td>Suggests typed Schema decoders when the input is assignable to the schema's Encoded type</td></tr>
|
|
187
196
|
<tr><td><a href="https://github.com/Effect-TS/tsgo/blob/main/docs/rules/provide-layer-succeed-to-provide-service.md"><code>provideLayerSucceedToProvideService</code></a></td><td>Suggests providing inline Layer.succeed and Layer.effect services directly</td></tr>
|
package/dist/effect-tsgo.cjs
CHANGED
|
@@ -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.
|
|
52772
|
+
var version = "0.61.0";
|
|
52741
52773
|
|
|
52742
52774
|
//#endregion
|
|
52743
52775
|
//#region src/metadata.json
|
|
@@ -52802,6 +52834,7 @@ var presets$1 = [
|
|
|
52802
52834
|
"errorPayloadShadowsName": "suggestion",
|
|
52803
52835
|
"experimentalApiUsage": "warning",
|
|
52804
52836
|
"flatMapConditionalToFilterOrFail": "suggestion",
|
|
52837
|
+
"flatMapIdentityToFlatten": "suggestion",
|
|
52805
52838
|
"flatMapIgnoredParamToAndThen": "suggestion",
|
|
52806
52839
|
"flatMapToMap": "suggestion",
|
|
52807
52840
|
"flatMapToTap": "suggestion",
|
|
@@ -52895,6 +52928,7 @@ var presets$1 = [
|
|
|
52895
52928
|
"errorPayloadShadowsName": "error",
|
|
52896
52929
|
"experimentalApiUsage": "error",
|
|
52897
52930
|
"flatMapConditionalToFilterOrFail": "error",
|
|
52931
|
+
"flatMapIdentityToFlatten": "error",
|
|
52898
52932
|
"flatMapIgnoredParamToAndThen": "error",
|
|
52899
52933
|
"flatMapToMap": "error",
|
|
52900
52934
|
"flatMapToTap": "error",
|
|
@@ -53068,6 +53102,7 @@ var presets$1 = [
|
|
|
53068
53102
|
"effectSleepZeroToYieldNow": "warning",
|
|
53069
53103
|
"effectSucceedWithVoid": "warning",
|
|
53070
53104
|
"flatMapConditionalToFilterOrFail": "warning",
|
|
53105
|
+
"flatMapIdentityToFlatten": "warning",
|
|
53071
53106
|
"flatMapIgnoredParamToAndThen": "warning",
|
|
53072
53107
|
"flatMapToMap": "warning",
|
|
53073
53108
|
"flatMapToTap": "warning",
|
|
@@ -54686,6 +54721,23 @@ var rules = [
|
|
|
54686
54721
|
}]
|
|
54687
54722
|
}
|
|
54688
54723
|
},
|
|
54724
|
+
{
|
|
54725
|
+
"name": "flatMapIdentityToFlatten",
|
|
54726
|
+
"group": "style",
|
|
54727
|
+
"description": "Suggests Effect.flatten instead of Effect.flatMap when the callback is Effect's identity export referenced directly or an unannotated function returning its parameter",
|
|
54728
|
+
"defaultSeverity": "suggestion",
|
|
54729
|
+
"fixable": true,
|
|
54730
|
+
"supportedEffect": ["v3", "v4"],
|
|
54731
|
+
"codes": [377151],
|
|
54732
|
+
"preview": {
|
|
54733
|
+
"sourceText": "import { Effect } from \"effect\"\n\ndeclare const loadTask: Effect.Effect<Effect.Effect<string>>\n\nexport const program = loadTask.pipe(Effect.flatMap((inner) => inner))\n",
|
|
54734
|
+
"diagnostics": [{
|
|
54735
|
+
"start": 132,
|
|
54736
|
+
"end": 146,
|
|
54737
|
+
"text": "`Effect.flatten` expresses this unwrapping more directly than `Effect.flatMap` with an identity callback. effect(flatMapIdentityToFlatten)"
|
|
54738
|
+
}]
|
|
54739
|
+
}
|
|
54740
|
+
},
|
|
54689
54741
|
{
|
|
54690
54742
|
"name": "flatMapIgnoredParamToAndThen",
|
|
54691
54743
|
"group": "style",
|
|
@@ -54973,7 +55025,7 @@ var rules = [
|
|
|
54973
55025
|
{
|
|
54974
55026
|
"name": "preferSchemaTypeProperty",
|
|
54975
55027
|
"group": "style",
|
|
54976
|
-
"description": "Disallows Schema.Schema.Type<typeof X> in favor of typeof X.Type",
|
|
55028
|
+
"description": "Disallows Schema.Schema.Type<typeof X> and Schema.Codec.Encoded<typeof X>-style helpers in favor of typeof X.Type and typeof X.Encoded",
|
|
54977
55029
|
"defaultSeverity": "off",
|
|
54978
55030
|
"fixable": true,
|
|
54979
55031
|
"supportedEffect": ["v3", "v4"],
|
|
@@ -54983,7 +55035,7 @@ var rules = [
|
|
|
54983
55035
|
"diagnostics": [{
|
|
54984
55036
|
"start": 97,
|
|
54985
55037
|
"end": 128,
|
|
54986
|
-
"text": "Do not use `Schema.Schema.Type<typeof X
|
|
55038
|
+
"text": "Do not use `Schema.Schema.Type<typeof X>`. Use `typeof X.Type` instead. effect(preferSchemaTypeProperty)"
|
|
54987
55039
|
}]
|
|
54988
55040
|
}
|
|
54989
55041
|
},
|
|
@@ -55390,11 +55442,11 @@ var tags = {
|
|
|
55390
55442
|
"typescript": {
|
|
55391
55443
|
"latest": "7.0.2",
|
|
55392
55444
|
"beta": "7.1.0-beta",
|
|
55393
|
-
"next": "7.1.0-dev.
|
|
55445
|
+
"next": "7.1.0-dev.20261026.1"
|
|
55394
55446
|
},
|
|
55395
55447
|
"oxlint": { "latest": "1.89.0" },
|
|
55396
55448
|
"oxlint-tsgolint": { "latest": "7.0.2005" },
|
|
55397
|
-
"tsrs": { "latest": "0.
|
|
55449
|
+
"tsrs": { "latest": "0.20.0-ts7.1.0-beta" }
|
|
55398
55450
|
};
|
|
55399
55451
|
var components = {
|
|
55400
55452
|
"typescript": {
|
|
@@ -55406,12 +55458,8 @@ var components = {
|
|
|
55406
55458
|
"gitHead": "3e9236361fa97a9e6c685f4833ac457ae2d8c50a",
|
|
55407
55459
|
"provider": "typescript"
|
|
55408
55460
|
},
|
|
55409
|
-
"7.1.0-dev.
|
|
55410
|
-
"gitHead": "
|
|
55411
|
-
"provider": "typescript"
|
|
55412
|
-
},
|
|
55413
|
-
"7.1.0-dev.20261023.1": {
|
|
55414
|
-
"gitHead": "a91e93821feafd081641f9f5d161eba626d0b2ce",
|
|
55461
|
+
"7.1.0-dev.20261026.1": {
|
|
55462
|
+
"gitHead": "8a62bbe746909624b69b6e671026b454da2f02cf",
|
|
55415
55463
|
"provider": "typescript"
|
|
55416
55464
|
}
|
|
55417
55465
|
},
|
|
@@ -55430,11 +55478,11 @@ var components = {
|
|
|
55430
55478
|
"1.88.0": { "gitHead": "6941b4ed45ead21c45bc2164cb80a180eed85b43" },
|
|
55431
55479
|
"1.89.0": { "gitHead": "07ed78f4abde4020ca7919381ffea4da8616b78a" }
|
|
55432
55480
|
},
|
|
55433
|
-
"tsrs": { "0.
|
|
55434
|
-
"gitHead": "
|
|
55481
|
+
"tsrs": { "0.20.0-ts7.1.0-beta": {
|
|
55482
|
+
"gitHead": "d197eeea709616d61930c2bd5eac048471e404b8",
|
|
55435
55483
|
"typescript": {
|
|
55436
|
-
"version": "7.1.0-
|
|
55437
|
-
"gitHead": "
|
|
55484
|
+
"version": "7.1.0-beta",
|
|
55485
|
+
"gitHead": "3e9236361fa97a9e6c685f4833ac457ae2d8c50a"
|
|
55438
55486
|
}
|
|
55439
55487
|
} }
|
|
55440
55488
|
};
|
|
@@ -55474,13 +55522,16 @@ const readPackage = (require, packageName) => gen(function* () {
|
|
|
55474
55522
|
catch: () => new DiscoveryError({ reason: `Unable to parse ${packageJsonPath}.` })
|
|
55475
55523
|
});
|
|
55476
55524
|
if (typeof json !== "object" || json === null || !("version" in json) || typeof json.version !== "string") return yield* new DiscoveryError({ reason: `${packageJsonPath} does not contain a version.` });
|
|
55525
|
+
const bin = "bin" in json ? json.bin : void 0;
|
|
55477
55526
|
return {
|
|
55478
55527
|
packageJsonPath,
|
|
55479
55528
|
version: json.version,
|
|
55480
|
-
..."main" in json && typeof json.main === "string" ? { main: json.main } : {}
|
|
55529
|
+
..."main" in json && typeof json.main === "string" ? { main: json.main } : {},
|
|
55530
|
+
...typeof bin === "string" || typeof bin === "object" && bin !== null ? { bin } : {}
|
|
55481
55531
|
};
|
|
55482
55532
|
});
|
|
55483
55533
|
const optionally = (effect) => effect.pipe(catchTag("DiscoveryError", (error) => error.reason.startsWith("Unable to resolve ") ? succeed$2(void 0) : fail$2(error)));
|
|
55534
|
+
const findInstalledPackage = (require, packageName) => optionally(readPackage(require, packageName));
|
|
55484
55535
|
const isGlibc = () => {
|
|
55485
55536
|
if (process.platform !== "linux") return false;
|
|
55486
55537
|
return typeof ((process.report?.getReport())?.header)?.glibcVersionRuntime === "string";
|
|
@@ -55490,19 +55541,23 @@ const experimentalOxlintTarget = (platform, arch, glibc) => {
|
|
|
55490
55541
|
if (platform !== "linux" && platform !== "darwin" && platform !== "win32") throw new DiscoveryError({ reason: `Unsupported platform ${platform}.` });
|
|
55491
55542
|
const packageTarget = `${platform}-${arch}`;
|
|
55492
55543
|
const codeTarget = platform === "linux" ? `${packageTarget}-${glibc ? "gnu" : "musl"}` : packageTarget;
|
|
55544
|
+
const oxlintTarget = platform === "win32" ? `${codeTarget}-msvc` : codeTarget;
|
|
55493
55545
|
return {
|
|
55494
55546
|
codeTarget,
|
|
55495
|
-
|
|
55547
|
+
oxlintBinding: `oxlint.${oxlintTarget}.node`,
|
|
55548
|
+
oxlintPackage: `@oxlint/binding-${oxlintTarget}`,
|
|
55496
55549
|
tsgolintPackage: `@oxlint-tsgolint/${packageTarget}`,
|
|
55497
55550
|
tsgolintExecutable: platform === "win32" ? "tsgolint.exe" : "tsgolint"
|
|
55498
55551
|
};
|
|
55499
55552
|
};
|
|
55500
55553
|
const tsrsTargets = [
|
|
55501
55554
|
"darwin-arm64",
|
|
55555
|
+
"darwin-x64",
|
|
55502
55556
|
"linux-x64-gnu",
|
|
55503
55557
|
"linux-x64-musl",
|
|
55504
55558
|
"linux-arm64-gnu",
|
|
55505
|
-
"linux-arm64-musl"
|
|
55559
|
+
"linux-arm64-musl",
|
|
55560
|
+
"win32-x64"
|
|
55506
55561
|
];
|
|
55507
55562
|
const tsrsTarget = (platform, arch, glibc) => {
|
|
55508
55563
|
const target = platform === "linux" ? `${platform}-${arch}-${glibc ? "gnu" : "musl"}` : `${platform}-${arch}`;
|
|
@@ -55563,6 +55618,7 @@ const discoverOxlint = (cwdRequire) => gen(function* () {
|
|
|
55563
55618
|
}
|
|
55564
55619
|
return discovered;
|
|
55565
55620
|
});
|
|
55621
|
+
const tsrsExecutableName = (platform) => platform === "win32" ? "tsrs.exe" : "tsrs";
|
|
55566
55622
|
const discoverTsrs = (cwdRequire) => gen(function* () {
|
|
55567
55623
|
const path = yield* Path$2;
|
|
55568
55624
|
const tsrs = yield* optionally(readPackage(cwdRequire, "tsrs"));
|
|
@@ -55576,7 +55632,7 @@ const discoverTsrs = (cwdRequire) => gen(function* () {
|
|
|
55576
55632
|
component: "tsrs",
|
|
55577
55633
|
packageName: platformPackageName,
|
|
55578
55634
|
packageVersion: platformPackage.version,
|
|
55579
|
-
binaryPath: path.join(path.dirname(platformPackage.packageJsonPath),
|
|
55635
|
+
binaryPath: path.join(path.dirname(platformPackage.packageJsonPath), tsrsExecutableName(process.platform))
|
|
55580
55636
|
}];
|
|
55581
55637
|
});
|
|
55582
55638
|
const discoverVitePlusOxlint = (cwdRequire) => gen(function* () {
|
|
@@ -55671,28 +55727,35 @@ const resolveOxlintDeclarations = (target) => gen(function* () {
|
|
|
55671
55727
|
fileHash: yield* hashBytes(replacement).pipe(mapError((error) => new PatcherError({ reason: `Unable to hash generated Oxlint declarations: ${error.message}` })))
|
|
55672
55728
|
};
|
|
55673
55729
|
});
|
|
55674
|
-
const
|
|
55730
|
+
const resolvePlatformPackageDirectory = gen(function* () {
|
|
55675
55731
|
const path = yield* Path$2;
|
|
55676
55732
|
const packageName = `@effect/tsgo-${process.platform}-${process.arch}`;
|
|
55677
55733
|
const selfRequire = node_module.createRequire(require("url").pathToFileURL(__filename).href);
|
|
55678
55734
|
const packageJsonPath = yield* try_({
|
|
55679
55735
|
try: () => selfRequire.resolve(`${packageName}/package.json`),
|
|
55680
|
-
catch: () => new
|
|
55681
|
-
target,
|
|
55682
|
-
reason: `Unable to resolve ${packageName}; no packaged replacement is available.`
|
|
55683
|
-
})
|
|
55736
|
+
catch: () => new PatcherError({ reason: `Unable to resolve ${packageName}; no packaged replacement is available.` })
|
|
55684
55737
|
});
|
|
55685
|
-
return
|
|
55738
|
+
return path.dirname(packageJsonPath);
|
|
55686
55739
|
});
|
|
55740
|
+
const resolvePlatformPackage = (target) => resolvePlatformPackageDirectory.pipe(map$5((packageDir) => ({ packageDir })), mapError(({ reason }) => new ReplacementUnavailableError({
|
|
55741
|
+
target,
|
|
55742
|
+
reason
|
|
55743
|
+
})));
|
|
55687
55744
|
const tsrsReplacementTargets = [
|
|
55688
55745
|
"darwin-arm64",
|
|
55746
|
+
"darwin-x64",
|
|
55689
55747
|
"linux-x64-gnu",
|
|
55690
|
-
"linux-arm64-gnu"
|
|
55748
|
+
"linux-arm64-gnu",
|
|
55749
|
+
"win32-x64"
|
|
55691
55750
|
];
|
|
55751
|
+
const packagedComponentPath = (packageDir, component, version, fileName) => gen(function* () {
|
|
55752
|
+
const path = yield* Path$2;
|
|
55753
|
+
return component === "typescript" && version === tags.typescript.latest ? path.join(packageDir, "lib", fileName) : path.join(packageDir, "artifacts", component, version, fileName);
|
|
55754
|
+
});
|
|
55692
55755
|
const packagedArtifactPath = (packageDir, target) => gen(function* () {
|
|
55693
55756
|
const path = yield* Path$2;
|
|
55694
55757
|
const fileName = path.basename(target.binaryPath);
|
|
55695
|
-
return target.component === "
|
|
55758
|
+
return target.component === "oxlint-dts" ? path.join(packageDir, "artifacts", target.component, target.packageVersion, fileName) : yield* packagedComponentPath(packageDir, target.component, target.packageVersion, fileName);
|
|
55696
55759
|
});
|
|
55697
55760
|
const resolveReplacement = (target) => gen(function* () {
|
|
55698
55761
|
const fs = yield* FileSystem;
|
|
@@ -204868,6 +204931,272 @@ const integrationFlags = {
|
|
|
204868
204931
|
};
|
|
204869
204932
|
const ensureIntegrationSelected = (typescript, oxlint, tsrs = false) => typescript || oxlint || tsrs ? void_$1 : fail$2(new IntegrationSelectionError({ reason: "Select at least one integration to manage." }));
|
|
204870
204933
|
|
|
204934
|
+
//#endregion
|
|
204935
|
+
//#region src/cli/proxy/exec.ts
|
|
204936
|
+
const nodeExecHost = {
|
|
204937
|
+
platform: process.platform,
|
|
204938
|
+
execve: typeof process.execve === "function" ? (file, args, env) => process.execve(file, args, env) : void 0,
|
|
204939
|
+
spawn: (file, args, options) => node_child_process.spawn(file, args, options),
|
|
204940
|
+
parent: process,
|
|
204941
|
+
reportError: (message) => process.stderr.write(`${message}\n`)
|
|
204942
|
+
};
|
|
204943
|
+
const forwardedSignals = (platform) => platform === "win32" ? [
|
|
204944
|
+
"SIGINT",
|
|
204945
|
+
"SIGTERM",
|
|
204946
|
+
"SIGHUP",
|
|
204947
|
+
"SIGBREAK"
|
|
204948
|
+
] : [
|
|
204949
|
+
"SIGINT",
|
|
204950
|
+
"SIGTERM",
|
|
204951
|
+
"SIGHUP",
|
|
204952
|
+
"SIGQUIT"
|
|
204953
|
+
];
|
|
204954
|
+
const execProxyCommand = (command, host = nodeExecHost) => {
|
|
204955
|
+
if (host.platform !== "win32" && host.execve !== void 0) try {
|
|
204956
|
+
host.execve(command.file, [command.file, ...command.args], command.env);
|
|
204957
|
+
} catch {}
|
|
204958
|
+
const signals = forwardedSignals(host.platform);
|
|
204959
|
+
const listening = [];
|
|
204960
|
+
let settled = false;
|
|
204961
|
+
let child;
|
|
204962
|
+
const forward = (signal) => {
|
|
204963
|
+
try {
|
|
204964
|
+
child?.kill(signal);
|
|
204965
|
+
} catch {}
|
|
204966
|
+
};
|
|
204967
|
+
const settle = (onSettled) => {
|
|
204968
|
+
if (settled) return;
|
|
204969
|
+
settled = true;
|
|
204970
|
+
for (const signal of listening) host.parent.off(signal, forward);
|
|
204971
|
+
onSettled();
|
|
204972
|
+
};
|
|
204973
|
+
const fail = (error) => settle(() => {
|
|
204974
|
+
host.reportError(`Failed to run ${command.file}: ${error instanceof Error ? error.message : String(error)}`);
|
|
204975
|
+
host.parent.exitCode = 1;
|
|
204976
|
+
});
|
|
204977
|
+
try {
|
|
204978
|
+
child = host.spawn(command.file, command.args, {
|
|
204979
|
+
stdio: "inherit",
|
|
204980
|
+
env: command.env
|
|
204981
|
+
});
|
|
204982
|
+
} catch (error) {
|
|
204983
|
+
fail(error);
|
|
204984
|
+
return;
|
|
204985
|
+
}
|
|
204986
|
+
child.on("error", fail);
|
|
204987
|
+
child.on("exit", (status, signal) => settle(() => propagateDiagnosticsExit({
|
|
204988
|
+
status,
|
|
204989
|
+
signal
|
|
204990
|
+
}, host.parent)));
|
|
204991
|
+
for (const signal of signals) {
|
|
204992
|
+
if (settled) break;
|
|
204993
|
+
try {
|
|
204994
|
+
host.parent.on(signal, forward);
|
|
204995
|
+
listening.push(signal);
|
|
204996
|
+
} catch {}
|
|
204997
|
+
}
|
|
204998
|
+
};
|
|
204999
|
+
|
|
205000
|
+
//#endregion
|
|
205001
|
+
//#region src/cli/proxy/resolve.ts
|
|
205002
|
+
var ProxyError = class extends TaggedError$1("ProxyError") {
|
|
205003
|
+
get message() {
|
|
205004
|
+
return this.reason;
|
|
205005
|
+
}
|
|
205006
|
+
};
|
|
205007
|
+
var UnsupportedProxyVersionError = class extends TaggedError$1("UnsupportedProxyVersionError") {
|
|
205008
|
+
get message() {
|
|
205009
|
+
const tags = Object.entries(this.tags).map(([tag, version]) => `${tag} (${version})`);
|
|
205010
|
+
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(", ")}.`;
|
|
205011
|
+
}
|
|
205012
|
+
};
|
|
205013
|
+
const upstreamTags = (component) => tags[component];
|
|
205014
|
+
const selectVersion = (tool, component, requested, installed) => gen(function* () {
|
|
205015
|
+
const versions = supportedVersions(component);
|
|
205016
|
+
const tags = upstreamTags(component);
|
|
205017
|
+
if (requested !== void 0) {
|
|
205018
|
+
if (requested === "") return yield* new ProxyError({ reason: `Expected a version or tag after ${tool}@.` });
|
|
205019
|
+
const version = Object.hasOwn(tags, requested) ? tags[requested] : requested;
|
|
205020
|
+
if (versions.includes(version)) return version;
|
|
205021
|
+
return yield* new UnsupportedProxyVersionError({
|
|
205022
|
+
packageName: tool,
|
|
205023
|
+
version: requested,
|
|
205024
|
+
source: "requested",
|
|
205025
|
+
supportedVersions: versions,
|
|
205026
|
+
tags
|
|
205027
|
+
});
|
|
205028
|
+
}
|
|
205029
|
+
if (installed !== void 0 && versions.includes(installed)) return installed;
|
|
205030
|
+
return tags.latest;
|
|
205031
|
+
});
|
|
205032
|
+
const projectRequire = (context) => gen(function* () {
|
|
205033
|
+
const path = yield* Path$2;
|
|
205034
|
+
return node_module.createRequire(path.join(context.cwd, "noop.js"));
|
|
205035
|
+
});
|
|
205036
|
+
const toProxyError = (error) => new ProxyError({ reason: error.message });
|
|
205037
|
+
const installedTypescriptVersion = (context) => gen(function* () {
|
|
205038
|
+
const require = yield* projectRequire(context);
|
|
205039
|
+
for (const packageName of defaultTypescriptPackageNames$1) {
|
|
205040
|
+
const installed = yield* findInstalledPackage(require, packageName).pipe(mapError(toProxyError));
|
|
205041
|
+
if (installed !== void 0 && isNativeTypescriptVersion$1(installed.version)) return installed.version;
|
|
205042
|
+
}
|
|
205043
|
+
});
|
|
205044
|
+
const installedTsrsVersion = (context) => gen(function* () {
|
|
205045
|
+
return (yield* findInstalledPackage(yield* projectRequire(context), "tsrs").pipe(mapError(toProxyError)))?.version;
|
|
205046
|
+
});
|
|
205047
|
+
const requireArtifact = (artifactPath) => gen(function* () {
|
|
205048
|
+
if (!(yield* (yield* FileSystem).exists(artifactPath).pipe(mapError(toProxyError)))) return yield* new ProxyError({ reason: `Missing packaged artifact ${artifactPath}.` });
|
|
205049
|
+
return artifactPath;
|
|
205050
|
+
});
|
|
205051
|
+
const ensureExecutable = (filePath, platform) => gen(function* () {
|
|
205052
|
+
if (platform === "win32") return;
|
|
205053
|
+
const fs = yield* FileSystem;
|
|
205054
|
+
if (yield* promise(() => (0, node_fs_promises.access)(filePath, node_fs.constants.X_OK).then(() => true, () => false))) return;
|
|
205055
|
+
yield* fs.chmod(filePath, 493).pipe(mapError((error) => new ProxyError({ reason: `Failed to set executable permissions on ${filePath}: ${error.message}` })));
|
|
205056
|
+
});
|
|
205057
|
+
const executablePath = (filePath, platform) => platform === "win32" && filePath.length >= 248 ? node_path.win32.toNamespacedPath(filePath) : filePath;
|
|
205058
|
+
const tscExecutable = (context, version) => packagedComponentPath(context.packageDirectory, "typescript", version, context.platform === "win32" ? "tsc.exe" : "tsc");
|
|
205059
|
+
const tsrsExecutable = (context, version) => packagedComponentPath(context.packageDirectory, "tsrs", version, tsrsExecutableName(context.platform));
|
|
205060
|
+
const resolveTsc = (context, invocation) => gen(function* () {
|
|
205061
|
+
const installed = invocation.version === void 0 ? yield* installedTypescriptVersion(context) : void 0;
|
|
205062
|
+
const executable = yield* requireArtifact(yield* tscExecutable(context, yield* selectVersion("tsc", "typescript", invocation.version, installed)));
|
|
205063
|
+
yield* ensureExecutable(executable, context.platform);
|
|
205064
|
+
return {
|
|
205065
|
+
file: executablePath(executable, context.platform),
|
|
205066
|
+
args: invocation.args,
|
|
205067
|
+
env: context.env
|
|
205068
|
+
};
|
|
205069
|
+
});
|
|
205070
|
+
const resolveTsrs = (context, invocation) => gen(function* () {
|
|
205071
|
+
const fs = yield* FileSystem;
|
|
205072
|
+
const path = yield* Path$2;
|
|
205073
|
+
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(", ")}.` });
|
|
205074
|
+
const target = tsrsTarget(context.platform, context.arch, true);
|
|
205075
|
+
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(", ")}.` });
|
|
205076
|
+
const installed = invocation.version === void 0 ? yield* installedTsrsVersion(context) : void 0;
|
|
205077
|
+
const executable = yield* requireArtifact(yield* tsrsExecutable(context, yield* selectVersion("tsrs", "tsrs", invocation.version, installed)));
|
|
205078
|
+
const libraryPath = path.join(path.dirname(executable), "lib.d.ts");
|
|
205079
|
+
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}.` });
|
|
205080
|
+
yield* ensureExecutable(executable, context.platform);
|
|
205081
|
+
return {
|
|
205082
|
+
file: executablePath(executable, context.platform),
|
|
205083
|
+
args: invocation.args,
|
|
205084
|
+
env: context.env
|
|
205085
|
+
};
|
|
205086
|
+
});
|
|
205087
|
+
const findOxlintInstallation = (cwd) => gen(function* () {
|
|
205088
|
+
const path = yield* Path$2;
|
|
205089
|
+
const find = (require, packageName) => findInstalledPackage(require, packageName).pipe(mapError(toProxyError));
|
|
205090
|
+
const cwdRequire = node_module.createRequire(path.join(cwd, "noop.js"));
|
|
205091
|
+
const vitePlus = yield* find(cwdRequire, "vite-plus");
|
|
205092
|
+
const scopes = [cwdRequire, ...vitePlus === void 0 ? [] : [node_module.createRequire(vitePlus.packageJsonPath)]];
|
|
205093
|
+
for (const require of scopes) {
|
|
205094
|
+
const oxlint = yield* find(require, "oxlint");
|
|
205095
|
+
if (oxlint !== void 0) return {
|
|
205096
|
+
oxlint,
|
|
205097
|
+
tsgolint: yield* find(require, "oxlint-tsgolint")
|
|
205098
|
+
};
|
|
205099
|
+
}
|
|
205100
|
+
});
|
|
205101
|
+
const oxlintBinPath = (oxlint) => gen(function* () {
|
|
205102
|
+
const path = yield* Path$2;
|
|
205103
|
+
const bin = typeof oxlint.bin === "string" ? oxlint.bin : oxlint.bin?.oxlint;
|
|
205104
|
+
if (bin === void 0) return yield* new ProxyError({ reason: `${oxlint.packageJsonPath} does not declare an oxlint bin entry.` });
|
|
205105
|
+
return path.resolve(path.dirname(oxlint.packageJsonPath), bin);
|
|
205106
|
+
});
|
|
205107
|
+
const supportedInstalledVersion = (component, installed) => {
|
|
205108
|
+
const versions = supportedVersions(component);
|
|
205109
|
+
return versions.includes(installed.version) ? succeed$2(installed.version) : fail$2(new UnsupportedProxyVersionError({
|
|
205110
|
+
packageName: component,
|
|
205111
|
+
version: installed.version,
|
|
205112
|
+
source: "installed",
|
|
205113
|
+
supportedVersions: versions,
|
|
205114
|
+
tags: {}
|
|
205115
|
+
}));
|
|
205116
|
+
};
|
|
205117
|
+
const oxlintCommand = (context, args, installation) => gen(function* () {
|
|
205118
|
+
const target = yield* try_({
|
|
205119
|
+
try: () => experimentalOxlintTarget(context.platform, context.arch, context.platform === "linux" && context.isGlibc()),
|
|
205120
|
+
catch: (error) => new ProxyError({ reason: error instanceof Error ? error.message : String(error) })
|
|
205121
|
+
});
|
|
205122
|
+
const oxlintVersion = yield* supportedInstalledVersion("oxlint", installation.oxlint);
|
|
205123
|
+
const binding = yield* requireArtifact(yield* packagedComponentPath(context.packageDirectory, "oxlint", oxlintVersion, target.oxlintBinding));
|
|
205124
|
+
let tsgolint;
|
|
205125
|
+
if (installation.tsgolint !== void 0) {
|
|
205126
|
+
const tsgolintVersion = yield* supportedInstalledVersion("oxlint-tsgolint", installation.tsgolint);
|
|
205127
|
+
tsgolint = yield* requireArtifact(yield* packagedComponentPath(context.packageDirectory, "oxlint-tsgolint", tsgolintVersion, target.tsgolintExecutable));
|
|
205128
|
+
yield* ensureExecutable(tsgolint, context.platform);
|
|
205129
|
+
}
|
|
205130
|
+
const bin = yield* oxlintBinPath(installation.oxlint);
|
|
205131
|
+
return {
|
|
205132
|
+
file: context.execPath,
|
|
205133
|
+
args: [bin, ...args],
|
|
205134
|
+
env: {
|
|
205135
|
+
...context.env,
|
|
205136
|
+
NAPI_RS_NATIVE_LIBRARY_PATH: binding,
|
|
205137
|
+
...tsgolint === void 0 ? {} : { OXLINT_TSGOLINT_PATH: tsgolint }
|
|
205138
|
+
}
|
|
205139
|
+
};
|
|
205140
|
+
});
|
|
205141
|
+
const resolveOxlint = (context, invocation) => gen(function* () {
|
|
205142
|
+
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.` });
|
|
205143
|
+
if (context.platform === "linux" && !context.isGlibc()) return yield* new ProxyError({ reason: "Linux musl is not supported by the packaged Oxlint integration." });
|
|
205144
|
+
const installation = yield* findOxlintInstallation(context.cwd);
|
|
205145
|
+
if (installation === void 0) return yield* new ProxyError({ reason: `Unable to resolve oxlint from ${context.cwd}. Install oxlint (or vite-plus) in the project.` });
|
|
205146
|
+
return yield* oxlintCommand(context, invocation.args, installation);
|
|
205147
|
+
});
|
|
205148
|
+
const resolveProxyCommand = (invocation, context) => {
|
|
205149
|
+
switch (invocation.tool) {
|
|
205150
|
+
case "tsc": return resolveTsc(context, invocation);
|
|
205151
|
+
case "tsrs": return resolveTsrs(context, invocation);
|
|
205152
|
+
case "oxlint": return resolveOxlint(context, invocation);
|
|
205153
|
+
}
|
|
205154
|
+
};
|
|
205155
|
+
|
|
205156
|
+
//#endregion
|
|
205157
|
+
//#region src/cli/proxy/argv.ts
|
|
205158
|
+
const proxyTools = [
|
|
205159
|
+
"tsc",
|
|
205160
|
+
"tsrs",
|
|
205161
|
+
"oxlint"
|
|
205162
|
+
];
|
|
205163
|
+
const isProxyTool = (value) => proxyTools.includes(value);
|
|
205164
|
+
const parseProxyInvocation = (argv) => {
|
|
205165
|
+
const [first, ...args] = argv;
|
|
205166
|
+
if (first === void 0) return void 0;
|
|
205167
|
+
const separator = first.indexOf("@");
|
|
205168
|
+
const tool = separator === -1 ? first : first.slice(0, separator);
|
|
205169
|
+
if (!isProxyTool(tool)) return void 0;
|
|
205170
|
+
return {
|
|
205171
|
+
tool,
|
|
205172
|
+
version: separator === -1 ? void 0 : first.slice(separator + 1),
|
|
205173
|
+
args
|
|
205174
|
+
};
|
|
205175
|
+
};
|
|
205176
|
+
|
|
205177
|
+
//#endregion
|
|
205178
|
+
//#region src/cli/proxy/index.ts
|
|
205179
|
+
const runProxy = (invocation, host = nodeExecHost) => {
|
|
205180
|
+
const program = gen(function* () {
|
|
205181
|
+
const packageDirectory = yield* resolvePlatformPackageDirectory.pipe(mapError(({ reason }) => new ProxyError({ reason })));
|
|
205182
|
+
return yield* resolveProxyCommand(invocation, {
|
|
205183
|
+
cwd: process.cwd(),
|
|
205184
|
+
env: process.env,
|
|
205185
|
+
execPath: process.execPath,
|
|
205186
|
+
platform: process.platform,
|
|
205187
|
+
arch: process.arch,
|
|
205188
|
+
isGlibc,
|
|
205189
|
+
packageDirectory
|
|
205190
|
+
});
|
|
205191
|
+
}).pipe(provide(layer));
|
|
205192
|
+
return runPromiseExit(program).then((exit) => {
|
|
205193
|
+
if (isSuccess$1(exit)) return execProxyCommand(exit.value, host);
|
|
205194
|
+
const error = squash(exit.cause);
|
|
205195
|
+
host.reportError(`effect-tsgo ${invocation.tool}: ${error instanceof Error ? error.message : String(error)}`);
|
|
205196
|
+
host.parent.exitCode = 1;
|
|
205197
|
+
});
|
|
205198
|
+
};
|
|
205199
|
+
|
|
204871
205200
|
//#endregion
|
|
204872
205201
|
//#region src/cli/presets.ts
|
|
204873
205202
|
const metadata = metadata_default;
|
|
@@ -205230,13 +205559,37 @@ const diagnosticsCommand = make("diagnostics", {
|
|
|
205230
205559
|
listFiles
|
|
205231
205560
|
}));
|
|
205232
205561
|
})));
|
|
205233
|
-
make("tsgo").pipe(
|
|
205562
|
+
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([
|
|
205563
|
+
{
|
|
205564
|
+
command: "effect-tsgo tsc -p tsconfig.json",
|
|
205565
|
+
description: "Type check with the Effect-patched tsc"
|
|
205566
|
+
},
|
|
205567
|
+
{
|
|
205568
|
+
command: "effect-tsgo tsc@7.0.2 --lsp --stdio",
|
|
205569
|
+
description: "Start the language server of a given TypeScript version"
|
|
205570
|
+
},
|
|
205571
|
+
{
|
|
205572
|
+
command: "effect-tsgo tsc@next --build",
|
|
205573
|
+
description: "Use the version behind an upstream tag (latest, beta, next)"
|
|
205574
|
+
},
|
|
205575
|
+
{
|
|
205576
|
+
command: "effect-tsgo tsrs --noEmit",
|
|
205577
|
+
description: "Type check with the Effect-patched tsrs"
|
|
205578
|
+
},
|
|
205579
|
+
{
|
|
205580
|
+
command: "effect-tsgo oxlint --type-aware",
|
|
205581
|
+
description: "Lint with the Effect-patched Oxlint and tsgolint"
|
|
205582
|
+
}
|
|
205583
|
+
]), withSubcommands([
|
|
205234
205584
|
patchCommand,
|
|
205235
205585
|
unpatchCommand,
|
|
205236
205586
|
getExePathCommand,
|
|
205237
205587
|
diagnosticsCommand,
|
|
205238
205588
|
setupCommand,
|
|
205239
205589
|
configCommand
|
|
205240
|
-
]))
|
|
205590
|
+
]));
|
|
205591
|
+
const proxyInvocation = parseProxyInvocation(process.argv.slice(2));
|
|
205592
|
+
if (proxyInvocation !== void 0) runProxy(proxyInvocation);
|
|
205593
|
+
else rootCommand.pipe(run({ version }), provide(layer), runMain());
|
|
205241
205594
|
|
|
205242
205595
|
//#endregion
|
package/oxlint-presets/index.js
CHANGED
|
@@ -153,6 +153,7 @@ export const recommended = {
|
|
|
153
153
|
"effecttsgo/error-payload-shadows-name": "warn",
|
|
154
154
|
"effecttsgo/experimental-api-usage": "warn",
|
|
155
155
|
"effecttsgo/flat-map-conditional-to-filter-or-fail": "warn",
|
|
156
|
+
"effecttsgo/flat-map-identity-to-flatten": "warn",
|
|
156
157
|
"effecttsgo/flat-map-ignored-param-to-and-then": "warn",
|
|
157
158
|
"effecttsgo/flat-map-to-map": "warn",
|
|
158
159
|
"effecttsgo/flat-map-to-tap": "warn",
|
|
@@ -251,6 +252,7 @@ export const strict = {
|
|
|
251
252
|
"effecttsgo/error-payload-shadows-name": "error",
|
|
252
253
|
"effecttsgo/experimental-api-usage": "error",
|
|
253
254
|
"effecttsgo/flat-map-conditional-to-filter-or-fail": "error",
|
|
255
|
+
"effecttsgo/flat-map-identity-to-flatten": "error",
|
|
254
256
|
"effecttsgo/flat-map-ignored-param-to-and-then": "error",
|
|
255
257
|
"effecttsgo/flat-map-to-map": "error",
|
|
256
258
|
"effecttsgo/flat-map-to-tap": "error",
|
|
@@ -340,6 +342,7 @@ export const style = {
|
|
|
340
342
|
"effecttsgo/effect-sleep-zero-to-yield-now": "warn",
|
|
341
343
|
"effecttsgo/effect-succeed-with-void": "warn",
|
|
342
344
|
"effecttsgo/flat-map-conditional-to-filter-or-fail": "warn",
|
|
345
|
+
"effecttsgo/flat-map-identity-to-flatten": "warn",
|
|
343
346
|
"effecttsgo/flat-map-ignored-param-to-and-then": "warn",
|
|
344
347
|
"effecttsgo/flat-map-to-map": "warn",
|
|
345
348
|
"effecttsgo/flat-map-to-tap": "warn",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"effecttsgo/error-payload-shadows-name": "warn",
|
|
36
36
|
"effecttsgo/experimental-api-usage": "warn",
|
|
37
37
|
"effecttsgo/flat-map-conditional-to-filter-or-fail": "warn",
|
|
38
|
+
"effecttsgo/flat-map-identity-to-flatten": "warn",
|
|
38
39
|
"effecttsgo/flat-map-ignored-param-to-and-then": "warn",
|
|
39
40
|
"effecttsgo/flat-map-to-map": "warn",
|
|
40
41
|
"effecttsgo/flat-map-to-tap": "warn",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"effecttsgo/error-payload-shadows-name": "error",
|
|
36
36
|
"effecttsgo/experimental-api-usage": "error",
|
|
37
37
|
"effecttsgo/flat-map-conditional-to-filter-or-fail": "error",
|
|
38
|
+
"effecttsgo/flat-map-identity-to-flatten": "error",
|
|
38
39
|
"effecttsgo/flat-map-ignored-param-to-and-then": "error",
|
|
39
40
|
"effecttsgo/flat-map-to-map": "error",
|
|
40
41
|
"effecttsgo/flat-map-to-tap": "error",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"effecttsgo/effect-sleep-zero-to-yield-now": "warn",
|
|
27
27
|
"effecttsgo/effect-succeed-with-void": "warn",
|
|
28
28
|
"effecttsgo/flat-map-conditional-to-filter-or-fail": "warn",
|
|
29
|
+
"effecttsgo/flat-map-identity-to-flatten": "warn",
|
|
29
30
|
"effecttsgo/flat-map-ignored-param-to-and-then": "warn",
|
|
30
31
|
"effecttsgo/flat-map-to-map": "warn",
|
|
31
32
|
"effecttsgo/flat-map-to-tap": "warn",
|
package/oxlint-schema.json
CHANGED
|
@@ -2344,6 +2344,9 @@
|
|
|
2344
2344
|
"effecttsgo/flat-map-conditional-to-filter-or-fail": {
|
|
2345
2345
|
"$ref": "#/definitions/RuleNoConfig"
|
|
2346
2346
|
},
|
|
2347
|
+
"effecttsgo/flat-map-identity-to-flatten": {
|
|
2348
|
+
"$ref": "#/definitions/RuleNoConfig"
|
|
2349
|
+
},
|
|
2347
2350
|
"effecttsgo/flat-map-ignored-param-to-and-then": {
|
|
2348
2351
|
"$ref": "#/definitions/RuleNoConfig"
|
|
2349
2352
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect/tsgo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.61.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-
|
|
45
|
-
"@effect/tsgo-
|
|
46
|
-
"@effect/tsgo-linux-
|
|
47
|
-
"@effect/tsgo-linux-
|
|
48
|
-
"@effect/tsgo-
|
|
49
|
-
"@effect/tsgo-
|
|
50
|
-
"@effect/tsgo-darwin-arm64": "0.
|
|
44
|
+
"@effect/tsgo-win32-x64": "0.61.0",
|
|
45
|
+
"@effect/tsgo-win32-arm64": "0.61.0",
|
|
46
|
+
"@effect/tsgo-linux-x64": "0.61.0",
|
|
47
|
+
"@effect/tsgo-linux-arm64": "0.61.0",
|
|
48
|
+
"@effect/tsgo-linux-arm": "0.61.0",
|
|
49
|
+
"@effect/tsgo-darwin-x64": "0.61.0",
|
|
50
|
+
"@effect/tsgo-darwin-arm64": "0.61.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
|
{
|
|
@@ -2483,6 +2524,11 @@
|
|
|
2483
2524
|
"default": "suggestion",
|
|
2484
2525
|
"description": "Suggests Effect.filterOrFail or Effect.filterOrElse when Effect.flatMap conditionally passes its input through with Effect.succeed"
|
|
2485
2526
|
},
|
|
2527
|
+
"flatMapIdentityToFlatten": {
|
|
2528
|
+
"$ref": "#/definitions/effectLanguageServicePluginSeverityDefinition",
|
|
2529
|
+
"default": "suggestion",
|
|
2530
|
+
"description": "Suggests Effect.flatten instead of Effect.flatMap when the callback is Effect's identity export referenced directly or an unannotated function returning its parameter"
|
|
2531
|
+
},
|
|
2486
2532
|
"flatMapIgnoredParamToAndThen": {
|
|
2487
2533
|
"$ref": "#/definitions/effectLanguageServicePluginSeverityDefinition",
|
|
2488
2534
|
"default": "suggestion",
|
|
@@ -2751,7 +2797,7 @@
|
|
|
2751
2797
|
"preferSchemaTypeProperty": {
|
|
2752
2798
|
"$ref": "#/definitions/effectLanguageServicePluginSeverityDefinition",
|
|
2753
2799
|
"default": "off",
|
|
2754
|
-
"description": "Disallows Schema.Schema.Type\u003ctypeof X\u003e in favor of typeof X.Type"
|
|
2800
|
+
"description": "Disallows Schema.Schema.Type\u003ctypeof X\u003e and Schema.Codec.Encoded\u003ctypeof X\u003e-style helpers in favor of typeof X.Type and typeof X.Encoded"
|
|
2755
2801
|
},
|
|
2756
2802
|
"preferSucceedSomeOrNone": {
|
|
2757
2803
|
"$ref": "#/definitions/effectLanguageServicePluginSeverityDefinition",
|
|
@@ -2981,7 +3027,8 @@
|
|
|
2981
3027
|
"enum": [
|
|
2982
3028
|
"service",
|
|
2983
3029
|
"error",
|
|
2984
|
-
"custom"
|
|
3030
|
+
"custom",
|
|
3031
|
+
"taggedClass"
|
|
2985
3032
|
],
|
|
2986
3033
|
"type": "string"
|
|
2987
3034
|
}
|