opkg 0.9.2 → 0.9.4
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/.claude/agents/code-reviewer.md +171 -0
- package/.claude/commands/commit-push-pr.md +20 -0
- package/.claude/commands/{specs/read.md → read-specs.md} +1 -1
- package/.claude/commands/{specs/update.md → update-specs.md} +4 -0
- package/.claude/skills/code-review-excellence/SKILL.md +538 -0
- package/README.md +2 -2
- package/package.json +3 -1
- package/packages/cli/dist/add-IJAPFHIX.js +624 -0
- package/packages/cli/dist/add-IJAPFHIX.js.map +7 -0
- package/packages/cli/dist/add-LLUNFLJI.js +624 -0
- package/packages/cli/dist/add-LLUNFLJI.js.map +7 -0
- package/packages/cli/dist/add-U44SL3OR.js +624 -0
- package/packages/cli/dist/add-U44SL3OR.js.map +7 -0
- package/packages/cli/dist/chunk-23VBP5L6.js +371 -0
- package/packages/cli/dist/chunk-23VBP5L6.js.map +7 -0
- package/packages/cli/dist/chunk-2SVHLF5C.js +1419 -0
- package/packages/cli/dist/chunk-2SVHLF5C.js.map +7 -0
- package/packages/cli/dist/chunk-37256POU.js +99 -0
- package/packages/cli/dist/chunk-37256POU.js.map +7 -0
- package/packages/cli/dist/chunk-3PZRVA6O.js +196 -0
- package/packages/cli/dist/chunk-3PZRVA6O.js.map +7 -0
- package/packages/cli/dist/chunk-427DCURL.js +155 -0
- package/packages/cli/dist/chunk-427DCURL.js.map +7 -0
- package/packages/cli/dist/chunk-4B5HJLP2.js +48 -0
- package/packages/cli/dist/chunk-4B5HJLP2.js.map +7 -0
- package/packages/cli/dist/chunk-4OWT3YEG.js +413 -0
- package/packages/cli/dist/chunk-4OWT3YEG.js.map +7 -0
- package/packages/cli/dist/chunk-4RIBTBXI.js +568 -0
- package/packages/cli/dist/chunk-4RIBTBXI.js.map +7 -0
- package/packages/cli/dist/chunk-4X2EJHJN.js +63 -0
- package/packages/cli/dist/chunk-4X2EJHJN.js.map +7 -0
- package/packages/cli/dist/chunk-6CYW66HD.js +1136 -0
- package/packages/cli/dist/chunk-6CYW66HD.js.map +7 -0
- package/packages/cli/dist/chunk-6DITYAFA.js +172 -0
- package/packages/cli/dist/chunk-6DITYAFA.js.map +7 -0
- package/packages/cli/dist/chunk-7KEAKEVZ.js +568 -0
- package/packages/cli/dist/chunk-7KEAKEVZ.js.map +7 -0
- package/packages/cli/dist/chunk-ABFUD25D.js +61 -0
- package/packages/cli/dist/chunk-ABFUD25D.js.map +7 -0
- package/packages/cli/dist/chunk-AR7GJCG6.js +274 -0
- package/packages/cli/dist/chunk-AR7GJCG6.js.map +7 -0
- package/packages/cli/dist/chunk-AYTGQCXH.js +86 -0
- package/packages/cli/dist/chunk-AYTGQCXH.js.map +7 -0
- package/packages/cli/dist/chunk-BROJ6OUT.js +631 -0
- package/packages/cli/dist/chunk-BROJ6OUT.js.map +7 -0
- package/packages/cli/dist/chunk-BVVSU7QD.js +23 -0
- package/packages/cli/dist/chunk-BVVSU7QD.js.map +7 -0
- package/packages/cli/dist/chunk-C6FY55UP.js +108 -0
- package/packages/cli/dist/chunk-C6FY55UP.js.map +7 -0
- package/packages/cli/dist/chunk-CVA64SXK.js +1136 -0
- package/packages/cli/dist/chunk-CVA64SXK.js.map +7 -0
- package/packages/cli/dist/chunk-D3O7LY2Q.js +1151 -0
- package/packages/cli/dist/chunk-D3O7LY2Q.js.map +7 -0
- package/packages/cli/dist/chunk-D6LEPODL.js +413 -0
- package/packages/cli/dist/chunk-D6LEPODL.js.map +7 -0
- package/packages/cli/dist/chunk-DEC24S7E.js +186 -0
- package/packages/cli/dist/chunk-DEC24S7E.js.map +7 -0
- package/packages/cli/dist/chunk-FMVVJH5M.js +371 -0
- package/packages/cli/dist/chunk-FMVVJH5M.js.map +7 -0
- package/packages/cli/dist/chunk-GDVFS3YP.js +130 -0
- package/packages/cli/dist/chunk-GDVFS3YP.js.map +7 -0
- package/packages/cli/dist/chunk-GEP2G5HF.js +31 -0
- package/packages/cli/dist/chunk-GEP2G5HF.js.map +7 -0
- package/packages/cli/dist/chunk-GSWHZBT2.js +62 -0
- package/packages/cli/dist/chunk-GSWHZBT2.js.map +7 -0
- package/packages/cli/dist/chunk-HTYHJA3B.js +61 -0
- package/packages/cli/dist/chunk-HTYHJA3B.js.map +7 -0
- package/packages/cli/dist/chunk-HYKYECAE.js +222 -0
- package/packages/cli/dist/chunk-HYKYECAE.js.map +7 -0
- package/packages/cli/dist/chunk-I7FEAHB4.js +100 -0
- package/packages/cli/dist/chunk-I7FEAHB4.js.map +7 -0
- package/packages/cli/dist/chunk-IHVZ5AUJ.js +107 -0
- package/packages/cli/dist/chunk-IHVZ5AUJ.js.map +7 -0
- package/packages/cli/dist/chunk-KI7FDU3H.js +99 -0
- package/packages/cli/dist/chunk-KI7FDU3H.js.map +7 -0
- package/packages/cli/dist/chunk-L5GRJQBS.js +32 -0
- package/packages/cli/dist/chunk-L5GRJQBS.js.map +7 -0
- package/packages/cli/dist/chunk-LHEAUDJL.js +302 -0
- package/packages/cli/dist/chunk-LHEAUDJL.js.map +7 -0
- package/packages/cli/dist/chunk-MIURCESJ.js +48 -0
- package/packages/cli/dist/chunk-MIURCESJ.js.map +7 -0
- package/packages/cli/dist/chunk-N43IXOND.js +732 -0
- package/packages/cli/dist/chunk-N43IXOND.js.map +7 -0
- package/packages/cli/dist/chunk-OUZRMGPV.js +274 -0
- package/packages/cli/dist/chunk-OUZRMGPV.js.map +7 -0
- package/packages/cli/dist/chunk-PSQXKAL4.js +371 -0
- package/packages/cli/dist/chunk-PSQXKAL4.js.map +7 -0
- package/packages/cli/dist/chunk-PUDRKDVZ.js +1419 -0
- package/packages/cli/dist/chunk-PUDRKDVZ.js.map +7 -0
- package/packages/cli/dist/chunk-RAKMX654.js +631 -0
- package/packages/cli/dist/chunk-RAKMX654.js.map +7 -0
- package/packages/cli/dist/chunk-RSFLK2TP.js +195 -0
- package/packages/cli/dist/chunk-RSFLK2TP.js.map +7 -0
- package/packages/cli/dist/chunk-S26PR2BS.js +99 -0
- package/packages/cli/dist/chunk-S26PR2BS.js.map +7 -0
- package/packages/cli/dist/chunk-U7FW7SXX.js +568 -0
- package/packages/cli/dist/chunk-U7FW7SXX.js.map +7 -0
- package/packages/cli/dist/chunk-VKM6K5TN.js +413 -0
- package/packages/cli/dist/chunk-VKM6K5TN.js.map +7 -0
- package/packages/cli/dist/chunk-VKNJG4JN.js +253 -0
- package/packages/cli/dist/chunk-VKNJG4JN.js.map +7 -0
- package/packages/cli/dist/chunk-VQ2KY6CK.js +113 -0
- package/packages/cli/dist/chunk-VQ2KY6CK.js.map +7 -0
- package/packages/cli/dist/chunk-VQDTXLOX.js +1312 -0
- package/packages/cli/dist/chunk-VQDTXLOX.js.map +7 -0
- package/packages/cli/dist/chunk-VXNS3X5O.js +60 -0
- package/packages/cli/dist/chunk-VXNS3X5O.js.map +7 -0
- package/packages/cli/dist/chunk-WF7H2YDU.js +376 -0
- package/packages/cli/dist/chunk-WF7H2YDU.js.map +7 -0
- package/packages/cli/dist/chunk-WNRXZLWW.js +266 -0
- package/packages/cli/dist/chunk-WNRXZLWW.js.map +7 -0
- package/packages/cli/dist/chunk-WT4VVCXM.js +1121 -0
- package/packages/cli/dist/chunk-WT4VVCXM.js.map +7 -0
- package/packages/cli/dist/configure-3AZUMDJZ.js +107 -0
- package/packages/cli/dist/configure-3AZUMDJZ.js.map +7 -0
- package/packages/cli/dist/configure-D722JQOD.js +107 -0
- package/packages/cli/dist/configure-D722JQOD.js.map +7 -0
- package/packages/cli/dist/configure-IU5H7XD6.js +107 -0
- package/packages/cli/dist/configure-IU5H7XD6.js.map +7 -0
- package/packages/cli/dist/file-format-detector-PXCIAKTK.js +22 -0
- package/packages/cli/dist/file-format-detector-PXCIAKTK.js.map +7 -0
- package/packages/cli/dist/index.js +17 -17
- package/packages/cli/dist/install-EZNWMLJR.js +7581 -0
- package/packages/cli/dist/install-EZNWMLJR.js.map +7 -0
- package/packages/cli/dist/install-F5ANFUBX.js +7577 -0
- package/packages/cli/dist/install-F5ANFUBX.js.map +7 -0
- package/packages/cli/dist/install-JSXEPPC2.js +7104 -0
- package/packages/cli/dist/install-JSXEPPC2.js.map +7 -0
- package/packages/cli/dist/install-QHEBX7JH.js +7101 -0
- package/packages/cli/dist/install-QHEBX7JH.js.map +7 -0
- package/packages/cli/dist/list-DMOUATYI.js +327 -0
- package/packages/cli/dist/list-DMOUATYI.js.map +7 -0
- package/packages/cli/dist/list-UESSCB7Y.js +327 -0
- package/packages/cli/dist/list-UESSCB7Y.js.map +7 -0
- package/packages/cli/dist/list-XR7RSJFS.js +327 -0
- package/packages/cli/dist/list-XR7RSJFS.js.map +7 -0
- package/packages/cli/dist/login-EYZ2SOYZ.js +150 -0
- package/packages/cli/dist/login-EYZ2SOYZ.js.map +7 -0
- package/packages/cli/dist/login-JWCSTAEU.js +150 -0
- package/packages/cli/dist/login-JWCSTAEU.js.map +7 -0
- package/packages/cli/dist/login-NRKHXZKM.js +150 -0
- package/packages/cli/dist/login-NRKHXZKM.js.map +7 -0
- package/packages/cli/dist/logout-HDMYRXIE.js +40 -0
- package/packages/cli/dist/logout-HDMYRXIE.js.map +7 -0
- package/packages/cli/dist/logout-SYHXCVCQ.js +40 -0
- package/packages/cli/dist/logout-SYHXCVCQ.js.map +7 -0
- package/packages/cli/dist/logout-X3XUUOH5.js +40 -0
- package/packages/cli/dist/logout-X3XUUOH5.js.map +7 -0
- package/packages/cli/dist/new-3LTFKDTQ.js +277 -0
- package/packages/cli/dist/new-3LTFKDTQ.js.map +7 -0
- package/packages/cli/dist/new-F46OSD72.js +277 -0
- package/packages/cli/dist/new-F46OSD72.js.map +7 -0
- package/packages/cli/dist/new-OPCCLNL2.js +277 -0
- package/packages/cli/dist/new-OPCCLNL2.js.map +7 -0
- package/packages/cli/dist/package-marker-detector-T5O5YD2E.js +80 -0
- package/packages/cli/dist/package-marker-detector-T5O5YD2E.js.map +7 -0
- package/packages/cli/dist/package-yml-QWZIJDYU.js +16 -0
- package/packages/cli/dist/package-yml-QWZIJDYU.js.map +7 -0
- package/packages/cli/dist/plugin-naming-YP2I4NPA.js +29 -0
- package/packages/cli/dist/plugin-naming-YP2I4NPA.js.map +7 -0
- package/packages/cli/dist/publish-4H43PCSG.js +619 -0
- package/packages/cli/dist/publish-4H43PCSG.js.map +7 -0
- package/packages/cli/dist/publish-RULKLNUX.js +619 -0
- package/packages/cli/dist/publish-RULKLNUX.js.map +7 -0
- package/packages/cli/dist/publish-URWY2P3E.js +619 -0
- package/packages/cli/dist/publish-URWY2P3E.js.map +7 -0
- package/packages/cli/dist/remove-BD52BHR2.js +542 -0
- package/packages/cli/dist/remove-BD52BHR2.js.map +7 -0
- package/packages/cli/dist/remove-G5NRC7LD.js +542 -0
- package/packages/cli/dist/remove-G5NRC7LD.js.map +7 -0
- package/packages/cli/dist/remove-TC3FQUYQ.js +542 -0
- package/packages/cli/dist/remove-TC3FQUYQ.js.map +7 -0
- package/packages/cli/dist/resource-discoverer-4X4RY43E.js +17 -0
- package/packages/cli/dist/resource-discoverer-4X4RY43E.js.map +7 -0
- package/packages/cli/dist/save-24TESYKI.js +1728 -0
- package/packages/cli/dist/save-24TESYKI.js.map +7 -0
- package/packages/cli/dist/save-N3QWF2WN.js +1728 -0
- package/packages/cli/dist/save-N3QWF2WN.js.map +7 -0
- package/packages/cli/dist/save-P2U67DTV.js +1728 -0
- package/packages/cli/dist/save-P2U67DTV.js.map +7 -0
- package/packages/cli/dist/search-ABROK3UO.js +157 -0
- package/packages/cli/dist/search-ABROK3UO.js.map +7 -0
- package/packages/cli/dist/search-WVFXFNAV.js +157 -0
- package/packages/cli/dist/search-WVFXFNAV.js.map +7 -0
- package/packages/cli/dist/search-YQN2Q2SO.js +157 -0
- package/packages/cli/dist/search-YQN2Q2SO.js.map +7 -0
- package/packages/cli/dist/set-DCWF73F6.js +251 -0
- package/packages/cli/dist/set-DCWF73F6.js.map +7 -0
- package/packages/cli/dist/set-GJEG2F6Y.js +251 -0
- package/packages/cli/dist/set-GJEG2F6Y.js.map +7 -0
- package/packages/cli/dist/set-NGM2FIKF.js +251 -0
- package/packages/cli/dist/set-NGM2FIKF.js.map +7 -0
- package/packages/cli/dist/uninstall-3CJQMTYH.js +539 -0
- package/packages/cli/dist/uninstall-3CJQMTYH.js.map +7 -0
- package/packages/cli/dist/uninstall-Q3CP4UN5.js +539 -0
- package/packages/cli/dist/uninstall-Q3CP4UN5.js.map +7 -0
- package/packages/cli/dist/uninstall-QU5OMEEC.js +539 -0
- package/packages/cli/dist/uninstall-QU5OMEEC.js.map +7 -0
- package/packages/cli/dist/unpublish-GHJQYC4S.js +245 -0
- package/packages/cli/dist/unpublish-GHJQYC4S.js.map +7 -0
- package/packages/cli/dist/unpublish-L2CYMK4B.js +245 -0
- package/packages/cli/dist/unpublish-L2CYMK4B.js.map +7 -0
- package/packages/cli/dist/unpublish-VBTNTMS5.js +245 -0
- package/packages/cli/dist/unpublish-VBTNTMS5.js.map +7 -0
- package/packages/cli/dist/view-MXRBMXOG.js +488 -0
- package/packages/cli/dist/view-MXRBMXOG.js.map +7 -0
- package/packages/cli/dist/view-NMND7SAW.js +488 -0
- package/packages/cli/dist/view-NMND7SAW.js.map +7 -0
- package/packages/cli/dist/view-RPQRDSYB.js +488 -0
- package/packages/cli/dist/view-RPQRDSYB.js.map +7 -0
- package/packages/cli/package.json +2 -0
- package/packages/core/dist/constants/index.d.ts +9 -0
- package/packages/core/dist/constants/index.d.ts.map +1 -1
- package/packages/core/dist/constants/index.js +12 -0
- package/packages/core/dist/constants/index.js.map +1 -1
- package/packages/core/dist/core/dependency-resolver/index.d.ts +2 -10
- package/packages/core/dist/core/dependency-resolver/index.d.ts.map +1 -1
- package/packages/core/dist/core/dependency-resolver/index.js +3 -14
- package/packages/core/dist/core/dependency-resolver/index.js.map +1 -1
- package/packages/core/dist/core/install/base-detector.d.ts +2 -1
- package/packages/core/dist/core/install/base-detector.d.ts.map +1 -1
- package/packages/core/dist/core/install/base-detector.js +54 -1
- package/packages/core/dist/core/install/base-detector.js.map +1 -1
- package/packages/core/dist/core/install/conflicts/file-conflict-resolver.d.ts +7 -5
- package/packages/core/dist/core/install/conflicts/file-conflict-resolver.d.ts.map +1 -1
- package/packages/core/dist/core/install/conflicts/file-conflict-resolver.js +25 -9
- package/packages/core/dist/core/install/conflicts/file-conflict-resolver.js.map +1 -1
- package/packages/core/dist/core/install/flow-index-installer.d.ts +2 -1
- package/packages/core/dist/core/install/flow-index-installer.d.ts.map +1 -1
- package/packages/core/dist/core/install/flow-index-installer.js +19 -4
- package/packages/core/dist/core/install/flow-index-installer.js.map +1 -1
- package/packages/core/dist/core/install/input-classifier-base.js +3 -3
- package/packages/core/dist/core/install/input-classifier-base.js.map +1 -1
- package/packages/core/dist/core/install/install-reporting.d.ts.map +1 -1
- package/packages/core/dist/core/install/install-reporting.js +7 -9
- package/packages/core/dist/core/install/install-reporting.js.map +1 -1
- package/packages/core/dist/core/install/list-handler.d.ts.map +1 -1
- package/packages/core/dist/core/install/list-handler.js +3 -0
- package/packages/core/dist/core/install/list-handler.js.map +1 -1
- package/packages/core/dist/core/install/marketplace-handler.d.ts.map +1 -1
- package/packages/core/dist/core/install/marketplace-handler.js.map +1 -1
- package/packages/core/dist/core/install/operations/conflict-handler.d.ts +2 -1
- package/packages/core/dist/core/install/operations/conflict-handler.d.ts.map +1 -1
- package/packages/core/dist/core/install/operations/conflict-handler.js +2 -2
- package/packages/core/dist/core/install/operations/conflict-handler.js.map +1 -1
- package/packages/core/dist/core/install/operations/installation-executor.d.ts +3 -0
- package/packages/core/dist/core/install/operations/installation-executor.d.ts.map +1 -1
- package/packages/core/dist/core/install/operations/installation-executor.js +39 -22
- package/packages/core/dist/core/install/operations/installation-executor.js.map +1 -1
- package/packages/core/dist/core/install/orchestrator/orchestrator.d.ts +7 -3
- package/packages/core/dist/core/install/orchestrator/orchestrator.d.ts.map +1 -1
- package/packages/core/dist/core/install/orchestrator/orchestrator.js +193 -93
- package/packages/core/dist/core/install/orchestrator/orchestrator.js.map +1 -1
- package/packages/core/dist/core/install/orchestrator/strategies/git-strategy.d.ts +1 -0
- package/packages/core/dist/core/install/orchestrator/strategies/git-strategy.d.ts.map +1 -1
- package/packages/core/dist/core/install/orchestrator/strategies/git-strategy.js +11 -24
- package/packages/core/dist/core/install/orchestrator/strategies/git-strategy.js.map +1 -1
- package/packages/core/dist/core/install/orchestrator/strategies/path-strategy.d.ts +2 -0
- package/packages/core/dist/core/install/orchestrator/strategies/path-strategy.d.ts.map +1 -1
- package/packages/core/dist/core/install/orchestrator/strategies/path-strategy.js +14 -14
- package/packages/core/dist/core/install/orchestrator/strategies/path-strategy.js.map +1 -1
- package/packages/core/dist/core/install/orchestrator/strategies/registry-strategy.d.ts +7 -0
- package/packages/core/dist/core/install/orchestrator/strategies/registry-strategy.d.ts.map +1 -1
- package/packages/core/dist/core/install/orchestrator/strategies/registry-strategy.js +28 -0
- package/packages/core/dist/core/install/orchestrator/strategies/registry-strategy.js.map +1 -1
- package/packages/core/dist/core/install/orchestrator/types.d.ts +2 -0
- package/packages/core/dist/core/install/orchestrator/types.d.ts.map +1 -1
- package/packages/core/dist/core/install/path-package-loader.d.ts.map +1 -1
- package/packages/core/dist/core/install/path-package-loader.js +20 -1
- package/packages/core/dist/core/install/path-package-loader.js.map +1 -1
- package/packages/core/dist/core/install/platform-resolution.d.ts +3 -0
- package/packages/core/dist/core/install/platform-resolution.d.ts.map +1 -1
- package/packages/core/dist/core/install/platform-resolution.js +5 -2
- package/packages/core/dist/core/install/platform-resolution.js.map +1 -1
- package/packages/core/dist/core/install/preprocessing/context-population.d.ts +18 -0
- package/packages/core/dist/core/install/preprocessing/context-population.d.ts.map +1 -0
- package/packages/core/dist/core/install/preprocessing/context-population.js +36 -0
- package/packages/core/dist/core/install/preprocessing/context-population.js.map +1 -0
- package/packages/core/dist/core/install/preprocessing/convenience-preprocessor.d.ts +23 -0
- package/packages/core/dist/core/install/preprocessing/convenience-preprocessor.d.ts.map +1 -1
- package/packages/core/dist/core/install/preprocessing/convenience-preprocessor.js +44 -0
- package/packages/core/dist/core/install/preprocessing/convenience-preprocessor.js.map +1 -1
- package/packages/core/dist/core/install/sources/git-source.d.ts.map +1 -1
- package/packages/core/dist/core/install/sources/git-source.js +67 -4
- package/packages/core/dist/core/install/sources/git-source.js.map +1 -1
- package/packages/core/dist/core/install/sources/path-source.d.ts.map +1 -1
- package/packages/core/dist/core/install/sources/path-source.js +8 -0
- package/packages/core/dist/core/install/sources/path-source.js.map +1 -1
- package/packages/core/dist/core/install/strategies/flow-based-strategy.d.ts.map +1 -1
- package/packages/core/dist/core/install/strategies/flow-based-strategy.js +12 -5
- package/packages/core/dist/core/install/strategies/flow-based-strategy.js.map +1 -1
- package/packages/core/dist/core/install/strategies/types.d.ts +11 -1
- package/packages/core/dist/core/install/strategies/types.d.ts.map +1 -1
- package/packages/core/dist/core/install/unified/context-builders.d.ts +5 -0
- package/packages/core/dist/core/install/unified/context-builders.d.ts.map +1 -1
- package/packages/core/dist/core/install/unified/context-builders.js +12 -0
- package/packages/core/dist/core/install/unified/context-builders.js.map +1 -1
- package/packages/core/dist/core/install/unified/context-helpers.d.ts +0 -4
- package/packages/core/dist/core/install/unified/context-helpers.d.ts.map +1 -1
- package/packages/core/dist/core/install/unified/context-helpers.js +0 -24
- package/packages/core/dist/core/install/unified/context-helpers.js.map +1 -1
- package/packages/core/dist/core/install/unified/index.d.ts +1 -1
- package/packages/core/dist/core/install/unified/index.d.ts.map +1 -1
- package/packages/core/dist/core/install/unified/index.js +1 -1
- package/packages/core/dist/core/install/unified/index.js.map +1 -1
- package/packages/core/dist/core/install/unified/multi-context-pipeline.d.ts +6 -0
- package/packages/core/dist/core/install/unified/multi-context-pipeline.d.ts.map +1 -1
- package/packages/core/dist/core/install/unified/multi-context-pipeline.js +11 -4
- package/packages/core/dist/core/install/unified/multi-context-pipeline.js.map +1 -1
- package/packages/core/dist/core/install/unified/phases/conflicts.d.ts.map +1 -1
- package/packages/core/dist/core/install/unified/phases/conflicts.js +1 -1
- package/packages/core/dist/core/install/unified/phases/conflicts.js.map +1 -1
- package/packages/core/dist/core/install/unified/phases/execute.d.ts.map +1 -1
- package/packages/core/dist/core/install/unified/phases/execute.js +5 -5
- package/packages/core/dist/core/install/unified/phases/execute.js.map +1 -1
- package/packages/core/dist/core/install/unified/phases/load-package.js +3 -3
- package/packages/core/dist/core/install/unified/phases/load-package.js.map +1 -1
- package/packages/core/dist/core/install/unified/phases/report.js +1 -1
- package/packages/core/dist/core/install/unified/phases/report.js.map +1 -1
- package/packages/core/dist/core/install/unified/pipeline.d.ts.map +1 -1
- package/packages/core/dist/core/install/unified/pipeline.js +7 -10
- package/packages/core/dist/core/install/unified/pipeline.js.map +1 -1
- package/packages/core/dist/core/install/wave-resolver/content-root-cache.d.ts +24 -0
- package/packages/core/dist/core/install/wave-resolver/content-root-cache.d.ts.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/content-root-cache.js +71 -0
- package/packages/core/dist/core/install/wave-resolver/content-root-cache.js.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/context-builder.d.ts +39 -0
- package/packages/core/dist/core/install/wave-resolver/context-builder.d.ts.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/context-builder.js +148 -0
- package/packages/core/dist/core/install/wave-resolver/context-builder.js.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/fetcher.d.ts +49 -0
- package/packages/core/dist/core/install/wave-resolver/fetcher.d.ts.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/fetcher.js +221 -0
- package/packages/core/dist/core/install/wave-resolver/fetcher.js.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/index-updater.d.ts +23 -0
- package/packages/core/dist/core/install/wave-resolver/index-updater.d.ts.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/index-updater.js +87 -0
- package/packages/core/dist/core/install/wave-resolver/index-updater.js.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/index-write-collector.d.ts +101 -0
- package/packages/core/dist/core/install/wave-resolver/index-write-collector.d.ts.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/index-write-collector.js +194 -0
- package/packages/core/dist/core/install/wave-resolver/index-write-collector.js.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/index.d.ts +17 -0
- package/packages/core/dist/core/install/wave-resolver/index.d.ts.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/index.js +16 -0
- package/packages/core/dist/core/install/wave-resolver/index.js.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/manifest-reader.d.ts +34 -0
- package/packages/core/dist/core/install/wave-resolver/manifest-reader.d.ts.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/manifest-reader.js +112 -0
- package/packages/core/dist/core/install/wave-resolver/manifest-reader.js.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/types.d.ts +210 -0
- package/packages/core/dist/core/install/wave-resolver/types.d.ts.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/types.js +6 -0
- package/packages/core/dist/core/install/wave-resolver/types.js.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/version-solver.d.ts +65 -0
- package/packages/core/dist/core/install/wave-resolver/version-solver.d.ts.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/version-solver.js +166 -0
- package/packages/core/dist/core/install/wave-resolver/version-solver.js.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/wave-engine.d.ts +16 -0
- package/packages/core/dist/core/install/wave-resolver/wave-engine.d.ts.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/wave-engine.js +337 -0
- package/packages/core/dist/core/install/wave-resolver/wave-engine.js.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/wave-installer.d.ts +50 -0
- package/packages/core/dist/core/install/wave-resolver/wave-installer.d.ts.map +1 -0
- package/packages/core/dist/core/install/wave-resolver/wave-installer.js +246 -0
- package/packages/core/dist/core/install/wave-resolver/wave-installer.js.map +1 -0
- package/packages/core/dist/core/ports/buffered-output.d.ts +36 -0
- package/packages/core/dist/core/ports/buffered-output.d.ts.map +1 -0
- package/packages/core/dist/core/ports/buffered-output.js +89 -0
- package/packages/core/dist/core/ports/buffered-output.js.map +1 -0
- package/packages/core/dist/core/ports/resolve.d.ts +0 -13
- package/packages/core/dist/core/ports/resolve.d.ts.map +1 -1
- package/packages/core/dist/core/ports/resolve.js +0 -28
- package/packages/core/dist/core/ports/resolve.js.map +1 -1
- package/packages/core/dist/core/remove/removal-confirmation.d.ts +4 -1
- package/packages/core/dist/core/remove/removal-confirmation.d.ts.map +1 -1
- package/packages/core/dist/core/remove/removal-confirmation.js +5 -4
- package/packages/core/dist/core/remove/removal-confirmation.js.map +1 -1
- package/packages/core/dist/core/remove/remove-from-source-pipeline.d.ts.map +1 -1
- package/packages/core/dist/core/remove/remove-from-source-pipeline.js +1 -10
- package/packages/core/dist/core/remove/remove-from-source-pipeline.js.map +1 -1
- package/packages/core/dist/core/uninstall/uninstall-executor.js +1 -1
- package/packages/core/dist/core/uninstall/uninstall-executor.js.map +1 -1
- package/packages/core/dist/core/uninstall/uninstall-reporter.d.ts +2 -2
- package/packages/core/dist/core/uninstall/uninstall-reporter.d.ts.map +1 -1
- package/packages/core/dist/core/uninstall/uninstall-reporter.js +4 -4
- package/packages/core/dist/core/uninstall/uninstall-reporter.js.map +1 -1
- package/packages/core/dist/index.d.ts +1 -1
- package/packages/core/dist/index.d.ts.map +1 -1
- package/packages/core/dist/types/execution-context.d.ts +40 -10
- package/packages/core/dist/types/execution-context.d.ts.map +1 -1
- package/packages/core/dist/utils/concurrency-pool.d.ts +34 -0
- package/packages/core/dist/utils/concurrency-pool.d.ts.map +1 -0
- package/packages/core/dist/utils/concurrency-pool.js +58 -0
- package/packages/core/dist/utils/concurrency-pool.js.map +1 -0
- package/packages/core/dist/utils/plugin-naming.d.ts +11 -3
- package/packages/core/dist/utils/plugin-naming.d.ts.map +1 -1
- package/packages/core/dist/utils/plugin-naming.js +27 -7
- package/packages/core/dist/utils/plugin-naming.js.map +1 -1
- package/plans/wave-resolver.md +254 -0
- package/.claude/agents/essentials/code-simplifier.md +0 -52
- package/.claude/commands/essentials/cleanup.md +0 -1
- package/.claude/commands/essentials/review.md +0 -8
- package/.claude/commands/git/commit.md +0 -5
|
@@ -0,0 +1,732 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
findSubpathIndex,
|
|
4
|
+
normalizePathForProcessing,
|
|
5
|
+
parsePathWithPrefix
|
|
6
|
+
} from "./chunk-YMKK4XPN.js";
|
|
7
|
+
import {
|
|
8
|
+
DIR_PATTERNS,
|
|
9
|
+
FILE_PATTERNS
|
|
10
|
+
} from "./chunk-IHVZ5AUJ.js";
|
|
11
|
+
import {
|
|
12
|
+
exists
|
|
13
|
+
} from "./chunk-S47F4OG4.js";
|
|
14
|
+
import {
|
|
15
|
+
logger
|
|
16
|
+
} from "./chunk-5EFWGD33.js";
|
|
17
|
+
|
|
18
|
+
// ../core/src/core/platforms.ts
|
|
19
|
+
import { join as join4 } from "path";
|
|
20
|
+
|
|
21
|
+
// ../core/src/core/platform/platform-mapper.ts
|
|
22
|
+
import { join, basename, dirname, extname, relative } from "path";
|
|
23
|
+
import { realpathSync } from "fs";
|
|
24
|
+
function extractPatternString(pattern) {
|
|
25
|
+
return typeof pattern == "string" ? pattern : pattern.pattern;
|
|
26
|
+
}
|
|
27
|
+
function extractFromPatternsFromFlow(flow) {
|
|
28
|
+
let from = flow.from;
|
|
29
|
+
if (typeof from == "string")
|
|
30
|
+
return [from];
|
|
31
|
+
if (Array.isArray(from))
|
|
32
|
+
return from.map((p) => extractPatternString(p));
|
|
33
|
+
if (typeof from == "object" && from !== null && "pattern" in from)
|
|
34
|
+
return [extractPatternString(from)];
|
|
35
|
+
if (typeof from == "object" && from !== null && "$switch" in from) {
|
|
36
|
+
let sw = from.$switch, patterns = [];
|
|
37
|
+
if (sw.cases)
|
|
38
|
+
for (let c of sw.cases) {
|
|
39
|
+
let v = c.value;
|
|
40
|
+
typeof v == "string" ? patterns.push(v) : typeof v == "object" && v !== null && "pattern" in v && patterns.push(v.pattern);
|
|
41
|
+
}
|
|
42
|
+
if (sw.default !== void 0) {
|
|
43
|
+
let d = sw.default;
|
|
44
|
+
typeof d == "string" ? patterns.push(d) : typeof d == "object" && d !== null && "pattern" in d && patterns.push(d.pattern);
|
|
45
|
+
}
|
|
46
|
+
return patterns;
|
|
47
|
+
}
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
function normalizePlatforms(platforms) {
|
|
51
|
+
if (!(!platforms || platforms.length === 0))
|
|
52
|
+
return platforms.map((p) => p.toLowerCase());
|
|
53
|
+
}
|
|
54
|
+
function extractToPatternsFromFlow(flow) {
|
|
55
|
+
let toField = flow.to, patterns = [];
|
|
56
|
+
if (typeof toField == "object" && toField !== null && "$switch" in toField) {
|
|
57
|
+
let switchExpr = toField;
|
|
58
|
+
if (switchExpr.$switch?.cases)
|
|
59
|
+
for (let caseItem of switchExpr.$switch.cases)
|
|
60
|
+
typeof caseItem.value == "string" ? patterns.push(caseItem.value) : typeof caseItem.value == "object" && "pattern" in caseItem.value && patterns.push(caseItem.value.pattern);
|
|
61
|
+
return switchExpr.$switch?.default && (typeof switchExpr.$switch.default == "string" ? patterns.push(switchExpr.$switch.default) : typeof switchExpr.$switch.default == "object" && "pattern" in switchExpr.$switch.default && patterns.push(switchExpr.$switch.default.pattern)), patterns;
|
|
62
|
+
}
|
|
63
|
+
return typeof toField == "string" ? [toField] : typeof toField == "object" && "pattern" in toField && typeof toField.pattern == "string" ? [toField.pattern] : typeof toField == "object" ? Object.keys(toField) : [];
|
|
64
|
+
}
|
|
65
|
+
function mapPlatformFileToUniversal(absPath, cwd = process.cwd()) {
|
|
66
|
+
let normalizedPath = normalizePathForProcessing(absPath);
|
|
67
|
+
for (let platform of getAllPlatforms({ includeDisabled: !0 }, cwd)) {
|
|
68
|
+
let definition = getPlatformDefinition(platform, cwd);
|
|
69
|
+
if (definition.export && definition.export.length > 0)
|
|
70
|
+
for (let flow of definition.export) {
|
|
71
|
+
let toPatterns = extractToPatternsFromFlow(flow);
|
|
72
|
+
for (let toPattern of toPatterns) {
|
|
73
|
+
if (!toPattern) continue;
|
|
74
|
+
let platformSubdirPath = toPattern.split("/").slice(0, -1).join("/"), subdirIndex = findSubpathIndex(normalizedPath, platformSubdirPath);
|
|
75
|
+
if (subdirIndex !== -1) {
|
|
76
|
+
if (typeof flow.from == "object" && "$switch" in flow.from)
|
|
77
|
+
continue;
|
|
78
|
+
let fromPatternRaw = Array.isArray(flow.from) ? flow.from[0] : flow.from, fromPattern = extractPatternString(fromPatternRaw), subdir = fromPattern.split("/")[0], absPattern = `/${platformSubdirPath}/`, relPattern = `${platformSubdirPath}/`, patternLength = normalizedPath.indexOf(absPattern) !== -1 ? absPattern.length : relPattern.length, relPathStart = subdirIndex + patternLength, relPath = normalizedPath.substring(relPathStart), workspaceExtMatch = relPath.match(/\.[^.]+$/), toExtMatch = toPattern.match(/\.[^./]+$/), fromExtMatch = fromPattern.match(/\.[^./]+$/);
|
|
79
|
+
if (workspaceExtMatch && toExtMatch && fromExtMatch) {
|
|
80
|
+
let workspaceExt = workspaceExtMatch[0], toExt = toExtMatch[0], fromExt = fromExtMatch[0];
|
|
81
|
+
workspaceExt === toExt && toExt !== fromExt && (relPath = relPath.slice(0, -workspaceExt.length) + fromExt);
|
|
82
|
+
}
|
|
83
|
+
return { platform, subdir, relPath };
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
function mapWorkspaceFileToUniversal(workspaceFilePath, cwd = process.cwd()) {
|
|
91
|
+
let absolutePath = realpathSync(workspaceFilePath), absoluteCwd = realpathSync(cwd), relativePath = relative(absoluteCwd, absolutePath).replace(/\\/g, "/");
|
|
92
|
+
for (let platform of getAllPlatforms({ includeDisabled: !0 }, cwd)) {
|
|
93
|
+
let definition = getPlatformDefinition(platform, cwd);
|
|
94
|
+
if (definition.import && definition.import.length > 0)
|
|
95
|
+
for (let flow of definition.import) {
|
|
96
|
+
let fromPatterns = extractFromPatternsFromFlow(flow);
|
|
97
|
+
if (fromPatterns.length === 0) continue;
|
|
98
|
+
let matchedFromPattern = null;
|
|
99
|
+
for (let p of fromPatterns)
|
|
100
|
+
if (matchesFlowPattern(relativePath, p)) {
|
|
101
|
+
matchedFromPattern = p;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
if (!matchedFromPattern) continue;
|
|
105
|
+
let toPattern;
|
|
106
|
+
if (typeof flow.to == "string")
|
|
107
|
+
toPattern = flow.to;
|
|
108
|
+
else if (typeof flow.to == "object" && flow.to !== null && "$switch" in flow.to) {
|
|
109
|
+
let d = flow.to.$switch.default;
|
|
110
|
+
toPattern = typeof d == "string" ? d : typeof d == "object" && d !== null && "pattern" in d ? d.pattern : void 0;
|
|
111
|
+
} else typeof flow.to == "object" && flow.to !== null && (toPattern = Object.keys(flow.to)[0]);
|
|
112
|
+
if (!toPattern) continue;
|
|
113
|
+
let subdir = toPattern.split("/")[0], relPath = mapPathUsingFlowPattern(relativePath, matchedFromPattern, toPattern);
|
|
114
|
+
if (relPath)
|
|
115
|
+
return { platform, subdir, relPath, flow };
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
function matchesFlowPattern(normalizedPath, pattern) {
|
|
121
|
+
let regexPattern = pattern.replace(/\./g, "\\.").replace(/\*\*\//g, "___DOUBLESTAR_SLASH___").replace(/\/\*\*/g, "___SLASH_DOUBLESTAR___").replace(/\*\*/g, "___DOUBLESTAR___").replace(/\*/g, "[^/]+").replace(/___DOUBLESTAR_SLASH___/g, "(?:.*?/)?").replace(/___SLASH_DOUBLESTAR___/g, "(?:/.*)?").replace(/___DOUBLESTAR___/g, ".*");
|
|
122
|
+
return new RegExp(`^${regexPattern}$`).test(normalizedPath);
|
|
123
|
+
}
|
|
124
|
+
function mapPathUsingFlowPattern(sourcePath, fromPattern, toPattern) {
|
|
125
|
+
if (fromPattern.includes("**") && toPattern.includes("**")) {
|
|
126
|
+
let fromParts = fromPattern.split("**"), toParts = toPattern.split("**"), fromBase = fromParts[0].replace(/\/$/, ""), toBase = toParts[0].replace(/\/$/, ""), fromSuffix = fromParts[1] || "", toSuffix = toParts[1] || "", relativeSubpath = sourcePath;
|
|
127
|
+
if (fromBase) {
|
|
128
|
+
if (!sourcePath.startsWith(fromBase + "/") && !sourcePath.startsWith("/" + fromBase + "/"))
|
|
129
|
+
return null;
|
|
130
|
+
let startPos = sourcePath.indexOf(fromBase);
|
|
131
|
+
relativeSubpath = sourcePath.slice(startPos + fromBase.length + 1);
|
|
132
|
+
}
|
|
133
|
+
if (fromSuffix && toSuffix) {
|
|
134
|
+
let fromExt = fromSuffix.replace(/^\/?\*+/, ""), toExt = toSuffix.replace(/^\/?\*+/, "");
|
|
135
|
+
fromExt && toExt && fromExt !== toExt && (relativeSubpath = relativeSubpath.replace(new RegExp(fromExt.replace(".", "\\.") + "$"), toExt));
|
|
136
|
+
}
|
|
137
|
+
return relativeSubpath;
|
|
138
|
+
}
|
|
139
|
+
if (fromPattern.includes("*") && toPattern.includes("*")) {
|
|
140
|
+
let sourceFileName = basename(sourcePath), sourceExt2 = extname(sourcePath), sourceBase = basename(sourcePath, sourceExt2), toParts = toPattern.split("*"), toPrefix = toParts[0], toSuffix = toParts[1] || "", targetExt2 = toSuffix.startsWith(".") ? toSuffix : sourceExt2 + toSuffix, targetFileName = sourceBase + targetExt2;
|
|
141
|
+
return toPrefix.split("/").filter((p) => p).slice(1).concat([targetFileName]).join("/");
|
|
142
|
+
}
|
|
143
|
+
let fileName = basename(sourcePath), toFileName = basename(toPattern), sourceExt = extname(fileName), targetExt = extname(toFileName), mappedFileName = fileName;
|
|
144
|
+
sourceExt !== targetExt && targetExt && (mappedFileName = basename(fileName, sourceExt) + targetExt);
|
|
145
|
+
let relDir = dirname(toPattern).split("/").filter((p) => p && p !== ".").slice(1).join("/");
|
|
146
|
+
return relDir ? `${relDir}/${mappedFileName}` : mappedFileName;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// ../core/src/core/platform/platform-file.ts
|
|
150
|
+
function parseUniversalPath(path2, options = {}) {
|
|
151
|
+
let universalSubdirs = getPlatformsState(options.cwd ?? null).universalSubdirs, knownPlatforms = getAllPlatforms({ includeDisabled: !0 }), withoutPrefix = normalizePathForProcessing(path2);
|
|
152
|
+
for (let subdir of universalSubdirs) {
|
|
153
|
+
let parsed = parsePathWithPrefix(withoutPrefix, subdir);
|
|
154
|
+
if (parsed) {
|
|
155
|
+
let remainingPath = parsed.remaining, platformSuffix, normalizedRelPath = remainingPath;
|
|
156
|
+
if (options.allowPlatformSuffix !== !1) {
|
|
157
|
+
let segments = remainingPath.split("/");
|
|
158
|
+
for (let i = 0; i < segments.length - 1; i++) {
|
|
159
|
+
let segment = segments[i];
|
|
160
|
+
for (let platform of knownPlatforms)
|
|
161
|
+
if (segment.endsWith(`.${platform}`) && isPlatformId(platform)) {
|
|
162
|
+
platformSuffix = platform, segments[i] = segment.slice(0, -platform.length - 1), normalizedRelPath = segments.join("/");
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
if (platformSuffix) break;
|
|
166
|
+
}
|
|
167
|
+
if (!platformSuffix) {
|
|
168
|
+
let parts = remainingPath.split(".");
|
|
169
|
+
if (parts.length >= 3 && parts[parts.length - 1] === "md") {
|
|
170
|
+
let possiblePlatformSuffix = parts[parts.length - 2];
|
|
171
|
+
isPlatformId(possiblePlatformSuffix) && (platformSuffix = possiblePlatformSuffix, normalizedRelPath = parts.slice(0, -2).join(".") + FILE_PATTERNS.MD_FILES);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return {
|
|
176
|
+
universalSubdir: subdir,
|
|
177
|
+
relPath: normalizedRelPath,
|
|
178
|
+
platformSuffix
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// ../core/src/utils/jsonc.ts
|
|
186
|
+
import { readFileSync, existsSync } from "fs";
|
|
187
|
+
import { dirname as dirname2, join as join2 } from "path";
|
|
188
|
+
import { fileURLToPath } from "url";
|
|
189
|
+
import { parse } from "jsonc-parser";
|
|
190
|
+
function getProjectRoot() {
|
|
191
|
+
let __filename = fileURLToPath(import.meta.url), dir = dirname2(__filename);
|
|
192
|
+
for (let i = 0; i < 10; i++) {
|
|
193
|
+
if (existsSync(join2(dir, "platforms.jsonc")))
|
|
194
|
+
return dir;
|
|
195
|
+
let parent = dirname2(dir);
|
|
196
|
+
if (parent === dir) break;
|
|
197
|
+
dir = parent;
|
|
198
|
+
}
|
|
199
|
+
let fallback = dirname2(__filename);
|
|
200
|
+
return join2(fallback, "..", "..");
|
|
201
|
+
}
|
|
202
|
+
function readJsoncFileSync(relativePath) {
|
|
203
|
+
let projectRoot = getProjectRoot(), fullPath = join2(projectRoot, relativePath);
|
|
204
|
+
try {
|
|
205
|
+
let content = readFileSync(fullPath, "utf-8"), parsed = parse(content);
|
|
206
|
+
if (parsed === void 0)
|
|
207
|
+
throw new Error(`Failed to parse JSONC file: ${relativePath}`);
|
|
208
|
+
return parsed;
|
|
209
|
+
} catch (error) {
|
|
210
|
+
throw logger.error(`Failed to read JSONC file: ${relativePath}`, { error, fullPath }), new Error(`Failed to read JSONC file ${relativePath}: ${error}`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
function readJsoncOrJson(fullPath) {
|
|
214
|
+
if (existsSync(fullPath))
|
|
215
|
+
try {
|
|
216
|
+
let content = readFileSync(fullPath, "utf-8"), parsed = parse(content);
|
|
217
|
+
if (parsed && typeof parsed == "object" && !Array.isArray(parsed) && parsed !== null)
|
|
218
|
+
return parsed;
|
|
219
|
+
} catch (error) {
|
|
220
|
+
logger.warn(`Failed to parse JSONC/JSON file ${fullPath}: ${error.message}`);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// ../core/src/core/platforms.ts
|
|
225
|
+
import * as os2 from "os";
|
|
226
|
+
|
|
227
|
+
// ../core/src/core/flows/switch-resolver.ts
|
|
228
|
+
import { minimatch as minimatch2 } from "minimatch";
|
|
229
|
+
|
|
230
|
+
// ../core/src/utils/path-comparison.ts
|
|
231
|
+
import * as path from "path";
|
|
232
|
+
import * as os from "os";
|
|
233
|
+
import { minimatch } from "minimatch";
|
|
234
|
+
function isPathLike(value) {
|
|
235
|
+
return typeof value != "string" ? !1 : value.includes("/") || // Unix-style path
|
|
236
|
+
value.includes("\\") || // Windows-style path
|
|
237
|
+
value.startsWith("~") || // Home directory reference
|
|
238
|
+
value.match(/^[A-Za-z]:/) !== null;
|
|
239
|
+
}
|
|
240
|
+
function expandTilde(filepath) {
|
|
241
|
+
return filepath && (filepath === "~" ? os.homedir() : filepath.startsWith("~/") ? path.join(os.homedir(), filepath.slice(2)) : filepath);
|
|
242
|
+
}
|
|
243
|
+
function hasGlobChars(pattern) {
|
|
244
|
+
return /[*?[\]{}]/.test(pattern);
|
|
245
|
+
}
|
|
246
|
+
function comparePathsWithGlobSupport(value, pattern) {
|
|
247
|
+
let expandedValue = expandTilde(value), expandedPattern = expandTilde(pattern), normalizedValue = path.normalize(expandedValue), normalizedPattern = path.normalize(expandedPattern);
|
|
248
|
+
return hasGlobChars(normalizedPattern) ? minimatch(normalizedValue, normalizedPattern, {
|
|
249
|
+
dot: !0,
|
|
250
|
+
// Match dotfiles
|
|
251
|
+
nocase: process.platform === "win32"
|
|
252
|
+
// Case-insensitive on Windows
|
|
253
|
+
}) : process.platform === "win32" ? normalizedValue.toLowerCase() === normalizedPattern.toLowerCase() : normalizedValue === normalizedPattern;
|
|
254
|
+
}
|
|
255
|
+
function smartEquals(left, right) {
|
|
256
|
+
if (isPathLike(left) || isPathLike(right)) {
|
|
257
|
+
let leftStr = String(left), rightStr = String(right);
|
|
258
|
+
return comparePathsWithGlobSupport(leftStr, rightStr);
|
|
259
|
+
}
|
|
260
|
+
return left === right;
|
|
261
|
+
}
|
|
262
|
+
function smartNotEquals(left, right) {
|
|
263
|
+
return !smartEquals(left, right);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// ../core/src/core/flows/switch-resolver.ts
|
|
267
|
+
function extractPattern(value) {
|
|
268
|
+
return typeof value == "string" ? value : value.pattern;
|
|
269
|
+
}
|
|
270
|
+
function extractSchema(value) {
|
|
271
|
+
if (typeof value != "string")
|
|
272
|
+
return value.schema;
|
|
273
|
+
}
|
|
274
|
+
function resolveSwitchExpression(switchExpr, context) {
|
|
275
|
+
return resolveSwitchExpressionFull(switchExpr, context).pattern;
|
|
276
|
+
}
|
|
277
|
+
function resolveSwitchExpressionFull(switchExpr, context) {
|
|
278
|
+
let { field, cases, default: defaultValue } = switchExpr.$switch, fieldValue = resolveFieldValue(field, context);
|
|
279
|
+
for (let switchCase of cases)
|
|
280
|
+
if (matchesPattern(fieldValue, switchCase.pattern))
|
|
281
|
+
return {
|
|
282
|
+
pattern: extractPattern(switchCase.value),
|
|
283
|
+
schema: extractSchema(switchCase.value)
|
|
284
|
+
};
|
|
285
|
+
if (defaultValue !== void 0)
|
|
286
|
+
return {
|
|
287
|
+
pattern: extractPattern(defaultValue),
|
|
288
|
+
schema: extractSchema(defaultValue)
|
|
289
|
+
};
|
|
290
|
+
throw new Error(
|
|
291
|
+
`No matching case in $switch expression for ${field}=${JSON.stringify(fieldValue)}, and no default provided`
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
function resolveFieldValue(field, context) {
|
|
295
|
+
if (field.startsWith("$$")) {
|
|
296
|
+
let varName = field.slice(2);
|
|
297
|
+
if (!(varName in context.variables))
|
|
298
|
+
throw new Error(`Variable '${varName}' not found in flow context`);
|
|
299
|
+
return context.variables[varName];
|
|
300
|
+
}
|
|
301
|
+
return field;
|
|
302
|
+
}
|
|
303
|
+
function matchesPattern(value, pattern) {
|
|
304
|
+
return typeof pattern == "object" && pattern !== null ? deepEquals(value, pattern) : typeof pattern == "string" ? pattern.includes("*") || pattern.includes("?") || pattern.includes("[") ? minimatch2(String(value), pattern) : smartEquals(value, pattern) : value === pattern;
|
|
305
|
+
}
|
|
306
|
+
function deepEquals(a, b) {
|
|
307
|
+
if (a === b) return !0;
|
|
308
|
+
if (typeof a != typeof b) return !1;
|
|
309
|
+
if (a === null || b === null || typeof a != "object") return a === b;
|
|
310
|
+
if (Array.isArray(a) !== Array.isArray(b)) return !1;
|
|
311
|
+
if (Array.isArray(a))
|
|
312
|
+
return a.length !== b.length ? !1 : a.every((item, index) => deepEquals(item, b[index]));
|
|
313
|
+
let keysA = Object.keys(a), keysB = Object.keys(b);
|
|
314
|
+
return keysA.length !== keysB.length ? !1 : keysA.every((key) => keysB.includes(key) && deepEquals(a[key], b[key]));
|
|
315
|
+
}
|
|
316
|
+
function validateSwitchExpression(switchExpr) {
|
|
317
|
+
let errors = [];
|
|
318
|
+
if (!switchExpr.$switch)
|
|
319
|
+
return errors.push("Switch expression must have $switch property"), { valid: !1, errors };
|
|
320
|
+
let { field, cases, default: defaultValue } = switchExpr.$switch;
|
|
321
|
+
return field ? typeof field != "string" && errors.push("Switch expression field must be a string") : errors.push("Switch expression missing required field: field"), cases ? Array.isArray(cases) ? cases.length === 0 ? errors.push("Switch expression must have at least one case") : cases.forEach((switchCase, index) => {
|
|
322
|
+
if (!switchCase || typeof switchCase != "object") {
|
|
323
|
+
errors.push(`Case at index ${index} must be an object`);
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
"pattern" in switchCase || errors.push(`Case at index ${index} missing required field: pattern`), "value" in switchCase ? isValidSwitchCaseValue(switchCase.value) || errors.push(`Case at index ${index} value must be a string or object with 'pattern' field`) : errors.push(`Case at index ${index} missing required field: value`);
|
|
327
|
+
}) : errors.push("Switch expression cases must be an array") : errors.push("Switch expression missing required field: cases"), defaultValue !== void 0 && !isValidSwitchCaseValue(defaultValue) && errors.push("Switch expression default must be a string or object with 'pattern' field"), {
|
|
328
|
+
valid: errors.length === 0,
|
|
329
|
+
errors
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
function isValidSwitchCaseValue(value) {
|
|
333
|
+
return typeof value == "string" ? !0 : typeof value == "object" && value !== null && "pattern" in value ? typeof value.pattern == "string" : !1;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
// ../core/src/core/universal-patterns.ts
|
|
337
|
+
import { minimatch as minimatch3 } from "minimatch";
|
|
338
|
+
function isPatternMatch(filePath, pattern) {
|
|
339
|
+
let normalizedPath = normalizePathForProcessing(filePath), normalizedPattern = normalizePathForProcessing(pattern);
|
|
340
|
+
return minimatch3(normalizedPath, normalizedPattern, {
|
|
341
|
+
dot: !1,
|
|
342
|
+
// Don't match dotfiles by default
|
|
343
|
+
nocase: !1,
|
|
344
|
+
// Case-sensitive matching
|
|
345
|
+
matchBase: !1
|
|
346
|
+
// Don't match basename only
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
function matchesAnyPattern(filePath, patterns) {
|
|
350
|
+
let normalized = normalizePathForProcessing(filePath);
|
|
351
|
+
for (let pattern of patterns)
|
|
352
|
+
if (isPatternMatch(normalized, pattern))
|
|
353
|
+
return !0;
|
|
354
|
+
return !1;
|
|
355
|
+
}
|
|
356
|
+
function extractFirstComponent(pathOrPattern) {
|
|
357
|
+
let normalized = normalizePathForProcessing(pathOrPattern);
|
|
358
|
+
return normalized && normalized.split("/")[0] || null;
|
|
359
|
+
}
|
|
360
|
+
function isSubdirectoryPattern(pattern) {
|
|
361
|
+
let firstComponent = extractFirstComponent(pattern);
|
|
362
|
+
return firstComponent !== null && !firstComponent.includes(".");
|
|
363
|
+
}
|
|
364
|
+
function extractSubdirectoriesFromPatterns(patterns) {
|
|
365
|
+
let subdirs = /* @__PURE__ */ new Set();
|
|
366
|
+
for (let pattern of patterns)
|
|
367
|
+
if (isSubdirectoryPattern(pattern)) {
|
|
368
|
+
let firstComponent = extractFirstComponent(pattern);
|
|
369
|
+
firstComponent && subdirs.add(firstComponent);
|
|
370
|
+
}
|
|
371
|
+
return subdirs;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// ../core/src/core/platforms.ts
|
|
375
|
+
function isGlobalFlowsConfig(cfg) {
|
|
376
|
+
return ("export" in cfg || "import" in cfg) && !("name" in cfg) && !("rootDir" in cfg);
|
|
377
|
+
}
|
|
378
|
+
function createPlatformDefinitions(config) {
|
|
379
|
+
let result = {};
|
|
380
|
+
for (let [id, cfg] of Object.entries(config)) {
|
|
381
|
+
if (id === "$schema" || id === "global" || isGlobalFlowsConfig(cfg)) continue;
|
|
382
|
+
let platformConfig = cfg, platformId = id;
|
|
383
|
+
result[platformId] = {
|
|
384
|
+
id: platformId,
|
|
385
|
+
name: platformConfig.name,
|
|
386
|
+
rootDir: platformConfig.rootDir,
|
|
387
|
+
rootFile: platformConfig.rootFile,
|
|
388
|
+
detection: platformConfig.detection,
|
|
389
|
+
export: platformConfig.export || [],
|
|
390
|
+
import: platformConfig.import || [],
|
|
391
|
+
aliases: platformConfig.aliases,
|
|
392
|
+
enabled: platformConfig.enabled !== !1,
|
|
393
|
+
description: platformConfig.description,
|
|
394
|
+
variables: platformConfig.variables
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
return result;
|
|
398
|
+
}
|
|
399
|
+
var BUILT_IN_CONFIG = readJsoncFileSync("platforms.jsonc"), builtinErrors = validatePlatformsConfig(BUILT_IN_CONFIG);
|
|
400
|
+
if (builtinErrors.length > 0)
|
|
401
|
+
throw new Error(`Built-in platforms.jsonc validation failed:
|
|
402
|
+
- ${builtinErrors.join(`
|
|
403
|
+
- `)}`);
|
|
404
|
+
function mergePlatformsConfig(base, override) {
|
|
405
|
+
let merged = { ...base };
|
|
406
|
+
for (let [platformId, overridePlat] of Object.entries(override)) {
|
|
407
|
+
if (platformId === "$schema") {
|
|
408
|
+
merged[platformId] = overridePlat;
|
|
409
|
+
continue;
|
|
410
|
+
}
|
|
411
|
+
let basePlat = base[platformId];
|
|
412
|
+
if (!basePlat) {
|
|
413
|
+
merged[platformId] = overridePlat;
|
|
414
|
+
continue;
|
|
415
|
+
}
|
|
416
|
+
if (platformId === "global") {
|
|
417
|
+
isGlobalFlowsConfig(overridePlat) && (merged[platformId] = overridePlat);
|
|
418
|
+
continue;
|
|
419
|
+
}
|
|
420
|
+
if (isGlobalFlowsConfig(overridePlat) || isGlobalFlowsConfig(basePlat)) {
|
|
421
|
+
merged[platformId] = overridePlat;
|
|
422
|
+
continue;
|
|
423
|
+
}
|
|
424
|
+
let overrideCfg = overridePlat, baseCfg = basePlat;
|
|
425
|
+
merged[platformId] = {
|
|
426
|
+
name: overrideCfg.name ?? baseCfg.name,
|
|
427
|
+
rootDir: overrideCfg.rootDir ?? baseCfg.rootDir,
|
|
428
|
+
rootFile: overrideCfg.rootFile ?? baseCfg.rootFile,
|
|
429
|
+
detection: overrideCfg.detection ?? baseCfg.detection,
|
|
430
|
+
// replace array
|
|
431
|
+
aliases: overrideCfg.aliases ?? baseCfg.aliases,
|
|
432
|
+
// replace array
|
|
433
|
+
enabled: overrideCfg.enabled ?? baseCfg.enabled,
|
|
434
|
+
description: overrideCfg.description ?? baseCfg.description,
|
|
435
|
+
variables: overrideCfg.variables ?? baseCfg.variables,
|
|
436
|
+
export: overrideCfg.export ?? baseCfg.export,
|
|
437
|
+
// replace array (no merge)
|
|
438
|
+
import: overrideCfg.import ?? baseCfg.import
|
|
439
|
+
// replace array (no merge)
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
return merged;
|
|
443
|
+
}
|
|
444
|
+
function validatePlatformsConfig(config) {
|
|
445
|
+
let errors = [];
|
|
446
|
+
for (let [platformId, platConfig] of Object.entries(config)) {
|
|
447
|
+
if (platformId === "$schema")
|
|
448
|
+
continue;
|
|
449
|
+
if (platformId === "global") {
|
|
450
|
+
isGlobalFlowsConfig(platConfig) && errors.push(...validateGlobalFlowsConfig(platConfig));
|
|
451
|
+
continue;
|
|
452
|
+
}
|
|
453
|
+
if (isGlobalFlowsConfig(platConfig)) {
|
|
454
|
+
errors.push(`Platform '${platformId}': Cannot use global flows config format for platform entry`);
|
|
455
|
+
continue;
|
|
456
|
+
}
|
|
457
|
+
let cfg = platConfig;
|
|
458
|
+
!cfg.detection && (!cfg.rootDir || cfg.rootDir.trim() === "") && errors.push(`Platform '${platformId}': Must define either 'detection' array or 'rootDir'`), (!cfg.name || cfg.name.trim() === "") && errors.push(`Platform '${platformId}': Missing or empty name`), cfg.export !== void 0 && (Array.isArray(cfg.export) ? errors.push(...validateFlows(cfg.export, `${platformId}.export`)) : errors.push(`Platform '${platformId}': export must be array or undefined`)), cfg.import !== void 0 && (Array.isArray(cfg.import) ? errors.push(...validateFlows(cfg.import, `${platformId}.import`)) : errors.push(`Platform '${platformId}': import must be array or undefined`));
|
|
459
|
+
let hasExport = cfg.export && cfg.export.length > 0, hasImport = cfg.import && cfg.import.length > 0, hasDetection = cfg.detection && cfg.detection.length > 0;
|
|
460
|
+
!hasExport && !hasImport && !cfg.rootFile && !hasDetection && errors.push(`Platform '${platformId}': Must define at least one of 'export', 'import', 'detection', or 'rootFile'`), cfg.aliases !== void 0 && (!Array.isArray(cfg.aliases) || cfg.aliases.some((a) => typeof a != "string")) && errors.push(`Platform '${platformId}': aliases must be array of strings or undefined`), typeof cfg.enabled != "boolean" && cfg.enabled !== void 0 && errors.push(`Platform '${platformId}': enabled must be boolean or undefined`), cfg.variables !== void 0 && (typeof cfg.variables != "object" || Array.isArray(cfg.variables)) && errors.push(`Platform '${platformId}': variables must be object or undefined`);
|
|
461
|
+
}
|
|
462
|
+
return errors;
|
|
463
|
+
}
|
|
464
|
+
function extractPatternString2(field) {
|
|
465
|
+
if (typeof field == "string")
|
|
466
|
+
return field;
|
|
467
|
+
if (typeof field == "object" && field !== null) {
|
|
468
|
+
if ("pattern" in field)
|
|
469
|
+
return field.pattern;
|
|
470
|
+
if ("$switch" in field)
|
|
471
|
+
return null;
|
|
472
|
+
}
|
|
473
|
+
return Array.isArray(field) && field.length > 0 ? extractPatternString2(field[0]) : null;
|
|
474
|
+
}
|
|
475
|
+
function validateGlobalFlowsConfig(config) {
|
|
476
|
+
let errors = [];
|
|
477
|
+
return config.export !== void 0 && (Array.isArray(config.export) ? errors.push(...validateFlows(config.export, "global.export")) : errors.push("Global config: export must be array or undefined")), config.import !== void 0 && (Array.isArray(config.import) ? errors.push(...validateFlows(config.import, "global.import")) : errors.push("Global config: import must be array or undefined")), config.description !== void 0 && typeof config.description != "string" && errors.push("Global config: description must be string or undefined"), errors;
|
|
478
|
+
}
|
|
479
|
+
function isSwitchExpression(value) {
|
|
480
|
+
return typeof value == "object" && value !== null && "$switch" in value;
|
|
481
|
+
}
|
|
482
|
+
function isPatternObject(value) {
|
|
483
|
+
return typeof value == "object" && value !== null && "pattern" in value && typeof value.pattern == "string";
|
|
484
|
+
}
|
|
485
|
+
function validatePatternObject(value, context) {
|
|
486
|
+
let errors = [];
|
|
487
|
+
return (typeof value.pattern != "string" || value.pattern.trim() === "") && errors.push(`${context}: pattern must be non-empty string`), "schema" in value && typeof value.schema != "string" && errors.push(`${context}: schema must be string if provided`), errors;
|
|
488
|
+
}
|
|
489
|
+
function validateFlows(flows, context) {
|
|
490
|
+
let errors = [];
|
|
491
|
+
for (let i = 0; i < flows.length; i++) {
|
|
492
|
+
let flow = flows[i];
|
|
493
|
+
if (flow.from ? typeof flow.from == "string" ? flow.from.trim() === "" && errors.push(`${context}, flows[${i}]: 'from' cannot be empty`) : Array.isArray(flow.from) ? (flow.from.length === 0 && errors.push(`${context}, flows[${i}]: 'from' array cannot be empty`), flow.from.forEach((p, j) => {
|
|
494
|
+
typeof p == "string" ? p.trim() === "" && errors.push(`${context}, flows[${i}]: 'from' array item ${j} cannot be empty string`) : isPatternObject(p) ? errors.push(...validatePatternObject(p, `${context}, flows[${i}].from[${j}]`)) : errors.push(`${context}, flows[${i}]: 'from' array item ${j} must be string or pattern object`);
|
|
495
|
+
})) : isSwitchExpression(flow.from) || (isPatternObject(flow.from) ? errors.push(...validatePatternObject(flow.from, `${context}, flows[${i}].from`)) : errors.push(`${context}, flows[${i}]: 'from' must be string, array, pattern object, or $switch expression`)) : errors.push(`${context}, flows[${i}]: Missing 'from' field`), !flow.to)
|
|
496
|
+
errors.push(`${context}, flows[${i}]: Missing 'to' field`);
|
|
497
|
+
else if (typeof flow.to == "string")
|
|
498
|
+
flow.to.trim() === "" && errors.push(`${context}, flows[${i}]: 'to' cannot be empty`);
|
|
499
|
+
else if (isSwitchExpression(flow.to)) {
|
|
500
|
+
let switchValidation = validateSwitchExpression(flow.to);
|
|
501
|
+
switchValidation.valid || switchValidation.errors.forEach((err) => {
|
|
502
|
+
errors.push(`${context}, flows[${i}]: ${err}`);
|
|
503
|
+
});
|
|
504
|
+
} else if (isPatternObject(flow.to))
|
|
505
|
+
errors.push(...validatePatternObject(flow.to, `${context}, flows[${i}].to`));
|
|
506
|
+
else if (typeof flow.to == "object")
|
|
507
|
+
for (let [targetPath, targetFlow] of Object.entries(flow.to))
|
|
508
|
+
(typeof targetPath != "string" || targetPath.trim() === "") && errors.push(`${context}, flows[${i}].to: target path cannot be empty`);
|
|
509
|
+
else
|
|
510
|
+
errors.push(`${context}, flows[${i}]: 'to' must be string, pattern object, switch expression, or multi-target object`);
|
|
511
|
+
if (flow.merge !== void 0) {
|
|
512
|
+
let validMerges = ["replace", "shallow", "deep", "composite"];
|
|
513
|
+
validMerges.includes(flow.merge) || errors.push(`${context}, flows[${i}]: Invalid merge strategy '${flow.merge}'. Must be one of: ${validMerges.join(", ")}`);
|
|
514
|
+
}
|
|
515
|
+
let pipe = flow.pipe;
|
|
516
|
+
pipe !== void 0 && (Array.isArray(pipe) ? pipe.some((p) => typeof p != "string" || p.trim() === "") && errors.push(`${context}, flows[${i}]: 'pipe' must be array of strings`) : errors.push(`${context}, flows[${i}]: 'pipe' must be array`)), flow.map !== void 0 && !Array.isArray(flow.map) && errors.push(`${context}, flows[${i}]: 'map' must be array of operations`), flow.pick !== void 0 && !Array.isArray(flow.pick) && errors.push(`${context}, flows[${i}]: 'pick' must be array or undefined`), flow.omit !== void 0 && !Array.isArray(flow.omit) && errors.push(`${context}, flows[${i}]: 'omit' must be array or undefined`), flow.embed !== void 0 && (typeof flow.embed != "string" || flow.embed.trim() === "") && errors.push(`${context}, flows[${i}]: 'embed' must be non-empty string or undefined`);
|
|
517
|
+
}
|
|
518
|
+
return errors;
|
|
519
|
+
}
|
|
520
|
+
var GLOBAL_DIR = join4(os2.homedir(), ".openpackage"), stateCache = /* @__PURE__ */ new Map();
|
|
521
|
+
function getPlatformsState(targetDir) {
|
|
522
|
+
let key = targetDir ?? null;
|
|
523
|
+
if (stateCache.has(key))
|
|
524
|
+
return stateCache.get(key);
|
|
525
|
+
let config;
|
|
526
|
+
if (key === null) {
|
|
527
|
+
let globalFile = readJsoncOrJson(join4(GLOBAL_DIR, "platforms.jsonc")) ?? readJsoncOrJson(join4(GLOBAL_DIR, "platforms.json"));
|
|
528
|
+
config = globalFile ? mergePlatformsConfig(BUILT_IN_CONFIG, globalFile) : BUILT_IN_CONFIG;
|
|
529
|
+
let errors = validatePlatformsConfig(config);
|
|
530
|
+
if (errors.length > 0)
|
|
531
|
+
throw new Error(`Global platforms config validation failed:
|
|
532
|
+
- ${errors.join(`
|
|
533
|
+
- `)}`);
|
|
534
|
+
} else {
|
|
535
|
+
let globalConfig2 = getPlatformsState(null).config, localDir = join4(key, DIR_PATTERNS.OPENPACKAGE), localFile = readJsoncOrJson(join4(localDir, "platforms.jsonc")) ?? readJsoncOrJson(join4(localDir, "platforms.json"));
|
|
536
|
+
config = localFile ? mergePlatformsConfig(globalConfig2, localFile) : globalConfig2;
|
|
537
|
+
let errors = validatePlatformsConfig(config);
|
|
538
|
+
if (errors.length > 0)
|
|
539
|
+
throw new Error(`Local platforms config validation failed in ${key}:
|
|
540
|
+
- ${errors.join(`
|
|
541
|
+
- `)}`);
|
|
542
|
+
}
|
|
543
|
+
let globalConfig = config.global, globalExportFlows = globalConfig && isGlobalFlowsConfig(globalConfig) ? globalConfig.export : void 0, globalImportFlows = globalConfig && isGlobalFlowsConfig(globalConfig) ? globalConfig.import : void 0, defs = createPlatformDefinitions(config), dirLookup = {}, aliasLookup = {}, universalPatterns = /* @__PURE__ */ new Set(), rootFiles = [], allPlatforms = [];
|
|
544
|
+
for (let def of Object.values(defs)) {
|
|
545
|
+
allPlatforms.push(def.id), def.rootDir && (dirLookup[def.rootDir] = def.id);
|
|
546
|
+
for (let alias of def.aliases ?? [])
|
|
547
|
+
aliasLookup[alias.toLowerCase()] = def.id;
|
|
548
|
+
if (def.export && def.export.length > 0)
|
|
549
|
+
for (let flow of def.export) {
|
|
550
|
+
let pattern = extractPatternString2(flow.from);
|
|
551
|
+
pattern && universalPatterns.add(pattern);
|
|
552
|
+
}
|
|
553
|
+
def.rootFile && rootFiles.push(def.rootFile);
|
|
554
|
+
}
|
|
555
|
+
if (globalExportFlows && globalExportFlows.length > 0)
|
|
556
|
+
for (let flow of globalExportFlows) {
|
|
557
|
+
let pattern = extractPatternString2(flow.from);
|
|
558
|
+
pattern && universalPatterns.add(pattern);
|
|
559
|
+
}
|
|
560
|
+
let universalSubdirs = extractSubdirectoriesFromPatterns(universalPatterns), enabledPlatforms = allPlatforms.filter((p) => defs[p].enabled), state = {
|
|
561
|
+
config,
|
|
562
|
+
globalExportFlows,
|
|
563
|
+
globalImportFlows,
|
|
564
|
+
defs,
|
|
565
|
+
dirLookup,
|
|
566
|
+
aliasLookup,
|
|
567
|
+
universalPatterns,
|
|
568
|
+
universalSubdirs,
|
|
569
|
+
rootFiles,
|
|
570
|
+
allPlatforms,
|
|
571
|
+
enabledPlatforms
|
|
572
|
+
};
|
|
573
|
+
return stateCache.set(key, state), state;
|
|
574
|
+
}
|
|
575
|
+
function getPlatformDefinitions(targetDir) {
|
|
576
|
+
return getPlatformsState(targetDir).defs;
|
|
577
|
+
}
|
|
578
|
+
function getGlobalExportFlows(targetDir) {
|
|
579
|
+
return getPlatformsState(targetDir).globalExportFlows;
|
|
580
|
+
}
|
|
581
|
+
function getGlobalImportFlows(targetDir) {
|
|
582
|
+
return getPlatformsState(targetDir).globalImportFlows;
|
|
583
|
+
}
|
|
584
|
+
function platformUsesFlows(platform, targetDir) {
|
|
585
|
+
try {
|
|
586
|
+
let def = getPlatformDefinition(platform, targetDir), hasExport = def.export !== void 0 && def.export.length > 0, hasImport = def.import !== void 0 && def.import.length > 0;
|
|
587
|
+
return hasExport || hasImport;
|
|
588
|
+
} catch {
|
|
589
|
+
return !1;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
function getAllUniversalPatterns(targetDir) {
|
|
593
|
+
return new Set(getPlatformsState(targetDir).universalPatterns);
|
|
594
|
+
}
|
|
595
|
+
function matchesUniversalPattern(filePath, targetDir) {
|
|
596
|
+
let patterns = getAllUniversalPatterns(targetDir);
|
|
597
|
+
return matchesAnyPattern(filePath, patterns);
|
|
598
|
+
}
|
|
599
|
+
function getPlatformDirLookup(targetDir) {
|
|
600
|
+
return getPlatformsState(targetDir).dirLookup;
|
|
601
|
+
}
|
|
602
|
+
function getPlatformRootFiles(targetDir) {
|
|
603
|
+
return getPlatformsState(targetDir).rootFiles;
|
|
604
|
+
}
|
|
605
|
+
function getPlatformDefinition(name, targetDir) {
|
|
606
|
+
let def = getPlatformsState(targetDir).defs[name];
|
|
607
|
+
if (!def)
|
|
608
|
+
throw new Error(`Unknown platform: ${name}`);
|
|
609
|
+
return def;
|
|
610
|
+
}
|
|
611
|
+
function deriveRootDirFromFlows(definition) {
|
|
612
|
+
if (definition.rootDir)
|
|
613
|
+
return definition.rootDir;
|
|
614
|
+
let extractPathFromSwitch = (switchExpr) => isSwitchExpression(switchExpr) ? switchExpr.$switch.default || switchExpr.$switch.cases[0]?.value : null;
|
|
615
|
+
if (definition.export && definition.export.length > 0)
|
|
616
|
+
for (let flow of definition.export) {
|
|
617
|
+
let toPattern = null;
|
|
618
|
+
if (typeof flow.to == "string" ? toPattern = flow.to : isSwitchExpression(flow.to) ? toPattern = extractPathFromSwitch(flow.to) : toPattern = Object.keys(flow.to)[0], toPattern) {
|
|
619
|
+
let match = toPattern.match(/^(\.[^/]+)/);
|
|
620
|
+
if (match)
|
|
621
|
+
return match[1];
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
if (definition.import && definition.import.length > 0)
|
|
625
|
+
for (let flow of definition.import) {
|
|
626
|
+
let fromPattern = null;
|
|
627
|
+
if (typeof flow.from == "string" ? fromPattern = flow.from : Array.isArray(flow.from) ? fromPattern = flow.from[0] : isSwitchExpression(flow.from) && (fromPattern = extractPathFromSwitch(flow.from)), fromPattern) {
|
|
628
|
+
let match = fromPattern.match(/^(\.[^/]+)/);
|
|
629
|
+
if (match)
|
|
630
|
+
return match[1];
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
return `.${definition.id}`;
|
|
634
|
+
}
|
|
635
|
+
function getAllPlatforms(options, targetDir) {
|
|
636
|
+
let state = getPlatformsState(targetDir);
|
|
637
|
+
return options?.includeDisabled ? state.allPlatforms : state.enabledPlatforms;
|
|
638
|
+
}
|
|
639
|
+
function resolvePlatformName(input, targetDir) {
|
|
640
|
+
if (!input)
|
|
641
|
+
return;
|
|
642
|
+
let state = getPlatformsState(targetDir), normalized = input.toLowerCase();
|
|
643
|
+
return normalized in state.defs ? normalized : state.aliasLookup[normalized];
|
|
644
|
+
}
|
|
645
|
+
function resolvePlatformKey(key, targetDir) {
|
|
646
|
+
if (!key) return null;
|
|
647
|
+
let normalized = key.toLowerCase(), state = getPlatformsState(targetDir);
|
|
648
|
+
return normalized in state.defs ? normalized : state.aliasLookup[normalized] ?? null;
|
|
649
|
+
}
|
|
650
|
+
async function detectAllPlatforms(targetDir) {
|
|
651
|
+
let state = getPlatformsState(targetDir), detectionPromises = state.enabledPlatforms.map(
|
|
652
|
+
async (platform) => {
|
|
653
|
+
let definition = state.defs[platform];
|
|
654
|
+
if (definition.detection && definition.detection.length > 0) {
|
|
655
|
+
for (let pattern of definition.detection) {
|
|
656
|
+
let testPath = join4(targetDir, pattern);
|
|
657
|
+
if (await exists(testPath))
|
|
658
|
+
return {
|
|
659
|
+
name: platform,
|
|
660
|
+
detected: !0
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
return {
|
|
664
|
+
name: platform,
|
|
665
|
+
detected: !1
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
let detected = !1;
|
|
669
|
+
if (definition.rootDir) {
|
|
670
|
+
let rootDirPath = join4(targetDir, definition.rootDir);
|
|
671
|
+
detected = await exists(rootDirPath);
|
|
672
|
+
}
|
|
673
|
+
if (!detected && definition.rootFile && definition.rootFile !== FILE_PATTERNS.AGENTS_MD) {
|
|
674
|
+
let rootFilePath = join4(targetDir, definition.rootFile);
|
|
675
|
+
detected = await exists(rootFilePath);
|
|
676
|
+
}
|
|
677
|
+
return {
|
|
678
|
+
name: platform,
|
|
679
|
+
detected
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
);
|
|
683
|
+
return await Promise.all(detectionPromises);
|
|
684
|
+
}
|
|
685
|
+
async function getDetectedPlatforms2(cwd) {
|
|
686
|
+
return (await detectAllPlatforms(cwd)).filter((result) => result.detected).map((result) => result.name);
|
|
687
|
+
}
|
|
688
|
+
function isPlatformId(value, targetDir) {
|
|
689
|
+
return value ? value in getPlatformsState(targetDir).defs : !1;
|
|
690
|
+
}
|
|
691
|
+
function inferPlatformFromWorkspaceFile(fullPath, sourceDir, registryPath, targetDir) {
|
|
692
|
+
let mapping = mapPlatformFileToUniversal(fullPath, targetDir);
|
|
693
|
+
if (mapping?.platform)
|
|
694
|
+
return mapping.platform;
|
|
695
|
+
let fromSource = getPlatformDirLookup(targetDir)[sourceDir];
|
|
696
|
+
if (fromSource)
|
|
697
|
+
return fromSource;
|
|
698
|
+
let state = getPlatformsState(targetDir);
|
|
699
|
+
for (let [platformId, def] of Object.entries(state.defs))
|
|
700
|
+
if (deriveRootDirFromFlows(def) === sourceDir)
|
|
701
|
+
return platformId;
|
|
702
|
+
let parsed = parseUniversalPath(registryPath, { allowPlatformSuffix: !0 });
|
|
703
|
+
if (parsed?.platformSuffix && isPlatformId(parsed.platformSuffix, targetDir))
|
|
704
|
+
return parsed.platformSuffix;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
export {
|
|
708
|
+
parseUniversalPath,
|
|
709
|
+
smartEquals,
|
|
710
|
+
smartNotEquals,
|
|
711
|
+
resolveSwitchExpression,
|
|
712
|
+
resolveSwitchExpressionFull,
|
|
713
|
+
validateSwitchExpression,
|
|
714
|
+
getPlatformsState,
|
|
715
|
+
getPlatformDefinitions,
|
|
716
|
+
getGlobalExportFlows,
|
|
717
|
+
getGlobalImportFlows,
|
|
718
|
+
platformUsesFlows,
|
|
719
|
+
matchesUniversalPattern,
|
|
720
|
+
getPlatformRootFiles,
|
|
721
|
+
getPlatformDefinition,
|
|
722
|
+
deriveRootDirFromFlows,
|
|
723
|
+
getAllPlatforms,
|
|
724
|
+
resolvePlatformName,
|
|
725
|
+
resolvePlatformKey,
|
|
726
|
+
getDetectedPlatforms2 as getDetectedPlatforms,
|
|
727
|
+
isPlatformId,
|
|
728
|
+
inferPlatformFromWorkspaceFile,
|
|
729
|
+
normalizePlatforms,
|
|
730
|
+
mapWorkspaceFileToUniversal
|
|
731
|
+
};
|
|
732
|
+
//# sourceMappingURL=chunk-N43IXOND.js.map
|