mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 17:34:47 -05:00
fix(tools/publish): correctly handle importing from self in unfurling (#22774)
We emitted `import "./` rather than `import "./$NAME"`. This is now fixed. Also makes a cosmetic change so that `../` imports are now just imported as `../`, not `./../`.
This commit is contained in:
parent
f0ec4fe1b8
commit
87a08fc3b2
1 changed files with 11 additions and 1 deletions
|
@ -280,7 +280,15 @@ fn relative_url(
|
||||||
referrer: &ModuleSpecifier,
|
referrer: &ModuleSpecifier,
|
||||||
) -> String {
|
) -> String {
|
||||||
if resolved.scheme() == "file" {
|
if resolved.scheme() == "file" {
|
||||||
format!("./{}", referrer.make_relative(resolved).unwrap())
|
let relative = referrer.make_relative(resolved).unwrap();
|
||||||
|
if relative.is_empty() {
|
||||||
|
let last = resolved.path_segments().unwrap().last().unwrap();
|
||||||
|
format!("./{last}")
|
||||||
|
} else if relative.starts_with("../") {
|
||||||
|
relative
|
||||||
|
} else {
|
||||||
|
format!("./{relative}")
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
resolved.to_string()
|
resolved.to_string()
|
||||||
}
|
}
|
||||||
|
@ -380,6 +388,7 @@ import chalk from "chalk";
|
||||||
import baz from "./baz";
|
import baz from "./baz";
|
||||||
import b from "./b.js";
|
import b from "./b.js";
|
||||||
import b2 from "./b";
|
import b2 from "./b";
|
||||||
|
import "./mod.ts";
|
||||||
import url from "url";
|
import url from "url";
|
||||||
// TODO: unfurl these to jsr
|
// TODO: unfurl these to jsr
|
||||||
// import "npm:@jsr/std__fs@1/file";
|
// import "npm:@jsr/std__fs@1/file";
|
||||||
|
@ -428,6 +437,7 @@ import chalk from "npm:chalk@5";
|
||||||
import baz from "./baz/index.js";
|
import baz from "./baz/index.js";
|
||||||
import b from "./b.ts";
|
import b from "./b.ts";
|
||||||
import b2 from "./b.ts";
|
import b2 from "./b.ts";
|
||||||
|
import "./mod.ts";
|
||||||
import url from "node:url";
|
import url from "node:url";
|
||||||
// TODO: unfurl these to jsr
|
// TODO: unfurl these to jsr
|
||||||
// import "npm:@jsr/std__fs@1/file";
|
// import "npm:@jsr/std__fs@1/file";
|
||||||
|
|
Loading…
Add table
Reference in a new issue