@ttsc/wasm 0.11.0-dev.20260517

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.
Files changed (80) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +125 -0
  3. package/build/build-wasm.cjs +240 -0
  4. package/build/pack-prepare.cjs +68 -0
  5. package/cmd/ttsc-wasm/main.go +130 -0
  6. package/cmd/ttsc-wasm/main_wasm.go +17 -0
  7. package/dist/go.mod +54 -0
  8. package/dist/ttsc.wasm +0 -0
  9. package/dist/wasm_exec.js +575 -0
  10. package/go.mod +54 -0
  11. package/go.sum +26 -0
  12. package/host/api.go +205 -0
  13. package/host/doc.go +31 -0
  14. package/host/host.go +317 -0
  15. package/host/host_native.go +12 -0
  16. package/host/plugin.go +59 -0
  17. package/lib/src/MemFS.d.ts +68 -0
  18. package/lib/src/MemFS.js +384 -0
  19. package/lib/src/MemFS.js.map +1 -0
  20. package/lib/src/api.d.ts +87 -0
  21. package/lib/src/api.js +20 -0
  22. package/lib/src/api.js.map +1 -0
  23. package/lib/src/index.d.ts +6 -0
  24. package/lib/src/index.js +10 -0
  25. package/lib/src/index.js.map +1 -0
  26. package/lib/src/instantiate.d.ts +27 -0
  27. package/lib/src/instantiate.js +71 -0
  28. package/lib/src/instantiate.js.map +1 -0
  29. package/package.json +49 -0
  30. package/src/MemFS.ts +566 -0
  31. package/src/api.ts +112 -0
  32. package/src/index.ts +28 -0
  33. package/src/instantiate.ts +114 -0
  34. package/vendor/shim/ast/extra-shim.json +4 -0
  35. package/vendor/shim/ast/go.mod +5 -0
  36. package/vendor/shim/ast/lint.go +328 -0
  37. package/vendor/shim/ast/shim.go +220 -0
  38. package/vendor/shim/ast/surface.go +685 -0
  39. package/vendor/shim/bundled/extra-shim.json +1 -0
  40. package/vendor/shim/bundled/go.mod +5 -0
  41. package/vendor/shim/bundled/shim.go +23 -0
  42. package/vendor/shim/checker/extra-shim.json +31 -0
  43. package/vendor/shim/checker/go.mod +5 -0
  44. package/vendor/shim/checker/shim.go +174 -0
  45. package/vendor/shim/compiler/extra-shim.json +4 -0
  46. package/vendor/shim/compiler/go.mod +5 -0
  47. package/vendor/shim/compiler/shim.go +65 -0
  48. package/vendor/shim/core/extra-shim.json +4 -0
  49. package/vendor/shim/core/go.mod +5 -0
  50. package/vendor/shim/core/shim.go +29 -0
  51. package/vendor/shim/diagnosticwriter/go.mod +5 -0
  52. package/vendor/shim/diagnosticwriter/lint.go +145 -0
  53. package/vendor/shim/diagnosticwriter/shim.go +29 -0
  54. package/vendor/shim/lsp/extra-shim.json +4 -0
  55. package/vendor/shim/lsp/go.mod +16 -0
  56. package/vendor/shim/lsp/go.sum +26 -0
  57. package/vendor/shim/lsp/shim.go +42 -0
  58. package/vendor/shim/parser/extra-shim.json +4 -0
  59. package/vendor/shim/parser/go.mod +5 -0
  60. package/vendor/shim/parser/shim.go +61 -0
  61. package/vendor/shim/printer/go.mod +5 -0
  62. package/vendor/shim/printer/shim.go +23 -0
  63. package/vendor/shim/scanner/extra-shim.json +4 -0
  64. package/vendor/shim/scanner/go.mod +5 -0
  65. package/vendor/shim/scanner/shim.go +134 -0
  66. package/vendor/shim/tsoptions/extra-shim.json +4 -0
  67. package/vendor/shim/tsoptions/go.mod +5 -0
  68. package/vendor/shim/tsoptions/shim.go +173 -0
  69. package/vendor/shim/tspath/extra-shim.json +4 -0
  70. package/vendor/shim/tspath/go.mod +5 -0
  71. package/vendor/shim/tspath/shim.go +236 -0
  72. package/vendor/shim/vfs/cachedvfs/extra-shim.json +4 -0
  73. package/vendor/shim/vfs/cachedvfs/go.mod +5 -0
  74. package/vendor/shim/vfs/cachedvfs/shim.go +12 -0
  75. package/vendor/shim/vfs/extra-shim.json +4 -0
  76. package/vendor/shim/vfs/go.mod +5 -0
  77. package/vendor/shim/vfs/osvfs/extra-shim.json +4 -0
  78. package/vendor/shim/vfs/osvfs/go.mod +5 -0
  79. package/vendor/shim/vfs/osvfs/shim.go +13 -0
  80. package/vendor/shim/vfs/shim.go +22 -0
