-
#185
7df9daeThanks @JounQin! - AddcreateInteractiveParser()for REPL-style chunked parsing. Eachwrite(chunk)returns the statements completed by that chunk, the unconsumed trailing text, and whether it is incomplete. -
#187
ac975adThanks @JounQin! - Updatemvdan.cc/sh/v3to a pinned commit containing the parser nesting limit,BraceExpwalk support, heredoc/Interactive fixes, and current AST fields. AST heredoc redirects now exposeclosePos, and split brace expansions retain their brace positions. Deeper JS/WASM transport handling, including the nesting limit's practical ceiling, remains tracked in #188.
- #180
8c770b7Thanks @JounQin! - Expose stable error classes and codes.ParseErrornow extendsShSyntaxError/SyntaxErrorand reportsname: "ParseError";InputErrorextendsTypeError; other syntax failures useShSyntaxErrorwith one ofSH_SYNTAX_LANGUAGE,SH_SYNTAX_PRINT, orSH_SYNTAX_SPLIT_BRACES.
-
#176
889d042Thanks @JounQin! - Use a generated binary wire for AST transport, removing the JSON parser andencoding/jsonfrom the WASM path. -
#173
ac1cbeeThanks @JounQin! -print(ast)now prints the current syntax tree, including edits made to its fields, instead of requiringoriginalText. -
#178
910c9a3Thanks @JounQin! -print(node)now prints printable syntax subtrees: files, statements, commands, words, word parts, and assigns. File output keeps its trailing newline; subtree output does not. -
#179
fec2d3fThanks @JounQin! - AddsplitBraces(word)returning{ word, changed }to split brace expressions intoBraceExpparts for analysis.changedis true when mvdan processed brace syntax, even if noBraceExpremains. The returned word keeps its original source span. Split literals lack source positions, while compositeBraceExpbounds may be derived from retained children and serialized. The printer cannot renderBraceExp; such trees are rejected explicitly.
-
#163
6235123Thanks @JounQin! - Addinit()to load the WASM runtime explicitly and cache it. The asyncparseandprintAPIs initialize automatically.init()now rejects when the Go program fails to start instead of reporting success and leaking an unhandled rejection. The browser entry now uses the sameinit()plus async API without top-level await. -
#162
532ecabThanks @JounQin! - AddcreateSourceIndex, which converts the AST's UTF-8 byte offsets to UTF-16 code-unit offsets for JavaScript string slicing. -
#167
68f9c6cThanks @JounQin! - Move the synchronous API to thesh-syntax/syncentry (Node and browser top-level await variants; workerd has no sync variant and fails at build/import time) and keep the root entry async-only. The oldparseSync/printSyncnames are nowparse/printfromsh-syntax/sync. -
#168
dcbe443Thanks @JounQin! - Surface Go startup failures from both asyncinit()and the synchronoussh-syntax/syncprocessor instead of leaking an unhandled rejection. -
#160
a3227deThanks @JounQin! - Add enter/exit visitors towalk: a function is theenterphase, an object may pair optionalenterwith requiredexit, and visitors receive(node, parent, prop, index). Returningfalsefromenterskips a node's children; returningfalsefromexitstops the walk. -
#164
94ee1abThanks @JounQin! - Add a dedicatedworkerdentry that imports the bundledmain.wasmas a compiled module and exports the same asyncinit/parse/printAPI.getProcessornow also accepts a compiledWebAssembly.Module.
- #157
d326627Thanks @JounQin! - Keep the vendored Go runtime in bundled builds by pointingsideEffectsatvendors/wasm_exec.cjsinstead of the renamedvendors/wasm_exec.js.
- #155
ac466ecThanks @JounQin! - Build WASM with standard Go instead of TinyGo. The standard Go GC removes the-gc=leakingmemory growth that made long-running synchronous parsing unsafe. The binary is larger; a fresh runtime has higher startup cost, although async reuse amortizes it.wasm-opt -Ozis used to trim the final artifact. The async processor now reuses one Go runtime and serializes calls, so it no longer pays WASM instantiation cost per call. That runtime retains the Go heap high-water mark for the processor lifetime; memory stays bounded but does not shrink after a large parse. The internalprocessABI changed, somain.wasmmust match the package version.
- #148
84a41e5Thanks @renovate! - Updatemvdan.cc/sh/v3to 3.14.1 and expose the newParamExpfieldsglobSubst,rcExpand, andsplit, and refresh the Go/TinyGo toolchain.
-
#145
8f2c8c6Thanks @JounQin! - Return the full shell syntax tree and keep printing source text.-
Node.js >=18 is required.
-
The AST is no longer Go-shaped. Fields are lowerCamelCase and node positions are explicit: use
node.type,start/end, and{ offset, line, column }objects instead ofPos/End,Stmts,Cmd,Parts,Value, and the other Go field names. -
ParseError/IParseErrorfields are renamed from Go style:Filename→filename,Incomplete→incomplete,Text→text, andPos→pos. -
Operator-valued fields (
op) now use the upstream numeric enum values instead of display strings. Typed constants such asRedirOperator,CaseOperator,ProcOperator, andBinAritOperatorare exported. -
Word.Litis gone; useparts.File.Lastis nowlastComments. -
print(ast)withoutoriginalTextis no longer supported and throws aTypeError. Printing an edited AST is deferred to a follow-up; the AST is currently a parse result, not a second input format.
parse()now returns every node and field frommvdan.cc/sh's syntax package instead of only positions. The tree is plain JSON-compatible data: every node hastype,start, andend; fields use lowerCamelCase; and position fields are{ offset, line, column }objects.- Add a
walk()helper for the typed tree; usenode.typeinstead of a node-type helper. - Public AST types are a discriminated union:
BaseNodeplus literaltypefields, withNode,Command,WordPart,Loop,ArithmExpr, andTestExprunions sonode.typenarrows in TypeScript. print()continues to format source text.print(ast, { originalText })andprocessor(ast, { originalText })remain accepted for tooling compatibility, but the AST is deliberately ignored andoriginalTextis formatted.getProcessor()caches the compiled WebAssembly module, usescompileStreaming()forapplication/wasmresponses, acceptsBuffer/BufferSource/Response/response-like sources, and instantiates a fresh runtime per call.- Add
parseSync()andprintSync()for bounded synchronous work, plusgetProcessorSync()for preloaded WASM bytes or a synchronous loader. Long-lived processes should use the async APIs; the TinyGo leaking GC means unbounded synchronous loops accumulate memory. - Positions recovered by
recoverErrorsnow exposerecovered: true.
-
-
#136
ecd5eb7Thanks @jjloneman! - Add zsh dialect support by rebuilding the WASM against a newermvdan/sh:- Rebuild
main.wasmagainstmvdan/shv3.13.1 (was v3.11.0) and expose thezshLangVariant. - Valid zsh such as
${0:A:h:h}now parses and prints instead of erroring withternary operator missing ? before :.
Breaking:
LangVariantis now a bit-flag enum (1 << iota) to matchmvdan/shv3.13, so every numeric value changed. Code using the exportedLangVariantconstants is unaffected; only code passing raw variant numbers needs updating:LangBash:0→1LangPOSIX:1→2LangMirBSDKorn:2→4LangBats:3→8LangZsh: (new) →16LangAuto:4→32
- Rebuild
-
#138
2aa922bThanks @JounQin! - FixFile.StmtsJSON field name to match themvdan/shsyntax library, correcting a serialization mismatch between the WASM runtime and TypeScript types. -
#139
eea166dThanks @JounQin! - Remove unusedtslibfrom dependencies.
- #97
28d68baThanks @JounQin! - chore: housekeeping, bumpmvdan/shandeasyjsondeps, upgradegotov1.23
-
e13b13aThanks @JounQin! - fix: add a trailing 0 for bytes, this should fix several known issuesfeat: drop node 14 support
- #52
487fee4Thanks @jlarmstrongiv! - fix: check property existence before patching