diff --git a/.changeset/add-sourcemap-shim.md b/.changeset/add-sourcemap-shim.md new file mode 100644 index 00000000..7da48bfb --- /dev/null +++ b/.changeset/add-sourcemap-shim.md @@ -0,0 +1,5 @@ +--- +"@effect/tsgo": minor +--- + +Update TypeScript-Go and expose the internal sourcemap package through generated shims. diff --git a/.changeset/bright-geese-push.md b/.changeset/bright-geese-push.md deleted file mode 100644 index e7c86d76..00000000 --- a/.changeset/bright-geese-push.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@effect/tsgo": patch ---- - -Publish platform packages with both the `tsgo` binary built from `main` and the `tsc` binary built from `generated/stable`. diff --git a/.changeset/generated-stable-branch.md b/.changeset/generated-stable-branch.md deleted file mode 100644 index d80729be..00000000 --- a/.changeset/generated-stable-branch.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@effect/tsgo": patch ---- - -Add automation that publishes a generated `generated/stable` branch pinned to the TypeScript RC `typescript-go` commit and runs CI on that branch. diff --git a/.changeset/generated-stable-parent.md b/.changeset/generated-stable-parent.md new file mode 100644 index 00000000..e4f868e2 --- /dev/null +++ b/.changeset/generated-stable-parent.md @@ -0,0 +1,5 @@ +--- +"@effect/tsgo": patch +--- + +Make generated stable branch pull requests commit on top of `generated/stable` to avoid merge conflicts with `main`. diff --git a/.changeset/generated-stable-pr-workflow.md b/.changeset/generated-stable-pr-workflow.md deleted file mode 100644 index 888c2e68..00000000 --- a/.changeset/generated-stable-pr-workflow.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@effect/tsgo": patch ---- - -Update the generated stable branch automation to open a pull request and validate it before merging. diff --git a/.changeset/native-preview-githead.md b/.changeset/native-preview-githead.md deleted file mode 100644 index a0a2e141..00000000 --- a/.changeset/native-preview-githead.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@effect/tsgo": patch ---- - -Fix the automated TypeScript-Go update workflow to pin the submodule to the commit shipped by `@typescript/native-preview@latest`. diff --git a/.changeset/remove-effect-diagnostics-api.md b/.changeset/remove-effect-diagnostics-api.md new file mode 100644 index 00000000..9c32f352 --- /dev/null +++ b/.changeset/remove-effect-diagnostics-api.md @@ -0,0 +1,5 @@ +--- +"@effect/tsgo": patch +--- + +Remove the unused native `getEffectDiagnostics` API hook from the patched TypeScript-Go API. diff --git a/.changeset/update-typescript-go.md b/.changeset/update-typescript-go.md index 26e4d6d9..26e8c24b 100644 --- a/.changeset/update-typescript-go.md +++ b/.changeset/update-typescript-go.md @@ -2,4 +2,4 @@ "@effect/tsgo": patch --- -Update to [`@typescript/native-preview@7.0.0-dev.20260620.1`](https://www.npmjs.com/package/@typescript/native-preview/v/7.0.0-dev.20260620.1), which ships [`typescript-go`](https://github.com/microsoft/typescript-go/commit/dc37b5249ab60e2bbce936f71b883e6c8136167e) commit `dc37b5249ab60e2bbce936f71b883e6c8136167e`. +Update to [`@typescript/native-preview@7.0.0-dev.20260623.1`](https://www.npmjs.com/package/@typescript/native-preview/v/7.0.0-dev.20260623.1), which ships [`typescript-go`](https://github.com/microsoft/typescript-go/commit/9415bebdeb9e69997846d2a2844c78f439ff22f1) commit `9415bebdeb9e69997846d2a2844c78f439ff22f1`. diff --git a/.changeset/version-suffix-patch-context.md b/.changeset/version-suffix-patch-context.md deleted file mode 100644 index 698a08c1..00000000 --- a/.changeset/version-suffix-patch-context.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@effect/tsgo": patch ---- - -Make the TypeScript-Go version suffix patch apply across upstream TypeScript version literal changes. diff --git a/.github/workflows/generate-stable-branch.yml b/.github/workflows/generate-stable-branch.yml index 82457f97..63852c68 100644 --- a/.github/workflows/generate-stable-branch.yml +++ b/.github/workflows/generate-stable-branch.yml @@ -23,7 +23,7 @@ jobs: outputs: has_changes: ${{ steps.changes.outputs.has_changes }} pr_number: ${{ steps.pr.outputs.pr_number }} - head_sha: ${{ steps.pr.outputs.head_sha }} + head_sha: ${{ steps.changes.outputs.head_sha }} permissions: contents: write pull-requests: write @@ -83,36 +83,35 @@ jobs: - name: Regenerate shims and generated files run: bash _tools/setup-repo.sh --ci - - name: Commit generated stable changes + - name: Create generated stable commit + id: changes run: | git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git add -A - - if git diff --cached --quiet; then - echo "No generated stable changes to commit." - else - git commit -m "chore: generate stable TypeScript-Go branch" \ - -m "TypeScript package: ${{ steps.typescript.outputs.spec }}" \ - -m "TypeScript version: ${{ steps.typescript.outputs.version }}" \ - -m "TypeScript-Go commit: ${{ steps.typescript.outputs.git_head }}" - fi - - - name: Check for generated/stable changes - id: changes - run: | git fetch --depth 1 origin generated/stable - if git diff --quiet FETCH_HEAD HEAD; then + git add -A + generated_tree="$(git write-tree)" + stable_tree="$(git rev-parse FETCH_HEAD^{tree})" + + if [ "${generated_tree}" = "${stable_tree}" ]; then + echo "Generated stable branch is already up to date." echo "has_changes=false" >> "$GITHUB_OUTPUT" exit 0 fi + head_sha="$(git commit-tree "${generated_tree}" \ + -p FETCH_HEAD \ + -m "chore: generate stable TypeScript-Go branch" \ + -m "TypeScript package: ${{ steps.typescript.outputs.spec }}" \ + -m "TypeScript version: ${{ steps.typescript.outputs.version }}" \ + -m "TypeScript-Go commit: ${{ steps.typescript.outputs.git_head }}")" echo "has_changes=true" >> "$GITHUB_OUTPUT" + echo "head_sha=${head_sha}" >> "$GITHUB_OUTPUT" - name: Push generated stable PR branch if: steps.changes.outputs.has_changes == 'true' - run: git push --force origin HEAD:chore/generate-stable-branch + run: git push --force origin "${{ steps.changes.outputs.head_sha }}:chore/generate-stable-branch" - name: Create or update generated stable PR id: pr @@ -159,7 +158,6 @@ jobs: fi echo "pr_number=${pr_number}" >> "$GITHUB_OUTPUT" - echo "head_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" validate-pr: name: Validate generated stable PR diff --git a/_packages/tsgo-darwin-arm64/CHANGELOG.md b/_packages/tsgo-darwin-arm64/CHANGELOG.md index ebd234f0..44d582ec 100644 --- a/_packages/tsgo-darwin-arm64/CHANGELOG.md +++ b/_packages/tsgo-darwin-arm64/CHANGELOG.md @@ -1,5 +1,7 @@ # @effect/tsgo-darwin-arm64 +## 0.14.6 + ## 0.14.5 ## 0.14.4 diff --git a/_packages/tsgo-darwin-arm64/package.json b/_packages/tsgo-darwin-arm64/package.json index 30031356..cacc5671 100644 --- a/_packages/tsgo-darwin-arm64/package.json +++ b/_packages/tsgo-darwin-arm64/package.json @@ -1,6 +1,6 @@ { "name": "@effect/tsgo-darwin-arm64", - "version": "0.14.5", + "version": "0.14.6", "description": "Effect Language Service for TypeScript-Go — Effect-specific diagnostics and hover features.", "license": "MIT", "repository": { diff --git a/_packages/tsgo-darwin-x64/CHANGELOG.md b/_packages/tsgo-darwin-x64/CHANGELOG.md index c3100527..7e3fa226 100644 --- a/_packages/tsgo-darwin-x64/CHANGELOG.md +++ b/_packages/tsgo-darwin-x64/CHANGELOG.md @@ -1,5 +1,7 @@ # @effect/tsgo-darwin-x64 +## 0.14.6 + ## 0.14.5 ## 0.14.4 diff --git a/_packages/tsgo-darwin-x64/package.json b/_packages/tsgo-darwin-x64/package.json index 2e1482f9..747fc90f 100644 --- a/_packages/tsgo-darwin-x64/package.json +++ b/_packages/tsgo-darwin-x64/package.json @@ -1,6 +1,6 @@ { "name": "@effect/tsgo-darwin-x64", - "version": "0.14.5", + "version": "0.14.6", "description": "Effect Language Service for TypeScript-Go — Effect-specific diagnostics and hover features.", "license": "MIT", "repository": { diff --git a/_packages/tsgo-linux-arm/CHANGELOG.md b/_packages/tsgo-linux-arm/CHANGELOG.md index acfa2e05..b950e716 100644 --- a/_packages/tsgo-linux-arm/CHANGELOG.md +++ b/_packages/tsgo-linux-arm/CHANGELOG.md @@ -1,5 +1,7 @@ # @effect/tsgo-linux-arm +## 0.14.6 + ## 0.14.5 ## 0.14.4 diff --git a/_packages/tsgo-linux-arm/package.json b/_packages/tsgo-linux-arm/package.json index 243a8c20..b68caa5f 100644 --- a/_packages/tsgo-linux-arm/package.json +++ b/_packages/tsgo-linux-arm/package.json @@ -1,6 +1,6 @@ { "name": "@effect/tsgo-linux-arm", - "version": "0.14.5", + "version": "0.14.6", "description": "Effect Language Service for TypeScript-Go — Effect-specific diagnostics and hover features.", "license": "MIT", "repository": { diff --git a/_packages/tsgo-linux-arm64/CHANGELOG.md b/_packages/tsgo-linux-arm64/CHANGELOG.md index 632f7baa..8f0579de 100644 --- a/_packages/tsgo-linux-arm64/CHANGELOG.md +++ b/_packages/tsgo-linux-arm64/CHANGELOG.md @@ -1,5 +1,7 @@ # @effect/tsgo-linux-arm64 +## 0.14.6 + ## 0.14.5 ## 0.14.4 diff --git a/_packages/tsgo-linux-arm64/package.json b/_packages/tsgo-linux-arm64/package.json index 6cc6b6a4..1a79b329 100644 --- a/_packages/tsgo-linux-arm64/package.json +++ b/_packages/tsgo-linux-arm64/package.json @@ -1,6 +1,6 @@ { "name": "@effect/tsgo-linux-arm64", - "version": "0.14.5", + "version": "0.14.6", "description": "Effect Language Service for TypeScript-Go — Effect-specific diagnostics and hover features.", "license": "MIT", "repository": { diff --git a/_packages/tsgo-linux-x64/CHANGELOG.md b/_packages/tsgo-linux-x64/CHANGELOG.md index 0fb3abb6..ff81ba39 100644 --- a/_packages/tsgo-linux-x64/CHANGELOG.md +++ b/_packages/tsgo-linux-x64/CHANGELOG.md @@ -1,5 +1,7 @@ # @effect/tsgo-linux-x64 +## 0.14.6 + ## 0.14.5 ## 0.14.4 diff --git a/_packages/tsgo-linux-x64/package.json b/_packages/tsgo-linux-x64/package.json index c30e03af..4ce214b5 100644 --- a/_packages/tsgo-linux-x64/package.json +++ b/_packages/tsgo-linux-x64/package.json @@ -1,6 +1,6 @@ { "name": "@effect/tsgo-linux-x64", - "version": "0.14.5", + "version": "0.14.6", "description": "Effect Language Service for TypeScript-Go — Effect-specific diagnostics and hover features.", "license": "MIT", "repository": { diff --git a/_packages/tsgo-win32-arm64/CHANGELOG.md b/_packages/tsgo-win32-arm64/CHANGELOG.md index 34a982dc..29bef90f 100644 --- a/_packages/tsgo-win32-arm64/CHANGELOG.md +++ b/_packages/tsgo-win32-arm64/CHANGELOG.md @@ -1,5 +1,7 @@ # @effect/tsgo-win32-arm64 +## 0.14.6 + ## 0.14.5 ## 0.14.4 diff --git a/_packages/tsgo-win32-arm64/package.json b/_packages/tsgo-win32-arm64/package.json index 41d543f9..f4f4c6d4 100644 --- a/_packages/tsgo-win32-arm64/package.json +++ b/_packages/tsgo-win32-arm64/package.json @@ -1,6 +1,6 @@ { "name": "@effect/tsgo-win32-arm64", - "version": "0.14.5", + "version": "0.14.6", "description": "Effect Language Service for TypeScript-Go — Effect-specific diagnostics and hover features.", "license": "MIT", "repository": { diff --git a/_packages/tsgo-win32-x64/CHANGELOG.md b/_packages/tsgo-win32-x64/CHANGELOG.md index b462fea7..eb6bb17c 100644 --- a/_packages/tsgo-win32-x64/CHANGELOG.md +++ b/_packages/tsgo-win32-x64/CHANGELOG.md @@ -1,5 +1,7 @@ # @effect/tsgo-win32-x64 +## 0.14.6 + ## 0.14.5 ## 0.14.4 diff --git a/_packages/tsgo-win32-x64/package.json b/_packages/tsgo-win32-x64/package.json index 325b311f..6ebb6f6d 100644 --- a/_packages/tsgo-win32-x64/package.json +++ b/_packages/tsgo-win32-x64/package.json @@ -1,6 +1,6 @@ { "name": "@effect/tsgo-win32-x64", - "version": "0.14.5", + "version": "0.14.6", "description": "Effect Language Service for TypeScript-Go — Effect-specific diagnostics and hover features.", "license": "MIT", "repository": { diff --git a/_packages/tsgo/CHANGELOG.md b/_packages/tsgo/CHANGELOG.md index f3d8d208..75154c6a 100644 --- a/_packages/tsgo/CHANGELOG.md +++ b/_packages/tsgo/CHANGELOG.md @@ -1,5 +1,16 @@ # @effect/tsgo +## 0.14.6 + +### Patch Changes + +- 070f2b5: Publish platform packages with both the `tsgo` binary built from `main` and the `tsc` binary built from `generated/stable`. +- ef53ddd: Add automation that publishes a generated `generated/stable` branch pinned to the TypeScript RC `typescript-go` commit and runs CI on that branch. +- eb0dbbc: Update the generated stable branch automation to open a pull request and validate it before merging. +- ef0a5a0: Fix the automated TypeScript-Go update workflow to pin the submodule to the commit shipped by `@typescript/native-preview@latest`. +- fb3096f: Update to [`@typescript/native-preview@7.0.0-dev.20260620.1`](https://www.npmjs.com/package/@typescript/native-preview/v/7.0.0-dev.20260620.1), which ships [`typescript-go`](https://github.com/microsoft/typescript-go/commit/dc37b5249ab60e2bbce936f71b883e6c8136167e) commit `dc37b5249ab60e2bbce936f71b883e6c8136167e`. +- 4423d1d: Make the TypeScript-Go version suffix patch apply across upstream TypeScript version literal changes. + ## 0.14.5 ### Patch Changes diff --git a/_packages/tsgo/package.json b/_packages/tsgo/package.json index 43435c29..b207e478 100644 --- a/_packages/tsgo/package.json +++ b/_packages/tsgo/package.json @@ -1,6 +1,6 @@ { "name": "@effect/tsgo", - "version": "0.14.5", + "version": "0.14.6", "description": "Effect Language Service for TypeScript-Go — Effect-specific diagnostics and hover features.", "license": "MIT", "repository": { diff --git a/_patches/001-cmd-tsgo-main.patch b/_patches/001-cmd-tsgo-main.patch index 41a3bb33..f0579f1e 100644 --- a/_patches/001-cmd-tsgo-main.patch +++ b/_patches/001-cmd-tsgo-main.patch @@ -2,12 +2,11 @@ diff --git a/cmd/tsgo/main.go b/cmd/tsgo/main.go index 8d6816fa3d..49c6cbecba 100644 --- a/cmd/tsgo/main.go +++ b/cmd/tsgo/main.go -@@ -6,6 +6,12 @@ import ( +@@ -6,6 +6,11 @@ import ( "os/signal" "syscall" + // Import Effect hooks to register via init() -+ _ "github.com/effect-ts/tsgo/etsapihooks" // native API hooks + _ "github.com/effect-ts/tsgo/etsexecutehooks" // exit-code filtering hooks + _ "github.com/effect-ts/tsgo/etscheckerhooks" // checker diagnostics hooks + _ "github.com/effect-ts/tsgo/etslshooks" // LS codefix hooks diff --git a/_patches/028-api-effect-diagnostics.patch b/_patches/028-api-effect-diagnostics.patch deleted file mode 100644 index 5e124d21..00000000 --- a/_patches/028-api-effect-diagnostics.patch +++ /dev/null @@ -1,118 +0,0 @@ -diff --git a/internal/api/proto.go b/internal/api/proto.go ---- a/internal/api/proto.go -+++ b/internal/api/proto.go -@@ -4,6 +4,7 @@ import ( - "errors" - "fmt" - -+ "github.com/effect-ts/tsgo/etscore" - "github.com/microsoft/typescript-go/internal/ast" - "github.com/microsoft/typescript-go/internal/checker" - "github.com/microsoft/typescript-go/internal/core" -@@ -156,6 +157,7 @@ const ( - // Diagnostic methods - MethodGetSyntacticDiagnostics Method = "getSyntacticDiagnostics" - MethodGetSemanticDiagnostics Method = "getSemanticDiagnostics" -+ MethodGetEffectDiagnostics Method = "getEffectDiagnostics" - MethodGetSuggestionDiagnostics Method = "getSuggestionDiagnostics" - MethodGetDeclarationDiagnostics Method = "getDeclarationDiagnostics" - MethodGetConfigFileParsingDiagnostics Method = "getConfigFileParsingDiagnostics" -@@ -357,6 +359,7 @@ var unmarshalers = map[Method]func([]byte) (any, error){ - MethodGetESSymbolType: unmarshallerFor[GetIntrinsicTypeParams], - MethodGetSyntacticDiagnostics: unmarshallerFor[GetDiagnosticsParams], - MethodGetSemanticDiagnostics: unmarshallerFor[GetDiagnosticsParams], -+ MethodGetEffectDiagnostics: unmarshallerFor[GetEffectDiagnosticsParams], - MethodGetSuggestionDiagnostics: unmarshallerFor[GetDiagnosticsParams], - MethodGetDeclarationDiagnostics: unmarshallerFor[GetDiagnosticsParams], - MethodGetConfigFileParsingDiagnostics: unmarshallerFor[GetProjectDiagnosticsParams], -@@ -829,6 +832,15 @@ type GetDiagnosticsParams struct { - File *DocumentIdentifier `json:"file,omitempty"` - } - -+// GetEffectDiagnosticsParams are parameters for Effect diagnostic rules. -+type GetEffectDiagnosticsParams struct { -+ Snapshot SnapshotID `json:"snapshot"` -+ Project ProjectID `json:"project"` -+ File DocumentIdentifier `json:"file"` -+ Options *etscore.EffectPluginOptions `json:"options,omitempty"` -+ Rules []string `json:"rules,omitempty"` -+} -+ - // GetProjectDiagnosticsParams are parameters for project-wide diagnostic methods. - type GetProjectDiagnosticsParams struct { - Snapshot SnapshotID `json:"snapshot"` -diff --git a/internal/api/session.go b/internal/api/session.go ---- a/internal/api/session.go -+++ b/internal/api/session.go -@@ -7,6 +7,7 @@ import ( - "sync" - "sync/atomic" - -+ "github.com/effect-ts/tsgo/etscore" - "github.com/microsoft/typescript-go/internal/api/encoder" - "github.com/microsoft/typescript-go/internal/ast" - "github.com/microsoft/typescript-go/internal/astnav" -@@ -21,6 +22,15 @@ import ( - "github.com/microsoft/typescript-go/internal/tspath" - ) - -+// GetEffectDiagnosticsCallback is invoked by the API getEffectDiagnostics method. -+// It is registered by external packages to keep Effect rule evaluation outside TypeScript-Go. -+var GetEffectDiagnosticsCallback func(ctx context.Context, program *compiler.Program, c *checker.Checker, sourceFile *ast.SourceFile, options *etscore.EffectPluginOptions, rules []string) ([]*ast.Diagnostic, error) -+ -+// RegisterGetEffectDiagnosticsCallback registers the getEffectDiagnostics API callback. -+func RegisterGetEffectDiagnosticsCallback(cb func(ctx context.Context, program *compiler.Program, c *checker.Checker, sourceFile *ast.SourceFile, options *etscore.EffectPluginOptions, rules []string) ([]*ast.Diagnostic, error)) { -+ GetEffectDiagnosticsCallback = cb -+} -+ - var sessionIDCounter atomic.Uint64 - - // snapshotData holds the per-snapshot state including the snapshot itself -@@ -459,6 +469,8 @@ func (s *Session) HandleRequest(ctx context.Context, method string, params json. - return s.handleGetSyntacticDiagnostics(ctx, parsed.(*GetDiagnosticsParams)) - case string(MethodGetSemanticDiagnostics): - return s.handleGetSemanticDiagnostics(ctx, parsed.(*GetDiagnosticsParams)) -+ case string(MethodGetEffectDiagnostics): -+ return s.handleGetEffectDiagnostics(ctx, parsed.(*GetEffectDiagnosticsParams)) - case string(MethodGetSuggestionDiagnostics): - return s.handleGetSuggestionDiagnostics(ctx, parsed.(*GetDiagnosticsParams)) - case string(MethodGetDeclarationDiagnostics): -@@ -2169,4 +2181,38 @@ func (s *Session) handleGetSemanticDiagnostics(ctx context.Context, params *GetD - return NewDiagnosticResponses(diags), nil - } - -+// handleGetEffectDiagnostics returns Effect diagnostics for a file using explicit API options. -+func (s *Session) handleGetEffectDiagnostics(ctx context.Context, params *GetEffectDiagnosticsParams) ([]*DiagnosticResponse, error) { -+ if GetEffectDiagnosticsCallback == nil { -+ return nil, fmt.Errorf("getEffectDiagnostics callback is not registered") -+ } -+ -+ sd, err := s.getSnapshotData(params.Snapshot) -+ if err != nil { -+ return nil, err -+ } -+ -+ program, err := sd.getProgram(params.Project) -+ if err != nil { -+ return nil, err -+ } -+ -+ sourceFile := program.GetSourceFile(params.File.ToFileName()) -+ if sourceFile == nil { -+ return nil, fmt.Errorf("source file not found: %s", params.File.ToFileName()) -+ } -+ -+ c, done := program.GetTypeCheckerForFileExclusive(ctx, sourceFile) -+ defer done() -+ -+ // Ensure the source file is checked before running rules that rely on type information. -+ c.GetDiagnostics(ctx, sourceFile) -+ -+ diags, err := GetEffectDiagnosticsCallback(ctx, program, c, sourceFile, params.Options, params.Rules) -+ if err != nil { -+ return nil, err -+ } -+ return NewDiagnosticResponses(diags), nil -+} -+ - // handleGetSuggestionDiagnostics returns suggestion diagnostics for a file or all files. diff --git a/_tools/gen_shims/main.go b/_tools/gen_shims/main.go index c18969a2..d0b1c6af 100644 --- a/_tools/gen_shims/main.go +++ b/_tools/gen_shims/main.go @@ -75,6 +75,7 @@ func main() { "project/logging", "repo", "scanner", + "sourcemap", "testrunner", "testutil", "testutil/lsptestutil", diff --git a/etsapihooks/doc.go b/etsapihooks/doc.go deleted file mode 100644 index 82645155..00000000 --- a/etsapihooks/doc.go +++ /dev/null @@ -1,5 +0,0 @@ -// Package etsapihooks registers Effect API hooks for TypeScript-Go. -// -// This package should be imported with a blank identifier by the main entry point -// to register API-only Effect diagnostics. -package etsapihooks diff --git a/etsapihooks/init.go b/etsapihooks/init.go deleted file mode 100644 index 1ddfaa31..00000000 --- a/etsapihooks/init.go +++ /dev/null @@ -1,25 +0,0 @@ -package etsapihooks - -import ( - "context" - - "github.com/effect-ts/tsgo/etscore" - "github.com/effect-ts/tsgo/internal/effectconfigraw" - "github.com/effect-ts/tsgo/internal/rulerunner" - "github.com/microsoft/typescript-go/shim/api" - "github.com/microsoft/typescript-go/shim/ast" - "github.com/microsoft/typescript-go/shim/checker" - "github.com/microsoft/typescript-go/shim/compiler" -) - -func init() { - effectconfigraw.Register() - api.RegisterGetEffectDiagnosticsCallback(getEffectDiagnostics) -} - -func getEffectDiagnostics(ctx context.Context, program *compiler.Program, c *checker.Checker, sf *ast.SourceFile, options *etscore.EffectPluginOptions, ruleNames []string) ([]*ast.Diagnostic, error) { - if options == nil { - options = program.Options().Effect - } - return rulerunner.Run(ctx, program, c, sf, options, ruleNames) -} diff --git a/etscore/version_generated.go b/etscore/version_generated.go index dfb00e8d..a03a99a8 100644 --- a/etscore/version_generated.go +++ b/etscore/version_generated.go @@ -2,4 +2,4 @@ package etscore -const EffectVersion = "0.14.5" +const EffectVersion = "0.14.6" diff --git a/flake.nix b/flake.nix index 7afebbfe..5caab87c 100644 --- a/flake.nix +++ b/flake.nix @@ -7,7 +7,7 @@ /* Source of truth: git submodule `typescript-go` commit. Keep in sync via `_tools/update-flake-vendor-hash.sh`. */ typescript-go-src = { - url = "github:microsoft/typescript-go/dc37b5249ab60e2bbce936f71b883e6c8136167e?submodules=1"; + url = "github:microsoft/typescript-go/6d68dd661d656b030149a703b6eeafffe46ee578?submodules=1"; flake = false; }; /* Source of truth: typescript-go's `_submodules/TypeScript` commit. diff --git a/go.mod b/go.mod index 7eaec22b..2010139e 100644 --- a/go.mod +++ b/go.mod @@ -31,6 +31,7 @@ replace ( github.com/microsoft/typescript-go/shim/project/logging => ./shim/project/logging github.com/microsoft/typescript-go/shim/repo => ./shim/repo github.com/microsoft/typescript-go/shim/scanner => ./shim/scanner + github.com/microsoft/typescript-go/shim/sourcemap => ./shim/sourcemap github.com/microsoft/typescript-go/shim/testrunner => ./shim/testrunner github.com/microsoft/typescript-go/shim/testutil => ./shim/testutil github.com/microsoft/typescript-go/shim/testutil/baseline => ./shim/testutil/baseline @@ -69,6 +70,7 @@ require ( github.com/microsoft/typescript-go/shim/parser v0.0.0-00010101000000-000000000000 github.com/microsoft/typescript-go/shim/project/logging v0.0.0-00010101000000-000000000000 github.com/microsoft/typescript-go/shim/scanner v0.0.0-00010101000000-000000000000 + github.com/microsoft/typescript-go/shim/sourcemap v0.0.0-00010101000000-000000000000 github.com/microsoft/typescript-go/shim/testutil/baseline v0.0.0-00010101000000-000000000000 github.com/microsoft/typescript-go/shim/testutil/harnessutil v0.0.0-00010101000000-000000000000 github.com/microsoft/typescript-go/shim/tsoptions v0.0.0-00010101000000-000000000000 diff --git a/go.work b/go.work index 844412a7..b813f4e6 100644 --- a/go.work +++ b/go.work @@ -29,6 +29,7 @@ use ( ./shim/project/logging ./shim/repo ./shim/scanner + ./shim/sourcemap ./shim/testrunner ./shim/testutil ./shim/testutil/baseline diff --git a/shim/api/shim.go b/shim/api/shim.go index 215c9ba8..76c14dc4 100644 --- a/shim/api/shim.go +++ b/shim/api/shim.go @@ -3,12 +3,9 @@ package api -import "context" -import "github.com/effect-ts/tsgo/etscore" import "github.com/microsoft/typescript-go/internal/api" import "github.com/microsoft/typescript-go/internal/ast" import "github.com/microsoft/typescript-go/internal/checker" -import "github.com/microsoft/typescript-go/internal/compiler" import "github.com/microsoft/typescript-go/internal/project" import "io" import _ "unsafe" @@ -36,8 +33,6 @@ type GetCompletionsAtPositionParams = api.GetCompletionsAtPositionParams type GetContextualTypeParams = api.GetContextualTypeParams type GetDefaultProjectForFileParams = api.GetDefaultProjectForFileParams type GetDiagnosticsParams = api.GetDiagnosticsParams -var GetEffectDiagnosticsCallback = api.GetEffectDiagnosticsCallback -type GetEffectDiagnosticsParams = api.GetEffectDiagnosticsParams type GetIntrinsicTypeParams = api.GetIntrinsicTypeParams type GetNonNullableTypeParams = api.GetNonNullableTypeParams type GetParameterTypeParams = api.GetParameterTypeParams @@ -99,7 +94,6 @@ const MethodGetDeclarationDiagnostics = api.MethodGetDeclarationDiagnostics const MethodGetDeclaredTypeOfSymbol = api.MethodGetDeclaredTypeOfSymbol const MethodGetDefaultProjectForFile = api.MethodGetDefaultProjectForFile const MethodGetESSymbolType = api.MethodGetESSymbolType -const MethodGetEffectDiagnostics = api.MethodGetEffectDiagnostics const MethodGetExportSymbolOfSymbol = api.MethodGetExportSymbolOfSymbol const MethodGetExportsOfSymbol = api.MethodGetExportsOfSymbol const MethodGetExtendsTypeOfType = api.MethodGetExtendsTypeOfType @@ -210,8 +204,6 @@ type ProjectResponse = api.ProjectResponse type Protocol = api.Protocol type RawBinary = api.RawBinary type ReferencedSymbolEntry = api.ReferencedSymbolEntry -//go:linkname RegisterGetEffectDiagnosticsCallback github.com/microsoft/typescript-go/internal/api.RegisterGetEffectDiagnosticsCallback -func RegisterGetEffectDiagnosticsCallback(cb func(ctx context.Context, program *compiler.Program, c *checker.Checker, sourceFile *ast.SourceFile, options *etscore.EffectPluginOptions, rules []string) ([]*ast.Diagnostic, error)) type ReleaseParams = api.ReleaseParams type ResolveNameParams = api.ResolveNameParams type Session = api.Session diff --git a/shim/sourcemap/go.mod b/shim/sourcemap/go.mod new file mode 100644 index 00000000..a338278d --- /dev/null +++ b/shim/sourcemap/go.mod @@ -0,0 +1,5 @@ +module github.com/microsoft/typescript-go/shim/sourcemap + +go 1.26 + +require github.com/microsoft/typescript-go v0.0.0 diff --git a/shim/sourcemap/shim.go b/shim/sourcemap/shim.go new file mode 100644 index 00000000..36dd1cc5 --- /dev/null +++ b/shim/sourcemap/shim.go @@ -0,0 +1,37 @@ + +// Code generated by _tools/gen_shims. DO NOT EDIT. + +package sourcemap + +import "github.com/microsoft/typescript-go/internal/core" +import "github.com/microsoft/typescript-go/internal/sourcemap" +import "github.com/microsoft/typescript-go/internal/tspath" +import _ "unsafe" + +//go:linkname CreateECMALineInfo github.com/microsoft/typescript-go/internal/sourcemap.CreateECMALineInfo +func CreateECMALineInfo(text string, lineStarts core.ECMALineStarts) *sourcemap.ECMALineInfo +//go:linkname DecodeMappings github.com/microsoft/typescript-go/internal/sourcemap.DecodeMappings +func DecodeMappings(mappings string) *sourcemap.MappingsDecoder +type DocumentPosition = sourcemap.DocumentPosition +type DocumentPositionMapper = sourcemap.DocumentPositionMapper +type ECMALineInfo = sourcemap.ECMALineInfo +type Generator = sourcemap.Generator +//go:linkname GetDocumentPositionMapper github.com/microsoft/typescript-go/internal/sourcemap.GetDocumentPositionMapper +func GetDocumentPositionMapper(host sourcemap.Host, generatedFileName string) *sourcemap.DocumentPositionMapper +type Host = sourcemap.Host +type MappedPosition = sourcemap.MappedPosition +type Mapping = sourcemap.Mapping +type MappingsDecoder = sourcemap.MappingsDecoder +const MissingLineOrColumn = sourcemap.MissingLineOrColumn +const MissingName = sourcemap.MissingName +const MissingSource = sourcemap.MissingSource +const MissingUTF16Column = sourcemap.MissingUTF16Column +type NameIndex = sourcemap.NameIndex +//go:linkname NewGenerator github.com/microsoft/typescript-go/internal/sourcemap.NewGenerator +func NewGenerator(file string, sourceRoot string, sourcesDirectoryPath string, options tspath.ComparePathsOptions) *sourcemap.Generator +type RawSourceMap = sourcemap.RawSourceMap +type Source = sourcemap.Source +type SourceIndex = sourcemap.SourceIndex +type SourceMappedPosition = sourcemap.SourceMappedPosition +//go:linkname TryGetSourceMappingURL github.com/microsoft/typescript-go/internal/sourcemap.TryGetSourceMappingURL +func TryGetSourceMappingURL(lineInfo *sourcemap.ECMALineInfo) string