mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
fix(publish): remove incorrect relative-package-import
diagnostic when root of workspace is package (#30333)
This commit is contained in:
parent
2b50970347
commit
0f865b474b
6 changed files with 23 additions and 15 deletions
|
@ -1123,7 +1123,6 @@ fn collect_excluded_module_diagnostics(
|
|||
}
|
||||
|
||||
if !had_excluded_specifier {
|
||||
let mut found_outside_specifier = false;
|
||||
// ensure no path being published references another package
|
||||
// via a relative import
|
||||
for publish_path in publish_paths {
|
||||
|
@ -1148,7 +1147,6 @@ fn collect_excluded_module_diagnostics(
|
|||
}
|
||||
});
|
||||
if let Some((outside_res, package)) = maybe_res.next() {
|
||||
found_outside_specifier = true;
|
||||
diagnostics_collector.push(
|
||||
PublishDiagnostic::RelativePackageImport {
|
||||
// Wasm modules won't have a referrer
|
||||
|
@ -1166,19 +1164,6 @@ fn collect_excluded_module_diagnostics(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !found_outside_specifier {
|
||||
// just in case we didn't find an outside specifier above, add
|
||||
// diagnostics for all the specifiers found outside the package
|
||||
for (specifier, to_package) in outside_specifiers {
|
||||
diagnostics_collector.push(PublishDiagnostic::RelativePackageImport {
|
||||
specifier: specifier.clone(),
|
||||
from_package_name: current_package_name.to_string(),
|
||||
to_package_name: to_package.name.clone(),
|
||||
maybe_referrer: None,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"args": "publish --dry-run",
|
||||
// should succeed
|
||||
"output": "[WILDCARD]"
|
||||
}
|
9
tests/specs/publish/workspace_root_package/deno.json
Normal file
9
tests/specs/publish/workspace_root_package/deno.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"name": "@scope/package-a",
|
||||
"version": "0.1.0",
|
||||
"license": "MIT",
|
||||
"workspace": [
|
||||
"./package-b"
|
||||
],
|
||||
"exports": "./mod.ts"
|
||||
}
|
3
tests/specs/publish/workspace_root_package/mod.ts
Normal file
3
tests/specs/publish/workspace_root_package/mod.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
import { Test } from "@scope/package-b";
|
||||
|
||||
export { Test };
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"name": "@scope/package-b",
|
||||
"version": "0.1.0",
|
||||
"exports": "./mod.ts"
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
export class Test {}
|
Loading…
Add table
Add a link
Reference in a new issue