@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,220 @@
1
+ // gen_shims:hand-maintained
2
+ //
3
+ // This shim file mixes generated re-exports with hand-written `go:linkname`
4
+ // declarations (see GetSourceFileOfNode / GetNodeAtPosition below). gen_shims
5
+ // detects the marker on the first line and skips this file. Remove the marker
6
+ // only if you are intentionally regenerating and willing to re-add the
7
+ // hand-maintained content.
8
+
9
+ package ast
10
+
11
+ import (
12
+ innerast "github.com/microsoft/typescript-go/internal/ast"
13
+ _ "unsafe"
14
+ )
15
+
16
+ type CallExpression = innerast.CallExpression
17
+ type Diagnostic = innerast.Diagnostic
18
+ type Identifier = innerast.Identifier
19
+ type IdentifierNode = innerast.IdentifierNode
20
+ type ImportAttributesNode = innerast.ImportAttributesNode
21
+ type ImportClauseNode = innerast.ImportClauseNode
22
+ type ImportPhaseModifierSyntaxKind = innerast.ImportPhaseModifierSyntaxKind
23
+ type ImportSpecifierList = innerast.ImportSpecifierList
24
+ type IntersectionTypeNode = innerast.IntersectionTypeNode
25
+ type Kind = innerast.Kind
26
+ type KeywordExpressionSyntaxKind = innerast.KeywordExpressionSyntaxKind
27
+ type KeywordTypeSyntaxKind = innerast.KeywordTypeSyntaxKind
28
+ type LiteralTypeNode = innerast.LiteralTypeNode
29
+ type NoSubstitutionTemplateLiteral = innerast.NoSubstitutionTemplateLiteral
30
+ type Node = innerast.Node
31
+ type NodeFactory = innerast.NodeFactory
32
+ type NodeFactoryHooks = innerast.NodeFactoryHooks
33
+ type NodeVisitor = innerast.NodeVisitor
34
+ type NodeVisitorHooks = innerast.NodeVisitorHooks
35
+ type TokenFlags = innerast.TokenFlags
36
+ type ModifierList = innerast.ModifierList
37
+ type StatementList = innerast.StatementList
38
+ type VariableDeclarationNodeList = innerast.VariableDeclarationNodeList
39
+ type BindingElementList = innerast.BindingElementList
40
+ type TypeParameterList = innerast.TypeParameterList
41
+ type ParameterList = innerast.ParameterList
42
+ type ElementList = innerast.ElementList
43
+ type TypeList = innerast.TypeList
44
+ type TypeElementList = innerast.TypeElementList
45
+ type Statement = innerast.Statement
46
+ type Expression = innerast.Expression
47
+ type TypeNode = innerast.TypeNode
48
+ type TypePredicateParameterName = innerast.TypePredicateParameterName
49
+ type AssertsKeyword = innerast.AssertsKeyword
50
+ type BindingName = innerast.BindingName
51
+ type BinaryOperatorToken = innerast.BinaryOperatorToken
52
+ type PropertyName = innerast.PropertyName
53
+ type MemberName = innerast.MemberName
54
+ type EntityName = innerast.EntityName
55
+ type ModuleExportName = innerast.ModuleExportName
56
+ type NamedImportBindings = innerast.NamedImportBindings
57
+ type ConciseBody = innerast.ConciseBody
58
+ type TemplateSpanList = innerast.TemplateSpanList
59
+ type TemplateMiddleOrTail = innerast.TemplateMiddleOrTail
60
+ type TemplateHeadNode = innerast.TemplateHeadNode
61
+ type QuestionDotToken = innerast.QuestionDotToken
62
+ type QuestionToken = innerast.QuestionToken
63
+ type DotDotDotToken = innerast.DotDotDotToken
64
+ type ExclamationToken = innerast.ExclamationToken
65
+ type EqualsGreaterThanToken = innerast.EqualsGreaterThanToken
66
+ type AsteriskToken = innerast.AsteriskToken
67
+ type TokenNode = innerast.TokenNode
68
+ type TemplateHead = innerast.TemplateHead
69
+ type TemplateLiteralTypeNode = innerast.TemplateLiteralTypeNode
70
+ type TemplateLiteralTypeSpan = innerast.TemplateLiteralTypeSpan
71
+ type TemplateMiddle = innerast.TemplateMiddle
72
+ type TemplateTail = innerast.TemplateTail
73
+ type PrefixUnaryExpression = innerast.PrefixUnaryExpression
74
+ type ComputedPropertyName = innerast.ComputedPropertyName
75
+ type PropertySignatureDeclaration = innerast.PropertySignatureDeclaration
76
+ type QualifiedName = innerast.QualifiedName
77
+ type TypeLiteralNode = innerast.TypeLiteralNode
78
+ type FunctionTypeNode = innerast.FunctionTypeNode
79
+ type InterfaceDeclaration = innerast.InterfaceDeclaration
80
+ type TypeReferenceNode = innerast.TypeReferenceNode
81
+ type SourceFile = innerast.SourceFile
82
+ type StringLiteral = innerast.StringLiteral
83
+ type Symbol = innerast.Symbol
84
+ type SymbolFlags = innerast.SymbolFlags
85
+ type NumericLiteral = innerast.NumericLiteral
86
+ type BigIntLiteral = innerast.BigIntLiteral
87
+ type ArrayTypeNode = innerast.ArrayTypeNode
88
+ type IndexSignatureDeclaration = innerast.IndexSignatureDeclaration
89
+ type NamedTupleMember = innerast.NamedTupleMember
90
+ type OptionalTypeNode = innerast.OptionalTypeNode
91
+ type RestTypeNode = innerast.RestTypeNode
92
+ type TypeAliasDeclaration = innerast.TypeAliasDeclaration
93
+ type TypeParameterDeclaration = innerast.TypeParameterDeclaration
94
+ type TupleTypeNode = innerast.TupleTypeNode
95
+ type UnionTypeNode = innerast.UnionTypeNode
96
+ type MethodSignatureDeclaration = innerast.MethodSignatureDeclaration
97
+ type MethodDeclaration = innerast.MethodDeclaration
98
+ type NodeList = innerast.NodeList
99
+ type ParameterDeclaration = innerast.ParameterDeclaration
100
+ type ParenthesizedTypeNode = innerast.ParenthesizedTypeNode
101
+
102
+ const (
103
+ KindEndOfFile = innerast.KindEndOfFile
104
+ KindSingleLineCommentTrivia = innerast.KindSingleLineCommentTrivia
105
+ KindCallExpression = innerast.KindCallExpression
106
+ KindIdentifier = innerast.KindIdentifier
107
+ KindMultiLineCommentTrivia = innerast.KindMultiLineCommentTrivia
108
+ KindPropertyAccessExpression = innerast.KindPropertyAccessExpression
109
+ KindPropertySignature = innerast.KindPropertySignature
110
+ KindComputedPropertyName = innerast.KindComputedPropertyName
111
+ KindMethodSignature = innerast.KindMethodSignature
112
+ KindMethodDeclaration = innerast.KindMethodDeclaration
113
+ KindIndexSignature = innerast.KindIndexSignature
114
+ KindParameter = innerast.KindParameter
115
+ KindStringKeyword = innerast.KindStringKeyword
116
+ KindNumberKeyword = innerast.KindNumberKeyword
117
+ KindBooleanKeyword = innerast.KindBooleanKeyword
118
+ KindBigIntKeyword = innerast.KindBigIntKeyword
119
+ KindAnyKeyword = innerast.KindAnyKeyword
120
+ KindUnknownKeyword = innerast.KindUnknownKeyword
121
+ KindNeverKeyword = innerast.KindNeverKeyword
122
+ KindUndefinedKeyword = innerast.KindUndefinedKeyword
123
+ KindNullKeyword = innerast.KindNullKeyword
124
+ KindVoidKeyword = innerast.KindVoidKeyword
125
+ KindTrueKeyword = innerast.KindTrueKeyword
126
+ KindFalseKeyword = innerast.KindFalseKeyword
127
+ KindStringLiteral = innerast.KindStringLiteral
128
+ KindNoSubstitutionTemplateLiteral = innerast.KindNoSubstitutionTemplateLiteral
129
+ KindTemplateHead = innerast.KindTemplateHead
130
+ KindTemplateMiddle = innerast.KindTemplateMiddle
131
+ KindTemplateTail = innerast.KindTemplateTail
132
+ KindNumericLiteral = innerast.KindNumericLiteral
133
+ KindBigIntLiteral = innerast.KindBigIntLiteral
134
+ KindTypeReference = innerast.KindTypeReference
135
+ KindFunctionType = innerast.KindFunctionType
136
+ KindLiteralType = innerast.KindLiteralType
137
+ KindArrayType = innerast.KindArrayType
138
+ KindTypeLiteral = innerast.KindTypeLiteral
139
+ KindInterfaceDeclaration = innerast.KindInterfaceDeclaration
140
+ KindTupleType = innerast.KindTupleType
141
+ KindUnionType = innerast.KindUnionType
142
+ KindIntersectionType = innerast.KindIntersectionType
143
+ KindNamedTupleMember = innerast.KindNamedTupleMember
144
+ KindOptionalType = innerast.KindOptionalType
145
+ KindParenthesizedType = innerast.KindParenthesizedType
146
+ KindRestType = innerast.KindRestType
147
+ KindTemplateLiteralType = innerast.KindTemplateLiteralType
148
+ KindTemplateLiteralTypeSpan = innerast.KindTemplateLiteralTypeSpan
149
+ KindPrefixUnaryExpression = innerast.KindPrefixUnaryExpression
150
+ KindQualifiedName = innerast.KindQualifiedName
151
+ KindTypeAliasDeclaration = innerast.KindTypeAliasDeclaration
152
+ KindTypeParameter = innerast.KindTypeParameter
153
+ KindImportSpecifier = innerast.KindImportSpecifier
154
+ KindImportDeclaration = innerast.KindImportDeclaration
155
+ KindNamedImports = innerast.KindNamedImports
156
+ KindNamespaceImport = innerast.KindNamespaceImport
157
+ KindExportSpecifier = innerast.KindExportSpecifier
158
+ KindModuleBlock = innerast.KindModuleBlock
159
+ KindModuleDeclaration = innerast.KindModuleDeclaration
160
+ KindFunctionDeclaration = innerast.KindFunctionDeclaration
161
+ KindMinusToken = innerast.KindMinusToken
162
+ KindQuestionDotToken = innerast.KindQuestionDotToken
163
+ KindAssertsKeyword = innerast.KindAssertsKeyword
164
+ KindEqualsGreaterThanToken = innerast.KindEqualsGreaterThanToken
165
+
166
+ NodeFlagsOptionalChain = innerast.NodeFlagsOptionalChain
167
+
168
+ TokenFlagsNone = innerast.TokenFlagsNone
169
+
170
+ SymbolFlagsOptional = innerast.SymbolFlagsOptional
171
+ SymbolFlagsAlias = innerast.SymbolFlagsAlias
172
+ SymbolFlagsType = innerast.SymbolFlagsType
173
+ SymbolFlagsNamespace = innerast.SymbolFlagsNamespace
174
+
175
+ ModifierFlagsPrivate = innerast.ModifierFlagsPrivate
176
+ ModifierFlagsProtected = innerast.ModifierFlagsProtected
177
+ ModifierFlagsReadonly = innerast.ModifierFlagsReadonly
178
+ )
179
+
180
+ func NewNodeFactory(options NodeFactoryHooks) *NodeFactory {
181
+ return innerast.NewNodeFactory(options)
182
+ }
183
+
184
+ func NewNodeVisitor(visit func(node *Node) *Node, factory *NodeFactory, options NodeVisitorHooks) *NodeVisitor {
185
+ return innerast.NewNodeVisitor(visit, factory, options)
186
+ }
187
+
188
+ func IsFunctionLike(node *Node) bool {
189
+ return innerast.IsFunctionLike(node)
190
+ }
191
+
192
+ func IsPropertyAssignment(node *Node) bool {
193
+ return innerast.IsPropertyAssignment(node)
194
+ }
195
+
196
+ func IsPropertyDeclaration(node *Node) bool {
197
+ return innerast.IsPropertyDeclaration(node)
198
+ }
199
+
200
+ func IsModuleBlock(node *Node) bool {
201
+ return innerast.IsModuleBlock(node)
202
+ }
203
+
204
+ func IsStringLiteral(node *Node) bool {
205
+ return innerast.IsStringLiteral(node)
206
+ }
207
+
208
+ func IsPropertyAccessExpression(node *Node) bool {
209
+ return innerast.IsPropertyAccessExpression(node)
210
+ }
211
+
212
+ func IsElementAccessExpression(node *Node) bool {
213
+ return innerast.IsElementAccessExpression(node)
214
+ }
215
+
216
+ //go:linkname GetSourceFileOfNode github.com/microsoft/typescript-go/internal/ast.GetSourceFileOfNode
217
+ func GetSourceFileOfNode(node *innerast.Node) *innerast.SourceFile
218
+
219
+ //go:linkname GetNodeAtPosition github.com/microsoft/typescript-go/internal/ast.GetNodeAtPosition
220
+ func GetNodeAtPosition(file *innerast.SourceFile, position int, includeJSDoc bool) *innerast.Node