fix: improve bun lockfile resolution

This commit is contained in:
Ruben Fiszel
2023-09-12 07:59:18 +02:00
parent 51ba268324
commit 209da209cf
@@ -7,6 +7,8 @@ const bo = await Bun.build({
const fs = require("fs/promises");
const captureVersion = /(^\@?[^\@]+)(?:\@(.+))?/;
if (!bo.success) {
bo.logs.forEach((l) => console.log(l));
process.exit(1);
@@ -17,7 +19,7 @@ if (!bo.success) {
const { intersect } = require("semver-intersect");
const dependencies: Record<string, string[]> = {};
for (const i of imports) {
let [name, version] = i.path.split("@");
let [_, name, version] = i.path.match(captureVersion) ?? [];
if (version == undefined) {
if (dependencies[name] == undefined) {
dependencies[name] = [];