@visulima/vis 5.0.0 → 6.0.0
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 +101 -0
- package/LICENSE.md +151 -88
- package/README.md +2 -2
- package/dist/bin.js +1 -1
- package/dist/binx.js +1 -1
- package/dist/config/index.d.ts +16 -18
- package/dist/packem_chunks/CONFIG_FILES.js +4 -4
- package/dist/packem_chunks/bloom-status.js +1 -1
- package/dist/packem_chunks/bloom-sync.js +1 -1
- package/dist/packem_chunks/catalog.js +61 -51
- package/dist/packem_chunks/cli-exec.js +1 -1
- package/dist/packem_chunks/cli-main.js +202 -176
- package/dist/packem_chunks/dart-plan.js +1 -1
- package/dist/packem_chunks/dart-projects.js +1 -1
- package/dist/packem_chunks/dispatch.js +1 -1
- package/dist/packem_chunks/doctor-probe.js +1 -1
- package/dist/packem_chunks/fix.js +1 -1
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +4 -4
- package/dist/packem_chunks/handler11.js +1 -1
- package/dist/packem_chunks/handler12.js +1 -1
- package/dist/packem_chunks/handler13.js +1 -1
- package/dist/packem_chunks/handler14.js +1 -1
- package/dist/packem_chunks/handler15.js +1 -1
- package/dist/packem_chunks/handler16.js +1 -1
- package/dist/packem_chunks/handler17.js +1 -1
- package/dist/packem_chunks/handler18.js +1 -1
- package/dist/packem_chunks/handler19.js +1 -1
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler20.js +2 -2
- package/dist/packem_chunks/handler21.js +1 -1
- package/dist/packem_chunks/handler22.js +2 -2
- package/dist/packem_chunks/handler23.js +1 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler26.js +3 -3
- package/dist/packem_chunks/handler27.js +1 -1
- package/dist/packem_chunks/handler28.js +1 -1
- package/dist/packem_chunks/handler29.js +1 -1
- package/dist/packem_chunks/handler3.js +1 -1
- package/dist/packem_chunks/handler30.js +1 -1
- package/dist/packem_chunks/handler39.js +6 -6
- package/dist/packem_chunks/handler5.js +1 -1
- package/dist/packem_chunks/handler50.js +2 -2
- package/dist/packem_chunks/handler51.js +1 -1
- package/dist/packem_chunks/handler53.js +1 -1
- package/dist/packem_chunks/handler54.js +1 -1
- package/dist/packem_chunks/handler55.js +1 -1
- package/dist/packem_chunks/handler58.js +1 -1
- package/dist/packem_chunks/handler59.js +1 -1
- package/dist/packem_chunks/handler6.js +1 -1
- package/dist/packem_chunks/handler60.js +7 -7
- package/dist/packem_chunks/handler61.js +2 -2
- package/dist/packem_chunks/handler62.js +2 -2
- package/dist/packem_chunks/handler63.js +1 -1
- package/dist/packem_chunks/handler64.js +2 -2
- package/dist/packem_chunks/handler65.js +3 -3
- package/dist/packem_chunks/handler66.js +2 -2
- package/dist/packem_chunks/handler67.js +31 -20
- package/dist/packem_chunks/handler68.js +1 -1
- package/dist/packem_chunks/handler69.js +4 -4
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler70.js +5 -5
- package/dist/packem_chunks/handler71.js +1 -1
- package/dist/packem_chunks/handler72.js +1 -1
- package/dist/packem_chunks/handler73.js +1 -1
- package/dist/packem_chunks/handler74.js +1 -1
- package/dist/packem_chunks/handler75.js +36 -36
- package/dist/packem_chunks/handler76.js +1 -1
- package/dist/packem_chunks/handler77.js +3 -3
- package/dist/packem_chunks/handler78.js +24 -24
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +1 -1
- package/dist/packem_chunks/heal.js +1 -1
- package/dist/packem_chunks/help-command.js +40 -7
- package/dist/packem_chunks/index2.js +32 -32
- package/dist/packem_chunks/index6.js +1 -1
- package/dist/packem_chunks/keys-refresh.js +1 -1
- package/dist/packem_chunks/lean.js +3 -4
- package/dist/packem_chunks/list.js +1 -1
- package/dist/packem_chunks/loader.js +1 -1
- package/dist/packem_chunks/orchestrator.js +1 -1
- package/dist/packem_chunks/prompts.js +1 -1
- package/dist/packem_chunks/status.js +1 -1
- package/dist/packem_chunks/sync.js +1 -1
- package/dist/packem_chunks/sync2.js +1 -1
- package/dist/packem_chunks/tripwire.js +1 -1
- package/dist/packem_chunks/ts-loader.js +5 -5
- package/dist/packem_chunks/verify-lockfile.js +1 -1
- package/dist/packem_shared/{affected-selection-BJXJW_3Q.js → affected-selection-DDxwjwM4.js} +1 -1
- package/dist/packem_shared/{affected-shas-B_kfSKss.js → affected-shas-BuaWvmsG.js} +1 -1
- package/dist/packem_shared/{ai-fix-BC6aIRJT.js → ai-fix-C2BhFFhi.js} +5 -5
- package/dist/packem_shared/{augment-B9kSZuvW.js → augment-CxUPE8KX.js} +1 -1
- package/dist/packem_shared/{bin-Dx8mjl3g.js → bin-Be7_QhQK.js} +1 -1
- package/dist/packem_shared/{build-scripts-CEDx_nJp.js → build-scripts-DxyVSkgM.js} +1 -1
- package/dist/packem_shared/command-runtime-BXvH5EC0.js +1 -0
- package/dist/packem_shared/{dart-pubspec-BK_cK2EP.js → dart-pubspec-DvmyleIr.js} +2 -2
- package/dist/packem_shared/{dependency-scan-B8jroa1D.js → dependency-scan-DKK3ZEZI.js} +1 -1
- package/dist/packem_shared/{docker-DXqV-07f.js → docker-BTuwdXaC.js} +1 -1
- package/dist/packem_shared/{ecosystem-gate-CeV20GSB.js → ecosystem-gate-BpQNUJzN.js} +1 -1
- package/dist/packem_shared/{env-consistency-Dt_uDbSP.js → env-consistency-CUBJHENL.js} +1 -1
- package/dist/packem_shared/{failure-log-D2x5BT8S.js → failure-log-kp0n2rbD.js} +1 -1
- package/dist/packem_shared/{formatBytes-BHAzNIrn-CrusHOew.js → formatBytes-BHAzNIrn-DRcKvqnb.js} +1 -1
- package/dist/packem_shared/{index-BzhrR_iC.js → index-BdMIfGVZ.js} +15 -15
- package/dist/packem_shared/index-C9ENZqH9.js +39 -0
- package/dist/packem_shared/{index-nEyN71oX.js → index-DQfNpt2u.js} +1 -1
- package/dist/packem_shared/{index-C_ScJMpb.js → index-DsSWb5XH.js} +1 -1
- package/dist/packem_shared/{index.server-sXNQYpsl.js → index.server-D8BLnYZO.js} +2 -2
- package/dist/packem_shared/{isAccessibleSync-DYKTrrvc-C-_5cgwu.js → isAccessibleSync-DYKTrrvc-BwaMhQs0.js} +1 -1
- package/dist/packem_shared/{lifecycle-D6PMPor-.js → lifecycle-BAhkhE2L.js} +1 -1
- package/dist/packem_shared/{lockfile-CiUtEbnt.js → lockfile-DHmlPGk1.js} +1 -1
- package/dist/packem_shared/{manifests-Du4yKlf_.js → manifests-Dd4Hoztt.js} +1 -1
- package/dist/packem_shared/{min-release-age-JViyQuBM.js → min-release-age-BJnOQaoF.js} +1 -1
- package/dist/packem_shared/{missing-package-json-Cu5YVAot.js → missing-package-json-DfzrGwe1.js} +1 -1
- package/dist/packem_shared/{multi-eco-lockfiles-B2X3yhyo.js → multi-eco-lockfiles-BIa6xvJc.js} +1 -1
- package/dist/packem_shared/{native-config-sync-TdTWjVgI.js → native-config-sync-Dr9XvxOf.js} +1 -1
- package/dist/packem_shared/osv-bloom-t40ra5U5.js +2 -0
- package/dist/packem_shared/{package-version-CiRZecQu.js → package-version-CFuNUWDG.js} +2 -2
- package/dist/packem_shared/{packument-Df46y5MY.js → packument-C9nRiBJf.js} +1 -1
- package/dist/packem_shared/pm-runner-ImwtpnWY.js +1 -0
- package/dist/packem_shared/{project-name-filter-CH8Ih7Qr.js → project-name-filter-C2rkW-Vn.js} +1 -1
- package/dist/packem_shared/{provenance-DKeR0Ig1.js → provenance-DF-ypZj3.js} +1 -1
- package/dist/packem_shared/{readJsonSync-CbryXYxN-EWl7_7KX.js → readJsonSync-CbryXYxN-Bm5i10UW.js} +1 -1
- package/dist/packem_shared/{registry-keys-DwB3ZXS_.js → registry-keys-BLuHOyZu.js} +1 -1
- package/dist/packem_shared/{resolve-explicit-BmV8YBE-.js → resolve-explicit-BDaQRR6o.js} +1 -1
- package/dist/packem_shared/resolve-runtime-Cr19Pk6L.js +1 -0
- package/dist/packem_shared/{run-file-UBukWaha.js → run-file-XbRCF6Mp.js} +1 -1
- package/dist/packem_shared/{runtime-check-1U8HrQd9.js → runtime-check-Bh5q9IrT.js} +1 -1
- package/dist/packem_shared/{s1ngularity-DZhkIqL4.js → s1ngularity-UCZN7skW.js} +1 -1
- package/dist/packem_shared/{scan-progress-CkumcBG-.js → scan-progress-DcYI76zE.js} +1 -1
- package/dist/packem_shared/{selectors-edwcgNl3.js → selectors-DCiEU0iv.js} +2 -2
- package/dist/packem_shared/{signatures-BxTMck2l.js → signatures-CicxPHN4.js} +1 -1
- package/dist/packem_shared/target-merge-BClIXg2k.js +14 -0
- package/dist/packem_shared/{target-options-DsHFmRZH.js → target-options-PgWIuJnb.js} +1 -1
- package/dist/packem_shared/{task-env-DzR4RkOj.js → task-env-Dl08aklA.js} +1 -1
- package/dist/packem_shared/toolchain-DvUxlbDz.js +5 -0
- package/dist/packem_shared/{typosquats-8u0drCqQ.js → typosquats-DxPzyK7u.js} +1 -1
- package/dist/packem_shared/{verify-B_MblU_Q.js → verify-CadR9PUk.js} +1 -1
- package/dist/packem_shared/{vis-update-app-BCIccZfA.js → vis-update-app-DrFWQyPn.js} +1 -1
- package/dist/packem_shared/{vis-user-error-Dd7hwxlW.js → vis-user-error-k7CLTpA4.js} +15 -15
- package/dist/packem_shared/{watch-CcTketln.js → watch-Dr_6yz3o.js} +1 -1
- package/dist/packem_shared/watch-loop-BId9vT7Q.js +11 -0
- package/dist/packem_shared/{writeFileSync-DJoHk3Ks-BPRoepNw.js → writeFileSync-DJoHk3Ks-Dhem3Uof.js} +1 -1
- package/dist/release/core/version-actions/index.d.ts +1 -1
- package/dist/release/presets.d.ts +1 -55
- package/dist/release/presets.js +1 -1
- package/dist/release/types.d.ts +1 -18
- package/dist/runtime/preload.js +1 -1
- package/index.d.ts +204 -204
- package/index.js +26 -26
- package/package.json +10 -10
- package/schemas/vis-config.schema.json +6 -28
- package/schemas/vis-release-config.schema.json +1 -12
- package/dist/packem_shared/Table-BB8xHTU5-BLPS917D.js +0 -11
- package/dist/packem_shared/command-runtime-p4IXiIf6.js +0 -1
- package/dist/packem_shared/index-BisalDCf.js +0 -39
- package/dist/packem_shared/osv-bloom-BCAX5ARR.js +0 -2
- package/dist/packem_shared/pm-runner-3iiQayy-.js +0 -1
- package/dist/packem_shared/resolve-runtime-CNiHcVtx.js +0 -1
- package/dist/packem_shared/target-merge-DVJl-7Qz.js +0 -4
- package/dist/packem_shared/toolchain-BRdpaAC4.js +0 -5
- package/dist/packem_shared/watch-loop-BBkg02-Q.js +0 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as k,D as
|
|
1
|
+
import{m as k,D as $,f as L}from"./provenance-DF-ypZj3.js";import{g as S}from"./packument-C9nRiBJf.js";import{f}from"./formatBytes-BHAzNIrn-DRcKvqnb.js";import{a as E}from"./build-scripts-DxyVSkgM.js";import{n as h}from"./license-DvlYdo6T.js";import{z as A,U as P,a as x}from"./index-BdMIfGVZ.js";import{S as M}from"./lockfile-DhHAaHN5.js";import{L as b}from"./dependency-scan-DKK3ZEZI.js";import{M as O}from"../packem_chunks/catalog.js";const C=2,m=4,y={CRITICAL:0,HIGH:1,LOW:3,MODERATE:C,UNKNOWN:m},le=(e,s)=>{const n=y[(e.vulnerability.severity??"UNKNOWN").toUpperCase()]??m,t=y[(s.vulnerability.severity??"UNKNOWN").toUpperCase()]??m;return n-t||e.packageName.localeCompare(s.packageName)||e.packageVersion.localeCompare(s.packageVersion)},D=(e,s)=>{const n=y[s.toUpperCase()]??C;return(y[e.toUpperCase()]??m)<=n},R=["firstSeen","installScripts","license","malware","publisherChange","score","unexpectedDeps","vulnerability"],w=6e4,W=(e,s,n)=>{for(const t of n)if(t===e||t===`${e}@${s}`||t.endsWith("*")&&e.startsWith(t.slice(0,-1)))return!0;return!1},U=async(e,s)=>{const n=s.security?.policies?.firstSeen;if(n?.minutes===void 0||n.minutes<=0)return[];const{minutes:t}=n,r=n.exclude??[],c=s.security?.acceptedRisks,a=t*w,o=Date.now();return(await k(e.packages,$,async l=>{if(W(l.name,l.version,r))return;const p=await S(l.name,{workspaceRoot:e.workspaceRoot});if(p===void 0)return;const u=p.time?.[l.version];if(u===void 0)return;const d=Date.parse(u);if(Number.isNaN(d))return;const v=o-d;if(v>=a)return;const g=Math.max(0,Math.floor(v/w));return{acceptedRisk:f(l.name,l.version,c,"firstSeen"),data:{ageMinutes:g,minimumMinutes:t,publishedAt:u},packageName:l.name,policy:"firstSeen",reason:`${l.name}@${l.version} was published ${String(g)} min ago — below the ${String(t)} min firstSeen cooldown.`,severity:"block",version:l.version}})).filter(l=>l!==void 0)},_=(e,s)=>{const n=s.security?.policies?.installScripts;if(!n)return[];const t=n.allow??{},r=n.strict===!0;if(!r&&Object.keys(t).length===0)return[];const c=E(e.workspaceRoot,t,{pinVersions:s.security?.pinVersions===!0});if(c.unapproved.length===0)return[];const a=s.security?.acceptedRisks,o=r?"block":"warn";return c.unapproved.map(i=>({acceptedRisk:f(i.name,i.version??"*",a,"installScripts"),data:{hooks:i.hooks},packageName:i.name,policy:"installScripts",reason:`${i.name}${i.version?`@${i.version}`:""} declares unapproved build script(s): ${i.hooks.join(", ")}`,severity:o,version:i.version??"*"}))},I=new Set(["AND","OR"]),F=e=>{const s=e.replaceAll("("," ").replaceAll(")"," ").split(/\s+/).map(r=>r.trim()).filter(r=>r.length>0),n=[];let t=!1;for(const r of s){const c=r.toUpperCase();if(t){t=!1;continue}if(c==="WITH"){t=!0;continue}if(I.has(c))continue;const a=r.endsWith("+"),o=a?r.slice(0,-1):r,i=h(o)??o;n.push(i),a&&n.push(`${i}-or-later`)}return n},T=e=>{if(typeof e.license=="string"){const s=e.license.trim();return s.length>0?s:void 0}if(e.license&&typeof e.license=="object"&&typeof e.license.type=="string"){const s=e.license.type.trim();if(s.length>0)return s}if(Array.isArray(e.licenses)&&e.licenses.length>0){const s=e.licenses.map(n=>n&&typeof n.type=="string"?n.type.trim():"").filter(n=>n.length>0);if(s.length>0)return s.length===1?s[0]:`(${s.join(" OR ")})`}},V=(e,s)=>{if(s.length===0)return;const n=new Set(s.map(t=>h(t)??t).map(t=>t.toLowerCase()));for(const t of e)if(n.has(t.toLowerCase()))return t},K=(e,s)=>{if(s.length===0)return;const n=new Set(s.map(t=>h(t)??t).map(t=>t.toLowerCase()));for(const t of e)if(!n.has(t.toLowerCase()))return t},j=(e,s)=>{const n=s.security?.policies?.license;if(!n)return[];const t=n.allow??[],r=n.deny??[];if(t.length===0&&r.length===0)return[];const c=s.security?.acceptedRisks,a=[];for(const o of e.packages){const i=e.manifestData?.get(`${o.name}@${o.version}`),l=i?T(i):void 0;if(!l){t.length>0&&a.push({acceptedRisk:f(o.name,o.version,c,"license"),data:{declaredLicense:null},packageName:o.name,policy:"license",reason:`${o.name}@${o.version} declares no license; allow-list mode requires one of: ${t.join(", ")}`,severity:"block",version:o.version});continue}const p=F(l),u=V(p,r);if(u){a.push({acceptedRisk:f(o.name,o.version,c,"license"),data:{declaredLicense:l,deniedLicense:u},packageName:o.name,policy:"license",reason:`${o.name}@${o.version} uses denied license '${u}' (declared: ${l})`,severity:"block",version:o.version});continue}const d=K(p,t);d&&a.push({acceptedRisk:f(o.name,o.version,c,"license"),data:{allowList:t,declaredLicense:l,unallowedLicense:d},packageName:o.name,policy:"license",reason:`${o.name}@${o.version} uses license '${d}' which is not on the allow-list (declared: ${l})`,severity:"block",version:o.version})}return a},z=6e4,B=(e,s,n)=>{for(const t of n)if(t===e||t===`${e}@${s}`||t.endsWith("*")&&e.startsWith(t.slice(0,-1)))return!0;return!1},Y=async(e,s)=>{const n=s.security?.policies?.publisherChange;if(n?.mode!=="no-downgrade")return[];const t=n.exclude??[],r=typeof n.ignoreAfter=="number"?n.ignoreAfter*z:void 0,c=s.security?.acceptedRisks,a=Date.now();return(await k(e.packages,$,async i=>{if(B(i.name,i.version,t))return;const l=await S(i.name,{workspaceRoot:e.workspaceRoot});if(l===void 0)return;if(r!==void 0){const d=l.time?.[i.version],v=d===void 0?Number.NaN:Date.parse(d);if(!Number.isNaN(v)&&a-v>r)return}if(l.versions[i.version]?.dist?.attestations?.provenance!==void 0)return;const u=L(l,i.version);if(u!==void 0)return{acceptedRisk:f(i.name,i.version,c,"publisherChange"),data:{priorVersionWithProvenance:u},packageName:i.name,policy:"publisherChange",reason:`${i.name}@${i.version} dropped the provenance attestation that ${i.name}@${u} carried — publisher trust downgrade.`,severity:"block",version:i.version}})).filter(i=>i!==void 0)},H=e=>{for(const s of Object.values(b))for(const n of[s.file,...s.aliases??[]])if(e===n||e.endsWith(`/${n}`)||e.endsWith(`.${n}`))return s.type},q=(e,s,n)=>{const t=A(s)?s:P(e,s);let r;try{r=x(t)}catch{return}const c=H(t)??b[n]?.type;if(!c)return;const a=M(r,c);if(a.length===0)return;const o=new Set;for(const i of a)o.add(`${i.name}@${i.version}`);return o},G=(e,s)=>{for(const n of s)if(n===e||n.endsWith("*")&&e.startsWith(n.slice(0,-1)))return!0;return!1},X=(e,s)=>{const n=s.security?.policies?.unexpectedDeps;if(!n)return[];const t=n.allow??[],r=n.baselineLockfile;if(t.length===0&&!r)return[];const c=r?q(e.workspaceRoot,r,e.packageManager):void 0,a=s.security?.acceptedRisks,o=[];for(const i of e.packages){const l=t.length===0||G(i.name,t),p=c?c.has(`${i.name}@${i.version}`):!0;if(l&&p)continue;const u=[],d={};l||(u.push(`not on allow-list (${t.length} entr${t.length===1?"y":"ies"})`),d.allowList=t),!p&&c&&(u.push(`not present in baseline lockfile (${r})`),d.baselineLockfile=r),o.push({acceptedRisk:f(i.name,i.version,a,"unexpectedDeps"),data:d,packageName:i.name,policy:"unexpectedDeps",reason:`${i.name}@${i.version} is unexpected: ${u.join("; ")}`,severity:"block",version:i.version})}return o},J=(e,s)=>{if(!e.osvFindings||e.osvFindings.size===0)return[];const t=s.security?.policies?.vulnerability?.failOn,r=s.security?.acceptedRisks,c=[];for(const a of e.packages){const o=e.osvFindings.get(O(a.name,a.version))??e.osvFindings.get(a.name);if(!(!o||o.length===0))for(const i of o){const l=t?D(i.severity,t)?"block":"warn":"info";c.push({acceptedRisk:f(a.name,a.version,r,"vulnerability"),data:{advisoryId:i.id,aliases:i.aliases??[],cvssScore:i.cvssScore,fixedVersions:i.fixedVersions,severity:i.severity,summary:i.summary},packageName:a.name,policy:"vulnerability",reason:`${i.severity} ${i.id} affects ${a.name}@${a.version}: ${i.summary}`,severity:l,version:a.version})}}return c},N=[{evaluate:J,isConfigured:e=>e.security?.policies?.vulnerability!==void 0,name:"vulnerability",offlineSupported:!0,surfaces:["audit","doctor"]},{evaluate:j,isConfigured:e=>{const s=e.security?.policies?.license;return!!(s&&(s.allow&&s.allow.length>0||s.deny&&s.deny.length>0))},name:"license",offlineSupported:!0,surfaces:["audit","doctor","install"]},{evaluate:_,isConfigured:e=>{const s=e.security?.policies?.installScripts;return!!(s&&(s.allow&&Object.keys(s.allow).length>0||s.strict===!0))},name:"installScripts",offlineSupported:!0,surfaces:["audit","doctor","install"]},{evaluate:X,isConfigured:e=>{const s=e.security?.policies?.unexpectedDeps;return!!(s&&(s.allow&&s.allow.length>0||typeof s.baselineLockfile=="string"))},name:"unexpectedDeps",offlineSupported:!0,surfaces:["audit","doctor","install"]},{evaluate:U,isConfigured:e=>{const s=e.security?.policies?.firstSeen?.minutes;return typeof s=="number"&&s>0},name:"firstSeen",offlineSupported:!1,surfaces:["audit","doctor","install"]},{evaluate:Y,isConfigured:e=>e.security?.policies?.publisherChange?.mode==="no-downgrade",name:"publisherChange",offlineSupported:!1,surfaces:["audit","doctor","install"]}],Q=(e,s,n)=>N.filter(t=>t.surfaces.includes(e)?n!==void 0?n.has(t.name):t.isConfigured(s):!1),ue=async(e,s,n)=>{const t=Q(s,n.visConfig,n.enabledPolicies),r=[];for(const c of t){if(e.offline&&!c.offlineSupported){r.push({packageName:"*",policy:c.name,reason:`policy.${c.name} skipped: requires network (--offline)`,severity:"info",version:"*"});continue}try{const a=await c.evaluate(e,n.visConfig);r.push(...a)}catch(a){const o=a instanceof Error?a.message:String(a);r.push({packageName:"*",policy:c.name,reason:`policy.${c.name} failed: ${o}`,severity:"info",version:"*"})}}return r},Z=(()=>{const e=new Map;for(const s of R)e.set(s.toLowerCase(),s);return e})(),de=()=>N.map(e=>e.name),pe=(e,s)=>{if(e===void 0)return;const n=e.trim().toLowerCase();if(n===""||n==="none")return new Set;if(n==="all")return new Set(R);const t=new Set;for(const r of e.split(",").map(c=>c.trim()).filter(c=>c.length>0)){const c=r.replace(/^_+/,"").replaceAll(/_+([a-z])/g,(o,i)=>i.toUpperCase()),a=Z.get(c.toLowerCase());a===void 0?s?.(r):t.add(a)}return t};export{le as c,ue as e,de as g,pe as p,D as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as e}from"./vis-user-error-
|
|
1
|
+
import{b as e}from"./vis-user-error-k7CLTpA4.js";const o={filter:{alias:"F",description:"Filter packages by name pattern",multiple:!0,type:String},parallel:{defaultValue:!1,description:"Run concurrently without topological ordering",type:Boolean},recursive:{alias:"r",defaultValue:!1,description:"Run in every workspace package",type:Boolean},reverse:{defaultValue:!1,description:"Reverse topological execution order",type:Boolean},"shell-mode":{alias:"c",defaultValue:!1,description:"Execute within shell environment",type:Boolean},"workspace-root":{alias:"w",defaultValue:!1,description:"Run on workspace root only",type:Boolean}},l=e({argument:{description:"Command to execute followed by arguments",name:"command",type:String},description:"Execute a local node_modules/.bin command (no remote fallback)",examples:[["vis exec eslint .","Run local eslint"],["vis exec tsc --noEmit","Run local TypeScript check"],["vis exec -r -- eslint .","Run in all workspace packages"],["vis exec -c 'echo $PATH'","Shell mode"]],group:"Run & Execute",loader:()=>import("../packem_chunks/handler.js"),name:"exec",options:o});export{l as e};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const G=/^-{1,2}(no-color|no-colors|color=false|color=never)$/,D=/^-{1,2}(color=256)$/,P=/^-{1,2}(color=16m|color=full|color=truecolor)$/,L=/^-{1,2}(color|colors|color=true|color=always)$/,
|
|
2
|
-
`)&&(i=i.replace(/(\r*\n)/g,`${s.closeStack}$1${s.openStack}`)),s.openStack+i+s.closeStack},A=function(t){const e=t?.level??x,{baseColors:s,baseStyles:i,styleMethods:c}=I(e),g={};let u=null;const
|
|
1
|
+
const G=/^-{1,2}(no-color|no-colors|color=false|color=never)$/,D=/^-{1,2}(color=256)$/,P=/^-{1,2}(color=16m|color=full|color=truecolor)$/,L=/^-{1,2}(color|colors|color=true|color=always)$/,Y=/-mono|dumb/i,j=/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/,F=/-256(color)?$/i,W=/^screen|^tmux|^xterm|^vt[1-5]\d\d|^ansi|color|mintty|rxvt|cygwin|linux/i,U=()=>{const t=globalThis.process?.getBuiltinModule;return typeof t!="function"?"":t("node:os").release()},_=(t,e={})=>{const{isTTY:s,sniffFlags:i=!0}=e,c=globalThis,g=c.Deno!=null,u=c.process??c.Deno??{},p=u.argv??u.args??[],$=i?p.indexOf("--"):-1,a=f=>{if(!i)return!1;const R=p.findIndex(k=>f.test(k));return R!==-1&&($===-1||R<$)};let n={};try{n=g?c.Deno.env.toObject():u.env??{}}catch{}const o="FORCE_COLOR",b=o in n,l=n[o]??void 0,m=typeof l=="string",y=typeof l=="number";let B;if(l==="true")B=1;else if(l==="false")B=0;else if(m&&l.length===0)B=1;else if(m&&l.length>0){const f=Number.parseInt(l,10);B=Number.isNaN(f)?void 0:Math.max(0,Math.min(f,3))}else y&&(B=Number.isNaN(l)?void 0:Math.max(0,Math.min(l,3)));if(l!=="true"&&l!=="false"&&B!==void 0&&B<4)return B;const w=b&&B!==void 0&&B>0;if(b&&B===0||a(G)||!w&&"NO_COLOR"in n)return 0;if(a(D))return 2;if(a(P))return 3;if(a(L))return 1;const O=B??0;if("TF_BUILD"in n&&"AGENT_NAME"in n)return 1;if(n.TERM&&Y.test(n.TERM))return O;if(g?c.Deno.build.os==="windows":u.platform==="win32"){if("WT_SESSION"in n)return 3;if("ANSICON"in n)return 1;try{let f;g?f=c.Deno.osRelease():typeof u.os?.release=="function"?f=u.os.release():f=U();const R=f.split(".");return Number(R[0])>=10&&Number(R[2])>=10586?Number(R[2])>=14931?3:2:1}catch{}}if("CI"in n)return["GITEA_ACTIONS","CIRCLECI","GITHUB_WORKFLOW","GITHUB_ACTIONS"].some(f=>f in n)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(f=>f in n)||n.CI_NAME==="codeship"?1:O;if(n.TERMINAL_EMULATOR?.includes("JediTerm"))return 3;if("TEAMCITY_VERSION"in n)return j.test(n.TEAMCITY_VERSION)?1:0;if(n.COLORTERM==="truecolor"||n.TERM==="xterm-kitty"||n.TERM==="xterm-ghostty"||n.TERM==="wezterm")return 3;if("TERM_PROGRAM"in n){const f=Number.parseInt((n.TERM_PROGRAM_VERSION??"").split(".")[0],10);if(n.TERM_PROGRAM==="iTerm.app")return f>=3?3:2;if(n.TERM_PROGRAM==="Apple_Terminal")return 2}if(F.test(n.TERM))return 2;let T;return s!==void 0?T=s:g?T=t==="out"?c.Deno.stdout.isTerminal():c.Deno.stderr.isTerminal():"PM2_HOME"in n&&"pm_id"in n?T=!0:T=!!u[`std${t}`]?.isTTY,T&&W.test(n.TERM)||"COLORTERM"in n?1:O},V=()=>_("out"),H=()=>_("err");function q({onlyFirst:t=!1}={}){const e="(?:\\u001B\\][^\\u0007\\u001B\\u009C]*(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(e,t?void 0:"g")}const M=(t,e,s)=>e>t?e:Math.min(t,s),z=/^#?([a-f\d]{3}|[a-f\d]{6})$/i,J=t=>{let[,e]=z.exec(t)??[];const s=e?e.length:0;if(s===3){const c=e.charAt(0),g=e.charAt(1),u=e.charAt(2);e=c+c+g+g+u+u}else if(s!==6)return globalThis.process?.env?.NODE_ENV!=="production"&&console.warn(`[@visulima/colorize] Invalid hex color "${t}"; expected a 3- or 6-digit hex string (e.g. "#96C" or "#E0115F"). Falling back to black.`),[0,0,0];const i=Number.parseInt(e,16);return[i>>16&255,i>>8&255,i&255]},v=(t,e,s)=>t===e&&e===s?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/51)+6*Math.round(e/51)+Math.round(s/51),C=t=>{let e,s,i;if(t<8)return 30+t;if(t<16)return 90+(t-8);if(t>=232)e=s=i=((t-232)*10+8)/255;else{t-=16;const u=t%36;e=Math.floor(t/36)/5,s=Math.floor(u/6)/5,i=u%6/5}const c=Math.max(e,s,i)*2;if(c===0)return 30;const g=30+(Math.round(i)<<2|Math.round(s)<<1|Math.round(e));return c===2?g+60:g},S=(t,e,s)=>C(v(t,e,s)),h=39,d=49,N=10,E={close:"",open:""},I=t=>{const e=t>0?(o,b)=>({close:`\x1B[${String(b)}m`,open:`\x1B[${String(o)}m`}):()=>E,s=o=>(b,l,m)=>o(v(Number(b),Number(l),Number(m))),i=o=>b=>{const[l,m,y]=J(b);return o(l,m,y)};let c=o=>e(`38;5;${String(o)}`,h),g=o=>e(`48;5;${String(o)}`,d),u=(o,b,l)=>e(`38;2;${String(o)};${String(b)};${String(l)}`,h),p=(o,b,l)=>e(`48;2;${String(o)};${String(b)};${String(l)}`,d);t===1?(c=o=>e(C(Number(o)),h),g=o=>e(C(Number(o))+N,d),u=(o,b,l)=>e(S(Number(o),Number(b),Number(l)),h),p=(o,b,l)=>e(S(Number(o),Number(b),Number(l))+N,d)):t===2&&(u=s(c),p=s(g));const $={bold:e(1,22),dim:e(2,22),hidden:e(8,28),inverse:e(7,27),italic:e(3,23),overline:e(53,55),reset:e(0,0),strike:e(9,29),strikethrough:e(9,29),underline:e(4,24),underlineCurly:e("4:3",24),underlineDashed:e("4:5",24),underlineDotted:e("4:4",24),underlineDouble:e("4:2",24),visible:E},a={bgBlack:e(40,d),bgBlackBright:e(100,d),bgBlue:e(44,d),bgBlueBright:e(104,d),bgCyan:e(46,d),bgCyanBright:e(106,d),bgGray:e(100,d),bgGreen:e(42,d),bgGreenBright:e(102,d),bgGrey:e(100,d),bgMagenta:e(45,d),bgMagentaBright:e(105,d),bgRed:e(41,d),bgRedBright:e(101,d),bgWhite:e(47,d),bgWhiteBright:e(107,d),bgYellow:e(43,d),bgYellowBright:e(103,d),black:e(30,h),blackBright:e(90,h),blue:e(34,h),blueBright:e(94,h),cyan:e(36,h),cyanBright:e(96,h),gray:e(90,h),green:e(32,h),greenBright:e(92,h),grey:e(90,h),magenta:e(35,h),magentaBright:e(95,h),red:e(31,h),redBright:e(91,h),white:e(37,h),whiteBright:e(97,h),yellow:e(33,h),yellowBright:e(93,h)},n={bg:o=>g(M(o,0,255)),bgHex:i(p),bgRgb:(o,b,l)=>p(M(o,0,255),M(b,0,255),M(l,0,255)),fg:o=>c(M(o,0,255)),hex:i(u),rgb:(o,b,l)=>u(M(o,0,255),M(b,0,255),M(l,0,255))};return{baseColors:a,baseStyles:$,styleMethods:n}},x=V(),K=H();I(x);const X=(t,e,s)=>{if(e==="")return t;let i=t.indexOf(e);if(i<0)return t;const c=e.length;let g=0,u="";for(;~i;)u+=t.slice(g,i)+s,g=i+c,i=t.indexOf(e,g);return u+t.slice(g)},Z=(t,e,s)=>{if(t==null||t==="")return"";let i;if(t.raw===void 0?i=String(t):i=String.raw(t,...e),i.includes("\x1B"))for(let c=s;c;c=c.props)i=X(i,c.close,c.open);return i.includes(`
|
|
2
|
+
`)&&(i=i.replace(/(\r*\n)/g,`${s.closeStack}$1${s.openStack}`)),s.openStack+i+s.closeStack},A=function(t){const e=t?.level??x,{baseColors:s,baseStyles:i,styleMethods:c}=I(e),g={};let u=null;const p=({props:a},{close:n,open:o})=>{const b=(a?.openStack??"")+o,l=n+(a?.closeStack??""),m=(y,...B)=>Z(y,B,m.props);return Object.setPrototypeOf(m,u),m.props={close:n,closeStack:l,open:o,openStack:b,props:a},m.open=b,m.close=l,m},$=a=>String(a);$.strip=a=>a.replaceAll(q(),"");for(const a in s)g[a]={get(){const n=p(this,s[a]);return Object.defineProperty(this,a,{value:n}),n}};for(const a in i)g[a]={get(){const n=p(this,i[a]);return Object.defineProperty(this,a,{value:n}),n}};for(const a in c)g[a]={get(){return(...n)=>p(this,c[a](...n))}};return g.ansi256=g.fg,g.bgAnsi256=g.bg,u=Object.defineProperties({},g),Object.setPrototypeOf($,u),$},r=new A;new A({level:K});r.ansi256;r.bg;r.bgAnsi256;r.bgHex;r.bgRgb;r.fg;r.hex;r.rgb;r.strip;r.bgBlack;r.bgBlackBright;r.bgBlue;r.bgBlueBright;r.bgCyan;r.bgCyanBright;r.bgGray;r.bgGreen;r.bgGreenBright;r.bgGrey;r.bgMagenta;r.bgMagentaBright;r.bgRed;r.bgRedBright;r.bgWhite;r.bgWhiteBright;r.bgYellow;r.bgYellowBright;r.black;r.blackBright;r.blue;r.blueBright;const Q=r.bold,ee=r.cyan;r.cyanBright;const re=r.dim;r.gray;const te=r.green;r.greenBright;r.grey;r.hidden;const ne=r.inverse;r.italic;const oe=r.magenta;r.magentaBright;r.overline;const ie=r.red;r.redBright;r.reset;r.strike;r.strikethrough;const se=r.underline;r.underlineCurly;r.underlineDashed;r.underlineDotted;r.underlineDouble;r.visible;r.white;r.whiteBright;const le=r.yellow;r.yellowBright;export{H as $,re as F,te as J,ne as P,oe as T,V as U,ie as X,le as b,se as e,Q as j,ee as q,r as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as n}from"node:module";import{o as p,n as a,C as f}from"./index-
|
|
1
|
+
import{createRequire as n}from"node:module";import{o as p,n as a,C as f}from"./index-BdMIfGVZ.js";let i;const c=e=>(i??=n(import.meta.url))(e),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=e=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[o,s]=r.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return r.getBuiltinModule(e)}return c(e)},{createRequire:l}=u("node:module");let d;const _=e=>(d??=l(import.meta.url))(e),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,m=e=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[o,s]=t.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return t.getBuiltinModule(e)}return _(e)},{accessSync:g}=m("node:fs");function h(e,o=p){a(e),e=f(e);try{return g(e,o),!0}catch{return!1}}export{h as y};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as K}from"node:module";import{n as E,o as z,C as S,d as X,e as h}from"./index-
|
|
1
|
+
import{createRequire as K}from"node:module";import{n as E,o as z,C as S,d as X,e as h}from"./index-BdMIfGVZ.js";import{p as rt}from"./formatBytes-BHAzNIrn-DRcKvqnb.js";import{N as it}from"./readJsonSync-CbryXYxN-Bm5i10UW.js";import{r as D}from"./writeFileSync-DJoHk3Ks-Dhem3Uof.js";import{withEnhancedPath as lt}from"@visulima/task-runner";let V;const U=t=>(V??=K(import.meta.url))(t),f=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,l=t=>{if(typeof f<"u"&&f.versions&&f.versions.node){const[e,o]=f.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return f.getBuiltinModule(t)}return U(t)},{Socket:Y}=l("node:net"),{randomBytes:J}=l("node:crypto"),{readdir:Q,rm:b,unlink:$,open:Z,readFile:tt,stat:et,writeFile:ot,rename:st}=l("node:fs/promises"),{createRequire:M}=l("node:module"),{spawn:nt}=l("node:child_process"),{openSync:ct,closeSync:at}=l("node:fs");let ht;const dt=t=>(ht??=M(import.meta.url))(t),u=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ft=t=>{if(typeof u<"u"&&u.versions&&u.versions.node){const[e,o]=u.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return u.getBuiltinModule(t)}return dt(t)},{lstat:A,mkdir:ut}=ft("node:fs/promises"),pt=async t=>{E(t);try{const e=await A(t);if(!e.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(D(e))}'`);return}catch(e){if(e.code!=="ENOENT")throw e}try{await ut(t,{recursive:!0})}catch(e){if(e.code!=="EEXIST")throw e;const o=await A(t);if(!o.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(D(o))}'`,{cause:e})}};let wt;const yt=t=>(wt??=M(import.meta.url))(t),p=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,kt=t=>{if(typeof p<"u"&&p.versions&&p.versions.node){const[e,o]=p.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return p.getBuiltinModule(t)}return yt(t)},{access:mt}=kt("node:fs/promises");async function _t(t,e=z){E(t),t=S(t);try{return await mt(t,e),!0}catch{return!1}}let gt;const vt=t=>(gt??=M(import.meta.url))(t),w=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,x=t=>{if(typeof w<"u"&&w.versions&&w.versions.node){const[e,o]=w.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return w.getBuiltinModule(t)}return vt(t)},{readFile:bt}=x("node:fs/promises"),{unzip:Tt,brotliDecompress:Et}=x("node:zlib"),St={brotli:Et,gzip:Tt,none:(t,e)=>{e(null,t)}},Mt=async(t,e)=>{E(t),t=S(t);const{buffer:o,compression:s,encoding:r,flag:i}=e??{};let n;try{n=await bt(t,i?{flag:i}:{})}catch(c){throw X(c,t)}return await new Promise((c,g)=>{St[s??"none"](n,(k,m)=>{k?g(k):c(o?m:m.toString(r??"utf8"))})})};async function C(t,e,o){const s=await Mt(t,{buffer:!0,encoding:void 0});let r=new TextDecoder().decode(s);const{beforeParse:i,color:n}={};return typeof i=="function"&&(r=i(r)),it(r,e,S(t),{color:n})}const Ht=3e4,N=100;class Rt extends Error{constructor(e,o){super(e),this.elapsedMs=o,this.name="ServiceReadinessError"}elapsedMs}const Pt=async t=>{const e=t.host??"127.0.0.1",{port:o}=t,s=t.timeoutMs??Ht,r=Date.now();for(;Date.now()-r<s;){if(await $t(e,o))return;await Dt(N)}throw new Rt(`Timed out waiting for ${e}:${String(o)} to accept TCP connections (${String(s)}ms)`,Date.now()-r)},$t=(t,e)=>new Promise(o=>{const s=new Y,r=i=>{s.removeAllListeners(),s.destroy(),o(i)};s.once("connect",()=>{r(!0)}),s.once("error",()=>{r(!1)}),s.setTimeout(N,()=>{r(!1)});try{s.connect(e,t)}catch{r(!1)}}),Dt=t=>new Promise(e=>{setTimeout(e,t)}),At=async(t,e)=>{const o=t.readiness??(t.port===void 0?void 0:{tcp:{port:t.port}});o&&await Pt({host:o.tcp.host,port:o.tcp.port,timeoutMs:e?.timeoutMs??o.tcp.timeoutMs})},H=384,L=5e3,Lt=50,Ot=3e4,d=async t=>{const e=h(rt(t),"services");try{await pt(e)}catch(o){throw o.code==="ENOTDIR"?new Error(`Service registry path ${e} exists but is not a directory. Remove it or move the conflicting file before running \`vis service\`.`,{cause:o}):o}return e},R=t=>t.replaceAll("/","_").replaceAll(":","__"),P=(t,e)=>h(t,`${R(e)}.json`),It=(t,e)=>h(t,`${R(e)}.lock`),_=async(t,e)=>{const o=await d(t),s=P(o,e);if(await _t(s))try{return await C(s)}catch{return}},xt=async t=>{const e=await d(t);let o;try{o=await Q(e)}catch{return[]}const s=[];for(const r of o)if(r.endsWith(".json"))try{const i=await C(h(e,r));s.push(i)}catch{}return s},Ct=async(t,e)=>{const o=await d(t),s=P(o,e.id),r=h(o,`.${J(8).toString("hex")}.tmp`);await ot(r,`${JSON.stringify(e,void 0,2)}
|
|
2
2
|
`,{mode:H});try{await Wt(r,s)}catch(i){throw await b(r,{force:!0}).catch(()=>{}),i}},Nt=new Set(["EACCES","EBUSY","EPERM"]),Ft=8,jt=20,Wt=async(t,e)=>{let o=0;for(;;)try{await st(t,e);return}catch(s){const{code:r}=s;if(!(r!==void 0&&Nt.has(r))||o>=Ft)throw s;const n=jt*2**o;await new Promise(c=>{setTimeout(c,n)}),o+=1}},y=async(t,e,o)=>{const s=await d(t),r=o??await _(t,e);await b(P(s,e),{force:!0}),r&&await b(r.logFile,{force:!0}).catch(()=>{})},a=t=>{try{return process.kill(t,0),!0}catch{return!1}},se=async t=>{const e=await xt(t),o=[],s=[];for(const r of e){if(a(r.pid)){s.push(r);continue}const i=await _(t,r.id);if(i&&i.pid!==r.pid){s.push(i);continue}await y(t,r.id,r).catch(()=>{}),o.push(r.id)}return{pruned:o,surviving:s}},Bt=t=>new Promise(e=>{setTimeout(e,t)}),Gt=async t=>{try{const e=await Z(t,"wx",H);try{await e.writeFile(String(process.pid))}finally{await e.close().catch(()=>{})}return!0}catch(e){if(e.code==="EEXIST")return!1;throw e}},qt=async t=>{let e;try{const o=await tt(t,"utf8"),s=Number.parseInt(o.trim(),10);e=Number.isFinite(s)?s:void 0}catch{return!0}if(e!==void 0&&!a(e))return!0;try{const o=await et(t);return Date.now()-o.mtimeMs>Ot}catch{return!0}},F=async(t,e,o)=>{const s=await d(t),r=It(s,e),i=Date.now();for(;!await Gt(r);){if(await qt(r)){await $(r).catch(()=>{});continue}if(Date.now()-i>=L)throw new Error(`Could not acquire service lock for ${e} within ${String(L)}ms — another \`vis service\` invocation appears to be holding it.`);await Bt(Lt)}try{return await o()}finally{await $(r).catch(()=>{})}};function T(t,e={},o){for(const s in t){const r=t[s],i=o?`${o}:${s}`:s;typeof r=="object"&&r!==null?T(r,e,i):typeof r=="function"&&(e[i]=r)}return e}const j=(()=>{if(console.createTask)return console.createTask;const t={run:e=>e()};return()=>t})();function W(t,e,o,s){for(let r=o;r<t.length;r+=1)try{const i=s?s.run(()=>t[r](...e)):t[r](...e);if(i&&typeof i.then=="function")return Promise.resolve(i).then(()=>W(t,e,r+1,s))}catch(i){return Promise.reject(i)}}function Kt(t,e,o){if(t.length>0)return W(t,e,0,j(o))}function Vt(t,e,o){if(t.length>0){const s=j(o);return Promise.all(t.map(r=>s.run(()=>r(...e))))}}function v(t,e){for(const o of[...t])o(e)}var Ut=class{_hooks;_before;_after;_deprecatedHooks;_deprecatedMessages;constructor(){this._hooks={},this._before=void 0,this._after=void 0,this._deprecatedMessages=void 0,this._deprecatedHooks={},this.hook=this.hook.bind(this),this.callHook=this.callHook.bind(this),this.callHookWith=this.callHookWith.bind(this)}hook(t,e,o={}){if(!t||typeof e!="function")return()=>{};const s=t;let r;for(;this._deprecatedHooks[t];)r=this._deprecatedHooks[t],t=r.to;if(r&&!o.allowDeprecated){let i=r.message;i||(i=`${s} hook has been deprecated`+(r.to?`, please use ${r.to}`:"")),this._deprecatedMessages||(this._deprecatedMessages=new Set),this._deprecatedMessages.has(i)||(console.warn(i),this._deprecatedMessages.add(i))}if(!e.name)try{Object.defineProperty(e,"name",{get:()=>"_"+t.replace(/\W+/g,"_")+"_hook_cb",configurable:!0})}catch{}return this._hooks[t]=this._hooks[t]||[],this._hooks[t].push(e),()=>{e&&(this.removeHook(t,e),e=void 0)}}hookOnce(t,e){let o,s=(...r)=>(typeof o=="function"&&o(),o=void 0,s=void 0,e(...r));return o=this.hook(t,s),o}removeHook(t,e){const o=this._hooks[t];if(o){const s=o.indexOf(e);s!==-1&&o.splice(s,1),o.length===0&&(this._hooks[t]=void 0)}}clearHook(t){this._hooks[t]=void 0}deprecateHook(t,e){this._deprecatedHooks[t]=typeof e=="string"?{to:e}:e;const o=this._hooks[t]||[];this._hooks[t]=void 0;for(const s of o)this.hook(t,s)}deprecateHooks(t){for(const e in t)this.deprecateHook(e,t[e])}addHooks(t){const e=T(t),o=Object.keys(e).map(s=>this.hook(s,e[s]));return()=>{for(const s of o)s();o.length=0}}removeHooks(t){const e=T(t);for(const o in e)this.removeHook(o,e[o])}removeAllHooks(){this._hooks={}}callHook(t,...e){return this.callHookWith(Kt,t,e)}callHookParallel(t,...e){return this.callHookWith(Vt,t,e)}callHookWith(t,e,o){const s=this._before||this._after?{name:e,args:o,context:{}}:void 0;this._before&&v(this._before,s);const r=t(this._hooks[e]?[...this._hooks[e]]:[],o,e);return r instanceof Promise?r.finally(()=>{this._after&&s&&v(this._after,s)}):(this._after&&s&&v(this._after,s),r)}beforeEach(t){return this._before=this._before||[],this._before.push(t),()=>{if(this._before!==void 0){const e=this._before.indexOf(t);e!==-1&&this._before.splice(e,1)}}}afterEach(t){return this._after=this._after||[],this._after.push(t),()=>{if(this._after!==void 0){const e=this._after.indexOf(t);e!==-1&&this._after.splice(e,1)}}}};function zt(){return new Ut}const re=()=>zt(),ie=async(t,e)=>{if(!(!e||e.length===0))for(const o of e){if(o.hooks)for(const[s,r]of Object.entries(o.hooks)){const i=Array.isArray(r)?r:[r];for(const n of i)t.hook(s,n)}o.setup&&await o.setup(t)}};class ne{#o;#e;#s=new Map;constructor(e,o){this.#o=e,this.#e=o}startTasks(e){for(const o of e)this.#s.set(o.id,o),this.#t("task:before",o)}endTasks(e){for(const o of e)this.#s.delete(o.task.id),this.#t("task:after",o.task,o),o.status==="failure"?this.#t("task:failure",o.task,o):Xt(o.status)&&this.#t("task:cacheHit",o.task,o)}printCacheMiss(e,o){this.#t("task:cacheMiss",e,o)}onTaskStdout(e,o){this.#t("task:stdout",e,o)}onTaskStderr(e,o){this.#t("task:stderr",e,o)}#t(e,...o){Promise.resolve(this.#o.callHook(e,...o)).catch(s=>{if(this.#e)try{this.#e(e,s)}catch{}})}}const Xt=t=>t==="local-cache"||t==="local-cache-kept-existing"||t==="remote-cache",O=process.platform==="win32",Yt=async t=>{const{command:e,cwd:o,env:s,logFile:r}=t,i=ct(r,"a",H);let n;const c=O?"cmd":"/bin/sh",g=O?["/d","/s","/c",e]:["-c",e];try{n=nt(c,g,{cwd:o,detached:!0,env:lt({...process.env,...s},o),stdio:["ignore",i,i],windowsHide:!0})}finally{at(i)}if(n.pid===void 0&&await new Promise((k,m)=>{n.once("spawn",()=>{k()}),n.once("error",q=>{m(q)})}),n.pid===void 0)throw new Error(`Failed to spawn detached process for command: ${e}`);return n.unref(),{pid:n.pid}},B=5e3,ce=async t=>F(t.workspaceRoot,t.id,async()=>{const e=await _(t.workspaceRoot,t.id);if(e&&a(e.pid))throw new Error(`Service ${t.id} is already running (pid ${String(e.pid)})`);e&&await y(t.workspaceRoot,t.id,e);const o=await d(t.workspaceRoot),s=R(t.id),r=h(o,`${s}.log`),{pid:i}=await Yt({command:t.command,cwd:t.cwd,env:t.env,logFile:r}),n={command:t.command,config:t.config,cwd:t.cwd,env:t.config.env??{},id:t.id,logFile:r,pid:i,slug:s,startedAt:new Date().toISOString(),visVersion:process.env.VIS_VERSION??"0.0.0"};if(await Ct(t.workspaceRoot,n),t.skipReadiness!==!0)try{await At(t.config,{timeoutMs:t.readinessTimeoutMs})}catch(c){throw await G(i,t.config.killGracePeriodMs??B).catch(()=>{}),await y(t.workspaceRoot,t.id,n).catch(()=>{}),c}return{entry:n}}),ae=async t=>F(t.workspaceRoot,t.id,async()=>{const e=await _(t.workspaceRoot,t.id);if(!e)return{stopped:!1};if(!a(e.pid))return await y(t.workspaceRoot,t.id,e),{stopped:!1};const o=t.graceMs??e.config.killGracePeriodMs??B;return await G(e.pid,o),await y(t.workspaceRoot,t.id,e),{stopped:!0}}),G=async(t,e)=>{I(t,"SIGTERM");const o=Date.now();for(;Date.now()-o<e;){if(!a(t))return;await new Promise(s=>{setTimeout(s,100)})}a(t)&&I(t,"SIGKILL")},I=(t,e)=>{try{process.platform==="win32"?process.kill(t,e):process.kill(-t,e)}catch(o){if(o.code==="ESRCH")return;throw o}};export{ne as H,Rt as S,ce as a,At as b,xt as c,re as d,ie as e,y as f,_t as g,a as i,se as p,_ as r,ae as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as p}from"node:module";import{e as a}from"./index-
|
|
1
|
+
import{createRequire as p}from"node:module";import{e as a}from"./index-BdMIfGVZ.js";let k;const _=e=>(k??=p(import.meta.url))(e),i=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,y=e=>{if(typeof i<"u"&&i.versions&&i.versions.node){const[o,t]=i.versions.node.split(".").map(Number);if(o>22||o===22&&t>=3||o===20&&t>=16)return i.getBuiltinModule(e)}return _(e)},{statSync:u,existsSync:m,readFileSync:f}=y("node:fs"),h={aube:["aube-lock.yaml"],bun:["bun.lock","bun.lockb"],npm:["npm-shrinkwrap.json","package-lock.json"],pnpm:["pnpm-lock.yaml"],yarn:["yarn.lock"]},b={aube:["node_modules/.aube-state","node_modules/.modules.yaml"],bun:["node_modules/.bun-tag"],npm:["node_modules/.package-lock.json"],pnpm:["node_modules/.modules.yaml","node_modules/.pnpm/lock.yaml"],yarn:["node_modules/.yarn-integrity","node_modules/.yarn-state.yml",".yarn/install-state.gz"]},g={pnpm:"node_modules/.pnpm/lock.yaml"},M={ci:{aube:"aube ci",bun:"bun install --frozen-lockfile",npm:"npm ci",pnpm:"pnpm install --frozen-lockfile",yarn:"yarn install --immutable"},tty:{aube:"aube install",bun:"bun install",npm:"npm install",pnpm:"pnpm install",yarn:"yarn install"}},L=1e3,S=e=>{for(const[o,t]of Object.entries(h))for(const s of t)if(m(a(e,s)))return{lockfileFile:s,manager:o}},j=(e,o,t)=>{const s=g[t];if(!s)return;const n=a(e,s);if(!m(n))return;const r=a(e,o);try{return u(r).size!==u(n).size?!1:f(r).equals(f(n))}catch{return}},v=(e,o)=>{let t;for(const s of b[o]){const n=a(e,s);if(!m(n))continue;const{mtimeMs:r}=u(n);(!t||r>t.mtimeMs)&&(t={mtimeMs:r,path:s})}return t},C=(e,o={})=>{const t=S(e);if(!t)return{checked:!1};const{lockfileFile:s,manager:n}=t,r=u(a(e,s)).mtimeMs,l=v(e,n),d=M[o.inCi?"ci":"tty"][n],c={comparedBy:"mtime",installMarkerMtimeMs:l?.mtimeMs,lockfileMtimeMs:r,lockfilePath:s,marker:l?.path,packageManager:n};return l?j(e,s,n)===!0?{checked:!0,detail:{...c,comparedBy:"content"}}:r>l.mtimeMs+L?{checked:!0,detail:c,failure:"stale-install",message:`${s} is newer than node_modules (${l.path}) — run \`${d}\` to sync.`}:{checked:!0,detail:c}:{checked:!0,detail:c,failure:"missing-install",message:`lockfile detected but node_modules looks uninitialised — run \`${d}\` before \`vis run\`.`}},E=(e,o,t,s={})=>{if(s.skip)return{checked:!1,shouldContinue:!0};const n=C(e,{inCi:o});if(!n.failure)return{...n,shouldContinue:!0};const r=`preflight: ${n.message??"lockfile drift detected"}`;return o&&!s.ciAsWarning?{...n,formattedMessage:r,shouldContinue:!1}:(t.warn(r),{...n,formattedMessage:r,shouldContinue:!0})};export{S as d,E as r};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as j}from"node:module";import{e as d}from"./index-
|
|
1
|
+
import{createRequire as j}from"node:module";import{e as d}from"./index-BdMIfGVZ.js";import{y}from"./isAccessibleSync-DYKTrrvc-BwaMhQs0.js";import{p as P}from"./readJsonSync-CbryXYxN-Bm5i10UW.js";let M;const b=o=>(M??=j(import.meta.url))(o),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,N=o=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[e,t]=l.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return l.getBuiltinModule(o)}return b(o)},{readdirSync:g,lstatSync:S}=N("node:fs"),R=/^([^<(]+?)?(?:<([^>]+)>)?\s*(?:\(([^)]+)\))?\s*$/u,T=o=>{const e=o.match(R);if(!e)return;const t=e[1]?.trim(),n=e[2]?.trim(),r=e[3]?.trim();if(!(!t&&!n&&!r))return{email:n||void 0,name:t||void 0,url:r||void 0}},k=o=>{if(!Array.isArray(o)||o.length===0)return;const e=[];for(const t of o)if(typeof t=="string"){const n=T(t);n&&e.push(n)}else if(t&&typeof t=="object"){const n=t,r=typeof n.name=="string"?n.name:void 0,i=typeof n.email=="string"?n.email:void 0,u=typeof n.url=="string"?n.url:void 0;(r||i||u)&&e.push({email:i,name:r,url:u})}return e.length>0?e:void 0},D=o=>{const e=d(o,"node_modules");if(!y(e))return new Map;const t=new Map,n=new Set,r=(i,u="")=>{if(n.has(i))return;n.add(i);let h;try{h=g(i)}catch{return}for(const a of h){const c=d(i,a);let m;try{m=S(c)}catch{continue}if(m.isSymbolicLink())continue;if(a.startsWith("@")){m.isDirectory()&&r(c,`${a}/`);continue}if(a===".pnpm"&&u===""){let s;try{s=g(c)}catch{continue}for(const p of s){const f=d(c,p,"node_modules");y(f)&&r(f)}continue}if(a.startsWith(".")||!m.isDirectory())continue;const v=u+a,_=d(c,"package.json");try{if(!y(_))continue;const s=P(_);if(typeof s.version!="string")continue;const p=`${v}@${s.version}`;t.has(p)||t.set(p,{directory:c,license:s.license,licenses:Array.isArray(s.licenses)?s.licenses:void 0,maintainers:k(s.maintainers),name:v,scripts:s.scripts&&typeof s.scripts=="object"?s.scripts:void 0,version:s.version});const f=d(c,"node_modules");y(f)&&r(f)}catch{}}};return r(e),t};export{k as n,D as r};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as g,
|
|
1
|
+
import{e as g,a as d}from"./index-BdMIfGVZ.js";import{r as A}from"../packem_chunks/cli-main.js";import{y as $}from"./isAccessibleSync-DYKTrrvc-BwaMhQs0.js";import{U as u}from"./writeFileSync-DJoHk3Ks-Dhem3Uof.js";const x=(k,p,h,m=[])=>{const t=[];if(h===void 0)return t.push("minimumReleaseAge not set in vis.config; skipping native sync."),t;const r=Number.isFinite(h)?Math.max(0,Math.round(h)):0;switch(k){case"bun":{const n=g(p,"bunfig.toml");let e=$(n)?d(n):"";const s=r*60,i=`minimumReleaseAge = ${String(s)}`,a=m.length>0?`minimumReleaseAgeExcludes = [${m.map(c=>`"${c.replaceAll(String.raw`"`,String.raw`\"`)}"`).join(", ")}]`:void 0,o=/^\[install\][ \t]*\n/m.exec(e);if(o?.index===void 0){const c=a?`${i}
|
|
2
2
|
${a}`:i;e=`${e.trimEnd()?`${e.trimEnd()}
|
|
3
3
|
|
|
4
4
|
`:""}[install]
|
package/dist/packem_shared/{missing-package-json-Cu5YVAot.js → missing-package-json-DfzrGwe1.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as d,U as u}from"./index-
|
|
1
|
+
import{e as d,U as u}from"./index-BdMIfGVZ.js";import{k as m,z as E,B as D,L as o}from"../packem_chunks/catalog.js";import{y as l}from"./isAccessibleSync-DYKTrrvc-BwaMhQs0.js";const S=/\/+$/,f=/node_modules/,p=/\.git/,_=/[$()+.?[\\\]^{|}]/g,y=/\/\*\*$|\/\*\/\*$/,P=t=>{for(const r of o(t,{includeDirs:!1,includeSymlinks:!1,skip:[f,p]}))if(r.name==="package.json")return!0;return!1},h=(t,r,n)=>{for(const e of o(t,{includeFiles:!1,includeSymlinks:!1,maxDepth:1,skip:[f,p]})){if(e.path===t||e.name.startsWith(".")||l(d(e.path,"package.json")))continue;const i=`${r}/${e.name}`;P(e.path)?h(e.path,i,n):n.push(i)}},g=(t,r)=>{const n=r.replace(S,"");if(n.startsWith("!"))return[];const e=[];if(n.endsWith("/*")&&!n.endsWith("/*/*")){const a=n.slice(0,-2),s=u(t,a);if(!l(s))return[];for(const c of o(s,{includeFiles:!1,includeSymlinks:!1,maxDepth:1,skip:[f,p]}))c.path===s||c.name.startsWith(".")||e.push(d(a,c.name));return e}if(n.endsWith("/**")||n.endsWith("/*/*")){const a=n.replace(y,""),s=u(t,a);return l(s)&&h(s,a,e),e}if(!n.includes("/")&&n.includes("*")){const a=n.replaceAll(_,String.raw`\$&`).replaceAll("*",".*"),s=new RegExp(`^${a}$`);for(const c of o(t,{includeFiles:!1,includeSymlinks:!1,maxDepth:1,skip:[f,p]}))c.path!==t&&s.test(c.name)&&e.push(c.name);return e}const i=u(t,n);return l(i)&&e.push(n),e},x=t=>{const n=m(t)??E(t)??[],e=new Set,i=[];for(const a of n)for(const s of g(t,a))s==="."||e.has(s)||(e.add(s),D(d(t,s))||i.push({packageDir:s}));return i};export{x as l};
|
package/dist/packem_shared/{multi-eco-lockfiles-B2X3yhyo.js → multi-eco-lockfiles-BIa6xvJc.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as J}from"node:module";import{e as K}from"./index-BzhrR_iC.js";import{G as X}from"../packem_chunks/catalog.js";import{e as L,i as Z,s as Q}from"./maven-pom-B0KG9kJQ.js";import{c as ee}from"./composer-DR3D-Psb.js";let Y;const B=e=>(Y??=J(import.meta.url))(e),S=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,O=e=>{if(typeof S<"u"&&S.versions&&S.versions.node){const[n,t]=S.versions.node.split(".").map(Number);if(n>22||n===22&&t>=3||n===20&&t>=16)return S.getBuiltinModule(e)}return B(e)},{existsSync:E,readFileSync:_}=O("node:fs"),{resolve:w,dirname:M,join:x}=O("node:path"),oe=8,ne=8,te="vis:maven:version-unresolved",N=(e,n,t)=>`pkg:maven/${encodeURIComponent(e)}/${encodeURIComponent(n)}${t===void 0?"":`@${encodeURIComponent(t)}`}`,A=e=>{if(E(e))try{return{path:e,scan:Q(_(e,"utf8"))}}catch{return}},D=e=>{const n=e.scan.parent;if(!n)return;const t=n.relativePath||"../pom.xml",o=t.endsWith(".xml")?w(M(e.path),t):w(M(e.path),t,"pom.xml"),s=A(o);return s&&s.scan.artifactId?.value===n.artifactId?.value&&L(s.scan)===n.groupId?.value?s:void 0},se=e=>{const n=[e];let t=D(e);for(;t&&n.length<oe;)n.push(t),t=D(t);return n},P=(e,n,t=0)=>{if(e===""||t>ne)return;let o=!1;const s=e.replaceAll(/\$\{([^}]+)\}/g,(c,r)=>{const i=n(r),a=i===void 0?void 0:P(i,n,t+1);return a===void 0?(o=!0,""):a});return o||s.includes("${")?void 0:s},C=(e,n)=>{if(e===void 0)return{unresolved:""};const t=P(e,n);return t===void 0||!Z(t)?{unresolved:e}:{version:t}},re=e=>{const n=[],t=new Set,o=s=>{const c=w(s),r=A(c);if(!(!r||t.has(c))){t.add(c),n.push(se(r));for(const i of r.scan.modules)o(i.endsWith(".xml")?w(M(c),i):w(M(c),i,"pom.xml"))}};return o(e),n},T=e=>{const n=[];for(const t of re(w(e,"pom.xml"))){const o=t[0].scan,s=new Map;for(const m of t)for(const[y,b]of m.scan.properties)s.has(y)||s.set(y,b.value);const c=L(o),r=o.artifactId?.value,i=o.version?.value??o.parent?.version?.value,a=o.parent?.version?.value,l=m=>{switch(m){case"artifactId":case"pom.artifactId":case"project.artifactId":return r;case"groupId":case"pom.groupId":case"project.groupId":return c;case"pom.version":case"project.version":case"version":return i;case"project.parent.version":return a;default:return s.get(m)}},u=c===void 0?void 0:P(c,l),g=r===void 0?void 0:P(r,l),h=C(i,l),v=new Map;for(const m of t)for(const y of m.scan.dependencies){const b=y.groupId?.value??"",d=y.artifactId?.value??"",p=`${b}:${d}`;if(v.has(p))continue;const f=P(b,l),k=P(d,l),j=f===void 0||k===void 0?{unresolved:y.version?.value??""}:C(y.version?.value,l);v.set(p,{artifact:k,group:f,scope:y.scope?.value??"compile",unresolved:f===void 0||k===void 0?p:j.unresolved,version:j.version})}n.push({artifact:g,dependencies:[...v.values()],group:u,path:t[0].path,unresolved:h.unresolved,version:h.version})}return n},G=e=>e==="test"||e==="provided",ce=(e,n)=>{const t=new Set(n),o=new Map;for(const r of e)r.group!==void 0&&r.artifact!==void 0&&o.set(`${r.group}:${r.artifact}`,r);const s=new Set(e.filter(r=>r.artifact!==void 0&&t.has(r.artifact))),c=[...s];for(;c.length>0;){const r=c.shift();for(const i of r.dependencies){const a=o.get(`${i.group}:${i.artifact}`);a!==void 0&&!s.has(a)&&(s.add(a),c.push(a))}}return e.filter(r=>s.has(r))},De=(e,n={})=>{const t=n.includeDev??!1,o=new Map,s=new Map,c=(a,l,u,g,h)=>{const v=N(a,l,u);if(!o.has(v)){const m={"bom-ref":v,group:a,name:l,purl:v,type:"library"};u!==void 0&&(m.version=u),g!==void 0&&(m.properties=[{name:te,value:g}]),h!==void 0&&(m.scope=h),o.set(v,m)}return v},r=T(e);for(const a of n.focusNames===void 0?r:ce(r,n.focusNames)){const l=a.group!==void 0&&a.artifact!==void 0?c(a.group,a.artifact,a.version,a.unresolved):void 0;for(const u of a.dependencies){if(G(u.scope)&&!t||u.group===void 0||u.artifact===void 0)continue;const g=c(u.group,u.artifact,u.version,u.unresolved,G(u.scope)?"optional":"required");l!==void 0&&s.set(l,(s.get(l)??new Set).add(g))}}const i=[...o.values()].sort((a,l)=>(a["bom-ref"]??"").localeCompare(l["bom-ref"]??""));return{components:i,dependencies:i.map(a=>{const l=a["bom-ref"]??"",u=[...s.get(l)??[]].sort();return u.length>0?{dependsOn:u,ref:l}:{ref:l}})}},ie=e=>{const n=[];for(const t of e.split(/\r?\n/)){const o=t.trim();if(o.length===0||o.startsWith("#"))continue;const s=o.indexOf("="),c=(s===-1?o:o.slice(0,s)).split(":");if(c.length<3||!c[0]||!c[1]||!c[2])continue;const r=s===-1?[]:o.slice(s+1).split(",").map(i=>i.trim()).filter(i=>i.length>0);n.push({artifact:c[1],configurations:r,group:c[0],version:c[2]})}return n},ae=e=>["",...X(e,[])].map(t=>x(e,t,"gradle.lockfile")).filter(t=>E(t)),U=e=>{const n=[];for(const t of ae(e))try{n.push(...ie(_(t,"utf8")))}catch{}return n},de=e=>e.configurations.length>0&&e.configurations.every(n=>/test/i.test(n)),Ce=(e,n={})=>{const t=n.includeDev??!1,o=new Map;for(const r of U(e)){const i=N(r.group,r.artifact,r.version),a=o.get(i),l=de(r);o.set(i,{dev:(a?.dev??!0)&&l,entry:r})}const s=[...o.keys()].filter(r=>t||!o.get(r).dev).sort();return{components:s.map(r=>{const{dev:i,entry:a}=o.get(r);return{"bom-ref":r,group:a.group,name:a.artifact,purl:r,scope:i?"optional":"required",type:"library",version:a.version}}),dependencies:s.map(r=>({ref:r}))}},V=(e,n)=>{const{focusNames:t,includeDev:o=!1,normalize:s,purl:c}=n,r=new Map;for(const d of e){const p=`${s(d.name)}@${d.version}`;r.set(p,(r.get(p)??0)+1)}const i=d=>{const p=(r.get(`${s(d.name)}@${d.version}`)??0)>1,f=c(d.name,d.version);return p&&d.source!==void 0?`${f}?source=${encodeURIComponent(d.source)}`:f},a=new Map;for(const d of e){const p=s(d.name);a.set(p,[...a.get(p)??[],d])}const l=d=>{const p=(a.get(s(d.name))??[]).filter(f=>(d.version===void 0||f.version===d.version)&&(d.source===void 0||f.source===d.source));return p.length===1?p[0]:void 0},u=t===void 0?void 0:new Set(t.map(d=>s(d))),g=e.filter(d=>d.member&&(u===void 0||u.has(s(d.name)))),h=new Set(g),v=[...g];for(;v.length>0;){const d=v.shift();for(const p of d.deps){if(p.kind==="dev"&&!o)continue;const f=l(p);f!==void 0&&!h.has(f)&&(h.add(f),v.push(f))}}const m=[...h],y=m.map(d=>{const p=i(d);return{"bom-ref":p,name:d.name,purl:p,type:"library",version:d.version}}).sort((d,p)=>(d["bom-ref"]??"").localeCompare(p["bom-ref"]??"")),b=m.map(d=>{const p=[...new Set(d.deps.filter(k=>o||k.kind!=="dev").map(k=>l(k)).filter(k=>k!==void 0&&h.has(k)).map(k=>i(k)))].sort(),f=i(d);return p.length>0?{dependsOn:p,ref:f}:{ref:f}}).sort((d,p)=>d.ref.localeCompare(p.ref));return{components:y,dependencies:b}},le=(e,n)=>`pkg:hex/${encodeURIComponent(e)}@${encodeURIComponent(n)}`,ue=/^\s*"[^"]+":\s*\{:hex,\s*:([a-z_]\w*),\s*"([^"]+)"/,q=e=>{const n=[];for(const t of e.split(/\r?\n/)){const o=ue.exec(t);if(o?.[1]===void 0||o[2]===void 0)continue;const s=[];for(const c of t.matchAll(/\{:([a-z_]\w*),\s*"/g))s.push({kind:"main",name:c[1]});n.push({deps:s,member:!0,name:o[1],version:o[2]})}return n},Ge=(e,n={})=>{let t;try{t=_(x(e,"mix.lock"),"utf8")}catch{return{components:[],dependencies:[]}}return V(q(t),{includeDev:n.includeDev,normalize:o=>o,purl:le})},pe=(e,n)=>`pkg:nuget/${encodeURIComponent(e)}@${encodeURIComponent(n)}`,$=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),I=e=>e.toLowerCase(),z=e=>{let n;try{n=JSON.parse(e)}catch{return[]}if(!$(n)||!$(n.dependencies))return[];const t=[];for(const i of Object.values(n.dependencies)){if(!$(i))continue;const a=new Map;for(const[l,u]of Object.entries(i))$(u)&&a.set(l,{depIds:$(u.dependencies)?Object.keys(u.dependencies):[],resolved:typeof u.resolved=="string"?u.resolved:void 0,type:typeof u.type=="string"?u.type:""});t.push(a)}const o=new Set;let s=!1;for(const i of t)for(const a of i.values())if(a.type==="Direct"&&(s=!0),a.type==="Project")for(const l of a.depIds)o.add(I(l));const c=new Map;for(const i of t)for(const[a,l]of i){if(l.type==="Project"||l.resolved===void 0)continue;const u=`${I(a)}\0${l.resolved}`,g=c.get(u)??{deps:[],member:!1,name:a,version:l.resolved};c.set(u,g),l.type==="Direct"&&(g.member=!0);for(const h of l.depIds){const v=i.get(h)?.resolved;v!==void 0&&g.deps.push({kind:"main",name:h,version:v})}}const r=!s&&o.size===0;return[...c.values()].map(i=>({...i,member:r||i.member||o.has(I(i.name))}))},Oe=e=>{let n;try{n=_(x(e,"packages.lock.json"),"utf8")}catch{return{components:[],dependencies:[]}}return V(z(n),{normalize:I,purl:pe})},F={"crates.io":["Cargo.lock"],Go:["go.sum"],Hex:["mix.lock"],Maven:["gradle.lockfile","pom.xml"],NuGet:["packages.lock.json"],Packagist:["composer.lock"],Pub:["pubspec.lock"],PyPI:["uv.lock","poetry.lock","Pipfile.lock"],RubyGems:["Gemfile.lock"],SwiftURL:["Package.resolved"]},fe={cargo:"crates.io",composer:"Packagist","crates.io":"crates.io",dart:"Pub",go:"Go",gradle:"Maven",hex:"Hex",maven:"Maven",npm:"npm",nuget:"NuGet",packagist:"Packagist",pub:"Pub",pypi:"PyPI",rubygems:"RubyGems",swift:"SwiftURL",swifturl:"SwiftURL"},R=e=>fe[e.toLowerCase()]??e,Le=e=>F[R(e)]??[],ve=(e,n)=>{const t=R(n),o=F[t]??[];for(const s of o){const c=K(e,s);if(E(c))return c}},H=e=>{const n=new Set,t=[];for(const o of e){const s=`${o.name}@${o.version}`;n.has(s)||(n.add(s),t.push(o))}return t},me=/\[\[package\]\]([\s\S]*?)(?=\[\[|$)/g,ge=/^\s*name\s*=\s*"([^"]+)"\s*$/m,he=/^\s*version\s*=\s*"([^"]+)"\s*$/m,ke=e=>{const n=[];for(const t of e.matchAll(me)){const o=t[1]??"",s=ge.exec(o)?.[1],c=he.exec(o)?.[1];s&&c&&n.push({isDev:!1,name:s,version:c})}return n},ye=e=>{let n;try{n=JSON.parse(e)}catch{return[]}if(typeof n!="object"||n===null)return[];const t=[];for(const o of["default","develop"]){const s=n[o];if(!(typeof s!="object"||s===null))for(const[c,r]of Object.entries(s)){if(typeof r!="object"||r===null)continue;const i=r.version;if(typeof i!="string")continue;const a=i.replace(/^==/,"").trim();a.length>0&&t.push({isDev:!1,name:c,version:a})}}return t},be=e=>{const n=[];let t;try{t=JSON.parse(e)}catch{return n}for(const[o,s]of[["packages",!1],["packages-dev",!0]]){const c=t[o];if(Array.isArray(c))for(const r of c)typeof r.name=="string"&&typeof r.version=="string"&&n.push({isDev:s,name:r.name,version:ee(r.version)})}return n},Pe=e=>{const n=[];for(const t of e.split(/\r?\n/)){const o=t.trim();if(o.length===0)continue;const s=o.split(/\s+/);if(s.length<3)continue;const[c,r]=s;if(!c||!r?.endsWith("/go.mod"))continue;const i=r.slice(0,-7);i.length!==0&&n.push({isDev:!1,name:c,version:i})}return n},we=/^ {4}([^ ()]+) \(([^()]+)\)\s*$/,Se=e=>{const n=[];let t=!1,o=!1;for(const s of e.split(/\r?\n/)){if(s.startsWith("GEM")){t=!0,o=!1;continue}if(t&&/^[A-Z]/.test(s)){t=!1,o=!1;continue}if(t&&s.trim()==="specs:"){o=!0;continue}if(o){const c=we.exec(s);if(c){const[,r,i]=c,a=i?.split("-")[0];r&&a&&n.push({isDev:!1,name:r,version:a})}}}return n},$e=e=>{const n=[];let t=!1;for(const o of e.split(/\r?\n/)){if(/^\S/.test(o)){t=o.trimEnd()==="packages:";continue}const s=n.at(-1),c=/^ {2}(\S+):\s*$/.exec(o);if(t&&c?.[1]!==void 0){n.push({name:c[1]});continue}const[,r,i]=/^ {4}(dependency|source|version): "?([^"]*)"?\s*$/.exec(o)??[];t&&s!==void 0&&r!==void 0&&i!==void 0&&(r==="source"?s.source=i:r==="version"?s.version=i:s.dependency=i)}return n.filter(o=>o.source==="hosted"&&o.version!==void 0&&o.version.length>0).map(o=>({isDev:o.dependency==="direct dev",name:o.name,version:o.version}))},_e=e=>e.trim().replace(/^[a-z+]+:\/\//i,"").replace(/^[^@/]+@([^:/]+):/,"$1/").replace(/\.git$/,"").replace(/\/+$/,""),Ie=e=>{let n;try{n=JSON.parse(e)}catch{return[]}const t=typeof n=="object"&&n!==null?n.pins:void 0;if(!Array.isArray(t))return[];const o=[];for(const s of t)typeof s.location=="string"&&typeof s.state?.version=="string"&&s.state.version.length>0&&o.push({isDev:!1,name:_e(s.location),version:s.state.version});return o},W=e=>{const n=[],t=[];for(const o of T(e))for(const s of o.dependencies){if(s.group===void 0||s.artifact===void 0||s.version===void 0){t.push(s.group!==void 0&&s.artifact!==void 0?`${s.group}:${s.artifact}`:s.unresolved??"");continue}n.push({isDev:!1,name:`${s.group}:${s.artifact}`,version:s.version})}for(const o of U(e))n.push({isDev:!1,name:`${o.group}:${o.artifact}`,version:o.version});return{packages:H(n),unresolved:[...new Set(t)]}},Ne=e=>W(e).unresolved,Ae=(e,n)=>{if(R(n)==="Maven")return W(e).packages;const t=ve(e,n);if(!t)return[];let o;try{o=_(t,"utf8")}catch{return[]}const s=t.split(/[/\\]/).pop()??"";let c;switch(s){case"Cargo.lock":case"poetry.lock":case"uv.lock":{c=ke(o);break}case"composer.lock":{c=be(o);break}case"Gemfile.lock":{c=Se(o);break}case"go.sum":{c=Pe(o);break}case"mix.lock":{c=q(o).map(r=>({isDev:!1,name:r.name,version:r.version}));break}case"Package.resolved":{c=Ie(o);break}case"packages.lock.json":{c=z(o).map(r=>({isDev:!1,name:r.name,version:r.version}));break}case"Pipfile.lock":{c=ye(o);break}case"pubspec.lock":{c=$e(o);break}default:return[]}return H(c)};export{Ge as a,V as b,R as c,De as d,Ce as e,Oe as f,ae as g,ve as h,Le as i,Ae as l,Ne as m};
|
|
1
|
+
import{createRequire as J}from"node:module";import{e as K}from"./index-BdMIfGVZ.js";import{G as X}from"../packem_chunks/catalog.js";import{e as L,i as Z,s as Q}from"./maven-pom-B0KG9kJQ.js";import{c as ee}from"./composer-DR3D-Psb.js";let Y;const B=e=>(Y??=J(import.meta.url))(e),S=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,O=e=>{if(typeof S<"u"&&S.versions&&S.versions.node){const[n,t]=S.versions.node.split(".").map(Number);if(n>22||n===22&&t>=3||n===20&&t>=16)return S.getBuiltinModule(e)}return B(e)},{existsSync:E,readFileSync:_}=O("node:fs"),{resolve:w,dirname:M,join:x}=O("node:path"),oe=8,ne=8,te="vis:maven:version-unresolved",N=(e,n,t)=>`pkg:maven/${encodeURIComponent(e)}/${encodeURIComponent(n)}${t===void 0?"":`@${encodeURIComponent(t)}`}`,A=e=>{if(E(e))try{return{path:e,scan:Q(_(e,"utf8"))}}catch{return}},D=e=>{const n=e.scan.parent;if(!n)return;const t=n.relativePath||"../pom.xml",o=t.endsWith(".xml")?w(M(e.path),t):w(M(e.path),t,"pom.xml"),s=A(o);return s&&s.scan.artifactId?.value===n.artifactId?.value&&L(s.scan)===n.groupId?.value?s:void 0},se=e=>{const n=[e];let t=D(e);for(;t&&n.length<oe;)n.push(t),t=D(t);return n},P=(e,n,t=0)=>{if(e===""||t>ne)return;let o=!1;const s=e.replaceAll(/\$\{([^}]+)\}/g,(c,r)=>{const i=n(r),a=i===void 0?void 0:P(i,n,t+1);return a===void 0?(o=!0,""):a});return o||s.includes("${")?void 0:s},C=(e,n)=>{if(e===void 0)return{unresolved:""};const t=P(e,n);return t===void 0||!Z(t)?{unresolved:e}:{version:t}},re=e=>{const n=[],t=new Set,o=s=>{const c=w(s),r=A(c);if(!(!r||t.has(c))){t.add(c),n.push(se(r));for(const i of r.scan.modules)o(i.endsWith(".xml")?w(M(c),i):w(M(c),i,"pom.xml"))}};return o(e),n},T=e=>{const n=[];for(const t of re(w(e,"pom.xml"))){const o=t[0].scan,s=new Map;for(const m of t)for(const[y,b]of m.scan.properties)s.has(y)||s.set(y,b.value);const c=L(o),r=o.artifactId?.value,i=o.version?.value??o.parent?.version?.value,a=o.parent?.version?.value,l=m=>{switch(m){case"artifactId":case"pom.artifactId":case"project.artifactId":return r;case"groupId":case"pom.groupId":case"project.groupId":return c;case"pom.version":case"project.version":case"version":return i;case"project.parent.version":return a;default:return s.get(m)}},u=c===void 0?void 0:P(c,l),g=r===void 0?void 0:P(r,l),h=C(i,l),v=new Map;for(const m of t)for(const y of m.scan.dependencies){const b=y.groupId?.value??"",d=y.artifactId?.value??"",p=`${b}:${d}`;if(v.has(p))continue;const f=P(b,l),k=P(d,l),j=f===void 0||k===void 0?{unresolved:y.version?.value??""}:C(y.version?.value,l);v.set(p,{artifact:k,group:f,scope:y.scope?.value??"compile",unresolved:f===void 0||k===void 0?p:j.unresolved,version:j.version})}n.push({artifact:g,dependencies:[...v.values()],group:u,path:t[0].path,unresolved:h.unresolved,version:h.version})}return n},G=e=>e==="test"||e==="provided",ce=(e,n)=>{const t=new Set(n),o=new Map;for(const r of e)r.group!==void 0&&r.artifact!==void 0&&o.set(`${r.group}:${r.artifact}`,r);const s=new Set(e.filter(r=>r.artifact!==void 0&&t.has(r.artifact))),c=[...s];for(;c.length>0;){const r=c.shift();for(const i of r.dependencies){const a=o.get(`${i.group}:${i.artifact}`);a!==void 0&&!s.has(a)&&(s.add(a),c.push(a))}}return e.filter(r=>s.has(r))},De=(e,n={})=>{const t=n.includeDev??!1,o=new Map,s=new Map,c=(a,l,u,g,h)=>{const v=N(a,l,u);if(!o.has(v)){const m={"bom-ref":v,group:a,name:l,purl:v,type:"library"};u!==void 0&&(m.version=u),g!==void 0&&(m.properties=[{name:te,value:g}]),h!==void 0&&(m.scope=h),o.set(v,m)}return v},r=T(e);for(const a of n.focusNames===void 0?r:ce(r,n.focusNames)){const l=a.group!==void 0&&a.artifact!==void 0?c(a.group,a.artifact,a.version,a.unresolved):void 0;for(const u of a.dependencies){if(G(u.scope)&&!t||u.group===void 0||u.artifact===void 0)continue;const g=c(u.group,u.artifact,u.version,u.unresolved,G(u.scope)?"optional":"required");l!==void 0&&s.set(l,(s.get(l)??new Set).add(g))}}const i=[...o.values()].sort((a,l)=>(a["bom-ref"]??"").localeCompare(l["bom-ref"]??""));return{components:i,dependencies:i.map(a=>{const l=a["bom-ref"]??"",u=[...s.get(l)??[]].sort();return u.length>0?{dependsOn:u,ref:l}:{ref:l}})}},ie=e=>{const n=[];for(const t of e.split(/\r?\n/)){const o=t.trim();if(o.length===0||o.startsWith("#"))continue;const s=o.indexOf("="),c=(s===-1?o:o.slice(0,s)).split(":");if(c.length<3||!c[0]||!c[1]||!c[2])continue;const r=s===-1?[]:o.slice(s+1).split(",").map(i=>i.trim()).filter(i=>i.length>0);n.push({artifact:c[1],configurations:r,group:c[0],version:c[2]})}return n},ae=e=>["",...X(e,[])].map(t=>x(e,t,"gradle.lockfile")).filter(t=>E(t)),U=e=>{const n=[];for(const t of ae(e))try{n.push(...ie(_(t,"utf8")))}catch{}return n},de=e=>e.configurations.length>0&&e.configurations.every(n=>/test/i.test(n)),Ce=(e,n={})=>{const t=n.includeDev??!1,o=new Map;for(const r of U(e)){const i=N(r.group,r.artifact,r.version),a=o.get(i),l=de(r);o.set(i,{dev:(a?.dev??!0)&&l,entry:r})}const s=[...o.keys()].filter(r=>t||!o.get(r).dev).sort();return{components:s.map(r=>{const{dev:i,entry:a}=o.get(r);return{"bom-ref":r,group:a.group,name:a.artifact,purl:r,scope:i?"optional":"required",type:"library",version:a.version}}),dependencies:s.map(r=>({ref:r}))}},V=(e,n)=>{const{focusNames:t,includeDev:o=!1,normalize:s,purl:c}=n,r=new Map;for(const d of e){const p=`${s(d.name)}@${d.version}`;r.set(p,(r.get(p)??0)+1)}const i=d=>{const p=(r.get(`${s(d.name)}@${d.version}`)??0)>1,f=c(d.name,d.version);return p&&d.source!==void 0?`${f}?source=${encodeURIComponent(d.source)}`:f},a=new Map;for(const d of e){const p=s(d.name);a.set(p,[...a.get(p)??[],d])}const l=d=>{const p=(a.get(s(d.name))??[]).filter(f=>(d.version===void 0||f.version===d.version)&&(d.source===void 0||f.source===d.source));return p.length===1?p[0]:void 0},u=t===void 0?void 0:new Set(t.map(d=>s(d))),g=e.filter(d=>d.member&&(u===void 0||u.has(s(d.name)))),h=new Set(g),v=[...g];for(;v.length>0;){const d=v.shift();for(const p of d.deps){if(p.kind==="dev"&&!o)continue;const f=l(p);f!==void 0&&!h.has(f)&&(h.add(f),v.push(f))}}const m=[...h],y=m.map(d=>{const p=i(d);return{"bom-ref":p,name:d.name,purl:p,type:"library",version:d.version}}).sort((d,p)=>(d["bom-ref"]??"").localeCompare(p["bom-ref"]??"")),b=m.map(d=>{const p=[...new Set(d.deps.filter(k=>o||k.kind!=="dev").map(k=>l(k)).filter(k=>k!==void 0&&h.has(k)).map(k=>i(k)))].sort(),f=i(d);return p.length>0?{dependsOn:p,ref:f}:{ref:f}}).sort((d,p)=>d.ref.localeCompare(p.ref));return{components:y,dependencies:b}},le=(e,n)=>`pkg:hex/${encodeURIComponent(e)}@${encodeURIComponent(n)}`,ue=/^\s*"[^"]+":\s*\{:hex,\s*:([a-z_]\w*),\s*"([^"]+)"/,q=e=>{const n=[];for(const t of e.split(/\r?\n/)){const o=ue.exec(t);if(o?.[1]===void 0||o[2]===void 0)continue;const s=[];for(const c of t.matchAll(/\{:([a-z_]\w*),\s*"/g))s.push({kind:"main",name:c[1]});n.push({deps:s,member:!0,name:o[1],version:o[2]})}return n},Ge=(e,n={})=>{let t;try{t=_(x(e,"mix.lock"),"utf8")}catch{return{components:[],dependencies:[]}}return V(q(t),{includeDev:n.includeDev,normalize:o=>o,purl:le})},pe=(e,n)=>`pkg:nuget/${encodeURIComponent(e)}@${encodeURIComponent(n)}`,$=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),I=e=>e.toLowerCase(),z=e=>{let n;try{n=JSON.parse(e)}catch{return[]}if(!$(n)||!$(n.dependencies))return[];const t=[];for(const i of Object.values(n.dependencies)){if(!$(i))continue;const a=new Map;for(const[l,u]of Object.entries(i))$(u)&&a.set(l,{depIds:$(u.dependencies)?Object.keys(u.dependencies):[],resolved:typeof u.resolved=="string"?u.resolved:void 0,type:typeof u.type=="string"?u.type:""});t.push(a)}const o=new Set;let s=!1;for(const i of t)for(const a of i.values())if(a.type==="Direct"&&(s=!0),a.type==="Project")for(const l of a.depIds)o.add(I(l));const c=new Map;for(const i of t)for(const[a,l]of i){if(l.type==="Project"||l.resolved===void 0)continue;const u=`${I(a)}\0${l.resolved}`,g=c.get(u)??{deps:[],member:!1,name:a,version:l.resolved};c.set(u,g),l.type==="Direct"&&(g.member=!0);for(const h of l.depIds){const v=i.get(h)?.resolved;v!==void 0&&g.deps.push({kind:"main",name:h,version:v})}}const r=!s&&o.size===0;return[...c.values()].map(i=>({...i,member:r||i.member||o.has(I(i.name))}))},Oe=e=>{let n;try{n=_(x(e,"packages.lock.json"),"utf8")}catch{return{components:[],dependencies:[]}}return V(z(n),{normalize:I,purl:pe})},F={"crates.io":["Cargo.lock"],Go:["go.sum"],Hex:["mix.lock"],Maven:["gradle.lockfile","pom.xml"],NuGet:["packages.lock.json"],Packagist:["composer.lock"],Pub:["pubspec.lock"],PyPI:["uv.lock","poetry.lock","Pipfile.lock"],RubyGems:["Gemfile.lock"],SwiftURL:["Package.resolved"]},fe={cargo:"crates.io",composer:"Packagist","crates.io":"crates.io",dart:"Pub",go:"Go",gradle:"Maven",hex:"Hex",maven:"Maven",npm:"npm",nuget:"NuGet",packagist:"Packagist",pub:"Pub",pypi:"PyPI",rubygems:"RubyGems",swift:"SwiftURL",swifturl:"SwiftURL"},R=e=>fe[e.toLowerCase()]??e,Le=e=>F[R(e)]??[],ve=(e,n)=>{const t=R(n),o=F[t]??[];for(const s of o){const c=K(e,s);if(E(c))return c}},H=e=>{const n=new Set,t=[];for(const o of e){const s=`${o.name}@${o.version}`;n.has(s)||(n.add(s),t.push(o))}return t},me=/\[\[package\]\]([\s\S]*?)(?=\[\[|$)/g,ge=/^\s*name\s*=\s*"([^"]+)"\s*$/m,he=/^\s*version\s*=\s*"([^"]+)"\s*$/m,ke=e=>{const n=[];for(const t of e.matchAll(me)){const o=t[1]??"",s=ge.exec(o)?.[1],c=he.exec(o)?.[1];s&&c&&n.push({isDev:!1,name:s,version:c})}return n},ye=e=>{let n;try{n=JSON.parse(e)}catch{return[]}if(typeof n!="object"||n===null)return[];const t=[];for(const o of["default","develop"]){const s=n[o];if(!(typeof s!="object"||s===null))for(const[c,r]of Object.entries(s)){if(typeof r!="object"||r===null)continue;const i=r.version;if(typeof i!="string")continue;const a=i.replace(/^==/,"").trim();a.length>0&&t.push({isDev:!1,name:c,version:a})}}return t},be=e=>{const n=[];let t;try{t=JSON.parse(e)}catch{return n}for(const[o,s]of[["packages",!1],["packages-dev",!0]]){const c=t[o];if(Array.isArray(c))for(const r of c)typeof r.name=="string"&&typeof r.version=="string"&&n.push({isDev:s,name:r.name,version:ee(r.version)})}return n},Pe=e=>{const n=[];for(const t of e.split(/\r?\n/)){const o=t.trim();if(o.length===0)continue;const s=o.split(/\s+/);if(s.length<3)continue;const[c,r]=s;if(!c||!r?.endsWith("/go.mod"))continue;const i=r.slice(0,-7);i.length!==0&&n.push({isDev:!1,name:c,version:i})}return n},we=/^ {4}([^ ()]+) \(([^()]+)\)\s*$/,Se=e=>{const n=[];let t=!1,o=!1;for(const s of e.split(/\r?\n/)){if(s.startsWith("GEM")){t=!0,o=!1;continue}if(t&&/^[A-Z]/.test(s)){t=!1,o=!1;continue}if(t&&s.trim()==="specs:"){o=!0;continue}if(o){const c=we.exec(s);if(c){const[,r,i]=c,a=i?.split("-")[0];r&&a&&n.push({isDev:!1,name:r,version:a})}}}return n},$e=e=>{const n=[];let t=!1;for(const o of e.split(/\r?\n/)){if(/^\S/.test(o)){t=o.trimEnd()==="packages:";continue}const s=n.at(-1),c=/^ {2}(\S+):\s*$/.exec(o);if(t&&c?.[1]!==void 0){n.push({name:c[1]});continue}const[,r,i]=/^ {4}(dependency|source|version): "?([^"]*)"?\s*$/.exec(o)??[];t&&s!==void 0&&r!==void 0&&i!==void 0&&(r==="source"?s.source=i:r==="version"?s.version=i:s.dependency=i)}return n.filter(o=>o.source==="hosted"&&o.version!==void 0&&o.version.length>0).map(o=>({isDev:o.dependency==="direct dev",name:o.name,version:o.version}))},_e=e=>e.trim().replace(/^[a-z+]+:\/\//i,"").replace(/^[^@/]+@([^:/]+):/,"$1/").replace(/\.git$/,"").replace(/\/+$/,""),Ie=e=>{let n;try{n=JSON.parse(e)}catch{return[]}const t=typeof n=="object"&&n!==null?n.pins:void 0;if(!Array.isArray(t))return[];const o=[];for(const s of t)typeof s.location=="string"&&typeof s.state?.version=="string"&&s.state.version.length>0&&o.push({isDev:!1,name:_e(s.location),version:s.state.version});return o},W=e=>{const n=[],t=[];for(const o of T(e))for(const s of o.dependencies){if(s.group===void 0||s.artifact===void 0||s.version===void 0){t.push(s.group!==void 0&&s.artifact!==void 0?`${s.group}:${s.artifact}`:s.unresolved??"");continue}n.push({isDev:!1,name:`${s.group}:${s.artifact}`,version:s.version})}for(const o of U(e))n.push({isDev:!1,name:`${o.group}:${o.artifact}`,version:o.version});return{packages:H(n),unresolved:[...new Set(t)]}},Ne=e=>W(e).unresolved,Ae=(e,n)=>{if(R(n)==="Maven")return W(e).packages;const t=ve(e,n);if(!t)return[];let o;try{o=_(t,"utf8")}catch{return[]}const s=t.split(/[/\\]/).pop()??"";let c;switch(s){case"Cargo.lock":case"poetry.lock":case"uv.lock":{c=ke(o);break}case"composer.lock":{c=be(o);break}case"Gemfile.lock":{c=Se(o);break}case"go.sum":{c=Pe(o);break}case"mix.lock":{c=q(o).map(r=>({isDev:!1,name:r.name,version:r.version}));break}case"Package.resolved":{c=Ie(o);break}case"packages.lock.json":{c=z(o).map(r=>({isDev:!1,name:r.name,version:r.version}));break}case"Pipfile.lock":{c=ye(o);break}case"pubspec.lock":{c=$e(o);break}default:return[]}return H(c)};export{Ge as a,V as b,R as c,De as d,Ce as e,Oe as f,ae as g,ve as h,Le as i,Ae as l,Ne as m};
|
package/dist/packem_shared/{native-config-sync-TdTWjVgI.js → native-config-sync-Dr9XvxOf.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{e as o,
|
|
1
|
+
import{e as o,a as f}from"./index-BdMIfGVZ.js";import{l as E}from"../packem_chunks/ts-loader.js";import{i as O}from"../packem_chunks/cli-main.js";import{U as c}from"./writeFileSync-DJoHk3Ks-Dhem3Uof.js";import{y as u}from"./isAccessibleSync-DYKTrrvc-BwaMhQs0.js";import{p as C}from"./readJsonSync-CbryXYxN-Bm5i10UW.js";const J=(x,a,d)=>{const s=[],$=Object.entries(d).filter(([,n])=>n).map(([n])=>n);switch(x){case"bun":{const n=o(a,"package.json");if(u(n))try{const e=C(n);e.trustedDependencies=$,c(n,`${JSON.stringify(e,null,2)}
|
|
2
2
|
`),s.push(`Updated package.json trustedDependencies with ${$.length} packages`)}catch(e){s.push(`Failed to update package.json: ${e instanceof Error?e.message:String(e)}`)}break}case"npm":{const n=o(a,".npmrc");let e=u(n)?f(n):"";/^\s*ignore-scripts\s*=\s*true\s*$/m.test(e)?s.push(".npmrc already has ignore-scripts=true"):(e=`${e.trimEnd()}
|
|
3
3
|
ignore-scripts=true
|
|
4
4
|
`,c(n,e),s.push("Added ignore-scripts=true to .npmrc"));break}case"pnpm":{const n=o(a,"pnpm-workspace.yaml");if(!u(n)){s.push("pnpm-workspace.yaml not found. Cannot sync allowBuilds.");break}let e={},m=[];try{const t=E(n);e=t?.allowBuilds??{},m=Array.isArray(t?.onlyBuiltDependencies)?t.onlyBuiltDependencies:[]}catch{}const y={...e,...d},j=Object.keys(d).filter(t=>e[t]!==d[t]).length,g=$.toSorted((t,l)=>t.localeCompare(l)),S=[...new Set([...m,...g])].toSorted((t,l)=>t.localeCompare(l)),b=g.filter(t=>!m.includes(t)).length;if(j===0&&b===0)s.push(`All ${String(Object.keys(d).length)} allowBuilds entries already present in pnpm-workspace.yaml.`);else{const t=Object.keys(y).sort(),l=i=>i.startsWith("@")||i.includes("/")||/[:#\s]/.test(i),h=i=>l(i)?`'${i.replaceAll("'","''")}'`:i,p=`allowBuilds:
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire as j}from"node:module";import{K}from"./target-merge-BClIXg2k.js";import{osvBloomDecode as J,osvBloomProbeBatch as z,NATIVE_BINDING_VERSION as D}from"#native";let k;const V=e=>(k??=j(import.meta.url))(e),h=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,v=e=>{if(typeof h<"u"&&h.versions&&h.versions.node){const[s,t]=h.versions.node.split(".").map(Number);if(s>22||s===22&&t>=3||s===20&&t>=16)return h.getBuiltinModule(e)}return V(e)},{createHash:H,randomUUID:P}=v("node:crypto"),{existsSync:g}=v("node:fs"),{readFile:O,mkdir:T,stat:B,writeFile:F,rename:q,unlink:G}=v("node:fs/promises"),{join:d,dirname:W}=v("node:path"),I=6;if(D!==I)throw new Error(`vis native binding ABI mismatch in osv-bloom: expected ${I}, got ${D}. Rebuild via \`pnpm --filter @visulima/vis run build:native\` or reinstall the platform binding package.`);const nt="https://endevco.github.io/osv-bloom",X=new Set(["endevco.github.io"]);class w extends Error{cause="OSV_BLOOM_SOURCE_NOT_ALLOWED";constructor(s){super(`osv-bloom source host '${s}' is not in the built-in allowlist. Add it to \`security.audit.advisories.bloom.allowedHosts\` if intentional.`),this.name="OsvBloomSourceNotAllowedError"}}class b extends Error{cause="OSV_BLOOM_NETWORK";constructor(s,t){super(`osv-bloom fetch failed for ${s}: ${t}. Check connectivity, proxy env vars, or --source.`),this.name="OsvBloomNetworkError"}}class Y extends Error{cause="OSV_BLOOM_INTEGRITY";constructor(s,t){super(`osv-bloom filter.bin sha256 mismatch (expected ${s}, got ${t}). Refusing to install a corrupted filter.`),this.name="OsvBloomIntegrityError"}}class m extends Error{cause="OSV_BLOOM_MANIFEST";constructor(s){super(`osv-bloom manifest invalid: ${s}`),this.name="OsvBloomManifestError"}}class Q extends Error{cause="OSV_BLOOM_CACHE_MISS";constructor(s){super(`No osv-bloom cache at ${s}. Run 'vis advisories bloom sync' first.`),this.name="OsvBloomCacheMissError"}}const p=e=>{const t=K("vis",{create:!0,cwd:e})??d(e,"node_modules",".cache","vis");return d(t,"osv-bloom")},l=e=>d(e,"filter.bin"),$=e=>d(e,"manifest.json"),L=e=>d(e,"state.json"),Z=(e,s)=>{let t;try{t=new URL(e)}catch{throw new w(e)}if(!t.host)throw new w(e);if(t.protocol!=="https:")throw new w(`${t.protocol}//${t.host}`);if(!new Set([...X,...s??[]]).has(t.host))throw new w(t.host);return t},at=async e=>{const s=Date.now(),t=e.cacheDir??p(e.workspaceRoot);await T(t,{recursive:!0});const r=Z(e.source,e.allowedHosts),n=new URL("manifest.json",M(r.toString())),o=new URL("filter.bin",M(r.toString())),a=await A(n,{method:"GET"});if(!a.ok)throw new b(n.toString(),a.status);const _=await a.text(),i=R(_),u=await x(t);if(!e.force&&u?.setDigestSha256===i.setDigestSha256&&g(l(t)))return{bytesOnDisk:(await B(l(t))).size,cacheDir:t,durationMs:Date.now()-s,manifest:i,upToDate:!0};const E={};!e.force&&u?.filterEtag&&(E.headers={"if-none-match":u.filterEtag});const f=await A(o,{...E,method:"GET"});if(f.status===304&&u&&g(l(t)))return await N(t,_,{fetchedAtIso:new Date().toISOString(),filterEtag:u.filterEtag,setDigestSha256:i.setDigestSha256}),{bytesOnDisk:(await B(l(t))).size,cacheDir:t,durationMs:Date.now()-s,manifest:i,upToDate:!0};if(!f.ok||!f.body)throw new b(o.toString(),f.status);const c=Buffer.from(await f.arrayBuffer());e.onProgress&&e.onProgress(c.length,c.length);const y=tt(c);if(y!==i.filterSha256)throw new Y(i.filterSha256,y);if(c.length!==i.bloomByteLen)throw new m(`filter.bin length ${c.length} does not match manifest.bloom_byte_len ${i.bloomByteLen}`);const U=f.headers.get("etag")??void 0;return await S(l(t),c),await N(t,_,{fetchedAtIso:new Date().toISOString(),filterEtag:U,setDigestSha256:i.setDigestSha256}),{bytesOnDisk:c.length,cacheDir:t,durationMs:Date.now()-s,manifest:i,upToDate:!1}},it=async(e,s)=>{const t=s?.cacheDir??p(e),r=l(t);if(!g(r)){if(s?.softFail)return null;throw new Q(t)}const n=await O(r);return J(n)},ct=(e,s)=>z(e,s),lt=async(e,s)=>{const t=s??p(e);if(!g(l(t)))return{cacheDir:t,present:!1};let n,o;try{n=R(await O($(t),"utf8"))}catch{}try{o=await x(t)}catch{}return{cacheDir:t,fetchedAtIso:o?.fetchedAtIso,manifest:n,present:!0}},R=e=>{let s;try{s=JSON.parse(e)}catch(o){throw new m(o instanceof Error?o.message:String(o))}const t=o=>{const a=s[o];if(typeof a!="number"||Number.isNaN(a))throw new m(`field '${o}' missing or non-numeric`);return a},r=o=>{const a=s[o];if(typeof a!="string"||a.length===0)throw new m(`field '${o}' missing or empty`);return a},n=t("format_version");if(n!==1)throw new m(`unsupported format_version ${n} (this build expects v1)`);return{advisoryCount:t("advisory_count"),bloomByteLen:t("bloom_byte_len"),bloomKHashes:t("bloom_k_hashes"),bloomMBits:t("bloom_m_bits"),builtAtRfc3339:r("built_at_rfc3339"),builtAtUnix:t("built_at_unix"),entryCount:t("entry_count"),filterSha256:r("filter_sha256"),formatVersion:n,setDigestSha256:r("set_digest_sha256"),sourceUrl:r("source_url"),targetFpr:t("target_fpr")}},x=async e=>{try{const s=await O(L(e),"utf8"),t=JSON.parse(s);return typeof t.setDigestSha256!="string"||typeof t.fetchedAtIso!="string"?void 0:{fetchedAtIso:t.fetchedAtIso,filterEtag:typeof t.filterEtag=="string"?t.filterEtag:void 0,setDigestSha256:t.setDigestSha256}}catch{return}},N=async(e,s,t)=>{await S($(e),Buffer.from(s,"utf8")),await S(L(e),Buffer.from(`${JSON.stringify(t,void 0,2)}
|
|
2
|
+
`,"utf8"))},S=async(e,s)=>{await T(W(e),{recursive:!0});const t=`${e}.${process.pid}.${P()}.tmp`;try{await F(t,s),await q(t,e)}catch(r){throw await G(t).catch(()=>{}),r}},tt=e=>H("sha256").update(e).digest("hex"),M=e=>e.endsWith("/")?e:`${e}/`,et=3e4,A=async(e,s)=>{try{return await fetch(e,{...s,signal:AbortSignal.timeout(et)})}catch(t){throw new b(e.toString(),t instanceof Error?t.message:String(t))}};export{nt as D,Q as O,lt as g,it as l,ct as p,at as s};
|