@astryxdesign/cli 0.7.17-canary.g5a3fd39 → 0.7.17-canary.g5cf5d69
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/README.md +64 -63
- package/api/build/_adapter.d.mts +51 -0
- package/api/build/_adapter.mjs +122 -6
- package/api/build/build.doc.mjs +1 -1
- package/api/build/build.mjs +23 -14
- package/api/build/build.type.d.mts +1 -1
- package/api/build/build.type.mjs +3 -3
- package/api/build/help/help.d.mts +15 -14
- package/api/build/help/help.mjs +62 -3
- package/api/build/kit/answer.mjs +2 -3
- package/api/build/kit/signals.d.mts +10 -0
- package/api/build/kit/signals.mjs +15 -2
- package/api/component/detail/blocks/blocks.mjs +2 -1
- package/api/discover/_adapter.d.mts +57 -6
- package/api/discover/_adapter.mjs +278 -49
- package/api/discover/_catalog-view.d.mts +7 -0
- package/api/discover/_catalog-view.mjs +10 -1
- package/api/discover/detail/detail.d.mts +3 -2
- package/api/discover/detail/detail.mjs +3 -2
- package/api/discover/detail/doc/doc.mjs +1 -1
- package/api/discover/discover.d.mts +24 -0
- package/api/discover/discover.doc.mjs +1 -1
- package/api/discover/discover.mjs +146 -25
- package/api/discover/discover.type.d.mts +6 -4
- package/api/discover/discover.type.mjs +6 -4
- package/api/discover/search/search.d.mts +22 -0
- package/api/discover/search/search.mjs +290 -70
- package/api/docs/_entry-names.mjs +4 -3
- package/api/doctor/_adapter.d.mts +43 -3
- package/api/doctor/_adapter.mjs +142 -18
- package/api/doctor/built-checks.d.mts +30 -3
- package/api/doctor/built-checks.mjs +132 -5
- package/api/doctor/doctor.d.mts +93 -6
- package/api/doctor/doctor.doc.mjs +2 -2
- package/api/doctor/doctor.mjs +524 -33
- package/api/doctor/doctor.type.d.mts +2 -1
- package/api/doctor/doctor.type.mjs +2 -1
- package/api/doctor/theme-checks.d.mts +19 -0
- package/api/doctor/theme-checks.mjs +74 -6
- package/api/hook/hook.type.d.mts +1 -1
- package/api/hook/hook.type.mjs +1 -1
- package/api/hook/list/list.mjs +11 -7
- package/api/icon/_adapter.d.mts +2 -1
- package/api/icon/_adapter.mjs +10 -15
- package/api/icon/_records.d.mts +3 -1
- package/api/icon/_records.mjs +30 -3
- package/api/icon/exportIconIndex.doc.mjs +1 -1
- package/api/icon/icon.doc.mjs +3 -3
- package/api/icon/icon.type.d.mts +32 -1
- package/api/icon/icon.type.mjs +19 -3
- package/api/icon/list/list.mjs +4 -1
- package/api/icon/rankIconIndex.doc.mjs +1 -1
- package/api/icon/search/icon-index.mjs +18 -8
- package/api/icon/search/search.d.mts +26 -3
- package/api/icon/search/search.mjs +155 -9
- package/api/init/_adapter.d.mts +14 -0
- package/api/init/_adapter.mjs +26 -4
- package/api/init/init.d.mts +1 -1
- package/api/init/init.doc.mjs +2 -2
- package/api/init/init.mjs +1 -1
- package/api/init/init.type.d.mts +29 -1
- package/api/init/init.type.mjs +14 -1
- package/api/init/run/run.d.mts +11 -1
- package/api/init/run/run.mjs +84 -5
- package/api/integration/_adapter.d.mts +5 -4
- package/api/integration/_adapter.mjs +7 -5
- package/api/integration/integrationCheck.doc.mjs +1 -1
- package/api/integration/pack-check.mjs +8 -9
- package/api/integration/validate-integration.d.mts +1 -1
- package/api/integration/validate-integration.mjs +26 -24
- package/api/integration/validate-integration.type.d.mts +5 -2
- package/api/integration/validate-integration.type.mjs +5 -2
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/render/_adapter.d.mts +4 -2
- package/api/render/_adapter.mjs +62 -21
- package/api/render/render.doc.mjs +8 -5
- package/api/render/render.mjs +1 -1
- package/api/render/render.type.d.mts +2 -0
- package/api/render/render.type.mjs +2 -0
- package/api/search/ORDERING.md +2 -2
- package/api/search/_candidate-score.d.mts +3 -0
- package/api/search/_candidate-score.mjs +36 -3
- package/api/search/_gather-docs.mjs +29 -2
- package/api/search/_gather-templates.mjs +2 -1
- package/api/search/_main-searcher.mjs +13 -0
- package/api/search/_named-keywords.d.mts +2 -1
- package/api/search/_named-keywords.mjs +48 -6
- package/api/search/_order.d.mts +36 -1
- package/api/search/_order.mjs +141 -3
- package/api/swizzle/list/list.mjs +8 -1
- package/api/swizzle/swizzle.type.d.mts +1 -1
- package/api/swizzle/swizzle.type.mjs +1 -1
- package/api/template/copy/copy.mjs +3 -4
- package/api/template/list/list.mjs +2 -1
- package/api/template/show/show.mjs +2 -1
- package/api/template/skeleton/skeleton.mjs +2 -1
- package/api/template/template.doc.mjs +1 -1
- package/api/template/template.mjs +19 -1
- package/api/template/template.type.d.mts +1 -0
- package/api/template/template.type.mjs +2 -1
- package/api/theme/_adapter.d.mts +1 -0
- package/api/theme/_adapter.mjs +3 -5
- package/api/theme/_app-provider.d.mts +42 -0
- package/api/theme/_app-provider.mjs +61 -27
- package/api/theme/build/build.d.mts +4 -10
- package/api/theme/build/build.mjs +165 -116
- package/api/theme/build/input-fields.d.mts +9 -0
- package/api/theme/build/input-fields.mjs +155 -16
- package/api/theme/build/radius-values.d.mts +18 -0
- package/api/theme/build/radius-values.mjs +76 -0
- package/api/theme/build/typography-values.mjs +7 -23
- package/api/theme/build/written-values.d.mts +18 -0
- package/api/theme/build/written-values.mjs +107 -31
- package/api/theme/eject/eject.mjs +6 -1
- package/api/theme/palette/generate/generator.mjs +24 -0
- package/api/theme/theme.type.d.mts +4 -2
- package/api/theme/theme.type.mjs +3 -2
- package/api/theme/themeBuild.doc.mjs +2 -2
- package/api/theme/themeEject.doc.mjs +1 -1
- package/api/theme-edit/_catalog.d.mts +40 -0
- package/api/theme-edit/_catalog.mjs +100 -22
- package/api/theme-edit/_check.mjs +213 -43
- package/api/theme-edit/_color.d.mts +14 -0
- package/api/theme-edit/_color.mjs +22 -0
- package/api/theme-edit/_compiler.mjs +52 -0
- package/api/theme-edit/_context.d.mts +20 -2
- package/api/theme-edit/_context.mjs +157 -29
- package/api/theme-edit/_edit.mjs +426 -58
- package/api/theme-edit/_how-question.d.mts +14 -0
- package/api/theme-edit/_how-question.mjs +1541 -127
- package/api/theme-edit/_how.mjs +43 -0
- package/api/theme-edit/_missed.mjs +107 -27
- package/api/theme-edit/_normal.d.mts +18 -4
- package/api/theme-edit/_normal.mjs +84 -3
- package/api/theme-edit/_palette.d.mts +9 -0
- package/api/theme-edit/_palette.mjs +158 -33
- package/api/theme-edit/_part-words.mjs +16 -3
- package/api/theme-edit/_parts.d.mts +8 -0
- package/api/theme-edit/_parts.mjs +120 -36
- package/api/theme-edit/_png.d.mts +24 -0
- package/api/theme-edit/_png.mjs +99 -0
- package/api/theme-edit/_preview-app.d.mts +16 -0
- package/api/theme-edit/_preview-app.mjs +52 -18
- package/api/theme-edit/_preview.d.mts +44 -26
- package/api/theme-edit/_preview.mjs +255 -67
- package/api/theme-edit/_project.d.mts +12 -1
- package/api/theme-edit/_project.mjs +16 -1
- package/api/theme-edit/_settings.d.mts +116 -0
- package/api/theme-edit/_settings.mjs +1197 -58
- package/api/theme-edit/_tables.d.mts +16 -0
- package/api/theme-edit/_tables.mjs +34 -4
- package/api/theme-edit/theme-edit.type.d.mts +15 -2
- package/api/theme-edit/theme-edit.type.mjs +8 -6
- package/api/upgrade/_adapter.d.mts +46 -7
- package/api/upgrade/_adapter.mjs +110 -15
- package/api/upgrade/registry/registry.d.mts +6 -3
- package/api/upgrade/registry/registry.mjs +21 -6
- package/api/upgrade/run/run.mjs +23 -11
- package/api/upgrade/upgrade.doc.mjs +4 -3
- package/assets/component-list.generated.json +1 -1
- package/assets/docs/tree/agent-guidance.doc.mjs +3 -2
- package/assets/docs/tree/checks.doc.mjs +2 -2
- package/assets/docs/tree/host-entry.doc.mjs +4 -0
- package/assets/docs/tree/icon-definitions.doc.mjs +3 -3
- package/assets/docs/tree/icon-sets.doc.mjs +6 -6
- package/assets/docs/tree/problems.doc.mjs +3 -3
- package/assets/docs/tree/render-pages.doc.mjs +17 -3
- package/assets/docs/tree/share-a-page.doc.mjs +5 -5
- package/assets/docs/tree/short-and-findable.doc.mjs +3 -3
- package/assets/docs/tree/troubleshooting.doc.mjs +8 -0
- package/assets/docs/tree/updates.doc.mjs +1 -1
- package/assets/docs/tree/versioning.doc.mjs +1 -1
- package/assets/docs/working-with-ai.doc.mjs +40 -5
- package/assets/docs-routes.generated.json +1 -1
- package/assets/docs.generated.json +2 -2
- package/assets/icons/installed-icon-set.doc.mjs +30 -0
- package/assets/search-catalog.generated.json +2 -2
- package/assets/self-audit.generated.json +1 -1
- package/assets/templates/blocks/components/Avatar/AvatarInteractive.tsx +6 -1
- package/assets/templates/blocks/components/CodeBlock/CodeBlockTerminal.tsx +1 -1
- package/assets/templates/blocks/components/LinkProvider/LinkProviderCustomLink.tsx +3 -1
- package/assets/templates/components.generated.json +1 -1
- package/assets/templates/pages/ai-chat/page.tsx +6 -2
- package/assets/templates/pages/ai-chat-landing/page.tsx +1 -1
- package/assets/templates/pages/blank/page.tsx +4 -2
- package/assets/templates/pages/canvas-editor/page.tsx +3 -1
- package/assets/templates/pages/centered-hero/page.tsx +1 -1
- package/assets/templates/pages/checkout-wizard/page.tsx +1 -1
- package/assets/templates/pages/classic-gallery/page.tsx +1 -1
- package/assets/templates/pages/contact-form/page.tsx +2 -2
- package/assets/templates/pages/course-detail/page.tsx +1 -1
- package/assets/templates/pages/dashboard/page.tsx +24 -8
- package/assets/templates/pages/dashboard-alert-rail/page.tsx +4 -2
- package/assets/templates/pages/dashboard-cohort-funnel/page.tsx +7 -3
- package/assets/templates/pages/dashboard-comparison/page.tsx +5 -2
- package/assets/templates/pages/dashboard-composition/page.tsx +10 -4
- package/assets/templates/pages/dashboard-progress/page.tsx +6 -3
- package/assets/templates/pages/dashboard-scorecard/page.tsx +17 -8
- package/assets/templates/pages/detail-page/page.tsx +22 -5
- package/assets/templates/pages/documentation/page.tsx +4 -2
- package/assets/templates/pages/documentation-design/page.tsx +5 -2
- package/assets/templates/pages/documentation-technical/page.tsx +4 -2
- package/assets/templates/pages/editor/page.tsx +28 -9
- package/assets/templates/pages/file-explorer/page.tsx +3 -1
- package/assets/templates/pages/form-two-column/page.tsx +1 -1
- package/assets/templates/pages/form-wizard/page.tsx +1 -1
- package/assets/templates/pages/form-wizard-dialog/page.tsx +3 -1
- package/assets/templates/pages/form-wizard-inline/page.tsx +1 -1
- package/assets/templates/pages/form-wizard-vertical/page.tsx +1 -1
- package/assets/templates/pages/gallery-hero/page.tsx +1 -1
- package/assets/templates/pages/ide/page.tsx +7 -2
- package/assets/templates/pages/kanban-board/page.tsx +10 -4
- package/assets/templates/pages/library/page.tsx +31 -61
- package/assets/templates/pages/login/page.tsx +4 -2
- package/assets/templates/pages/login-card/page.tsx +4 -2
- package/assets/templates/pages/login-split/page.tsx +3 -2
- package/assets/templates/pages/login-sso/page.tsx +4 -4
- package/assets/templates/pages/mixed-gallery/page.tsx +1 -1
- package/assets/templates/pages/payment-form/page.tsx +1 -1
- package/assets/templates/pages/product-detail/page.tsx +16 -4
- package/assets/templates/pages/product-gallery/page.tsx +1 -1
- package/assets/templates/pages/settings/page.tsx +10 -4
- package/assets/templates/pages/settings-dialog/page.tsx +5 -6
- package/assets/templates/pages/settings-sidebar/page.tsx +39 -13
- package/assets/templates/pages/side-gallery/page.tsx +1 -1
- package/assets/templates/pages/table/page.tsx +2 -2
- package/assets/templates/pages/table-filter/page.tsx +21 -6
- package/assets/templates/pages/table-grouped/page.tsx +23 -2
- package/assets/templates/pages/table-inbox/page.tsx +82 -32
- package/assets/templates/pages/theme-showcase/page.tsx +3 -2
- package/assets/templates/themes/butter/butterPaletteRefs.generated.ts +12 -12
- package/assets/templates/themes/butter/butterTheme.ts +197 -4
- package/assets/templates/themes/chocolate/chocolateTheme.ts +72 -8
- package/assets/templates/themes/gothic/gothicPaletteRefs.generated.ts +3 -3
- package/assets/templates/themes/gothic/gothicTheme.ts +114 -4
- package/assets/templates/themes/matcha/matchaPaletteRefs.generated.ts +8 -8
- package/assets/templates/themes/matcha/matchaTheme.ts +48 -12
- package/assets/templates/themes/neutral/neutralTheme.ts +29 -0
- package/assets/templates/themes/stone/stonePaletteRefs.generated.ts +2 -2
- package/assets/templates/themes/stone/stoneTheme.ts +69 -0
- package/assets/templates/themes/y2k/y2kPaletteRefs.generated.ts +9 -9
- package/assets/templates/themes/y2k/y2kTheme.ts +249 -14
- package/authoring/codemod/parse.d.mts +0 -36
- package/authoring/codemod/parse.mjs +62 -41
- package/authoring/config/config.doc.mjs +1 -1
- package/authoring/config/parse.d.mts +0 -47
- package/authoring/config/parse.mjs +128 -103
- package/authoring/config/type.ts +4 -3
- package/authoring/debug/parse.d.mts +2 -2
- package/authoring/discover/parse.d.mts +2 -2
- package/authoring/discover/parse.mjs +52 -38
- package/authoring/discover/type.ts +2 -1
- package/authoring/doctypes/_schema.d.mts +834 -950
- package/authoring/doctypes/_schema.mjs +863 -825
- package/authoring/doctypes/command/parse.mjs +2 -2
- package/authoring/doctypes/component/parse.mjs +2 -2
- package/authoring/doctypes/enum/parse.mjs +2 -2
- package/authoring/doctypes/hook/parse.mjs +2 -2
- package/authoring/doctypes/icon-definition/icon-definition.doc.mjs +1 -1
- package/authoring/doctypes/icon-definition/parse.d.mts +0 -24
- package/authoring/doctypes/icon-definition/parse.mjs +59 -43
- package/authoring/doctypes/icon-set/parse.d.mts +0 -75
- package/authoring/doctypes/icon-set/parse.mjs +239 -210
- package/authoring/doctypes/legacy.mjs +3 -3
- package/authoring/doctypes/namespace/parse.mjs +2 -2
- package/authoring/doctypes/reference/parse.mjs +2 -2
- package/authoring/doctypes/schema/parse.mjs +2 -2
- package/authoring/doctypes/template/parse.d.mts +0 -101
- package/authoring/doctypes/template/parse.mjs +131 -106
- package/authoring/doctypes/theme/parse.d.mts +0 -23
- package/authoring/doctypes/theme/parse.mjs +52 -36
- package/authoring/gap-report/parse.d.mts +1 -1
- package/authoring/integration/integration.doc.mjs +8 -0
- package/authoring/integration/schema.d.mts +14 -3
- package/authoring/integration/schema.mjs +20 -2
- package/authoring/integration/type.ts +14 -0
- package/clients/cli/build-id.generated.json +1 -1
- package/clients/cli/commands/build.mjs +27 -13
- package/clients/cli/commands/component.mjs +14 -3
- package/clients/cli/commands/discover.doc.mjs +2 -2
- package/clients/cli/commands/discover.mjs +20 -3
- package/clients/cli/commands/docs.doc.mjs +11 -9
- package/clients/cli/commands/docs.mjs +50 -21
- package/clients/cli/commands/experimental/icon.mjs +330 -227
- package/clients/cli/commands/experimental/render.mjs +16 -1
- package/clients/cli/commands/experimental/theme.mjs +42 -17
- package/clients/cli/commands/experimental-icon-add.doc.mjs +1 -1
- package/clients/cli/commands/experimental-icon-map.doc.mjs +4 -1
- package/clients/cli/commands/experimental-icon-new-definition.doc.mjs +4 -1
- package/clients/cli/commands/experimental-icon-new-set.doc.mjs +4 -1
- package/clients/cli/commands/experimental-icon-use.doc.mjs +1 -1
- package/clients/cli/commands/experimental-icon.doc.mjs +1 -1
- package/clients/cli/commands/experimental-render.doc.mjs +3 -3
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -1
- package/clients/cli/commands/init.doc.mjs +36 -24
- package/clients/cli/commands/integration-check.doc.mjs +1 -1
- package/clients/cli/commands/mcp.doc.mjs +53 -0
- package/clients/cli/commands/mcp.mjs +51 -0
- package/clients/cli/commands/search.mjs +46 -9
- package/clients/cli/commands/template.mjs +3 -2
- package/clients/cli/commands/theme-build.doc.mjs +1 -1
- package/clients/cli/commands/theme.mjs +12 -2
- package/clients/cli/commands/upgrade.doc.mjs +3 -2
- package/clients/cli/commands.generated.json +1 -1
- package/clients/cli/formatters/index.mjs +52 -6
- package/clients/cli/index.mjs +23 -17
- package/clients/cli/lib/base-gate.mjs +37 -5
- package/clients/cli/lib/define-command.mjs +82 -4
- package/clients/cli/lib/json-shim.mjs +61 -4
- package/clients/cli/lib/manifest.mjs +9 -1
- package/clients/cli/lib/mcp-server.mjs +286 -0
- package/clients/cli/lib/mcp-tools.mjs +405 -0
- package/clients/cli/lib/other-cli-words.mjs +99 -0
- package/clients/cli/lib/stray-option.mjs +27 -1
- package/clients/cli/lib/unknown-command.mjs +326 -11
- package/clients/cli/manifest.generated.json +1 -1
- package/clients/cli/run.mjs +1 -1
- package/foundation/agent-docs/agent-docs.d.mts +49 -1
- package/foundation/agent-docs/agent-docs.mjs +108 -7
- package/foundation/agent-docs/computer-agent-text.mjs +1 -1
- package/foundation/bases/core.d.mts +1 -1
- package/foundation/bases/core.mjs +3 -3
- package/foundation/bases/resolve.d.mts +4 -8
- package/foundation/bases/resolve.mjs +15 -21
- package/foundation/bases/state.d.mts +15 -9
- package/foundation/bases/state.mjs +33 -6
- package/foundation/config/project.d.mts +5 -4
- package/foundation/config/project.mjs +33 -17
- package/foundation/discovery/component-discovery.mjs +15 -28
- package/foundation/discovery/icon-imports.d.mts +66 -0
- package/foundation/discovery/icon-imports.mjs +225 -0
- package/foundation/discovery/icon-ranking.d.mts +12 -2
- package/foundation/discovery/icon-ranking.mjs +197 -10
- package/foundation/discovery/icon-set-checks.mjs +2 -1
- package/foundation/discovery/icon-set-discovery.d.mts +28 -0
- package/foundation/discovery/icon-set-discovery.mjs +42 -0
- package/foundation/discovery/icon-set-writer.d.mts +2 -11
- package/foundation/discovery/icon-set-writer.mjs +3 -29
- package/foundation/discovery/module-exports.d.mts +1 -1
- package/foundation/discovery/module-exports.mjs +136 -33
- package/foundation/discovery/name-roots.d.mts +5 -0
- package/foundation/discovery/name-roots.mjs +11 -0
- package/foundation/discovery/runner-allowlist.d.mts +1 -0
- package/foundation/discovery/runner-allowlist.mjs +2 -0
- package/foundation/discovery/runner-commands.mjs +1 -0
- package/foundation/discovery/template-adapter.d.mts +1 -1
- package/foundation/discovery/template-destination.d.mts +14 -6
- package/foundation/discovery/template-destination.mjs +42 -8
- package/foundation/discovery/template-icons.d.mts +45 -2
- package/foundation/discovery/template-icons.mjs +26 -54
- package/foundation/discovery/template-needs.d.mts +28 -2
- package/foundation/discovery/template-needs.mjs +92 -11
- package/foundation/discovery/theme-discovery.d.mts +8 -0
- package/foundation/discovery/theme-discovery.mjs +23 -6
- package/foundation/discovery/theme-imports.mjs +2 -4
- package/foundation/doc-compiler/parse-readable.mjs +4 -3
- package/foundation/doc-compiler/stored-docs.d.mts +13 -0
- package/foundation/doc-compiler/stored-docs.mjs +74 -3
- package/foundation/env/cli-command.d.mts +68 -10
- package/foundation/env/cli-command.mjs +116 -22
- package/foundation/env/project-scope.d.mts +9 -0
- package/foundation/env/project-scope.mjs +28 -2
- package/foundation/fs/gather-cache.d.mts +23 -0
- package/foundation/fs/gather-cache.mjs +94 -2
- package/foundation/fs/module-loader.d.mts +3 -1
- package/foundation/fs/module-loader.mjs +85 -5
- package/foundation/fs/read-record.mjs +9 -5
- package/foundation/identity/package-names.d.mts +18 -0
- package/foundation/identity/package-names.mjs +19 -0
- package/foundation/identity/providers.mjs +3 -2
- package/foundation/integrations/icon-features.d.mts +63 -0
- package/foundation/integrations/icon-features.mjs +54 -0
- package/foundation/integrations/integrations.d.mts +13 -1
- package/foundation/integrations/integrations.mjs +47 -6
- package/foundation/integrations/pack-state.d.mts +21 -0
- package/foundation/integrations/pack-state.mjs +42 -19
- package/foundation/integrations/validate-contributions.d.mts +11 -3
- package/foundation/integrations/validate-contributions.mjs +51 -13
- package/foundation/release/cache.d.mts +13 -1
- package/foundation/release/cache.mjs +94 -14
- package/foundation/release/notices.d.mts +15 -0
- package/foundation/release/notices.mjs +111 -7
- package/foundation/release/project.d.mts +3 -4
- package/foundation/release/project.mjs +5 -6
- package/foundation/render/client-bundle.d.mts +126 -0
- package/foundation/render/client-bundle.mjs +565 -0
- package/foundation/render/cut-short.d.mts +7 -1
- package/foundation/render/cut-short.mjs +46 -6
- package/foundation/render/embedded-imports.d.mts +4 -3
- package/foundation/render/embedded-imports.mjs +13 -8
- package/foundation/render/esbuild-dependency.d.mts +14 -0
- package/foundation/render/esbuild-dependency.mjs +41 -0
- package/foundation/render/file-header.mjs +5 -4
- package/foundation/render/page-worker.mjs +562 -86
- package/foundation/render/picture-chrome.mjs +54 -29
- package/foundation/render/picture-playwright.mjs +78 -42
- package/foundation/render/picture-window.d.mts +33 -0
- package/foundation/render/picture-window.mjs +78 -0
- package/foundation/render/render-page.d.mts +55 -4
- package/foundation/render/render-page.mjs +199 -28
- package/foundation/render/restore-folder.d.mts +13 -0
- package/foundation/render/restore-folder.mjs +30 -0
- package/foundation/render/served-packages.d.mts +2 -1
- package/foundation/render/served-packages.mjs +5 -3
- package/foundation/render/ts-paths.d.mts +11 -0
- package/foundation/render/ts-paths.mjs +27 -2
- package/foundation/render/value-uses.d.mts +43 -0
- package/foundation/render/value-uses.mjs +110 -0
- package/foundation/response/error-codes.d.mts +2 -1
- package/foundation/response/error-codes.doc.mjs +7 -1
- package/foundation/response/error-codes.mjs +10 -2
- package/foundation/response/response-types.doc.mjs +12 -12
- package/foundation/runtime/package-root.d.mts +8 -0
- package/foundation/runtime/package-root.mjs +20 -0
- package/foundation/suggest/other-command.d.mts +11 -0
- package/foundation/suggest/other-command.mjs +1 -1
- package/foundation/text/icon-id.d.mts +20 -0
- package/foundation/text/icon-id.mjs +40 -0
- package/foundation/text/icon-set-next.d.mts +25 -0
- package/foundation/text/icon-set-next.mjs +29 -0
- package/foundation/xle/browser.d.mts +2 -2
- package/package.json +7 -6
|
@@ -45,6 +45,13 @@ export function placeholderUses(source: string): Array<{
|
|
|
45
45
|
* @returns {string[]}
|
|
46
46
|
*/
|
|
47
47
|
export function placeholderFixes(definitions: string[], main: string, backups?: readonly string[], variant?: string | null): string[];
|
|
48
|
+
/**
|
|
49
|
+
* Index every installed set's exports: `<module>\0<export>` → the icon it
|
|
50
|
+
* draws and the variant that export draws.
|
|
51
|
+
* @param {DiscoveredIconSet[]} sets
|
|
52
|
+
* @returns {Map<string, SourceIcon>}
|
|
53
|
+
*/
|
|
54
|
+
export function indexSets(sets: DiscoveredIconSet[]): Map<string, SourceIcon>;
|
|
48
55
|
/**
|
|
49
56
|
* The target-set icon whose reviewed `matches` name the source icon with one
|
|
50
57
|
* of `confidences`, ties broken by the order the confidences are given and
|
|
@@ -68,6 +75,36 @@ export function matchIcon(source: SourceIcon, target: DiscoveredIconSet): {
|
|
|
68
75
|
icon: IconSetIcon;
|
|
69
76
|
by: "match" | "definition";
|
|
70
77
|
} | null;
|
|
78
|
+
/**
|
|
79
|
+
* The icon of a set whose export re-exports a library export, read from the
|
|
80
|
+
* set's generated module: the same artwork, in one of the set's looks.
|
|
81
|
+
* @param {DiscoveredIconSet} set
|
|
82
|
+
* @param {string} module the library module the template imports from
|
|
83
|
+
* @param {string} imported the export it imports
|
|
84
|
+
* @param {Map<DiscoveredIconSet, Map<string, string>>} read each set's
|
|
85
|
+
* exports by the library export they re-export, read once per mapping
|
|
86
|
+
* @returns {IconSetIcon | undefined}
|
|
87
|
+
*/
|
|
88
|
+
export function wrappedIcon(set: DiscoveredIconSet, module: string, imported: string, read: Map<DiscoveredIconSet, Map<string, string>>): IconSetIcon | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* Whether a module is one of Astryx's own packages (`@astryxdesign/core`,
|
|
91
|
+
* its subpaths, and every other `@astryxdesign/` package).
|
|
92
|
+
* @param {string} module
|
|
93
|
+
*/
|
|
94
|
+
export function isAstryxModule(module: string): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Whether a set wraps the library a module belongs to: the module is the
|
|
97
|
+
* package the set's data names as its `source`, or a subpath of it.
|
|
98
|
+
* @param {DiscoveredIconSet} set
|
|
99
|
+
* @param {string} module
|
|
100
|
+
*/
|
|
101
|
+
export function wrapsModule(set: DiscoveredIconSet, module: string): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* The name an import specifier reads from its module: `default` for a
|
|
104
|
+
* default import, `*` for a namespace import.
|
|
105
|
+
* @param {any} specifier
|
|
106
|
+
*/
|
|
107
|
+
export function importedName(specifier: any): any;
|
|
71
108
|
/**
|
|
72
109
|
* The keys of a template's `icons` that its source binds by no import or
|
|
73
110
|
* re-export at all, so they can never map (`integration check` lists them).
|
|
@@ -90,6 +127,12 @@ export function sharedTemplateMeanings(declared: Record<string, string>): Array<
|
|
|
90
127
|
definition: string;
|
|
91
128
|
keys: string[];
|
|
92
129
|
}>;
|
|
130
|
+
/**
|
|
131
|
+
* Whether a module is a package import: not relative, not absolute, and not
|
|
132
|
+
* a Node built-in.
|
|
133
|
+
* @param {string} module
|
|
134
|
+
*/
|
|
135
|
+
export function isPackageModule(module: string): boolean;
|
|
93
136
|
/**
|
|
94
137
|
* The value imports a template takes from other packages, as the keys its
|
|
95
138
|
* `icons` uses: a named import by the name it imports, a default import by
|
|
@@ -147,8 +190,8 @@ export function undeclaredTemplateIcons(templates: Array<{
|
|
|
147
190
|
* icon definition each imported icon draws, by its imported name
|
|
148
191
|
* @returns {{source: string, icons: TemplateIconsReport | undefined}} `icons`
|
|
149
192
|
* is undefined, and the source unchanged, when no set is given and none is
|
|
150
|
-
* configured, as for every project
|
|
151
|
-
* no sets: icon sets are experimental (spec:AST-017 FR27), so a
|
|
193
|
+
* configured, as for every project where icon features are off, whose
|
|
194
|
+
* state carries no sets: icon sets are experimental (spec:AST-017 FR27), so a
|
|
152
195
|
* project that does not use them gets exactly the output it always has.
|
|
153
196
|
*/
|
|
154
197
|
export function mapTemplateIcons(source: string, { sets, choice }: {
|
|
@@ -58,7 +58,12 @@ import {
|
|
|
58
58
|
walk,
|
|
59
59
|
writtenNames,
|
|
60
60
|
} from './template-source-tree.mjs';
|
|
61
|
-
import {
|
|
61
|
+
import {
|
|
62
|
+
definitionsByIcon,
|
|
63
|
+
iconLookExport,
|
|
64
|
+
iconUseCommand,
|
|
65
|
+
missingIconLook,
|
|
66
|
+
} from './icon-set-discovery.mjs';
|
|
62
67
|
import {astryxDefinitionsByName} from './icon-definition-discovery.mjs';
|
|
63
68
|
import {generatedOrigins} from './icon-set-writer.mjs';
|
|
64
69
|
import {compareText} from '../text/compare-text.mjs';
|
|
@@ -350,7 +355,7 @@ export function placeholderFixes(definitions, main, backups = [], variant) {
|
|
|
350
355
|
* @param {DiscoveredIconSet[]} sets
|
|
351
356
|
* @returns {Map<string, SourceIcon>}
|
|
352
357
|
*/
|
|
353
|
-
function indexSets(sets) {
|
|
358
|
+
export function indexSets(sets) {
|
|
354
359
|
/** @type {Map<string, SourceIcon>} */
|
|
355
360
|
const index = new Map();
|
|
356
361
|
const astryx = astryxDefinitionsByName();
|
|
@@ -450,45 +455,6 @@ export function matchIcon(source, target) {
|
|
|
450
455
|
return null;
|
|
451
456
|
}
|
|
452
457
|
|
|
453
|
-
/**
|
|
454
|
-
* The export a mapped icon uses: the target's variant of the name asked for
|
|
455
|
-
* (the project's variant, else the source's) when it has one, else the
|
|
456
|
-
* default.
|
|
457
|
-
* @param {IconSetIcon} icon
|
|
458
|
-
* @param {DiscoveredIconSet} set
|
|
459
|
-
* @param {string | undefined} variant
|
|
460
|
-
*/
|
|
461
|
-
function targetExport(icon, set, variant) {
|
|
462
|
-
const module = icon.module ?? set.data.module;
|
|
463
|
-
if (variant && variant !== set.data.default?.variant) {
|
|
464
|
-
const entry = (icon.variants ?? []).find(each => each.variant === variant);
|
|
465
|
-
if (entry) {
|
|
466
|
-
return {module: entry.module ?? module, export: entry.export};
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
return {module, export: icon.export};
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
/**
|
|
473
|
-
* The look a mapped icon draws when the look asked for (the project's
|
|
474
|
-
* variant, else the source's) is one the target's icon does not have: what
|
|
475
|
-
* was asked for and the target's default look. Undefined when the look is
|
|
476
|
-
* kept, or when no look is asked for.
|
|
477
|
-
* @param {IconSetIcon} icon
|
|
478
|
-
* @param {DiscoveredIconSet} set
|
|
479
|
-
* @param {string | undefined} variant
|
|
480
|
-
* @returns {{asked: string, used: string | null} | undefined}
|
|
481
|
-
*/
|
|
482
|
-
function lookChange(icon, set, variant) {
|
|
483
|
-
if (!variant) return undefined;
|
|
484
|
-
const fallback = set.data.default?.variant ?? null;
|
|
485
|
-
if (variant === fallback) return undefined;
|
|
486
|
-
if ((icon.variants ?? []).some(each => each.variant === variant)) {
|
|
487
|
-
return undefined;
|
|
488
|
-
}
|
|
489
|
-
return {asked: variant, used: fallback};
|
|
490
|
-
}
|
|
491
|
-
|
|
492
458
|
/**
|
|
493
459
|
* Whether an icon draws a look: its own export draws the set's default
|
|
494
460
|
* variant, and each of its `variants` one more.
|
|
@@ -513,7 +479,7 @@ function hasLook(icon, set, variant) {
|
|
|
513
479
|
* exports by the library export they re-export, read once per mapping
|
|
514
480
|
* @returns {IconSetIcon | undefined}
|
|
515
481
|
*/
|
|
516
|
-
function wrappedIcon(set, module, imported, read) {
|
|
482
|
+
export function wrappedIcon(set, module, imported, read) {
|
|
517
483
|
let byOrigin = read.get(set);
|
|
518
484
|
if (!byOrigin) {
|
|
519
485
|
byOrigin = new Map();
|
|
@@ -541,7 +507,7 @@ function wrappedIcon(set, module, imported, read) {
|
|
|
541
507
|
* its subpaths, and every other `@astryxdesign/` package).
|
|
542
508
|
* @param {string} module
|
|
543
509
|
*/
|
|
544
|
-
function isAstryxModule(module) {
|
|
510
|
+
export function isAstryxModule(module) {
|
|
545
511
|
return module.startsWith('@astryxdesign/');
|
|
546
512
|
}
|
|
547
513
|
|
|
@@ -551,7 +517,7 @@ function isAstryxModule(module) {
|
|
|
551
517
|
* @param {DiscoveredIconSet} set
|
|
552
518
|
* @param {string} module
|
|
553
519
|
*/
|
|
554
|
-
function wrapsModule(set, module) {
|
|
520
|
+
export function wrapsModule(set, module) {
|
|
555
521
|
const library = set.data.source?.package;
|
|
556
522
|
return (
|
|
557
523
|
library != null && (module === library || module.startsWith(`${library}/`))
|
|
@@ -563,7 +529,7 @@ function wrapsModule(set, module) {
|
|
|
563
529
|
* default import, `*` for a namespace import.
|
|
564
530
|
* @param {any} specifier
|
|
565
531
|
*/
|
|
566
|
-
function importedName(specifier) {
|
|
532
|
+
export function importedName(specifier) {
|
|
567
533
|
if (specifier.type === 'ImportDefaultSpecifier') return 'default';
|
|
568
534
|
if (specifier.type === 'ImportNamespaceSpecifier') return '*';
|
|
569
535
|
return specifier.imported.name ?? specifier.imported.value;
|
|
@@ -674,7 +640,7 @@ export function sharedTemplateMeanings(declared) {
|
|
|
674
640
|
* a Node built-in.
|
|
675
641
|
* @param {string} module
|
|
676
642
|
*/
|
|
677
|
-
function isPackageModule(module) {
|
|
643
|
+
export function isPackageModule(module) {
|
|
678
644
|
return !/^(?:\.|\/|node:)/u.test(module);
|
|
679
645
|
}
|
|
680
646
|
|
|
@@ -882,8 +848,8 @@ export const NO_ICON_SETS = Object.freeze({
|
|
|
882
848
|
* icon definition each imported icon draws, by its imported name
|
|
883
849
|
* @returns {{source: string, icons: TemplateIconsReport | undefined}} `icons`
|
|
884
850
|
* is undefined, and the source unchanged, when no set is given and none is
|
|
885
|
-
* configured, as for every project
|
|
886
|
-
* no sets: icon sets are experimental (spec:AST-017 FR27), so a
|
|
851
|
+
* configured, as for every project where icon features are off, whose
|
|
852
|
+
* state carries no sets: icon sets are experimental (spec:AST-017 FR27), so a
|
|
887
853
|
* project that does not use them gets exactly the output it always has.
|
|
888
854
|
*/
|
|
889
855
|
export function mapTemplateIcons(source, {sets, choice}, declared = {}) {
|
|
@@ -1135,7 +1101,7 @@ export function mapTemplateIcons(source, {sets, choice}, declared = {}) {
|
|
|
1135
1101
|
suggestion: {
|
|
1136
1102
|
set: target.name,
|
|
1137
1103
|
id: likely.id,
|
|
1138
|
-
...
|
|
1104
|
+
...iconLookExport(likely, target, askedLook(record)),
|
|
1139
1105
|
confidence: /** @type {const} */ ('likely'),
|
|
1140
1106
|
},
|
|
1141
1107
|
}
|
|
@@ -1160,7 +1126,7 @@ export function mapTemplateIcons(source, {sets, choice}, declared = {}) {
|
|
|
1160
1126
|
suggestion: {
|
|
1161
1127
|
set: target.name,
|
|
1162
1128
|
id: likely.id,
|
|
1163
|
-
...
|
|
1129
|
+
...iconLookExport(likely, target, askedLook(record)),
|
|
1164
1130
|
confidence: /** @type {const} */ ('likely'),
|
|
1165
1131
|
},
|
|
1166
1132
|
}
|
|
@@ -1168,8 +1134,8 @@ export function mapTemplateIcons(source, {sets, choice}, declared = {}) {
|
|
|
1168
1134
|
});
|
|
1169
1135
|
continue;
|
|
1170
1136
|
}
|
|
1171
|
-
const chosen =
|
|
1172
|
-
const look =
|
|
1137
|
+
const chosen = iconLookExport(match.icon, set, askedLook(record));
|
|
1138
|
+
const look = missingIconLook(match.icon, set, askedLook(record));
|
|
1173
1139
|
const key = `${chosen.module}\0${chosen.export}`;
|
|
1174
1140
|
let entry = added.get(key);
|
|
1175
1141
|
if (!entry) {
|
|
@@ -1278,13 +1244,19 @@ export function mapTemplateIcons(source, {sets, choice}, declared = {}) {
|
|
|
1278
1244
|
const wrapper = wrapped.get(specifier);
|
|
1279
1245
|
if (!wrapper) continue;
|
|
1280
1246
|
accounted.add(declaredKey(specifier));
|
|
1247
|
+
// A set wraps a library package, not one subpath of it.
|
|
1248
|
+
const library = wrapper.data.source?.package;
|
|
1249
|
+
const from =
|
|
1250
|
+
library && node.source.value !== library
|
|
1251
|
+
? `${node.source.value}, part of ${library}`
|
|
1252
|
+
: node.source.value;
|
|
1281
1253
|
icons.kept.push({
|
|
1282
1254
|
module: node.source.value,
|
|
1283
1255
|
export: importedName(specifier),
|
|
1284
1256
|
reason:
|
|
1285
1257
|
wrapper === target
|
|
1286
|
-
? `it already comes from ${
|
|
1287
|
-
: `no set in your list maps its icon definition, and it already comes from ${
|
|
1258
|
+
? `it already comes from ${from}, which ${icons.set} wraps`
|
|
1259
|
+
: `no set in your list maps its icon definition, and it already comes from ${from}, which ${wrapper.package}/${wrapper.name} wraps`,
|
|
1288
1260
|
});
|
|
1289
1261
|
}
|
|
1290
1262
|
}
|
|
@@ -16,6 +16,14 @@
|
|
|
16
16
|
* `@scope/name`, unscoped to the first path segment).
|
|
17
17
|
*/
|
|
18
18
|
export function extractImportedPackages(source: string): Set<string>;
|
|
19
|
+
/**
|
|
20
|
+
* The files a source names with `/// <reference path="…" />` before its
|
|
21
|
+
* first statement, the only place TypeScript reads one. They bring in types
|
|
22
|
+
* for the type check, not code a build runs, so they are not imports.
|
|
23
|
+
* @param {string} source
|
|
24
|
+
* @returns {string[]}
|
|
25
|
+
*/
|
|
26
|
+
export function referencedPaths(source: string): string[];
|
|
19
27
|
/**
|
|
20
28
|
* moduleSpecifiers, read from the source's syntax tree.
|
|
21
29
|
* @param {string} source
|
|
@@ -26,14 +34,30 @@ export function parsedSpecifiers(source: string): string[];
|
|
|
26
34
|
* The command that installs `packages` in the project at `cwd`, in its package
|
|
27
35
|
* manager and with the CLI workspace's version ranges. Null, with the reason,
|
|
28
36
|
* when several lockfiles leave the package manager undetermined; null with no
|
|
29
|
-
* reason when there is nothing to install.
|
|
37
|
+
* reason when there is nothing to install. `installGuidance` is the line the
|
|
38
|
+
* project's integrations give for adding packages, with the packages filled
|
|
39
|
+
* in, or null; where it is set, printers show it instead of the command.
|
|
30
40
|
* @param {string[]} packages
|
|
31
41
|
* @param {string} cwd
|
|
32
|
-
* @returns {{installCommand: string | null, noCommandReason: string | null}}
|
|
42
|
+
* @returns {{installCommand: string | null, noCommandReason: string | null, installGuidance: string | null}}
|
|
33
43
|
*/
|
|
34
44
|
export function installCommandFor(packages: string[], cwd: string): {
|
|
35
45
|
installCommand: string | null;
|
|
36
46
|
noCommandReason: string | null;
|
|
47
|
+
installGuidance: string | null;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* The install step to print for `packages` in the project at `cwd`: the
|
|
51
|
+
* install guidance its integrations give, else its package manager's command,
|
|
52
|
+
* or `npm install` with a note naming the folder whose lockfiles disagree when
|
|
53
|
+
* the package manager cannot be decided.
|
|
54
|
+
* @param {string[]} packages
|
|
55
|
+
* @param {string} cwd
|
|
56
|
+
* @returns {{line: string, note: string | null}}
|
|
57
|
+
*/
|
|
58
|
+
export function installStepFor(packages: string[], cwd: string): {
|
|
59
|
+
line: string;
|
|
60
|
+
note: string | null;
|
|
37
61
|
};
|
|
38
62
|
/**
|
|
39
63
|
* Analyze what a template source needs that the target project lacks.
|
|
@@ -48,10 +72,12 @@ export function installCommandFor(packages: string[], cwd: string): {
|
|
|
48
72
|
* notes: string[],
|
|
49
73
|
* missingPackages: string[],
|
|
50
74
|
* installCommand: string | null,
|
|
75
|
+
* installGuidance: string | null,
|
|
51
76
|
* }}
|
|
52
77
|
*/
|
|
53
78
|
export function analyzeTemplateNeeds(source: string, cwd: string): {
|
|
54
79
|
notes: string[];
|
|
55
80
|
missingPackages: string[];
|
|
56
81
|
installCommand: string | null;
|
|
82
|
+
installGuidance: string | null;
|
|
57
83
|
};
|
|
@@ -24,9 +24,12 @@ import {
|
|
|
24
24
|
walk,
|
|
25
25
|
} from './template-source-tree.mjs';
|
|
26
26
|
import {readStore, storedKey} from '../doc-compiler/stored-docs.mjs';
|
|
27
|
-
import {CLI_ROOT, findWorkspaceRoot} from '../fs/paths.mjs';
|
|
27
|
+
import {CLI_ROOT, findPackageRoot, findWorkspaceRoot} from '../fs/paths.mjs';
|
|
28
28
|
import {writtenString} from '../text/written-string.mjs';
|
|
29
29
|
import {detectStylingSystem} from '../agent-docs/agent-docs.mjs';
|
|
30
|
+
import {servingRootPackages} from '../runtime/package-root.mjs';
|
|
31
|
+
import {runChoice} from '../release/run-context.mjs';
|
|
32
|
+
import {installGuidanceFor} from '../env/cli-command.mjs';
|
|
30
33
|
import {
|
|
31
34
|
decidePackageManagerIn,
|
|
32
35
|
formatCliCommand,
|
|
@@ -95,6 +98,31 @@ function moduleSpecifiers(source) {
|
|
|
95
98
|
return parsedSpecifiers(source);
|
|
96
99
|
}
|
|
97
100
|
|
|
101
|
+
/**
|
|
102
|
+
* The files a source names with `/// <reference path="…" />` before its
|
|
103
|
+
* first statement, the only place TypeScript reads one. They bring in types
|
|
104
|
+
* for the type check, not code a build runs, so they are not imports.
|
|
105
|
+
* @param {string} source
|
|
106
|
+
* @returns {string[]}
|
|
107
|
+
*/
|
|
108
|
+
export function referencedPaths(source) {
|
|
109
|
+
let file;
|
|
110
|
+
try {
|
|
111
|
+
file = parseTemplateSource(source, {errorRecovery: true});
|
|
112
|
+
} catch {
|
|
113
|
+
return [];
|
|
114
|
+
}
|
|
115
|
+
const first = file.program.body[0]?.start ?? Infinity;
|
|
116
|
+
/** @type {string[]} */
|
|
117
|
+
const out = [];
|
|
118
|
+
for (const c of file.comments ?? []) {
|
|
119
|
+
if (c.type !== 'CommentLine' || c.start >= first) continue;
|
|
120
|
+
const ref = /^\/\s*<reference\s+path\s*=\s*(["'])(.+?)\1/.exec(c.value);
|
|
121
|
+
if (ref) out.push(ref[2]);
|
|
122
|
+
}
|
|
123
|
+
return out;
|
|
124
|
+
}
|
|
125
|
+
|
|
98
126
|
/**
|
|
99
127
|
* moduleSpecifiers, read from the source's syntax tree.
|
|
100
128
|
* @param {string} source
|
|
@@ -134,6 +162,12 @@ export function parsedSpecifiers(source) {
|
|
|
134
162
|
add(node.arguments?.[0]);
|
|
135
163
|
} else if (node.type === 'ImportExpression') {
|
|
136
164
|
add(node.source);
|
|
165
|
+
} else if (
|
|
166
|
+
node.type === 'TSImportEqualsDeclaration' &&
|
|
167
|
+
node.moduleReference?.type === 'TSExternalModuleReference'
|
|
168
|
+
) {
|
|
169
|
+
// `import s = require('../shared')`
|
|
170
|
+
add(node.moduleReference.expression);
|
|
137
171
|
} else if (node.type === 'TSImportType') {
|
|
138
172
|
// `type O = import('chart-lib').Options`
|
|
139
173
|
add(
|
|
@@ -251,28 +285,59 @@ function cliPackageRanges() {
|
|
|
251
285
|
* The command that installs `packages` in the project at `cwd`, in its package
|
|
252
286
|
* manager and with the CLI workspace's version ranges. Null, with the reason,
|
|
253
287
|
* when several lockfiles leave the package manager undetermined; null with no
|
|
254
|
-
* reason when there is nothing to install.
|
|
288
|
+
* reason when there is nothing to install. `installGuidance` is the line the
|
|
289
|
+
* project's integrations give for adding packages, with the packages filled
|
|
290
|
+
* in, or null; where it is set, printers show it instead of the command.
|
|
255
291
|
* @param {string[]} packages
|
|
256
292
|
* @param {string} cwd
|
|
257
|
-
* @returns {{installCommand: string | null, noCommandReason: string | null}}
|
|
293
|
+
* @returns {{installCommand: string | null, noCommandReason: string | null, installGuidance: string | null}}
|
|
258
294
|
*/
|
|
259
295
|
export function installCommandFor(packages, cwd) {
|
|
260
296
|
if (packages.length === 0) {
|
|
261
|
-
return {installCommand: null, noCommandReason: null};
|
|
297
|
+
return {installCommand: null, noCommandReason: null, installGuidance: null};
|
|
262
298
|
}
|
|
263
299
|
const resolved = resolveInstallVerb(cwd);
|
|
264
300
|
const ranges = cliPackageRanges();
|
|
265
|
-
|
|
301
|
+
// A `*` range pins nothing, so the bare name says the same in fewer bytes.
|
|
302
|
+
const specs = packages.map(p =>
|
|
303
|
+
ranges[p] && ranges[p] !== '*' ? `${p}@"${ranges[p]}"` : p,
|
|
304
|
+
);
|
|
305
|
+
// Guidance names the bare packages: the integration's own rule picks versions.
|
|
306
|
+
const installGuidance = installGuidanceFor(packages, cwd) ?? null;
|
|
266
307
|
if (resolved.verb !== null) {
|
|
267
308
|
return {
|
|
268
309
|
installCommand: `${resolved.verb} ${specs.join(' ')}`,
|
|
269
310
|
noCommandReason: null,
|
|
311
|
+
installGuidance,
|
|
270
312
|
};
|
|
271
313
|
}
|
|
272
314
|
const where = path.relative(cwd, resolved.dir) || '.';
|
|
273
315
|
return {
|
|
274
316
|
installCommand: null,
|
|
275
317
|
noCommandReason: `Install missing dependencies: ${specs.join(' ')}. No install command: ${where} has ${resolved.lockfiles.join(' and ')}, and nothing there says which package manager to use.`,
|
|
318
|
+
installGuidance,
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* The install step to print for `packages` in the project at `cwd`: the
|
|
324
|
+
* install guidance its integrations give, else its package manager's command,
|
|
325
|
+
* or `npm install` with a note naming the folder whose lockfiles disagree when
|
|
326
|
+
* the package manager cannot be decided.
|
|
327
|
+
* @param {string[]} packages
|
|
328
|
+
* @param {string} cwd
|
|
329
|
+
* @returns {{line: string, note: string | null}}
|
|
330
|
+
*/
|
|
331
|
+
export function installStepFor(packages, cwd) {
|
|
332
|
+
const {installCommand, installGuidance} = installCommandFor(packages, cwd);
|
|
333
|
+
if (installGuidance) return {line: installGuidance, note: null};
|
|
334
|
+
if (installCommand) return {line: installCommand, note: null};
|
|
335
|
+
const resolved = resolveInstallVerb(cwd);
|
|
336
|
+
const where =
|
|
337
|
+
resolved.verb === null ? path.relative(cwd, resolved.dir) || '.' : '.';
|
|
338
|
+
return {
|
|
339
|
+
line: `npm install ${packages.join(' ')}`,
|
|
340
|
+
note: `the lockfiles in ${where === '.' ? 'this folder' : where} disagree; use the package manager this project uses`,
|
|
276
341
|
};
|
|
277
342
|
}
|
|
278
343
|
|
|
@@ -289,6 +354,7 @@ export function installCommandFor(packages, cwd) {
|
|
|
289
354
|
* notes: string[],
|
|
290
355
|
* missingPackages: string[],
|
|
291
356
|
* installCommand: string | null,
|
|
357
|
+
* installGuidance: string | null,
|
|
292
358
|
* }}
|
|
293
359
|
*/
|
|
294
360
|
export function analyzeTemplateNeeds(source, cwd) {
|
|
@@ -314,9 +380,20 @@ export function analyzeTemplateNeeds(source, cwd) {
|
|
|
314
380
|
// No package.json or unreadable — treat everything as missing.
|
|
315
381
|
}
|
|
316
382
|
|
|
317
|
-
|
|
383
|
+
// Outside a project, a page takes what the host's package set provides,
|
|
384
|
+
// so a package that set declares needs no install.
|
|
385
|
+
const provided = runChoice(cwd).inProject ? [] : servingRootPackages();
|
|
386
|
+
const missing = external.filter(
|
|
387
|
+
p => !(p in projectDeps) && !provided.includes(p),
|
|
388
|
+
);
|
|
318
389
|
|
|
319
|
-
|
|
390
|
+
// In a folder that no package.json holds, an install would make the folder
|
|
391
|
+
// a project, so the missing packages are named for the project that uses
|
|
392
|
+
// the page instead.
|
|
393
|
+
const unpackaged = findPackageRoot(cwd) == null;
|
|
394
|
+
const {installCommand, noCommandReason, installGuidance} = unpackaged
|
|
395
|
+
? {installCommand: null, noCommandReason: null, installGuidance: null}
|
|
396
|
+
: installCommandFor(missing, cwd);
|
|
320
397
|
|
|
321
398
|
// ── StyleX compiler ────────────────────────────────────────────────────
|
|
322
399
|
const usesStylex = imported.has(STYLEX_RUNTIME);
|
|
@@ -328,9 +405,13 @@ export function analyzeTemplateNeeds(source, cwd) {
|
|
|
328
405
|
const notes = [];
|
|
329
406
|
if (missing.length > 0) {
|
|
330
407
|
notes.push(
|
|
331
|
-
|
|
332
|
-
? `
|
|
333
|
-
:
|
|
408
|
+
unpackaged
|
|
409
|
+
? `Missing dependencies: ${missing.join(', ')}. Install them in the project that uses this page.`
|
|
410
|
+
: installGuidance
|
|
411
|
+
? `Install missing dependencies: ${installGuidance}`
|
|
412
|
+
: installCommand
|
|
413
|
+
? `Install missing dependencies: ${installCommand}`
|
|
414
|
+
: (noCommandReason ?? ''),
|
|
334
415
|
);
|
|
335
416
|
}
|
|
336
417
|
if (stylexCompilerNeeded) {
|
|
@@ -339,5 +420,5 @@ export function analyzeTemplateNeeds(source, cwd) {
|
|
|
339
420
|
);
|
|
340
421
|
}
|
|
341
422
|
|
|
342
|
-
return {notes, missingPackages: missing, installCommand};
|
|
423
|
+
return {notes, missingPackages: missing, installCommand, installGuidance};
|
|
343
424
|
}
|
|
@@ -170,6 +170,14 @@ export function discoverLocalThemes(projectDir: string, owner?: string, { onFold
|
|
|
170
170
|
*/
|
|
171
171
|
export function discoverIntegrationThemes(integration: import("../integrations/integrations.mjs").LoadedIntegration): Promise<DiscoveredTheme[]>;
|
|
172
172
|
export const BUNDLED_THEME_PACKAGE: "@astryxdesign/cli";
|
|
173
|
+
/**
|
|
174
|
+
* The theme a project starts with when it has none: the package `init`
|
|
175
|
+
* installs and the build playbook tells such a project to add.
|
|
176
|
+
*/
|
|
177
|
+
export const STARTER_THEME: Readonly<{
|
|
178
|
+
slug: "neutral";
|
|
179
|
+
package: "@astryxdesign/theme-neutral";
|
|
180
|
+
}>;
|
|
173
181
|
export const THEMES_DIR: string;
|
|
174
182
|
export const THEME_DOC_SUFFIX: ".doc.mjs";
|
|
175
183
|
export { THEME_MODULE_EXTENSIONS };
|
|
@@ -23,6 +23,7 @@ import {lowerDoc} from '../doc-compiler/compile.mjs';
|
|
|
23
23
|
import {packageSource} from '../doc-compiler/source.mjs';
|
|
24
24
|
import {CLI_ROOT, realDir} from '../fs/paths.mjs';
|
|
25
25
|
import {persistedGather} from '../fs/gather-cache.mjs';
|
|
26
|
+
import {fileStamp, recordContentRead} from '../fs/read-record.mjs';
|
|
26
27
|
import {EXACT_CODEC} from '../fs/exact-codec.mjs';
|
|
27
28
|
import {listDirEntries} from '../fs/listing-cache.mjs';
|
|
28
29
|
import {formatCliCommand} from '../env/package-manager.mjs';
|
|
@@ -39,6 +40,15 @@ import {compareText} from '../text/compare-text.mjs';
|
|
|
39
40
|
import {currentNonCoreBase} from '../bases/state.mjs';
|
|
40
41
|
|
|
41
42
|
export const BUNDLED_THEME_PACKAGE = '@astryxdesign/cli';
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The theme a project starts with when it has none: the package `init`
|
|
46
|
+
* installs and the build playbook tells such a project to add.
|
|
47
|
+
*/
|
|
48
|
+
export const STARTER_THEME = Object.freeze({
|
|
49
|
+
slug: 'neutral',
|
|
50
|
+
package: '@astryxdesign/theme-neutral',
|
|
51
|
+
});
|
|
42
52
|
export const THEMES_DIR = path.join(CLI_ROOT, 'assets', 'templates', 'themes');
|
|
43
53
|
export const THEME_DOC_SUFFIX = '.doc.mjs';
|
|
44
54
|
|
|
@@ -670,8 +680,8 @@ function readThemeDoc(docPath, owner) {
|
|
|
670
680
|
|
|
671
681
|
/**
|
|
672
682
|
* Descriptor reads in this process, by path and label, reused while the file
|
|
673
|
-
* keeps its
|
|
674
|
-
* @type {Map<string, {
|
|
683
|
+
* keeps its stamp (`fileStamp`).
|
|
684
|
+
* @type {Map<string, {stamp: string, read: {value: Record<string, any>} | {error: unknown}}>}
|
|
675
685
|
*/
|
|
676
686
|
const descriptorReads = new Map();
|
|
677
687
|
|
|
@@ -705,10 +715,15 @@ export function readStaticDescriptorValue(
|
|
|
705
715
|
typeName,
|
|
706
716
|
{data = false} = {},
|
|
707
717
|
) {
|
|
708
|
-
|
|
718
|
+
// A kept read still counts as a read of the file, so a kept catalog sees an
|
|
719
|
+
// edit to it.
|
|
720
|
+
recordContentRead(docPath);
|
|
721
|
+
const stamp = fileStamp(docPath);
|
|
722
|
+
// An absent path throws the error a stat gives.
|
|
723
|
+
if (stamp === '-') fs.statSync(docPath);
|
|
709
724
|
const key = `${docPath}\0${label}\0${typeName}\0${data}`;
|
|
710
725
|
let cached = descriptorReads.get(key);
|
|
711
|
-
if (
|
|
726
|
+
if (cached?.stamp !== stamp) {
|
|
712
727
|
/** @type {{value: Record<string, any>} | {error: unknown}} */
|
|
713
728
|
let read;
|
|
714
729
|
try {
|
|
@@ -734,8 +749,10 @@ export function readStaticDescriptorValue(
|
|
|
734
749
|
} catch (error) {
|
|
735
750
|
read = {error};
|
|
736
751
|
}
|
|
737
|
-
cached = {
|
|
738
|
-
|
|
752
|
+
cached = {stamp, read};
|
|
753
|
+
// A file that appeared after its stamp is not kept: the entry would
|
|
754
|
+
// outlive its removal.
|
|
755
|
+
if (stamp !== '-') descriptorReads.set(key, cached);
|
|
739
756
|
}
|
|
740
757
|
if ('error' in cached.read) throw cached.read.error;
|
|
741
758
|
return data ? structuredClone(cached.read.value) : {...cached.read.value};
|
|
@@ -20,8 +20,7 @@ import {inspectPackageExport} from './package-exports.mjs';
|
|
|
20
20
|
import {themeImportPackage} from './theme-discovery.mjs';
|
|
21
21
|
import {isLocalThemeOwner, projectPath} from '../config/theme-state.mjs';
|
|
22
22
|
import {formatCliCommand} from '../env/package-manager.mjs';
|
|
23
|
-
import {listedPackageInstall} from '../release/notices.mjs';
|
|
24
|
-
import {installCommandFor} from './template-needs.mjs';
|
|
23
|
+
import {addMatchingCore, listedPackageInstall} from '../release/notices.mjs';
|
|
25
24
|
|
|
26
25
|
export class ThemeImportError extends Error {
|
|
27
26
|
/**
|
|
@@ -184,8 +183,7 @@ function resolvePackageTheme(theme, cwd, ownerThemeCount) {
|
|
|
184
183
|
}
|
|
185
184
|
// The app imports a theme from its package, bundled themes included, so
|
|
186
185
|
// the package is installed in the app before the theme is added.
|
|
187
|
-
const
|
|
188
|
-
const install = installCommand ?? `npm install ${importPackage}`;
|
|
186
|
+
const install = addMatchingCore(cwd, importPackage);
|
|
189
187
|
throw new ThemeImportError(
|
|
190
188
|
`Theme package "${importPackage}" is not installed. The app imports ${theme.slug} from it, so install it, then add the theme: \`${install}\`, then \`${add}\`.`,
|
|
191
189
|
{
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import {parseDoc} from '../../authoring/doctypes/parse.mjs';
|
|
14
|
-
import {storedParse} from './stored-docs.mjs';
|
|
14
|
+
import {keptParse, storedParse} from './stored-docs.mjs';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* @param {unknown} input
|
|
@@ -27,6 +27,7 @@ export function parseReadableDoc(input, label = 'doc') {
|
|
|
27
27
|
throw new Error(`${label} has unsupported type ${JSON.stringify(type)}.`);
|
|
28
28
|
}
|
|
29
29
|
// A doc Astryx ships was parsed at publish (scripts/generate-stored-docs.mjs):
|
|
30
|
-
// its stored parse is what parsing it gives.
|
|
31
|
-
|
|
30
|
+
// its stored parse is what parsing it gives. Another stored doc's parse is
|
|
31
|
+
// kept for the user once it is made.
|
|
32
|
+
return storedParse(input) ?? keptParse(input, () => parseDoc(input, label));
|
|
32
33
|
}
|
|
@@ -43,6 +43,19 @@ export function storedParseKey(key: string, name: string): string;
|
|
|
43
43
|
* @returns {any}
|
|
44
44
|
*/
|
|
45
45
|
export function storedParse(value: unknown): any;
|
|
46
|
+
/**
|
|
47
|
+
* The parse of `value` by `parse`. When `value` is a stored doc's export
|
|
48
|
+
* (./import.mjs), the parse is a function of the doc's text, the CLI build
|
|
49
|
+
* and the zod release the parsers load, so it is kept for the user by those
|
|
50
|
+
* (gather-cache's `persistedValue`): a later read of the same text, by the
|
|
51
|
+
* same build with the same zod, gets the kept parse and does not parse. Any
|
|
52
|
+
* other value is parsed as before, and so is every value when the zod
|
|
53
|
+
* release cannot be read.
|
|
54
|
+
* @param {unknown} value
|
|
55
|
+
* @param {() => any} parse
|
|
56
|
+
* @returns {any}
|
|
57
|
+
*/
|
|
58
|
+
export function keptParse(value: unknown, parse: () => any): any;
|
|
46
59
|
/**
|
|
47
60
|
* Where the exports of the doc files Astryx ships (the CLI's and Core's) are
|
|
48
61
|
* stored: each doc that imports nothing, reads nothing of where it sits, and
|