@ttsc/wasm 0.19.0 → 0.19.2
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/dist/ttsc.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// gen_shims:hand-maintained
|
|
2
|
+
//
|
|
3
|
+
// Reference-graph parts of tsgo's own incremental engine (`tsc --incremental`
|
|
4
|
+
// semantics), linked from internal/execute/incremental so ttsc's transform
|
|
5
|
+
// envelopes can carry the same language-semantic input bound the compiler
|
|
6
|
+
// itself uses for invalidation: per-file direct resolved references and the
|
|
7
|
+
// files that contribute to the global scope.
|
|
8
|
+
package compiler
|
|
9
|
+
|
|
10
|
+
import (
|
|
11
|
+
_ "unsafe"
|
|
12
|
+
|
|
13
|
+
innerast "github.com/microsoft/typescript-go/internal/ast"
|
|
14
|
+
"github.com/microsoft/typescript-go/internal/collections"
|
|
15
|
+
innercompiler "github.com/microsoft/typescript-go/internal/compiler"
|
|
16
|
+
"github.com/microsoft/typescript-go/internal/tspath"
|
|
17
|
+
|
|
18
|
+
// The linknamed symbols below live in the incremental package; the blank
|
|
19
|
+
// import compiles it into every shim consumer so the references resolve.
|
|
20
|
+
_ "github.com/microsoft/typescript-go/internal/execute/incremental"
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
//go:linkname incrementalGetReferencedFiles github.com/microsoft/typescript-go/internal/execute/incremental.getReferencedFiles
|
|
24
|
+
func incrementalGetReferencedFiles(program *innercompiler.Program, file *innerast.SourceFile) *collections.Set[tspath.Path]
|
|
25
|
+
|
|
26
|
+
//go:linkname incrementalFileAffectsGlobalScope github.com/microsoft/typescript-go/internal/execute/incremental.fileAffectsGlobalScope
|
|
27
|
+
func incrementalFileAffectsGlobalScope(file *innerast.SourceFile) bool
|
|
28
|
+
|
|
29
|
+
// GetReferencedFilePaths returns the canonical paths of every file that `file`
|
|
30
|
+
// directly references in `program`: resolved imports and re-exports (type-only
|
|
31
|
+
// included), `/// <reference>` targets, resolved type reference directives,
|
|
32
|
+
// module augmentations, and ambient-module declaration files. This is exactly
|
|
33
|
+
// the per-file `referencedMap` entry tsgo's incremental engine stores in
|
|
34
|
+
// `tsbuildinfo`, so the result is the sound language-semantic upper bound on
|
|
35
|
+
// which program files a symbol in `file` can resolve through.
|
|
36
|
+
//
|
|
37
|
+
// The returned strings are tspath.Path values (case-canonicalized on
|
|
38
|
+
// case-insensitive filesystems); map them back to real file names through
|
|
39
|
+
// Program.GetSourceFileByPath when the original spelling matters.
|
|
40
|
+
func GetReferencedFilePaths(program *Program, file *innerast.SourceFile) []string {
|
|
41
|
+
set := incrementalGetReferencedFiles(program, file)
|
|
42
|
+
if set == nil {
|
|
43
|
+
return nil
|
|
44
|
+
}
|
|
45
|
+
out := make([]string, 0, set.Len())
|
|
46
|
+
for path := range set.Keys() {
|
|
47
|
+
out = append(out, string(path))
|
|
48
|
+
}
|
|
49
|
+
return out
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// FileAffectsGlobalScope reports whether editing `file` can change the global
|
|
53
|
+
// scope: global-scope module augmentations, ambient declaration files, and
|
|
54
|
+
// script (non-module) files. Mirrors the predicate tsgo's incremental engine
|
|
55
|
+
// uses to decide that a change must invalidate every file in the program.
|
|
56
|
+
func FileAffectsGlobalScope(file *innerast.SourceFile) bool {
|
|
57
|
+
return incrementalFileAffectsGlobalScope(file)
|
|
58
|
+
}
|
|
@@ -50,6 +50,11 @@ const (
|
|
|
50
50
|
JsxEmitReactJSXDev = innercore.JsxEmitReactJSXDev
|
|
51
51
|
)
|
|
52
52
|
|
|
53
|
+
// Version reports the TypeScript compiler version typescript-go implements, in
|
|
54
|
+
// the same form `tsc --version` prints. A graph snapshot publishes it so a
|
|
55
|
+
// consumer can tell which checker resolved the facts it is reading.
|
|
56
|
+
func Version() string { return innercore.Version() }
|
|
57
|
+
|
|
53
58
|
// NewTextRange constructs a closed/open [pos, end) text range.
|
|
54
59
|
func NewTextRange(pos, end int) TextRange { return innercore.NewTextRange(pos, end) }
|
|
55
60
|
|