chore: better var name
This commit is contained in:
parent
ec2dbd8a30
commit
87e9e072cf
1 changed files with 6 additions and 2 deletions
|
@ -151,7 +151,11 @@ export function relativeToSrcDir(config: AstroConfig, idOrUrl: URL | string) {
|
||||||
return id.slice(slash(fileURLToPath(config.srcDir)).length);
|
return id.slice(slash(fileURLToPath(config.srcDir)).length);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function rootRelativePath(root: URL, idOrUrl: URL | string, prependSlash = true) {
|
export function rootRelativePath(
|
||||||
|
root: URL,
|
||||||
|
idOrUrl: URL | string,
|
||||||
|
shouldPrependForwardSlash = true
|
||||||
|
) {
|
||||||
let id: string;
|
let id: string;
|
||||||
if (typeof idOrUrl !== 'string') {
|
if (typeof idOrUrl !== 'string') {
|
||||||
id = unwrapId(viteID(idOrUrl));
|
id = unwrapId(viteID(idOrUrl));
|
||||||
|
@ -162,7 +166,7 @@ export function rootRelativePath(root: URL, idOrUrl: URL | string, prependSlash
|
||||||
if (id.startsWith(normalizedRoot)) {
|
if (id.startsWith(normalizedRoot)) {
|
||||||
id = id.slice(normalizedRoot.length);
|
id = id.slice(normalizedRoot.length);
|
||||||
}
|
}
|
||||||
return prependSlash ? prependForwardSlash(id) : id;
|
return shouldPrependForwardSlash ? prependForwardSlash(id) : id;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function emoji(char: string, fallback: string) {
|
export function emoji(char: string, fallback: string) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue