@effect/tsgo 0.24.3 → 0.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ declare function getExePath(): string;
2
+ export default getExePath;
@@ -0,0 +1,96 @@
1
+ import fs from "node:fs";
2
+ import module from "node:module";
3
+ import path from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+
6
+ const typescriptPackageNames = ["typescript", "@typescript/native"];
7
+ function readJson(fileName) {
8
+ return JSON.parse(fs.readFileSync(fileName, "utf8"));
9
+ }
10
+
11
+ function resolveTypeScriptPackage() {
12
+ const cwdRequire = module.createRequire(path.join(process.cwd(), "noop.js"));
13
+
14
+ for (const packageName of typescriptPackageNames) {
15
+ let packageJson;
16
+ try {
17
+ packageJson = cwdRequire.resolve(packageName + "/package.json");
18
+ }
19
+ catch {
20
+ continue;
21
+ }
22
+
23
+ const pkg = readJson(packageJson);
24
+ const major = /^\s*(\d+)/.exec(pkg.version);
25
+ if (major && Number(major[1]) >= 7) {
26
+ if (typeof pkg.gitHead !== "string") {
27
+ throw new Error("Missing gitHead in " + packageName + "/package.json.");
28
+ }
29
+ return pkg;
30
+ }
31
+ }
32
+
33
+ throw new Error("Unable to resolve a native TypeScript package. Install typescript >= 7 or @typescript/native.");
34
+ }
35
+
36
+ export default function getExePath() {
37
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
38
+ const normalizedDirname = __dirname.replace(/\\/g, "/");
39
+
40
+ if (normalizedDirname.endsWith("/_packages/tsgo/lib")) {
41
+ let exe = path.resolve(__dirname, "..", "..", "..", "tsgo");
42
+ if (process.platform === "win32") {
43
+ exe += ".exe";
44
+ }
45
+ if (!fs.existsSync(exe)) {
46
+ throw new Error("Executable not found: " + exe);
47
+ }
48
+ return exe;
49
+ }
50
+
51
+ const typescriptPackage = resolveTypeScriptPackage();
52
+ const platformPackageName = "@effect/tsgo-" + process.platform + "-" + process.arch;
53
+ let packageJson;
54
+
55
+ try {
56
+ const require_ = module.createRequire(path.join(__dirname, "getExePath.js"));
57
+ packageJson = require_.resolve(platformPackageName + "/package.json");
58
+ }
59
+ catch {
60
+ throw new Error("Unable to resolve " + platformPackageName + ". Either your platform is unsupported, or you are missing the package on disk.");
61
+ }
62
+
63
+ const packageDir = path.dirname(packageJson);
64
+ const exeDir = path.join(packageDir, "lib");
65
+ const upstream = readJson(path.join(exeDir, "upstream.json"));
66
+ if (upstream.schemaVersion !== 2 || !Array.isArray(upstream.profiles)) {
67
+ throw new Error("Invalid " + platformPackageName + "/lib/upstream.json.");
68
+ }
69
+ const profiles = upstream.profiles
70
+ .filter((profile) => profile?.kind === "ts")
71
+ .sort((left, right) => left.binName === "tsc" ? -1 : right.binName === "tsc" ? 1 : 0);
72
+
73
+ for (const profile of profiles) {
74
+ const binName = profile.binName;
75
+ if ((binName !== "tsc" && binName !== "tsc-next") || typeof profile.ts?.version !== "string" || typeof profile.ts?.gitHead !== "string") {
76
+ throw new Error("Invalid TypeScript profile metadata in " + platformPackageName + "/lib/upstream.json.");
77
+ }
78
+ let exe = path.join(exeDir, binName);
79
+ if (process.platform === "win32") {
80
+ exe += ".exe";
81
+ if (exe.length >= 248) {
82
+ exe = "\\\\?\\" + exe;
83
+ }
84
+ }
85
+
86
+ if (!fs.existsSync(exe)) {
87
+ continue;
88
+ }
89
+
90
+ if (profile.ts.gitHead === typescriptPackage.gitHead) {
91
+ return exe;
92
+ }
93
+ }
94
+
95
+ throw new Error("No packaged Effect TypeScript executable matches installed TypeScript " + typescriptPackage.version + " gitHead " + typescriptPackage.gitHead + ".");
96
+ }
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@effect/tsgo",
3
- "version": "0.24.3",
3
+ "version": "0.27.1",
4
+ "type": "module",
4
5
  "description": "Effect Language Service for TypeScript-Go — Effect-specific diagnostics and hover features.",
