From 58fb4176e9f3aae1aa38deac874830079caa88de Mon Sep 17 00:00:00 2001 From: Ben Scott <227292+BPScott@users.noreply.github.com> Date: Fri, 26 Sep 2025 16:19:30 -0700 Subject: [PATCH 1/2] Allow emitFile filenames that start with a period --- plugin/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/index.ts b/plugin/index.ts index c3a8a07..29b6a3c 100644 --- a/plugin/index.ts +++ b/plugin/index.ts @@ -290,7 +290,7 @@ export const visualizer = ( }); if (opts.emitFile) { - if (path.isAbsolute(filename) || filename.startsWith(".")) { + if (path.isAbsolute(filename) || filename.startsWith("./") || filename.startsWith("../")) { this.error(ERR_FILENAME_EMIT); } this.emitFile({ From c65a9bead366951302b5869d38afc1adca582223 Mon Sep 17 00:00:00 2001 From: Ben Scott Date: Mon, 29 Sep 2025 15:14:02 -0700 Subject: [PATCH 2/2] Check for relative paths on windows --- plugin/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugin/index.ts b/plugin/index.ts index 29b6a3c..55313d9 100644 --- a/plugin/index.ts +++ b/plugin/index.ts @@ -290,7 +290,9 @@ export const visualizer = ( }); if (opts.emitFile) { - if (path.isAbsolute(filename) || filename.startsWith("./") || filename.startsWith("../")) { + // Regex checks for filenames starting with `./`, `../`, `.\` or `..\` + // to account for windows-style path separators + if (path.isAbsolute(filename) || /^\.{1,2}[/\\]/.test(filename)) { this.error(ERR_FILENAME_EMIT); } this.emitFile({