typia 13.0.0-dev.20260509 → 13.0.0-dev.20260511
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/lib/executable/TypiaGenerateWizard2.mjs +28 -7
- package/lib/executable/TypiaGenerateWizard2.mjs.map +1 -1
- package/lib/executable/generate/ttsc.d.ts +1 -11
- package/lib/executable/generate/ttsc.js +1 -0
- package/lib/executable/generate/ttsc.js.map +1 -1
- package/lib/executable/generate/ttsc2.mjs +4 -0
- package/lib/executable/generate/ttsc2.mjs.map +1 -1
- package/lib/executable/typia.d.ts +1 -4
- package/lib/executable/typia.js +4 -36
- package/lib/executable/typia.js.map +1 -1
- package/lib/executable/typia2.mjs +5 -39
- package/lib/executable/typia2.mjs.map +1 -1
- package/native/adapter/adapter.go +3 -3
- package/native/adapter/cleanup.go +42 -0
- package/native/cmd/ttsc-typia/transform.go +1 -40
- package/native/go.mod +0 -4
- package/native/{shim/printer/shim.go → internal/printer/printer.go} +43 -63
- package/package.json +6 -6
- package/src/executable/typia.ts +1 -1
- package/native/go.work +0 -20
- package/native/go.work.sum +0 -11
- package/native/shim/printer/go.mod +0 -5
- package/native/third_party/ttsc/driver/host.go +0 -31
- package/native/third_party/ttsc/driver/program.go +0 -466
- package/native/third_party/ttsc/driver/rewrite.go +0 -341
- package/native/third_party/ttsc/go.mod +0 -48
- package/native/third_party/ttsc/go.sum +0 -22
- package/native/third_party/ttsc/shim/ast/extra-shim.json +0 -4
- package/native/third_party/ttsc/shim/ast/go.mod +0 -5
- package/native/third_party/ttsc/shim/ast/lint.go +0 -331
- package/native/third_party/ttsc/shim/ast/shim.go +0 -210
- package/native/third_party/ttsc/shim/bundled/extra-shim.json +0 -1
- package/native/third_party/ttsc/shim/bundled/go.mod +0 -5
- package/native/third_party/ttsc/shim/bundled/shim.go +0 -23
- package/native/third_party/ttsc/shim/checker/extra-shim.json +0 -31
- package/native/third_party/ttsc/shim/checker/go.mod +0 -5
- package/native/third_party/ttsc/shim/checker/shim.go +0 -166
- package/native/third_party/ttsc/shim/compiler/extra-shim.json +0 -4
- package/native/third_party/ttsc/shim/compiler/go.mod +0 -5
- package/native/third_party/ttsc/shim/compiler/shim.go +0 -65
- package/native/third_party/ttsc/shim/core/extra-shim.json +0 -4
- package/native/third_party/ttsc/shim/core/go.mod +0 -5
- package/native/third_party/ttsc/shim/core/shim.go +0 -29
- package/native/third_party/ttsc/shim/diagnosticwriter/go.mod +0 -5
- package/native/third_party/ttsc/shim/diagnosticwriter/lint.go +0 -137
- package/native/third_party/ttsc/shim/diagnosticwriter/shim.go +0 -29
- package/native/third_party/ttsc/shim/parser/extra-shim.json +0 -4
- package/native/third_party/ttsc/shim/parser/go.mod +0 -5
- package/native/third_party/ttsc/shim/parser/shim.go +0 -61
- package/native/third_party/ttsc/shim/scanner/extra-shim.json +0 -4
- package/native/third_party/ttsc/shim/scanner/go.mod +0 -5
- package/native/third_party/ttsc/shim/scanner/shim.go +0 -134
- package/native/third_party/ttsc/shim/tsoptions/extra-shim.json +0 -4
- package/native/third_party/ttsc/shim/tsoptions/go.mod +0 -5
- package/native/third_party/ttsc/shim/tsoptions/shim.go +0 -173
- package/native/third_party/ttsc/shim/tspath/extra-shim.json +0 -4
- package/native/third_party/ttsc/shim/tspath/go.mod +0 -5
- package/native/third_party/ttsc/shim/tspath/shim.go +0 -236
- package/native/third_party/ttsc/shim/vfs/cachedvfs/extra-shim.json +0 -4
- package/native/third_party/ttsc/shim/vfs/cachedvfs/go.mod +0 -5
- package/native/third_party/ttsc/shim/vfs/cachedvfs/shim.go +0 -12
- package/native/third_party/ttsc/shim/vfs/extra-shim.json +0 -4
- package/native/third_party/ttsc/shim/vfs/go.mod +0 -5
- package/native/third_party/ttsc/shim/vfs/osvfs/extra-shim.json +0 -4
- package/native/third_party/ttsc/shim/vfs/osvfs/go.mod +0 -5
- package/native/third_party/ttsc/shim/vfs/osvfs/shim.go +0 -13
- package/native/third_party/ttsc/shim/vfs/shim.go +0 -22
|
@@ -1,66 +1,46 @@
|
|
|
1
1
|
package printer
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
innerprinter "github.com/microsoft/typescript-go/internal/printer"
|
|
4
|
+
shimast "github.com/microsoft/typescript-go/shim/ast"
|
|
5
|
+
shimprinter "github.com/microsoft/typescript-go/shim/printer"
|
|
7
6
|
)
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
type PrinterOptions = innerprinter.PrinterOptions
|
|
11
|
-
type PrintHandlers = innerprinter.PrintHandlers
|
|
12
|
-
type EmitContext = innerprinter.EmitContext
|
|
8
|
+
const kindColonToken = shimast.KindQuestionToken + 1
|
|
13
9
|
|
|
14
|
-
func
|
|
15
|
-
return innerprinter.NewPrinter(options, handlers, emitContext)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
func NewEmitContext() *EmitContext {
|
|
19
|
-
return innerprinter.NewEmitContext()
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
func Emit(node *innerast.Node, sourceFile *innerast.SourceFile) string {
|
|
10
|
+
func EmitWithIdentifierSubstitutions(node *shimast.Node, sourceFile *shimast.SourceFile, substitutions map[string]string) string {
|
|
23
11
|
node = stripTypeSyntax(node)
|
|
12
|
+
node = rewriteIdentifiers(node, substitutions)
|
|
24
13
|
normalizeSyntheticTokens(node)
|
|
25
|
-
return
|
|
26
|
-
RemoveComments: true,
|
|
27
|
-
NewLine: innercore.NewLineKindLF,
|
|
28
|
-
}, PrintHandlers{}, nil).Emit(node, sourceFile)
|
|
14
|
+
return emit(node, sourceFile)
|
|
29
15
|
}
|
|
30
16
|
|
|
31
|
-
func
|
|
32
|
-
node = stripTypeSyntax(node)
|
|
17
|
+
func EmitPreservingTypesWithIdentifierSubstitutions(node *shimast.Node, sourceFile *shimast.SourceFile, substitutions map[string]string) string {
|
|
33
18
|
node = rewriteIdentifiers(node, substitutions)
|
|
34
19
|
normalizeSyntheticTokens(node)
|
|
35
|
-
return
|
|
36
|
-
RemoveComments: true,
|
|
37
|
-
NewLine: innercore.NewLineKindLF,
|
|
38
|
-
}, PrintHandlers{}, nil).Emit(node, sourceFile)
|
|
20
|
+
return emit(node, sourceFile)
|
|
39
21
|
}
|
|
40
22
|
|
|
41
|
-
func
|
|
42
|
-
|
|
43
|
-
normalizeSyntheticTokens(node)
|
|
44
|
-
return NewPrinter(PrinterOptions{
|
|
23
|
+
func emit(node *shimast.Node, sourceFile *shimast.SourceFile) string {
|
|
24
|
+
return shimprinter.NewPrinter(shimprinter.PrinterOptions{
|
|
45
25
|
RemoveComments: true,
|
|
46
|
-
NewLine:
|
|
47
|
-
}, PrintHandlers{}, nil).Emit(node, sourceFile)
|
|
26
|
+
NewLine: 2,
|
|
27
|
+
}, shimprinter.PrintHandlers{}, nil).Emit(node, sourceFile)
|
|
48
28
|
}
|
|
49
29
|
|
|
50
|
-
func stripTypeSyntax(node *
|
|
30
|
+
func stripTypeSyntax(node *shimast.Node) *shimast.Node {
|
|
51
31
|
if node == nil {
|
|
52
32
|
return nil
|
|
53
33
|
}
|
|
54
|
-
factory :=
|
|
55
|
-
var visitor *
|
|
56
|
-
visitor =
|
|
34
|
+
factory := shimast.NewNodeFactory(shimast.NodeFactoryHooks{})
|
|
35
|
+
var visitor *shimast.NodeVisitor
|
|
36
|
+
visitor = shimast.NewNodeVisitor(func(current *shimast.Node) *shimast.Node {
|
|
57
37
|
if current == nil {
|
|
58
38
|
return nil
|
|
59
39
|
}
|
|
60
40
|
switch current.Kind {
|
|
61
|
-
case
|
|
41
|
+
case shimast.KindAsExpression, shimast.KindSatisfiesExpression, shimast.KindTypeAssertionExpression, shimast.KindNonNullExpression:
|
|
62
42
|
return visitor.VisitNode(current.Expression())
|
|
63
|
-
case
|
|
43
|
+
case shimast.KindVariableDeclaration:
|
|
64
44
|
decl := current.AsVariableDeclaration()
|
|
65
45
|
return factory.UpdateVariableDeclaration(
|
|
66
46
|
decl,
|
|
@@ -69,7 +49,7 @@ func stripTypeSyntax(node *innerast.Node) *innerast.Node {
|
|
|
69
49
|
nil,
|
|
70
50
|
visitor.VisitNode(decl.Initializer),
|
|
71
51
|
)
|
|
72
|
-
case
|
|
52
|
+
case shimast.KindParameter:
|
|
73
53
|
parameter := current.AsParameterDeclaration()
|
|
74
54
|
return factory.UpdateParameterDeclaration(
|
|
75
55
|
parameter,
|
|
@@ -80,7 +60,7 @@ func stripTypeSyntax(node *innerast.Node) *innerast.Node {
|
|
|
80
60
|
nil,
|
|
81
61
|
visitor.VisitNode(parameter.Initializer),
|
|
82
62
|
)
|
|
83
|
-
case
|
|
63
|
+
case shimast.KindArrowFunction:
|
|
84
64
|
arrow := current.AsArrowFunction()
|
|
85
65
|
return factory.UpdateArrowFunction(
|
|
86
66
|
arrow,
|
|
@@ -92,7 +72,7 @@ func stripTypeSyntax(node *innerast.Node) *innerast.Node {
|
|
|
92
72
|
visitor.VisitNode(arrow.EqualsGreaterThanToken),
|
|
93
73
|
visitor.VisitNode(arrow.Body),
|
|
94
74
|
)
|
|
95
|
-
case
|
|
75
|
+
case shimast.KindCallExpression:
|
|
96
76
|
call := current.AsCallExpression()
|
|
97
77
|
return factory.UpdateCallExpression(
|
|
98
78
|
call,
|
|
@@ -102,7 +82,7 @@ func stripTypeSyntax(node *innerast.Node) *innerast.Node {
|
|
|
102
82
|
visitor.VisitNodes(call.Arguments),
|
|
103
83
|
call.Flags,
|
|
104
84
|
)
|
|
105
|
-
case
|
|
85
|
+
case shimast.KindNewExpression:
|
|
106
86
|
expr := current.AsNewExpression()
|
|
107
87
|
return factory.UpdateNewExpression(
|
|
108
88
|
expr,
|
|
@@ -113,27 +93,27 @@ func stripTypeSyntax(node *innerast.Node) *innerast.Node {
|
|
|
113
93
|
default:
|
|
114
94
|
return visitor.VisitEachChild(current)
|
|
115
95
|
}
|
|
116
|
-
}, factory,
|
|
96
|
+
}, factory, shimast.NodeVisitorHooks{})
|
|
117
97
|
return visitor.VisitNode(node)
|
|
118
98
|
}
|
|
119
99
|
|
|
120
|
-
func rewriteIdentifiers(node *
|
|
100
|
+
func rewriteIdentifiers(node *shimast.Node, substitutions map[string]string) *shimast.Node {
|
|
121
101
|
if node == nil || len(substitutions) == 0 {
|
|
122
102
|
return node
|
|
123
103
|
}
|
|
124
|
-
factory :=
|
|
125
|
-
var visitor *
|
|
126
|
-
visitor =
|
|
104
|
+
factory := shimast.NewNodeFactory(shimast.NodeFactoryHooks{})
|
|
105
|
+
var visitor *shimast.NodeVisitor
|
|
106
|
+
visitor = shimast.NewNodeVisitor(func(current *shimast.Node) *shimast.Node {
|
|
127
107
|
if current == nil {
|
|
128
108
|
return nil
|
|
129
109
|
}
|
|
130
110
|
switch current.Kind {
|
|
131
|
-
case
|
|
111
|
+
case shimast.KindIdentifier:
|
|
132
112
|
if replacement, ok := substitutions[current.Text()]; ok {
|
|
133
113
|
return rewriteIdentifierExpression(factory, replacement)
|
|
134
114
|
}
|
|
135
115
|
return current
|
|
136
|
-
case
|
|
116
|
+
case shimast.KindVariableDeclaration:
|
|
137
117
|
decl := current.AsVariableDeclaration()
|
|
138
118
|
return factory.UpdateVariableDeclaration(
|
|
139
119
|
decl,
|
|
@@ -142,7 +122,7 @@ func rewriteIdentifiers(node *innerast.Node, substitutions map[string]string) *i
|
|
|
142
122
|
nil,
|
|
143
123
|
visitor.VisitNode(decl.Initializer),
|
|
144
124
|
)
|
|
145
|
-
case
|
|
125
|
+
case shimast.KindParameter:
|
|
146
126
|
parameter := current.AsParameterDeclaration()
|
|
147
127
|
return factory.UpdateParameterDeclaration(
|
|
148
128
|
parameter,
|
|
@@ -153,7 +133,7 @@ func rewriteIdentifiers(node *innerast.Node, substitutions map[string]string) *i
|
|
|
153
133
|
nil,
|
|
154
134
|
visitor.VisitNode(parameter.Initializer),
|
|
155
135
|
)
|
|
156
|
-
case
|
|
136
|
+
case shimast.KindPropertyAssignment:
|
|
157
137
|
assignment := current.AsPropertyAssignment()
|
|
158
138
|
return factory.UpdatePropertyAssignment(
|
|
159
139
|
assignment,
|
|
@@ -163,10 +143,10 @@ func rewriteIdentifiers(node *innerast.Node, substitutions map[string]string) *i
|
|
|
163
143
|
nil,
|
|
164
144
|
visitor.VisitNode(assignment.Initializer),
|
|
165
145
|
)
|
|
166
|
-
case
|
|
146
|
+
case shimast.KindShorthandPropertyAssignment:
|
|
167
147
|
assignment := current.AsShorthandPropertyAssignment()
|
|
168
148
|
name := assignment.Name()
|
|
169
|
-
if name != nil && name.Kind ==
|
|
149
|
+
if name != nil && name.Kind == shimast.KindIdentifier {
|
|
170
150
|
if replacement, ok := substitutions[name.Text()]; ok && assignment.ObjectAssignmentInitializer == nil {
|
|
171
151
|
return factory.NewPropertyAssignment(
|
|
172
152
|
assignment.Modifiers(),
|
|
@@ -186,7 +166,7 @@ func rewriteIdentifiers(node *innerast.Node, substitutions map[string]string) *i
|
|
|
186
166
|
nil,
|
|
187
167
|
visitor.VisitNode(assignment.ObjectAssignmentInitializer),
|
|
188
168
|
)
|
|
189
|
-
case
|
|
169
|
+
case shimast.KindPropertyAccessExpression:
|
|
190
170
|
access := current.AsPropertyAccessExpression()
|
|
191
171
|
return factory.UpdatePropertyAccessExpression(
|
|
192
172
|
access,
|
|
@@ -198,11 +178,11 @@ func rewriteIdentifiers(node *innerast.Node, substitutions map[string]string) *i
|
|
|
198
178
|
default:
|
|
199
179
|
return visitor.VisitEachChild(current)
|
|
200
180
|
}
|
|
201
|
-
}, factory,
|
|
181
|
+
}, factory, shimast.NodeVisitorHooks{})
|
|
202
182
|
return visitor.VisitNode(node)
|
|
203
183
|
}
|
|
204
184
|
|
|
205
|
-
func rewriteIdentifierExpression(factory *
|
|
185
|
+
func rewriteIdentifierExpression(factory *shimast.NodeFactory, replacement string) *shimast.Node {
|
|
206
186
|
parts := []string{}
|
|
207
187
|
start := 0
|
|
208
188
|
for i := 0; i <= len(replacement); i++ {
|
|
@@ -222,27 +202,27 @@ func rewriteIdentifierExpression(factory *innerast.NodeFactory, replacement stri
|
|
|
222
202
|
output,
|
|
223
203
|
nil,
|
|
224
204
|
factory.NewIdentifier(part),
|
|
225
|
-
|
|
205
|
+
shimast.NodeFlagsNone,
|
|
226
206
|
)
|
|
227
207
|
}
|
|
228
208
|
return output
|
|
229
209
|
}
|
|
230
210
|
|
|
231
|
-
func normalizeSyntheticTokens(node *
|
|
211
|
+
func normalizeSyntheticTokens(node *shimast.Node) {
|
|
232
212
|
if node == nil {
|
|
233
213
|
return
|
|
234
214
|
}
|
|
235
|
-
if node.Kind ==
|
|
215
|
+
if node.Kind == shimast.KindConditionalExpression {
|
|
236
216
|
conditional := node.AsConditionalExpression()
|
|
237
|
-
factory :=
|
|
217
|
+
factory := shimast.NewNodeFactory(shimast.NodeFactoryHooks{})
|
|
238
218
|
if conditional.QuestionToken == nil {
|
|
239
|
-
conditional.QuestionToken = factory.NewToken(
|
|
219
|
+
conditional.QuestionToken = factory.NewToken(shimast.KindQuestionToken)
|
|
240
220
|
}
|
|
241
221
|
if conditional.ColonToken == nil {
|
|
242
|
-
conditional.ColonToken = factory.NewToken(
|
|
222
|
+
conditional.ColonToken = factory.NewToken(kindColonToken)
|
|
243
223
|
}
|
|
244
224
|
}
|
|
245
|
-
node.ForEachChild(func(child *
|
|
225
|
+
node.ForEachChild(func(child *shimast.Node) bool {
|
|
246
226
|
normalizeSyntheticTokens(child)
|
|
247
227
|
return false
|
|
248
228
|
})
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typia",
|
|
3
|
-
"version": "13.0.0-dev.
|
|
3
|
+
"version": "13.0.0-dev.20260511",
|
|
4
4
|
"description": "Superfast runtime validators with only one line",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
|
-
"types": "lib/index.d.ts",
|
|
7
6
|
"exports": {
|
|
8
7
|
".": {
|
|
9
8
|
"types": "./lib/index.d.ts",
|
|
@@ -45,8 +44,8 @@
|
|
|
45
44
|
"commander": "^10.0.0",
|
|
46
45
|
"inquirer": "^8.2.5",
|
|
47
46
|
"randexp": "^0.5.3",
|
|
48
|
-
"@typia/interface": "^13.0.0-dev.
|
|
49
|
-
"@typia/utils": "^13.0.0-dev.
|
|
47
|
+
"@typia/interface": "^13.0.0-dev.20260511",
|
|
48
|
+
"@typia/utils": "^13.0.0-dev.20260511"
|
|
50
49
|
},
|
|
51
50
|
"devDependencies": {
|
|
52
51
|
"@rollup/plugin-commonjs": "^29.0.0",
|
|
@@ -55,7 +54,7 @@
|
|
|
55
54
|
"@types/node": "^25.3.0",
|
|
56
55
|
"@typescript-eslint/eslint-plugin": "^8.1.0",
|
|
57
56
|
"@typescript-eslint/parser": "^8.1.0",
|
|
58
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
57
|
+
"@typescript/native-preview": "7.0.0-dev.20260510.1",
|
|
59
58
|
"chalk": "^4.0.0",
|
|
60
59
|
"eslint-plugin-deprecation": "^3.0.0",
|
|
61
60
|
"rimraf": "^6.1.2",
|
|
@@ -64,7 +63,7 @@
|
|
|
64
63
|
"rollup-plugin-node-externals": "^8.1.2",
|
|
65
64
|
"suppress-warnings": "^1.0.2",
|
|
66
65
|
"tinyglobby": "^0.2.12",
|
|
67
|
-
"ttsc": "^0.
|
|
66
|
+
"ttsc": "^0.10.0"
|
|
68
67
|
},
|
|
69
68
|
"sideEffects": [
|
|
70
69
|
"./lib/_virtual/*.mjs",
|
|
@@ -119,5 +118,6 @@
|
|
|
119
118
|
"build": "rimraf lib && ttsc && rollup -c && cp ../../README.md README.md",
|
|
120
119
|
"dev": "ttsc --watch"
|
|
121
120
|
},
|
|
121
|
+
"types": "lib/index.d.ts",
|
|
122
122
|
"module": "lib/index.mjs"
|
|
123
123
|
}
|
package/src/executable/typia.ts
CHANGED
|
@@ -43,7 +43,7 @@ const main = async (): Promise<void> => {
|
|
|
43
43
|
const type: string | undefined = process.argv[2];
|
|
44
44
|
if (type === "generate") {
|
|
45
45
|
loadNativePreview();
|
|
46
|
-
const { TypiaGenerateWizard } = await import("./TypiaGenerateWizard");
|
|
46
|
+
const { TypiaGenerateWizard } = await import("./TypiaGenerateWizard.js");
|
|
47
47
|
await TypiaGenerateWizard.generate();
|
|
48
48
|
} else halt(USAGE);
|
|
49
49
|
};
|
package/native/go.work
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
go 1.26
|
|
2
|
-
|
|
3
|
-
use (
|
|
4
|
-
.
|
|
5
|
-
./shim/printer
|
|
6
|
-
./third_party/ttsc
|
|
7
|
-
./third_party/ttsc/shim/ast
|
|
8
|
-
./third_party/ttsc/shim/bundled
|
|
9
|
-
./third_party/ttsc/shim/checker
|
|
10
|
-
./third_party/ttsc/shim/compiler
|
|
11
|
-
./third_party/ttsc/shim/core
|
|
12
|
-
./third_party/ttsc/shim/diagnosticwriter
|
|
13
|
-
./third_party/ttsc/shim/parser
|
|
14
|
-
./third_party/ttsc/shim/scanner
|
|
15
|
-
./third_party/ttsc/shim/tsoptions
|
|
16
|
-
./third_party/ttsc/shim/tspath
|
|
17
|
-
./third_party/ttsc/shim/vfs
|
|
18
|
-
./third_party/ttsc/shim/vfs/cachedvfs
|
|
19
|
-
./third_party/ttsc/shim/vfs/osvfs
|
|
20
|
-
)
|
package/native/go.work.sum
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
|
|
2
|
-
github.com/mackerelio/go-osstat v0.2.7/go.mod h1:dwpYh5pIPmvk+IEwBKNIWRFMB92mrC08CmXOhDC7nQk=
|
|
3
|
-
github.com/matryer/moq v0.7.1/go.mod h1:IabIiFkaKCyHxej25INgFR+fnOxSZFMv2LYrU+ioyDs=
|
|
4
|
-
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
|
5
|
-
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
|
6
|
-
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
|
7
|
-
golang.org/x/mod v0.35.0/go.mod h1:+GwiRhIInF8wPm+4AoT6L0FA1QWAad3OMdTRx4tFYlU=
|
|
8
|
-
golang.org/x/net v0.53.0/go.mod h1:JvMuJH7rrdiCfbeHoo3fCQU24Lf5JJwT9W3sJFulfgs=
|
|
9
|
-
golang.org/x/telemetry v0.0.0-20260409153401-be6f6cb8b1fa/go.mod h1:kHjTxDEnAu6/Nl9lDkzjWpR+bmKfxeiRuSDlsMb70gE=
|
|
10
|
-
golang.org/x/term v0.42.0/go.mod h1:Dq/D+snpsbazcBG5+F9Q1n2rXV8Ma+71xEjTRufARgY=
|
|
11
|
-
golang.org/x/tools v0.44.0/go.mod h1:KA0AfVErSdxRZIsOVipbv3rQhVXTnlU6UhKxHd1seDI=
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// Package driver wraps the typescript-go compiler so the rest of ttsc doesn't
|
|
2
|
-
// need to know about shim packages directly. It is the only part of the engine
|
|
3
|
-
// that imports `shim/*` by design — everything downstream consumes a small,
|
|
4
|
-
// shim-agnostic interface (`*Program`).
|
|
5
|
-
//
|
|
6
|
-
// Structural note: this file is deliberately adapted from tsgonest's
|
|
7
|
-
// `internal/compiler/host.go` (MIT, github.com/tsgonest/tsgonest).
|
|
8
|
-
// The helper surface is the same because both hosts need the same bundled-lib
|
|
9
|
-
// filesystem and CompilerHost construction.
|
|
10
|
-
package driver
|
|
11
|
-
|
|
12
|
-
import (
|
|
13
|
-
"github.com/microsoft/typescript-go/shim/bundled"
|
|
14
|
-
shimcompiler "github.com/microsoft/typescript-go/shim/compiler"
|
|
15
|
-
"github.com/microsoft/typescript-go/shim/vfs"
|
|
16
|
-
"github.com/microsoft/typescript-go/shim/vfs/cachedvfs"
|
|
17
|
-
"github.com/microsoft/typescript-go/shim/vfs/osvfs"
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
// DefaultFS returns an OS-backed filesystem wrapped with tsgo's bundled libs so
|
|
21
|
-
// built-in definitions (lib.es*.d.ts, dom, etc.) resolve without a network
|
|
22
|
-
// fetch. Mirrors tsgonest/tsgolint behavior.
|
|
23
|
-
func DefaultFS() vfs.FS {
|
|
24
|
-
return bundled.WrapFS(cachedvfs.From(osvfs.FS()))
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// DefaultHost returns a CompilerHost anchored at cwd that can find tsgo's
|
|
28
|
-
// bundled library files via `bundled.LibPath()`.
|
|
29
|
-
func DefaultHost(cwd string, fs vfs.FS) shimcompiler.CompilerHost {
|
|
30
|
-
return shimcompiler.NewCompilerHost(cwd, fs, bundled.LibPath(), nil, nil)
|
|
31
|
-
}
|