-
-
Notifications
You must be signed in to change notification settings - Fork 781
Closed
Labels
Description
What problem does this feature solve?
Among many dependencies, they mark the scope of the dependency as span, range, or start&end. This behavior is very chaotic in Dependency.
rspack/crates/rspack_plugin_javascript/src/dependency/esm/harmony_export_header_dependency.rs
Lines 11 to 16 in f37741c
| pub struct HarmonyExportHeaderDependency { | |
| id: DependencyId, | |
| loc: ErrorLocation, | |
| range: Option<ErrorSpan>, | |
| range_stmt: ErrorSpan, | |
| } |
rspack/crates/rspack_plugin_javascript/src/dependency/esm/harmony_import_dependency.rs
Lines 43 to 54 in f37741c
| pub struct HarmonyImportSideEffectDependency { | |
| pub request: Atom, | |
| pub source_order: i32, | |
| pub id: DependencyId, | |
| pub loc: ErrorLocation, | |
| pub span: ErrorSpan, | |
| pub source_span: ErrorSpan, | |
| pub dependency_type: DependencyType, | |
| pub export_all: bool, | |
| attributes: Option<ImportAttributes>, | |
| resource_identifier: String, | |
| } |
| pub struct CachedConstDependency { | |
| pub start: u32, | |
| pub end: u32, | |
| pub identifier: Box<str>, | |
| pub content: Box<str>, | |
| } |
This 0-based range is based on the 1-based SWC's Span conversion, and I think we should name it range which used in webpack to avoid ambiguity.
In addition, I think it may be better to name the types of loc and range as DependencyLocation and DependencyRange.
What's your opinion? @h-a-n-a
What does the proposed API of configuration look like?
pub struct Dependency {
loc: DependencyLocation,
range: DependencyRange
}### Tasks
- [ ] https://github.com/web-infra-dev/rspack/issues/7336
- [ ] https://github.com/web-infra-dev/rspack/pull/7576
- [ ] https://github.com/web-infra-dev/rspack/pull/7635
- [ ] https://github.com/web-infra-dev/rspack/pull/7641
- [ ] https://github.com/web-infra-dev/rspack/pull/7671
- [ ] https://github.com/web-infra-dev/rspack/pull/7841
- [ ] https://github.com/web-infra-dev/rspack/pull/7871
- [ ] https://github.com/web-infra-dev/rspack/pull/7892
Reactions are currently unavailable