ttsc 0.18.2 → 0.18.4
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/cmd/ttscgraph/main.go +18 -12
- package/cmd/ttscgraph/run_help_version_and_bad_flags_exit_codes_test.go +23 -5
- package/cmd/ttscgraph/serve.go +863 -0
- package/cmd/ttscgraph/serve_protocol_rejects_invalid_request_line_test.go +43 -0
- package/cmd/ttscgraph/serve_protocol_retries_session_creation_test.go +83 -0
- package/cmd/ttscgraph/serve_protocol_reuses_session_test.go +35 -0
- package/cmd/ttscgraph/serve_session_applies_source_edit_incrementally_test.go +55 -0
- package/cmd/ttscgraph/serve_session_fails_closed_on_deleted_config_test.go +68 -0
- package/cmd/ttscgraph/serve_session_fails_closed_on_invalid_config_test.go +50 -0
- package/cmd/ttscgraph/serve_session_keeps_missing_literal_root_unchanged_test.go +46 -0
- package/cmd/ttscgraph/serve_session_rebuilds_import_graph_change_test.go +60 -0
- package/cmd/ttscgraph/serve_session_reloads_created_literal_root_test.go +44 -0
- package/cmd/ttscgraph/serve_session_reloads_extended_config_change_test.go +45 -0
- package/cmd/ttscgraph/serve_session_reloads_newly_resolved_conditional_export_test.go +60 -0
- package/cmd/ttscgraph/serve_session_reloads_newly_resolved_config_types_test.go +44 -0
- package/cmd/ttscgraph/serve_session_reloads_newly_resolved_excluded_import_test.go +62 -0
- package/cmd/ttscgraph/serve_session_reloads_newly_resolved_package_export_test.go +46 -0
- package/cmd/ttscgraph/serve_session_reloads_newly_resolved_package_import_test.go +46 -0
- package/cmd/ttscgraph/serve_session_reloads_newly_resolved_path_alias_test.go +47 -0
- package/cmd/ttscgraph/serve_session_reloads_newly_resolved_reference_path_test.go +42 -0
- package/cmd/ttscgraph/serve_session_reloads_newly_resolved_root_dirs_target_test.go +46 -0
- package/cmd/ttscgraph/serve_session_reloads_newly_resolved_type_reference_test.go +42 -0
- package/cmd/ttscgraph/serve_session_reloads_root_file_set_test.go +52 -0
- package/cmd/ttscgraph/serve_session_reloads_source_deleted_during_load_test.go +60 -0
- package/cmd/ttscgraph/serve_session_reloads_transitive_project_reference_test.go +55 -0
- package/cmd/ttscgraph/serve_session_reloads_when_program_plugin_linked_test.go +53 -0
- package/cmd/ttscgraph/serve_session_reuses_unchanged_preamble_source_test.go +45 -0
- package/cmd/ttscgraph/serve_session_reuses_unchanged_snapshot_test.go +52 -0
- package/cmd/ttscgraph/serve_session_revisits_source_edited_during_load_test.go +61 -0
- package/cmd/ttscgraph/serve_session_tolerates_os_invalid_resolution_candidate_test.go +56 -0
- package/cmd/ttscgraph/serve_session_tracks_all_module_specifier_forms_test.go +41 -0
- package/cmd/ttscgraph/serve_session_tracks_diamond_project_references_once_test.go +61 -0
- package/driver/emit_plugin.go +27 -12
- package/driver/plugins.go +21 -5
- package/driver/program.go +43 -14
- package/driver/session.go +11 -3
- package/lib/TtscCompiler.d.ts +3 -2
- package/lib/TtscCompiler.js +6 -14
- package/lib/TtscCompiler.js.map +1 -1
- package/lib/compiler/internal/compileProjectInMemory.js +14 -1
- package/lib/compiler/internal/compileProjectInMemory.js.map +1 -1
- package/lib/compiler/internal/runBuild.d.ts +7 -0
- package/lib/compiler/internal/runBuild.js +176 -16
- package/lib/compiler/internal/runBuild.js.map +1 -1
- package/lib/structures/ITtscCompilerResult.d.ts +8 -5
- package/package.json +8 -8
- package/shim/printer/shim.go +22 -4
- package/src/TtscCompiler.ts +4 -16
- package/src/compiler/internal/compileProjectInMemory.ts +17 -1
- package/src/compiler/internal/runBuild.ts +237 -23
- package/src/structures/ITtscCompilerResult.ts +8 -5
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
package main
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"os"
|
|
5
|
+
"path/filepath"
|
|
6
|
+
"testing"
|
|
7
|
+
|
|
8
|
+
"github.com/samchon/ttsc/packages/ttsc/driver"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
// TestServeSessionRevisitsSourceEditedDuringLoad verifies a source edited
|
|
12
|
+
// between compiler load and state capture is refreshed on the next snapshot.
|
|
13
|
+
//
|
|
14
|
+
// Hashing the raw disk bytes at capture time would bless content the resident
|
|
15
|
+
// program never parsed: disk and graph would disagree until an unrelated
|
|
16
|
+
// change. The capture must hash the resident text instead, so the next
|
|
17
|
+
// snapshot sees the disk mismatch and applies the missed edit.
|
|
18
|
+
//
|
|
19
|
+
// 1. Load a session, then rewrite the source before capturing state.
|
|
20
|
+
// 2. Take a snapshot and assert it refreshes to the on-disk declaration.
|
|
21
|
+
// 3. Take another snapshot and assert the session has converged (unchanged).
|
|
22
|
+
func TestServeSessionRevisitsSourceEditedDuringLoad(t *testing.T) {
|
|
23
|
+
root := graphSessionFixture(t)
|
|
24
|
+
compiler, diags, err := driver.NewSession(root, "tsconfig.json", driver.LoadProgramOptions{})
|
|
25
|
+
if err != nil {
|
|
26
|
+
t.Fatal(err)
|
|
27
|
+
}
|
|
28
|
+
if compiler == nil {
|
|
29
|
+
t.Fatalf("NewSession returned nil session (diagnostics: %v)", diags)
|
|
30
|
+
}
|
|
31
|
+
file := filepath.Join(root, "src", "index.ts")
|
|
32
|
+
if err := os.WriteFile(file, []byte("export class EditedDuringLoad {}\n"), 0o644); err != nil {
|
|
33
|
+
t.Fatal(err)
|
|
34
|
+
}
|
|
35
|
+
session := &graphSession{
|
|
36
|
+
cwd: root,
|
|
37
|
+
tsconfig: "tsconfig.json",
|
|
38
|
+
compiler: compiler,
|
|
39
|
+
initialized: true,
|
|
40
|
+
}
|
|
41
|
+
defer session.Close()
|
|
42
|
+
if err := session.captureState(); err != nil {
|
|
43
|
+
t.Fatal(err)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
dump, _, changed, err := session.Snapshot()
|
|
47
|
+
if err != nil {
|
|
48
|
+
t.Fatal(err)
|
|
49
|
+
}
|
|
50
|
+
if dump == nil || !changed || !hasDumpNode(*dump, "EditedDuringLoad") || hasDumpNode(*dump, "BeforeEdit") {
|
|
51
|
+
t.Fatalf("edited-during-load source was not refreshed: dump:%v changed:%v", dump != nil, changed)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
dump, mode, changed, err := session.Snapshot()
|
|
55
|
+
if err != nil {
|
|
56
|
+
t.Fatal(err)
|
|
57
|
+
}
|
|
58
|
+
if dump != nil || mode != "unchanged" || changed {
|
|
59
|
+
t.Fatalf("session did not converge after the missed edit: dump:%v mode:%q changed:%v", dump != nil, mode, changed)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
package main
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"path/filepath"
|
|
5
|
+
"testing"
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
// TestServeSessionToleratesOsInvalidResolutionCandidate verifies unresolved
|
|
9
|
+
// module specifiers that name OS-unparseable paths never break the session.
|
|
10
|
+
//
|
|
11
|
+
// Bundler-style specifiers (`./style.css?inline`) and URL imports (`data:`)
|
|
12
|
+
// stay unresolved in tsgo and become freshness candidates. On Windows those
|
|
13
|
+
// candidate paths fail os.ReadFile with ERROR_INVALID_NAME, which is neither
|
|
14
|
+
// ErrNotExist nor ErrInvalid; treating that as a snapshot error would make
|
|
15
|
+
// every graph request fail forever on such a project.
|
|
16
|
+
//
|
|
17
|
+
// 1. Open a session whose only root imports a query-suffixed CSS path and a
|
|
18
|
+
// data: URL.
|
|
19
|
+
// 2. Assert the session initializes and serves its initial dump.
|
|
20
|
+
// 3. Assert an untouched second snapshot reports unchanged.
|
|
21
|
+
func TestServeSessionToleratesOsInvalidResolutionCandidate(t *testing.T) {
|
|
22
|
+
root := t.TempDir()
|
|
23
|
+
writeGraphFile(t, filepath.Join(root, "tsconfig.json"), `{
|
|
24
|
+
"compilerOptions": { "target": "ES2022", "module": "commonjs" },
|
|
25
|
+
"files": ["src/index.ts"]
|
|
26
|
+
}`)
|
|
27
|
+
writeGraphFile(t, filepath.Join(root, "src", "index.ts"), `
|
|
28
|
+
// @ts-expect-error bundler-only specifier stays unresolved for tsgo
|
|
29
|
+
import styles from "./style.css?inline";
|
|
30
|
+
// @ts-expect-error data: URLs resolve at runtime, not through the compiler
|
|
31
|
+
import remote from "data:text/plain,hello";
|
|
32
|
+
export const value: unknown[] = [styles, remote];
|
|
33
|
+
`)
|
|
34
|
+
|
|
35
|
+
session, err := newGraphSession(root, "tsconfig.json")
|
|
36
|
+
if err != nil {
|
|
37
|
+
t.Fatal(err)
|
|
38
|
+
}
|
|
39
|
+
defer session.Close()
|
|
40
|
+
|
|
41
|
+
dump, mode, changed, err := session.Snapshot()
|
|
42
|
+
if err != nil {
|
|
43
|
+
t.Fatal(err)
|
|
44
|
+
}
|
|
45
|
+
if dump == nil || mode != "initial" || !changed {
|
|
46
|
+
t.Fatalf("initial snapshot = dump:%v mode:%q changed:%v", dump != nil, mode, changed)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
dump, mode, changed, err = session.Snapshot()
|
|
50
|
+
if err != nil {
|
|
51
|
+
t.Fatal(err)
|
|
52
|
+
}
|
|
53
|
+
if dump != nil || mode != "unchanged" || changed {
|
|
54
|
+
t.Fatalf("untouched snapshot = dump:%v mode:%q changed:%v", dump != nil, mode, changed)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
package main
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"path/filepath"
|
|
5
|
+
"testing"
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
// TestServeSessionTracksAllModuleSpecifierForms verifies that every TypeScript
|
|
9
|
+
// syntax which can trigger module resolution contributes missing-file
|
|
10
|
+
// candidates to the freshness snapshot.
|
|
11
|
+
func TestServeSessionTracksAllModuleSpecifierForms(t *testing.T) {
|
|
12
|
+
root := t.TempDir()
|
|
13
|
+
writeGraphFile(t, filepath.Join(root, "tsconfig.json"), `{
|
|
14
|
+
"compilerOptions": { "target": "ES2022", "module": "commonjs", "strict": true },
|
|
15
|
+
"files": ["src/index.ts"]
|
|
16
|
+
}`)
|
|
17
|
+
writeGraphFile(t, filepath.Join(root, "src", "index.ts"), `
|
|
18
|
+
import legacy = require("./legacy");
|
|
19
|
+
export { exported } from "./exported";
|
|
20
|
+
export type Deferred = import("./types").Deferred;
|
|
21
|
+
export const lazy = import("./lazy");
|
|
22
|
+
export const common = require("./common");
|
|
23
|
+
export const result = legacy();
|
|
24
|
+
`)
|
|
25
|
+
|
|
26
|
+
session, err := newGraphSession(root, "tsconfig.json")
|
|
27
|
+
if err != nil {
|
|
28
|
+
t.Fatal(err)
|
|
29
|
+
}
|
|
30
|
+
defer session.Close()
|
|
31
|
+
|
|
32
|
+
for _, name := range []string{"legacy.ts", "exported.ts", "types.ts", "lazy.ts", "common.ts"} {
|
|
33
|
+
candidate := filepath.Join(root, "src", name)
|
|
34
|
+
state, ok := session.auxStates[candidate]
|
|
35
|
+
if !ok {
|
|
36
|
+
t.Errorf("module candidate %s was not tracked", name)
|
|
37
|
+
} else if state.Exists {
|
|
38
|
+
t.Errorf("missing module candidate %s unexpectedly exists", name)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
package main
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"path/filepath"
|
|
5
|
+
"testing"
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
// TestServeSessionTracksDiamondProjectReferencesOnce verifies the config
|
|
9
|
+
// traversal terminates and deduplicates when two references share a child.
|
|
10
|
+
//
|
|
11
|
+
// A diamond (root -> left, root -> right, both -> shared) visits the shared
|
|
12
|
+
// config twice; without the seen-set the traversal would duplicate tracked
|
|
13
|
+
// state, and on a reference cycle it would never terminate. The shared leaf
|
|
14
|
+
// must appear in the freshness state exactly once and the session must stay
|
|
15
|
+
// stable across untouched snapshots.
|
|
16
|
+
//
|
|
17
|
+
// 1. Open a session over a diamond of project references.
|
|
18
|
+
// 2. Assert the shared leaf config is hash-tracked.
|
|
19
|
+
// 3. Assert an untouched snapshot reports unchanged.
|
|
20
|
+
func TestServeSessionTracksDiamondProjectReferencesOnce(t *testing.T) {
|
|
21
|
+
root := t.TempDir()
|
|
22
|
+
writeGraphFile(t, filepath.Join(root, "tsconfig.json"), `{
|
|
23
|
+
"files": ["src/index.ts"],
|
|
24
|
+
"references": [{ "path": "./left" }, { "path": "./right" }]
|
|
25
|
+
}`)
|
|
26
|
+
writeGraphFile(t, filepath.Join(root, "src", "index.ts"), "export const root = 1;\n")
|
|
27
|
+
for _, side := range []string{"left", "right"} {
|
|
28
|
+
writeGraphFile(t, filepath.Join(root, side, "tsconfig.json"), `{
|
|
29
|
+
"compilerOptions": { "composite": true },
|
|
30
|
+
"files": ["src/index.ts"],
|
|
31
|
+
"references": [{ "path": "../shared" }]
|
|
32
|
+
}`)
|
|
33
|
+
writeGraphFile(t, filepath.Join(root, side, "src", "index.ts"), "export const side = 1;\n")
|
|
34
|
+
}
|
|
35
|
+
writeGraphFile(t, filepath.Join(root, "shared", "tsconfig.json"), `{
|
|
36
|
+
"compilerOptions": { "composite": true },
|
|
37
|
+
"files": ["src/index.ts"]
|
|
38
|
+
}`)
|
|
39
|
+
writeGraphFile(t, filepath.Join(root, "shared", "src", "index.ts"), "export const shared = 1;\n")
|
|
40
|
+
|
|
41
|
+
session, err := newGraphSession(root, "tsconfig.json")
|
|
42
|
+
if err != nil {
|
|
43
|
+
t.Fatal(err)
|
|
44
|
+
}
|
|
45
|
+
defer session.Close()
|
|
46
|
+
sharedConfig := filepath.ToSlash(filepath.Join(root, "shared", "tsconfig.json"))
|
|
47
|
+
if _, ok := session.configHashes[sharedConfig]; !ok {
|
|
48
|
+
t.Fatalf("shared diamond config was not tracked: %s; got %#v", sharedConfig, session.configHashes)
|
|
49
|
+
}
|
|
50
|
+
if _, _, _, err := session.Snapshot(); err != nil {
|
|
51
|
+
t.Fatal(err)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
dump, mode, changed, err := session.Snapshot()
|
|
55
|
+
if err != nil {
|
|
56
|
+
t.Fatal(err)
|
|
57
|
+
}
|
|
58
|
+
if dump != nil || mode != "unchanged" || changed {
|
|
59
|
+
t.Fatalf("diamond references churned: dump:%v mode:%q changed:%v", dump != nil, mode, changed)
|
|
60
|
+
}
|
|
61
|
+
}
|
package/driver/emit_plugin.go
CHANGED
|
@@ -80,19 +80,12 @@ func (p *Program) EmitWithPluginTransformer(transform PluginTransform, writeFile
|
|
|
80
80
|
return p.EmitWithPluginTransformers([]PluginTransform{transform}, writeFile)
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
// EmitLinkedTransforms emits using the
|
|
84
|
-
//
|
|
85
|
-
//
|
|
86
|
-
//
|
|
83
|
+
// EmitLinkedTransforms emits using only the linked plugins' hooks, with no
|
|
84
|
+
// host-owned transformer. It is the no-transform convenience form of
|
|
85
|
+
// EmitWithPluginTransformers, which honors linked plugins on every emit it
|
|
86
|
+
// runs.
|
|
87
87
|
func (p *Program) EmitLinkedTransforms(writeFile shimcompiler.WriteFile) ([]Diagnostic, error) {
|
|
88
|
-
|
|
89
|
-
return nil, errors.New("driver: nil program")
|
|
90
|
-
}
|
|
91
|
-
transforms, err := p.plugins.emitTransforms()
|
|
92
|
-
if err != nil {
|
|
93
|
-
return nil, err
|
|
94
|
-
}
|
|
95
|
-
return p.EmitWithPluginTransformers(transforms, writeFile)
|
|
88
|
+
return p.EmitWithPluginTransformers(nil, writeFile)
|
|
96
89
|
}
|
|
97
90
|
|
|
98
91
|
// restoreOriginalDeclarationSymbols copies the binder symbol from each original
|
|
@@ -135,6 +128,11 @@ func restoreOriginalDeclarationSymbols(ec *shimprinter.EmitContext, node *shimas
|
|
|
135
128
|
// import aliasing: tsgo's module-transform aliases the plugins' injected
|
|
136
129
|
// imports itself.
|
|
137
130
|
//
|
|
131
|
+
// Linked plugins are honored on every call: registered ProgramPlugins apply
|
|
132
|
+
// to the program before emit (once per Program), and registered
|
|
133
|
+
// EmitTransformPlugins are chained after the caller's transforms in
|
|
134
|
+
// registration order.
|
|
135
|
+
//
|
|
138
136
|
// Because the JavaScript side bypasses tsgo's own emitter, it reproduces the
|
|
139
137
|
// emitter's source-map step via PrintFileWithSourceMap: a `sourceMap` /
|
|
140
138
|
// `inlineSourceMap` build emits a `.js.map` (and `//# sourceMappingURL=`
|
|
@@ -146,6 +144,23 @@ func (p *Program) EmitWithPluginTransformers(transforms []PluginTransform, write
|
|
|
146
144
|
if p == nil || p.TSProgram == nil {
|
|
147
145
|
return nil, errors.New("driver: nil program")
|
|
148
146
|
}
|
|
147
|
+
// Linked plugins ride inside whichever host binary owns the emit pass, and
|
|
148
|
+
// the host does not know which linked packages ttsc compiled into it. Honor
|
|
149
|
+
// them at the funnel every host emits through: linked ProgramPlugins mutate
|
|
150
|
+
// the program before the per-file loop below, and linked EmitTransformPlugins
|
|
151
|
+
// join the per-file chain after the host's own transforms. A host that only
|
|
152
|
+
// passes its own transform would otherwise link, register, and silently never
|
|
153
|
+
// run the linked hooks.
|
|
154
|
+
if err := p.ApplyLinkedPlugins(); err != nil {
|
|
155
|
+
return nil, err
|
|
156
|
+
}
|
|
157
|
+
linked, err := p.plugins.emitTransforms()
|
|
158
|
+
if err != nil {
|
|
159
|
+
return nil, err
|
|
160
|
+
}
|
|
161
|
+
if len(linked) != 0 {
|
|
162
|
+
transforms = append(append([]PluginTransform{}, transforms...), linked...)
|
|
163
|
+
}
|
|
149
164
|
host := &pluginEmitHost{program: p.TSProgram, emitResolver: p.Checker.GetEmitResolver()}
|
|
150
165
|
options := p.TSProgram.Options()
|
|
151
166
|
for _, sf := range shimcompiler.GetSourceFilesToEmit(host, nil, false) {
|
package/driver/plugins.go
CHANGED
|
@@ -42,11 +42,14 @@ type ProgramPlugin interface {
|
|
|
42
42
|
// EmitTransformPlugin contributes an emit-phase AST transformer. The returned
|
|
43
43
|
// PluginTransform runs first in tsgo's per-file emit chain, sharing the emit
|
|
44
44
|
// EmitContext with the builtin transformers, so a plugin returns AST instead of
|
|
45
|
-
// spliced text
|
|
46
|
-
//
|
|
47
|
-
//
|
|
48
|
-
//
|
|
49
|
-
// transform
|
|
45
|
+
// spliced text. For an injected import, allocate its binding once with
|
|
46
|
+
// ec.Factory.NewUniqueNameEx and the Optimistic | FileLevel flags, then reuse
|
|
47
|
+
// that identifier for every reference. NewGeneratedNameForNode on a string
|
|
48
|
+
// literal uses tsgo's temp-name channel and can be shadowed by downlevel temps.
|
|
49
|
+
// Tsgo's module-transform emits the require and aliases the references itself.
|
|
50
|
+
// This is the AST-integration replacement for the ProgramPlugin + RewriteSet
|
|
51
|
+
// text-splice model. A plugin whose returned transform is nil contributes
|
|
52
|
+
// nothing.
|
|
50
53
|
type EmitTransformPlugin interface {
|
|
51
54
|
EmitTransform(PluginContext) (PluginTransform, error)
|
|
52
55
|
}
|
|
@@ -130,6 +133,19 @@ func (state linkedPluginState) apply(prog *Program) error {
|
|
|
130
133
|
return nil
|
|
131
134
|
}
|
|
132
135
|
|
|
136
|
+
func (state linkedPluginState) hasProgramPlugins() bool {
|
|
137
|
+
for index := range state.entries {
|
|
138
|
+
plugin, ok := registeredPlugin(index)
|
|
139
|
+
if !ok {
|
|
140
|
+
continue
|
|
141
|
+
}
|
|
142
|
+
if _, ok := plugin.(ProgramPlugin); ok {
|
|
143
|
+
return true
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return false
|
|
147
|
+
}
|
|
148
|
+
|
|
133
149
|
// emitTransforms collects an emit-phase PluginTransform from every registered
|
|
134
150
|
// EmitTransformPlugin, in registration order. Entries that do not implement
|
|
135
151
|
// EmitTransformPlugin, or whose transform is nil, are skipped.
|
package/driver/program.go
CHANGED
|
@@ -94,11 +94,15 @@ func NewLintDiagnostic(
|
|
|
94
94
|
return d
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
// SourceFile returns the program source file matching filename.
|
|
97
|
+
// SourceFile returns the program source file matching filename. Like
|
|
98
|
+
// SourceFiles, it applies linked ProgramPlugins first so a single-file
|
|
99
|
+
// consumer (e.g. a host's --file transform lane) sees the same mutated tree
|
|
100
|
+
// as a whole-project walk.
|
|
98
101
|
func (p *Program) SourceFile(filename string) *ast.SourceFile {
|
|
99
102
|
if p == nil || p.TSProgram == nil {
|
|
100
103
|
return nil
|
|
101
104
|
}
|
|
105
|
+
_ = p.ApplyLinkedPlugins()
|
|
102
106
|
normalized := filepath.ToSlash(filename)
|
|
103
107
|
for _, file := range p.TSProgram.SourceFiles() {
|
|
104
108
|
if filepath.ToSlash(file.FileName()) == normalized {
|
|
@@ -185,15 +189,16 @@ func CountErrors(diagnostics []Diagnostic) int {
|
|
|
185
189
|
|
|
186
190
|
// Program is the shim-agnostic facade the rest of the engine sees.
|
|
187
191
|
type Program struct {
|
|
188
|
-
TSProgram
|
|
189
|
-
ParsedConfig
|
|
190
|
-
Checker
|
|
191
|
-
checkerRelease
|
|
192
|
-
Host
|
|
193
|
-
FS
|
|
194
|
-
SourcePreamble
|
|
195
|
-
plugins
|
|
196
|
-
pluginsApplied
|
|
192
|
+
TSProgram *shimcompiler.Program
|
|
193
|
+
ParsedConfig *tsoptions.ParsedCommandLine
|
|
194
|
+
Checker *shimchecker.Checker
|
|
195
|
+
checkerRelease func()
|
|
196
|
+
Host shimcompiler.CompilerHost
|
|
197
|
+
FS vfs.FS
|
|
198
|
+
SourcePreamble string
|
|
199
|
+
plugins linkedPluginState
|
|
200
|
+
pluginsApplied bool
|
|
201
|
+
pluginsApplyErr error
|
|
197
202
|
}
|
|
198
203
|
|
|
199
204
|
// LoadProgramOptions controls tsconfig overrides applied before tsgo creates
|
|
@@ -451,10 +456,10 @@ type sourcePreambleFS struct {
|
|
|
451
456
|
|
|
452
457
|
func (fs sourcePreambleFS) ReadFile(filePath string) (string, bool) {
|
|
453
458
|
contents, ok := fs.FS.ReadFile(filePath)
|
|
454
|
-
if !ok
|
|
459
|
+
if !ok {
|
|
455
460
|
return contents, ok
|
|
456
461
|
}
|
|
457
|
-
return
|
|
462
|
+
return ApplySourcePreambleToFile(filePath, contents, fs.preamble), true
|
|
458
463
|
}
|
|
459
464
|
|
|
460
465
|
// isSourcePreambleTarget reports whether the preamble should be injected into
|
|
@@ -475,6 +480,15 @@ func isSourcePreambleTarget(filePath string) bool {
|
|
|
475
480
|
return false
|
|
476
481
|
}
|
|
477
482
|
|
|
483
|
+
// ApplySourcePreambleToFile applies a generated preamble only when filePath is
|
|
484
|
+
// a non-declaration TypeScript or JavaScript source, matching sourcePreambleFS.
|
|
485
|
+
func ApplySourcePreambleToFile(filePath string, text string, preamble string) string {
|
|
486
|
+
if !isSourcePreambleTarget(filePath) {
|
|
487
|
+
return text
|
|
488
|
+
}
|
|
489
|
+
return ApplySourcePreamble(text, preamble)
|
|
490
|
+
}
|
|
491
|
+
|
|
478
492
|
// ApplySourcePreamble inserts a generated source preamble without moving the
|
|
479
493
|
// file's BOM or hashbang away from the first bytes of the physical output.
|
|
480
494
|
func ApplySourcePreamble(text string, preamble string) string {
|
|
@@ -521,12 +535,27 @@ func (p *Program) sourceFilesRaw() []*ast.SourceFile {
|
|
|
521
535
|
}
|
|
522
536
|
|
|
523
537
|
// ApplyLinkedPlugins runs registered linked ProgramPlugin hooks exactly once.
|
|
538
|
+
// A hook failure is latched and returned on every subsequent call: SourceFiles
|
|
539
|
+
// swallows the error by contract, so without the latch a lookup that happened
|
|
540
|
+
// to run first would consume the only report and let a later emit proceed over
|
|
541
|
+
// the half-applied program as if nothing failed.
|
|
524
542
|
func (p *Program) ApplyLinkedPlugins() error {
|
|
525
|
-
if p == nil
|
|
543
|
+
if p == nil {
|
|
526
544
|
return nil
|
|
527
545
|
}
|
|
546
|
+
if p.pluginsApplied {
|
|
547
|
+
return p.pluginsApplyErr
|
|
548
|
+
}
|
|
528
549
|
p.pluginsApplied = true
|
|
529
|
-
|
|
550
|
+
p.pluginsApplyErr = p.plugins.apply(p)
|
|
551
|
+
return p.pluginsApplyErr
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
// HasLinkedProgramPlugins reports whether the loaded project has an active
|
|
555
|
+
// ProgramPlugin. Those hooks mutate parsed ASTs in place and therefore require
|
|
556
|
+
// a fresh Program rather than Session's incremental source replacement.
|
|
557
|
+
func (p *Program) HasLinkedProgramPlugins() bool {
|
|
558
|
+
return p != nil && p.plugins.hasProgramPlugins()
|
|
530
559
|
}
|
|
531
560
|
|
|
532
561
|
// Diagnostics returns project diagnostics that must block compilation or
|
package/driver/session.go
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
package driver
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
|
+
"context"
|
|
5
|
+
|
|
4
6
|
shimtspath "github.com/microsoft/typescript-go/shim/tspath"
|
|
5
7
|
)
|
|
6
8
|
|
|
7
9
|
// Session is a resident compiler host for incremental type-checking: it keeps a
|
|
8
10
|
// loaded program alive and re-parses only the changed file on each edit (reusing
|
|
9
|
-
// the unchanged ASTs and the
|
|
10
|
-
// recompiling the whole project per request.
|
|
11
|
+
// the unchanged ASTs and refreshing the checker for the updated Program),
|
|
12
|
+
// instead of recompiling the whole project per request.
|
|
11
13
|
//
|
|
12
14
|
// It is the driver-level incremental type-check primitive. The resident
|
|
13
15
|
// transform path (utility-host `serve`) deliberately does not use it: the
|
|
@@ -50,10 +52,16 @@ func (s *Session) Apply(absPath, content string) bool {
|
|
|
50
52
|
name = file.FileName()
|
|
51
53
|
}
|
|
52
54
|
changed := shimtspath.ToPath(name, s.cwd, s.overlay.caseSensitive)
|
|
53
|
-
newHost := DefaultHost(s.cwd, s.
|
|
55
|
+
newHost := DefaultHost(s.cwd, s.prog.FS)
|
|
54
56
|
newProg, reused := s.prog.TSProgram.UpdateProgram(changed, newHost, nil)
|
|
55
57
|
if newProg != nil {
|
|
58
|
+
if s.prog.checkerRelease != nil {
|
|
59
|
+
s.prog.checkerRelease()
|
|
60
|
+
}
|
|
61
|
+
checker, release := newProg.GetTypeChecker(context.Background())
|
|
56
62
|
s.prog.TSProgram = newProg
|
|
63
|
+
s.prog.Checker = checker
|
|
64
|
+
s.prog.checkerRelease = release
|
|
57
65
|
s.prog.Host = newHost
|
|
58
66
|
}
|
|
59
67
|
return reused
|
package/lib/TtscCompiler.d.ts
CHANGED
|
@@ -70,8 +70,9 @@ export declare class TtscCompiler {
|
|
|
70
70
|
* directory before returning.
|
|
71
71
|
*
|
|
72
72
|
* The result uses an `embed-typescript`-style discriminated union: `success`
|
|
73
|
-
* for clean compiles, `failure` for
|
|
74
|
-
* `exception` for host
|
|
73
|
+
* for clean compiles, `failure` for compiler diagnostics or plugin failures
|
|
74
|
+
* that reached the build pipeline, and `exception` for host failures that
|
|
75
|
+
* prevent any project check from running.
|
|
75
76
|
*
|
|
76
77
|
* @returns Structured compilation result containing diagnostics or output.
|
|
77
78
|
*/
|
package/lib/TtscCompiler.js
CHANGED
|
@@ -9,6 +9,7 @@ const node_path_1 = __importDefault(require("node:path"));
|
|
|
9
9
|
const compileProjectInMemory_1 = require("./compiler/internal/compileProjectInMemory");
|
|
10
10
|
const resolveProjectConfig_1 = require("./compiler/internal/project/resolveProjectConfig");
|
|
11
11
|
const resolveBinary_1 = require("./compiler/internal/resolveBinary");
|
|
12
|
+
const runBuild_1 = require("./compiler/internal/runBuild");
|
|
12
13
|
const transformProjectInMemory_1 = require("./compiler/internal/transformProjectInMemory");
|
|
13
14
|
const buildSourcePlugin_1 = require("./plugin/internal/buildSourcePlugin");
|
|
14
15
|
const loadProjectPlugins_1 = require("./plugin/internal/loadProjectPlugins");
|
|
@@ -121,8 +122,9 @@ class TtscCompiler {
|
|
|
121
122
|
* directory before returning.
|
|
122
123
|
*
|
|
123
124
|
* The result uses an `embed-typescript`-style discriminated union: `success`
|
|
124
|
-
* for clean compiles, `failure` for
|
|
125
|
-
* `exception` for host
|
|
125
|
+
* for clean compiles, `failure` for compiler diagnostics or plugin failures
|
|
126
|
+
* that reached the build pipeline, and `exception` for host failures that
|
|
127
|
+
* prevent any project check from running.
|
|
126
128
|
*
|
|
127
129
|
* @returns Structured compilation result containing diagnostics or output.
|
|
128
130
|
*/
|
|
@@ -293,22 +295,12 @@ function toCompilerResult(project) {
|
|
|
293
295
|
}
|
|
294
296
|
return {
|
|
295
297
|
diagnostics: result.diagnostics.length === 0
|
|
296
|
-
? [createProcessDiagnostic(result)]
|
|
298
|
+
? [(0, runBuild_1.createProcessDiagnostic)(result)]
|
|
297
299
|
: result.diagnostics,
|
|
298
300
|
output,
|
|
299
301
|
type: "failure",
|
|
300
302
|
};
|
|
301
303
|
}
|
|
302
|
-
function createProcessDiagnostic(result) {
|
|
303
|
-
const messageText = (result.stderr || result.stdout).trim() ||
|
|
304
|
-
`ttsc exited with status ${result.status}`;
|
|
305
|
-
return {
|
|
306
|
-
category: "error",
|
|
307
|
-
code: "TTSC_PROCESS",
|
|
308
|
-
file: null,
|
|
309
|
-
messageText,
|
|
310
|
-
};
|
|
311
|
-
}
|
|
312
304
|
function toCompilerTransformation(project) {
|
|
313
305
|
const { dependencies, result, typescript } = project;
|
|
314
306
|
const dependencyField = dependencies === undefined ? {} : { dependencies };
|
|
@@ -325,7 +317,7 @@ function toCompilerTransformation(project) {
|
|
|
325
317
|
return {
|
|
326
318
|
...dependencyField,
|
|
327
319
|
diagnostics: result.diagnostics.length === 0
|
|
328
|
-
? [createProcessDiagnostic(result)]
|
|
320
|
+
? [(0, runBuild_1.createProcessDiagnostic)(result)]
|
|
329
321
|
: result.diagnostics,
|
|
330
322
|
type: "failure",
|
|
331
323
|
typescript,
|
package/lib/TtscCompiler.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TtscCompiler.js","sourceRoot":"","sources":["../src/TtscCompiler.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAE7B,uFAAoF;AACpF,2FAAwF;AACxF,qEAAkE;AAClE,2FAAwF;AACxF,2EAA0E;AAC1E,6EAA0E;AAO1E;;;;;;;;;;;;;;;;;;;GAmBG;AACH;IACmB,OAAO,CAAuB;IAE/C;;;;;;OAMG;IACH,YA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AE/C,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC;AAC3E,CAAC;AAED,SAAS,cAAc,CAAC,KAAc;IACpC,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO;QACL,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,KAAK,EAAE,KAAK,CAAC,KAAK;KACnB,CAAC;AACJ,CAAC"}
|
|
@@ -33,7 +33,7 @@ function compileProjectInMemory(options) {
|
|
|
33
33
|
projectRoot: options.projectRoot,
|
|
34
34
|
tsconfig: options.tsconfig,
|
|
35
35
|
});
|
|
36
|
-
if (
|
|
36
|
+
if (shouldUsePluginBuild(options, project)) {
|
|
37
37
|
return compileProjectWithPlugins(options, cwd, project);
|
|
38
38
|
}
|
|
39
39
|
const tsconfig = project.path;
|
|
@@ -67,6 +67,19 @@ function compileProjectInMemory(options) {
|
|
|
67
67
|
function hasConfiguredPlugins(options, project) {
|
|
68
68
|
return (0, loadProjectPlugins_1.hasProjectPluginEntries)(project, options.plugins);
|
|
69
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Route plugin discovery failures through runBuild's recoverable setup path.
|
|
72
|
+
* The fast native-host lane cannot surface the plugin error or run the
|
|
73
|
+
* post-failure TypeScript check, while the plugin-backed lane can do both.
|
|
74
|
+
*/
|
|
75
|
+
function shouldUsePluginBuild(options, project) {
|
|
76
|
+
try {
|
|
77
|
+
return hasConfiguredPlugins(options, project);
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
70
83
|
/**
|
|
71
84
|
* Plugin-backed compilation: emit into a temp directory via `runBuild`, then
|
|
72
85
|
* read back every file the build wrote so they can be returned as strings.
|
|
@@ -1 +1 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IAAI,EAAE;SAC5B,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CACb,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC,IAAI,EAAE;YACvB,+CAA+C,CAClD,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"compileProjectInMemory.js","sourceRoot":"","sources":["../../../src/compiler/internal/compileProjectInMemory.ts"],"names":[],"mappings":";;;;;;AAAA,2DAA+C;AAC/C,sDAAyB;AACzB,sDAAyB;AACzB,0DAA6B;AAE7B,iFAAmF;AAKnF,+DAA4D;AAC5D,mCAAgE;AAChE,mEAAgE;AAChE,yCAAsC;AAEtC;;;;;;;;;;;;GAYG;AACH,gCAAuC,OAA6B;IAIlE,MAAM,GAAG,GAAG,mBAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACvD,MAAM,OAAO,GAAG,IAAA,qCAAiB,EAAC;QAChC,GAAG;QACH,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,QAAQ,EAAE,OAAO,CAAC,QAAQ;KAC3B,CAAC,CAAC;IACH,IAAI,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;QAC3C,OAAO,yBAAyB,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IAC1D,CAAC;IACD,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAC9B,MAAM,MAAM,GAAG,IAAA,yCAAmB,EAAC;QACjC,YAAY,EAAE,OAAO,CAAC,IAAI;QAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,EAAE,cAAc;QACzD,WAAW,EAAE,IAAA,sBAAc,GAAE;KAC9B,CAAC,CAAC;IACH,MAAM,GAAG,GAAG,IAAA,8BAAS,EACnB,MAAM,EACN,CAAC,aAAa,EAAE,OAAO,EAAE,OAAO,CAAC,I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AI,EAAE,CAAC;AACpB,CAAC;AAED,gFAAgF;AAChF,SAAS,SAAS,CAAC,IAAY;IAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;GAMG;AACH,SAAS,wBAAwB,CAC/B,MAAc,EACd,MAAc;IAKd,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAG/B,CAAC;QACF,OAAO;YACL,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,EAAE;YACrC,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE;SAC5B,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CACb,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC,IAAI,EAAE;YACvB,+CAA+C,CAClD,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -19,6 +19,13 @@ export declare function runBuild(options?: RunBuildOptions): TtscBuildResult;
|
|
|
19
19
|
* - `stdout`/`stderr`: concatenated left then right.
|
|
20
20
|
*/
|
|
21
21
|
export declare function appendBuildOutput(left: TtscBuildResult, right: TtscBuildResult): TtscBuildResult;
|
|
22
|
+
/**
|
|
23
|
+
* Synthesize one structured diagnostic from a non-zero process result that
|
|
24
|
+
* produced no parsable diagnostics, carrying the captured stderr/stdout as the
|
|
25
|
+
* message. Shared by the public API result mapping and the plugin-failure
|
|
26
|
+
* recovery pass so the failure text is never dropped from structured output.
|
|
27
|
+
*/
|
|
28
|
+
export declare function createProcessDiagnostic(result: TtscBuildResult): ITtscCompilerDiagnostic;
|
|
22
29
|
/**
|
|
23
30
|
* `TtscBuildResult` with `diagnostics` made optional. Used internally when
|
|
24
31
|
* diagnostics are parsed lazily from stdout/stderr by `normalizeBuildOutput`.
|