mirror of
https://github.com/withastro/astro.git
synced 2024-12-23 21:53:55 -05:00
[ci] format
This commit is contained in:
parent
f27ca6ab3e
commit
e5fd0a4946
1 changed files with 4 additions and 3 deletions
|
@ -9,9 +9,9 @@ import ancestor from 'common-ancestor-path';
|
||||||
import esbuild from 'esbuild';
|
import esbuild from 'esbuild';
|
||||||
import slash from 'slash';
|
import slash from 'slash';
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
|
import { cachedCompilation, CompileProps, getCachedSource } from '../core/compile/index.js';
|
||||||
import { isRelativePath, prependForwardSlash, startsWithForwardSlash } from '../core/path.js';
|
import { isRelativePath, prependForwardSlash, startsWithForwardSlash } from '../core/path.js';
|
||||||
import { viteID } from '../core/util.js';
|
import { viteID } from '../core/util.js';
|
||||||
import { cachedCompilation, CompileProps, getCachedSource } from '../core/compile/index.js';
|
|
||||||
import { getFileInfo } from '../vite-plugin-utils/index.js';
|
import { getFileInfo } from '../vite-plugin-utils/index.js';
|
||||||
import {
|
import {
|
||||||
createTransformStyles,
|
createTransformStyles,
|
||||||
|
@ -49,7 +49,8 @@ export default function astro({ config, logging }: AstroPluginOptions): vite.Plu
|
||||||
// Variables for determining if an id starts with /src...
|
// Variables for determining if an id starts with /src...
|
||||||
const srcRootWeb = config.srcDir.pathname.slice(config.root.pathname.length - 1);
|
const srcRootWeb = config.srcDir.pathname.slice(config.root.pathname.length - 1);
|
||||||
const isBrowserPath = (path: string) => path.startsWith(srcRootWeb);
|
const isBrowserPath = (path: string) => path.startsWith(srcRootWeb);
|
||||||
const isFullFilePath = (path: string) => path.startsWith(prependForwardSlash(slash(fileURLToPath(config.root))));
|
const isFullFilePath = (path: string) =>
|
||||||
|
path.startsWith(prependForwardSlash(slash(fileURLToPath(config.root))));
|
||||||
|
|
||||||
function resolveRelativeFromAstroParent(id: string, parsedFrom: ParsedRequestResult): string {
|
function resolveRelativeFromAstroParent(id: string, parsedFrom: ParsedRequestResult): string {
|
||||||
const filename = normalizeFilename(parsedFrom.filename);
|
const filename = normalizeFilename(parsedFrom.filename);
|
||||||
|
@ -97,7 +98,7 @@ export default function astro({ config, logging }: AstroPluginOptions): vite.Plu
|
||||||
return relativeToRoot(id);
|
return relativeToRoot(id);
|
||||||
}
|
}
|
||||||
// Convert file paths to ViteID, meaning on Windows it omits the leading slash
|
// Convert file paths to ViteID, meaning on Windows it omits the leading slash
|
||||||
if(isFullFilePath(id)) {
|
if (isFullFilePath(id)) {
|
||||||
return viteID(new URL('file://' + id));
|
return viteID(new URL('file://' + id));
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
|
|
Loading…
Reference in a new issue