Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions _packages/tsgo-darwin-arm64/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# @effect/tsgo-darwin-arm64

## 0.36.4

## 0.36.3

## 0.36.2

## 0.36.1
Expand Down
2 changes: 1 addition & 1 deletion _packages/tsgo-darwin-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@effect/tsgo-darwin-arm64",
"version": "0.36.2",
"version": "0.36.4",
"description": "Effect Language Service for TypeScript-Go — Effect-specific diagnostics and hover features.",
"license": "MIT",
"repository": {
Expand Down
4 changes: 4 additions & 0 deletions _packages/tsgo-darwin-x64/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# @effect/tsgo-darwin-x64

## 0.36.4

## 0.36.3

## 0.36.2

## 0.36.1
Expand Down
2 changes: 1 addition & 1 deletion _packages/tsgo-darwin-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@effect/tsgo-darwin-x64",
"version": "0.36.2",
"version": "0.36.4",
"description": "Effect Language Service for TypeScript-Go — Effect-specific diagnostics and hover features.",
"license": "MIT",
"repository": {
Expand Down
4 changes: 4 additions & 0 deletions _packages/tsgo-linux-arm/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# @effect/tsgo-linux-arm

## 0.36.4

## 0.36.3

## 0.36.2

## 0.36.1
Expand Down
2 changes: 1 addition & 1 deletion _packages/tsgo-linux-arm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@effect/tsgo-linux-arm",
"version": "0.36.2",
"version": "0.36.4",
"description": "Effect Language Service for TypeScript-Go — Effect-specific diagnostics and hover features.",
"license": "MIT",
"repository": {
Expand Down
4 changes: 4 additions & 0 deletions _packages/tsgo-linux-arm64/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# @effect/tsgo-linux-arm64

## 0.36.4

## 0.36.3

## 0.36.2

## 0.36.1
Expand Down
2 changes: 1 addition & 1 deletion _packages/tsgo-linux-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@effect/tsgo-linux-arm64",
"version": "0.36.2",
"version": "0.36.4",
"description": "Effect Language Service for TypeScript-Go — Effect-specific diagnostics and hover features.",
"license": "MIT",
"repository": {
Expand Down
4 changes: 4 additions & 0 deletions _packages/tsgo-linux-x64/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# @effect/tsgo-linux-x64

## 0.36.4

## 0.36.3

## 0.36.2

## 0.36.1
Expand Down
2 changes: 1 addition & 1 deletion _packages/tsgo-linux-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@effect/tsgo-linux-x64",
"version": "0.36.2",
"version": "0.36.4",
"description": "Effect Language Service for TypeScript-Go — Effect-specific diagnostics and hover features.",
"license": "MIT",
"repository": {
Expand Down
4 changes: 4 additions & 0 deletions _packages/tsgo-win32-arm64/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# @effect/tsgo-win32-arm64

## 0.36.4

## 0.36.3

## 0.36.2

## 0.36.1
Expand Down
2 changes: 1 addition & 1 deletion _packages/tsgo-win32-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@effect/tsgo-win32-arm64",
"version": "0.36.2",
"version": "0.36.4",
"description": "Effect Language Service for TypeScript-Go — Effect-specific diagnostics and hover features.",
"license": "MIT",
"repository": {
Expand Down
4 changes: 4 additions & 0 deletions _packages/tsgo-win32-x64/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# @effect/tsgo-win32-x64

## 0.36.4

## 0.36.3

## 0.36.2

## 0.36.1
Expand Down
2 changes: 1 addition & 1 deletion _packages/tsgo-win32-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@effect/tsgo-win32-x64",
"version": "0.36.2",
"version": "0.36.4",
"description": "Effect Language Service for TypeScript-Go — Effect-specific diagnostics and hover features.",
"license": "MIT",
"repository": {
Expand Down
13 changes: 13 additions & 0 deletions _packages/tsgo/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# @effect/tsgo

## 0.36.4

### Patch Changes

- 7a616ec: Allow declaration emit with `noEmitOnError` when all diagnostics are ignored Effect diagnostics.

## 0.36.3

### Patch Changes

- 73f7f28: Refresh patched binaries when an updated `@effect/tsgo` package provides a different replacement artifact.
- 9190801: Update Effect v4 dependencies and embedded test fixtures to `4.0.0-beta.107`.

## 0.36.2

### Patch Changes
Expand Down
8 changes: 4 additions & 4 deletions _packages/tsgo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@effect/tsgo",
"version": "0.36.2",
"version": "0.36.4",
"type": "module",
"description": "Effect Language Service for TypeScript-Go — Effect-specific diagnostics and hover features.",
"license": "MIT",
Expand Down Expand Up @@ -58,12 +58,12 @@
"@effect/tsgo-darwin-arm64": "workspace:*"
},
"devDependencies": {
"@effect/platform-node": "^4.0.0-beta.104",
"@effect/platform-node-shared": "^4.0.0-beta.104",
"@effect/platform-node": "^4.0.0-beta.107",
"@effect/platform-node-shared": "^4.0.0-beta.107",
"@types/node": "^24.3.0",
"tsdown": "^0.20.1",
"typescript": "^5.9.2",
"effect": "^4.0.0-beta.104",
"effect": "^4.0.0-beta.107",
"vitest": "^3.2.1"
}
}
19 changes: 13 additions & 6 deletions _packages/tsgo/src/patcher/discovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as Data from "effect/Data"
import * as Effect from "effect/Effect"
import * as FileSystem from "effect/FileSystem"
import * as Path from "effect/Path"
import { hashFile } from "./fileHash.js"
import type { Component, DiscoveredBinary } from "./types.js"

export const defaultTypescriptPackageNames = ["typescript", "@typescript/native"] as const
Expand All @@ -19,6 +20,8 @@ interface PackageMetadata {
readonly main?: string
}

type DiscoveredBinaryLocation = Omit<DiscoveredBinary, "fileHash">

const isNativeTypescriptVersion = (version: string) => {
const match = /\d+/.exec(version.trim())
return match !== null && Number(match[0]) >= 7
Expand Down Expand Up @@ -82,7 +85,7 @@ export const experimentalOxlintTarget = (platform: NodeJS.Platform, arch: string
const discoverTypeScript: (
cwdRequire: NodeJS.Require,
preferredPackage?: string
) => Effect.Effect<DiscoveredBinary[], DiscoveryError, FileSystem.FileSystem | Path.Path> = (
) => Effect.Effect<DiscoveredBinaryLocation[], DiscoveryError, FileSystem.FileSystem | Path.Path> = (
cwdRequire,
preferredPackage
) => Effect.gen(function*() {
Expand All @@ -102,14 +105,14 @@ const discoverTypeScript: (
packageName: platformPackageName,
packageVersion: platformPackage.version,
binaryPath: path.join(path.dirname(platformPackage.packageJsonPath), "lib", binaryName)
} satisfies DiscoveredBinary]
} satisfies DiscoveredBinaryLocation]
}
return []
})

const discoverOxlint: (
cwdRequire: NodeJS.Require
) => Effect.Effect<DiscoveredBinary[], DiscoveryError, FileSystem.FileSystem | Path.Path> = (cwdRequire) =>
) => Effect.Effect<DiscoveredBinaryLocation[], DiscoveryError, FileSystem.FileSystem | Path.Path> = (cwdRequire) =>
Effect.gen(function*() {
const path = yield* Path.Path
const oxlint = yield* optionally(readPackage(cwdRequire, "oxlint"))
Expand All @@ -121,7 +124,7 @@ const discoverOxlint: (
? error
: new DiscoveryError({ reason: "Unable to determine the Oxlint platform target." })
})
const discovered: Array<DiscoveredBinary> = []
const discovered: Array<DiscoveredBinaryLocation> = []
if (oxlint !== undefined) {
const binding = yield* readPackage(nodeModule.createRequire(oxlint.packageJsonPath), target.oxlintPackage)
if (binding.main === undefined) {
Expand Down Expand Up @@ -157,7 +160,7 @@ const discoverOxlint: (

const discoverVitePlusOxlint: (
cwdRequire: NodeJS.Require
) => Effect.Effect<DiscoveredBinary[], DiscoveryError, FileSystem.FileSystem | Path.Path> = (cwdRequire) =>
) => Effect.Effect<DiscoveredBinaryLocation[], DiscoveryError, FileSystem.FileSystem | Path.Path> = (cwdRequire) =>
Effect.gen(function*() {
const vitePlus = yield* optionally(readPackage(cwdRequire, "vite-plus"))
if (vitePlus === undefined) return []
Expand All @@ -170,9 +173,13 @@ export const discoverBinaries = (cwd: string, preferredTypescriptPackage?: strin
const typescript = yield* discoverTypeScript(cwdRequire, preferredTypescriptPackage)
const oxlint = yield* discoverOxlint(cwdRequire)
const vitePlusOxlint = yield* discoverVitePlusOxlint(cwdRequire)
return [...new Map(
const discovered = [...new Map(
[...typescript, ...oxlint, ...vitePlusOxlint].map((binary) => [binary.binaryPath, binary])
).values()]
return yield* Effect.forEach(discovered, (binary) => hashFile(binary.binaryPath).pipe(
Effect.map((fileHash) => ({ ...binary, fileHash })),
Effect.mapError(() => new DiscoveryError({ reason: `Unable to read discovered binary ${binary.binaryPath}.` }))
))
})

export const selectComponents = (
Expand Down
17 changes: 17 additions & 0 deletions _packages/tsgo/src/patcher/fileHash.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import * as Crypto from "effect/Crypto"
import * as Effect from "effect/Effect"
import * as Encoding from "effect/Encoding"
import * as FileSystem from "effect/FileSystem"

const textEncoder = new TextEncoder()

export const hashBytes = (contents: string | Uint8Array) => Effect.gen(function*() {
const crypto = yield* Crypto.Crypto
const digest = yield* crypto.digest("SHA-256", typeof contents === "string" ? textEncoder.encode(contents) : contents)
return Encoding.encodeHex(digest)
})

export const hashFile = (filePath: string) => Effect.gen(function*() {
const fs = yield* FileSystem.FileSystem
return yield* hashBytes(yield* fs.readFile(filePath))
})
Loading