@storm-software/bun-tools 0.0.40 → 0.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/bin/bun.cjs +36 -4
- package/bin/bun.js +36 -4
- package/dist/{chunk-AD5LCW4J.js → chunk-4TXVMOZB.js} +1 -1
- package/dist/{chunk-ISMM6IAX.cjs → chunk-EBCTMDFX.cjs} +1 -1
- package/dist/chunk-QEDDZEJV.cjs +3 -0
- package/dist/chunk-YTASAMLT.js +3 -0
- package/dist/helpers/catalog.cjs +1 -1
- package/dist/helpers/catalog.js +1 -1
- package/dist/helpers/index.cjs +1 -1
- package/dist/helpers/index.js +1 -1
- package/dist/helpers/replace-deps-aliases.cjs +1 -1
- package/dist/helpers/replace-deps-aliases.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +6 -6
- package/dist/chunk-5XGB6SOS.cjs +0 -3
- package/dist/chunk-ZMUT65O7.js +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog for Storm Ops - Bun Tools
|
|
4
4
|
|
|
5
|
+
## [0.0.42](https://github.com/storm-software/storm-ops/releases/tag/bun-tools%400.0.42) (08/08/2026)
|
|
6
|
+
|
|
7
|
+
### Updated Dependencies
|
|
8
|
+
|
|
9
|
+
- Updated **npm-tools** to **v0.6.249**
|
|
10
|
+
|
|
11
|
+
## [0.0.41](https://github.com/storm-software/storm-ops/releases/tag/bun-tools%400.0.41) (08/08/2026)
|
|
12
|
+
|
|
13
|
+
### Updated Dependencies
|
|
14
|
+
|
|
15
|
+
- Updated **config** to **v1.138.66**
|
|
16
|
+
- Updated **config-tools** to **v1.190.130**
|
|
17
|
+
- Updated **npm-tools** to **v0.6.248**
|
|
18
|
+
- Updated **package-constants** to **v0.1.142**
|
|
19
|
+
- Updated **testing-tools** to **v1.119.282**
|
|
20
|
+
|
|
5
21
|
## [0.0.40](https://github.com/storm-software/storm-ops/releases/tag/bun-tools%400.0.40) (08/08/2026)
|
|
6
22
|
|
|
7
23
|
### Miscellaneous
|
package/bin/bun.cjs
CHANGED
|
@@ -2233,7 +2233,7 @@ var import_commander = require("commander");
|
|
|
2233
2233
|
// package.json
|
|
2234
2234
|
var package_default = {
|
|
2235
2235
|
name: "@storm-software/bun-tools",
|
|
2236
|
-
version: "0.0.
|
|
2236
|
+
version: "0.0.42",
|
|
2237
2237
|
private: false,
|
|
2238
2238
|
description: "A set of [Bun](https://bun.sh/) plugins and utilities for managing workspace packages/dependencies.",
|
|
2239
2239
|
repository: {
|
|
@@ -2381,8 +2381,31 @@ var import_node_child_process3 = require("child_process");
|
|
|
2381
2381
|
var import_semver = require("semver");
|
|
2382
2382
|
var import_strip_ansi = __toESM(require("strip-ansi"), 1);
|
|
2383
2383
|
var BENIGN_PACKAGE_MANAGER_STDERR_LINE = /^(npm warn|\[[\d.]+ms\]|\[sys\]|\[warn\] request took)/i;
|
|
2384
|
+
var BENIGN_PACKAGE_MANAGER_ENV_LINE = /^\[[\d.]+ms\].*(?:\.env(?:\.local)?|\"\.env)/i;
|
|
2385
|
+
function isBenignPackageManagerOutput(line) {
|
|
2386
|
+
const trimmed = line.trim();
|
|
2387
|
+
if (!trimmed) {
|
|
2388
|
+
return true;
|
|
2389
|
+
}
|
|
2390
|
+
const candidates = [trimmed, (0, import_strip_ansi.default)(trimmed)];
|
|
2391
|
+
return candidates.some((normalized) => {
|
|
2392
|
+
if (!normalized) {
|
|
2393
|
+
return true;
|
|
2394
|
+
}
|
|
2395
|
+
if (BENIGN_PACKAGE_MANAGER_STDERR_LINE.test(normalized)) {
|
|
2396
|
+
return true;
|
|
2397
|
+
}
|
|
2398
|
+
if (BENIGN_PACKAGE_MANAGER_ENV_LINE.test(normalized)) {
|
|
2399
|
+
return true;
|
|
2400
|
+
}
|
|
2401
|
+
if (/ms\].*\.env/i.test(normalized)) {
|
|
2402
|
+
return true;
|
|
2403
|
+
}
|
|
2404
|
+
return /\[[\d.]+ms\].*\.env/i.test(trimmed);
|
|
2405
|
+
});
|
|
2406
|
+
}
|
|
2384
2407
|
function filterBenignPackageManagerStderr(stderr) {
|
|
2385
|
-
return stderr.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0).filter((line) => !
|
|
2408
|
+
return stderr.split(/\r?\n/).map((line) => (0, import_strip_ansi.default)(line).trim()).filter((line) => line.length > 0).filter((line) => !isBenignPackageManagerOutput(line)).join("\n").trim();
|
|
2386
2409
|
}
|
|
2387
2410
|
function extractPackageVersion(stdout) {
|
|
2388
2411
|
const lines = (0, import_strip_ansi.default)(stdout).split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
|
|
@@ -2417,7 +2440,13 @@ async function getVersion(packageName, tag = DEFAULT_NPM_TAG, options = {}) {
|
|
|
2417
2440
|
},
|
|
2418
2441
|
(error, stdout, stderr) => {
|
|
2419
2442
|
const filteredStderr = stderr ? filterBenignPackageManagerStderr(stderr) : "";
|
|
2420
|
-
|
|
2443
|
+
const version2 = extractPackageVersion(stdout);
|
|
2444
|
+
const hasValidVersion = (0, import_semver.valid)(version2, true);
|
|
2445
|
+
if (hasValidVersion) {
|
|
2446
|
+
return resolve(version2);
|
|
2447
|
+
}
|
|
2448
|
+
const errorMessage = error?.message ? (0, import_strip_ansi.default)(error.message).trim() : "";
|
|
2449
|
+
if (error && errorMessage && !errorMessage.toLowerCase().startsWith("npm warn") && !isBenignPackageManagerOutput(errorMessage)) {
|
|
2421
2450
|
return reject(
|
|
2422
2451
|
filteredStderr ? new Error(filteredStderr, { cause: error }) : error
|
|
2423
2452
|
);
|
|
@@ -2425,7 +2454,10 @@ async function getVersion(packageName, tag = DEFAULT_NPM_TAG, options = {}) {
|
|
|
2425
2454
|
if (filteredStderr) {
|
|
2426
2455
|
return reject(new Error(filteredStderr));
|
|
2427
2456
|
}
|
|
2428
|
-
|
|
2457
|
+
if (error) {
|
|
2458
|
+
return reject(error);
|
|
2459
|
+
}
|
|
2460
|
+
return resolve(version2);
|
|
2429
2461
|
}
|
|
2430
2462
|
);
|
|
2431
2463
|
})
|
package/bin/bun.js
CHANGED
|
@@ -2211,7 +2211,7 @@ import { Command } from "commander";
|
|
|
2211
2211
|
// package.json
|
|
2212
2212
|
var package_default = {
|
|
2213
2213
|
name: "@storm-software/bun-tools",
|
|
2214
|
-
version: "0.0.
|
|
2214
|
+
version: "0.0.42",
|
|
2215
2215
|
private: false,
|
|
2216
2216
|
description: "A set of [Bun](https://bun.sh/) plugins and utilities for managing workspace packages/dependencies.",
|
|
2217
2217
|
repository: {
|
|
@@ -2359,8 +2359,31 @@ import { exec as exec3 } from "node:child_process";
|
|
|
2359
2359
|
import { valid } from "semver";
|
|
2360
2360
|
import stripAnsi from "strip-ansi";
|
|
2361
2361
|
var BENIGN_PACKAGE_MANAGER_STDERR_LINE = /^(npm warn|\[[\d.]+ms\]|\[sys\]|\[warn\] request took)/i;
|
|
2362
|
+
var BENIGN_PACKAGE_MANAGER_ENV_LINE = /^\[[\d.]+ms\].*(?:\.env(?:\.local)?|\"\.env)/i;
|
|
2363
|
+
function isBenignPackageManagerOutput(line) {
|
|
2364
|
+
const trimmed = line.trim();
|
|
2365
|
+
if (!trimmed) {
|
|
2366
|
+
return true;
|
|
2367
|
+
}
|
|
2368
|
+
const candidates = [trimmed, stripAnsi(trimmed)];
|
|
2369
|
+
return candidates.some((normalized) => {
|
|
2370
|
+
if (!normalized) {
|
|
2371
|
+
return true;
|
|
2372
|
+
}
|
|
2373
|
+
if (BENIGN_PACKAGE_MANAGER_STDERR_LINE.test(normalized)) {
|
|
2374
|
+
return true;
|
|
2375
|
+
}
|
|
2376
|
+
if (BENIGN_PACKAGE_MANAGER_ENV_LINE.test(normalized)) {
|
|
2377
|
+
return true;
|
|
2378
|
+
}
|
|
2379
|
+
if (/ms\].*\.env/i.test(normalized)) {
|
|
2380
|
+
return true;
|
|
2381
|
+
}
|
|
2382
|
+
return /\[[\d.]+ms\].*\.env/i.test(trimmed);
|
|
2383
|
+
});
|
|
2384
|
+
}
|
|
2362
2385
|
function filterBenignPackageManagerStderr(stderr) {
|
|
2363
|
-
return stderr.split(/\r?\n/).map((line) => line.trim()).filter((line) => line.length > 0).filter((line) => !
|
|
2386
|
+
return stderr.split(/\r?\n/).map((line) => stripAnsi(line).trim()).filter((line) => line.length > 0).filter((line) => !isBenignPackageManagerOutput(line)).join("\n").trim();
|
|
2364
2387
|
}
|
|
2365
2388
|
function extractPackageVersion(stdout) {
|
|
2366
2389
|
const lines = stripAnsi(stdout).split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
|
|
@@ -2395,7 +2418,13 @@ async function getVersion(packageName, tag = DEFAULT_NPM_TAG, options = {}) {
|
|
|
2395
2418
|
},
|
|
2396
2419
|
(error, stdout, stderr) => {
|
|
2397
2420
|
const filteredStderr = stderr ? filterBenignPackageManagerStderr(stderr) : "";
|
|
2398
|
-
|
|
2421
|
+
const version2 = extractPackageVersion(stdout);
|
|
2422
|
+
const hasValidVersion = valid(version2, true);
|
|
2423
|
+
if (hasValidVersion) {
|
|
2424
|
+
return resolve(version2);
|
|
2425
|
+
}
|
|
2426
|
+
const errorMessage = error?.message ? stripAnsi(error.message).trim() : "";
|
|
2427
|
+
if (error && errorMessage && !errorMessage.toLowerCase().startsWith("npm warn") && !isBenignPackageManagerOutput(errorMessage)) {
|
|
2399
2428
|
return reject(
|
|
2400
2429
|
filteredStderr ? new Error(filteredStderr, { cause: error }) : error
|
|
2401
2430
|
);
|
|
@@ -2403,7 +2432,10 @@ async function getVersion(packageName, tag = DEFAULT_NPM_TAG, options = {}) {
|
|
|
2403
2432
|
if (filteredStderr) {
|
|
2404
2433
|
return reject(new Error(filteredStderr));
|
|
2405
2434
|
}
|
|
2406
|
-
|
|
2435
|
+
if (error) {
|
|
2436
|
+
return reject(error);
|
|
2437
|
+
}
|
|
2438
|
+
return resolve(version2);
|
|
2407
2439
|
}
|
|
2408
2440
|
);
|
|
2409
2441
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b}from'./chunk-
|
|
1
|
+
import {b}from'./chunk-YTASAMLT.js';import {d,e}from'./chunk-6RUWDFGG.js';import {readCachedProjectGraph,createProjectGraphAsync}from'@nx/devkit';import {existsSync}from'node:fs';import {readFile,writeFile}from'node:fs/promises';import {format}from'prettier';import J from'prettier-plugin-packagejson';async function F(t=process.cwd(),f=e(t)){let g=d(t,"package.json"),l=await readFile(g,"utf8");if(!l)throw new Error("No package.json file found in package root: "+t);let s=await b(f),c=JSON.parse(l);if(!s){console.warn("No workspace catalog found. Skipping dependencies replacement for now.");return}for(let n of ["dependencies","devDependencies","peerDependencies"]){let o=c[n];if(o){for(let e of Object.keys(o))if(o[e]==="catalog:"){if(!s)throw new Error(`Dependency ${e} is marked as \`catalog:\`, but no catalog exists in the workspace root's \`package.json\` file.`);let a=s[e];if(!a)throw new Error("Missing workspace catalog version for "+e);o[e]=a;}else if(o[e].startsWith("catalog:"))throw new Error("multiple named catalogs not supported")}}let r;try{r=readCachedProjectGraph();}catch{await createProjectGraphAsync(),r=readCachedProjectGraph();}let i={};r&&await Promise.all(Object.keys(r.nodes).map(async n=>{let o=r.nodes[n];if(o?.data.root){let e=d(f,o.data.root,"package.json");if(existsSync(e)){let a=await readFile(e,"utf8"),p=JSON.parse(a);p.private!==true&&(i[p.name]=p.version);}}}));for(let n of ["dependencies","devDependencies","peerDependencies"]){let o=c[n];if(o){for(let e of Object.keys(o))if(o[e].startsWith("workspace:"))if(i[e])o[e]=`^${i[e]}`;else throw new Error(`Workspace dependency ${e} not found in workspace packages.`)}}return writeFile(g,await format(JSON.stringify(c),{parser:"json",proseWrap:"preserve",trailingComma:"none",tabWidth:2,semi:true,singleQuote:false,quoteProps:"as-needed",insertPragma:false,bracketSameLine:true,printWidth:80,bracketSpacing:true,arrowParens:"avoid",endOfLine:"lf",plugins:[J]}))}export{F as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkQEDDZEJV_cjs=require('./chunk-QEDDZEJV.cjs'),chunk66TU3CP3_cjs=require('./chunk-66TU3CP3.cjs'),devkit=require('@nx/devkit'),fs=require('fs'),promises=require('fs/promises'),prettier=require('prettier'),J=require('prettier-plugin-packagejson');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var J__default=/*#__PURE__*/_interopDefault(J);async function x(t=process.cwd(),f=chunk66TU3CP3_cjs.e(t)){let g=chunk66TU3CP3_cjs.d(t,"package.json"),l=await promises.readFile(g,"utf8");if(!l)throw new Error("No package.json file found in package root: "+t);let s=await chunkQEDDZEJV_cjs.b(f),c=JSON.parse(l);if(!s){console.warn("No workspace catalog found. Skipping dependencies replacement for now.");return}for(let n of ["dependencies","devDependencies","peerDependencies"]){let o=c[n];if(o){for(let e of Object.keys(o))if(o[e]==="catalog:"){if(!s)throw new Error(`Dependency ${e} is marked as \`catalog:\`, but no catalog exists in the workspace root's \`package.json\` file.`);let a=s[e];if(!a)throw new Error("Missing workspace catalog version for "+e);o[e]=a;}else if(o[e].startsWith("catalog:"))throw new Error("multiple named catalogs not supported")}}let r;try{r=devkit.readCachedProjectGraph();}catch{await devkit.createProjectGraphAsync(),r=devkit.readCachedProjectGraph();}let i={};r&&await Promise.all(Object.keys(r.nodes).map(async n=>{let o=r.nodes[n];if(o?.data.root){let e=chunk66TU3CP3_cjs.d(f,o.data.root,"package.json");if(fs.existsSync(e)){let a=await promises.readFile(e,"utf8"),p=JSON.parse(a);p.private!==true&&(i[p.name]=p.version);}}}));for(let n of ["dependencies","devDependencies","peerDependencies"]){let o=c[n];if(o){for(let e of Object.keys(o))if(o[e].startsWith("workspace:"))if(i[e])o[e]=`^${i[e]}`;else throw new Error(`Workspace dependency ${e} not found in workspace packages.`)}}return promises.writeFile(g,await prettier.format(JSON.stringify(c),{parser:"json",proseWrap:"preserve",trailingComma:"none",tabWidth:2,semi:true,singleQuote:false,quoteProps:"as-needed",insertPragma:false,bracketSameLine:true,printWidth:80,bracketSpacing:true,arrowParens:"avoid",endOfLine:"lf",plugins:[J__default.default]}))}exports.a=x;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
'use strict';var chunkWAL5SD4G_cjs=require('./chunk-WAL5SD4G.cjs'),chunk66TU3CP3_cjs=require('./chunk-66TU3CP3.cjs'),child_process=require('child_process'),semver=require('semver'),d=require('strip-ansi');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var d__default=/*#__PURE__*/_interopDefault(d);var W="https://registry.npmjs.org";var k="latest";var $=k;async function F(t="npm"){return new Promise((r,o)=>{child_process.exec(`${t} config get registry`,(e,a,f)=>e&&!e.message.toLowerCase().trim().startsWith("npm warn")?o(e):f&&!f.toLowerCase().trim().startsWith("npm warn")?o(f):r(a.trim()));})}async function C(){if(process.env.STORM_REGISTRY_NPM)return process.env.STORM_REGISTRY_NPM;let t=await chunk66TU3CP3_cjs.f();return t?.registry?.npm?t?.registry?.npm:W}var N=/^(npm warn|\[[\d.]+ms\]|\[sys\]|\[warn\] request took)/i,H=/^\[[\d.]+ms\].*(?:\.env(?:\.local)?|\"\.env)/i;function B(t){let r=t.trim();return r?[r,d__default.default(r)].some(e=>!e||N.test(e)||H.test(e)||/ms\].*\.env/i.test(e)?true:/\[[\d.]+ms\].*\.env/i.test(r)):true}function q(t){return t.split(/\r?\n/).map(r=>d__default.default(r).trim()).filter(r=>r.length>0).filter(r=>!B(r)).join(`
|
|
2
|
+
`).trim()}function K(t){let r=d__default.default(t).split(/\r?\n/).map(o=>o.trim()).filter(Boolean);for(let o=r.length-1;o>=0;o-=1){let e=r[o];if(e&&semver.valid(e,true))return e}return d__default.default(t).trim()}async function M(t,r=$,o={}){let e=o.executable||"npm",a=o.retries??3,f=o.timeout??1e4,l=o.registry||await F(e),g;for(let n=0;n<=a;n++)try{let c=new AbortController,s=setTimeout(()=>{c.abort();},f),i=await Promise.resolve(new Promise((I,_)=>{child_process.exec(`${e} view ${t} version --registry=${l}`,{signal:c.signal,maxBuffer:1024*1024*10},(w,D,S)=>{let T=S?q(S):"",x=K(D);if(semver.valid(x,!0))return I(x);let P=w?.message?d__default.default(w.message).trim():"";return w&&P&&!P.toLowerCase().startsWith("npm warn")&&!B(P)?_(T?new Error(T,{cause:w}):w):T?_(new Error(T)):w?_(w):I(x)});}));if(!semver.valid(i,!0))throw clearTimeout(s),new Error(d__default.default(i).startsWith("[WARN] Request took")?`A timeout occurred while fetching the version for package "${t}" with tag "${r}".`:`Invalid version "${i}" fetched for package "${t}" with tag "${r}"`);return clearTimeout(s),i}catch(c){if(g=c,n<a){let s=Math.pow(2,n)*100;await new Promise(i=>setTimeout(i,s));}}throw g}async function X(t=chunk66TU3CP3_cjs.e(process.cwd())){let r=await chunk66TU3CP3_cjs.i(t);if(!r){chunk66TU3CP3_cjs.a(`No package.json file found in workspace root: ${t}`,{logLevel:"all"});return}let o=chunk66TU3CP3_cjs.j(r);if(o)return Object.fromEntries(Object.entries(o).map(([e,a])=>[e,a.replaceAll('"',"").replaceAll("'","")]));console.warn(`No catalog found in package.json file located in workspace root: ${t}
|
|
3
|
+
File content: ${JSON.stringify(r,null,2)}`);}async function Q(t=chunk66TU3CP3_cjs.e(process.cwd())){let r=await X(t);if(!r)throw new Error("No catalog entries found in workspace root package.json file");return r}async function Z(t,r=chunk66TU3CP3_cjs.e(process.cwd())){let o=await chunk66TU3CP3_cjs.i(r);if(!o)throw new Error("No package.json file found in workspace root");chunk66TU3CP3_cjs.k(o,Object.fromEntries(Object.entries(t).filter(([,e])=>e&&(e.startsWith("npm:")||semver.valid(chunkWAL5SD4G_cjs.a(e),true))).map(([e,a])=>[e,a.replaceAll('"',"").replaceAll("'","")]))),await chunk66TU3CP3_cjs.l(o,r);}async function At(t,r,o={}){let{tag:e=$,prefix:a="^",workspaceRoot:f=chunk66TU3CP3_cjs.e(),verbose:l=false}=o,g=await chunk66TU3CP3_cjs.g(true,{workspaceRoot:f});l&&chunk66TU3CP3_cjs.c(`Upgrading catalog entry for package "${r}" with tag "${e}"`,g);let n=await C(),c=await M(r,e,{executable:"bun pm",registry:n});if(!c)throw new Error(`Failed to fetch version for package "${r}" with tag "${e}"`);if(!semver.valid(chunkWAL5SD4G_cjs.a(c),true))throw new Error(`Invalid version "${c}" fetched for package "${r}" with tag "${e}"`);let s=`${a||""}${chunkWAL5SD4G_cjs.a(c)}`,i=false;return t[r]?.startsWith("npm:")?(t[r]=s,chunk66TU3CP3_cjs.b(`Writing version ${t[r]} to catalog for "${r}" package`,g)):!semver.valid(semver.coerce(t[r]))||semver.coerce(t[r])&&semver.coerce(s)&&semver.gt(semver.coerce(s),semver.coerce(t[r]))?(t[r]=`${a||""}${chunkWAL5SD4G_cjs.a(s)}`,chunk66TU3CP3_cjs.b(`Writing version ${t[r]} to catalog for "${r}" package`,g),i=true):l&&chunk66TU3CP3_cjs.b(`The current version ${t[r]} for package "${r}" is greater than or equal to the version ${chunkWAL5SD4G_cjs.a(s)} fetched from the npm registry with tag "${e}". No update performed.`,g),{catalog:t,updated:i}}async function vt(t,r={}){let{tag:o=$,prefix:e="^",throwIfMissingInCatalog:a=false,workspaceRoot:f=chunk66TU3CP3_cjs.e(),verbose:l=false}=r,g=await chunk66TU3CP3_cjs.g(true,{workspaceRoot:f}),n=await Q(f);if(!n)throw new Error("No catalog found");if(a===true&&!n[t])throw new Error(`Package "${t}" not found in catalog: ${JSON.stringify(n,null,2)}`);l&&chunk66TU3CP3_cjs.c(`Upgrading catalog entry for package "${t}" with tag "${o}"`,g);let c=await C(),s=await M(t,o,{executable:"bun pm",registry:c});if(!s)throw new Error(`Failed to fetch version for package "${t}" with tag "${o}"`);if(!semver.valid(chunkWAL5SD4G_cjs.a(s),true))throw new Error(`Invalid version "${s}" fetched for package "${t}" with tag "${o}"`);let i=`${e||""}${chunkWAL5SD4G_cjs.a(s)}`;i===n[t]?l&&chunk66TU3CP3_cjs.c(`The version for package "${t}" is already up to date in the catalog: ${i}`,g):!semver.valid(chunkWAL5SD4G_cjs.a(n[t]),true)||semver.coerce(n[t])&&semver.coerce(i)&&semver.gt(semver.coerce(i),semver.coerce(n[t]))?(n[t]=`${e||""}${chunkWAL5SD4G_cjs.a(i)}`,chunk66TU3CP3_cjs.b(`Writing version ${n[t]} to catalog for "${t}" package`,g),await Z(n,f)):l&&chunk66TU3CP3_cjs.a(`The current version "${n[t]}" for package "${t}" is greater than or equal to the version "${i}" fetched from the npm registry with tag "${o}". No update performed.`,g);}exports.a=X;exports.b=Q;exports.c=Z;exports.d=At;exports.e=vt;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import {a as a$1}from'./chunk-7QKHH2VM.js';import {i,a,j,e,k as k$1,l,g,c,b as b$1,f}from'./chunk-6RUWDFGG.js';import {exec}from'node:child_process';import {valid,coerce,gt}from'semver';import d from'strip-ansi';var k="https://registry.npmjs.org";var F="latest";var $=F;async function B(t="npm"){return new Promise((r,o)=>{exec(`${t} config get registry`,(e,a,f)=>e&&!e.message.toLowerCase().trim().startsWith("npm warn")?o(e):f&&!f.toLowerCase().trim().startsWith("npm warn")?o(f):r(a.trim()));})}async function b(){if(process.env.STORM_REGISTRY_NPM)return process.env.STORM_REGISTRY_NPM;let t=await f();return t?.registry?.npm?t?.registry?.npm:k}var H=/^(npm warn|\[[\d.]+ms\]|\[sys\]|\[warn\] request took)/i,q=/^\[[\d.]+ms\].*(?:\.env(?:\.local)?|\"\.env)/i;function Y(t){let r=t.trim();return r?[r,d(r)].some(e=>!e||H.test(e)||q.test(e)||/ms\].*\.env/i.test(e)?true:/\[[\d.]+ms\].*\.env/i.test(r)):true}function K(t){return t.split(/\r?\n/).map(r=>d(r).trim()).filter(r=>r.length>0).filter(r=>!Y(r)).join(`
|
|
2
|
+
`).trim()}function X(t){let r=d(t).split(/\r?\n/).map(o=>o.trim()).filter(Boolean);for(let o=r.length-1;o>=0;o-=1){let e=r[o];if(e&&valid(e,true))return e}return d(t).trim()}async function I(t,r=$,o={}){let e=o.executable||"npm",a=o.retries??3,f=o.timeout??1e4,l=o.registry||await B(e),g;for(let n=0;n<=a;n++)try{let c=new AbortController,s=setTimeout(()=>{c.abort();},f),i=await Promise.resolve(new Promise((S,_)=>{exec(`${e} view ${t} version --registry=${l}`,{signal:c.signal,maxBuffer:1024*1024*10},(w,J,O)=>{let T=O?K(O):"",x=X(J);if(valid(x,!0))return S(x);let P=w?.message?d(w.message).trim():"";return w&&P&&!P.toLowerCase().startsWith("npm warn")&&!Y(P)?_(T?new Error(T,{cause:w}):w):T?_(new Error(T)):w?_(w):S(x)});}));if(!valid(i,!0))throw clearTimeout(s),new Error(d(i).startsWith("[WARN] Request took")?`A timeout occurred while fetching the version for package "${t}" with tag "${r}".`:`Invalid version "${i}" fetched for package "${t}" with tag "${r}"`);return clearTimeout(s),i}catch(c){if(g=c,n<a){let s=Math.pow(2,n)*100;await new Promise(i=>setTimeout(i,s));}}throw g}async function Q(t=e(process.cwd())){let r=await i(t);if(!r){a(`No package.json file found in workspace root: ${t}`,{logLevel:"all"});return}let o=j(r);if(o)return Object.fromEntries(Object.entries(o).map(([e,a])=>[e,a.replaceAll('"',"").replaceAll("'","")]));console.warn(`No catalog found in package.json file located in workspace root: ${t}
|
|
3
|
+
File content: ${JSON.stringify(r,null,2)}`);}async function Z(t=e(process.cwd())){let r=await Q(t);if(!r)throw new Error("No catalog entries found in workspace root package.json file");return r}async function z(t,r=e(process.cwd())){let o=await i(r);if(!o)throw new Error("No package.json file found in workspace root");k$1(o,Object.fromEntries(Object.entries(t).filter(([,e])=>e&&(e.startsWith("npm:")||valid(a$1(e),true))).map(([e,a])=>[e,a.replaceAll('"',"").replaceAll("'","")]))),await l(o,r);}async function vt(t,r,o={}){let{tag:e$1=$,prefix:a="^",workspaceRoot:f=e(),verbose:l=false}=o,g$1=await g(true,{workspaceRoot:f});l&&c(`Upgrading catalog entry for package "${r}" with tag "${e$1}"`,g$1);let n=await b(),c$1=await I(r,e$1,{executable:"bun pm",registry:n});if(!c$1)throw new Error(`Failed to fetch version for package "${r}" with tag "${e$1}"`);if(!valid(a$1(c$1),true))throw new Error(`Invalid version "${c$1}" fetched for package "${r}" with tag "${e$1}"`);let s=`${a||""}${a$1(c$1)}`,i=false;return t[r]?.startsWith("npm:")?(t[r]=s,b$1(`Writing version ${t[r]} to catalog for "${r}" package`,g$1)):!valid(coerce(t[r]))||coerce(t[r])&&coerce(s)&>(coerce(s),coerce(t[r]))?(t[r]=`${a||""}${a$1(s)}`,b$1(`Writing version ${t[r]} to catalog for "${r}" package`,g$1),i=true):l&&b$1(`The current version ${t[r]} for package "${r}" is greater than or equal to the version ${a$1(s)} fetched from the npm registry with tag "${e$1}". No update performed.`,g$1),{catalog:t,updated:i}}async function Gt(t,r={}){let{tag:o=$,prefix:e$1="^",throwIfMissingInCatalog:a$2=false,workspaceRoot:f=e(),verbose:l=false}=r,g$1=await g(true,{workspaceRoot:f}),n=await Z(f);if(!n)throw new Error("No catalog found");if(a$2===true&&!n[t])throw new Error(`Package "${t}" not found in catalog: ${JSON.stringify(n,null,2)}`);l&&c(`Upgrading catalog entry for package "${t}" with tag "${o}"`,g$1);let c$1=await b(),s=await I(t,o,{executable:"bun pm",registry:c$1});if(!s)throw new Error(`Failed to fetch version for package "${t}" with tag "${o}"`);if(!valid(a$1(s),true))throw new Error(`Invalid version "${s}" fetched for package "${t}" with tag "${o}"`);let i=`${e$1||""}${a$1(s)}`;i===n[t]?l&&c(`The version for package "${t}" is already up to date in the catalog: ${i}`,g$1):!valid(a$1(n[t]),true)||coerce(n[t])&&coerce(i)&>(coerce(i),coerce(n[t]))?(n[t]=`${e$1||""}${a$1(i)}`,b$1(`Writing version ${n[t]} to catalog for "${t}" package`,g$1),await z(n,f)):l&&a(`The current version "${n[t]}" for package "${t}" is greater than or equal to the version "${i}" fetched from the npm registry with tag "${o}". No update performed.`,g$1);}export{Q as a,Z as b,z as c,vt as d,Gt as e};
|
package/dist/helpers/catalog.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkQEDDZEJV_cjs=require('../chunk-QEDDZEJV.cjs');require('../chunk-WAL5SD4G.cjs'),require('../chunk-66TU3CP3.cjs');Object.defineProperty(exports,"getCatalog",{enumerable:true,get:function(){return chunkQEDDZEJV_cjs.b}});Object.defineProperty(exports,"getCatalogSafe",{enumerable:true,get:function(){return chunkQEDDZEJV_cjs.a}});Object.defineProperty(exports,"saveCatalog",{enumerable:true,get:function(){return chunkQEDDZEJV_cjs.e}});Object.defineProperty(exports,"setCatalog",{enumerable:true,get:function(){return chunkQEDDZEJV_cjs.c}});Object.defineProperty(exports,"upgradeCatalog",{enumerable:true,get:function(){return chunkQEDDZEJV_cjs.d}});
|
package/dist/helpers/catalog.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{b as getCatalog,a as getCatalogSafe,e as saveCatalog,c as setCatalog,d as upgradeCatalog}from'../chunk-
|
|
1
|
+
export{b as getCatalog,a as getCatalogSafe,e as saveCatalog,c as setCatalog,d as upgradeCatalog}from'../chunk-YTASAMLT.js';import'../chunk-7QKHH2VM.js';import'../chunk-6RUWDFGG.js';
|
package/dist/helpers/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';require('../chunk-3CHW2FOO.cjs');var
|
|
1
|
+
'use strict';require('../chunk-3CHW2FOO.cjs');var chunkEBCTMDFX_cjs=require('../chunk-EBCTMDFX.cjs'),chunkQEDDZEJV_cjs=require('../chunk-QEDDZEJV.cjs');require('../chunk-WAL5SD4G.cjs');var chunkGC3KXELW_cjs=require('../chunk-GC3KXELW.cjs'),chunk66TU3CP3_cjs=require('../chunk-66TU3CP3.cjs');Object.defineProperty(exports,"replaceDepsAliases",{enumerable:true,get:function(){return chunkEBCTMDFX_cjs.a}});Object.defineProperty(exports,"getCatalog",{enumerable:true,get:function(){return chunkQEDDZEJV_cjs.b}});Object.defineProperty(exports,"getCatalogSafe",{enumerable:true,get:function(){return chunkQEDDZEJV_cjs.a}});Object.defineProperty(exports,"saveCatalog",{enumerable:true,get:function(){return chunkQEDDZEJV_cjs.e}});Object.defineProperty(exports,"setCatalog",{enumerable:true,get:function(){return chunkQEDDZEJV_cjs.c}});Object.defineProperty(exports,"upgradeCatalog",{enumerable:true,get:function(){return chunkQEDDZEJV_cjs.d}});Object.defineProperty(exports,"getWorkspaceFilePath",{enumerable:true,get:function(){return chunkGC3KXELW_cjs.a}});Object.defineProperty(exports,"readWorkspaceFile",{enumerable:true,get:function(){return chunkGC3KXELW_cjs.b}});Object.defineProperty(exports,"writeWorkspaceFile",{enumerable:true,get:function(){return chunkGC3KXELW_cjs.c}});Object.defineProperty(exports,"getCatalogFromPackageJson",{enumerable:true,get:function(){return chunk66TU3CP3_cjs.j}});Object.defineProperty(exports,"getRootPackageJsonPath",{enumerable:true,get:function(){return chunk66TU3CP3_cjs.h}});Object.defineProperty(exports,"readRootPackageJson",{enumerable:true,get:function(){return chunk66TU3CP3_cjs.i}});Object.defineProperty(exports,"setCatalogInPackageJson",{enumerable:true,get:function(){return chunk66TU3CP3_cjs.k}});Object.defineProperty(exports,"writeRootPackageJson",{enumerable:true,get:function(){return chunk66TU3CP3_cjs.l}});
|
package/dist/helpers/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import'../chunk-PJBAL7AE.js';export{a as replaceDepsAliases}from'../chunk-
|
|
1
|
+
import'../chunk-PJBAL7AE.js';export{a as replaceDepsAliases}from'../chunk-4TXVMOZB.js';export{b as getCatalog,a as getCatalogSafe,e as saveCatalog,c as setCatalog,d as upgradeCatalog}from'../chunk-YTASAMLT.js';import'../chunk-7QKHH2VM.js';export{a as getWorkspaceFilePath,b as readWorkspaceFile,c as writeWorkspaceFile}from'../chunk-KWVKMOA5.js';export{j as getCatalogFromPackageJson,h as getRootPackageJsonPath,i as readRootPackageJson,k as setCatalogInPackageJson,l as writeRootPackageJson}from'../chunk-6RUWDFGG.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkEBCTMDFX_cjs=require('../chunk-EBCTMDFX.cjs');require('../chunk-QEDDZEJV.cjs'),require('../chunk-WAL5SD4G.cjs'),require('../chunk-66TU3CP3.cjs');Object.defineProperty(exports,"replaceDepsAliases",{enumerable:true,get:function(){return chunkEBCTMDFX_cjs.a}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as replaceDepsAliases}from'../chunk-
|
|
1
|
+
export{a as replaceDepsAliases}from'../chunk-4TXVMOZB.js';import'../chunk-YTASAMLT.js';import'../chunk-7QKHH2VM.js';import'../chunk-6RUWDFGG.js';
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';require('./chunk-SFZRYJZ2.cjs'),require('./chunk-3CHW2FOO.cjs');var
|
|
1
|
+
'use strict';require('./chunk-SFZRYJZ2.cjs'),require('./chunk-3CHW2FOO.cjs');var chunkEBCTMDFX_cjs=require('./chunk-EBCTMDFX.cjs'),chunkQEDDZEJV_cjs=require('./chunk-QEDDZEJV.cjs');require('./chunk-WAL5SD4G.cjs');var chunkGC3KXELW_cjs=require('./chunk-GC3KXELW.cjs'),chunk66TU3CP3_cjs=require('./chunk-66TU3CP3.cjs');Object.defineProperty(exports,"replaceDepsAliases",{enumerable:true,get:function(){return chunkEBCTMDFX_cjs.a}});Object.defineProperty(exports,"getCatalog",{enumerable:true,get:function(){return chunkQEDDZEJV_cjs.b}});Object.defineProperty(exports,"getCatalogSafe",{enumerable:true,get:function(){return chunkQEDDZEJV_cjs.a}});Object.defineProperty(exports,"saveCatalog",{enumerable:true,get:function(){return chunkQEDDZEJV_cjs.e}});Object.defineProperty(exports,"setCatalog",{enumerable:true,get:function(){return chunkQEDDZEJV_cjs.c}});Object.defineProperty(exports,"upgradeCatalog",{enumerable:true,get:function(){return chunkQEDDZEJV_cjs.d}});Object.defineProperty(exports,"getWorkspaceFilePath",{enumerable:true,get:function(){return chunkGC3KXELW_cjs.a}});Object.defineProperty(exports,"readWorkspaceFile",{enumerable:true,get:function(){return chunkGC3KXELW_cjs.b}});Object.defineProperty(exports,"writeWorkspaceFile",{enumerable:true,get:function(){return chunkGC3KXELW_cjs.c}});Object.defineProperty(exports,"getCatalogFromPackageJson",{enumerable:true,get:function(){return chunk66TU3CP3_cjs.j}});Object.defineProperty(exports,"getRootPackageJsonPath",{enumerable:true,get:function(){return chunk66TU3CP3_cjs.h}});Object.defineProperty(exports,"readRootPackageJson",{enumerable:true,get:function(){return chunk66TU3CP3_cjs.i}});Object.defineProperty(exports,"setCatalogInPackageJson",{enumerable:true,get:function(){return chunk66TU3CP3_cjs.k}});Object.defineProperty(exports,"writeRootPackageJson",{enumerable:true,get:function(){return chunk66TU3CP3_cjs.l}});
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import'./chunk-GGNOJ77I.js';import'./chunk-PJBAL7AE.js';export{a as replaceDepsAliases}from'./chunk-
|
|
1
|
+
import'./chunk-GGNOJ77I.js';import'./chunk-PJBAL7AE.js';export{a as replaceDepsAliases}from'./chunk-4TXVMOZB.js';export{b as getCatalog,a as getCatalogSafe,e as saveCatalog,c as setCatalog,d as upgradeCatalog}from'./chunk-YTASAMLT.js';import'./chunk-7QKHH2VM.js';export{a as getWorkspaceFilePath,b as readWorkspaceFile,c as writeWorkspaceFile}from'./chunk-KWVKMOA5.js';export{j as getCatalogFromPackageJson,h as getRootPackageJsonPath,i as readRootPackageJson,k as setCatalogInPackageJson,l as writeRootPackageJson}from'./chunk-6RUWDFGG.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storm-software/bun-tools",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.42",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A set of [Bun](https://bun.sh/) plugins and utilities for managing workspace packages/dependencies.",
|
|
6
6
|
"repository": {
|
|
@@ -73,10 +73,10 @@
|
|
|
73
73
|
"storm-bun-esm": "./bin/bun.js"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@storm-software/config": "^1.138.
|
|
77
|
-
"@storm-software/config-tools": "1.190.
|
|
78
|
-
"@storm-software/npm-tools": "0.6.
|
|
79
|
-
"@storm-software/package-constants": "^0.1.
|
|
76
|
+
"@storm-software/config": "^1.138.66",
|
|
77
|
+
"@storm-software/config-tools": "^1.190.130",
|
|
78
|
+
"@storm-software/npm-tools": "^0.6.249",
|
|
79
|
+
"@storm-software/package-constants": "^0.1.142",
|
|
80
80
|
"chalk": "^4.1.2",
|
|
81
81
|
"commander": "^12.1.0",
|
|
82
82
|
"defu": "^6.1.7",
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": { "@types/node": "^25.9.5", "tsup": "8.4.0" },
|
|
89
89
|
"publishConfig": { "access": "public" },
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "aec6740206e81d783bcc058942f25bec92017913"
|
|
91
91
|
}
|
package/dist/chunk-5XGB6SOS.cjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkWAL5SD4G_cjs=require('./chunk-WAL5SD4G.cjs'),chunk66TU3CP3_cjs=require('./chunk-66TU3CP3.cjs'),child_process=require('child_process'),semver=require('semver'),A=require('strip-ansi');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var A__default=/*#__PURE__*/_interopDefault(A);var O="https://registry.npmjs.org";var U="latest";var d=U;async function L(t="npm"){return new Promise((r,e)=>{child_process.exec(`${t} config get registry`,(o,a,f)=>o&&!o.message.toLowerCase().trim().startsWith("npm warn")?e(o):f&&!f.toLowerCase().trim().startsWith("npm warn")?e(f):r(a.trim()));})}async function _(){if(process.env.STORM_REGISTRY_NPM)return process.env.STORM_REGISTRY_NPM;let t=await chunk66TU3CP3_cjs.f();return t?.registry?.npm?t?.registry?.npm:O}var j=/^(npm warn|\[[\d.]+ms\]|\[sys\]|\[warn\] request took)/i;function B(t){return t.split(/\r?\n/).map(r=>r.trim()).filter(r=>r.length>0).filter(r=>!j.test(r)).join(`
|
|
2
|
-
`).trim()}function J(t){let r=A__default.default(t).split(/\r?\n/).map(e=>e.trim()).filter(Boolean);for(let e=r.length-1;e>=0;e-=1){let o=r[e];if(o&&semver.valid(o,true))return o}return A__default.default(t).trim()}async function v(t,r=d,e={}){let o=e.executable||"npm",a=e.retries??3,f=e.timeout??1e4,u=e.registry||await L(o),g;for(let n=0;n<=a;n++)try{let c=new AbortController,s=setTimeout(()=>{c.abort();},f),i=await Promise.resolve(new Promise((k,G)=>{child_process.exec(`${o} view ${t} version --registry=${u}`,{signal:c.signal,maxBuffer:1024*1024*10},($,F,C)=>{let T=C?B(C):"";return $&&!$.message.toLowerCase().trim().startsWith("npm warn")?G(T?new Error(T,{cause:$}):$):T?G(new Error(T)):k(J(F))});}));if(!semver.valid(i,!0))throw clearTimeout(s),new Error(A__default.default(i).startsWith("[WARN] Request took")?`A timeout occurred while fetching the version for package "${t}" with tag "${r}".`:`Invalid version "${i}" fetched for package "${t}" with tag "${r}"`);return clearTimeout(s),i}catch(c){if(g=c,n<a){let s=Math.pow(2,n)*100;await new Promise(i=>setTimeout(i,s));}}throw g}async function H(t=chunk66TU3CP3_cjs.e(process.cwd())){let r=await chunk66TU3CP3_cjs.i(t);if(!r){chunk66TU3CP3_cjs.a(`No package.json file found in workspace root: ${t}`,{logLevel:"all"});return}let e=chunk66TU3CP3_cjs.j(r);if(e)return Object.fromEntries(Object.entries(e).map(([o,a])=>[o,a.replaceAll('"',"").replaceAll("'","")]));console.warn(`No catalog found in package.json file located in workspace root: ${t}
|
|
3
|
-
File content: ${JSON.stringify(r,null,2)}`);}async function q(t=chunk66TU3CP3_cjs.e(process.cwd())){let r=await H(t);if(!r)throw new Error("No catalog entries found in workspace root package.json file");return r}async function X(t,r=chunk66TU3CP3_cjs.e(process.cwd())){let e=await chunk66TU3CP3_cjs.i(r);if(!e)throw new Error("No package.json file found in workspace root");chunk66TU3CP3_cjs.k(e,Object.fromEntries(Object.entries(t).filter(([,o])=>o&&(o.startsWith("npm:")||semver.valid(chunkWAL5SD4G_cjs.a(o),true))).map(([o,a])=>[o,a.replaceAll('"',"").replaceAll("'","")]))),await chunk66TU3CP3_cjs.l(e,r);}async function Rt(t,r,e={}){let{tag:o=d,prefix:a="^",workspaceRoot:f=chunk66TU3CP3_cjs.e(),verbose:u=false}=e,g=await chunk66TU3CP3_cjs.g(true,{workspaceRoot:f});u&&chunk66TU3CP3_cjs.c(`Upgrading catalog entry for package "${r}" with tag "${o}"`,g);let n=await _(),c=await v(r,o,{executable:"bun pm",registry:n});if(!c)throw new Error(`Failed to fetch version for package "${r}" with tag "${o}"`);if(!semver.valid(chunkWAL5SD4G_cjs.a(c),true))throw new Error(`Invalid version "${c}" fetched for package "${r}" with tag "${o}"`);let s=`${a||""}${chunkWAL5SD4G_cjs.a(c)}`,i=false;return t[r]?.startsWith("npm:")?(t[r]=s,chunk66TU3CP3_cjs.b(`Writing version ${t[r]} to catalog for "${r}" package`,g)):!semver.valid(semver.coerce(t[r]))||semver.coerce(t[r])&&semver.coerce(s)&&semver.gt(semver.coerce(s),semver.coerce(t[r]))?(t[r]=`${a||""}${chunkWAL5SD4G_cjs.a(s)}`,chunk66TU3CP3_cjs.b(`Writing version ${t[r]} to catalog for "${r}" package`,g),i=true):u&&chunk66TU3CP3_cjs.b(`The current version ${t[r]} for package "${r}" is greater than or equal to the version ${chunkWAL5SD4G_cjs.a(s)} fetched from the npm registry with tag "${o}". No update performed.`,g),{catalog:t,updated:i}}async function xt(t,r={}){let{tag:e=d,prefix:o="^",throwIfMissingInCatalog:a=false,workspaceRoot:f=chunk66TU3CP3_cjs.e(),verbose:u=false}=r,g=await chunk66TU3CP3_cjs.g(true,{workspaceRoot:f}),n=await q(f);if(!n)throw new Error("No catalog found");if(a===true&&!n[t])throw new Error(`Package "${t}" not found in catalog: ${JSON.stringify(n,null,2)}`);u&&chunk66TU3CP3_cjs.c(`Upgrading catalog entry for package "${t}" with tag "${e}"`,g);let c=await _(),s=await v(t,e,{executable:"bun pm",registry:c});if(!s)throw new Error(`Failed to fetch version for package "${t}" with tag "${e}"`);if(!semver.valid(chunkWAL5SD4G_cjs.a(s),true))throw new Error(`Invalid version "${s}" fetched for package "${t}" with tag "${e}"`);let i=`${o||""}${chunkWAL5SD4G_cjs.a(s)}`;i===n[t]?u&&chunk66TU3CP3_cjs.c(`The version for package "${t}" is already up to date in the catalog: ${i}`,g):!semver.valid(chunkWAL5SD4G_cjs.a(n[t]),true)||semver.coerce(n[t])&&semver.coerce(i)&&semver.gt(semver.coerce(i),semver.coerce(n[t]))?(n[t]=`${o||""}${chunkWAL5SD4G_cjs.a(i)}`,chunk66TU3CP3_cjs.b(`Writing version ${n[t]} to catalog for "${t}" package`,g),await X(n,f)):u&&chunk66TU3CP3_cjs.a(`The current version "${n[t]}" for package "${t}" is greater than or equal to the version "${i}" fetched from the npm registry with tag "${e}". No update performed.`,g);}exports.a=H;exports.b=q;exports.c=X;exports.d=Rt;exports.e=xt;
|
package/dist/chunk-ZMUT65O7.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-7QKHH2VM.js';import {i,a,j,e,k,l,g,c,b,f}from'./chunk-6RUWDFGG.js';import {exec}from'node:child_process';import {valid,coerce,gt}from'semver';import v from'strip-ansi';var U="https://registry.npmjs.org";var L="latest";var d=L;async function V(t="npm"){return new Promise((r,e)=>{exec(`${t} config get registry`,(o,a,f)=>o&&!o.message.toLowerCase().trim().startsWith("npm warn")?e(o):f&&!f.toLowerCase().trim().startsWith("npm warn")?e(f):r(a.trim()));})}async function A(){if(process.env.STORM_REGISTRY_NPM)return process.env.STORM_REGISTRY_NPM;let t=await f();return t?.registry?.npm?t?.registry?.npm:U}var B=/^(npm warn|\[[\d.]+ms\]|\[sys\]|\[warn\] request took)/i;function J(t){return t.split(/\r?\n/).map(r=>r.trim()).filter(r=>r.length>0).filter(r=>!B.test(r)).join(`
|
|
2
|
-
`).trim()}function H(t){let r=v(t).split(/\r?\n/).map(e=>e.trim()).filter(Boolean);for(let e=r.length-1;e>=0;e-=1){let o=r[e];if(o&&valid(o,true))return o}return v(t).trim()}async function G(t,r=d,e={}){let o=e.executable||"npm",a=e.retries??3,f=e.timeout??1e4,u=e.registry||await V(o),g;for(let n=0;n<=a;n++)try{let c=new AbortController,s=setTimeout(()=>{c.abort();},f),i=await Promise.resolve(new Promise((F,C)=>{exec(`${o} view ${t} version --registry=${u}`,{signal:c.signal,maxBuffer:1024*1024*10},($,Y,b)=>{let T=b?J(b):"";return $&&!$.message.toLowerCase().trim().startsWith("npm warn")?C(T?new Error(T,{cause:$}):$):T?C(new Error(T)):F(H(Y))});}));if(!valid(i,!0))throw clearTimeout(s),new Error(v(i).startsWith("[WARN] Request took")?`A timeout occurred while fetching the version for package "${t}" with tag "${r}".`:`Invalid version "${i}" fetched for package "${t}" with tag "${r}"`);return clearTimeout(s),i}catch(c){if(g=c,n<a){let s=Math.pow(2,n)*100;await new Promise(i=>setTimeout(i,s));}}throw g}async function q(t=e(process.cwd())){let r=await i(t);if(!r){a(`No package.json file found in workspace root: ${t}`,{logLevel:"all"});return}let e=j(r);if(e)return Object.fromEntries(Object.entries(e).map(([o,a])=>[o,a.replaceAll('"',"").replaceAll("'","")]));console.warn(`No catalog found in package.json file located in workspace root: ${t}
|
|
3
|
-
File content: ${JSON.stringify(r,null,2)}`);}async function X(t=e(process.cwd())){let r=await q(t);if(!r)throw new Error("No catalog entries found in workspace root package.json file");return r}async function K(t,r=e(process.cwd())){let e=await i(r);if(!e)throw new Error("No package.json file found in workspace root");k(e,Object.fromEntries(Object.entries(t).filter(([,o])=>o&&(o.startsWith("npm:")||valid(a$1(o),true))).map(([o,a])=>[o,a.replaceAll('"',"").replaceAll("'","")]))),await l(e,r);}async function xt(t,r,e$1={}){let{tag:o=d,prefix:a="^",workspaceRoot:f=e(),verbose:u=false}=e$1,g$1=await g(true,{workspaceRoot:f});u&&c(`Upgrading catalog entry for package "${r}" with tag "${o}"`,g$1);let n=await A(),c$1=await G(r,o,{executable:"bun pm",registry:n});if(!c$1)throw new Error(`Failed to fetch version for package "${r}" with tag "${o}"`);if(!valid(a$1(c$1),true))throw new Error(`Invalid version "${c$1}" fetched for package "${r}" with tag "${o}"`);let s=`${a||""}${a$1(c$1)}`,i=false;return t[r]?.startsWith("npm:")?(t[r]=s,b(`Writing version ${t[r]} to catalog for "${r}" package`,g$1)):!valid(coerce(t[r]))||coerce(t[r])&&coerce(s)&>(coerce(s),coerce(t[r]))?(t[r]=`${a||""}${a$1(s)}`,b(`Writing version ${t[r]} to catalog for "${r}" package`,g$1),i=true):u&&b(`The current version ${t[r]} for package "${r}" is greater than or equal to the version ${a$1(s)} fetched from the npm registry with tag "${o}". No update performed.`,g$1),{catalog:t,updated:i}}async function yt(t,r={}){let{tag:e$1=d,prefix:o="^",throwIfMissingInCatalog:a$2=false,workspaceRoot:f=e(),verbose:u=false}=r,g$1=await g(true,{workspaceRoot:f}),n=await X(f);if(!n)throw new Error("No catalog found");if(a$2===true&&!n[t])throw new Error(`Package "${t}" not found in catalog: ${JSON.stringify(n,null,2)}`);u&&c(`Upgrading catalog entry for package "${t}" with tag "${e$1}"`,g$1);let c$1=await A(),s=await G(t,e$1,{executable:"bun pm",registry:c$1});if(!s)throw new Error(`Failed to fetch version for package "${t}" with tag "${e$1}"`);if(!valid(a$1(s),true))throw new Error(`Invalid version "${s}" fetched for package "${t}" with tag "${e$1}"`);let i=`${o||""}${a$1(s)}`;i===n[t]?u&&c(`The version for package "${t}" is already up to date in the catalog: ${i}`,g$1):!valid(a$1(n[t]),true)||coerce(n[t])&&coerce(i)&>(coerce(i),coerce(n[t]))?(n[t]=`${o||""}${a$1(i)}`,b(`Writing version ${n[t]} to catalog for "${t}" package`,g$1),await K(n,f)):u&&a(`The current version "${n[t]}" for package "${t}" is greater than or equal to the version "${i}" fetched from the npm registry with tag "${e$1}". No update performed.`,g$1);}export{q as a,X as b,K as c,xt as d,yt as e};
|