Skip to content

Commit

Permalink
refactor: remove ensureVolumeInPath (#12690)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red authored Apr 1, 2023
1 parent 050c0f9 commit a3150ee
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 11 deletions.
4 changes: 1 addition & 3 deletions packages/vite/src/node/plugins/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
cleanUrl,
createDebugger,
deepImportRE,
ensureVolumeInPath,
fsPathFromId,
injectQuery,
isBuiltin,
Expand Down Expand Up @@ -203,7 +202,7 @@ export function resolvePlugin(resolveOptions: InternalResolveOptions): Plugin {
if (asSrc && depsOptimizer?.isOptimizedDepUrl(id)) {
const optimizedPath = id.startsWith(FS_PREFIX)
? fsPathFromId(id)
: normalizePath(ensureVolumeInPath(path.resolve(root, id.slice(1))))
: normalizePath(path.resolve(root, id.slice(1)))
return optimizedPath
}

Expand Down Expand Up @@ -1250,7 +1249,6 @@ function equalWithoutSuffix(path: string, key: string, suffix: string) {
}

function getRealPath(resolved: string, preserveSymlinks?: boolean): string {
resolved = ensureVolumeInPath(resolved)
if (!preserveSymlinks && browserExternalId !== resolved) {
resolved = safeRealpathSync(resolved)
}
Expand Down
5 changes: 1 addition & 4 deletions packages/vite/src/node/server/middlewares/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import type { ViteDevServer } from '..'
import {
cleanUrl,
createDebugger,
ensureVolumeInPath,
fsPathFromId,
injectQuery,
isImportRequest,
Expand Down Expand Up @@ -79,9 +78,7 @@ export function transformMiddleware(
// means that the dependency has already been pre-bundled and loaded
const sourcemapPath = url.startsWith(FS_PREFIX)
? fsPathFromId(url)
: normalizePath(
ensureVolumeInPath(path.resolve(root, url.slice(1))),
)
: normalizePath(path.resolve(root, url.slice(1)))
try {
const map = JSON.parse(
await fsp.readFile(sourcemapPath, 'utf-8'),
Expand Down
4 changes: 0 additions & 4 deletions packages/vite/src/node/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,6 @@ export function isParentDirectory(dir: string, file: string): boolean {
)
}

export function ensureVolumeInPath(file: string): string {
return isWindows ? path.resolve(file) : file
}

export const queryRE = /\?.*$/s

const postfixRE = /[?#].*$/s
Expand Down

0 comments on commit a3150ee

Please sign in to comment.