From 3d4e6c77a03a4bbb6552608463af8a7528484aa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Wed, 24 Jan 2024 13:50:55 +0900 Subject: [PATCH] Remove `stripComponents` --- src/swc/util.ts | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/swc/util.ts b/src/swc/util.ts index 3784ee5..f61b156 100644 --- a/src/swc/util.ts +++ b/src/swc/util.ts @@ -126,25 +126,10 @@ export function assertCompilationResult( } } -/** - * Removes the leading directory, including all parent relative paths - */ -function stripComponents(filename: string) { - const components = filename.split("/").slice(1); - if (!components.length) { - return filename; - } - while (components[0] === "..") { - components.shift(); - } - return components.join("/"); -} - const cwd = process.cwd(); export function getDest(filename: string, outDir: string, ext?: string) { - const relativePath = slash(relative(cwd, filename)); - let base = stripComponents(relativePath); + let base = slash(relative(cwd, filename)); if (ext) { base = base.replace(/\.\w*$/, ext); }