-
-
Notifications
You must be signed in to change notification settings - Fork 616
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: expose added/removed compilation.*_dependencies to js side (#7522)
- Loading branch information
1 parent
d49b34f
commit 3867fe0
Showing
13 changed files
with
393 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
128 changes: 128 additions & 0 deletions
128
crates/rspack_binding_values/src/compilation/dependencies.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
use napi_derive::napi; | ||
use rspack_core::Compilation; | ||
|
||
#[napi] | ||
pub struct DependenciesDTO { | ||
pub(crate) compilation: &'static Compilation, | ||
} | ||
|
||
impl DependenciesDTO { | ||
pub(crate) fn new(compilation: &'static Compilation) -> Self { | ||
Self { compilation } | ||
} | ||
} | ||
|
||
#[napi] | ||
impl DependenciesDTO { | ||
#[napi(getter)] | ||
pub fn file_dependencies(&self) -> Vec<String> { | ||
self | ||
.compilation | ||
.file_dependencies() | ||
.0 | ||
.map(|i| i.to_string_lossy().to_string()) | ||
.collect() | ||
} | ||
#[napi(getter)] | ||
pub fn added_file_dependencies(&self) -> Vec<String> { | ||
self | ||
.compilation | ||
.file_dependencies() | ||
.1 | ||
.map(|i| i.to_string_lossy().to_string()) | ||
.collect() | ||
} | ||
#[napi(getter)] | ||
pub fn removed_file_dependencies(&self) -> Vec<String> { | ||
self | ||
.compilation | ||
.file_dependencies() | ||
.2 | ||
.map(|i| i.to_string_lossy().to_string()) | ||
.collect() | ||
} | ||
|
||
#[napi(getter)] | ||
pub fn context_dependencies(&self) -> Vec<String> { | ||
self | ||
.compilation | ||
.context_dependencies() | ||
.0 | ||
.map(|i| i.to_string_lossy().to_string()) | ||
.collect() | ||
} | ||
#[napi(getter)] | ||
pub fn added_context_dependencies(&self) -> Vec<String> { | ||
self | ||
.compilation | ||
.context_dependencies() | ||
.1 | ||
.map(|i| i.to_string_lossy().to_string()) | ||
.collect() | ||
} | ||
#[napi(getter)] | ||
pub fn removed_context_dependencies(&self) -> Vec<String> { | ||
self | ||
.compilation | ||
.context_dependencies() | ||
.2 | ||
.map(|i| i.to_string_lossy().to_string()) | ||
.collect() | ||
} | ||
|
||
#[napi(getter)] | ||
pub fn missing_dependencies(&self) -> Vec<String> { | ||
self | ||
.compilation | ||
.missing_dependencies() | ||
.0 | ||
.map(|i| i.to_string_lossy().to_string()) | ||
.collect() | ||
} | ||
#[napi(getter)] | ||
pub fn added_missing_dependencies(&self) -> Vec<String> { | ||
self | ||
.compilation | ||
.missing_dependencies() | ||
.1 | ||
.map(|i| i.to_string_lossy().to_string()) | ||
.collect() | ||
} | ||
#[napi(getter)] | ||
pub fn removed_missing_dependencies(&self) -> Vec<String> { | ||
self | ||
.compilation | ||
.missing_dependencies() | ||
.2 | ||
.map(|i| i.to_string_lossy().to_string()) | ||
.collect() | ||
} | ||
|
||
#[napi(getter)] | ||
pub fn build_dependencies(&self) -> Vec<String> { | ||
self | ||
.compilation | ||
.build_dependencies() | ||
.0 | ||
.map(|i| i.to_string_lossy().to_string()) | ||
.collect() | ||
} | ||
#[napi(getter)] | ||
pub fn added_build_dependencies(&self) -> Vec<String> { | ||
self | ||
.compilation | ||
.build_dependencies() | ||
.1 | ||
.map(|i| i.to_string_lossy().to_string()) | ||
.collect() | ||
} | ||
#[napi(getter)] | ||
pub fn removed_build_dependencies(&self) -> Vec<String> { | ||
self | ||
.compilation | ||
.build_dependencies() | ||
.2 | ||
.map(|i| i.to_string_lossy().to_string()) | ||
.collect() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
3867fe0
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.
📝 Ran ecosystem CI: Open
3867fe0
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.
📝 Benchmark detail: Open