-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] feat: expose AST parser API to Deno namespace. #6893
Conversation
What is the reason for taking a file name and reading the file instead of passing name and source code to |
I think we're supposed to support both: namespace Deno {
export type AstOptions = {
/** Name of the file or URL of the module. Where applicable, it will be
* downloaded and cached before being parsed. */
name: string;
// Other options...
} | {
/** Source of the module. It will be parsed without side-effect. */
source: string;
// Other options...
};;
export function ast(options: AstOptions): Module;
} Or even simpler if the name should be provided either way. |
|
||
// --- AST Nodes --- | ||
|
||
export interface Span { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these being put into the global scope or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, these are the AST return types but I'm unable to refer the Module
type in deno.unstable.d.ts
We are having an internal debate about whether we actually want this feature - we can't reach consensus. Because of that I don't want to land for 1.3.0. Removing the milestone. |
Closes #3983
Exposes
swc
's AST parser API to the runtime behind the--unstable
flag.Prior Art:
N/A - this feature is specific to the runtime compiler ops.
Corresponding command:
deno ast file.ts --unstable
Points:
swc_utils.rs
typescript
's AST as it is faster and much easier to serialise..d.ts
.