@@ -14,7 +14,6 @@ import (
14
14
"oss.terrastruct.com/d2/d2format"
15
15
"oss.terrastruct.com/d2/d2oracle"
16
16
"oss.terrastruct.com/d2/d2parser"
17
- "oss.terrastruct.com/d2/d2target"
18
17
"oss.terrastruct.com/d2/lib/urlenc"
19
18
)
20
19
@@ -128,11 +127,10 @@ type jsObject struct {
128
127
}
129
128
130
129
type jsParseResponse struct {
131
- DSL string `json:"dsl"`
132
- Texts []* d2target.MText `json:"texts"`
133
- ParseError string `json:"parseError"`
134
- UserError string `json:"userError"`
135
- D2Error string `json:"d2Error"`
130
+ DSL string `json:"dsl"`
131
+ ParseError string `json:"parseError"`
132
+ UserError string `json:"userError"`
133
+ D2Error string `json:"d2Error"`
136
134
}
137
135
138
136
type blockFS struct {}
@@ -177,11 +175,14 @@ func jsParse(this js.Value, args []js.Value) interface{} {
177
175
return string (str )
178
176
}
179
177
180
- resp := jsParseResponse {
181
- Texts : g .Texts (),
178
+ m , err := d2parser .Parse ("" , strings .NewReader (dsl ), nil )
179
+ if err != nil {
180
+ return err
182
181
}
183
182
184
- newDSL := d2format .Format (g .AST )
183
+ resp := jsParseResponse {}
184
+
185
+ newDSL := d2format .Format (m )
185
186
if dsl != newDSL {
186
187
resp .DSL = newDSL
187
188
}
0 commit comments