@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
package/api/doctor/_adapter.mjs
CHANGED
|
@@ -43,7 +43,14 @@ import {computerAgentTextSettings} from '../../foundation/env/user-settings.mjs'
|
|
|
43
43
|
import * as fs from 'node:fs';
|
|
44
44
|
import {createRequire} from 'node:module';
|
|
45
45
|
import {placeholderUses} from '../../foundation/discovery/template-icons.mjs';
|
|
46
|
+
import {iconImportFindings} from '../../foundation/discovery/icon-imports.mjs';
|
|
47
|
+
import {projectMapsImport} from '../../foundation/render/ts-paths.mjs';
|
|
48
|
+
import {
|
|
49
|
+
resolveIconModule,
|
|
50
|
+
splitSpecifier,
|
|
51
|
+
} from '../../foundation/discovery/icon-set-discovery.mjs';
|
|
46
52
|
export {placeholderFixes} from '../../foundation/discovery/template-icons.mjs';
|
|
53
|
+
export {iconFeatureGate} from '../../foundation/integrations/icon-features.mjs';
|
|
47
54
|
export {
|
|
48
55
|
iconUseCommand,
|
|
49
56
|
unlistedIconSets,
|
|
@@ -53,6 +60,7 @@ import {
|
|
|
53
60
|
rendersElement,
|
|
54
61
|
} from '../../foundation/discovery/module-exports.mjs';
|
|
55
62
|
import {cssImports} from '../../foundation/render/embedded-imports.mjs';
|
|
63
|
+
import {postcss} from '../../foundation/runtime/lazy-dependencies.mjs';
|
|
56
64
|
import {isValidSemver, satisfiesRange} from '../../foundation/env/semver.mjs';
|
|
57
65
|
import * as path from 'node:path';
|
|
58
66
|
import {
|
|
@@ -94,7 +102,11 @@ export {
|
|
|
94
102
|
themeBuild,
|
|
95
103
|
validateThemePrivateInputs,
|
|
96
104
|
} from '../theme/build/build.mjs';
|
|
97
|
-
export {
|
|
105
|
+
export {
|
|
106
|
+
installCommandFor as packageInstallCommand,
|
|
107
|
+
installStepFor as packageInstallStep,
|
|
108
|
+
} from '../../foundation/discovery/template-needs.mjs';
|
|
109
|
+
export {addMatchingCore} from '../../foundation/release/notices.mjs';
|
|
98
110
|
export {fontServiceFamilies} from '../../foundation/fonts/font-stylesheet.mjs';
|
|
99
111
|
export {resolveRecordedTheme} from '../theme/theme.mjs';
|
|
100
112
|
export {themeIdentifier} from '../theme/_fork.mjs';
|
|
@@ -225,7 +237,8 @@ export function readTextFileIfExists(file) {
|
|
|
225
237
|
* links. The doctor parses the returned bytes without executing app code.
|
|
226
238
|
* @param {string} root
|
|
227
239
|
* @param {string} generatedModule
|
|
228
|
-
* @param {{stylesheets?: boolean}} [options] - also list
|
|
240
|
+
* @param {{stylesheets?: boolean, pages?: boolean}} [options] - also list
|
|
241
|
+
* `.css` files, and `.html` pages
|
|
229
242
|
*/
|
|
230
243
|
export function listProjectSourceFiles(root, generatedModule, options = {}) {
|
|
231
244
|
/** @type {string[]} */
|
|
@@ -251,7 +264,10 @@ export function listProjectSourceFiles(root, generatedModule, options = {}) {
|
|
|
251
264
|
entry.isFile() &&
|
|
252
265
|
file !== generatedModule &&
|
|
253
266
|
(SOURCE_EXTENSIONS.has(path.extname(entry.name)) ||
|
|
254
|
-
(options.stylesheets === true &&
|
|
267
|
+
(options.stylesheets === true &&
|
|
268
|
+
path.extname(entry.name) === '.css') ||
|
|
269
|
+
(options.pages === true &&
|
|
270
|
+
/^\.html?$/u.test(path.extname(entry.name))))
|
|
255
271
|
) {
|
|
256
272
|
files.push(file);
|
|
257
273
|
}
|
|
@@ -297,6 +313,77 @@ export function findIconPlaceholders(projectDir) {
|
|
|
297
313
|
return found.sort((a, b) => compareText(a.file, b.file));
|
|
298
314
|
}
|
|
299
315
|
|
|
316
|
+
/**
|
|
317
|
+
* Each file in the project's own source with icon imports that do not match
|
|
318
|
+
* the project's icon sets (see `iconImportFindings`): an icon from a set that
|
|
319
|
+
* is not in the list, or from a set later in the list than one that draws the
|
|
320
|
+
* same meaning, and an icon-named import of an npm package that does not
|
|
321
|
+
* resolve, that no path alias (`compilerOptions.paths` or `baseUrl`) maps, and
|
|
322
|
+
* that the project's package.json does not declare. A file reads only as
|
|
323
|
+
* a syntax tree. Read without executing app code.
|
|
324
|
+
* @param {string} projectDir
|
|
325
|
+
* @param {{sets: import('../../foundation/discovery/icon-set-discovery.mjs').DiscoveredIconSet[], choice: import('../../foundation/discovery/icon-set-discovery.mjs').IconSetChoice}} iconSets
|
|
326
|
+
* @returns {Array<{file: string, imports: import('../../foundation/discovery/icon-imports.mjs').IconImportFinding[]}>}
|
|
327
|
+
*/
|
|
328
|
+
export function findIconImports(projectDir, iconSets) {
|
|
329
|
+
const pkg = readPackageJson(path.join(projectDir, 'package.json')) ?? {};
|
|
330
|
+
const declared = new Set(
|
|
331
|
+
[
|
|
332
|
+
'dependencies',
|
|
333
|
+
'devDependencies',
|
|
334
|
+
'peerDependencies',
|
|
335
|
+
'optionalDependencies',
|
|
336
|
+
]
|
|
337
|
+
.flatMap(field => Object.keys(pkg[field] ?? {}))
|
|
338
|
+
.concat(typeof pkg.name === 'string' ? [pkg.name] : []),
|
|
339
|
+
);
|
|
340
|
+
// Only a file that names a set's module, a wrapped library, or an
|
|
341
|
+
// icon-named export is parsed.
|
|
342
|
+
const needles = [
|
|
343
|
+
...new Set(
|
|
344
|
+
iconSets.sets.flatMap(set => [
|
|
345
|
+
set.data.module,
|
|
346
|
+
...set.data.icons.flatMap(icon => (icon.module ? [icon.module] : [])),
|
|
347
|
+
...(set.data.source ? [set.data.source.package] : []),
|
|
348
|
+
]),
|
|
349
|
+
),
|
|
350
|
+
];
|
|
351
|
+
/** @type {Map<any, Map<string, string>>} */
|
|
352
|
+
const wrappedRead = new Map();
|
|
353
|
+
/** @type {Array<{file: string, imports: import('../../foundation/discovery/icon-imports.mjs').IconImportFinding[]}>} */
|
|
354
|
+
const found = [];
|
|
355
|
+
for (const file of listProjectSourceFiles(projectDir, '')) {
|
|
356
|
+
let source;
|
|
357
|
+
try {
|
|
358
|
+
source = readTextFile(file);
|
|
359
|
+
} catch {
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
if (
|
|
363
|
+
!/Icon\b/u.test(source) &&
|
|
364
|
+
!needles.some(each => source.includes(each))
|
|
365
|
+
) {
|
|
366
|
+
continue;
|
|
367
|
+
}
|
|
368
|
+
const fromDir = path.dirname(file);
|
|
369
|
+
const imports = iconImportFindings(
|
|
370
|
+
source,
|
|
371
|
+
iconSets,
|
|
372
|
+
module =>
|
|
373
|
+
!declared.has(splitSpecifier(module).name) &&
|
|
374
|
+
resolveIconModule(module, fromDir) === null &&
|
|
375
|
+
!projectMapsImport(module, file),
|
|
376
|
+
wrappedRead,
|
|
377
|
+
);
|
|
378
|
+
if (!imports || imports.length === 0) continue;
|
|
379
|
+
found.push({
|
|
380
|
+
file: path.relative(projectDir, file).split(path.sep).join('/'),
|
|
381
|
+
imports,
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
return found.sort((a, b) => compareText(a.file, b.file));
|
|
385
|
+
}
|
|
386
|
+
|
|
300
387
|
/** @param {string} projectDir */
|
|
301
388
|
export async function discoverDoctorThemes(projectDir) {
|
|
302
389
|
const project = await Project.load(projectDir, {core: 'project'});
|
|
@@ -392,6 +479,48 @@ export function doctorStylesheetImports(css) {
|
|
|
392
479
|
return new Set(cssImports(css));
|
|
393
480
|
}
|
|
394
481
|
|
|
482
|
+
/**
|
|
483
|
+
* The names of a stylesheet's at-rules, lowercased, read with postcss so
|
|
484
|
+
* comments are ignored (`@stylex;` is `stylex`); empty for CSS that does not
|
|
485
|
+
* parse.
|
|
486
|
+
* @param {string} css
|
|
487
|
+
* @returns {Set<string>}
|
|
488
|
+
*/
|
|
489
|
+
export function doctorStylesheetAtRules(css) {
|
|
490
|
+
/** @type {Set<string>} */
|
|
491
|
+
const names = new Set();
|
|
492
|
+
try {
|
|
493
|
+
postcss()
|
|
494
|
+
.parse(css)
|
|
495
|
+
.walkAtRules(rule => {
|
|
496
|
+
names.add(rule.name.toLowerCase());
|
|
497
|
+
});
|
|
498
|
+
} catch {
|
|
499
|
+
// Not valid CSS: no rules.
|
|
500
|
+
}
|
|
501
|
+
return names;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
|
+
* The project folder of a path `doctor --built` checks: the nearest folder
|
|
506
|
+
* at or above it that holds a package.json, or null.
|
|
507
|
+
* @param {string} target
|
|
508
|
+
* @param {string} cwd
|
|
509
|
+
* @returns {string | null}
|
|
510
|
+
*/
|
|
511
|
+
export function builtProjectRoot(target, cwd) {
|
|
512
|
+
let dir = path.resolve(cwd, target);
|
|
513
|
+
try {
|
|
514
|
+
if (!fs.statSync(dir).isDirectory()) dir = path.dirname(dir);
|
|
515
|
+
} catch {
|
|
516
|
+
dir = path.resolve(cwd);
|
|
517
|
+
}
|
|
518
|
+
for (let at = dir; ; at = path.dirname(at)) {
|
|
519
|
+
if (fs.existsSync(path.join(at, 'package.json'))) return at;
|
|
520
|
+
if (path.dirname(at) === at) return null;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
|
|
395
524
|
/**
|
|
396
525
|
* The file a local stylesheet `@import` names, from the stylesheet that
|
|
397
526
|
* imports it: a relative path, or a package's file as Node resolves it
|
|
@@ -941,25 +1070,20 @@ export function readBuiltPath(target, {fileLimit = BUILT_FILE_LIMIT} = {}) {
|
|
|
941
1070
|
* @returns {string[]}
|
|
942
1071
|
*/
|
|
943
1072
|
export function builtIntegrationPackages(target, cwd) {
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
return [
|
|
953
|
-
...new Set(scanAutolinkCandidates(at).map(candidate => candidate.spec)),
|
|
954
|
-
];
|
|
955
|
-
}
|
|
956
|
-
if (path.dirname(at) === at) return [];
|
|
957
|
-
}
|
|
1073
|
+
const root = builtProjectRoot(target, cwd);
|
|
1074
|
+
return root
|
|
1075
|
+
? [
|
|
1076
|
+
...new Set(
|
|
1077
|
+
scanAutolinkCandidates(root).map(candidate => candidate.spec),
|
|
1078
|
+
),
|
|
1079
|
+
]
|
|
1080
|
+
: [];
|
|
958
1081
|
}
|
|
959
1082
|
|
|
960
1083
|
/**
|
|
961
1084
|
* The install line for the font families a known package loads (an open
|
|
962
|
-
* font the editor's table names),
|
|
1085
|
+
* font the editor's table names), as the project's integration install
|
|
1086
|
+
* guidance gives it, else in the project's package manager, and
|
|
963
1087
|
* whether it loads every family given. A family no known package loads (a
|
|
964
1088
|
* self-hosted face) gets none: its package name would be a guess.
|
|
965
1089
|
* @param {string} projectDir
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Whether a page links Core's component styles: a `<link>` whose `rel` is a
|
|
6
|
+
* stylesheet and whose `href` names the package's `astryx.css`. Comments
|
|
7
|
+
* never count.
|
|
8
|
+
* @param {string} html
|
|
9
|
+
*/
|
|
10
|
+
export function linksCoreStylesheet(html: string): boolean;
|
|
4
11
|
/**
|
|
5
12
|
* Read a path and gather the evidence both checks judge.
|
|
6
13
|
* @param {string} target an existing file or folder
|
|
@@ -13,17 +20,20 @@ export function scanBuilt(target: string, packages: readonly string[], { fileLim
|
|
|
13
20
|
fileLimit?: number;
|
|
14
21
|
}): BuiltScan;
|
|
15
22
|
/**
|
|
16
|
-
* The
|
|
23
|
+
* The checks for a path.
|
|
17
24
|
* @param {string} target as the caller gave it
|
|
18
|
-
* @param {{cwd: string, packages: readonly string[], fileLimit?: number}} options
|
|
25
|
+
* @param {{cwd: string, packages: readonly string[], fileLimit?: number, sourceBuild?: string | null}} options
|
|
19
26
|
* `packages`: the integration packages whose components count as Astryx.
|
|
20
27
|
* `fileLimit`: how many files to read at most (BUILT_FILE_LIMIT).
|
|
28
|
+
* `sourceBuild`: how the path's app compiles Core's styles from source,
|
|
29
|
+
* when it does (the doctor adapter reads it).
|
|
21
30
|
* @returns {import('./doctor.type.mjs').DoctorCheck[]}
|
|
22
31
|
*/
|
|
23
|
-
export function checkBuilt(target: string, { cwd, packages, fileLimit }: {
|
|
32
|
+
export function checkBuilt(target: string, { cwd, packages, fileLimit, sourceBuild }: {
|
|
24
33
|
cwd: string;
|
|
25
34
|
packages: readonly string[];
|
|
26
35
|
fileLimit?: number;
|
|
36
|
+
sourceBuild?: string | null;
|
|
27
37
|
}): import("./doctor.type.mjs").DoctorCheck[];
|
|
28
38
|
export type BuiltFinding = {
|
|
29
39
|
/**
|
|
@@ -68,6 +78,23 @@ export type BuiltScan = {
|
|
|
68
78
|
* built files with an Astryx stylesheet
|
|
69
79
|
*/
|
|
70
80
|
stylesheets: string[];
|
|
81
|
+
/**
|
|
82
|
+
* built stylesheets and pages read
|
|
83
|
+
*/
|
|
84
|
+
styleFiles: number;
|
|
85
|
+
/**
|
|
86
|
+
* those with Core's component styles
|
|
87
|
+
*/
|
|
88
|
+
coreStyles: string[];
|
|
89
|
+
/**
|
|
90
|
+
* source files and stylesheets that
|
|
91
|
+
* import Core's component styles, which a build then carries
|
|
92
|
+
*/
|
|
93
|
+
coreStyleImports: string[];
|
|
94
|
+
/**
|
|
95
|
+
* pages that link Core's component styles
|
|
96
|
+
*/
|
|
97
|
+
coreStyleLinks: string[];
|
|
71
98
|
findings: BuiltFinding[];
|
|
72
99
|
/**
|
|
73
100
|
* whether the file limit cut the read short
|
|
@@ -11,7 +11,10 @@
|
|
|
11
11
|
* integration the project loads (its component catalog's providers).
|
|
12
12
|
* @output `built-astryx-usage`: fails when the path holds no value import from those
|
|
13
13
|
* packages, no use of a component imported from them, and no Astryx
|
|
14
|
-
* stylesheet in built CSS or HTML. `built-astryx-
|
|
14
|
+
* stylesheet in built CSS or HTML. `built-astryx-styles`: warns when output
|
|
15
|
+
* that uses Astryx holds built stylesheets or pages but none carries Core's
|
|
16
|
+
* component styles, so its components render unstyled; an app that compiles
|
|
17
|
+
* Core from source is not checked. `built-astryx-purity`: warns with the
|
|
15
18
|
* findings of the source check in `astryx docs is-my-code-good` (raw
|
|
16
19
|
* elements Astryx has a component for, raw SVG and icon-library icons,
|
|
17
20
|
* inline styles, classes, StyleX declarations and imported stylesheets),
|
|
@@ -111,6 +114,43 @@ const SHOWN = 5;
|
|
|
111
114
|
const STYLESHEET_MARK =
|
|
112
115
|
/@layer\s+[^{;]*\bastryx-(?:base|theme)\b|--astryx-[\w-]+/;
|
|
113
116
|
|
|
117
|
+
/**
|
|
118
|
+
* The mark of Core's component styles (`@astryxdesign/core/astryx.css`) in a
|
|
119
|
+
* built stylesheet or page: the rules of the `astryx-base` cascade layer. A
|
|
120
|
+
* theme's stylesheet names that layer only in its layer order. Core's
|
|
121
|
+
* scripts hold such a rule as text they write at run time, so only
|
|
122
|
+
* stylesheets and pages count.
|
|
123
|
+
*/
|
|
124
|
+
const CORE_STYLES_MARK = /@layer\s+astryx-base\s*\{/;
|
|
125
|
+
|
|
126
|
+
/** Core's component styles, as a stylesheet or a module imports them. */
|
|
127
|
+
const CORE_STYLESHEET = '@astryxdesign/core/astryx.css';
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* A page's link to Core's component styles: the package's file, from a
|
|
131
|
+
* package CDN (`…/@astryxdesign/core@<version>/dist/astryx.css`) or an
|
|
132
|
+
* installed copy.
|
|
133
|
+
*/
|
|
134
|
+
const CORE_STYLESHEET_HREF =
|
|
135
|
+
/@astryxdesign\/core(?:@[^/"'\s]+)?\/(?:dist\/)?astryx\.css(?:[?#"'\s]|$)/u;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Whether a page links Core's component styles: a `<link>` whose `rel` is a
|
|
139
|
+
* stylesheet and whose `href` names the package's `astryx.css`. Comments
|
|
140
|
+
* never count.
|
|
141
|
+
* @param {string} html
|
|
142
|
+
*/
|
|
143
|
+
export function linksCoreStylesheet(html) {
|
|
144
|
+
const text = html.replace(/<!--[\s\S]*?-->/gu, ' ');
|
|
145
|
+
for (const tag of text.matchAll(/<link\b[^>]*>/giu)) {
|
|
146
|
+
const attributes = tag[0];
|
|
147
|
+
if (!/\brel\s*=\s*["']?[^"'>]*\bstylesheet\b/iu.test(attributes)) continue;
|
|
148
|
+
const href = /\bhref\s*=\s*(["'])([^"']*)\1/iu.exec(attributes)?.[2];
|
|
149
|
+
if (href && CORE_STYLESHEET_HREF.test(href)) return true;
|
|
150
|
+
}
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
|
|
114
154
|
/**
|
|
115
155
|
* Raw elements the rubric names a component for (`astryx docs
|
|
116
156
|
* is-my-code-good`, "Common component replacements"), with that owner.
|
|
@@ -193,6 +233,11 @@ const ICON_PACKAGES = [
|
|
|
193
233
|
* @property {number} componentUses JSX uses of names imported from them
|
|
194
234
|
* @property {string[]} packages the Astryx packages imported, sorted
|
|
195
235
|
* @property {string[]} stylesheets built files with an Astryx stylesheet
|
|
236
|
+
* @property {number} styleFiles built stylesheets and pages read
|
|
237
|
+
* @property {string[]} coreStyles those with Core's component styles
|
|
238
|
+
* @property {string[]} coreStyleImports source files and stylesheets that
|
|
239
|
+
* import Core's component styles, which a build then carries
|
|
240
|
+
* @property {string[]} coreStyleLinks pages that link Core's component styles
|
|
196
241
|
* @property {BuiltFinding[]} findings
|
|
197
242
|
* @property {boolean} truncated whether the file limit cut the read short
|
|
198
243
|
* @property {number} unread source files over the size limit, unreadable, or
|
|
@@ -599,6 +644,10 @@ export function scanBuilt(target, packages, {fileLimit} = {}) {
|
|
|
599
644
|
componentUses: 0,
|
|
600
645
|
packages: [],
|
|
601
646
|
stylesheets: [],
|
|
647
|
+
styleFiles: 0,
|
|
648
|
+
coreStyles: [],
|
|
649
|
+
coreStyleImports: [],
|
|
650
|
+
coreStyleLinks: [],
|
|
602
651
|
findings: [],
|
|
603
652
|
truncated,
|
|
604
653
|
unread: 0,
|
|
@@ -632,6 +681,13 @@ export function scanBuilt(target, packages, {fileLimit} = {}) {
|
|
|
632
681
|
? raw.replace(/\/\*[\s\S]*?\*\/|<!--[\s\S]*?-->/g, ' ')
|
|
633
682
|
: raw;
|
|
634
683
|
if (STYLESHEET_MARK.test(styles)) scan.stylesheets.push(rel);
|
|
684
|
+
if (ext === '.css' || ext === '.html' || ext === '.htm') {
|
|
685
|
+
scan.styleFiles++;
|
|
686
|
+
if (CORE_STYLES_MARK.test(styles)) scan.coreStyles.push(rel);
|
|
687
|
+
}
|
|
688
|
+
if ((ext === '.html' || ext === '.htm') && linksCoreStylesheet(raw)) {
|
|
689
|
+
scan.coreStyleLinks.push(rel);
|
|
690
|
+
}
|
|
635
691
|
// A stylesheet that imports an Astryx package's CSS, as the
|
|
636
692
|
// getting-started setup does, uses Astryx.
|
|
637
693
|
if (ext === '.css') {
|
|
@@ -639,6 +695,7 @@ export function scanBuilt(target, packages, {fileLimit} = {}) {
|
|
|
639
695
|
/@import\s+(?:url\(\s*)?['"]?([^'")\s;]+)/g,
|
|
640
696
|
)) {
|
|
641
697
|
if (!isAstryxSpecifier(match[1], packages)) continue;
|
|
698
|
+
if (match[1] === CORE_STYLESHEET) scan.coreStyleImports.push(rel);
|
|
642
699
|
scan.imports++;
|
|
643
700
|
scan.importFiles++;
|
|
644
701
|
imported.add(
|
|
@@ -662,6 +719,7 @@ export function scanBuilt(target, packages, {fileLimit} = {}) {
|
|
|
662
719
|
? astImports(ast, raw)
|
|
663
720
|
: importsOf(text)) {
|
|
664
721
|
if (isAstryxSpecifier(spec, packages)) {
|
|
722
|
+
if (spec === CORE_STYLESHEET) scan.coreStyleImports.push(rel);
|
|
665
723
|
fileImports++;
|
|
666
724
|
imported.add(
|
|
667
725
|
spec.startsWith('@')
|
|
@@ -730,16 +788,83 @@ function plural(count, word) {
|
|
|
730
788
|
}
|
|
731
789
|
|
|
732
790
|
/**
|
|
733
|
-
*
|
|
791
|
+
* Whether output that uses Astryx carries Core's component styles. A page's
|
|
792
|
+
* components take their styles from `@astryxdesign/core/astryx.css`; a build
|
|
793
|
+
* without it passes and loads, but every component renders unstyled. It
|
|
794
|
+
* warns: `--built` shipped in a stable release without this check, and a new
|
|
795
|
+
* failure waits for the next minor release. An app that compiles Core's
|
|
796
|
+
* styles from source needs no `astryx.css`, so output that carries none is
|
|
797
|
+
* not checked there.
|
|
798
|
+
* @param {BuiltScan} scan
|
|
799
|
+
* @param {string} target as the caller gave it
|
|
800
|
+
* @param {string} cwd
|
|
801
|
+
* @param {string | null} sourceBuild how the app compiles Core from source
|
|
802
|
+
* @returns {import('./doctor.type.mjs').DoctorCheck}
|
|
803
|
+
*/
|
|
804
|
+
function coreStylesCheck(scan, target, cwd, sourceBuild) {
|
|
805
|
+
const label = "Built output carries Core's component styles";
|
|
806
|
+
if (scan.coreStyles.length > 0) {
|
|
807
|
+
return {
|
|
808
|
+
id: 'built-astryx-styles',
|
|
809
|
+
label,
|
|
810
|
+
status: 'pass',
|
|
811
|
+
message: `Core's component styles are in ${scan.coreStyles.slice(0, 3).join(', ')}${scan.coreStyles.length > 3 ? ` and ${scan.coreStyles.length - 3} more` : ''}.`,
|
|
812
|
+
};
|
|
813
|
+
}
|
|
814
|
+
if (scan.coreStyleLinks.length > 0) {
|
|
815
|
+
return {
|
|
816
|
+
id: 'built-astryx-styles',
|
|
817
|
+
label,
|
|
818
|
+
status: 'pass',
|
|
819
|
+
message: `${scan.coreStyleLinks[0]} links ${CORE_STYLESHEET}, Core's component styles.`,
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
if (scan.coreStyleImports.length > 0) {
|
|
823
|
+
return {
|
|
824
|
+
id: 'built-astryx-styles',
|
|
825
|
+
label,
|
|
826
|
+
status: 'pass',
|
|
827
|
+
message: `${scan.coreStyleImports[0]} imports ${CORE_STYLESHEET}, Core's component styles, so a build of it carries them.`,
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
if (sourceBuild) {
|
|
831
|
+
return {
|
|
832
|
+
id: 'built-astryx-styles',
|
|
833
|
+
label,
|
|
834
|
+
status: 'info',
|
|
835
|
+
message: `Not checked: this app compiles Core's styles from source (${sourceBuild}), so its build does not need ${CORE_STYLESHEET}.`,
|
|
836
|
+
};
|
|
837
|
+
}
|
|
838
|
+
if (scan.styleFiles === 0) {
|
|
839
|
+
return {
|
|
840
|
+
id: 'built-astryx-styles',
|
|
841
|
+
label,
|
|
842
|
+
status: 'info',
|
|
843
|
+
message: `${target} holds no built stylesheet or page, so doctor did not check whether Core's component styles reached the build. Run \`${formatCliCommand('doctor --built <folder>', cwd)}\` on the build output.`,
|
|
844
|
+
};
|
|
845
|
+
}
|
|
846
|
+
return {
|
|
847
|
+
id: 'built-astryx-styles',
|
|
848
|
+
label,
|
|
849
|
+
status: 'warn',
|
|
850
|
+
message: `${scan.styleFiles === 1 ? 'The one built stylesheet or page that doctor read does not carry' : `None of the ${scan.styleFiles} built stylesheets and pages that doctor read carries`} Core's component styles (the \`astryx-base\` layer of ${CORE_STYLESHEET}). This output's Astryx components render unstyled.`,
|
|
851
|
+
fix: "Import Core's stylesheets once, in the app's global stylesheet: `@import '@astryxdesign/core/reset.css';` then `@import '@astryxdesign/core/astryx.css';`. Or import both in the app's entry module, reset.css first. Then build again. Do not deliver this output.",
|
|
852
|
+
};
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
/**
|
|
856
|
+
* The checks for a path.
|
|
734
857
|
* @param {string} target as the caller gave it
|
|
735
|
-
* @param {{cwd: string, packages: readonly string[], fileLimit?: number}} options
|
|
858
|
+
* @param {{cwd: string, packages: readonly string[], fileLimit?: number, sourceBuild?: string | null}} options
|
|
736
859
|
* `packages`: the integration packages whose components count as Astryx.
|
|
737
860
|
* `fileLimit`: how many files to read at most (BUILT_FILE_LIMIT).
|
|
861
|
+
* `sourceBuild`: how the path's app compiles Core's styles from source,
|
|
862
|
+
* when it does (the doctor adapter reads it).
|
|
738
863
|
* @returns {import('./doctor.type.mjs').DoctorCheck[]}
|
|
739
864
|
*/
|
|
740
865
|
export function checkBuilt(
|
|
741
866
|
target,
|
|
742
|
-
{cwd, packages, fileLimit = BUILT_FILE_LIMIT},
|
|
867
|
+
{cwd, packages, fileLimit = BUILT_FILE_LIMIT, sourceBuild = null},
|
|
743
868
|
) {
|
|
744
869
|
const resolved = resolveBuiltPath(cwd, target);
|
|
745
870
|
if (resolved == null) {
|
|
@@ -864,5 +989,7 @@ export function checkBuilt(
|
|
|
864
989
|
fix: `Replace each with the Astryx component, icon surface, prop or token it names; \`${formatCliCommand('docs is-my-code-good', cwd)}\` has the full rubric. Keep a raw element only where its native meaning is needed.`,
|
|
865
990
|
};
|
|
866
991
|
}
|
|
867
|
-
return
|
|
992
|
+
return used
|
|
993
|
+
? [usage, coreStylesCheck(scan, target, cwd, sourceBuild), purity]
|
|
994
|
+
: [usage, purity];
|
|
868
995
|
}
|
package/api/doctor/doctor.d.mts
CHANGED
|
@@ -24,6 +24,36 @@ export function checkNodeVersion(ctx: DoctorContext): DoctorCheck;
|
|
|
24
24
|
* @returns {DoctorCheck}
|
|
25
25
|
*/
|
|
26
26
|
export function checkCoreInstalled(ctx: DoctorContext): DoctorCheck;
|
|
27
|
+
/**
|
|
28
|
+
* How an app compiles Core's styles from its source with
|
|
29
|
+
* `@astryxdesign/build`, so it loads no `astryx.css`: a `next.config` or
|
|
30
|
+
* `vite.config` that imports the build's plugin (`withAstryx()`,
|
|
31
|
+
* `astryxStylex()`), a stylesheet with the `@astryx;` rule the Next.js
|
|
32
|
+
* PostCSS plugin writes the compiled rules into, or one with the `@stylex;`
|
|
33
|
+
* rule while the PostCSS config loads the build's plugin. An `@stylex;` rule
|
|
34
|
+
* alone is the app's own StyleX, which still needs Core's prebuilt styles.
|
|
35
|
+
* Null when it does none of these.
|
|
36
|
+
* @param {string} root
|
|
37
|
+
* @returns {string | null}
|
|
38
|
+
*/
|
|
39
|
+
export function sourceBuildSetup(root: string): string | null;
|
|
40
|
+
/**
|
|
41
|
+
* The app loads Core's component styles. Without them, Astryx components
|
|
42
|
+
* render unstyled, and nothing else fails: the build passes and the page
|
|
43
|
+
* loads. An app that loads none but compiles Core's styles from source is
|
|
44
|
+
* not checked. Read from the project's own source, stylesheets and pages,
|
|
45
|
+
* never run.
|
|
46
|
+
* @param {DoctorContext} ctx
|
|
47
|
+
* @returns {DoctorCheck | null}
|
|
48
|
+
*/
|
|
49
|
+
export function checkCoreStylesheets(ctx: DoctorContext): DoctorCheck | null;
|
|
50
|
+
/**
|
|
51
|
+
* The active base is installed and resolvable, in a project whose base is
|
|
52
|
+
* not Core. A project on Core has {@link checkCoreInstalled} instead.
|
|
53
|
+
* @param {DoctorContext} ctx
|
|
54
|
+
* @returns {DoctorCheck | null}
|
|
55
|
+
*/
|
|
56
|
+
export function checkBaseInstalled(ctx: DoctorContext): DoctorCheck | null;
|
|
27
57
|
/**
|
|
28
58
|
* Check 3 — installed @astryxdesign/core is in step with @astryxdesign/cli (major/minor drift).
|
|
29
59
|
* @param {DoctorContext} ctx
|
|
@@ -116,20 +146,44 @@ export function checkIntegrationCoreRange(ctx: DoctorContext): DoctorCheck | nul
|
|
|
116
146
|
* withdrawn (with why), or that two packages ship under one name; and when
|
|
117
147
|
* more than one set is installed and the list leaves one out. Warns for each
|
|
118
148
|
* other installed set that was withdrawn, with why.
|
|
119
|
-
* Icon sets are experimental (spec:AST-017 FR27): only a project
|
|
120
|
-
*
|
|
149
|
+
* Icon sets are experimental (spec:AST-017 FR27): only a project where the
|
|
150
|
+
* icon feature gate is on gets the check, so every other report is unchanged.
|
|
121
151
|
* @param {DoctorContext} ctx
|
|
122
152
|
* @returns {DoctorCheck | null}
|
|
123
153
|
*/
|
|
124
154
|
export function checkIconSets(ctx: DoctorContext): DoctorCheck | null;
|
|
155
|
+
/**
|
|
156
|
+
* The main set the placeholder fixes name: the one `experimental.iconSet`
|
|
157
|
+
* names, else the only installed set; null when no main set is decided or
|
|
158
|
+
* icon features are off. The placeholder check, and the source scan it
|
|
159
|
+
* reads, run only when there is one.
|
|
160
|
+
* @param {DoctorContext['iconSets']} iconSets
|
|
161
|
+
* @returns {string | null}
|
|
162
|
+
*/
|
|
163
|
+
export function placeholderMainSet(iconSets: DoctorContext["iconSets"]): string | null;
|
|
125
164
|
/**
|
|
126
165
|
* The placeholder component for a missing icon, still in the project's own
|
|
127
166
|
* source (AST-084): each file and the meanings it stands for, with the commands that give each a
|
|
128
|
-
* real icon. Only a project
|
|
167
|
+
* real icon. Only a project where the icon feature gate is on, and whose
|
|
168
|
+
* main set is decided, gets the check.
|
|
129
169
|
* @param {DoctorContext} ctx
|
|
130
170
|
* @returns {DoctorCheck | null}
|
|
131
171
|
*/
|
|
132
172
|
export function checkIconPlaceholders(ctx: DoctorContext): DoctorCheck | null;
|
|
173
|
+
/**
|
|
174
|
+
* The icon imports in the project's own source that do not match its icon
|
|
175
|
+
* sets (AST-084): each file and import, with the icon of the list that draws
|
|
176
|
+
* the same meaning. An import from a set the list leaves out, or from a set
|
|
177
|
+
* later in the list than one that draws the same meaning, still renders, so
|
|
178
|
+
* the check warns, as for a placeholder. An icon-named import of a package
|
|
179
|
+
* that does not resolve and that package.json does not declare (a set the
|
|
180
|
+
* project uninstalled) breaks the build, so the check fails, as `icon-sets`
|
|
181
|
+
* fails for a set the list names that is not installed. Only a project where
|
|
182
|
+
* the icon feature gate is on, and whose main set is decided, gets the check.
|
|
183
|
+
* @param {DoctorContext} ctx
|
|
184
|
+
* @returns {DoctorCheck | null}
|
|
185
|
+
*/
|
|
186
|
+
export function checkIconImports(ctx: DoctorContext): DoctorCheck | null;
|
|
133
187
|
/**
|
|
134
188
|
* Check 10 — report the detected package manager, and say so when the project's
|
|
135
189
|
* own declaration disagrees with what is on disk.
|
|
@@ -221,6 +275,13 @@ export function checkDocsProgressiveDisclosure(ctx: DoctorContext | Partial<Doct
|
|
|
221
275
|
* @returns {DoctorCheck}
|
|
222
276
|
*/
|
|
223
277
|
export function checkCliCommand(ctx: DoctorContext): DoctorCheck;
|
|
278
|
+
/**
|
|
279
|
+
* Install guidance: whether the loaded integrations agree on how this app
|
|
280
|
+
* adds a dependency. Left out when none gives any.
|
|
281
|
+
* @param {DoctorContext} ctx
|
|
282
|
+
* @returns {DoctorCheck | null}
|
|
283
|
+
*/
|
|
284
|
+
export function checkInstallGuidance(ctx: DoctorContext): DoctorCheck | null;
|
|
224
285
|
/**
|
|
225
286
|
* What a computer check reads: the running Node, the release that answered
|
|
226
287
|
* (`meta.answeredBy`), and the newest release the computer knows of.
|
|
@@ -407,6 +468,10 @@ export type DoctorContext = {
|
|
|
407
468
|
* - Resolved core package directory, or null.
|
|
408
469
|
*/
|
|
409
470
|
coreDir: string | null;
|
|
471
|
+
/**
|
|
472
|
+
* The base the project's run reads; Core when absent.
|
|
473
|
+
*/
|
|
474
|
+
base?: import("../../foundation/bases/resolve.mjs").ActiveBase | undefined;
|
|
410
475
|
/**
|
|
411
476
|
* - Whether the project installs its own CLI;
|
|
412
477
|
* false means the copy that started the run answered it (spec AST-081 FR2).
|
|
@@ -477,7 +542,8 @@ export type DoctorContext = {
|
|
|
477
542
|
*/
|
|
478
543
|
configError?: Error | null | undefined;
|
|
479
544
|
/**
|
|
480
|
-
* The project's icon sets (AST-084 FR17), or null when they could not be
|
|
545
|
+
* The project's icon sets (AST-084 FR17), or null when they could not be
|
|
546
|
+
* read or the icon feature gate is off.
|
|
481
547
|
* Experimental: may change or be removed in a patch release.
|
|
482
548
|
*/
|
|
483
549
|
iconSets?: {
|
|
@@ -515,8 +581,8 @@ export type DoctorContext = {
|
|
|
515
581
|
} | null | undefined;
|
|
516
582
|
/**
|
|
517
583
|
* Each file in the project's own source that uses the placeholder component
|
|
518
|
-
* the CLI writes for a missing icon, read only
|
|
519
|
-
*
|
|
584
|
+
* the CLI writes for a missing icon, read only where the icon feature gate
|
|
585
|
+
* is on; null otherwise.
|
|
520
586
|
* Experimental: may change or be removed in a patch release.
|
|
521
587
|
*/
|
|
522
588
|
iconPlaceholders?: {
|
|
@@ -525,6 +591,27 @@ export type DoctorContext = {
|
|
|
525
591
|
meanings: string[] | null;
|
|
526
592
|
uses: number;
|
|
527
593
|
}[] | null | undefined;
|
|
594
|
+
/**
|
|
595
|
+
* Each file in the project's own source with icon imports that do not
|
|
596
|
+
* match its icon sets, read only when the placeholders are; null otherwise.
|
|
597
|
+
* Experimental: may change or be removed in a patch release.
|
|
598
|
+
*/
|
|
599
|
+
iconImports?: {
|
|
600
|
+
file: string;
|
|
601
|
+
imports: Array<{
|
|
602
|
+
line: number;
|
|
603
|
+
module: string;
|
|
604
|
+
export: string;
|
|
605
|
+
why: "unlisted" | "earlier" | "unresolved";
|
|
606
|
+
set: string | null;
|
|
607
|
+
definitions: string[];
|
|
608
|
+
replacement: {
|
|
609
|
+
set: string;
|
|
610
|
+
module: string;
|
|
611
|
+
export: string;
|
|
612
|
+
} | null;
|
|
613
|
+
}>;
|
|
614
|
+
}[] | null | undefined;
|
|
528
615
|
/**
|
|
529
616
|
* - Why the CLI could not load the
|
|
530
617
|
* project from its config, when it could not. Checks that need the loaded
|
|
@@ -17,7 +17,7 @@ export const doc = {
|
|
|
17
17
|
"Check a project's Astryx setup and get a pass/warn/fail report per check. Use it as a CI gate or before debugging a broken install.",
|
|
18
18
|
description:
|
|
19
19
|
'Runs a series of diagnostics: Node version, ' +
|
|
20
|
-
|
|
20
|
+
"@astryxdesign/core install and version alignment with the CLI, whether the app loads Core's component styles (`core-stylesheets`, a warning: a stylesheet or module that imports `@astryxdesign/core/astryx.css` or a page that links it; not checked in an app that loads none and compiles Core from source with `@astryxdesign/build`), installed " +
|
|
21
21
|
'themes and wiring, astryx.config validity, whether every integration ' +
|
|
22
22
|
'astryx.config names loads (a failed one fails the run), integrations linked from ' +
|
|
23
23
|
'package.json without a config entry, core peer dependencies, whether the @astryxdesign/core peer range of each loaded integration includes the installed Core (`integration-core-range`, a warning; added theme packages are checked by `theme-core-peers` instead), ' +
|
|
@@ -41,7 +41,7 @@ export const doc = {
|
|
|
41
41
|
name: 'options.built',
|
|
42
42
|
type: 'string',
|
|
43
43
|
description:
|
|
44
|
-
|
|
44
|
+
"A finished build to check before you deliver it: a project folder, a build output folder, or one built `.html` file, relative to `cwd`. Adds its checks after the others. `built-astryx-usage` fails when the path holds no value import from an Astryx package (any `@astryxdesign/*` package or an integration the project installs), no component imported from one, and no Astryx styles in built CSS or HTML. When the output uses Astryx, `built-astryx-styles` warns when no built stylesheet or page under the path carries Core's component styles (the `astryx-base` layer of `@astryxdesign/core/astryx.css`) and no source file or stylesheet there imports them, since the components then render unstyled; it is info, not checked, when the path holds no built stylesheet or page, or when the project that holds the path compiles Core's styles from source (`withAstryx()` or `astryxStylex()` from `@astryxdesign/build` in its `next.config` or `vite.config`, an `@astryx;` rule in a stylesheet, or an `@stylex;` rule while its PostCSS config loads `@astryxdesign/build`). `built-astryx-purity` warns with the source check of `astryx docs is-my-code-good`: raw elements Astryx has a component for, raw SVG and icon-library icons, inline styles, classes, `stylex.create` and imported stylesheets, each with its file and line, in `.tsx` and `.jsx` files and JSX in `.js` source, found by parsing it; it is info, not inspected, when the path holds no source with JSX, such as a bundle. It reads at most 20,000 files, each up to 5 MB, skipping installs and version control; when either limit leaves source unread and nothing was found, the purity check is info, not fully inspected, and when the file limit ends the read before any Astryx turns up, `built-astryx-usage` warns that the rest went unread instead of failing. Given one built `.html` file, it also reads the local stylesheets and scripts that page links, finding a root-relative link from the nearest folder above the page that holds it; a linked file that is not there makes `built-astryx-usage` warn instead of fail. An empty folder fails with nothing checked, like a missing path. A source tree counts as using Astryx through an import, a re-export (`export … from`) or a stylesheet `@import` of an Astryx package; a type-only import or re-export (`import type`, `export type`, or a list whose names are all `type`) does not count, since the build erases it. `--built` goes with `doctor` alone; a `doctor integration` check refuses it. A path that does not exist fails `built-astryx-usage` with nothing checked, and the purity check is left out. The integrations that count are the dependencies the nearest package.json above the path declares whose installed copy, found the way the CLI autolinks (a hoisted workspace copy included), has an integration manifest. The files under the path, and that configuration, are only read, never run. Without it, doctor runs exactly as before.",
|
|
45
45
|
},
|
|
46
46
|
],
|
|
47
47
|
returns: [
|