5
6
  "license": "MIT",
6
7
  "repository": {
@@ -15,29 +16,37 @@
15
16
  "provenance": true
16
17
  },
17
18
  "bin": {
18
- "effect-tsgo": "./dist/effect-tsgo.js"
19
+ "effect-tsgo": "./dist/effect-tsgo.cjs"
20
+ },
21
+ "exports": {
22
+ "./package.json": "./package.json",
23
+ "./lib/getExePath": {
24
+ "types": "./lib/getExePath.d.ts",
25
+ "default": "./lib/getExePath.js"
26
+ }
19
27
  },
20
28
  "files": [
21
29
  "dist/",
30
+ "lib/",
22
31
  "README.md",
23
32
  "schema.json"
24
33
  ],
25
34
  "optionalDependencies": {
26
- "@effect/tsgo-win32-x64": "0.24.3",
27
- "@effect/tsgo-win32-arm64": "0.24.3",
28
- "@effect/tsgo-linux-x64": "0.24.3",
29
- "@effect/tsgo-linux-arm64": "0.24.3",
30
- "@effect/tsgo-linux-arm": "0.24.3",
31
- "@effect/tsgo-darwin-x64": "0.24.3",
32
- "@effect/tsgo-darwin-arm64": "0.24.3"
35
+ "@effect/tsgo-win32-x64": "0.27.1",
36
+ "@effect/tsgo-win32-arm64": "0.27.1",
37
+ "@effect/tsgo-linux-x64": "0.27.1",
38
+ "@effect/tsgo-linux-arm64": "0.27.1",
39
+ "@effect/tsgo-linux-arm": "0.27.1",
40
+ "@effect/tsgo-darwin-x64": "0.27.1",
41
+ "@effect/tsgo-darwin-arm64": "0.27.1"
33
42
  },
34
43
  "devDependencies": {
35
- "@effect/platform-node": "^4.0.0-beta.83",
36
- "@effect/platform-node-shared": "^4.0.0-beta.83",
44
+ "@effect/platform-node": "^4.0.0-beta.101",
45
+ "@effect/platform-node-shared": "^4.0.0-beta.101",
37
46
  "@types/node": "^24.3.0",
38
47
  "tsdown": "^0.20.1",
39
48
  "typescript": "^5.9.2",
40
- "effect": "^4.0.0-beta.83",
49
+ "effect": "^4.0.0-beta.101",
41
50
  "vitest": "^3.2.1"
42
51
  },
43
52
  "scripts": {
package/schema.json CHANGED
@@ -1664,6 +1664,11 @@
1664
1664
  },
1665
1665
  "description": "Allows overriding the default severity for each Effect diagnostic across the project.",
