Skip to content

Commit

Permalink
fix(publish): do not warn about excluded external modules in node_mod…
Browse files Browse the repository at this point in the history
…ules directory (#23173)
  • Loading branch information
dsherret authored and bartlomieju committed Apr 12, 2024
1 parent e5828a9 commit 3f7f931
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cli/tools/registry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,15 @@ fn collect_excluded_module_diagnostics(
return;
};
let specifiers = graph
.specifiers()
.map(|(s, _)| s)
.modules()
.filter_map(|m| match m {
deno_graph::Module::Js(_) | deno_graph::Module::Json(_) => {
Some(m.specifier())
}
deno_graph::Module::Npm(_)
| deno_graph::Module::Node(_)
| deno_graph::Module::External(_) => None,
})
.filter(|s| s.as_str().starts_with(root.as_str()));
for specifier in specifiers {
if !file_patterns.matches_specifier(specifier) {
Expand Down
4 changes: 4 additions & 0 deletions tests/specs/publish/byonm_dep/__test__.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"args": "publish --dry-run --allow-dirty",
"output": "publish.out"
}
11 changes: 11 additions & 0 deletions tests/specs/publish/byonm_dep/deno.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@scope/package",
"version": "0.0.0",
"exports": "./mod.ts",
"publish": {
// this was previously causing issues because it would cause
// external modules in the node_modules directory to be ignored
"include": ["mod.ts"]
},
"unstable": ["byonm", "sloppy-imports"]
}
7 changes: 7 additions & 0 deletions tests/specs/publish/byonm_dep/mod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { add } from "package";

export function myAdd(a: number, b: number): number {
return add(a, b);
}

export { add };

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions tests/specs/publish/byonm_dep/node_modules/package/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions tests/specs/publish/byonm_dep/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"package": "*"
}
}
6 changes: 6 additions & 0 deletions tests/specs/publish/byonm_dep/publish.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Check file:///[WILDLINE]/mod.ts
Checking for slow types in the public API...
Check file:///[WILDLINE]/mod.ts
Simulating publish of @scope/package@0.0.0 with files:
file:///[WILDLINE]/mod.ts (129B)
Warning Aborting due to --dry-run

0 comments on commit 3f7f931

Please sign in to comment.