From 29a1aa1edde7f613803879e446803f562e0659a7 Mon Sep 17 00:00:00 2001 From: Antriel Date: Wed, 11 Dec 2024 11:25:10 +0100 Subject: [PATCH] fix prefix finding (fix split by `/`) previous version split by single char --- public/index.html | 2 -- src/createGraph.mjs | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/public/index.html b/public/index.html index e453566..36a9d9a 100644 --- a/public/index.html +++ b/public/index.html @@ -95,8 +95,6 @@

Hello, this is Haxe dependency viewer. Have fun.

- - diff --git a/src/createGraph.mjs b/src/createGraph.mjs index 18349d2..6ecb69b 100644 --- a/src/createGraph.mjs +++ b/src/createGraph.mjs @@ -75,7 +75,7 @@ export default function createGraph(deps, config) { if (dep.label) continue; if (prefix === null) prefix = dep.path; else while (!dep.path.startsWith(prefix)) { - const parts = prefix.split(/(?!\/)/g); // Split by, but keep `/`. + const parts = prefix.match(/[^\/]+\/?|\//g); // Split by, but keep `/`. parts.pop(); prefix = parts.join(''); if (prefix === "") break;