Skip to content

Commit

Permalink
feat: support rspack native plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
LingyuCoder committed Jan 17, 2025
1 parent 9443de6 commit 9b7b783
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
7 changes: 6 additions & 1 deletion crates/rspack_plugin_rsdoctor/src/module_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,12 @@ pub fn collect_module_dependencies(
.dependency_by_id(&conn.dependency_id)?
.as_module_dependency()?;

if matches!(dep.dependency_type(), DependencyType::CjsSelfReference) {
if matches!(
dep.dependency_type(),
DependencyType::CjsSelfReference
| DependencyType::EsmExportImportedSpecifier
| DependencyType::EsmImportSpecifier
) {
return None;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,16 @@ module.exports = {
const hooks = RsdoctorPlugin.getCompilationHooks(compilation);
hooks.moduleGraph.tap("TestPlugin::Dependencies", (moduleGraph) => {
const { dependencies } = moduleGraph;
const deps = dependencies.map(dep => dep.request).filter((v, idx, arr) => arr.indexOf(v) === idx);
deps.sort((a, b) => a > b ? 1 : -1);
expect(deps).toEqual(["./b", "./c", "./lib/a"]);
const deps = dependencies.map(dep => ({
request: dep.request,
kind: dep.kind
}));
deps.sort((a, b) => a.request > b.request ? 1 : -1);
expect(deps).toEqual([
{ request: "./b", "kind": "esm export" },
{ request: "./c", "kind": "esm export" },
{ request: "./lib/a", "kind": "esm import" }
]);
});
});
}
Expand Down

0 comments on commit 9b7b783

Please sign in to comment.