Buy the grammar, own the execution: @yarnpkg/parsers parses the command line - aliased at bundle time to its shell entry so the root barrel's syml/js-yaml closure stays out of the worker - and a VFS-backed evaluator with a coreutils command table runs it inside the worker host. Each shell process is a real child WebWorker spawned from the same bundle (the first frame decides the role), so the TERM-then-KILL ladder is real - TERM requests, KILL terminates the worker - and the file face stays asynchronous end to end, since the deployment target serves no COOP/COEP headers and SharedArrayBuffer never exists there. node:child_process reports through the ChildProcess surface the subprocess service consumes; execSync, execFileSync and fork refuse, and node-pty stays stubbed.
24 lines
1.0 KiB
TypeScript
24 lines
1.0 KiB
TypeScript
/**
|
|
* The parsed command line, as this shell names it.
|
|
*
|
|
* `@yarnpkg/parsers` re-exports only part of its grammar's type map from the
|
|
* package root, and its `exports` field forbids reaching the grammar module
|
|
* directly, so the three missing members are derived from the ones it does
|
|
* publish. `CommandChain` is `Command` plus an optional pipeline link, which
|
|
* makes it usable wherever a command node is expected.
|
|
* @module @deepseek-ai/dsh-experimental-webworker-runtime/src/shell/ast
|
|
*/
|
|
|
|
import type { Argument, CommandChain } from '@yarnpkg/parsers'
|
|
|
|
export type { ArgumentSegment, ArithmeticExpression, CommandChain, CommandLine, ShellLine } from '@yarnpkg/parsers'
|
|
|
|
/** One command node: a program call, a subshell, a group, or bare assignments. */
|
|
export type Command = CommandChain
|
|
|
|
/** An argument that becomes argv fields. */
|
|
export type ValueArgument = Extract<Argument, { type: 'argument' }>
|
|
|
|
/** An argument that rewires a descriptor instead of becoming argv. */
|
|
export type RedirectArgument = Extract<Argument, { type: 'redirection' }>
|