@@ -0,0 +1,236 @@
1
+ // Code generated by packages/ttsc/tools/gen_shims. DO NOT EDIT.
2
+
3
+ package tspath
4
+
5
+ import "github.com/microsoft/typescript-go/internal/tspath"
6
+ import _ "unsafe"
7
+
8
+ var AllSupportedExtensions = tspath.AllSupportedExtensions
9
+ var AllSupportedExtensionsWithJson = tspath.AllSupportedExtensionsWithJson
10
+
11
+ //go:linkname ChangeAnyExtension github.com/microsoft/typescript-go/internal/tspath.ChangeAnyExtension
12
+ func ChangeAnyExtension(path string, ext string, extensions []string, ignoreCase bool) string
13
+
14
+ //go:linkname ChangeExtension github.com/microsoft/typescript-go/internal/tspath.ChangeExtension
15
+ func ChangeExtension(path string, newExtension string) string
16
+
17
+ //go:linkname ChangeFullExtension github.com/microsoft/typescript-go/internal/tspath.ChangeFullExtension
18
+ func ChangeFullExtension(path string, newExtension string) string
19
+
20
+ //go:linkname CombinePaths github.com/microsoft/typescript-go/internal/tspath.CombinePaths
21
+ func CombinePaths(firstPath string, paths ...string) string
22
+
23
+ //go:linkname CompareNumberOfDirectorySeparators github.com/microsoft/typescript-go/internal/tspath.CompareNumberOfDirectorySeparators
24
+ func CompareNumberOfDirectorySeparators(path1 string, path2 string) int
25
+
26
+ //go:linkname ComparePaths github.com/microsoft/typescript-go/internal/tspath.ComparePaths
27
+ func ComparePaths(a string, b string, options tspath.ComparePathsOptions) int
28
+
29
+ //go:linkname ComparePathsCaseInsensitive github.com/microsoft/typescript-go/internal/tspath.ComparePathsCaseInsensitive
30
+ func ComparePathsCaseInsensitive(a string, b string, currentDirectory string) int
31
+
32
+ //go:linkname ComparePathsCaseSensitive github.com/microsoft/typescript-go/internal/tspath.ComparePathsCaseSensitive
33
+ func ComparePathsCaseSensitive(a string, b string, currentDirectory string) int
34
+
35
+ type ComparePathsOptions = tspath.ComparePathsOptions
36
+
37
+ //go:linkname ContainsIgnoredPath github.com/microsoft/typescript-go/internal/tspath.ContainsIgnoredPath
38
+ func ContainsIgnoredPath(path string) bool
39
+
40
+ //go:linkname ContainsPath github.com/microsoft/typescript-go/internal/tspath.ContainsPath
41
+ func ContainsPath(parent string, child string, options tspath.ComparePathsOptions) bool
42
+
43
+ //go:linkname ConvertToRelativePath github.com/microsoft/typescript-go/internal/tspath.ConvertToRelativePath
44
+ func ConvertToRelativePath(absoluteOrRelativePath string, options tspath.ComparePathsOptions) string
45
+
46
+ const DirectorySeparator = tspath.DirectorySeparator
47
+
48
+ //go:linkname EnsurePathIsNonModuleName github.com/microsoft/typescript-go/internal/tspath.EnsurePathIsNonModuleName
49
+ func EnsurePathIsNonModuleName(path string) string
50
+
51
+ //go:linkname EnsureTrailingDirectorySeparator github.com/microsoft/typescript-go/internal/tspath.EnsureTrailingDirectorySeparator
52
+ func EnsureTrailingDirectorySeparator(path string) string
53
+
54
+ const ExtensionCjs = tspath.ExtensionCjs
55
+ const ExtensionCts = tspath.ExtensionCts
56
+ const ExtensionDcts = tspath.ExtensionDcts
57
+ const ExtensionDmts = tspath.ExtensionDmts
58
+ const ExtensionDts = tspath.ExtensionDts
59
+
60
+ //go:linkname ExtensionIsOneOf github.com/microsoft/typescript-go/internal/tspath.ExtensionIsOneOf
61
+ func ExtensionIsOneOf(ext string, extensions []string) bool
62
+
63
+ //go:linkname ExtensionIsTs github.com/microsoft/typescript-go/internal/tspath.ExtensionIsTs
64
+ func ExtensionIsTs(ext string) bool
65
+
66
+ const ExtensionJs = tspath.ExtensionJs
67
+ const ExtensionJson = tspath.ExtensionJson
68
+ const ExtensionJsx = tspath.ExtensionJsx
69
+ const ExtensionMjs = tspath.ExtensionMjs
70
+ const ExtensionMts = tspath.ExtensionMts
71
+ const ExtensionTs = tspath.ExtensionTs
72
+ const ExtensionTsBuildInfo = tspath.ExtensionTsBuildInfo
73
+ const ExtensionTsx = tspath.ExtensionTsx
74
+
75
+ var ExtensionsNotSupportingExtensionlessResolution = tspath.ExtensionsNotSupportingExtensionlessResolution
76
+
77
+ //go:linkname FileExtensionIs github.com/microsoft/typescript-go/internal/tspath.FileExtensionIs
78
+ func FileExtensionIs(path string, extension string) bool
79
+
80
+ //go:linkname FileExtensionIsOneOf github.com/microsoft/typescript-go/internal/tspath.FileExtensionIsOneOf
81
+ func FileExtensionIsOneOf(path string, extensions []string) bool
82
+
83
+ //go:linkname GetAnyExtensionFromPath github.com/microsoft/typescript-go/internal/tspath.GetAnyExtensionFromPath
84
+ func GetAnyExtensionFromPath(path string, extensions []string, ignoreCase bool) string
85
+
86
+ //go:linkname GetBaseFileName github.com/microsoft/typescript-go/internal/tspath.GetBaseFileName
87
+ func GetBaseFileName(path string) string
88
+
89
+ //go:linkname GetCanonicalFileName github.com/microsoft/typescript-go/internal/tspath.GetCanonicalFileName
90
+ func GetCanonicalFileName(fileName string, useCaseSensitiveFileNames bool) string
91
+
92
+ //go:linkname GetCommonParents github.com/microsoft/typescript-go/internal/tspath.GetCommonParents
93
+ func GetCommonParents(paths []string, minComponents int, getPathComponents func(path string, currentDirectory string) []string, options tspath.ComparePathsOptions) (parents []string, ignored map[string]struct{})
94
+
95
+ //go:linkname GetDeclarationEmitExtensionForPath github.com/microsoft/typescript-go/internal/tspath.GetDeclarationEmitExtensionForPath
96
+ func GetDeclarationEmitExtensionForPath(path string) string
97
+
98
+ //go:linkname GetDeclarationFileExtension github.com/microsoft/typescript-go/internal/tspath.GetDeclarationFileExtension
99
+ func GetDeclarationFileExtension(fileName string) string
100
+
101
+ //go:linkname GetDirectoryPath github.com/microsoft/typescript-go/internal/tspath.GetDirectoryPath
102
+ func GetDirectoryPath(path string) string
103
+
104
+ //go:linkname GetEncodedRootLength github.com/microsoft/typescript-go/internal/tspath.GetEncodedRootLength
105
+ func GetEncodedRootLength(path string) int
106
+
107
+ //go:linkname GetNormalizedAbsolutePath github.com/microsoft/typescript-go/internal/tspath.GetNormalizedAbsolutePath
108
+ func GetNormalizedAbsolutePath(fileName string, currentDirectory string) string
109
+
110
+ //go:linkname GetNormalizedAbsolutePathWithoutRoot github.com/microsoft/typescript-go/internal/tspath.GetNormalizedAbsolutePathWithoutRoot
111
+ func GetNormalizedAbsolutePathWithoutRoot(fileName string, currentDirectory string) string
112
+
113
+ //go:linkname GetNormalizedPathComponents github.com/microsoft/typescript-go/internal/tspath.GetNormalizedPathComponents
114
+ func GetNormalizedPathComponents(path string, currentDirectory string) []string
115
+
116
+ //go:linkname GetPathComponents github.com/microsoft/typescript-go/internal/tspath.GetPathComponents
117
+ func GetPathComponents(path string, currentDirectory string) []string
118
+
119
+ //go:linkname GetPathComponentsRelativeTo github.com/microsoft/typescript-go/internal/tspath.GetPathComponentsRelativeTo
120
+ func GetPathComponentsRelativeTo(from string, to string, options tspath.ComparePathsOptions) []string
121
+
122
+ //go:linkname GetPathFromPathComponents github.com/microsoft/typescript-go/internal/tspath.GetPathFromPathComponents
123
+ func GetPathFromPathComponents(pathComponents []string) string
124
+
125
+ //go:linkname GetPossibleOriginalInputExtensionForExtension github.com/microsoft/typescript-go/internal/tspath.GetPossibleOriginalInputExtensionForExtension
126
+ func GetPossibleOriginalInputExtensionForExtension(path string) []string
127
+
128
+ //go:linkname GetRelativePathFromDirectory github.com/microsoft/typescript-go/internal/tspath.GetRelativePathFromDirectory
129
+ func GetRelativePathFromDirectory(fromDirectory string, to string, options tspath.ComparePathsOptions) string
130
+
131
+ //go:linkname GetRelativePathFromFile github.com/microsoft/typescript-go/internal/tspath.GetRelativePathFromFile
132
+ func GetRelativePathFromFile(from string, to string, options tspath.ComparePathsOptions) string
133
+
134
+ //go:linkname GetRelativePathToDirectoryOrUrl github.com/microsoft/typescript-go/internal/tspath.GetRelativePathToDirectoryOrUrl
135
+ func GetRelativePathToDirectoryOrUrl(directoryPathOrUrl string, relativeOrAbsolutePath string, isAbsolutePathAnUrl bool, options tspath.ComparePathsOptions) string
136
+
137
+ //go:linkname GetRootLength github.com/microsoft/typescript-go/internal/tspath.GetRootLength
138
+ func GetRootLength(path string) int
139
+
140
+ //go:linkname HasExtension github.com/microsoft/typescript-go/internal/tspath.HasExtension
141
+ func HasExtension(fileName string) bool
142
+
143
+ //go:linkname HasImplementationTSFileExtension github.com/microsoft/typescript-go/internal/tspath.HasImplementationTSFileExtension
144
+ func HasImplementationTSFileExtension(path string) bool
145
+
146
+ //go:linkname HasJSFileExtension github.com/microsoft/typescript-go/internal/tspath.HasJSFileExtension
147
+ func HasJSFileExtension(path string) bool
148
+
149
+ //go:linkname HasJSONFileExtension github.com/microsoft/typescript-go/internal/tspath.HasJSONFileExtension
150
+ func HasJSONFileExtension(path string) bool
151
+
152
+ //go:linkname HasTSFileExtension github.com/microsoft/typescript-go/internal/tspath.HasTSFileExtension
153
+ func HasTSFileExtension(path string) bool
154
+
155
+ //go:linkname HasTrailingDirectorySeparator github.com/microsoft/typescript-go/internal/tspath.HasTrailingDirectorySeparator
156
+ func HasTrailingDirectorySeparator(path string) bool
157
+
158
+ //go:linkname IsDeclarationFileName github.com/microsoft/typescript-go/internal/tspath.IsDeclarationFileName
159
+ func IsDeclarationFileName(fileName string) bool
160
+
161
+ //go:linkname IsDiskPathRoot github.com/microsoft/typescript-go/internal/tspath.IsDiskPathRoot
162
+ func IsDiskPathRoot(path string) bool
163
+
164
+ //go:linkname IsDynamicFileName github.com/microsoft/typescript-go/internal/tspath.IsDynamicFileName
165
+ func IsDynamicFileName(fileName string) bool
166
+
167
+ //go:linkname IsExternalModuleNameRelative github.com/microsoft/typescript-go/internal/tspath.IsExternalModuleNameRelative
168
+ func IsExternalModuleNameRelative(moduleName string) bool
169
+
170
+ //go:linkname IsRootedDiskPath github.com/microsoft/typescript-go/internal/tspath.IsRootedDiskPath
171
+ func IsRootedDiskPath(path string) bool
172
+
173
+ //go:linkname IsUrl github.com/microsoft/typescript-go/internal/tspath.IsUrl
174
+ func IsUrl(path string) bool
175
+
176
+ //go:linkname IsVolumeCharacter github.com/microsoft/typescript-go/internal/tspath.IsVolumeCharacter
177
+ func IsVolumeCharacter(char byte) bool
178
+
179
+ //go:linkname NormalizePath github.com/microsoft/typescript-go/internal/tspath.NormalizePath
180
+ func NormalizePath(path string) string
181
+
182
+ //go:linkname NormalizeSlashes github.com/microsoft/typescript-go/internal/tspath.NormalizeSlashes
183
+ func NormalizeSlashes(path string) string
184
+
185
+ type Path = tspath.Path
186
+
187
+ //go:linkname PathIsAbsolute github.com/microsoft/typescript-go/internal/tspath.PathIsAbsolute
188
+ func PathIsAbsolute(path string) bool
189
+
190
+ //go:linkname PathIsRelative github.com/microsoft/typescript-go/internal/tspath.PathIsRelative
191
+ func PathIsRelative(path string) bool
192
+
193
+ //go:linkname RemoveExtension github.com/microsoft/typescript-go/internal/tspath.RemoveExtension
194
+ func RemoveExtension(path string, extension string) string
195
+
196
+ //go:linkname RemoveFileExtension github.com/microsoft/typescript-go/internal/tspath.RemoveFileExtension
197
+ func RemoveFileExtension(path string) string
198
+
199
+ //go:linkname RemoveTrailingDirectorySeparator github.com/microsoft/typescript-go/internal/tspath.RemoveTrailingDirectorySeparator
200
+ func RemoveTrailingDirectorySeparator(path string) string
201
+
202
+ //go:linkname RemoveTrailingDirectorySeparators github.com/microsoft/typescript-go/internal/tspath.RemoveTrailingDirectorySeparators
203
+ func RemoveTrailingDirectorySeparators(path string) string
204
+
205
+ //go:linkname ResolvePath github.com/microsoft/typescript-go/internal/tspath.ResolvePath
206
+ func ResolvePath(path string, paths ...string) string
207
+
208
+ //go:linkname ResolveTripleslashReference github.com/microsoft/typescript-go/internal/tspath.ResolveTripleslashReference
209
+ func ResolveTripleslashReference(moduleName string, containingFile string) string
210
+
211
+ //go:linkname SplitVolumePath github.com/microsoft/typescript-go/internal/tspath.SplitVolumePath
212
+ func SplitVolumePath(path string) (volume string, rest string, ok bool)
213
+
214
+ //go:linkname StartsWithDirectory github.com/microsoft/typescript-go/internal/tspath.StartsWithDirectory
215
+ func StartsWithDirectory(fileName string, directoryName string, useCaseSensitiveFileNames bool) bool
216
+
217
+ var SupportedDeclarationExtensions = tspath.SupportedDeclarationExtensions
218
+ var SupportedJSExtensions = tspath.SupportedJSExtensions
219
+ var SupportedJSExtensionsFlat = tspath.SupportedJSExtensionsFlat
220
+ var SupportedTSExtensions = tspath.SupportedTSExtensions
221
+ var SupportedTSExtensionsFlat = tspath.SupportedTSExtensionsFlat
222
+ var SupportedTSExtensionsWithJson = tspath.SupportedTSExtensionsWithJson
223
+ var SupportedTSExtensionsWithJsonFlat = tspath.SupportedTSExtensionsWithJsonFlat
224
+ var SupportedTSImplementationExtensions = tspath.SupportedTSImplementationExtensions
225
+
226
+ //go:linkname ToFileNameLowerCase github.com/microsoft/typescript-go/internal/tspath.ToFileNameLowerCase
227
+ func ToFileNameLowerCase(fileName string) string
228
+
229
+ //go:linkname ToPath github.com/microsoft/typescript-go/internal/tspath.ToPath
230
+ func ToPath(fileName string, basePath string, useCaseSensitiveFileNames bool) tspath.Path
231
+
232
+ //go:linkname TryExtractTSExtension github.com/microsoft/typescript-go/internal/tspath.TryExtractTSExtension
233
+ func TryExtractTSExtension(fileName string) string
234
+
235
+ //go:linkname TryGetExtensionFromPath github.com/microsoft/typescript-go/internal/tspath.TryGetExtensionFromPath
236
+ func TryGetExtensionFromPath(p string) string
@@ -0,0 +1,4 @@
1
+ {
2
+ "ExtraMethods": {},
3
+ "ExtraFields": {}
4
+ }
@@ -0,0 +1,5 @@
1
+ module github.com/microsoft/typescript-go/shim/vfs/cachedvfs
2
+
3
+ go 1.26
4
+
5
+ require github.com/microsoft/typescript-go v0.0.0-20260429010842-56ab4af42157
@@ -0,0 +1,12 @@
1
+ // Code generated by packages/ttsc/tools/gen_shims. DO NOT EDIT.
2
+
3
+ package cachedvfs
4
+
5
+ import "github.com/microsoft/typescript-go/internal/vfs"
6
+ import "github.com/microsoft/typescript-go/internal/vfs/cachedvfs"
7
+ import _ "unsafe"
8
+
9
+ type FS = cachedvfs.FS
10
+
11
+ //go:linkname From github.com/microsoft/typescript-go/internal/vfs/cachedvfs.From
12
+ func From(fs vfs.FS) *cachedvfs.FS
@@ -0,0 +1,4 @@
1
+ {
2
+ "ExtraMethods": {},
3
+ "ExtraFields": {}
4
+ }
@@ -0,0 +1,5 @@
1
+ module github.com/microsoft/typescript-go/shim/vfs
2
+
3
+ go 1.26
4
+
5
+ require github.com/microsoft/typescript-go v0.0.0-20260429010842-56ab4af42157
@@ -0,0 +1,4 @@
1
+ {
2
+ "ExtraMethods": {},
3
+ "ExtraFields": {}
4
+ }
@@ -0,0 +1,5 @@
1
+ module github.com/microsoft/typescript-go/shim/vfs/osvfs
2
+
3
+ go 1.26
4
+
5
+ require github.com/microsoft/typescript-go v0.0.0-20260429010842-56ab4af42157
@@ -0,0 +1,13 @@
1
+ // Code generated by packages/ttsc/tools/gen_shims. DO NOT EDIT.
2
+
3
+ package osvfs
4
+
5
+ import "github.com/microsoft/typescript-go/internal/vfs"
6
+ import _ "github.com/microsoft/typescript-go/internal/vfs/osvfs"
7
+ import _ "unsafe"
8
+
9
+ //go:linkname FS github.com/microsoft/typescript-go/internal/vfs/osvfs.FS
10
+ func FS() vfs.FS
11
+
12
+ //go:linkname GetGlobalTypingsCacheLocation github.com/microsoft/typescript-go/internal/vfs/osvfs.GetGlobalTypingsCacheLocation
13
+ func GetGlobalTypingsCacheLocation() string
@@ -0,0 +1,22 @@
1
+ // Code generated by packages/ttsc/tools/gen_shims. DO NOT EDIT.
2
+
3
+ package vfs
4
+
5
+ import "github.com/microsoft/typescript-go/internal/vfs"
6
+
7
+ type DirEntry = vfs.DirEntry
8
+ type Entries = vfs.Entries
9
+
10
+ var ErrClosed = vfs.ErrClosed
11
+ var ErrExist = vfs.ErrExist
12
+ var ErrInvalid = vfs.ErrInvalid
13
+ var ErrNotExist = vfs.ErrNotExist
14
+ var ErrPermission = vfs.ErrPermission
15
+
16
+ type FS = vfs.FS
17
+ type FileInfo = vfs.FileInfo
18
+
19
+ var SkipAll = vfs.SkipAll
20
+ var SkipDir = vfs.SkipDir
21
+
22
+ type WalkDirFunc = vfs.WalkDirFunc