From 209da209cffe658c03420e14e1b897cd9c150862 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Tue, 12 Sep 2023 07:59:18 +0200 Subject: [PATCH] fix: improve bun lockfile resolution --- backend/windmill-worker/loader_builder.bun.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/windmill-worker/loader_builder.bun.ts b/backend/windmill-worker/loader_builder.bun.ts index 4d7a2b48bf..eca8c9ef81 100644 --- a/backend/windmill-worker/loader_builder.bun.ts +++ b/backend/windmill-worker/loader_builder.bun.ts @@ -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 = {}; 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] = [];