From c57e0c9ce05d79376649e8d2fba6c86ae2bb8939 Mon Sep 17 00:00:00 2001 From: Hiroki Osame Date: Thu, 29 Aug 2024 11:39:59 +0900 Subject: [PATCH] refactor: rename normalize-path to normalize-relative-path --- src/parse-tsconfig/index.ts | 9 +++++---- .../{normalize-path.ts => normalize-relative-path.ts} | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) rename src/utils/{normalize-path.ts => normalize-relative-path.ts} (79%) diff --git a/src/parse-tsconfig/index.ts b/src/parse-tsconfig/index.ts index 1da91f5..3fed68a 100644 --- a/src/parse-tsconfig/index.ts +++ b/src/parse-tsconfig/index.ts @@ -1,7 +1,7 @@ import path from 'node:path'; import slash from 'slash'; import type { TsConfigJson, TsConfigJsonResolved, Cache } from '../types.js'; -import { normalizePath } from '../utils/normalize-path.js'; +import { normalizeRelativePath } from '../utils/normalize-relative-path.js'; import { readJsonc } from '../utils/read-jsonc.js'; import { implicitBaseUrlSymbol } from '../utils/symbols.js'; import { resolveExtendsPath } from './resolve-extends-path.js'; @@ -164,7 +164,7 @@ const _parseTsconfig = ( const unresolvedPath = compilerOptions[property]; if (unresolvedPath) { const resolvedBaseUrl = path.resolve(directoryPath, unresolvedPath); - const relativeBaseUrl = normalizePath(path.relative( + const relativeBaseUrl = normalizeRelativePath(path.relative( directoryPath, resolvedBaseUrl, )); @@ -181,14 +181,15 @@ const _parseTsconfig = ( if (!config.exclude.includes(outDir)) { config.exclude.push(outDir); } - compilerOptions.outDir = normalizePath(outDir); + + compilerOptions.outDir = normalizeRelativePath(outDir); } } else { config.compilerOptions = {}; } if (config.files) { - config.files = config.files.map(normalizePath); + config.files = config.files.map(normalizeRelativePath); } if (config.include) { diff --git a/src/utils/normalize-path.ts b/src/utils/normalize-relative-path.ts similarity index 79% rename from src/utils/normalize-path.ts rename to src/utils/normalize-relative-path.ts index 39948e3..2150890 100644 --- a/src/utils/normalize-path.ts +++ b/src/utils/normalize-relative-path.ts @@ -1,7 +1,7 @@ import slash from 'slash'; import { isRelativePathPattern } from './is-relative-path-pattern.js'; -export const normalizePath = (filePath: string) => { +export const normalizeRelativePath = (filePath: string) => { const normalizedPath = slash(filePath); return isRelativePathPattern.test(normalizedPath) ? normalizedPath