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
feat: subset type graph for JSR dependencies #346
Conversation
src/ast.rs
Outdated
@@ -48,48 +49,35 @@ static PATH_REFERENCE_RE: Lazy<Regex> = | |||
static TYPES_REFERENCE_RE: Lazy<Regex> = | |||
Lazy::new(|| Regex::new(r#"(?i)\stypes\s*=\s*["']([^"']*)["']"#).unwrap()); | |||
|
|||
pub struct ModuleParseOptions<'a> { |
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.
Not thrilled with this name. There is already a ParseModuleOptions
in the root. Any suggestions on a better name?
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.
Yikes, this is gonna be confusing 😬 maybe just ParseOptions
?
fn get_scope_analysis_parsed_source( | ||
&self, | ||
specifier: &ModuleSpecifier, | ||
) -> Option<ParsedSource>; |
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.
This enables lazily upgrading a parsed source to have scope analysis only if it's needed, which simplifies the code quite a bit.
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.
This file contains the main public API changes.
// n.decorators.clear(); | ||
// n.value = None; | ||
// Ok(true) | ||
todo!("Remove auto-accessor for now. Waiting on https://github.com/swc-project/swc/pull/8436") |
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.
I'm waiting on this PR for this. I think this is ok to do for now because barely anyone uses accessors.
@@ -3767,9 +3868,79 @@ impl<'a, 'graph> Builder<'a, 'graph> { | |||
} | |||
module_slot | |||
} | |||
|
|||
#[cfg(feature = "fast_check")] | |||
fn create_fast_check_type_graph(&mut self) { |
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.
This currently doesn't support caching this fast check type graph. I will add that in #347 as this PR is already large enough.
…otherwise. - Ensure `cargo test` passes with no-default-features
@@ -44,14 +44,19 @@ jobs: | |||
- name: Lint | |||
if: contains(matrix.os, 'ubuntu') | |||
run: | | |||
cargo clippy --locked --release --all-features --all-targets -- -D clippy::all |
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.
Is there a reason besides CI time to not use --release
?
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.
None of the code has conditions based on release or debug, so it's faster to just do debug on the CI.
src/ast.rs
Outdated
@@ -48,48 +49,35 @@ static PATH_REFERENCE_RE: Lazy<Regex> = | |||
static TYPES_REFERENCE_RE: Lazy<Regex> = | |||
Lazy::new(|| Regex::new(r#"(?i)\stypes\s*=\s*["']([^"']*)["']"#).unwrap()); | |||
|
|||
pub struct ModuleParseOptions<'a> { |
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.
Yikes, this is gonna be confusing 😬 maybe just ParseOptions
?
This is the first pass on adding a subset type graph for JSR dependencies. This type graph can then be provided to TypeScript instead of the original sources, causing very fast type checking and enabling the ability to distribute performant TypeScript as sources.
This is currently being called "fast check".