@powerhousedao/shared 6.2.3-staging.0 → 6.3.0-dev.1
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/dist/action-id-DON1WCeY.d.ts +19 -0
- package/dist/action-id-DON1WCeY.d.ts.map +1 -0
- package/dist/clis/args/access-token.d.mts +14 -2
- package/dist/clis/args/access-token.d.mts.map +1 -0
- package/dist/clis/args/access-token.mjs +21 -1
- package/dist/clis/args/access-token.mjs.map +1 -0
- package/dist/clis/args/{common-BXabdhiO.mjs → common-DG_SF8fN.mjs} +39 -8
- package/dist/clis/args/common-DG_SF8fN.mjs.map +1 -0
- package/dist/clis/args/{common-Bnm859xU.d.mts → common-DmerPWXo.d.mts} +8 -4
- package/dist/clis/args/common-DmerPWXo.d.mts.map +1 -0
- package/dist/clis/args/common.d.mts +1 -1
- package/dist/clis/args/common.mjs +1 -1
- package/dist/clis/args/connect.d.mts +448 -2
- package/dist/clis/args/connect.d.mts.map +1 -0
- package/dist/clis/args/connect.mjs +202 -1
- package/dist/clis/args/connect.mjs.map +1 -0
- package/dist/clis/args/{generate-BOItUNvP.mjs → generate-DMKgc6et.mjs} +2 -21
- package/dist/clis/args/generate-DMKgc6et.mjs.map +1 -0
- package/dist/clis/args/generate.d.mts +92 -2
- package/dist/clis/args/generate.d.mts.map +1 -0
- package/dist/clis/args/generate.mjs +1 -1
- package/dist/clis/args/{help-DVPTARGn.d.mts → help-BnD14eCa.d.mts} +62 -2
- package/dist/clis/args/help-BnD14eCa.d.mts.map +1 -0
- package/dist/clis/args/{help-DS1NlcJQ.mjs → help-Cjoe-b7d.mjs} +55 -15
- package/dist/clis/args/help-Cjoe-b7d.mjs.map +1 -0
- package/dist/clis/args/help.d.mts +1 -1
- package/dist/clis/args/help.mjs +16 -1
- package/dist/clis/args/host.d.mts +23 -0
- package/dist/clis/args/host.d.mts.map +1 -0
- package/dist/clis/args/host.mjs +35 -0
- package/dist/clis/args/host.mjs.map +1 -0
- package/dist/clis/args/index.d.mts +23 -19
- package/dist/clis/args/index.mjs +23 -19
- package/dist/clis/args/init.d.mts +53 -2
- package/dist/clis/args/init.d.mts.map +1 -0
- package/dist/clis/args/init.mjs +77 -1
- package/dist/clis/args/init.mjs.map +1 -0
- package/dist/clis/args/inspect.d.mts +11 -2
- package/dist/clis/args/inspect.d.mts.map +1 -0
- package/dist/clis/args/inspect.mjs +14 -1
- package/dist/clis/args/inspect.mjs.map +1 -0
- package/dist/clis/args/install.d.mts +35 -2
- package/dist/clis/args/install.d.mts.map +1 -0
- package/dist/clis/args/install.mjs +31 -1
- package/dist/clis/args/install.mjs.map +1 -0
- package/dist/clis/args/{login-CXRJXg71.d.mts → keyframes.d.mts} +13 -13
- package/dist/clis/args/keyframes.d.mts.map +1 -0
- package/dist/clis/args/keyframes.mjs +42 -0
- package/dist/clis/args/keyframes.mjs.map +1 -0
- package/dist/clis/args/list.d.mts +8 -2
- package/dist/clis/args/list.d.mts.map +1 -0
- package/dist/clis/args/list.mjs +6 -1
- package/dist/clis/args/list.mjs.map +1 -0
- package/dist/clis/args/login.d.mts +23 -2
- package/dist/clis/args/login.d.mts.map +1 -0
- package/dist/clis/args/login.mjs +39 -1
- package/dist/clis/args/login.mjs.map +1 -0
- package/dist/clis/args/{access-token-C5sKsH2O.d.mts → mcp.d.mts} +6 -7
- package/dist/clis/args/mcp.d.mts.map +1 -0
- package/dist/clis/args/mcp.mjs +22 -0
- package/dist/clis/args/mcp.mjs.map +1 -0
- package/dist/clis/args/migrate.d.mts +26 -2
- package/dist/clis/args/migrate.d.mts.map +1 -0
- package/dist/clis/args/migrate.mjs +43 -1
- package/dist/clis/args/migrate.mjs.map +1 -0
- package/dist/clis/args/{uninstall-CDx7lwxn.d.mts → model.d.mts} +28 -17
- package/dist/clis/args/model.d.mts.map +1 -0
- package/dist/clis/args/model.mjs +51 -0
- package/dist/clis/args/model.mjs.map +1 -0
- package/dist/clis/args/publish.d.mts +18 -2
- package/dist/clis/args/publish.d.mts.map +1 -0
- package/dist/clis/args/publish.mjs +26 -1
- package/dist/clis/args/publish.mjs.map +1 -0
- package/dist/clis/args/registry.d.mts +15 -2
- package/dist/clis/args/registry.d.mts.map +1 -0
- package/dist/clis/args/registry.mjs +22 -1
- package/dist/clis/args/registry.mjs.map +1 -0
- package/dist/clis/args/{unpublish-CEDsk6uv.d.mts → run.d.mts} +11 -12
- package/dist/clis/args/run.d.mts.map +1 -0
- package/dist/clis/args/run.mjs +33 -0
- package/dist/clis/args/run.mjs.map +1 -0
- package/dist/clis/args/{service-BBx5GDTc.d.mts → service-CLCvH3kf.d.mts} +4 -4
- package/dist/clis/args/service-CLCvH3kf.d.mts.map +1 -0
- package/dist/clis/args/service.d.mts +1 -1
- package/dist/clis/args/service.mjs +10 -1
- package/dist/clis/args/service.mjs.map +1 -0
- package/dist/clis/args/switchboard.d.mts +68 -2
- package/dist/clis/args/switchboard.d.mts.map +1 -0
- package/dist/clis/args/switchboard.mjs +84 -1
- package/dist/clis/args/switchboard.mjs.map +1 -0
- package/dist/clis/args/uninstall.d.mts +26 -2
- package/dist/clis/args/uninstall.d.mts.map +1 -0
- package/dist/clis/args/uninstall.mjs +15 -1
- package/dist/clis/args/uninstall.mjs.map +1 -0
- package/dist/clis/args/unpublish.d.mts +20 -2
- package/dist/clis/args/unpublish.d.mts.map +1 -0
- package/dist/clis/args/unpublish.mjs +29 -1
- package/dist/clis/args/unpublish.mjs.map +1 -0
- package/dist/clis/args/{vetra-BUNlAAPp.mjs → vetra-BqjDopAP.mjs} +18 -2
- package/dist/clis/args/vetra-BqjDopAP.mjs.map +1 -0
- package/dist/clis/args/vetra.d.mts +112 -2
- package/dist/clis/args/vetra.d.mts.map +1 -0
- package/dist/clis/args/vetra.mjs +1 -1
- package/dist/clis/{build-config-CmdMi_wu.mjs → build-config-BM1RL4u_.mjs} +87 -8
- package/dist/clis/build-config-BM1RL4u_.mjs.map +1 -0
- package/dist/clis/build-config.d.mts +26 -1
- package/dist/clis/build-config.d.mts.map +1 -1
- package/dist/clis/build-config.mjs +2 -2
- package/dist/clis/build-pieces.d.mts +71 -4
- package/dist/clis/build-pieces.d.mts.map +1 -1
- package/dist/clis/build-pieces.mjs +249 -26
- package/dist/clis/build-pieces.mjs.map +1 -1
- package/dist/clis/command-names.d.mts +3 -1
- package/dist/clis/command-names.d.mts.map +1 -1
- package/dist/clis/command-names.mjs +8 -1
- package/dist/clis/command-names.mjs.map +1 -1
- package/dist/clis/constants.d.mts +2 -2
- package/dist/clis/constants.mjs +92 -20
- package/dist/clis/constants.mjs.map +1 -1
- package/dist/clis/definition-sources.d.mts +26 -0
- package/dist/clis/definition-sources.d.mts.map +1 -0
- package/dist/clis/definition-sources.mjs +27 -0
- package/dist/clis/definition-sources.mjs.map +1 -0
- package/dist/clis/deprecations.d.mts +73 -0
- package/dist/clis/deprecations.d.mts.map +1 -0
- package/dist/clis/deprecations.mjs +121 -0
- package/dist/clis/deprecations.mjs.map +1 -0
- package/dist/clis/{index-6CZwrmQi.d.mts → index-DnZYG-8g.d.mts} +2 -2
- package/dist/clis/{index-6CZwrmQi.d.mts.map → index-DnZYG-8g.d.mts.map} +1 -1
- package/dist/clis/index.d.mts +2584 -901
- package/dist/clis/index.d.mts.map +1 -1
- package/dist/clis/index.mjs +1540 -919
- package/dist/clis/index.mjs.map +1 -1
- package/dist/clis/package-style.d.mts +32 -0
- package/dist/clis/package-style.d.mts.map +1 -0
- package/dist/clis/package-style.mjs +102 -0
- package/dist/clis/package-style.mjs.map +1 -0
- package/dist/clis/ph-dir.d.mts +26 -0
- package/dist/clis/ph-dir.d.mts.map +1 -0
- package/dist/clis/ph-dir.mjs +37 -0
- package/dist/clis/ph-dir.mjs.map +1 -0
- package/dist/clis/project-env.d.mts +6 -0
- package/dist/clis/project-env.d.mts.map +1 -1
- package/dist/clis/project-env.mjs +16 -1
- package/dist/clis/project-env.mjs.map +1 -1
- package/dist/clis/real-paths.d.mts +14 -0
- package/dist/clis/real-paths.d.mts.map +1 -0
- package/dist/clis/real-paths.mjs +36 -0
- package/dist/clis/real-paths.mjs.map +1 -0
- package/dist/clis/retired-flags.d.mts +45 -0
- package/dist/clis/retired-flags.d.mts.map +1 -0
- package/dist/clis/retired-flags.mjs +55 -0
- package/dist/clis/retired-flags.mjs.map +1 -0
- package/dist/clis/rolldown-runtime-B4iAMlE-.mjs +35 -0
- package/dist/clis/types-CZU17kAm.d.mts +2510 -0
- package/dist/clis/types-CZU17kAm.d.mts.map +1 -0
- package/dist/clis/utils.d.mts.map +1 -1
- package/dist/clis/utils.mjs.map +1 -1
- package/dist/{config-loader-C6dZB_iX.js → config-loader-B7SqNz8z.js} +24 -6
- package/dist/config-loader-B7SqNz8z.js.map +1 -0
- package/dist/connect/app-shell.d.ts +48 -0
- package/dist/connect/app-shell.d.ts.map +1 -0
- package/dist/connect/app-shell.js +90 -0
- package/dist/connect/app-shell.js.map +1 -0
- package/dist/connect/config-loader.d.ts +8 -1
- package/dist/connect/config-loader.d.ts.map +1 -1
- package/dist/connect/config-loader.js +2 -2
- package/dist/connect/connect-config-schema.d.ts +3 -0
- package/dist/connect/connect-config-schema.js +486 -0
- package/dist/connect/connect-config-schema.js.map +1 -0
- package/dist/connect/image-ref.d.ts +32 -0
- package/dist/connect/image-ref.d.ts.map +1 -0
- package/dist/connect/image-ref.js +80 -0
- package/dist/connect/image-ref.js.map +1 -0
- package/dist/connect/index.d.ts +84 -635
- package/dist/connect/index.d.ts.map +1 -1
- package/dist/connect/index.js +216 -553
- package/dist/connect/index.js.map +1 -1
- package/dist/connect/origin-placeholder.d.ts +52 -0
- package/dist/connect/origin-placeholder.d.ts.map +1 -0
- package/dist/connect/origin-placeholder.js +101 -0
- package/dist/connect/origin-placeholder.js.map +1 -0
- package/dist/connect-config-schema-cBfkNo1b.d.ts +1872 -0
- package/dist/connect-config-schema-cBfkNo1b.d.ts.map +1 -0
- package/dist/constants-5UFY_rXh.d.ts +9 -0
- package/dist/constants-5UFY_rXh.d.ts.map +1 -0
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +22 -6
- package/dist/constants.js.map +1 -1
- package/dist/document-drive/index.d.ts +3 -4
- package/dist/document-drive/index.d.ts.map +1 -1
- package/dist/document-drive/index.js +2 -13
- package/dist/document-drive/index.js.map +1 -1
- package/dist/document-model/action-id.d.ts +3 -0
- package/dist/document-model/action-id.js +59 -0
- package/dist/document-model/action-id.js.map +1 -0
- package/dist/document-model/dispatch.d.ts +25 -0
- package/dist/document-model/dispatch.d.ts.map +1 -0
- package/dist/document-model/dispatch.js +0 -0
- package/dist/document-model/errors.d.ts +3 -0
- package/dist/document-model/errors.js +214 -0
- package/dist/document-model/errors.js.map +1 -0
- package/dist/document-model/index.d.ts +5 -4
- package/dist/document-model/index.js +7 -5521
- package/dist/document-model/utils.d.ts +3 -2
- package/dist/document-model/utils.js +3 -2
- package/dist/document-model/version.d.ts +3 -0
- package/dist/document-model/version.js +8 -0
- package/dist/document-model/version.js.map +1 -0
- package/dist/document-model-CqySIaKV.js +5805 -0
- package/dist/document-model-CqySIaKV.js.map +1 -0
- package/dist/host-tokens/index.d.ts +3 -0
- package/dist/host-tokens/index.js +2 -0
- package/dist/host-tokens-DOeyxqLi.js +322 -0
- package/dist/host-tokens-DOeyxqLi.js.map +1 -0
- package/dist/{index-5gwOhPG5.d.ts → index-CUZ8eWun.d.ts} +2 -2
- package/dist/{index-5gwOhPG5.d.ts.map → index-CUZ8eWun.d.ts.map} +1 -1
- package/dist/index-D58WVj_E.d.ts +246 -0
- package/dist/index-D58WVj_E.d.ts.map +1 -0
- package/dist/index.d.ts +5 -5
- package/dist/processors/index.d.ts +2 -2
- package/dist/processors/index.js +177 -68
- package/dist/processors/index.js.map +1 -1
- package/dist/processors/testing.d.ts +22 -0
- package/dist/processors/testing.d.ts.map +1 -0
- package/dist/processors/testing.js +77 -0
- package/dist/processors/testing.js.map +1 -0
- package/dist/purge-CbAV5DVh.js +631 -0
- package/dist/purge-CbAV5DVh.js.map +1 -0
- package/dist/registry/index.d.ts +3 -3
- package/dist/registry/index.js +52 -9
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/manifest-slim.d.ts +2 -2
- package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/types-CV2j3BvH.d.ts +5709 -0
- package/dist/types-CV2j3BvH.d.ts.map +1 -0
- package/dist/{types-CI3ren9F.d.ts → types-D_6ZcaJj.d.ts} +20 -12
- package/dist/types-D_6ZcaJj.d.ts.map +1 -0
- package/dist/{utils-CSF716ux.js → utils-DiV32YIj.js} +45 -2
- package/dist/utils-DiV32YIj.js.map +1 -0
- package/dist/utils-MrLmLEVr.js +78 -0
- package/dist/utils-MrLmLEVr.js.map +1 -0
- package/dist/version-BxLITo9P.d.ts +6 -0
- package/dist/version-BxLITo9P.d.ts.map +1 -0
- package/package.json +37 -3
- package/dist/clis/args/access-token-3Hqv_U8I.mjs +0 -22
- package/dist/clis/args/access-token-3Hqv_U8I.mjs.map +0 -1
- package/dist/clis/args/access-token-C5sKsH2O.d.mts.map +0 -1
- package/dist/clis/args/common-BXabdhiO.mjs.map +0 -1
- package/dist/clis/args/common-Bnm859xU.d.mts.map +0 -1
- package/dist/clis/args/connect-BG3HkYBk.mjs +0 -203
- package/dist/clis/args/connect-BG3HkYBk.mjs.map +0 -1
- package/dist/clis/args/connect-DjeiqXus.d.mts +0 -450
- package/dist/clis/args/connect-DjeiqXus.d.mts.map +0 -1
- package/dist/clis/args/generate-BOItUNvP.mjs.map +0 -1
- package/dist/clis/args/generate-BPBBLeUD.d.mts +0 -103
- package/dist/clis/args/generate-BPBBLeUD.d.mts.map +0 -1
- package/dist/clis/args/help-DS1NlcJQ.mjs.map +0 -1
- package/dist/clis/args/help-DVPTARGn.d.mts.map +0 -1
- package/dist/clis/args/init-CFeTq4Cq.d.mts +0 -52
- package/dist/clis/args/init-CFeTq4Cq.d.mts.map +0 -1
- package/dist/clis/args/init-Dvb42Y87.mjs +0 -67
- package/dist/clis/args/init-Dvb42Y87.mjs.map +0 -1
- package/dist/clis/args/inspect-BjRmtB86.d.mts +0 -13
- package/dist/clis/args/inspect-BjRmtB86.d.mts.map +0 -1
- package/dist/clis/args/inspect-UNQgtuR0.mjs +0 -15
- package/dist/clis/args/inspect-UNQgtuR0.mjs.map +0 -1
- package/dist/clis/args/install-B0tMyUMw.d.mts +0 -37
- package/dist/clis/args/install-B0tMyUMw.d.mts.map +0 -1
- package/dist/clis/args/install-F-27kF6m.mjs +0 -32
- package/dist/clis/args/install-F-27kF6m.mjs.map +0 -1
- package/dist/clis/args/list-Bkfn8Yuo.mjs +0 -7
- package/dist/clis/args/list-Bkfn8Yuo.mjs.map +0 -1
- package/dist/clis/args/list-DrbxA7JJ.d.mts +0 -10
- package/dist/clis/args/list-DrbxA7JJ.d.mts.map +0 -1
- package/dist/clis/args/login-CIFkQExi.mjs +0 -40
- package/dist/clis/args/login-CIFkQExi.mjs.map +0 -1
- package/dist/clis/args/login-CXRJXg71.d.mts.map +0 -1
- package/dist/clis/args/magic-string.es-BWtG0AyA.mjs +0 -1019
- package/dist/clis/args/magic-string.es-BWtG0AyA.mjs.map +0 -1
- package/dist/clis/args/migrate-DkCQRL2D.d.mts +0 -19
- package/dist/clis/args/migrate-DkCQRL2D.d.mts.map +0 -1
- package/dist/clis/args/migrate-DwJGhc2d.mjs +0 -29
- package/dist/clis/args/migrate-DwJGhc2d.mjs.map +0 -1
- package/dist/clis/args/publish-CeW4bOrl.d.mts +0 -16
- package/dist/clis/args/publish-CeW4bOrl.d.mts.map +0 -1
- package/dist/clis/args/publish-DHqlGWmL.mjs +0 -19
- package/dist/clis/args/publish-DHqlGWmL.mjs.map +0 -1
- package/dist/clis/args/registry-DIwES3l2.mjs +0 -23
- package/dist/clis/args/registry-DIwES3l2.mjs.map +0 -1
- package/dist/clis/args/registry-DNH8xuaE.d.mts +0 -17
- package/dist/clis/args/registry-DNH8xuaE.d.mts.map +0 -1
- package/dist/clis/args/service-BBx5GDTc.d.mts.map +0 -1
- package/dist/clis/args/service-Cpjlyeu5.mjs +0 -11
- package/dist/clis/args/service-Cpjlyeu5.mjs.map +0 -1
- package/dist/clis/args/switchboard-CCaAtU56.mjs +0 -85
- package/dist/clis/args/switchboard-CCaAtU56.mjs.map +0 -1
- package/dist/clis/args/switchboard-RrNb1fUH.d.mts +0 -70
- package/dist/clis/args/switchboard-RrNb1fUH.d.mts.map +0 -1
- package/dist/clis/args/uninstall-3U0B8g5c.mjs +0 -16
- package/dist/clis/args/uninstall-3U0B8g5c.mjs.map +0 -1
- package/dist/clis/args/uninstall-CDx7lwxn.d.mts.map +0 -1
- package/dist/clis/args/unpublish-CEDsk6uv.d.mts.map +0 -1
- package/dist/clis/args/unpublish-s9zUh6Gw.mjs +0 -30
- package/dist/clis/args/unpublish-s9zUh6Gw.mjs.map +0 -1
- package/dist/clis/args/vetra-BUNlAAPp.mjs.map +0 -1
- package/dist/clis/args/vetra-DkDaWFPi.d.mts +0 -111
- package/dist/clis/args/vetra-DkDaWFPi.d.mts.map +0 -1
- package/dist/clis/args/vetra-ports.test.d.mts +0 -2
- package/dist/clis/args/vetra-ports.test.mjs +0 -13354
- package/dist/clis/args/vetra-ports.test.mjs.map +0 -1
- package/dist/clis/build-config-CmdMi_wu.mjs.map +0 -1
- package/dist/clis/types-nzer4WIr.d.mts +0 -541
- package/dist/clis/types-nzer4WIr.d.mts.map +0 -1
- package/dist/config-loader-C6dZB_iX.js.map +0 -1
- package/dist/constants-DO4IYxuR.d.ts +0 -9
- package/dist/constants-DO4IYxuR.d.ts.map +0 -1
- package/dist/document-model/index.js.map +0 -1
- package/dist/index-D6833Siv.d.ts +0 -939
- package/dist/index-D6833Siv.d.ts.map +0 -1
- package/dist/types-CI3ren9F.d.ts.map +0 -1
- package/dist/types-CmeoQg_J.d.ts +0 -3337
- package/dist/types-CmeoQg_J.d.ts.map +0 -1
- package/dist/utils-BrKxCmKx.d.ts +0 -18
- package/dist/utils-BrKxCmKx.d.ts.map +0 -1
- package/dist/utils-CSF716ux.js.map +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region clis/package-style.d.ts
|
|
2
|
+
/** The imports at the top of a project's style.css, which `ph migrate` keeps current. */
|
|
3
|
+
export declare const STYLE_IMPORT_LINES: string[];
|
|
4
|
+
/** The empty @theme block the style.css template used to end with. */
|
|
5
|
+
export declare const LEGACY_THEME_LINES: string[];
|
|
6
|
+
/** The default host's stylesheet, beside hosts/connect/routes. */
|
|
7
|
+
export declare const HOST_STYLESHEET = "hosts/connect/style.css";
|
|
8
|
+
export declare const TAILWIND_IMPORT: RegExp;
|
|
9
|
+
export declare function projectStyle(current: string, localPackages?: readonly string[]): {
|
|
10
|
+
tailwind: string | undefined;
|
|
11
|
+
rest: string;
|
|
12
|
+
};
|
|
13
|
+
export type PackageStyleOptions = {
|
|
14
|
+
/** The package's browser build, relative to the project. */
|
|
15
|
+
browserDir: string;
|
|
16
|
+
/** The project's local packages, whose old style.css imports are dropped. */
|
|
17
|
+
localPackages?: readonly string[];
|
|
18
|
+
/** The theme the classes build against, by reference: Connect's by default. */
|
|
19
|
+
references?: readonly string[];
|
|
20
|
+
};
|
|
21
|
+
/** What `ph build` compiles to a package's stylesheet: the classes in the
|
|
22
|
+
* package's browser build, and the project's own tokens and rules, with
|
|
23
|
+
* Tailwind's and Connect's theme by reference, so not emitted. */
|
|
24
|
+
export declare function packageStyleEntry(current: string | undefined, { browserDir, localPackages, references }: PackageStyleOptions): string;
|
|
25
|
+
/** The compiled entry in the external-packages layer, between Connect's
|
|
26
|
+
* components and utilities, whichever of Connect's stylesheets loads first. */
|
|
27
|
+
export declare function packageStylesheet(compiled: string): string;
|
|
28
|
+
/** The project's `provider: "local"` packages, from powerhouse.config.json. */
|
|
29
|
+
export declare function localPackageNames(projectDir: string): string[];
|
|
30
|
+
//#endregion
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=package-style.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-style.d.mts","names":[],"sources":["../../clis/package-style.ts"],"mappings":";;qBAOa;;qBASA;;qBAWA;qBAYA,iBAAe;wBAqBZ,aACd,iBACA;;;;YAiCU;;EAEV;;EAEA;;EAEA;;;;;wBAMc,kBACd,+BAEE,YACA,eACA,cACC;;;wBAmBW,kBAAkB;;wBAMlB,kBAAkB"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
+
//#region connect/layers.ts
|
|
4
|
+
/** Connect's cascade layers, Tailwind's `properties` first: package CSS goes in
|
|
5
|
+
* external-packages, above Connect's reset and below its utilities. */
|
|
6
|
+
const CONNECT_LAYER_ORDER = "@layer properties, theme, base, components, external-packages, utilities;";
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region clis/package-style.ts
|
|
9
|
+
/** The imports at the top of a project's style.css, which `ph migrate` keeps current. */
|
|
10
|
+
const STYLE_IMPORT_LINES = [
|
|
11
|
+
"/* Package CSS goes in external-packages, between Connect's components and utilities. */",
|
|
12
|
+
CONNECT_LAYER_ORDER,
|
|
13
|
+
"@import \"tailwindcss\";",
|
|
14
|
+
"/* Connect's tokens, rules and classes, generated in this one build. */",
|
|
15
|
+
"@import \"@powerhousedao/connect/tailwind.css\";"
|
|
16
|
+
];
|
|
17
|
+
/** The empty @theme block the style.css template used to end with. */
|
|
18
|
+
const LEGACY_THEME_LINES = [
|
|
19
|
+
"@theme {",
|
|
20
|
+
"/* You can customize the theme by overriding the theme variables here */",
|
|
21
|
+
"/* See https://tailwindcss.com/docs/theme#using-a-custom-theme for details */",
|
|
22
|
+
"/* If you would prefer to use plain css, add your styles below this @theme tag as you normally would */",
|
|
23
|
+
"/* A sensible CSS reset is applied by default. If you would prefer to use a different reset or none at all, uncomment the following line */",
|
|
24
|
+
"/* --*: initial; */",
|
|
25
|
+
"}"
|
|
26
|
+
];
|
|
27
|
+
/** The default host's stylesheet, beside hosts/connect/routes. */
|
|
28
|
+
const HOST_STYLESHEET = "hosts/connect/style.css";
|
|
29
|
+
const MANAGED_LINES = [
|
|
30
|
+
/^@layer (properties, )?theme, base, components\b.*;$/,
|
|
31
|
+
/^@import ["']@powerhousedao\/design-system\/(theme|style)\.css["'];$/,
|
|
32
|
+
/^@import ["']@powerhousedao\/connect\/(style|tailwind)\.css["'];$/,
|
|
33
|
+
/^@custom-variant dark \(&:where\(\.dark, \.dark \*\)\);$/
|
|
34
|
+
];
|
|
35
|
+
const PACKAGE_BUILD_IMPORT = /^@import ["']\.\/node_modules\/(.+)\/dist\/style\.css["'];$/;
|
|
36
|
+
const TAILWIND_IMPORT = /^@import ["']tailwindcss["'].*;$/;
|
|
37
|
+
const TEMPLATE_LINES = new Set(STYLE_IMPORT_LINES);
|
|
38
|
+
function withoutLegacyTheme(kept) {
|
|
39
|
+
const filled = kept.flatMap((line, i) => line.trim() ? [i] : []);
|
|
40
|
+
for (let start = 0; start + LEGACY_THEME_LINES.length <= filled.length; start++) {
|
|
41
|
+
const block = filled.slice(start, start + LEGACY_THEME_LINES.length);
|
|
42
|
+
if (block.every((i, n) => kept[i].trim() === LEGACY_THEME_LINES[n])) return [...kept.slice(0, block[0]), ...kept.slice(block.at(-1) + 1)];
|
|
43
|
+
}
|
|
44
|
+
return kept;
|
|
45
|
+
}
|
|
46
|
+
function projectStyle(current, localPackages = []) {
|
|
47
|
+
let tailwind;
|
|
48
|
+
const kept = current.split("\n").filter((line) => {
|
|
49
|
+
const trimmed = line.trim();
|
|
50
|
+
if (TAILWIND_IMPORT.test(trimmed)) {
|
|
51
|
+
tailwind ??= trimmed;
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
const packageBuild = PACKAGE_BUILD_IMPORT.exec(trimmed)?.[1];
|
|
55
|
+
return !TEMPLATE_LINES.has(trimmed) && !MANAGED_LINES.some((pattern) => pattern.test(trimmed)) && !(packageBuild && localPackages.includes(packageBuild));
|
|
56
|
+
});
|
|
57
|
+
return {
|
|
58
|
+
tailwind,
|
|
59
|
+
rest: withoutLegacyTheme(kept).join("\n").trim()
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function tailwindOptions(tailwind) {
|
|
63
|
+
if (!tailwind) return "";
|
|
64
|
+
const options = tailwind.replace(/^@import ["']tailwindcss["']/, "").replace(/;$/, "").replace(/\b(source|theme)\([^)]*\)/g, "").trim().replace(/\s+/g, " ");
|
|
65
|
+
return options ? ` ${options}` : "";
|
|
66
|
+
}
|
|
67
|
+
/** What `ph build` compiles to a package's stylesheet: the classes in the
|
|
68
|
+
* package's browser build, and the project's own tokens and rules, with
|
|
69
|
+
* Tailwind's and Connect's theme by reference, so not emitted. */
|
|
70
|
+
function packageStyleEntry(current, { browserDir, localPackages, references = ["@powerhousedao/connect/theme.css"] }) {
|
|
71
|
+
const { tailwind, rest } = projectStyle(current ?? "", localPackages);
|
|
72
|
+
const options = tailwindOptions(tailwind);
|
|
73
|
+
return `${[
|
|
74
|
+
`@import "tailwindcss/theme.css" theme(reference)${options};`,
|
|
75
|
+
...references.map((file) => `@reference ${JSON.stringify(file)};`),
|
|
76
|
+
`@import "tailwindcss/utilities.css" source(none)${options};`,
|
|
77
|
+
`@source ${JSON.stringify(browserDir)};`,
|
|
78
|
+
`@source not ${JSON.stringify(`${browserDir}/**/*.map`)};`,
|
|
79
|
+
rest
|
|
80
|
+
].join("\n")}\n`;
|
|
81
|
+
}
|
|
82
|
+
const BANNER = /^\/\*! tailwindcss v[^*]*\*\/\s*/;
|
|
83
|
+
/** The compiled entry in the external-packages layer, between Connect's
|
|
84
|
+
* components and utilities, whichever of Connect's stylesheets loads first. */
|
|
85
|
+
function packageStylesheet(compiled) {
|
|
86
|
+
const css = compiled.replace(BANNER, "").trim();
|
|
87
|
+
return `${CONNECT_LAYER_ORDER}\n@layer external-packages{${css}}\n`;
|
|
88
|
+
}
|
|
89
|
+
/** The project's `provider: "local"` packages, from powerhouse.config.json. */
|
|
90
|
+
function localPackageNames(projectDir) {
|
|
91
|
+
const file = join(projectDir, "powerhouse.config.json");
|
|
92
|
+
if (!existsSync(file)) return [];
|
|
93
|
+
try {
|
|
94
|
+
return (JSON.parse(readFileSync(file, "utf8")).packages ?? []).flatMap((p) => p.provider === "local" && typeof p.packageName === "string" ? [p.packageName] : []);
|
|
95
|
+
} catch {
|
|
96
|
+
return [];
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
100
|
+
export { HOST_STYLESHEET, LEGACY_THEME_LINES, STYLE_IMPORT_LINES, TAILWIND_IMPORT, localPackageNames, packageStyleEntry, packageStylesheet, projectStyle };
|
|
101
|
+
|
|
102
|
+
//# sourceMappingURL=package-style.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-style.mjs","names":[],"sources":["../../connect/layers.ts","../../clis/package-style.ts"],"sourcesContent":["/** Connect's cascade layers, Tailwind's `properties` first: package CSS goes in\n * external-packages, above Connect's reset and below its utilities. */\nexport const CONNECT_LAYER_ORDER =\n \"@layer properties, theme, base, components, external-packages, utilities;\";\n","// style.css's managed lines, and the package stylesheet `ph build` compiles from\n// it. Kept light: ph build imports this, and ph migrate (codegen) shares it.\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { CONNECT_LAYER_ORDER } from \"../connect/layers.js\";\n\n/** The imports at the top of a project's style.css, which `ph migrate` keeps current. */\nexport const STYLE_IMPORT_LINES = [\n \"/* Package CSS goes in external-packages, between Connect's components and utilities. */\",\n CONNECT_LAYER_ORDER,\n '@import \"tailwindcss\";',\n \"/* Connect's tokens, rules and classes, generated in this one build. */\",\n '@import \"@powerhousedao/connect/tailwind.css\";',\n];\n\n/** The empty @theme block the style.css template used to end with. */\nexport const LEGACY_THEME_LINES = [\n \"@theme {\",\n \"/* You can customize the theme by overriding the theme variables here */\",\n \"/* See https://tailwindcss.com/docs/theme#using-a-custom-theme for details */\",\n \"/* If you would prefer to use plain css, add your styles below this @theme tag as you normally would */\",\n \"/* A sensible CSS reset is applied by default. If you would prefer to use a different reset or none at all, uncomment the following line */\",\n \"/* --*: initial; */\",\n \"}\",\n];\n\n/** The default host's stylesheet, beside hosts/connect/routes. */\nexport const HOST_STYLESHEET = \"hosts/connect/style.css\";\n\n// Connect's stylesheet imports, current and past; the template's own lines too.\nconst MANAGED_LINES = [\n /^@layer (properties, )?theme, base, components\\b.*;$/,\n /^@import [\"']@powerhousedao\\/design-system\\/(theme|style)\\.css[\"'];$/,\n /^@import [\"']@powerhousedao\\/connect\\/(style|tailwind)\\.css[\"'];$/,\n /^@custom-variant dark \\(&:where\\(\\.dark, \\.dark \\*\\)\\);$/,\n];\n// A package's full build, which `ph install --local` used to add.\nconst PACKAGE_BUILD_IMPORT =\n /^@import [\"']\\.\\/node_modules\\/(.+)\\/dist\\/style\\.css[\"'];$/;\nexport const TAILWIND_IMPORT = /^@import [\"']tailwindcss[\"'].*;$/;\nconst TEMPLATE_LINES = new Set(STYLE_IMPORT_LINES);\n\n// `kept` without the old template's empty @theme block, matched line by line.\nfunction withoutLegacyTheme(kept: string[]) {\n const filled = kept.flatMap((line, i) => (line.trim() ? [i] : []));\n for (\n let start = 0;\n start + LEGACY_THEME_LINES.length <= filled.length;\n start++\n ) {\n const block = filled.slice(start, start + LEGACY_THEME_LINES.length);\n if (block.every((i, n) => kept[i].trim() === LEGACY_THEME_LINES[n])) {\n return [...kept.slice(0, block[0]), ...kept.slice(block.at(-1)! + 1)];\n }\n }\n return kept;\n}\n\n// The project's own lines, and its tailwindcss import if it has one. Imports of\n// its local packages' builds go; other node_modules CSS stays.\nexport function projectStyle(\n current: string,\n localPackages: readonly string[] = [],\n) {\n let tailwind: string | undefined;\n const kept = current.split(\"\\n\").filter((line) => {\n const trimmed = line.trim();\n if (TAILWIND_IMPORT.test(trimmed)) {\n // A project's `source(...)` or `prefix(...)` options stay.\n tailwind ??= trimmed;\n return false;\n }\n const packageBuild = PACKAGE_BUILD_IMPORT.exec(trimmed)?.[1];\n return (\n !TEMPLATE_LINES.has(trimmed) &&\n !MANAGED_LINES.some((pattern) => pattern.test(trimmed)) &&\n !(packageBuild && localPackages.includes(packageBuild))\n );\n });\n return { tailwind, rest: withoutLegacyTheme(kept).join(\"\\n\").trim() };\n}\n\n// Options of the project's `@import \"tailwindcss\"` that the package build keeps:\n// not source(), which it replaces, nor theme(), which clashes with theme(reference).\nfunction tailwindOptions(tailwind: string | undefined) {\n if (!tailwind) return \"\";\n const options = tailwind\n .replace(/^@import [\"']tailwindcss[\"']/, \"\")\n .replace(/;$/, \"\")\n .replace(/\\b(source|theme)\\([^)]*\\)/g, \"\")\n .trim()\n .replace(/\\s+/g, \" \");\n return options ? ` ${options}` : \"\";\n}\n\nexport type PackageStyleOptions = {\n /** The package's browser build, relative to the project. */\n browserDir: string;\n /** The project's local packages, whose old style.css imports are dropped. */\n localPackages?: readonly string[];\n /** The theme the classes build against, by reference: Connect's by default. */\n references?: readonly string[];\n};\n\n/** What `ph build` compiles to a package's stylesheet: the classes in the\n * package's browser build, and the project's own tokens and rules, with\n * Tailwind's and Connect's theme by reference, so not emitted. */\nexport function packageStyleEntry(\n current: string | undefined,\n {\n browserDir,\n localPackages,\n references = [\"@powerhousedao/connect/theme.css\"],\n }: PackageStyleOptions,\n): string {\n const { tailwind, rest } = projectStyle(current ?? \"\", localPackages);\n const options = tailwindOptions(tailwind);\n return `${[\n `@import \"tailwindcss/theme.css\" theme(reference)${options};`,\n ...references.map((file) => `@reference ${JSON.stringify(file)};`),\n `@import \"tailwindcss/utilities.css\" source(none)${options};`,\n `@source ${JSON.stringify(browserDir)};`,\n // Source maps carry the sources the bundle left out.\n `@source not ${JSON.stringify(`${browserDir}/**/*.map`)};`,\n rest,\n ].join(\"\\n\")}\\n`;\n}\n\nconst BANNER = /^\\/\\*! tailwindcss v[^*]*\\*\\/\\s*/;\n\n/** The compiled entry in the external-packages layer, between Connect's\n * components and utilities, whichever of Connect's stylesheets loads first. */\nexport function packageStylesheet(compiled: string): string {\n const css = compiled.replace(BANNER, \"\").trim();\n return `${CONNECT_LAYER_ORDER}\\n@layer external-packages{${css}}\\n`;\n}\n\n/** The project's `provider: \"local\"` packages, from powerhouse.config.json. */\nexport function localPackageNames(projectDir: string): string[] {\n const file = join(projectDir, \"powerhouse.config.json\");\n if (!existsSync(file)) return [];\n try {\n const config = JSON.parse(readFileSync(file, \"utf8\")) as {\n packages?: { packageName?: unknown; provider?: unknown }[];\n };\n return (config.packages ?? []).flatMap((p) =>\n p.provider === \"local\" && typeof p.packageName === \"string\"\n ? [p.packageName]\n : [],\n );\n } catch {\n return [];\n }\n}\n"],"mappings":";;;;;AAEA,MAAa,sBACX;;;;ACIF,MAAa,qBAAqB;CAChC;CACA;CACA;CACA;CACA;AACF;;AAGA,MAAa,qBAAqB;CAChC;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;AAGA,MAAa,kBAAkB;AAG/B,MAAM,gBAAgB;CACpB;CACA;CACA;CACA;AACF;AAEA,MAAM,uBACJ;AACF,MAAa,kBAAkB;AAC/B,MAAM,iBAAiB,IAAI,IAAI,kBAAkB;AAGjD,SAAS,mBAAmB,MAAgB;CAC1C,MAAM,SAAS,KAAK,SAAS,MAAM,MAAO,KAAK,KAAK,IAAI,CAAC,CAAC,IAAI,CAAC,CAAE;CACjE,KACE,IAAI,QAAQ,GACZ,QAAQ,mBAAmB,UAAU,OAAO,QAC5C,SACA;EACA,MAAM,QAAQ,OAAO,MAAM,OAAO,QAAQ,mBAAmB,MAAM;EACnE,IAAI,MAAM,OAAO,GAAG,MAAM,KAAK,EAAE,CAAC,KAAK,MAAM,mBAAmB,EAAE,GAChE,OAAO,CAAC,GAAG,KAAK,MAAM,GAAG,MAAM,EAAE,GAAG,GAAG,KAAK,MAAM,MAAM,GAAG,EAAE,IAAK,CAAC,CAAC;CAExE;CACA,OAAO;AACT;AAIA,SAAgB,aACd,SACA,gBAAmC,CAAC,GACpC;CACA,IAAI;CACJ,MAAM,OAAO,QAAQ,MAAM,IAAI,CAAC,CAAC,QAAQ,SAAS;EAChD,MAAM,UAAU,KAAK,KAAK;EAC1B,IAAI,gBAAgB,KAAK,OAAO,GAAG;GAEjC,aAAa;GACb,OAAO;EACT;EACA,MAAM,eAAe,qBAAqB,KAAK,OAAO,CAAC,GAAG;EAC1D,OACE,CAAC,eAAe,IAAI,OAAO,KAC3B,CAAC,cAAc,MAAM,YAAY,QAAQ,KAAK,OAAO,CAAC,KACtD,EAAE,gBAAgB,cAAc,SAAS,YAAY;CAEzD,CAAC;CACD,OAAO;EAAE;EAAU,MAAM,mBAAmB,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK;CAAE;AACtE;AAIA,SAAS,gBAAgB,UAA8B;CACrD,IAAI,CAAC,UAAU,OAAO;CACtB,MAAM,UAAU,SACb,QAAQ,gCAAgC,EAAE,CAAC,CAC3C,QAAQ,MAAM,EAAE,CAAC,CACjB,QAAQ,8BAA8B,EAAE,CAAC,CACzC,KAAK,CAAC,CACN,QAAQ,QAAQ,GAAG;CACtB,OAAO,UAAU,IAAI,YAAY;AACnC;;;;AAcA,SAAgB,kBACd,SACA,EACE,YACA,eACA,aAAa,CAAC,kCAAkC,KAE1C;CACR,MAAM,EAAE,UAAU,SAAS,aAAa,WAAW,IAAI,aAAa;CACpE,MAAM,UAAU,gBAAgB,QAAQ;CACxC,OAAO,GAAG;EACR,mDAAmD,QAAQ;EAC3D,GAAG,WAAW,KAAK,SAAS,cAAc,KAAK,UAAU,IAAI,EAAE,EAAE;EACjE,mDAAmD,QAAQ;EAC3D,WAAW,KAAK,UAAU,UAAU,EAAE;EAEtC,eAAe,KAAK,UAAU,GAAG,WAAW,UAAU,EAAE;EACxD;CACF,CAAC,CAAC,KAAK,IAAI,EAAE;AACf;AAEA,MAAM,SAAS;;;AAIf,SAAgB,kBAAkB,UAA0B;CAC1D,MAAM,MAAM,SAAS,QAAQ,QAAQ,EAAE,CAAC,CAAC,KAAK;CAC9C,OAAO,GAAG,oBAAoB,6BAA6B,IAAI;AACjE;;AAGA,SAAgB,kBAAkB,YAA8B;CAC9D,MAAM,OAAO,KAAK,YAAY,wBAAwB;CACtD,IAAI,CAAC,WAAW,IAAI,GAAG,OAAO,CAAC;CAC/B,IAAI;EAIF,QAHe,KAAK,MAAM,aAAa,MAAM,MAAM,CAGtC,CAAC,CAAC,YAAY,CAAC,EAAA,CAAG,SAAS,MACtC,EAAE,aAAa,WAAW,OAAO,EAAE,gBAAgB,WAC/C,CAAC,EAAE,WAAW,IACd,CAAC,CACP;CACF,QAAQ;EACN,OAAO,CAAC;CACV;AACF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//#region clis/ph-dir.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The project's `.ph` tree — stores, identity, run records, registry cache.
|
|
4
|
+
*
|
|
5
|
+
* Classically `<cwd>/.ph` (every classic command resolves it exactly so). A
|
|
6
|
+
* desktop shell relocates the WHOLE tree under the user's profile by setting
|
|
7
|
+
* `PH_USER_DATA_DIR`: the tree is then `${userData}/.ph`, the same names
|
|
8
|
+
* under a different root, and nothing of the user's lands in the install
|
|
9
|
+
* dir. One resolver replaces the former `.ph/...` literals; it adds no path
|
|
10
|
+
* names and no layout of its own.
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolvePhDir(base?: string, env?: Record<string, string | undefined>): string;
|
|
13
|
+
/**
|
|
14
|
+
* The two PGlite store dirs the switchboard defaults to, for the server and
|
|
15
|
+
* for `ph switchboard --reset` (which must touch the same paths). Without a
|
|
16
|
+
* user-data root these are the classic literals, verbatim — byte-identical
|
|
17
|
+
* to every classic boot log and reset prompt. Under PH_USER_DATA_DIR they
|
|
18
|
+
* are the same names inside `${userData}/.ph`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function defaultStoreDirs(env?: Record<string, string | undefined>, phDir?: string): {
|
|
21
|
+
reactor: string;
|
|
22
|
+
readModel: string;
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=ph-dir.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ph-dir.d.mts","names":[],"sources":["../../clis/ph-dir.ts"],"mappings":";;;;;;;;;;;wBAYgB,aACd,eACA,MAAK;;;;;;;;wBAYS,iBACd,MAAK,oCACL;EACG;EAAiB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
//#region clis/ph-dir.ts
|
|
3
|
+
/**
|
|
4
|
+
* The project's `.ph` tree — stores, identity, run records, registry cache.
|
|
5
|
+
*
|
|
6
|
+
* Classically `<cwd>/.ph` (every classic command resolves it exactly so). A
|
|
7
|
+
* desktop shell relocates the WHOLE tree under the user's profile by setting
|
|
8
|
+
* `PH_USER_DATA_DIR`: the tree is then `${userData}/.ph`, the same names
|
|
9
|
+
* under a different root, and nothing of the user's lands in the install
|
|
10
|
+
* dir. One resolver replaces the former `.ph/...` literals; it adds no path
|
|
11
|
+
* names and no layout of its own.
|
|
12
|
+
*/
|
|
13
|
+
function resolvePhDir(base = process.cwd(), env = process.env) {
|
|
14
|
+
return path.join(env.PH_USER_DATA_DIR ?? base, ".ph");
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The two PGlite store dirs the switchboard defaults to, for the server and
|
|
18
|
+
* for `ph switchboard --reset` (which must touch the same paths). Without a
|
|
19
|
+
* user-data root these are the classic literals, verbatim — byte-identical
|
|
20
|
+
* to every classic boot log and reset prompt. Under PH_USER_DATA_DIR they
|
|
21
|
+
* are the same names inside `${userData}/.ph`.
|
|
22
|
+
*/
|
|
23
|
+
function defaultStoreDirs(env = process.env, phDir) {
|
|
24
|
+
const root = phDir ?? (env.PH_USER_DATA_DIR ? resolvePhDir(void 0, env) : void 0);
|
|
25
|
+
if (root === void 0) return {
|
|
26
|
+
reactor: "./.ph/reactor-storage",
|
|
27
|
+
readModel: ".ph/read-storage"
|
|
28
|
+
};
|
|
29
|
+
return {
|
|
30
|
+
reactor: path.join(root, "reactor-storage"),
|
|
31
|
+
readModel: path.join(root, "read-storage")
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { defaultStoreDirs, resolvePhDir };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=ph-dir.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ph-dir.mjs","names":[],"sources":["../../clis/ph-dir.ts"],"sourcesContent":["import path from \"node:path\";\n\n/**\n * The project's `.ph` tree — stores, identity, run records, registry cache.\n *\n * Classically `<cwd>/.ph` (every classic command resolves it exactly so). A\n * desktop shell relocates the WHOLE tree under the user's profile by setting\n * `PH_USER_DATA_DIR`: the tree is then `${userData}/.ph`, the same names\n * under a different root, and nothing of the user's lands in the install\n * dir. One resolver replaces the former `.ph/...` literals; it adds no path\n * names and no layout of its own.\n */\nexport function resolvePhDir(\n base: string = process.cwd(),\n env: Record<string, string | undefined> = process.env,\n): string {\n return path.join(env.PH_USER_DATA_DIR ?? base, \".ph\");\n}\n\n/**\n * The two PGlite store dirs the switchboard defaults to, for the server and\n * for `ph switchboard --reset` (which must touch the same paths). Without a\n * user-data root these are the classic literals, verbatim — byte-identical\n * to every classic boot log and reset prompt. Under PH_USER_DATA_DIR they\n * are the same names inside `${userData}/.ph`.\n */\nexport function defaultStoreDirs(\n env: Record<string, string | undefined> = process.env,\n phDir?: string,\n): { reactor: string; readModel: string } {\n const root =\n phDir ?? (env.PH_USER_DATA_DIR ? resolvePhDir(undefined, env) : undefined);\n if (root === undefined) {\n return { reactor: \"./.ph/reactor-storage\", readModel: \".ph/read-storage\" };\n }\n return {\n reactor: path.join(root, \"reactor-storage\"),\n readModel: path.join(root, \"read-storage\"),\n };\n}\n"],"mappings":";;;;;;;;;;;;AAYA,SAAgB,aACd,OAAe,QAAQ,IAAI,GAC3B,MAA0C,QAAQ,KAC1C;CACR,OAAO,KAAK,KAAK,IAAI,oBAAoB,MAAM,KAAK;AACtD;;;;;;;;AASA,SAAgB,iBACd,MAA0C,QAAQ,KAClD,OACwC;CACxC,MAAM,OACJ,UAAU,IAAI,mBAAmB,aAAa,KAAA,GAAW,GAAG,IAAI,KAAA;CAClE,IAAI,SAAS,KAAA,GACX,OAAO;EAAE,SAAS;EAAyB,WAAW;CAAmB;CAE3E,OAAO;EACL,SAAS,KAAK,KAAK,MAAM,iBAAiB;EAC1C,WAAW,KAAK,KAAK,MAAM,cAAc;CAC3C;AACF"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
//#region clis/project-env.d.ts
|
|
2
|
+
/** `PH_NO_DOTENV=1` (or `true`): no `.env` file is read, so a launcher's
|
|
3
|
+
* explicit environment is the whole environment. */
|
|
4
|
+
export declare function isDotenvDisabled(env?: Record<string, string | undefined>): boolean;
|
|
2
5
|
/**
|
|
3
6
|
* Load the project's `.env.local` and `.env` into `process.env`.
|
|
4
7
|
*
|
|
@@ -12,6 +15,9 @@
|
|
|
12
15
|
* call it more than once per process.
|
|
13
16
|
*/
|
|
14
17
|
export declare function loadProjectEnv(cwd?: string): void;
|
|
18
|
+
/** The `process.env` names the shell set: those before the first
|
|
19
|
+
* {@link loadProjectEnv}. Undefined while no project `.env` was loaded. */
|
|
20
|
+
export declare function envNamesBeforeProjectEnv(): ReadonlySet<string> | undefined;
|
|
15
21
|
/** Test seam: forget which directory has already been loaded. */
|
|
16
22
|
export declare function resetProjectEnvForTests(): void;
|
|
17
23
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-env.d.mts","names":[],"sources":["../../clis/project-env.ts"],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"project-env.d.mts","names":[],"sources":["../../clis/project-env.ts"],"mappings":";;;wBAQgB,iBACd,MAAK;;;;;;;;;;;;;wBAkBS,eAAe;;;wBAaf,4BAA4B;;wBAK5B;;;;;;;;wBAYA,YAAY"}
|
|
@@ -2,6 +2,13 @@ import { join } from "node:path";
|
|
|
2
2
|
import dotenv from "dotenv";
|
|
3
3
|
//#region clis/project-env.ts
|
|
4
4
|
let loadedFor;
|
|
5
|
+
let namesBeforeLoad;
|
|
6
|
+
/** `PH_NO_DOTENV=1` (or `true`): no `.env` file is read, so a launcher's
|
|
7
|
+
* explicit environment is the whole environment. */
|
|
8
|
+
function isDotenvDisabled(env = process.env) {
|
|
9
|
+
const value = env.PH_NO_DOTENV?.trim().toLowerCase();
|
|
10
|
+
return value === "1" || value === "true";
|
|
11
|
+
}
|
|
5
12
|
/**
|
|
6
13
|
* Load the project's `.env.local` and `.env` into `process.env`.
|
|
7
14
|
*
|
|
@@ -15,14 +22,22 @@ let loadedFor;
|
|
|
15
22
|
* call it more than once per process.
|
|
16
23
|
*/
|
|
17
24
|
function loadProjectEnv(cwd = process.cwd()) {
|
|
25
|
+
if (isDotenvDisabled()) return;
|
|
18
26
|
if (loadedFor === cwd) return;
|
|
19
27
|
loadedFor = cwd;
|
|
28
|
+
namesBeforeLoad ??= new Set(Object.keys(process.env));
|
|
20
29
|
dotenv.config({ path: join(cwd, ".env.local") });
|
|
21
30
|
dotenv.config({ path: join(cwd, ".env") });
|
|
22
31
|
}
|
|
32
|
+
/** The `process.env` names the shell set: those before the first
|
|
33
|
+
* {@link loadProjectEnv}. Undefined while no project `.env` was loaded. */
|
|
34
|
+
function envNamesBeforeProjectEnv() {
|
|
35
|
+
return namesBeforeLoad;
|
|
36
|
+
}
|
|
23
37
|
/** Test seam: forget which directory has already been loaded. */
|
|
24
38
|
function resetProjectEnvForTests() {
|
|
25
39
|
loadedFor = void 0;
|
|
40
|
+
namesBeforeLoad = void 0;
|
|
26
41
|
}
|
|
27
42
|
/**
|
|
28
43
|
* Read an environment variable as a TCP port.
|
|
@@ -39,6 +54,6 @@ function readPortEnv(name) {
|
|
|
39
54
|
return port;
|
|
40
55
|
}
|
|
41
56
|
//#endregion
|
|
42
|
-
export { loadProjectEnv, readPortEnv, resetProjectEnvForTests };
|
|
57
|
+
export { envNamesBeforeProjectEnv, isDotenvDisabled, loadProjectEnv, readPortEnv, resetProjectEnvForTests };
|
|
43
58
|
|
|
44
59
|
//# sourceMappingURL=project-env.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-env.mjs","names":[],"sources":["../../clis/project-env.ts"],"sourcesContent":["import dotenv from \"dotenv\";\nimport { join } from \"node:path\";\n\nlet loadedFor: string | undefined;\n\n/**\n * Load the project's `.env.local` and `.env` into `process.env`.\n *\n * `dotenv` never overwrites a variable that is already set, so loading\n * `.env.local` first and `.env` second produces the precedence the CLI\n * documents: a real `process.env` value beats `.env.local`, which beats\n * `.env`. One `process.env` lookup afterwards therefore covers all three\n * sources.\n *\n * Idempotent per directory — CLI argument defaults call it lazily and may\n * call it more than once per process.\n */\nexport function loadProjectEnv(cwd: string = process.cwd()): void {\n if (loadedFor === cwd) return;\n loadedFor = cwd;\n // dotenv 16 logs nothing for a missing file, so no suppression option is\n // needed here (and none exists before dotenv 17).\n dotenv.config({ path: join(cwd, \".env.local\") });\n dotenv.config({ path: join(cwd, \".env\") });\n}\n\n/** Test seam: forget which directory has already been loaded. */\nexport function resetProjectEnvForTests(): void {\n loadedFor = undefined;\n}\n\n/**\n * Read an environment variable as a TCP port.\n *\n * Anything that is not a plain integer in 1-65535 is ignored rather than\n * throwing: a typo in `.env` should fall through to the next source in the\n * precedence chain, not break the CLI.\n */\nexport function readPortEnv(name: string): number | undefined {\n const raw = process.env[name]?.trim();\n if (!raw || !/^\\d+$/.test(raw)) return undefined;\n const port = Number(raw);\n if (port < 1 || port > 65535) return undefined;\n return port;\n}\n"],"mappings":";;;AAGA,IAAI;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"project-env.mjs","names":[],"sources":["../../clis/project-env.ts"],"sourcesContent":["import dotenv from \"dotenv\";\nimport { join } from \"node:path\";\n\nlet loadedFor: string | undefined;\nlet namesBeforeLoad: ReadonlySet<string> | undefined;\n\n/** `PH_NO_DOTENV=1` (or `true`): no `.env` file is read, so a launcher's\n * explicit environment is the whole environment. */\nexport function isDotenvDisabled(\n env: Record<string, string | undefined> = process.env,\n): boolean {\n const value = env.PH_NO_DOTENV?.trim().toLowerCase();\n return value === \"1\" || value === \"true\";\n}\n\n/**\n * Load the project's `.env.local` and `.env` into `process.env`.\n *\n * `dotenv` never overwrites a variable that is already set, so loading\n * `.env.local` first and `.env` second produces the precedence the CLI\n * documents: a real `process.env` value beats `.env.local`, which beats\n * `.env`. One `process.env` lookup afterwards therefore covers all three\n * sources.\n *\n * Idempotent per directory — CLI argument defaults call it lazily and may\n * call it more than once per process.\n */\nexport function loadProjectEnv(cwd: string = process.cwd()): void {\n if (isDotenvDisabled()) return;\n if (loadedFor === cwd) return;\n loadedFor = cwd;\n namesBeforeLoad ??= new Set(Object.keys(process.env));\n // dotenv 16 logs nothing for a missing file, so no suppression option is\n // needed here (and none exists before dotenv 17).\n dotenv.config({ path: join(cwd, \".env.local\") });\n dotenv.config({ path: join(cwd, \".env\") });\n}\n\n/** The `process.env` names the shell set: those before the first\n * {@link loadProjectEnv}. Undefined while no project `.env` was loaded. */\nexport function envNamesBeforeProjectEnv(): ReadonlySet<string> | undefined {\n return namesBeforeLoad;\n}\n\n/** Test seam: forget which directory has already been loaded. */\nexport function resetProjectEnvForTests(): void {\n loadedFor = undefined;\n namesBeforeLoad = undefined;\n}\n\n/**\n * Read an environment variable as a TCP port.\n *\n * Anything that is not a plain integer in 1-65535 is ignored rather than\n * throwing: a typo in `.env` should fall through to the next source in the\n * precedence chain, not break the CLI.\n */\nexport function readPortEnv(name: string): number | undefined {\n const raw = process.env[name]?.trim();\n if (!raw || !/^\\d+$/.test(raw)) return undefined;\n const port = Number(raw);\n if (port < 1 || port > 65535) return undefined;\n return port;\n}\n"],"mappings":";;;AAGA,IAAI;AACJ,IAAI;;;AAIJ,SAAgB,iBACd,MAA0C,QAAQ,KACzC;CACT,MAAM,QAAQ,IAAI,cAAc,KAAK,CAAC,CAAC,YAAY;CACnD,OAAO,UAAU,OAAO,UAAU;AACpC;;;;;;;;;;;;;AAcA,SAAgB,eAAe,MAAc,QAAQ,IAAI,GAAS;CAChE,IAAI,iBAAiB,GAAG;CACxB,IAAI,cAAc,KAAK;CACvB,YAAY;CACZ,oBAAoB,IAAI,IAAI,OAAO,KAAK,QAAQ,GAAG,CAAC;CAGpD,OAAO,OAAO,EAAE,MAAM,KAAK,KAAK,YAAY,EAAE,CAAC;CAC/C,OAAO,OAAO,EAAE,MAAM,KAAK,KAAK,MAAM,EAAE,CAAC;AAC3C;;;AAIA,SAAgB,2BAA4D;CAC1E,OAAO;AACT;;AAGA,SAAgB,0BAAgC;CAC9C,YAAY,KAAA;CACZ,kBAAkB,KAAA;AACpB;;;;;;;;AASA,SAAgB,YAAY,MAAkC;CAC5D,MAAM,MAAM,QAAQ,IAAI,KAAK,EAAE,KAAK;CACpC,IAAI,CAAC,OAAO,CAAC,QAAQ,KAAK,GAAG,GAAG,OAAO,KAAA;CACvC,MAAM,OAAO,OAAO,GAAG;CACvB,IAAI,OAAO,KAAK,OAAO,OAAO,OAAO,KAAA;CACrC,OAAO;AACT"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region clis/real-paths.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The absolute path with symlinks, and case where the filesystem ignores it,
|
|
4
|
+
* resolved as far as the path exists, so a path not written yet is judged
|
|
5
|
+
* against its real parent. A dangling symlink resolves to where it points:
|
|
6
|
+
* it is not where the path lives, and following it is what a later write
|
|
7
|
+
* through it does.
|
|
8
|
+
*/
|
|
9
|
+
export declare function realPathThroughExistingParent(path: string): string;
|
|
10
|
+
/** `path` relative to `root` when it is `root` or inside it, else null. */
|
|
11
|
+
export declare function pathWithin(root: string, path: string): string | null;
|
|
12
|
+
//#endregion
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=real-paths.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"real-paths.d.mts","names":[],"sources":["../../clis/real-paths.ts"],"mappings":";;;;;;;;wBAUgB,8BAA8B;;wBAyB9B,WAAW,cAAc"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { dirname, isAbsolute, relative, resolve, sep } from "node:path";
|
|
2
|
+
import { lstatSync, readlinkSync, realpathSync } from "node:fs";
|
|
3
|
+
//#region clis/real-paths.ts
|
|
4
|
+
/**
|
|
5
|
+
* The absolute path with symlinks, and case where the filesystem ignores it,
|
|
6
|
+
* resolved as far as the path exists, so a path not written yet is judged
|
|
7
|
+
* against its real parent. A dangling symlink resolves to where it points:
|
|
8
|
+
* it is not where the path lives, and following it is what a later write
|
|
9
|
+
* through it does.
|
|
10
|
+
*/
|
|
11
|
+
function realPathThroughExistingParent(path) {
|
|
12
|
+
const absolute = resolve(path);
|
|
13
|
+
let ancestor = absolute;
|
|
14
|
+
while (lstatSync(ancestor, { throwIfNoEntry: false }) === void 0) {
|
|
15
|
+
const parent = dirname(ancestor);
|
|
16
|
+
if (parent === ancestor) break;
|
|
17
|
+
ancestor = parent;
|
|
18
|
+
}
|
|
19
|
+
let real;
|
|
20
|
+
try {
|
|
21
|
+
real = realpathSync.native(ancestor);
|
|
22
|
+
} catch (error) {
|
|
23
|
+
if (!(error instanceof Error && "code" in error && error.code === "ENOENT") || !lstatSync(ancestor, { throwIfNoEntry: false })?.isSymbolicLink()) throw error;
|
|
24
|
+
real = realPathThroughExistingParent(resolve(dirname(ancestor), readlinkSync(ancestor)));
|
|
25
|
+
}
|
|
26
|
+
return resolve(real, relative(ancestor, absolute));
|
|
27
|
+
}
|
|
28
|
+
/** `path` relative to `root` when it is `root` or inside it, else null. */
|
|
29
|
+
function pathWithin(root, path) {
|
|
30
|
+
const inside = relative(root, path);
|
|
31
|
+
return inside === ".." || inside.startsWith(`..${sep}`) || isAbsolute(inside) ? null : inside;
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { pathWithin, realPathThroughExistingParent };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=real-paths.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"real-paths.mjs","names":[],"sources":["../../clis/real-paths.ts"],"sourcesContent":["import { lstatSync, readlinkSync, realpathSync } from \"node:fs\";\nimport { dirname, isAbsolute, relative, resolve, sep } from \"node:path\";\n\n/**\n * The absolute path with symlinks, and case where the filesystem ignores it,\n * resolved as far as the path exists, so a path not written yet is judged\n * against its real parent. A dangling symlink resolves to where it points:\n * it is not where the path lives, and following it is what a later write\n * through it does.\n */\nexport function realPathThroughExistingParent(path: string): string {\n const absolute = resolve(path);\n let ancestor = absolute;\n while (lstatSync(ancestor, { throwIfNoEntry: false }) === undefined) {\n const parent = dirname(ancestor);\n if (parent === ancestor) break;\n ancestor = parent;\n }\n let real: string;\n try {\n real = realpathSync.native(ancestor);\n } catch (error) {\n if (\n !(error instanceof Error && \"code\" in error && error.code === \"ENOENT\") ||\n !lstatSync(ancestor, { throwIfNoEntry: false })?.isSymbolicLink()\n )\n throw error;\n real = realPathThroughExistingParent(\n resolve(dirname(ancestor), readlinkSync(ancestor)),\n );\n }\n return resolve(real, relative(ancestor, absolute));\n}\n\n/** `path` relative to `root` when it is `root` or inside it, else null. */\nexport function pathWithin(root: string, path: string): string | null {\n const inside = relative(root, path);\n return inside === \"..\" || inside.startsWith(`..${sep}`) || isAbsolute(inside)\n ? null\n : inside;\n}\n"],"mappings":";;;;;;;;;;AAUA,SAAgB,8BAA8B,MAAsB;CAClE,MAAM,WAAW,QAAQ,IAAI;CAC7B,IAAI,WAAW;CACf,OAAO,UAAU,UAAU,EAAE,gBAAgB,MAAM,CAAC,MAAM,KAAA,GAAW;EACnE,MAAM,SAAS,QAAQ,QAAQ;EAC/B,IAAI,WAAW,UAAU;EACzB,WAAW;CACb;CACA,IAAI;CACJ,IAAI;EACF,OAAO,aAAa,OAAO,QAAQ;CACrC,SAAS,OAAO;EACd,IACE,EAAE,iBAAiB,SAAS,UAAU,SAAS,MAAM,SAAS,aAC9D,CAAC,UAAU,UAAU,EAAE,gBAAgB,MAAM,CAAC,CAAC,EAAE,eAAe,GAEhE,MAAM;EACR,OAAO,8BACL,QAAQ,QAAQ,QAAQ,GAAG,aAAa,QAAQ,CAAC,CACnD;CACF;CACA,OAAO,QAAQ,MAAM,SAAS,UAAU,QAAQ,CAAC;AACnD;;AAGA,SAAgB,WAAW,MAAc,MAA6B;CACpE,MAAM,SAAS,SAAS,MAAM,IAAI;CAClC,OAAO,WAAW,QAAQ,OAAO,WAAW,KAAK,KAAK,KAAK,WAAW,MAAM,IACxE,OACA;AACN"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//#region clis/retired-flags.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Environment variables that used to switch a feature and no longer do.
|
|
4
|
+
*
|
|
5
|
+
* A retired variable goes through two releases: first the CLI warns that it
|
|
6
|
+
* has no effect (`action: "warn"`), then it refuses to start while the
|
|
7
|
+
* variable still asks for the removed behaviour (`action: "refuse"`).
|
|
8
|
+
* Moving an entry from one to the other is a one-line change.
|
|
9
|
+
*/
|
|
10
|
+
export type RetiredFlagAction = "warn" | "refuse";
|
|
11
|
+
export interface RetiredFlag {
|
|
12
|
+
/** The environment variable. */
|
|
13
|
+
name: string;
|
|
14
|
+
/** The release in which the variable stopped having an effect. */
|
|
15
|
+
retiredIn: string;
|
|
16
|
+
/** The first release that refuses to start with the variable set this way. */
|
|
17
|
+
refusedIn: string;
|
|
18
|
+
/** Which values ask for the removed behaviour: a false one, or any. */
|
|
19
|
+
when: "false" | "set";
|
|
20
|
+
action: RetiredFlagAction;
|
|
21
|
+
/** What is true now, as a full sentence. */
|
|
22
|
+
message: string;
|
|
23
|
+
}
|
|
24
|
+
export declare const retiredFlags: readonly RetiredFlag[];
|
|
25
|
+
/** Set once a process has warned, so the CLIs it spawns do not repeat it. */
|
|
26
|
+
export declare const RETIRED_FLAGS_WARNED_ENV = "PH_RETIRED_FLAGS_WARNED";
|
|
27
|
+
/** The values that switch a variable off. */
|
|
28
|
+
export declare const FALSE_VALUES: ReadonlySet<string>;
|
|
29
|
+
export interface RetiredFlagFinding {
|
|
30
|
+
flag: RetiredFlag;
|
|
31
|
+
/** The value as set in the environment. */
|
|
32
|
+
value: string;
|
|
33
|
+
text: string;
|
|
34
|
+
}
|
|
35
|
+
/** The retired variables that `env` still sets in the way their entry names. */
|
|
36
|
+
export declare function findRetiredFlags(env?: Record<string, string | undefined>, flags?: readonly RetiredFlag[]): RetiredFlagFinding[];
|
|
37
|
+
/**
|
|
38
|
+
* Run at CLI start. Prints one warning per `warn` entry to stderr and throws
|
|
39
|
+
* for `refuse` entries. A process that warned marks `env`, which its child
|
|
40
|
+
* CLIs inherit, so one invocation warns once.
|
|
41
|
+
*/
|
|
42
|
+
export declare function checkRetiredFlags(env?: Record<string, string | undefined>, flags?: readonly RetiredFlag[], warn?: (text: string) => void): void;
|
|
43
|
+
//#endregion
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=retired-flags.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retired-flags.d.mts","names":[],"sources":["../../clis/retired-flags.ts"],"mappings":";;;;;;;;;YASY;iBAEK;;EAEf;;EAEA;;EAEA;;EAEA;EACA,QAAQ;;EAER;;qBAGW,uBAAuB;;qBAYvB;;qBAGA,cAAc;iBAOV;EACf,MAAM;;EAEN;EACA;;;wBAYc,iBACd,MAAK,oCACL,iBAAgB,gBACf;;;;;;wBAkBa,kBACd,MAAK,oCACL,iBAAgB,eAChB,QAAO"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
//#region clis/retired-flags.ts
|
|
2
|
+
const retiredFlags = [{
|
|
3
|
+
name: "FEATURE_UNIFORM_RUNNERS_ENABLED",
|
|
4
|
+
retiredIn: "6.3",
|
|
5
|
+
refusedIn: "6.4",
|
|
6
|
+
when: "false",
|
|
7
|
+
action: "warn",
|
|
8
|
+
message: "Hosts and `ph run` are always on now."
|
|
9
|
+
}];
|
|
10
|
+
/** Set once a process has warned, so the CLIs it spawns do not repeat it. */
|
|
11
|
+
const RETIRED_FLAGS_WARNED_ENV = "PH_RETIRED_FLAGS_WARNED";
|
|
12
|
+
/** The values that switch a variable off. */
|
|
13
|
+
const FALSE_VALUES = /* @__PURE__ */ new Set([
|
|
14
|
+
"false",
|
|
15
|
+
"0",
|
|
16
|
+
"off",
|
|
17
|
+
"no"
|
|
18
|
+
]);
|
|
19
|
+
function findingText(flag, value) {
|
|
20
|
+
const setTo = flag.when === "false" ? "set to false" : "set";
|
|
21
|
+
const head = `${flag.name}=${value} has no effect since ${flag.retiredIn}. ${flag.message}`;
|
|
22
|
+
return flag.action === "refuse" ? `${head} Remove the variable: since ${flag.refusedIn} the CLI refuses to start with it ${setTo}.` : `${head} Remove the variable: ${flag.refusedIn} will refuse to start with it ${setTo}.`;
|
|
23
|
+
}
|
|
24
|
+
/** The retired variables that `env` still sets in the way their entry names. */
|
|
25
|
+
function findRetiredFlags(env = process.env, flags = retiredFlags) {
|
|
26
|
+
const findings = [];
|
|
27
|
+
for (const flag of flags) {
|
|
28
|
+
const value = env[flag.name];
|
|
29
|
+
if (value === void 0) continue;
|
|
30
|
+
const normalized = value.trim().toLowerCase();
|
|
31
|
+
if (flag.when === "set" ? normalized !== "" : FALSE_VALUES.has(normalized)) findings.push({
|
|
32
|
+
flag,
|
|
33
|
+
value,
|
|
34
|
+
text: findingText(flag, value)
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return findings;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Run at CLI start. Prints one warning per `warn` entry to stderr and throws
|
|
41
|
+
* for `refuse` entries. A process that warned marks `env`, which its child
|
|
42
|
+
* CLIs inherit, so one invocation warns once.
|
|
43
|
+
*/
|
|
44
|
+
function checkRetiredFlags(env = process.env, flags = retiredFlags, warn = (text) => console.warn(text)) {
|
|
45
|
+
const findings = findRetiredFlags(env, flags);
|
|
46
|
+
const refused = findings.filter((f) => f.flag.action === "refuse");
|
|
47
|
+
if (refused.length > 0) throw new Error(refused.map((f) => f.text).join("\n"));
|
|
48
|
+
if (findings.length === 0 || env["PH_RETIRED_FLAGS_WARNED"] === "1") return;
|
|
49
|
+
for (const finding of findings) warn(`Warning: ${finding.text}`);
|
|
50
|
+
env[RETIRED_FLAGS_WARNED_ENV] = "1";
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
export { FALSE_VALUES, RETIRED_FLAGS_WARNED_ENV, checkRetiredFlags, findRetiredFlags, retiredFlags };
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=retired-flags.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retired-flags.mjs","names":[],"sources":["../../clis/retired-flags.ts"],"sourcesContent":["/**\n * Environment variables that used to switch a feature and no longer do.\n *\n * A retired variable goes through two releases: first the CLI warns that it\n * has no effect (`action: \"warn\"`), then it refuses to start while the\n * variable still asks for the removed behaviour (`action: \"refuse\"`).\n * Moving an entry from one to the other is a one-line change.\n */\n\nexport type RetiredFlagAction = \"warn\" | \"refuse\";\n\nexport interface RetiredFlag {\n /** The environment variable. */\n name: string;\n /** The release in which the variable stopped having an effect. */\n retiredIn: string;\n /** The first release that refuses to start with the variable set this way. */\n refusedIn: string;\n /** Which values ask for the removed behaviour: a false one, or any. */\n when: \"false\" | \"set\";\n action: RetiredFlagAction;\n /** What is true now, as a full sentence. */\n message: string;\n}\n\nexport const retiredFlags: readonly RetiredFlag[] = [\n {\n name: \"FEATURE_UNIFORM_RUNNERS_ENABLED\",\n retiredIn: \"6.3\",\n refusedIn: \"6.4\",\n when: \"false\",\n action: \"warn\",\n message: \"Hosts and `ph run` are always on now.\",\n },\n];\n\n/** Set once a process has warned, so the CLIs it spawns do not repeat it. */\nexport const RETIRED_FLAGS_WARNED_ENV = \"PH_RETIRED_FLAGS_WARNED\";\n\n/** The values that switch a variable off. */\nexport const FALSE_VALUES: ReadonlySet<string> = new Set([\n \"false\",\n \"0\",\n \"off\",\n \"no\",\n]);\n\nexport interface RetiredFlagFinding {\n flag: RetiredFlag;\n /** The value as set in the environment. */\n value: string;\n text: string;\n}\n\nfunction findingText(flag: RetiredFlag, value: string): string {\n const setTo = flag.when === \"false\" ? \"set to false\" : \"set\";\n const head = `${flag.name}=${value} has no effect since ${flag.retiredIn}. ${flag.message}`;\n return flag.action === \"refuse\"\n ? `${head} Remove the variable: since ${flag.refusedIn} the CLI refuses to start with it ${setTo}.`\n : `${head} Remove the variable: ${flag.refusedIn} will refuse to start with it ${setTo}.`;\n}\n\n/** The retired variables that `env` still sets in the way their entry names. */\nexport function findRetiredFlags(\n env: Record<string, string | undefined> = process.env,\n flags: readonly RetiredFlag[] = retiredFlags,\n): RetiredFlagFinding[] {\n const findings: RetiredFlagFinding[] = [];\n for (const flag of flags) {\n const value = env[flag.name];\n if (value === undefined) continue;\n const normalized = value.trim().toLowerCase();\n const hit =\n flag.when === \"set\" ? normalized !== \"\" : FALSE_VALUES.has(normalized);\n if (hit) findings.push({ flag, value, text: findingText(flag, value) });\n }\n return findings;\n}\n\n/**\n * Run at CLI start. Prints one warning per `warn` entry to stderr and throws\n * for `refuse` entries. A process that warned marks `env`, which its child\n * CLIs inherit, so one invocation warns once.\n */\nexport function checkRetiredFlags(\n env: Record<string, string | undefined> = process.env,\n flags: readonly RetiredFlag[] = retiredFlags,\n warn: (text: string) => void = (text) => console.warn(text),\n): void {\n const findings = findRetiredFlags(env, flags);\n const refused = findings.filter((f) => f.flag.action === \"refuse\");\n if (refused.length > 0) {\n throw new Error(refused.map((f) => f.text).join(\"\\n\"));\n }\n if (findings.length === 0 || env[RETIRED_FLAGS_WARNED_ENV] === \"1\") return;\n for (const finding of findings) {\n warn(`Warning: ${finding.text}`);\n }\n env[RETIRED_FLAGS_WARNED_ENV] = \"1\";\n}\n"],"mappings":";AAyBA,MAAa,eAAuC,CAClD;CACE,MAAM;CACN,WAAW;CACX,WAAW;CACX,MAAM;CACN,QAAQ;CACR,SAAS;AACX,CACF;;AAGA,MAAa,2BAA2B;;AAGxC,MAAa,+BAAoC,IAAI,IAAI;CACvD;CACA;CACA;CACA;AACF,CAAC;AASD,SAAS,YAAY,MAAmB,OAAuB;CAC7D,MAAM,QAAQ,KAAK,SAAS,UAAU,iBAAiB;CACvD,MAAM,OAAO,GAAG,KAAK,KAAK,GAAG,MAAM,uBAAuB,KAAK,UAAU,IAAI,KAAK;CAClF,OAAO,KAAK,WAAW,WACnB,GAAG,KAAK,8BAA8B,KAAK,UAAU,oCAAoC,MAAM,KAC/F,GAAG,KAAK,wBAAwB,KAAK,UAAU,gCAAgC,MAAM;AAC3F;;AAGA,SAAgB,iBACd,MAA0C,QAAQ,KAClD,QAAgC,cACV;CACtB,MAAM,WAAiC,CAAC;CACxC,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,QAAQ,IAAI,KAAK;EACvB,IAAI,UAAU,KAAA,GAAW;EACzB,MAAM,aAAa,MAAM,KAAK,CAAC,CAAC,YAAY;EAG5C,IADE,KAAK,SAAS,QAAQ,eAAe,KAAK,aAAa,IAAI,UAAU,GAC9D,SAAS,KAAK;GAAE;GAAM;GAAO,MAAM,YAAY,MAAM,KAAK;EAAE,CAAC;CACxE;CACA,OAAO;AACT;;;;;;AAOA,SAAgB,kBACd,MAA0C,QAAQ,KAClD,QAAgC,cAChC,QAAgC,SAAS,QAAQ,KAAK,IAAI,GACpD;CACN,MAAM,WAAW,iBAAiB,KAAK,KAAK;CAC5C,MAAM,UAAU,SAAS,QAAQ,MAAM,EAAE,KAAK,WAAW,QAAQ;CACjE,IAAI,QAAQ,SAAS,GACnB,MAAM,IAAI,MAAM,QAAQ,KAAK,MAAM,EAAE,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC;CAEvD,IAAI,SAAS,WAAW,KAAK,IAAA,+BAAkC,KAAK;CACpE,KAAK,MAAM,WAAW,UACpB,KAAK,YAAY,QAAQ,MAAM;CAEjC,IAAI,4BAA4B;AAClC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
10
|
+
var __exportAll = (all, no_symbols) => {
|
|
11
|
+
let target = {};
|
|
12
|
+
for (var name in all) __defProp(target, name, {
|
|
13
|
+
get: all[name],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
17
|
+
return target;
|
|
18
|
+
};
|
|
19
|
+
var __copyProps = (to, from, except, desc) => {
|
|
20
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
21
|
+
key = keys[i];
|
|
22
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
23
|
+
get: ((k) => from[k]).bind(null, key),
|
|
24
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return to;
|
|
28
|
+
};
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
30
|
+
value: mod,
|
|
31
|
+
enumerable: true
|
|
32
|
+
}) : target, mod));
|
|
33
|
+
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
34
|
+
//#endregion
|
|
35
|
+
export { __toESM as i, __exportAll as n, __require as r, __commonJSMin as t };
|