fix(publish): do not warn about excluded external modules in node_modules directory (#23173)

This commit is contained in:
David Sherret 2024-04-11 19:52:35 -04:00 committed by Bartek Iwańczuk
parent e5828a9585
commit 3f7f931716
No known key found for this signature in database
GPG Key ID: 0C6BCDDC3B3AD750
9 changed files with 50 additions and 2 deletions

View File

@ -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) {

View File

@ -0,0 +1,4 @@
{
"args": "publish --dry-run --allow-dirty",
"output": "publish.out"
}

View File

@ -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"]
}

View File

@ -0,0 +1,7 @@
import { add } from "package";
export function myAdd(a: number, b: number): number {
return add(a, b);
}
export { add };

View File

@ -0,0 +1 @@
export function add(a: number, b: number): number;

View File

@ -0,0 +1,3 @@
export function add(a, b) {
return a + b;
}

View File

@ -0,0 +1,4 @@
{
"main": "index.js",
"type": "module"
}

View File

@ -0,0 +1,5 @@
{
"dependencies": {
"package": "*"
}
}

View File

@ -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