1666
1666
  "properties": {
1667
+ "abortControllerInEffect": {
1668
+ "$ref": "#/definitions/effectLanguageServicePluginSeverityDefinition",
1669
+ "default": "suggestion",
1670
+ "description": "Warns when manually constructing AbortController inside Effect generators instead of using Effect.abortSignal"
1671
+ },
1667
1672
  "anyUnknownInErrorContext": {
1668
1673
  "$ref": "#/definitions/effectLanguageServicePluginSeverityDefinition",
1669
1674
  "default": "off",
@@ -1679,6 +1684,16 @@
1679
1684
  "default": "suggestion",
1680
1685
  "description": "Suggests using Effect.mapError instead of Effect.catch + Effect.fail"
1681
1686
  },
1687
+ "catchChainToFirstSuccessOf": {
1688
+ "$ref": "#/definitions/effectLanguageServicePluginSeverityDefinition",
1689
+ "default": "suggestion",
1690
+ "description": "Suggests Effect.firstSuccessOf for consecutive error-independent Effect.catch fallbacks when the error type is preserved"
1691
+ },
1692
+ "catchTagToCatchReason": {
1693
+ "$ref": "#/definitions/effectLanguageServicePluginSeverityDefinition",
1694
+ "default": "suggestion",
1695
+ "description": "Suggests Effect.catchReason or Effect.catchReasons for handlers that re-fail unmatched reason._tag branches"
1696
+ },
1682
1697
  "catchToIgnore": {
1683
1698
  "$ref": "#/definitions/effectLanguageServicePluginSeverityDefinition",
1684
1699
  "default": "suggestion",
@@ -1784,6 +1799,11 @@
1784
1799
  "default": "error",
1785
1800
  "description": "Detects Effect values that are neither yielded nor assigned"
1786
1801
  },
1802
+ "floatingEffectInVitest": {
1803
+ "$ref": "#/definitions/effectLanguageServicePluginSeverityDefinition",
1804
+ "default": "error",
1805
+ "description": "Detects Effects returned from non-Effect-aware Vitest callbacks"
1806
+ },
1787
1807
  "genericEffectServices": {
1788
1808
  "$ref": "#/definitions/effectLanguageServicePluginSeverityDefinition",
1789
1809
  "default": "warning",
@@ -1964,6 +1984,16 @@
1964
1984
  "default": "off",
1965
1985
  "description": "Suggests using Effect Schema for JSON operations instead of JSON.parse/JSON.stringify"
1966
1986
  },
1987
+ "preferSchemaTypeProperty": {
1988
+ "$ref": "#/definitions/effectLanguageServicePluginSeverityDefinition",
1989
+ "default": "off",
1990
+ "description": "Disallows Schema.Schema.Type\u003ctypeof X\u003e in favor of typeof X.Type"
1991
+ },
1992
+ "preferUnsafeConstructor": {
1993
+ "$ref": "#/definitions/effectLanguageServicePluginSeverityDefinition",
1994
+ "default": "suggestion",
1995
+ "description": "Suggests replacing Effect.runSync of a pure effect constructor with the synchronous *Unsafe variant exported by the same module"
1996
+ },
1967
1997
  "processEnv": {
1968
1998
  "$ref": "#/definitions/effectLanguageServicePluginSeverityDefinition",
1969
1999
  "default": "off",
@@ -1974,6 +2004,11 @@
1974
2004
  "default": "off",
1975
2005
  "description": "Warns when reading process.env inside Effect generators instead of using Effect Config"
1976
2006
  },
2007
+ "promiseInEffectSuccess": {
2008
+ "$ref": "#/definitions/effectLanguageServicePluginSeverityDefinition",
2009
+ "default": "warning",
2010
+ "description": "Detects Promise types in Effect success channels where they are not awaited"
2011
+ },
1977
2012
  "redundantMapError": {
1978
2013
  "$ref": "#/definitions/effectLanguageServicePluginSeverityDefinition",
1979
2014
  "default": "suggestion",
@@ -1999,6 +2034,11 @@
1999
2034
  "default": "suggestion",
2000
2035
  "description": "Suggests using Runtime or Effect.run*With methods instead of Effect.run* inside Effect contexts"
2001
2036
  },
2037
+ "schemaLiteralNonFinite": {
2038
+ "$ref": "#/definitions/effectLanguageServicePluginSeverityDefinition",
2039
+ "default": "error",
2040
+ "description": "Reports statically known non-finite numbers passed to Schema literal constructors"
2041
+ },
2002
2042
  "schemaNumber": {
2003
2043
  "$ref": "#/definitions/effectLanguageServicePluginSeverityDefinition",
2004
2044
  "default": "suggestion",