Skip to content

Commit

Permalink
fix prefix finding (fix split by /)
Browse files Browse the repository at this point in the history
previous version split by single char
  • Loading branch information
Antriel committed Dec 11, 2024
1 parent 44f0f3a commit 29a1aa1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 0 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ <h1>Hello, this is Haxe dependency viewer. Have fun.</h1>
<input type="search" id="search-input" list="suggestions" placeholder="Filter/search..." />
<datalist id="suggestions"></datalist>
</div>
<button id="config-button">⚙️ Config</button>
<div id="config-panel" class="hidden"></div>
<script src="bundle.js"></script>
</body>

Expand Down
2 changes: 1 addition & 1 deletion src/createGraph.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 29a1aa1

Please sign in to comment.