Commit 215f100
authored
feat(BREAKING): drop the deno_ast dependency (#810)
This crate only used `deno_ast` for parsing and its parse diagnostics — everything else it needed already came from dprint-swc-ext, which `deno_ast` re-exports. It now parses with swc directly and owns its diagnostics, dropping 17 crates from the dependency graph.
A `deno_ast` user can still hand over an already parsed AST with its comments via dprint-swc-ext's `ProgramInfoProvider` trait, so nothing has to be parsed twice.
Breaking changes:
- `format_parsed_source` takes `FormatParsedSourceOptions` and is generic over `ProgramInfoProvider`, so it accepts a parsed source from any crate. It no longer checks the parse diagnostics, since it can't for a source it didn't parse — `parse_program` does that instead, and `is_unsupported_syntax_error` is public for callers that parse elsewhere.
- The formatting entrypoints take the swc `Syntax` the file was parsed with rather than a media type.
- `format_text` takes the file text as an `Arc<str>`.
Diagnostic messages are unchanged.1 parent 0f42b28 commit 215f100
27 files changed
Lines changed: 1750 additions & 609 deletions
File tree
- src
- generation
- sorting
- swc
- parsing
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | 34 | | |
36 | 35 | | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
| 1 | + | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
0 commit comments