From 62f7d81ad416e1a9fab46c7a96d81aa33a26ea63 Mon Sep 17 00:00:00 2001 From: JaCraig Date: Wed, 23 Oct 2024 10:34:55 -0400 Subject: [PATCH] fix(typescript): fix path validation issue in validatePaths function Current code allows paths that are below the 'file' option but not nested directories. For example if file option is set to "C:/examplelib/output" then "C:/examplelib" is fine while "C:/examplelib/output/decl" is not. The order change in this commit fixes this issue introduced in 12.1.1. --- packages/typescript/src/options/validate.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/typescript/src/options/validate.ts b/packages/typescript/src/options/validate.ts index ae53834a3..c772ac0c1 100644 --- a/packages/typescript/src/options/validate.ts +++ b/packages/typescript/src/options/validate.ts @@ -66,7 +66,7 @@ export function validatePaths( ); } } else { - const fromTsDirToRollup = relative(compilerOptions[dirProperty]!, outputDir); + const fromTsDirToRollup = relative(outputDir, compilerOptions[dirProperty]!); if (fromTsDirToRollup.startsWith('..')) { context.error( `@rollup/plugin-typescript: Path of Typescript compiler option '${dirProperty}' must be located inside the same directory as the Rollup 'file' option.`