@visulima/vis 3.0.0 → 3.0.2
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 +19 -0
- package/LICENSE.md +5760 -4562
- package/dashboard/dist/index.html +12 -12
- package/dist/bin.js +1 -1
- package/dist/binx.js +2 -2
- package/dist/config/index.js +1 -1
- package/dist/packem_chunks/CONFIG_FILES.js +6 -6
- package/dist/packem_chunks/DEFAULT_CLEAN_KEEP.js +1 -1
- package/dist/packem_chunks/agent-instructions.js +7 -7
- package/dist/packem_chunks/bloom-status.js +2 -2
- package/dist/packem_chunks/bloom-sync.js +2 -2
- package/dist/packem_chunks/cache-attestation.js +1 -1
- package/dist/packem_chunks/catalog-detector.js +1 -1
- package/dist/packem_chunks/catalog.js +87 -111
- package/dist/packem_chunks/cli-exec.js +1 -1
- package/dist/packem_chunks/cli-main.js +192 -217
- package/dist/packem_chunks/defineReleasePlugin.js +3 -3
- package/dist/packem_chunks/detect.js +8 -3
- package/dist/packem_chunks/devtools.js +1 -1
- package/dist/packem_chunks/discord.js +4 -4
- package/dist/packem_chunks/dispatch.js +4 -4
- package/dist/packem_chunks/doctor-probe.js +2 -2
- package/dist/packem_chunks/extra-files.js +3 -3
- package/dist/packem_chunks/fix.js +11 -11
- package/dist/packem_chunks/git.js +3 -3
- package/dist/packem_chunks/group-tags.js +1 -1
- package/dist/packem_chunks/handler.js +1 -1
- package/dist/packem_chunks/handler10.js +5 -5
- package/dist/packem_chunks/handler11.js +1 -1
- package/dist/packem_chunks/handler12.js +16 -16
- package/dist/packem_chunks/handler13.js +5 -5
- 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 +5 -5
- package/dist/packem_chunks/handler2.js +1 -1
- package/dist/packem_chunks/handler20.js +2 -2
- package/dist/packem_chunks/handler21.js +2 -2
- package/dist/packem_chunks/handler22.js +8 -8
- package/dist/packem_chunks/handler23.js +1 -1
- package/dist/packem_chunks/handler24.js +1 -1
- package/dist/packem_chunks/handler25.js +1 -1
- package/dist/packem_chunks/handler26.js +5 -5
- package/dist/packem_chunks/handler27.js +1 -1
- package/dist/packem_chunks/handler28.js +3 -3
- package/dist/packem_chunks/handler29.js +1 -1
- package/dist/packem_chunks/handler3.js +2 -2
- package/dist/packem_chunks/handler30.js +1 -1
- package/dist/packem_chunks/handler31.js +2 -2
- package/dist/packem_chunks/handler32.js +2 -2
- package/dist/packem_chunks/handler33.js +2 -2
- package/dist/packem_chunks/handler34.js +3 -3
- package/dist/packem_chunks/handler35.js +5 -5
- package/dist/packem_chunks/handler36.js +1 -1
- package/dist/packem_chunks/handler37.js +2 -2
- package/dist/packem_chunks/handler38.js +6 -6
- package/dist/packem_chunks/handler39.js +8 -8
- package/dist/packem_chunks/handler4.js +4 -4
- package/dist/packem_chunks/handler40.js +34 -34
- package/dist/packem_chunks/handler41.js +5 -5
- package/dist/packem_chunks/handler42.js +4 -4
- package/dist/packem_chunks/handler43.js +3 -3
- package/dist/packem_chunks/handler44.js +2 -2
- package/dist/packem_chunks/handler45.js +1 -1
- package/dist/packem_chunks/handler46.js +1 -1
- package/dist/packem_chunks/handler47.js +1 -1
- package/dist/packem_chunks/handler48.js +3 -3
- package/dist/packem_chunks/handler49.js +1 -1
- package/dist/packem_chunks/handler5.js +6 -6
- package/dist/packem_chunks/handler50.js +6 -6
- package/dist/packem_chunks/handler51.js +13 -13
- package/dist/packem_chunks/handler52.js +3 -3
- package/dist/packem_chunks/handler53.js +5 -5
- package/dist/packem_chunks/handler54.js +2 -2
- package/dist/packem_chunks/handler55.js +1 -1
- package/dist/packem_chunks/handler56.js +4 -4
- package/dist/packem_chunks/handler57.js +5 -5
- package/dist/packem_chunks/handler58.js +5 -5
- package/dist/packem_chunks/handler59.js +8 -8
- package/dist/packem_chunks/handler6.js +7 -7
- package/dist/packem_chunks/handler60.js +3 -3
- package/dist/packem_chunks/handler61.js +21 -21
- package/dist/packem_chunks/handler62.js +12 -12
- package/dist/packem_chunks/handler63.js +3 -3
- package/dist/packem_chunks/handler64.js +5 -5
- package/dist/packem_chunks/handler65.js +8 -8
- package/dist/packem_chunks/handler66.js +2 -2
- package/dist/packem_chunks/handler67.js +25 -24
- package/dist/packem_chunks/handler68.js +153 -25
- package/dist/packem_chunks/handler69.js +10 -153
- package/dist/packem_chunks/handler7.js +1 -1
- package/dist/packem_chunks/handler70.js +22 -10
- package/dist/packem_chunks/handler71.js +17 -17
- package/dist/packem_chunks/handler72.js +104 -104
- package/dist/packem_chunks/handler73.js +20 -20
- package/dist/packem_chunks/handler74.js +45 -45
- package/dist/packem_chunks/handler75.js +27 -3
- package/dist/packem_chunks/handler76.js +3 -27
- package/dist/packem_chunks/handler77.js +68 -68
- package/dist/packem_chunks/handler78.js +30 -30
- package/dist/packem_chunks/handler8.js +1 -1
- package/dist/packem_chunks/handler9.js +1 -1
- package/dist/packem_chunks/heal-accept.js +9 -9
- package/dist/packem_chunks/heal.js +11 -11
- package/dist/packem_chunks/help-command.js +7 -63
- package/dist/packem_chunks/index.js +1 -1
- package/dist/packem_chunks/index2.js +48 -804
- package/dist/packem_chunks/index3.js +3 -7
- package/dist/packem_chunks/index4.js +801 -134
- package/dist/packem_chunks/index5.js +7 -73
- package/dist/packem_chunks/index6.js +73 -0
- package/dist/packem_chunks/index7.js +135 -0
- package/dist/packem_chunks/interface.js +2 -2
- package/dist/packem_chunks/keys-refresh.js +4 -4
- package/dist/packem_chunks/lean.js +3 -3
- package/dist/packem_chunks/list.js +3 -3
- package/dist/packem_chunks/loader.js +4 -4
- package/dist/packem_chunks/loader2.js +1 -1
- package/dist/packem_chunks/orchestrator.js +27 -27
- package/dist/packem_chunks/pre-mode.js +2 -2
- package/dist/packem_chunks/print-config.js +1 -1
- package/dist/packem_chunks/prompts.js +7 -7
- package/dist/packem_chunks/prune.js +3 -3
- package/dist/packem_chunks/publish-guards.js +1 -1
- package/dist/packem_chunks/resolveFormatter.js +5 -5
- package/dist/packem_chunks/run.js +1 -1
- package/dist/packem_chunks/security.js +1 -1
- package/dist/packem_chunks/shell-runner.js +1 -1
- package/dist/packem_chunks/slack.js +2 -2
- package/dist/packem_chunks/snapshot.js +2 -2
- package/dist/packem_chunks/stage-publisher.js +1 -1
- package/dist/packem_chunks/staged-registry.js +2 -2
- package/dist/packem_chunks/state.js +3 -3
- package/dist/packem_chunks/status.js +2 -2
- package/dist/packem_chunks/success-walk.js +4 -4
- package/dist/packem_chunks/sync.js +2 -2
- package/dist/packem_chunks/sync2.js +2 -2
- package/dist/packem_chunks/tar.js +3 -3
- package/dist/packem_chunks/tripwire.js +2 -2
- package/dist/packem_chunks/ts-loader.js +5 -9
- package/dist/packem_chunks/verify-lockfile.js +2 -2
- package/dist/packem_chunks/version-resolver.js +2 -2
- package/dist/packem_chunks/webhook.js +1 -1
- package/dist/packem_chunks/workflow-templates.js +5 -5
- package/dist/packem_chunks/workspace.js +2 -2
- package/dist/packem_shared/ReleaseClient-DAvbxCdo.js +1 -0
- package/dist/packem_shared/Table-DyORjLji-CC9cYgCG.js +11 -0
- package/dist/packem_shared/{VisReleaseError-DMGRBTNO.js → VisReleaseError-DZtgcKf8.js} +1 -1
- package/dist/packem_shared/_commonjsHelpers-DTfxOvZk.js +1 -0
- package/dist/packem_shared/advisories-DZd1uGqa.js +1 -0
- package/dist/packem_shared/affected-selection-CoRXp5H4.js +1 -0
- package/dist/packem_shared/affected-shas-Dd0P7fGD.js +1 -0
- package/dist/packem_shared/ai-analysis-DSQQDFU9.js +68 -0
- package/dist/packem_shared/ai-fix-6nXZbecQ.js +43 -0
- package/dist/packem_shared/augment-COAiXSIx.js +4 -0
- package/dist/packem_shared/bin-C2eYtJ_N.js +1 -0
- package/dist/packem_shared/build-scripts-pdVmqXRm.js +1 -0
- package/dist/packem_shared/clean-DRiLimTx.js +1 -0
- package/dist/packem_shared/command-runtime-CiLVo4ED.js +1 -0
- package/dist/packem_shared/{compile-cache-B_Vf_WxT.js → compile-cache-DoMHRsRZ.js} +1 -1
- package/dist/packem_shared/createAdapter-F7GidOzU.js +1 -0
- package/dist/packem_shared/createVersionActions-ByaJ1Nbv.js +1 -0
- package/dist/packem_shared/cyclonedx-B1vzerwP.js +4 -0
- package/dist/packem_shared/dependency-scan-DBH2Qo4I.js +1 -0
- package/dist/packem_shared/docker-Bex05Qcn.js +59 -0
- package/dist/packem_shared/failure-log-D92tM0ie.js +2 -0
- package/dist/packem_shared/formatBytes-BHAzNIrn-DFIppnY0.js +4 -0
- package/dist/packem_shared/getRandomSpinner-4ZEcbTYv-DCyIuj19.js +1 -0
- package/dist/packem_shared/giget-D8Kwb0kD.js +2 -0
- package/dist/packem_shared/glob-Cyk1H9ZL-ox19CSsT.js +1 -0
- package/dist/packem_shared/index-B4AjSxHU.js +1 -0
- package/dist/packem_shared/index-BisalDCf.js +39 -0
- package/dist/packem_shared/{index-BWl4DbMp.js → index-BjdW45xX.js} +1 -1
- package/dist/packem_shared/index-DHD8wb6Z.js +22 -0
- package/dist/packem_shared/index-DXPSWMbG.js +1 -0
- package/dist/packem_shared/index.server-BAjDJSEu.js +2 -0
- package/dist/packem_shared/isAccessibleSync-DYKTrrvc-CSnBISfV.js +1 -0
- package/dist/packem_shared/license-DvlYdo6T.js +1 -0
- package/dist/packem_shared/lifecycle-CfTZQHOG.js +2 -0
- package/dist/packem_shared/lockfile-35RFsJDs.js +1 -0
- package/dist/packem_shared/lockfile-DhHAaHN5.js +1 -0
- package/dist/packem_shared/main-BP-w-K-6.js +1 -0
- package/dist/packem_shared/manifests-BNSmpPF_.js +1 -0
- package/dist/packem_shared/min-release-age-ChzTC7_I.js +34 -0
- package/dist/packem_shared/missing-package-json-C0keIt78.js +1 -0
- package/dist/packem_shared/native-config-sync-BSzU4qUO.js +21 -0
- package/dist/packem_shared/osv-bloom-1JS__1or.js +2 -0
- package/dist/packem_shared/otelPlugin-D8LL2-4L.js +1 -0
- package/dist/packem_shared/package-version-Bb7KGF36.js +4 -0
- package/dist/packem_shared/packument-C55kVxcQ.js +1 -0
- package/dist/packem_shared/{peer-warnings-BXAzXqY3.js → peer-warnings-CmYSxvql.js} +1 -1
- package/dist/packem_shared/pm-runner-de-jCq8q.js +1 -0
- package/dist/packem_shared/project-name-filter-DYaIbrXa.js +7 -0
- package/dist/packem_shared/{prompt-BSAy8SMH.js → prompt-DMzaQEVa.js} +1 -1
- package/dist/packem_shared/provenance-CvfQEJPQ.js +1 -0
- package/dist/packem_shared/readJsonSync-CbryXYxN-B2aSeDpC.js +1 -0
- package/dist/packem_shared/registry-keys-DmBrAlhg.js +1 -0
- package/dist/packem_shared/resolve-explicit-DYaHAVDg.js +5 -0
- package/dist/packem_shared/resolve-runtime-C7NBCA1C.js +1 -0
- package/dist/packem_shared/run-file-jMngGQhs.js +1 -0
- package/dist/packem_shared/runtime-check-BklgEMkC.js +1 -0
- package/dist/packem_shared/s1ngularity-C8sva2SO.js +1 -0
- package/dist/packem_shared/scan-progress-aVHGZYWf.js +2 -0
- package/dist/packem_shared/selectors-B7lSFz7l.js +3 -0
- package/dist/packem_shared/signatures-oZ_2IneN.js +2 -0
- package/dist/packem_shared/{slug-DoueYuLo.js → slug-OBHcH7wV.js} +1 -1
- package/dist/packem_shared/spinner-CbJfWYwB.js +1 -0
- package/dist/packem_shared/sticky-comment-DjhyCIZt.js +1 -0
- package/dist/packem_shared/subtree-DtmcKAJK.js +2 -0
- package/dist/packem_shared/symbols-BXDZ_sKt.js +1 -0
- package/dist/packem_shared/tabs-BilwonkM.js +1 -0
- package/dist/packem_shared/target-merge-DCGow6Kw.js +4 -0
- package/dist/packem_shared/target-options-d_rIrLyq.js +1 -0
- package/dist/packem_shared/toolchain-DY11tPCw.js +5 -0
- package/dist/packem_shared/typosquats-Cdsnf6aN.js +1 -0
- package/dist/packem_shared/use-measured-height-BPQg2q_p.js +1 -0
- package/dist/packem_shared/utils-DQFHJn72.js +1 -0
- package/dist/packem_shared/verify-D8wYvB85.js +1 -0
- package/dist/packem_shared/vis-update-app-ngwL2mRv.js +1 -0
- package/dist/packem_shared/vis-user-error-CAu9wIbe.js +30 -0
- package/dist/packem_shared/watch-Dswvj6Zp.js +1 -0
- package/dist/packem_shared/watch-loop-COWvvSbR.js +11 -0
- package/dist/packem_shared/writeFileSync-DJoHk3Ks-CgQ-VNNT.js +1 -0
- package/dist/release/core/changelog/index.d.ts +62 -2
- package/dist/release/core/package-managers/index.d.ts +25 -1
- package/dist/release/core/package-managers/index.js +1 -1
- package/dist/release/core/version-actions/index.d.ts +47 -2
- package/dist/release/core/version-actions/index.js +1 -1
- package/dist/release/index.d.ts +100 -1
- package/dist/release/index.js +1 -1
- package/dist/release/plugin-sdk.d.ts +16 -1
- package/dist/release/plugin-sdk.js +1 -1
- package/dist/release/presets.js +1 -1
- package/dist/release/types.js +1 -1
- package/dist/runtime/preload.js +1 -1
- package/index.js +26 -26
- package/package.json +14 -14
- package/dist/packem_chunks/detect2.js +0 -8
- package/dist/packem_chunks/registry.js +0 -48
- package/dist/packem_shared/ReleaseClient-BY4OZNCK.js +0 -1
- package/dist/packem_shared/_commonjsHelpers-B5Y90VFO.js +0 -1
- package/dist/packem_shared/advisories-DsXRmIA5.js +0 -1
- package/dist/packem_shared/affected-selection-BE6VFCDV.js +0 -1
- package/dist/packem_shared/affected-shas-BKEu4RZc.js +0 -1
- package/dist/packem_shared/ai-analysis-DikAj6rX.js +0 -68
- package/dist/packem_shared/ai-fix-bfWo0cZX.js +0 -43
- package/dist/packem_shared/augment-BkJxi_GW.js +0 -4
- package/dist/packem_shared/bin-B-TytgzW.js +0 -1
- package/dist/packem_shared/build-scripts-DWypBQ--.js +0 -1
- package/dist/packem_shared/clean-DWjQl14S.js +0 -1
- package/dist/packem_shared/command-runtime-DQ7ZpLYL.js +0 -1
- package/dist/packem_shared/createAdapter-bU4DIP3F.js +0 -1
- package/dist/packem_shared/createVersionActions-BK43SNDH.js +0 -1
- package/dist/packem_shared/cyclonedx-DLBi65MV.js +0 -4
- package/dist/packem_shared/dependency-scan-ZLOuLkGN.js +0 -1
- package/dist/packem_shared/docker-B4zAZCZG.js +0 -59
- package/dist/packem_shared/en-BDYMmM2_.js +0 -27
- package/dist/packem_shared/failure-log-DyhWPqno.js +0 -2
- package/dist/packem_shared/giget-CAxjpwew.js +0 -2
- package/dist/packem_shared/glob-BUjyjdE8-Dp_QcayW.js +0 -1
- package/dist/packem_shared/index-BAe6e0XE.js +0 -1
- package/dist/packem_shared/index-BLtnel38.js +0 -35
- package/dist/packem_shared/index-CuKDxOCI.js +0 -1
- package/dist/packem_shared/index-tNFGWxc0.js +0 -39
- package/dist/packem_shared/index.server-CusjRLCh.js +0 -2
- package/dist/packem_shared/license-t5KnNX6v.js +0 -1
- package/dist/packem_shared/lifecycle-KY9umOg6.js +0 -2
- package/dist/packem_shared/lockfile-YAuZf1gh.js +0 -1
- package/dist/packem_shared/main-D_cam4hv.js +0 -1
- package/dist/packem_shared/manifests-BwTn_1ad.js +0 -1
- package/dist/packem_shared/min-release-age-6avfn81h.js +0 -34
- package/dist/packem_shared/missing-package-json-Cl0vdz6K.js +0 -1
- package/dist/packem_shared/native-config-sync-CHMCJx7H.js +0 -21
- package/dist/packem_shared/osv-bloom-DdqDnLCt.js +0 -2
- package/dist/packem_shared/otelPlugin-DmKDBaPo.js +0 -1
- package/dist/packem_shared/package-version-BNRJ3o9C.js +0 -4
- package/dist/packem_shared/packument-B9-WqReu.js +0 -1
- package/dist/packem_shared/pm-runner-DRybtzOV.js +0 -1
- package/dist/packem_shared/project-name-filter-Dw0fC6IO.js +0 -7
- package/dist/packem_shared/provenance-CLxuqCfL.js +0 -1
- package/dist/packem_shared/readJsonSync-DweZd5ZA-CtrDlqpb.js +0 -1
- package/dist/packem_shared/registry-keys-cTN24144.js +0 -1
- package/dist/packem_shared/resolve-explicit-Uw6WQl9R.js +0 -5
- package/dist/packem_shared/resolve-runtime-DztanwkZ.js +0 -1
- package/dist/packem_shared/run-file-CaE5_xBY.js +0 -1
- package/dist/packem_shared/runtime-check-C32yE57I.js +0 -1
- package/dist/packem_shared/s1ngularity-BIYhg82u.js +0 -1
- package/dist/packem_shared/scan-progress-DWfY4zkp.js +0 -2
- package/dist/packem_shared/selectors-D2j4M9Ul.js +0 -3
- package/dist/packem_shared/signatures-C8iQ5fUq.js +0 -2
- package/dist/packem_shared/sticky-comment-D6_7-w8T.js +0 -1
- package/dist/packem_shared/subtree-DSm0QEoE.js +0 -2
- package/dist/packem_shared/symbols-DPTlrJ3B.js +0 -1
- package/dist/packem_shared/target-merge-DLxJTcxn.js +0 -11
- package/dist/packem_shared/target-options-3t4-2F-F.js +0 -1
- package/dist/packem_shared/toolchain-BPzbahcQ.js +0 -5
- package/dist/packem_shared/typosquats-BWrmhh36.js +0 -1
- package/dist/packem_shared/use-measured-height-BwAwGHjw.js +0 -1
- package/dist/packem_shared/utils-CRueU43T.js +0 -1
- package/dist/packem_shared/verify-CzUPT6Uk.js +0 -1
- package/dist/packem_shared/vis-update-app-D6Wq8ZHM.js +0 -1
- package/dist/packem_shared/vis-user-error-CfM4_ORo.js +0 -30
- package/dist/packem_shared/watch-D_oAxW_Z.js +0 -1
- package/dist/packem_shared/watch-loop-BrjblOz5.js +0 -11
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{createRequire as
|
|
2
|
-
`);return}if(
|
|
3
|
-
`);return}if(s.info(`Migration equivalence: ${t.source} → vis`),s.info(` source nodes: ${String(t.sourceNodeCount)} vis nodes: ${String(t.visNodeCount)}`),t.findings.length===0){s.info(" ✓ task graph + cache-key surface preserved (no divergence).");return}for(const
|
|
4
|
-
`)},
|
|
5
|
-
`);const
|
|
1
|
+
import{createRequire as G}from"node:module";import{y as N,z as q,A as z,B as f,D as J,E as W,F as Y,G as H,H as V,I as Q,J as U,K as X,L as Z,M as tt,N as nt,P as et,Q as P,R as st}from"./cli-main.js";import{e as p,z as j,l as rt,$ as ct}from"../packem_shared/index-DHD8wb6Z.js";import{loadVisConfig as at}from"./CONFIG_FILES.js";import{y as x}from"../packem_shared/isAccessibleSync-DYKTrrvc-CSnBISfV.js";import{U as O}from"../packem_shared/writeFileSync-DJoHk3Ks-CgQ-VNNT.js";import{L as dt}from"./catalog.js";import{v as pt}from"../packem_shared/verify-D8wYvB85.js";let K;const L=t=>(K??=G(import.meta.url))(t),E=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,B=t=>{if(typeof E<"u"&&E.versions&&E.versions.node){const[n,s]=E.versions.node.split(".").map(Number);if(n>22||n===22&&s>=3||n===20&&s>=16)return E.getBuiltinModule(t)}return L(t)},{readdirSync:it,statSync:ot}=B("node:fs"),{stdin:T,stdout:ut}=E,{createInterface:ft}=B("node:readline/promises"),k="__global__",b=t=>[...new Set(t)].sort((n,s)=>n.localeCompare(s)),mt=t=>`{${Object.keys(t).sort().map(i=>`${i}=${JSON.stringify(t[i])}`).join(",")}}`,h=t=>{if(!Array.isArray(t))return[];const n=[];for(const s of t)typeof s=="string"?n.push(s):s&&typeof s=="object"&&n.push(mt(s));return b(n)},v=t=>({cache:void 0,dependsOn:[],env:[],id:t,inputs:[],outputs:[]}),g=(t,n,s)=>s?`^${n}`:t&&t!=="self"&&t!=="~"?`${t}#${n}`:n,lt=(t,n)=>{const s=t.trim();if(n==="moon"){if(s.startsWith("^:"))return g(void 0,s.slice(2),!0);if(s.startsWith("~:"))return g(void 0,s.slice(2),!1);if(s.includes(":")){const[i,e]=s.split(":");return g(i,e??"",!1)}return s}if(s.startsWith("^"))return g(void 0,s.slice(1),!0);if(s.includes("#")){const[i,e]=s.split("#");return g(i,e??"",!1)}return s},R=(t,n)=>{if(!Array.isArray(t))return[];const s=[];for(const i of t){if(typeof i=="string"){s.push(lt(i,n));continue}if(!i||typeof i!="object")continue;const e=i,{target:o}=e;if(!o)continue;if(e.dependencies===!0){s.push(g(void 0,o,!0));continue}if(e.projects===void 0){s.push(g(void 0,o,!1));continue}const r=Array.isArray(e.projects)?e.projects:[e.projects];for(const a of r)s.push(a==="^"?g(void 0,o,!0):g(a,o,!1))}return b(s)},M=t=>{if(x(t))try{return JSON.parse(j(t))}catch{return}},yt=t=>{const n=new Map,s=M(p(t,"turbo.json"));if(!s)return n;const i=s.tasks??s.pipeline??{};for(const[o,r]of Object.entries(i)){const a=o.includes("#")?o:`*#${o}`,c=v(a);c.dependsOn=R(r.dependsOn,"turbo"),c.inputs=h(r.inputs),c.outputs=h(r.outputs),c.env=b([...r.env??[],...r.passThroughEnv??[]]),c.cache=r.cache===!1?!1:void 0,n.set(a,c)}const e=v(k);return e.inputs=h(s.globalDependencies),e.env=b([...s.globalEnv??[],...s.globalPassThroughEnv??[]]),(e.inputs.length>0||e.env.length>0)&&n.set(k,e),n},ht=new Set([".git",".nx",".turbo",".vis","build","coverage","dist","node_modules"]),C=(t,n,s=8)=>{const i=[],e=(o,r)=>{if(r>s)return;let a;try{a=it(o)}catch{return}for(const c of a.toSorted()){if(c===n){i.push(p(o,c));continue}if(c.startsWith(".")&&c!==".moon"||ht.has(c))continue;const u=p(o,c);try{ot(u).isDirectory()&&e(u,r+1)}catch{}}};return e(t,0),i},I=(t,n)=>{t.dependsOn=R(n.dependsOn,"nx"),t.inputs=h(n.inputs),t.outputs=h(n.outputs),t.cache=typeof n.cache=="boolean"?n.cache:void 0},gt=t=>{const n=new Map,s=M(p(t,"nx.json"));for(const[i,e]of Object.entries(s?.targetDefaults??{})){const o=`*#${i}`,r=v(o);I(r,e),n.set(o,r)}for(const i of C(t,"project.json")){const e=M(i);if(!(!e?.name||!e.targets))for(const[o,r]of Object.entries(e.targets)){const a=`${e.name}#${o}`,c=v(a);I(c,r),n.set(a,c)}}return n},_=(t,n)=>{t.dependsOn=R(n.deps,"moon"),t.inputs=h(n.inputs),t.outputs=h(n.outputs),t.cache=typeof n.options?.cache=="boolean"?n.options.cache:void 0},A=t=>{if(x(t))try{return rt(t)}catch{return}},vt=t=>{const n=new Map,s=p(t,".moon"),i=[p(s,"tasks.yml"),p(s,"tasks.yaml")];for(const e of i){const o=A(e);if(o){for(const[r,a]of Object.entries(o.tasks??{})){const c=`*#${r}`,u=v(c);_(u,a),n.set(c,u)}if(o.implicitInputs&&o.implicitInputs.length>0){const r=v(k);r.inputs=h(o.implicitInputs),n.set(k,r)}}}for(const e of[...C(t,"moon.yml"),...C(t,"moon.yaml")]){const o=A(e);if(!o?.tasks)continue;const a=e.split(/[/\\]/).at(-2)??"*";for(const[c,u]of Object.entries(o.tasks)){const w=`${a}#${c}`,d=v(w);_(d,u),n.set(w,d)}}return n},xt=(t,n)=>{t.dependsOn=R(n.dependsOn,"vis"),t.inputs=h(n.inputs),t.outputs=h(n.outputs),t.env=b([...n.env??[],...n.passThroughEnv??[],...n.options?.passThroughEnv??[]]),t.cache=n.cache===!1?!1:typeof n.cache=="boolean"?n.cache:void 0},kt=async t=>{const n=new Map,s=await at(t);for(const[o,r]of Object.entries(s.tasks??{})){const a=`*#${o}`,c=v(a);xt(c,r??{}),n.set(a,c)}const i=s.taskRunner??{},e=v(k);return e.inputs=h(i.globalInputs),e.env=b([...i.globalEnv??[],...i.globalPassThroughEnv??[]]),(e.inputs.length>0||e.env.length>0)&&n.set(k,e),n},bt=(t,n)=>{switch(n){case"moon":return vt(t);case"nx":return gt(t);default:return yt(t)}},wt=t=>{const n=[];return x(p(t,"turbo.json"))&&n.push("turbo"),x(p(t,"nx.json"))&&n.push("nx"),(x(p(t,".moon","tasks.yml"))||x(p(t,".moon","tasks.yaml")))&&n.push("moon"),n.length===1?n[0]:void 0},S=(t,n,s,i,e)=>{const o=i.filter(c=>!e.includes(c)),r=e.filter(c=>!i.includes(c));if(o.length===0&&r.length===0)return;const a=[];o.length>0&&a.push(`dropped [${o.join(", ")}]`),r.length>0&&a.push(`added [${r.join(", ")}]`),t.push({axis:s,detail:`${s} diverged: ${a.join("; ")}`,node:n,severity:o.length>0?"error":"warning"})},Et=(t,n,s)=>{const i=[],e=b([...t.keys(),...n.keys()]);for(const o of e){const r=t.get(o),a=n.get(o);if(r&&!a){const c=s==="turbo"&&o.includes("#")&&!o.startsWith("*#")&&o!==k;i.push({axis:"target-set",detail:c?`source target \`${o}\` was skipped by design (turbo project#task is migrated into per-project project.json — move it there and re-verify)`:`source target \`${o}\` has no equivalent in the migrated vis config`,node:o,severity:c?"warning":"error"});continue}if(!r&&a){i.push({axis:"target-set",detail:`migrated vis config defines \`${o}\` with no source equivalent (extra target — not a regression, but review)`,node:o,severity:"warning"});continue}!r||!a||(S(i,o,"dependsOn",r.dependsOn,a.dependsOn),S(i,o,"inputs",r.inputs,a.inputs),S(i,o,"outputs",r.outputs,a.outputs),S(i,o,"env",r.env,a.env),r.cache!==void 0&&a.cache!==void 0&&r.cache!==a.cache&&i.push({axis:"cache",detail:`cache flag diverged: source=${String(r.cache)} vis=${String(a.cache)} (changes what invalidates the cache)`,node:o,severity:"error"}))}return i.sort((o,r)=>o.node.localeCompare(r.node)||o.axis.localeCompare(r.axis)),{findings:i,source:s,sourceNodeCount:t.size,visNodeCount:n.size}},$t=new Set(["json","ndjson","table"]),St=t=>({equivalent:t.findings.every(n=>n.severity!=="error"),findings:t.findings,source:t.source,sourceNodeCount:t.sourceNodeCount,visNodeCount:t.visNodeCount}),Rt=(t,n,s)=>{if(n==="json"){process.stdout.write(`${JSON.stringify(St(t),void 0,2)}
|
|
2
|
+
`);return}if(n==="ndjson"){for(const i of t.findings)process.stdout.write(`${JSON.stringify(i)}
|
|
3
|
+
`);return}if(s.info(`Migration equivalence: ${t.source} → vis`),s.info(` source nodes: ${String(t.sourceNodeCount)} vis nodes: ${String(t.visNodeCount)}`),t.findings.length===0){s.info(" ✓ task graph + cache-key surface preserved (no divergence).");return}for(const i of t.findings){const e=` [${i.severity}] ${i.node} (${i.axis}) — ${i.detail}`;i.severity==="error"?s.warn(e):s.info(e)}},jt=(t,n)=>t.findings.some(i=>n==="warning"?!0:i.severity==="error")?1:0,F=async t=>{if(!T.isTTY)return!0;const n=ft({input:T,output:ut});try{const i=(await n.question(`${t} [Y/n] `)).trim().toLowerCase();return i===""||i==="y"||i==="yes"}finally{n.close()}},Mt=[{description:"VisConfig.targetDefaults → VisConfig.tasks",next:"tasks",previous:"targetDefaults"},{description:"VisConfig.taskDefaults → VisConfig.scopedTasks",next:"scopedTasks",previous:"taskDefaults"},{description:"VisConfig.taskRunnerOptions → VisConfig.taskRunner",next:"taskRunner",previous:"taskRunnerOptions"},{description:"ScopedTasksBlock.scope → ScopedTasksBlock.match",next:"match",previous:"scope"},{description:"ScopedTasksBlock.targets → ScopedTasksBlock.tasks",next:"tasks",previous:"targets"}],Ct=[{description:"VisTaskConfig.targets → VisTaskConfig.tasks",next:"tasks",previous:"targets"}],Nt=t=>new RegExp(String.raw`(^|[\s,{(\[])(["']?)${t}\2(\s*:)`,"gmu"),Tt=(t,n)=>{let s=t;const i=[];for(const e of n){const o=Nt(e.previous);o.test(s)&&(o.lastIndex=0,s=s.replace(o,(r,a,c,u)=>`${a}${c}${e.next}${c}${u}`),i.push(e))}return{applied:i,output:s}},D=(t,n)=>Tt(t,n),Ot=["vis.config.ts","vis.config.mts","vis.config.cts","vis.config.js","vis.config.mjs","vis.config.cjs"],It=new Set(["vis.task.cjs","vis.task.cts","vis.task.js","vis.task.mjs","vis.task.mts","vis.task.ts"]),_t=t=>{for(const n of Ot){const s=p(t,n);if(x(s))return s}},At=t=>{const n=[];try{for(const s of dt(t,{includeDirs:!1,includeFiles:!0,includeSymlinks:!1,skip:[/node_modules/,/\.git/,/\.vis\b/,/dist\b/,/\.next\b/,/\.nuxt\b/]}))It.has(ct(s.path))&&n.push(s.path)}catch{}return n},Dt=(t,n,s,i)=>{const e=_t(t);if(e){const r=j(e),{applied:a,output:c}=D(r,Mt);if(a.length===0)s.info(`${e} already uses the current schema — no rewrite needed.`);else if(n.dryRun)s.info(`── ${e} (preview) ──`),s.info(c),s.info("── end preview ──"),s.info(`Would apply ${String(a.length)} rename(s): ${a.map(u=>u.description).join(", ")}`);else{N(e,i),O(e,c),s.info(`Rewrote ${e} (backup at ${e}.bak). Applied ${String(a.length)} rename(s).`);for(const u of a)i.manualSteps.push(`Renamed ${u.description} in ${e}`)}}else s.warn("No vis.config.ts found at workspace root — nothing to migrate."),i.warnings.push("No vis.config.{ts,mts,cts,js,mjs,cjs} at workspace root.");const o=n.taskConfigPaths??At(t);for(const r of o){if(!x(r))continue;const a=j(r),c=D(a,Ct);if(c.applied.length!==0)if(n.dryRun)s.info(`── ${r} (preview) ──`),s.info(c.output),s.info("── end preview ──"),s.info(`Would apply ${String(c.applied.length)} rename(s): ${c.applied.map(u=>u.description).join(", ")}`);else{N(r,i),O(r,c.output),s.info(`Rewrote ${r} (backup at ${r}.bak). Applied ${String(c.applied.length)} rename(s).`);for(const u of c.applied)i.manualSteps.push(`Renamed ${u.description} in ${r}`)}}},m=t=>{const n=t.workspaceRoot??process.cwd(),s=t.visConfig??{};return{config:s,dryRun:!!t.options.dryRun,logger:t.logger,packageManager:st(n),report:P(),root:n,useEditorconfig:typeof s.editorconfig=="boolean"?s.editorconfig:!0}},l=async(t,n,s)=>{if(n.yes||n.dryRun)return!0;const i=await F(`This will edit files, scripts, and hooks for "${t}". Backups (.bak) will be created. Continue?`);return i||s.info("Aborted."),i},y=t=>{t.dryRun&&t.logger.info(`Running in dry-run mode — no changes will be made.
|
|
4
|
+
`)},Bt=async({logger:t,options:n,visConfig:s,workspaceRoot:i})=>{if(!await l("deps",n,t))return;const e=m({logger:t,options:n,visConfig:s,workspaceRoot:i});y(e),t.info("── Migrating dependencies and scripts ──"),J(e.root,e.packageManager,e.config,{dryRun:e.dryRun},t,e.report),t.info(""),f(e.report,t)},Vt=async({logger:t,options:n,visConfig:s,workspaceRoot:i})=>{if(!await l("lint-staged",n,t))return;const e=m({logger:t,options:n,visConfig:s,workspaceRoot:i});y(e),t.info("── Migrating lint-staged ──"),W(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},t,e.report),t.info(""),f(e.report,t)},Pt=async({logger:t,options:n,visConfig:s,workspaceRoot:i})=>{if(!await l("nano-staged",n,t))return;const e=m({logger:t,options:n,visConfig:s,workspaceRoot:i});y(e),t.info("── Migrating nano-staged ──"),Y(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},t,e.report),t.info(""),f(e.report,t)},Ft=async({logger:t,options:n,visConfig:s,workspaceRoot:i})=>{if(!await l("turborepo",n,t))return;const e=m({logger:t,options:n,visConfig:s,workspaceRoot:i});y(e),t.info("── Migrating turborepo ──"),H(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},t,e.report),V(e.root,{dryRun:e.dryRun},t),t.info(""),f(e.report,t)},Gt=async({logger:t,options:n,visConfig:s,workspaceRoot:i})=>{if(!await l("nx",n,t))return;const e=m({logger:t,options:n,visConfig:s,workspaceRoot:i});y(e),t.info("── Migrating nx ──");const o=!!n.aggressive;Q(e.root,{aggressive:o,dryRun:e.dryRun,force:o||!!n.force,rewriteSyncGenerators:o||!!n.rewriteSyncGenerators,useEditorconfig:e.useEditorconfig},t,e.report),t.info(""),f(e.report,t)},Kt=async({logger:t,options:n,visConfig:s,workspaceRoot:i})=>{if(!await l("moon",n,t))return;const e=m({logger:t,options:n,visConfig:s,workspaceRoot:i});y(e),t.info("── Migrating moon ──"),U(e.root,{copyTemplates:!!n.copyTemplates,dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},t,e.report),V(e.root,{dryRun:e.dryRun},t),t.info(""),f(e.report,t)},Lt=async({logger:t,options:n,visConfig:s,workspaceRoot:i})=>{if(!await l("gitleaks",n,t))return;const e=m({logger:t,options:n,visConfig:s,workspaceRoot:i});y(e),t.info("── Migrating gitleaks ──"),X(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},t,e.report),t.info(""),f(e.report,t)},qt=async({logger:t,options:n,visConfig:s,workspaceRoot:i})=>{if(!await l("kingfisher",n,t))return;const e=m({logger:t,options:n,visConfig:s,workspaceRoot:i});y(e),t.info("── Migrating Kingfisher ──"),Z(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},t,e.report),t.info(""),f(e.report,t)},zt=async({logger:t,options:n,visConfig:s,workspaceRoot:i})=>{if(!await l("secretlint",n,t))return;const e=m({logger:t,options:n,visConfig:s,workspaceRoot:i});y(e),t.info("── Migrating secretlint ──"),tt(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},t,e.report),t.info(""),f(e.report,t)},Jt=async({logger:t,options:n,visConfig:s,workspaceRoot:i})=>{if(!await l("syncpack",n,t))return;const e=m({logger:t,options:n,visConfig:s,workspaceRoot:i});y(e),t.info("── Migrating syncpack ──"),nt(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},t,e.report),t.info(""),f(e.report,t)},Wt=async({logger:t,options:n,visConfig:s,workspaceRoot:i})=>{if(!await l("sherif",n,t))return;const e=m({logger:t,options:n,visConfig:s,workspaceRoot:i});y(e),t.info("── Migrating sherif ──"),et(e.root,{dryRun:e.dryRun,useEditorconfig:e.useEditorconfig},t,e.report),t.info(""),f(e.report,t)},Yt=async({logger:t,options:n,visConfig:s,workspaceRoot:i})=>{if(!await l("self",n,t))return;const e=m({logger:t,options:n,visConfig:s,workspaceRoot:i});y(e),t.info("── Migrating vis.config.ts to current schema ──"),Dt(e.root,{dryRun:e.dryRun},t,e.report),t.info(""),f(e.report,t)},Ht=({logger:t,workspaceRoot:n})=>{const s=n??process.cwd();pt(s,t).length>0&&(process.exitCode=1)},Qt=async({logger:t,options:n,workspaceRoot:s})=>{const i=s??process.cwd(),e=n.format??"table";if(!$t.has(e)){t.warn(`Invalid --format: ${String(n.format)}. Expected table | json | ndjson.`),process.exitCode=1;return}const o=n.failOn==="warning"?"warning":"error";let r;if(n.from){if(n.from!=="turbo"&&n.from!=="nx"&&n.from!=="moon"){t.warn(`Invalid --from: ${n.from}. Expected turbo | nx | moon.`),process.exitCode=1;return}r=n.from}else if(r=wt(i),!r){t.warn("Could not auto-detect the source tool (need exactly one of turbo.json / nx.json / .moon/tasks.yml). Pass --from <turbo|nx|moon>."),process.exitCode=1;return}const a=bt(i,r);if(a.size===0){t.warn(`No ${r} task graph found at ${i} — nothing to verify.`),process.exitCode=1;return}const c=await kt(i);if(c.size===0){t.warn("No migrated vis task graph found (vis.config.ts has no tasks). Run the migrator first."),process.exitCode=1;return}const u=Et(a,c,r);Rt(u,e,t),process.exitCode=jt(u,o)},Ut=async({logger:t,options:n,visConfig:s,workspaceRoot:i})=>{const e=i??process.cwd(),r=q(e,s??{}),a=z(r);if(a.length===0){t.info("No applicable migrations detected in this workspace.");return}const c=!!n.dryRun;t.info(`Detected ${String(a.length)} migration(s):`);for(const d of a)t.info(` • ${d.title} — ${d.description}`);if(t.info(""),!n.yes&&!c&&!await F("Apply all detected migrations? Backups (.bak) will be created.")){t.info("Aborted.");return}c&&t.info(`Running in dry-run mode — no changes will be made.
|
|
5
|
+
`);const u=P(),w=[];for(const d of a)try{if(t.info(`── Applying ${d.title} ──`),c)for(const $ of d.probe(r))t.info($);else d.apply(r,u,t);t.info("")}catch($){w.push({error:$,id:d.id}),t.warn(`Failed to apply ${d.title}: ${$.message}`)}f(u,t),w.length>0&&(t.warn(""),t.warn(`${String(w.length)} migration(s) failed — see messages above.`),process.exitCode=1)},cn=Bt,an=Vt,un=Pt,fn=Ft,dn=Gt,pn=Kt,mn=Lt,ln=qt,yn=zt,hn=Jt,gn=Wt,vn=Yt,xn=Ht,kn=Qt,bn=Ut;export{bn as migrateAllExecute,cn as migrateDepsExecute,mn as migrateGitleaksExecute,ln as migrateKingfisherExecute,an as migrateLintStagedExecute,pn as migrateMoonExecute,un as migrateNanoStagedExecute,dn as migrateNxExecute,yn as migrateSecretlintExecute,vn as migrateSelfExecute,gn as migrateSherifExecute,hn as migrateSyncpackExecute,fn as migrateTurborepoExecute,xn as migrateVerifyExecute,kn as migrateVerifyGraphExecute};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{createRequire as K}from"node:module";import{j as
|
|
2
|
-
`)},$="v2.14.0",
|
|
1
|
+
import{createRequire as K}from"node:module";import{j as g,F as m,q as v,J as N,X as P,b as j}from"../packem_shared/index.server-BAjDJSEu.js";import{e as h,v as U}from"../packem_shared/index-DHD8wb6Z.js";import{d as F,b as Y}from"./catalog.js";import{d as J}from"../packem_shared/lockfile-35RFsJDs.js";import{p as z,s as X}from"../packem_shared/docker-Bex05Qcn.js";import{i as ne}from"../packem_shared/index-BjdW45xX.js";import{g as B}from"../packem_shared/formatBytes-BHAzNIrn-DFIppnY0.js";import{h as oe}from"../packem_shared/writeFileSync-DJoHk3Ks-CgQ-VNNT.js";import{y as re}from"../packem_shared/isAccessibleSync-DYKTrrvc-CSnBISfV.js";let G;const W=e=>(G??=K(import.meta.url))(e),b=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,y=e=>{if(typeof b<"u"&&b.versions&&b.versions.node){const[t,n]=b.versions.node.split(".").map(Number);if(t>22||t===22&&n>=3||t===20&&n>=16)return b.getBuiltinModule(e)}return W(e)},{createInterface:O}=y("node:readline"),{spawn:Q}=y("node:child_process"),{createHash:Z}=y("node:crypto"),{existsSync:I,writeFileSync:ee,chmodSync:te}=y("node:fs"),S={aube:{base:["RUN corepack enable"],build:e=>e?`RUN aube run --filter ${e} build`:"RUN aube run build",install:"RUN aube install --frozen-lockfile"},bun:{base:["RUN npm install -g bun"],build:e=>e?`RUN bun run --filter ${e} build`:"RUN bun run build",install:"RUN --mount=type=cache,target=/root/.bun/install/cache bun install --frozen-lockfile"},npm:{base:[],build:e=>e?`RUN npm run build --workspace ${e}`:"RUN npm run build",install:"RUN --mount=type=cache,target=/root/.npm npm ci"},pnpm:{base:["ENV PNPM_HOME=/pnpm","ENV PATH=$PNPM_HOME:$PATH","RUN corepack enable"],build:e=>e?`RUN pnpm --filter ${e} build`:"RUN pnpm build",install:"RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile"},yarn:{base:["RUN corepack enable"],build:e=>e?`RUN yarn workspace ${e} build`:"RUN yarn build",install:"RUN --mount=type=cache,target=/usr/local/share/.cache/yarn yarn install --immutable"}},se=e=>{const{focus:t,manager:n,nodeVersion:r}=e,o=S[n]??S.npm;return["# syntax=docker/dockerfile:1","","# Generated by 'vis docker init'. Before building, scaffold the context:",`# vis docker scaffold${t?` --focus=${t}`:""} --include-sources`,"# then build with BuildKit enabled (DOCKER_BUILDKIT=1).","",`FROM node:${r}-slim AS base`,"WORKDIR /app",...o.base,"","# --- install dependencies from the scaffolded manifests only ---","FROM base AS deps","COPY .vis/docker/workspace/ ./",o.install,"","# --- build the focus project, then drop unfocused workspace projects ---","FROM deps AS build","COPY .vis/docker/sources/ ./",o.build(t),"RUN npx vis docker prune --context=.vis/docker","","# --- minimal runtime image ---",`FROM node:${r}-slim AS runtime`,"WORKDIR /app","ENV NODE_ENV=production","COPY --from=build /app ./","USER node","# TODO: point this at your app's entrypoint",'CMD ["node", "index.js"]',""].join(`
|
|
2
|
+
`)},$="v2.14.0",D=`https://github.com/hadolint/hadolint/releases/download/${$}`,ie={"hadolint-linux-arm64":"331f1d3511b84a4f1e3d18d52fec284723e4019552f4f47b19322a53ce9a40ed","hadolint-linux-x86_64":"6bf226944684f56c84dd014e8b979d27425c0148f61b3bd99bcc6f39e9dc5a47","hadolint-macos-arm64":"3625e2e9f43dcfe7bd38738a5f5520ed50ce39ed28485266e6803dd7bc197b10","hadolint-macos-x86_64":"2b69a853433f1eca522ffb921cd490bd1321424d03331fd8390f93b7fb4a02e9","hadolint-windows-x86_64.exe":"8e0ee174f88edb14f207a68430c7a53c2883ed509cdbde9a3a26fffa140fa5e4"},ae=e=>ie[e],ce=(e=process.platform,t=process.arch)=>{const n=e==="darwin"?"macos":e==="linux"?"linux":e==="win32"?"windows":void 0;if(n===void 0)return;const r=t==="arm64"?"arm64":t==="x64"?"x86_64":void 0;if(n==="windows")return"hadolint-windows-x86_64.exe";if(r!==void 0)return`hadolint-${n}-${r}`},L=e=>h(B(),"hadolint",$,e.endsWith(".exe")?"hadolint.exe":"hadolint"),le=()=>{const e=process.platform==="win32"?"hadolint.exe":"hadolint",t=(process.env.PATH??"").split(process.platform==="win32"?";":":");for(const n of t)if(n!==""&&I(h(n,e)))return e},de=e=>e.trim().split(/\s+/u)[0]??"",E=async e=>{const t=await fetch(e,{redirect:"follow"});if(!t.ok)throw new Error(`download failed (${String(t.status)} ${t.statusText}) for ${e}`);return Buffer.from(await t.arrayBuffer())},ue=async e=>{const t=L(e),n=ae(e),r=await E(`${D}/${e}`),o=Z("sha256").update(r).digest("hex");if(n===void 0){const s=await E(`${D}/${e}.sha256`),i=de(s.toString("utf8")).toLowerCase();if(i==="")throw new Error("hadolint checksum sidecar was empty or unparseable. Refusing to use the download.");if(i!==o)throw new Error(`hadolint checksum mismatch (expected ${i}, got ${o}). Refusing to use the download.`)}else if(n.toLowerCase()!==o)throw new Error(`hadolint checksum mismatch (expected ${n.toLowerCase()}, got ${o}). Refusing to use the download.`);return oe(h(B(),"hadolint",$)),ee(t,r),process.platform!=="win32"&&te(t,493),t},fe=async()=>{const e=O({input:process.stdin,output:process.stderr}),t=await new Promise(n=>{e.question(` Download hadolint ${v($)} now? ${m("[y/N]")} `,r=>{n(r.trim().toLowerCase())})});return e.close(),t==="y"||t==="yes"},pe=async e=>{const{autoInstall:t=!1,log:n}=e,r=le();if(r!==void 0)return r;const o=ce();if(o===void 0){n(`hadolint has no prebuilt binary for ${process.platform}/${process.arch}. Install it manually: https://github.com/hadolint/hadolint`);return}const s=L(o);if(I(s))return s;if(!t){if(!(!!process.stdin.isTTY&&!ne)){n(`hadolint is not installed. Re-run with ${g("--install")} (or install hadolint on PATH) to enable Dockerfile linting.`);return}if(n(`${g("hadolint")} is required to lint Dockerfiles but was not found on your PATH.`),!await fe()){n(`Skipped. Install it yourself or re-run with ${g("--install")}.`);return}}n(`Downloading hadolint ${$} (${o})…`);try{const i=await ue(o);return n(`Installed hadolint to ${m(i)}`),i}catch(i){n(`Failed to download hadolint: ${i.message}`);return}},_=async(e,t,n)=>{if(t.length===0)return[];const r=["--format","json","--no-fail",...n!==void 0&&n!==""?["--config",n]:[],...t],o=await new Promise((i,l)=>{const a=Q(e,r,{stdio:["ignore","pipe","pipe"],windowsHide:!0});let d="",u="";a.stdout?.on("data",c=>{d+=c.toString("utf8")}),a.stderr?.on("data",c=>{u+=c.toString("utf8")}),a.on("error",l),a.on("close",()=>{if(d.trim()===""&&u.trim()!==""){l(new Error(u.trim()));return}i(d)})});if(o.trim()==="")return[];let s;try{s=JSON.parse(o)}catch{throw new Error("Could not parse hadolint JSON output.")}return Array.isArray(s)?s:[]},C=(e,t,n)=>{if(!(!/\bapt-get\b/u.test(e)||!/\binstall\b/u.test(e)||n.test(e)))return e.replace(/\binstall\b/u,`install ${t}`)},k={DL3014:e=>C(e,"-y",/(?:^|\s)(?:-y|--yes|--assume-yes|-qq?)\b/u),DL3015:e=>C(e,"--no-install-recommends",/--no-install-recommends\b/u),DL3020:e=>/^\s*ADD\b/u.test(e)?e.replace(/^(\s*)ADD\b/u,"$1COPY"):void 0,DL3027:e=>/(?:^|\s)apt\s/u.test(e)&&!/\bapt-get\b/u.test(e)?e.replace(/(^|\s)apt(\s)/u,"$1apt-get$2"):void 0},T=new Set(Object.keys(k)),me=(e,t)=>{const n=e.includes(`\r
|
|
3
3
|
`)?`\r
|
|
4
4
|
`:`
|
|
5
|
-
`,r=e.split(/\r?\n/u),
|
|
6
|
-
${
|
|
7
|
-
`),c.some(p=>p.level==="error")?1:0;if(s&&f>0&&a.info(N(`✔ Auto-fixed ${String(f)} issue${f===1?"":"s"}.`)),c.length===0)return a.info(N("✔ No Dockerfile issues found.")),0;
|
|
8
|
-
${
|
|
9
|
-
`))},
|
|
5
|
+
`,r=e.split(/\r?\n/u),o=new Set;let s=0;const i=new Map;for(const l of t){if(!k[l.code])continue;const a=i.get(l.line)??[];a.push(l),i.set(l.line,a)}for(const[l,a]of i){const d=l-1;if(!(d<0||d>=r.length))for(const u of a){const c=k[u.code],f=c?.(r[d]??"");f!==void 0&&f!==r[d]&&(r[d]=f,o.add(u.code),s+=1)}}return{content:s>0?r.join(n):e,fixedCodes:[...o],fixedCount:s}},A={error:0,info:2,style:3,warning:1},he=(e,t)=>{switch(e){case"error":return P(t);case"info":return v(t);case"warning":return j(t);default:return m(t)}},we=(e,t)=>(e.length>0?e:["Dockerfile"]).map(r=>U(r)?r:h(t,r)).filter(r=>re(r)),be=(e,t)=>{const n=[...e].sort((o,s)=>o.file.localeCompare(s.file)||o.line-s.line||o.column-s.column||A[o.level]-A[s.level]);let r="";for(const o of n){o.file!==r&&(r=o.file,t.info(`
|
|
6
|
+
${g(r)}`));const s=m(`${String(o.line)}:${String(o.column)}`),i=he(o.level,o.level.padEnd(7)),l=T.has(o.code)?m(" (fixable)"):"";t.info(` ${s} ${i} ${v(o.code)} ${o.message}${l}`)}},ge=e=>{const t={error:0,info:0,style:0,warning:0};for(const n of e)t[n.level]+=1;return t},$e=async e=>{const{autoInstall:t,configPath:n,cwd:r,files:o,fix:s,fs:i,json:l,logger:a}=e,d=we(o,r);if(d.length===0)return a.error(`No Dockerfile found${o.length>0?` at: ${o.join(", ")}`:` in ${r}`}. Pass a path: vis docker lint <path>`),1;const u=await pe({autoInstall:t,log:p=>{a.info(p)}});if(u===void 0)return 0;let c=await _(u,d,n),f=0;if(s&&c.length>0){for(const p of d){const H=c.filter(V=>V.file===p),q=await i.readFile(p,"utf8"),x=me(q,H);x.fixedCount>0&&(await i.writeFile(p,x.content),f+=x.fixedCount)}f>0&&(c=await _(u,d,n))}if(l)return process.stdout.write(`${JSON.stringify({findings:c,fixed:f},null,2)}
|
|
7
|
+
`),c.some(p=>p.level==="error")?1:0;if(s&&f>0&&a.info(N(`✔ Auto-fixed ${String(f)} issue${f===1?"":"s"}.`)),c.length===0)return a.info(N("✔ No Dockerfile issues found.")),0;be(c,a);const w=ge(c),R=c.filter(p=>T.has(p.code)).length;return a.info(`
|
|
8
|
+
${g(String(c.length))} issue${c.length===1?"":"s"}: ${P(`${String(w.error)} error`)}, ${j(`${String(w.warning)} warning`)}, ${v(`${String(w.info)} info`)}, ${m(`${String(w.style)} style`)}`),!s&&R>0&&a.info(m(`Run 'vis docker lint --fix' to auto-fix ${String(R)} of them.`)),w.error>0?1:0},M=e=>{if(!e)throw new Error("Could not determine workspace root. Run inside a monorepo.");return e},Oe=async({logger:e,options:t,visConfig:n,workspaceRoot:r})=>{const o=M(r),{packageJsons:s,workspace:i}=F(o,n),l=Y(o,i,s),a=(t.focus??"").split(",").map(c=>c.trim()).filter(Boolean);if(a.length===0)throw new Error("Missing --focus. Pass one or more project names, comma-separated.");const d=h(o,t.out??".vis/docker"),{projects:u}=X({focus:a,includeSources:!!t.includeSources,log:c=>{e.info(c)},outDir:d,projectGraph:l,pruneLockfile:t.pruneLockfile!==!1,workspace:i,workspaceRoot:o});e.info(`Scaffolded ${u.length} project(s) into ${d}`),e.info(`Focus closure: ${u.toSorted().join(", ")}`)},Pe=async({logger:e,options:t,visConfig:n,workspaceRoot:r})=>{const o=M(r),{workspace:s}=F(o,n),i=h(o,t.context??".vis/docker"),{removed:l}=z({contextRoot:i,workspace:s,workspaceRoot:o});e.info(`Pruned ${l.length} unfocused project(s)`),l.length>0&&e.debug?.(l.join(`
|
|
9
|
+
`))},je=async({argument:e,fs:t,logger:n,options:r,process:o,workspaceRoot:s})=>{const i=await $e({autoInstall:!!r.install,configPath:r.config,cwd:s??o.cwd,files:e.filter(Boolean),fix:!!r.fix,fs:t,json:!!r.json,logger:n});i!==0&&(process.exitCode=i)},ye=async(e,t)=>{try{return await e.access(t),!0}catch{return!1}},ve=async e=>{const t=O({input:process.stdin,output:process.stderr}),n=await new Promise(r=>{t.question(` ${e} already exists. Overwrite? ${m("[y/N]")} `,o=>{r(o.trim().toLowerCase())})});return t.close(),n==="y"||n==="yes"},Ue=async({argument:e,fs:t,logger:n,options:r,process:o,workspaceRoot:s})=>{const i=s??o.cwd,l=e[0]??"Dockerfile",a=U(l)?l:h(i,l),d=J(i)?.manager??"npm",u=(r.focus??"").split(",").map(f=>f.trim()).find(Boolean),c=se({focus:u,manager:d,nodeVersion:r.node??"22"});if(r.dryRun){process.stdout.write(c.endsWith(`
|
|
10
10
|
`)?c:`${c}
|
|
11
|
-
`);return}if(await ye(
|
|
11
|
+
`);return}if(await ye(t,a)&&!r.force){if(!!!process.stdin.isTTY){n.error(`${a} already exists. Re-run with --force to overwrite.`),process.exitCode=1;return}if(!await ve(a)){n.info("Aborted — existing Dockerfile left untouched.");return}}await t.writeFile(a,c),n.info(`Created ${a} (package manager: ${d}).`),n.info(m(`Next: vis docker scaffold${u?` --focus=${u}`:""} --include-sources, then DOCKER_BUILDKIT=1 docker build .`))};export{Ue as initExecute,je as lintExecute,Pe as pruneExecute,Oe as scaffoldExecute};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{
|
|
2
|
-
Settings that would sync to pnpm-workspace.yaml:`);for(const E of
|
|
3
|
-
`);const
|
|
4
|
-
`);for(const
|
|
1
|
+
import{a as J,b as q,p,O as G,c as T,C as O}from"./cli-main.js";import{l as H,r as K,t as m,c as Q,k as W,R as c,E as X,m as y,n as P,o as Z,s as _}from"./catalog.js";import{i as ee}from"../packem_shared/index-BjdW45xX.js";import{v as te,r as se,f as ae}from"../packem_shared/ai-analysis-DSQQDFU9.js";import{d as re}from"../packem_shared/pm-runner-de-jCq8q.js";import{s as ne}from"../packem_shared/formatBytes-BHAzNIrn-DFIppnY0.js";import{U as oe,V as ce,C as j}from"../packem_shared/vis-update-app-ngwL2mRv.js";const he=async({argument:R,logger:s,options:e,visConfig:o,workspaceRoot:$})=>{if(!$)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const d=$;if(e.securityConfig){const t=re(d);if(J(o??{},t.name),e.sync&&t.name==="pnpm"){const a=q(o??{});if(a.length>0){p.info(`
|
|
2
|
+
Settings that would sync to pnpm-workspace.yaml:`);for(const E of a)p.success(` ${E}`)}else p.info("No security settings to sync.")}else e.sync&&t.name!=="pnpm"&&(p.info(`--sync is only available for pnpm projects. Your project uses ${t.name}.`),p.info("vis enforces security settings at the vis layer for non-pnpm projects."));if(!e.security&&!R?.length)return}const{packageManager:N}=G(d),D=H(d),i=o?.update??{},h=K(d,N,{dev:e.dev,includeInternal:e["include-internal"],peer:e.peer,prod:e.prod});if(h.size===0){s.info("No catalogs found.");return}const k=e.target??i.target??"latest";if(!["latest","minor","patch"].includes(k))throw new Error(`Invalid target "${k}". Use: latest, minor, or patch.`);const I={exclude:[...m(e.exclude),...m(i.exclude)],ignore:m(i.ignore),include:[...m(e.include),...m(i.include),...R],includeLocked:!!e.includeLocked,includePrerelease:e.prerelease||i.prerelease||!1,security:e.security!==!1,target:k};let x=0;for(const t of h.values())x+=t.size;const w=!!process.stdout.isTTY&&!ee;let l;const U=w?(t,a)=>{l?l.rerender(c.createElement(j,{current:t,total:a})):l=O(c.createElement(j,{current:t,total:a}),{interactive:!0,patchConsole:!1})}:(t,a)=>{s.info(`Checking ${String(t)}/${String(a)} dependencies...`)};w||s.info(`Checking ${String(x)} catalog dependencies against npm registry...
|
|
3
|
+
`);const v=new Set;T("socket")&&v.add("socket"),T("depsDev")&&v.add("deps-dev");const g=o?.security?.policies?.score?.minimum,M=Q(o?.security,{disabled:v,minimumScore:g}),{failed:S,outdated:n}=await W(h,I,D,U,d,M,o?.security?.acceptedRisks);if(l&&(l.clear(),l.unmount()),S.length>0&&s.warn(`Failed to fetch: ${S.join(", ")}`),n.length===0){s.info("All catalog dependencies are up to date.");return}const C=e.format??i.format??"table",B=te(e.aiType??"impact"),u=e.ai?await se(n,s,o?.ai,B):void 0;if(w&&C==="table"){const t=new oe(n,u??null),a=o?.tui?.autoExit??!1,E=a===!0?3:typeof a=="number"?a:0;await O(c.createElement(ce,{autoExitSeconds:E,isDryRun:!0,store:t}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit();const Y=process.stdout.columns||80;process.stdout.write(`
|
|
4
|
+
`);for(const r of n){const z=r.vulnerabilities?.length||r.socketReport&&r.socketReport.alerts.length>0,b=!!r.acceptedRisk,F=z?b?"✓":"⚠":"✓",L=b?"gray":r.updateType==="major"?"red":r.updateType==="minor"?"yellow":"green",f=r.socketReport?.score.overall,V=f===void 0?"":` [${String(Math.round(f*100))}%]`,A=f===void 0?void 0:ne(f);process.stdout.write(`${X(c.createElement(y,null," ",c.createElement(y,{color:L},F),` ${r.packageName} ${r.currentRange} → ${r.newRange}`,c.createElement(y,{dimColor:!0},` ${r.updateType}`),A?c.createElement(y,{color:A},V):null),{columns:Y})}
|
|
5
5
|
`)}process.stdout.write(`
|
|
6
|
-
`),
|
|
7
|
-
`)}else
|
|
8
|
-
`):(
|
|
6
|
+
`),s.info(P(n,g))}else if(C==="json"){const t={failed:S,outdated:n};u&&(t.aiAnalysis=u),process.stdout.write(`${JSON.stringify(t,void 0,2)}
|
|
7
|
+
`)}else C==="minimal"?process.stdout.write(`${Z(n)}
|
|
8
|
+
`):(_(n,s),s.info(P(n,g)),u&&(s.info(""),s.info(ae(u))));e.exitCode&&n.length>0&&(process.exitCode=1)};export{he as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{createRequire as
|
|
2
|
-
`);break}case"junit":{m.write(
|
|
3
|
-
`)};export{
|
|
1
|
+
import{createRequire as H}from"node:module";import{J as A,q as U,j as W,F as E}from"../packem_shared/index.server-BAjDJSEu.js";import{a as P}from"../packem_shared/index-DHD8wb6Z.js";import{Z as I}from"./cli-main.js";import{d as F,f as C,r as Z,a as Q,b as X,s as Y,c as ee,e as te,g as se,h as ie,i as ne,j as re,k as ae,l as oe,m as ce,n as de,o as fe,p as le,q as ue,t as pe}from"../packem_shared/watch-loop-COWvvSbR.js";import{T as h}from"./catalog.js";let J;const D=t=>(J??=H(import.meta.url))(t),k=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,G=t=>{if(typeof k<"u"&&k.versions&&k.versions.node){const[e,s]=k.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return k.getBuiltinModule(t)}return D(t)},{createHash:_}=G("node:crypto"),ge=t=>t.startsWith("/")||/^[a-z]:[\\/]/i.test(t),q=(t,e)=>ge(e)?e:`${t}/${e}`,me={argsCheck:(t,e)=>O(t,e,"check"),argsFix:(t,e)=>O(t,e,"fix"),bin:()=>["pnpm","exec","dprint"],cacheKey:(t,e)=>{const s=["dprint",t.declaredVersion??"unknown",t.configFile??"no-config",e.quiet?"q":"",...e.extraArgs??[]];return _("sha256").update(s.join("|")).digest("hex").slice(0,16)},detect:(t,e)=>{const s=F(e,h.dprint.packageNames[0]),i=C(t,h.dprint.configFiles);if(!(!s&&!i))return{adapter:"dprint",configFile:i,declared:!!s,declaredVersion:s,root:t}},extensions:["cjs","css","cts","dockerfile","html","js","json","jsonc","jsx","md","mdx","mjs","mts","toml","ts","tsx","yaml","yml"],id:"dprint",kind:"fmt",parse:(t,e)=>{if(t.exitCode===0)return[];const s=[];for(const i of t.stdout.split(/\r?\n/)){const n=i.trim();!n||n.startsWith("[")||n.startsWith("Checked ")||n.startsWith("Error:")||s.push({adapter:"dprint",file:q(e.root,n),fixable:!0,message:"Code style issues would be auto-fixed",severity:"info"})}return s}},O=(t,e,s)=>{const i=s==="fix"?["fmt"]:["check","--list-different"];return e.extraArgs?.length&&i.push(...e.extraArgs),i.push(...t),i},he={argsCheck:(t,e)=>V(t,e,"check"),argsFix:(t,e)=>V(t,e,"fix"),bin:()=>["pnpm","exec","oxfmt"],cacheKey:(t,e)=>{const s=["oxfmt",t.declaredVersion??"unknown",t.configFile??"no-config",e.quiet?"q":"",...e.extraArgs??[]];return _("sha256").update(s.join("|")).digest("hex").slice(0,16)},detect:(t,e)=>{const s=F(e,h.oxfmt.packageNames[0]),i=C(t,h.oxfmt.configFiles);if(!(!s&&!i))return{adapter:"oxfmt",configFile:i,declared:!!s,declaredVersion:s,root:t}},extensions:["cjs","cts","js","json","jsonc","jsx","mjs","mts","ts","tsx"],id:"oxfmt",kind:"fmt",parse:(t,e)=>{if(t.exitCode===0)return[];const s=[];for(const i of t.stdout.split(/\r?\n/)){const n=i.trim();!n||n.startsWith("[")||s.push({adapter:"oxfmt",file:q(e.root,n),fixable:!0,message:"Code style issues would be auto-fixed",severity:"info"})}return s}},V=(t,e,s)=>{const i=s==="fix"?["--write"]:["--list-different"];return e.extraArgs?.length&&i.push(...e.extraArgs),i.push(...t),i},xe={argsCheck:(t,e)=>N(t,e,"check"),argsFix:(t,e)=>N(t,e,"fix"),bin:()=>["pnpm","exec","prettier"],cacheKey:(t,e)=>{const s=["prettier",t.declaredVersion??"unknown",t.configFile??"no-config",e.quiet?"q":"",...e.extraArgs??[]];return _("sha256").update(s.join("|")).digest("hex").slice(0,16)},detect:(t,e)=>{const s=F(e,h.prettier.packageNames[0]),i=C(t,h.prettier.configFiles);if(!(!s&&!i))return{adapter:"prettier",configFile:i,declared:!!s,declaredVersion:s,root:t}},extensions:["cjs","css","cts","html","js","json","jsx","less","md","mdx","mjs","mts","scss","ts","tsx","vue","yaml","yml"],id:"prettier",kind:"fmt",parse:(t,e)=>{if(t.exitCode===0)return[];const s=[];for(const i of t.stdout.split(/\r?\n/)){const n=i.trim();n&&(n.startsWith("[")||s.push({adapter:"prettier",file:q(e.root,n),fixable:!0,message:"Code style issues would be auto-fixed",severity:"info"}))}return s}},N=(t,e,s)=>{const i=s==="fix"?["--write"]:["--list-different"];return e.quiet&&i.push("--log-level","warn"),e.extraArgs?.length&&i.push(...e.extraArgs),i.push(...t),i},ke=[he,se,me,xe,ie,ne],Re=async({logger:t,options:e,visConfig:s,workspaceRoot:i})=>{const n=i??process.cwd(),p=s?.fmt,w=Z(ke,p?.order),L=Q(n,w),x=X(L,w,"fmt").filter(({adapter:l})=>p?.adapters?.[l.id]?.enabled!==!1);if(x.length===0){t.warn("vis fmt: no formatter detected in this workspace (looked for: oxfmt, biome, dprint, prettier, ruff, deno-fmt).");return}const R=l=>{const a=p?.adapters?.[l]?.extraArgs;return a&&a.length>0?[...a]:void 0},v={quiet:e.quiet??!1},$=we(e),b=e.check?"check":"fix";let c;if(e.staged){if(c=Y(n),c===void 0)t.warn("vis fmt: could not resolve --staged (not a git repo or git unavailable). Falling back to a workspace-wide run.");else if(c.length===0){t.info(A("✓ fmt: no staged files"));return}}else if(typeof e.since=="string"&&e.since.length>0){if(c=ee(n,e.since),c===void 0)t.warn(`vis fmt: could not resolve --since ${e.since} (not a git repo or unknown ref). Falling back to a workspace-wide run.`);else if(c.length===0){t.info(A(`✓ fmt: no files changed since ${e.since}`));return}}const K=I(n,void 0,void 0,!0),y=e.format??"human";y==="human"&&e.output!==void 0&&t.warn("vis fmt: --output is ignored for the human format; pass --format json|minimal|sarif|junit|github to redirect findings to a file.");const M=async l=>{const a=$.length>0?$:l,g=[];if(a){const r=re(a,x,p?.extensionOverrides);for(const{adapter:o,presence:d}of x){const f=r.get(o.id);if(!f||f.length===0)continue;const B=R(o.id),T={adapter:o,files:f,presence:d};B&&(T.options={...v,extraArgs:B}),g.push(T)}}else for(const{adapter:r,presence:o}of x){const d=R(r.id),f={adapter:r,files:["."],presence:o};d&&(f.options={...v,extraArgs:d}),g.push(f)}if(g.length===0)return;const z=await ae(g,v,b,{cacheRoot:K}),j=g.map((r,o)=>{const d=z[o],f=r.adapter.parse(d,r.presence);return{adapter:r.adapter,durationMs:d.durationMs,exitCode:d.exitCode,findings:f}}),u=oe(j.map(r=>({adapter:r.adapter.id,durationMs:r.durationMs,exitCode:r.exitCode,findingCount:r.findings.length,findings:r.findings}))),m=y==="human"?void 0:ce({cwd:n,target:e.output});try{switch(y){case"github":{m.write(le({runs:j.map(r=>({findings:r.findings})),workspaceRoot:n}));break}case"json":{m.write(`${JSON.stringify({findings:u.findings,mode:b,runs:u.runs},null,2)}
|
|
2
|
+
`);break}case"junit":{m.write(fe({runs:j.map(r=>({adapter:r.adapter.id,durationMs:r.durationMs,findings:r.findings})),workspaceRoot:n}));break}case"minimal":{je(u.findings,n,m);break}case"sarif":{m.write(de({runs:j.map(r=>({adapter:r.adapter.id,findings:r.findings,presence:g.find(o=>o.adapter.id===r.adapter.id)?.presence})),workspaceRoot:n}));break}default:be(u.findings,n,b,t)}}finally{m?.close()}const S=b==="fix"?u.hadProcessFailure?1:0:ue({...u,maxSeverity:u.findings.length>0?"error":void 0});S!==0&&(process.exitCode=S)};if(e.watch){const l=[...new Set(x.flatMap(({adapter:a})=>a.extensions))];await te({extensions:l,initialFiles:c,label:"fmt",log:a=>{t.info(a)},runCycle:M,workspaceRoot:n});return}await M(c)},we=t=>{const e=t;return[...e._??e.args??[]]},be=(t,e,s,i)=>{if(t.length===0){i.info(A(s==="fix"?"✓ fmt: nothing to change":"✓ fmt: all files already formatted"));return}const n=pe(t),p=s==="fix"?U(W("Formatted:")):W("Would change:");i.info(p);for(const w of n.keys())i.info(` ${E("·")} ${P(e,w)}`);s==="check"&&(i.info(""),i.info(E(`Run \`vis fmt\` to apply changes (${String(n.size)} file${n.size===1?"":"s"}).`)))},je=(t,e,s)=>{for(const i of t)s.write(`${i.adapter} ${P(e,i.file)}
|
|
3
|
+
`)};export{Re as default};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import{createRequire as
|
|
2
|
-
`);for(const[
|
|
3
|
-
`)}for(;;){const
|
|
4
|
-
${
|
|
5
|
-
`)}},
|
|
6
|
-
`);for(const[
|
|
7
|
-
`)}for(;;){const
|
|
8
|
-
${
|
|
9
|
-
`)}},
|
|
10
|
-
`)}}else{
|
|
11
|
-
`),
|
|
12
|
-
`)}},
|
|
13
|
-
`)}},
|
|
1
|
+
import{createRequire as re}from"node:module";import{F as d,j as y,q as v}from"../packem_shared/index.server-BAjDJSEu.js";import{e as S,m as K,a as G,v as F,b as oe,U as ie}from"../packem_shared/index-DHD8wb6Z.js";import{y as _}from"../packem_shared/isAccessibleSync-DYKTrrvc-CSnBISfV.js";import{L as H}from"./catalog.js";import{d as de}from"../packem_shared/giget-D8Kwb0kD.js";import{p as f}from"./cli-main.js";import{h as J,U as me}from"../packem_shared/writeFileSync-DJoHk3Ks-CgQ-VNNT.js";let se;const ne=t=>(se??=re(import.meta.url))(t),O=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,B=t=>{if(typeof O<"u"&&O.versions&&O.versions.node){const[e,r]=O.versions.node.split(".").map(Number);if(e>22||e===22&&r>=3||e===20&&r>=16)return O.getBuiltinModule(t)}return ne(t)},{fileURLToPath:ae}=B("node:url"),{createInterface:ce}=B("node:readline"),{mkdtempSync:le,rmSync:fe}=B("node:fs"),{tmpdir:ue}=B("node:os"),{spawnSync:pe}=B("node:child_process"),z=[".ts",".mts",".cts",".js",".mjs",".cjs"],he="template.yml",ge=[".d",".test",".spec",".config",".bench",".stories"],we=[".d.ts",".d.mts",".d.cts",".js.map",".mjs.map",".cjs.map",".ts.map"],X=t=>{for(const e of z)if(t.endsWith(e))return t.slice(0,-e.length);return t},$e=t=>{if(we.some(r=>t.endsWith(r))||!z.some(r=>t.endsWith(r)))return!1;const e=X(t);return!ge.some(r=>e.endsWith(r))},U=(t,e)=>{const r=[];if(!_(t))return r;for(const n of H(t,{includeDirs:!1,includeSymlinks:!1,maxDepth:1})){if(!$e(n.name))continue;const s=X(n.name);r.push({load:()=>ve(n.path),name:s,path:n.path,source:e})}return r},I=(t,e)=>{const r=[];if(!_(t))return r;for(const n of H(t,{includeFiles:!1,includeSymlinks:!1,maxDepth:1})){if(n.path===t)continue;const s=S(n.path,he);_(s)&&r.push({load:()=>be(n.path,n.name),name:n.name,path:n.path,source:e})}return r},ye=()=>{try{const t=ae(import.meta.url),e=S(K(t),"..","..","templates");return _(e)?e:void 0}catch{return}},R=t=>{const{extraDirectories:e=[],onWarning:r,workspaceRoot:n}=t,s=[...U(S(n,".vis","templates"),"native"),...I(S(n,".vis","templates"),"moon"),...I(S(n,".moon","templates"),"moon")];for(const c of e)s.push(...I(c,"config")),s.push(...U(c,"config"));const i=ye();i&&s.push(...I(i,"builtin"));const a=new Map;for(const c of s){const o=a.get(c.name);if(!o){a.set(c.name,c);continue}r&&r(`Template "${c.name}" exists in multiple sources — using ${o.source} (${o.path}), ignoring ${c.source} (${c.path}).`)}return[...a.values()].sort((c,o)=>c.name.localeCompare(o.name))},ve=async t=>{const{loadNativeTemplate:e}=await import("./loader2.js");return e(t)},be=async(t,e)=>{const{loadMoonTemplate:r}=await import("./index5.js");return r(t,e)},q=(t,e)=>new Promise(r=>{t.question(e,n=>{r(n.trim())})}),Te=async(t,e,r)=>{const s=await q(t,` ${e} ${d(r?"[Y/n]":"[y/N]")} `);return s===""?r:s.toLowerCase()==="y"||s.toLowerCase()==="yes"},Se=async(t,e,r,n)=>{process.stderr.write(` ${e}
|
|
2
|
+
`);for(const[s,i]of r.entries()){const a=y(v(` ${String(s+1)}.`)),c=i===n?d(" (default)"):"";process.stderr.write(`${a} ${i}${c}
|
|
3
|
+
`)}for(;;){const s=await q(t,`
|
|
4
|
+
${d(`Enter choice (1-${String(r.length)}):`)} `);if(s===""&&n!==void 0)return n;const i=Number.parseInt(s,10);if(Number.isInteger(i)&&i>=1&&i<=r.length)return r[i-1];const a=r.find(c=>c===s);if(a)return a;process.stderr.write(` ${d("Invalid choice. Try again.")}
|
|
5
|
+
`)}},Ee=async(t,e,r,n)=>{process.stderr.write(` ${e} ${d("(comma-separated numbers)")}
|
|
6
|
+
`);for(const[s,i]of r.entries()){const a=y(v(` ${String(s+1)}.`)),c=n.includes(i)?d(" (default)"):"";process.stderr.write(`${a} ${i}${c}
|
|
7
|
+
`)}for(;;){const s=await q(t,`
|
|
8
|
+
${d("Enter choices:")} `);if(s===""&&n.length>0)return n;const i=s.split(",").map(a=>Number.parseInt(a.trim(),10)).filter(a=>Number.isInteger(a)&&a>=1&&a<=r.length);if(i.length>0)return i.map(a=>r[a-1]);process.stderr.write(` ${d("Invalid choice. Try again.")}
|
|
9
|
+
`)}},xe=t=>` ${d(`${t}:`)} `,Ne=(t,e)=>e.prompt??t,Oe=t=>Object.entries(t).sort(([e,r],[n,s])=>{const i=r.order??0,a=s.order??0;return i!==a?i-a:e.localeCompare(n)}),V=(t,e)=>{switch(t.type){case"array":return e.split(",").map(r=>r.trim()).filter(Boolean);case"boolean":return e==="true"||e==="1"||e==="yes"||e==="y";case"enum":return t.multiple?e.split(",").map(r=>r.trim()).filter(Boolean):e;case"number":{const r=Number(e);if(Number.isNaN(r))throw new TypeError(`Expected a number, got "${e}"`);return r}default:return e}},W=(t,e,r)=>{if(e.type==="enum"){const n=Array.isArray(r)?r:[r];for(const s of n)if(typeof s!="string"||!e.values.includes(s))throw new Error(`Variable "${t}" must be one of: ${e.values.join(", ")} (got "${String(s)}")`)}},_e=async t=>{const{defaults:e,interactive:r,overrides:n,variables:s}=t,i={},a=r?ce({input:process.stdin,output:process.stderr}):null;try{for(const[c,o]of Oe(s)){if(Object.hasOwn(n,c)){const m=V(o,n[c]??"");W(c,o,m),i[c]=m;continue}if(e||!r||o.internal){if(o.default!==void 0){W(c,o,o.default),i[c]=o.default;continue}if(o.required)throw new Error(`Required variable "${c}" not provided. Pass --${c}=<value> or remove --defaults.`);continue}const l=Ne(c,o);let u;if(o.type==="boolean")u=await Te(a,l,!!(o.default??!1));else if(o.type==="enum")if(o.multiple){const m=Array.isArray(o.default)?o.default:[];u=await Ee(a,l,o.values,m)}else{const m=typeof o.default=="string"?o.default:void 0;u=await Se(a,l,o.values,m)}else{const m=o.default===void 0?"":` (${String(o.default)})`,T=await q(a,xe(`${l}${m}`));if(T===""&&o.default!==void 0)u=o.default;else if(T===""){if(o.required)throw new Error(`Variable "${c}" is required`);continue}else u=V(o,T)}W(c,o,u),i[c]=u}return i}finally{a?.close()}},Be=["git://","npm://","https://","github:","gitlab:","bitbucket:","sourcehut:"],ke=t=>Be.some(e=>t.startsWith(e)),De=async(t,e={})=>{const r=e.targetDirectory===void 0,n=e.targetDirectory??le(S(ue(),"vis-generate-")),s=()=>{if(r)try{fe(n,{force:!0,recursive:!0})}catch{}};f.info(`Downloading ${t}…`);try{const i=await de(t,{auth:e.auth||process.env.GIGET_AUTH||process.env.GITHUB_TOKEN||process.env.GH_TOKEN||void 0,dir:n,force:!0,preferOffline:e.preferOffline});return{cleanup:s,directory:i.dir}}catch(i){s();const a=i instanceof Error?i.message:String(i);throw f.warn(`Failed to download template: ${a}`),i}},Y=(t,e="")=>{const r=[];for(const[n,s]of Object.entries(t)){const i=e?`${e}/${n}`:n;typeof s=="string"||Buffer.isBuffer(s)?r.push({content:s,path:i}):s&&typeof s=="object"&&r.push(...Y(s,i))}return r},je=t=>t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`,Ie=(t,e)=>{if(F(e))throw new Error(`Refusing to write outside destination: template produced absolute path "${e}".`);const r=S(t,e),n=G(t,r);if(n===".."||n.startsWith(`..${oe}`)||F(n))throw new Error(`Refusing to write outside destination: "${e}" resolves to "${r}" which escapes "${t}".`);return r},Re=(t,e)=>{J(K(t)),me(t,e)},qe=(t,e,r=!1)=>{const n=typeof t=="string"?[t]:t.commands,s=typeof t=="string"?r:t.silent??r;for(const i of n){s||f.info(`$ ${i}`);const a=pe(i,{cwd:e,shell:!0,stdio:s?"ignore":"inherit"});if(a.status!==0)return f.warn(`Script failed (exit ${String(a.status)}): ${i}`),!1}return!0},Le=t=>{const e=new Map;for(const r of t){const n=typeof r=="string"?0:r.phase??0,s=e.get(n);s?s.push(r):e.set(n,[r])}return[...e.entries()].sort(([r],[n])=>r-n)},We=async(t,e)=>{const n={builtins:{dest_dir:e.destination,dest_rel_dir:G(e.workspaceRoot,e.destination)||".",working_dir:e.cwd,workspace_root:e.workspaceRoot},options:e.options},s=await t.produce(n),i=s.files?Y(s.files):[],a=s.filesMeta??{},c=[];for(const o of i){const l=Ie(e.destination,o.path);c.push({file:o,meta:a[o.path]??{},target:l})}if(e.dryRun){f.info(`${y(v("Plan"))} ${d("(dry-run, no files written)")}`);for(const o of c){const l=Buffer.isBuffer(o.file.content)?o.file.content.length:Buffer.byteLength(o.file.content,"utf8");process.stderr.write(` ${d("write")} ${o.file.path} ${d(`(${je(l)})`)}
|
|
10
|
+
`)}}else{J(e.destination);let o=0,l=0;for(const u of c){const{file:m,meta:T,target:k}=u,b=_(k),E=e.force||T.force===!0;if(b&&!E){f.warn(`Skipped existing file: ${m.path} (use --force or set frontmatter force: true to overwrite)`),l+=1;continue}Re(k,m.content),o+=1}f.success(`Wrote ${String(o)} file${o===1?"":"s"}${l>0?`, skipped ${String(l)}`:""}`)}if(!e.dryRun&&!e.skipScripts&&s.scripts&&s.scripts.length>0){const o=Le(s.scripts);f.info(`Running ${String(s.scripts.length)} script${s.scripts.length===1?"":"s"} across ${String(o.length)} phase${o.length===1?"":"s"}…`);for(const[,l]of o)if((await Promise.all(l.map(m=>Promise.resolve(qe(m,e.destination))))).includes(!1))throw new Error("Script failed — aborting.")}if(s.suggestions&&s.suggestions.length>0){process.stderr.write(`
|
|
11
|
+
`),f.notice("Next steps:");for(const o of s.suggestions)process.stderr.write(` ${d("•")} ${o}
|
|
12
|
+
`)}},Fe=async t=>{let e;try{e=(await t.load()).about?.description}catch{}return{description:e,name:t.name,path:t.path,source:t.source}},Me=(t,e)=>{const r={default:e.default,name:t,order:e.order,prompt:e.prompt,required:e.required,type:e.type};return e.type==="enum"&&(r.multiple=e.multiple,r.values=e.values),r},Ae=async t=>{const e=await t.load(),r=Object.entries(e.options??{}).sort(([n,s],[i,a])=>{const c=s.order??0,o=a.order??0;return c===o?n.localeCompare(i):c-o}).map(([n,s])=>Me(n,s));return{description:e.about?.description??"",destination:e.destination,name:t.name,path:t.path,source:t.source,variables:r}},Pe=t=>{if(t.length===0){f.info("No templates found."),f.notice("Create one at .vis/templates/<name>.ts (programmatic) or .vis/templates/<name>/ (moon-format with template.yml).");return}f.info("Available templates:");for(const e of t){const r=d(`(${e.source})`);process.stderr.write(` ${y(v(e.name))} ${r}
|
|
13
|
+
`)}},Ce=(t,e)=>{const r={},n=[];for(let s=0;s<t.length;s++){const i=t[s];if(!i.startsWith("--")){n.push(i);continue}const a=i.indexOf("=");if(a===-1){const l=i.slice(2);if(l.startsWith("no-"))r[l.slice(3)]="false";else{r[l]="true";const u=t[s+1];u!==void 0&&!u.startsWith("-")&&e?.(`\`--${l} ${u}\` was read as boolean \`--${l}=true\` and \`${u}\` was ignored. For a string value use \`--${l}=${u}\`.`)}continue}const c=i.slice(2,a),o=i.slice(a+1);r[c]=o}return{overrides:r,remaining:n}},Ue=async t=>{const{createInterface:e}=await import("node:readline"),r=e({input:process.stdin,output:process.stderr});try{process.stderr.write(` ${y(v("vis generate"))} ${d("— pick a template")}
|
|
14
14
|
|
|
15
|
-
`);for(const[s
|
|
16
|
-
`)}return new Promise((s
|
|
17
|
-
${
|
|
18
|
-
`);return}
|
|
19
|
-
`);return}if(
|
|
20
|
-
`)}}return}let
|
|
21
|
-
`);const
|
|
22
|
-
`),
|
|
15
|
+
`);for(const[n,s]of t.entries()){const i=y(v(` ${String(n+1)}.`));process.stderr.write(`${i} ${s.name} ${d(`(${s.source})`)}
|
|
16
|
+
`)}return new Promise((n,s)=>{r.question(`
|
|
17
|
+
${d(`Enter choice (1-${String(t.length)}):`)} `,i=>{const a=Number.parseInt(i.trim(),10);Number.isInteger(a)&&a>=1&&a<=t.length?n(t[a-1].name):s(new Error("Invalid choice."))})})}finally{r.close()}},Qe=async({argument:t,options:e,rawUnknown:r,visConfig:n,workspaceRoot:s})=>{const i=e.cwd||s||process.cwd(),a=s??i,c=n?.generator,o=Array.isArray(t)?t:t?[t]:[];if(e.list){const p=R({extraDirectories:c?.templates??[],onWarning:h=>{f.warn(h)},workspaceRoot:a});if(e.json){const h=await Promise.all(p.map(w=>Fe(w)));process.stdout.write(`${JSON.stringify(h,null,2)}
|
|
18
|
+
`);return}Pe(p);return}if(e.describe){const p=o[0];if(!p)throw new Error("`--describe` requires a template name. Run `vis generate --list` to see available templates.");const w=R({extraDirectories:c?.templates??[],onWarning:$=>{f.warn($)},workspaceRoot:a}).find($=>$.name===p);if(!w)throw new Error(`Template "${p}" not found. Run \`vis generate --list\` to see available templates.`);const g=await Ae(w);if(e.json){process.stdout.write(`${JSON.stringify(g,null,2)}
|
|
19
|
+
`);return}if(f.info(`Template: ${y(v(g.name))} ${d(`(${g.source})`)}`),g.description&&f.info(g.description),g.destination&&f.info(`Destination: ${d(g.destination)}`),g.variables.length===0)f.info("No variables.");else{f.info("Variables:");for(const $ of g.variables){const j=[$.type];$.required&&j.push("required"),$.default!==void 0&&j.push(`default=${JSON.stringify($.default)}`),$.values&&j.push(`values=${$.values.join("|")}`),process.stderr.write(` ${y(v($.name))} ${d(`(${j.join(", ")})`)}
|
|
20
|
+
`)}}return}let l=[...r??[]];if(l.length===0){const p=process.argv.slice(2),h=p.indexOf("--");h!==-1&&(l=p.slice(h+1))}const u=o.indexOf("--"),m=u===-1?[]:o.slice(u+1),T=u===-1?o:o.slice(0,u),{overrides:k}=Ce([...m,...l],p=>{f.warn(p)});let b,E,D;const N=T[0];let L;if(N&&ke(N)){const p=await De(N,{auth:c?.auth,preferOffline:!!e.preferOffline||c?.preferOffline});L=p.cleanup;try{const w=R({extraDirectories:[p.directory],workspaceRoot:a}).find(g=>g.path.startsWith(p.directory));if(!w)throw new Error(`Downloaded template at ${p.directory} contains no template.yml or *.ts entrypoint.`);b=await w.load(),E=w.name,D=b.destination}catch(h){throw L(),h}}else{const p=R({extraDirectories:c?.templates??[],onWarning:g=>{f.warn(g)},workspaceRoot:a});if(p.length===0)throw new Error("No templates found. Create one at .vis/templates/<name>.ts or .vis/templates/<name>/template.yml.");let h;if(N)h=N;else{if(e.interactive===!1||!process.stdin.isTTY)throw new Error("No template specified. Pass a template name (see `vis generate --list`) or run interactively in a terminal.");h=await Ue(p)}const w=p.find(g=>g.name===h);if(!w)throw new Error(`Template "${h}" not found. Run 'vis generate --list' to see available templates.`);b=await w.load(),E=w.name,D=b.destination}const M=e.to,A=!!e.dryRun,Q=!!e.force,P=!!e.defaults,Z=!!e.skipScripts,ee=e.interactive!==!1&&!!process.stdin.isTTY&&!P;let x;M?x=M:D?x=D:x=".";const C=F(x)?x:ie(i,x);f.info(`Template: ${y(v(E))}`),f.info(`Target: ${d(C)}`),process.stderr.write(`
|
|
21
|
+
`);const te=await _e({defaults:P,interactive:ee,overrides:k,variables:b.options??{}});try{await We(b,{cwd:i,destination:C,dryRun:A,force:Q,options:te,skipScripts:Z,workspaceRoot:a}),A||(process.stderr.write(`
|
|
22
|
+
`),f.success(`Template '${E}' applied.`))}finally{L?.()}};export{Qe as default};
|