@astryxdesign/cli 0.7.16 → 0.7.17-canary.g0404a74
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 +76 -86
- package/api/build/_adapter.d.mts +17 -0
- package/api/build/_adapter.mjs +53 -34
- package/api/build/blocks/blocks.d.mts +7 -5
- package/api/build/blocks/blocks.mjs +113 -26
- package/api/build/blocks/blocks.weights.json +1 -1
- package/api/build/build.doc.mjs +4 -3
- package/api/build/build.type.d.mts +2 -2
- package/api/build/build.type.mjs +3 -3
- package/api/build/kit/kind.d.mts +2 -1
- package/api/build/kit/kind.mjs +199 -10
- package/api/build/kit/kit.mjs +6 -4
- package/api/build/kit/rank.d.mts +6 -4
- package/api/build/kit/rank.mjs +132 -28
- package/api/build/kit/signals.d.mts +7 -1
- package/api/build/kit/signals.mjs +21 -10
- package/api/build/kit/start.d.mts +5 -4
- package/api/build/kit/start.mjs +14 -9
- package/api/build/kit/weights.d.mts +39 -3
- package/api/build/kit/weights.json +1 -1
- package/api/build/kit/weights.mjs +351 -46
- package/api/build/kit/word-model.d.mts +23 -0
- package/api/build/kit/word-model.mjs +46 -0
- package/api/build/kit/words.d.mts +86 -0
- package/api/build/kit/words.mjs +241 -1
- package/api/build/tree.mjs +1 -1
- package/api/component/__fixtures__/resolutions/modules.txt +5 -6
- package/api/component/_adapter.d.mts +26 -2
- package/api/component/_adapter.mjs +135 -8
- package/api/component/component.mjs +14 -1
- package/api/component/list/list.d.mts +1 -1
- package/api/component/list/list.mjs +48 -6
- package/api/discover/_adapter.d.mts +11 -1
- package/api/discover/_adapter.mjs +95 -1
- package/api/discover/detail/item/item.mjs +5 -0
- package/api/discover/discover.mjs +12 -3
- package/api/discover/discover.type.d.mts +16 -3
- package/api/discover/discover.type.mjs +13 -3
- package/api/discover/search/search.mjs +3 -2
- package/api/docs/_adapter.d.mts +57 -2
- package/api/docs/_adapter.mjs +266 -33
- package/api/docs/_entry-names-lazily.d.mts +22 -0
- package/api/docs/_entry-names-lazily.mjs +25 -0
- package/api/docs/_entry-names.d.mts +23 -0
- package/api/docs/_entry-names.mjs +105 -0
- package/api/docs/docs.d.mts +3 -0
- package/api/docs/docs.doc.mjs +7 -1
- package/api/docs/docs.mjs +12 -0
- package/api/docs/docs.type.d.mts +5 -0
- package/api/docs/docs.type.mjs +2 -0
- package/api/docs/node/node.mjs +1 -1
- package/api/doctor/_adapter.d.mts +54 -5
- package/api/doctor/_adapter.mjs +162 -11
- package/api/doctor/built-checks.mjs +40 -14
- package/api/doctor/doctor.d.mts +15 -3
- package/api/doctor/doctor.doc.mjs +1 -1
- package/api/doctor/doctor.mjs +31 -7
- package/api/doctor/theme-checks.d.mts +35 -3
- package/api/doctor/theme-checks.mjs +377 -29
- package/api/hook/_adapter.d.mts +10 -4
- package/api/hook/_adapter.mjs +41 -5
- package/api/hook/detail/detail.mjs +5 -2
- package/api/hook/detail/params/params.mjs +10 -3
- package/api/icon/_records.mjs +2 -1
- package/api/index.d.mts +2 -0
- package/api/index.mjs +2 -0
- package/api/integration/_adapter.d.mts +44 -0
- package/api/integration/_adapter.mjs +77 -1
- package/api/integration/add-helpers.mjs +10 -0
- package/api/integration/authoring-checks.mjs +11 -8
- package/api/integration/example-scope.d.mts +14 -0
- package/api/integration/example-scope.mjs +44 -0
- package/api/integration/example-scope.type.d.mts +29 -0
- package/api/integration/example-scope.type.mjs +25 -0
- package/api/integration/integrationExampleScope.doc.d.mts +11 -0
- package/api/integration/integrationExampleScope.doc.mjs +59 -0
- package/api/integration/pack-check.mjs +16 -1
- package/api/integration/validate-integration.d.mts +18 -6
- package/api/integration/validate-integration.mjs +129 -15
- package/api/integration/validate-integration.type.d.mts +22 -0
- package/api/integration/validate-integration.type.mjs +2 -1
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/render/_adapter.mjs +591 -195
- package/api/render/render.doc.mjs +11 -3
- package/api/render/render.type.d.mts +53 -1
- package/api/render/render.type.mjs +32 -2
- package/api/search/ORDERING.md +2 -2
- package/api/search/_adapter.d.mts +9 -0
- package/api/search/_adapter.mjs +85 -0
- package/api/search/_candidate-score.d.mts +9 -4
- package/api/search/_candidate-score.mjs +133 -46
- package/api/search/_fit-order.mjs +3 -3
- package/api/search/_gather-components.d.mts +3 -2
- package/api/search/_gather-components.mjs +12 -3
- package/api/search/_lexical.d.mts +14 -0
- package/api/search/_lexical.mjs +93 -11
- package/api/search/_result.d.mts +11 -9
- package/api/search/_result.mjs +4 -4
- package/api/search/_score.d.mts +6 -1
- package/api/search/_score.mjs +15 -3
- package/api/search/search-index.mjs +7 -1
- package/api/search/search.d.mts +1 -1
- package/api/template/_adapter.d.mts +16 -0
- package/api/template/_adapter.mjs +39 -2
- package/api/template/cdn/cdn.mjs +37 -8
- package/api/template/copy/copy.d.mts +6 -3
- package/api/template/copy/copy.mjs +40 -8
- package/api/template/template.doc.mjs +3 -3
- package/api/template/template.mjs +63 -11
- package/api/template/template.type.d.mts +1 -0
- package/api/template/template.type.mjs +1 -0
- package/api/theme/_adapter.d.mts +12 -1
- package/api/theme/_adapter.mjs +132 -13
- package/api/theme/_app-provider.d.mts +31 -0
- package/api/theme/_app-provider.mjs +135 -0
- package/api/theme/add/add.mjs +3 -1
- package/api/theme/build/build.d.mts +142 -1
- package/api/theme/build/build.mjs +692 -284
- package/api/theme/build/core-interception.d.mts +10 -0
- package/api/theme/build/core-interception.mjs +10 -0
- package/api/theme/build/font-warning.d.mts +80 -5
- package/api/theme/build/font-warning.mjs +323 -55
- package/api/theme/build/icon-imports.mjs +51 -9
- package/api/theme/build/null-values.d.mts +28 -0
- package/api/theme/build/null-values.mjs +191 -0
- package/api/theme/list/list.mjs +17 -1
- package/api/theme/remove/remove.d.mts +2 -1
- package/api/theme/remove/remove.mjs +7 -3
- package/api/theme/theme.type.d.mts +78 -1
- package/api/theme/theme.type.mjs +38 -2
- package/api/theme/themeAdd.doc.mjs +1 -1
- package/api/theme/themeListAvailable.doc.mjs +1 -1
- package/api/theme/themeRemove.doc.mjs +8 -5
- package/api/theme-edit/_adapter.d.mts +116 -4
- package/api/theme-edit/_adapter.mjs +1058 -93
- package/api/theme-edit/_catalog.d.mts +46 -2
- package/api/theme-edit/_catalog.mjs +115 -14
- package/api/theme-edit/_check.d.mts +133 -24
- package/api/theme-edit/_check.mjs +3392 -531
- package/api/theme-edit/_color.d.mts +26 -0
- package/api/theme-edit/_color.mjs +92 -2
- package/api/theme-edit/_compiler.d.mts +5 -1
- package/api/theme-edit/_compiler.mjs +141 -17
- package/api/theme-edit/_context.d.mts +74 -6
- package/api/theme-edit/_context.mjs +468 -76
- package/api/theme-edit/_css.d.mts +21 -0
- package/api/theme-edit/_css.mjs +87 -14
- package/api/theme-edit/_edit.d.mts +74 -7
- package/api/theme-edit/_edit.mjs +4426 -319
- package/api/theme-edit/_how-commands.d.mts +76 -1
- package/api/theme-edit/_how-commands.mjs +793 -9
- package/api/theme-edit/_how-question.d.mts +97 -6
- package/api/theme-edit/_how-question.mjs +9184 -747
- package/api/theme-edit/_how.d.mts +5 -2
- package/api/theme-edit/_how.mjs +255 -46
- package/api/theme-edit/_importers.d.mts +38 -0
- package/api/theme-edit/_importers.mjs +188 -0
- package/api/theme-edit/_marks.d.mts +31 -5
- package/api/theme-edit/_marks.mjs +57 -5
- package/api/theme-edit/_name-rule.d.mts +11 -0
- package/api/theme-edit/_name-rule.mjs +12 -0
- package/api/theme-edit/_normal.d.mts +322 -0
- package/api/theme-edit/_normal.mjs +1630 -0
- package/api/theme-edit/_palette.d.mts +49 -0
- package/api/theme-edit/_palette.mjs +180 -38
- package/api/theme-edit/_part-words.d.mts +39 -0
- package/api/theme-edit/_part-words.mjs +152 -0
- package/api/theme-edit/_parts.d.mts +55 -3
- package/api/theme-edit/_parts.mjs +421 -36
- package/api/theme-edit/_preview-app.d.mts +7 -13
- package/api/theme-edit/_preview-app.mjs +1108 -599
- package/api/theme-edit/_preview.d.mts +156 -19
- package/api/theme-edit/_preview.mjs +809 -180
- package/api/theme-edit/_project.d.mts +61 -1
- package/api/theme-edit/_project.mjs +177 -6
- package/api/theme-edit/_settings.d.mts +619 -48
- package/api/theme-edit/_settings.mjs +4910 -617
- package/api/theme-edit/_tables.d.mts +41 -0
- package/api/theme-edit/_tables.mjs +261 -41
- package/api/theme-edit/_vet.d.mts +31 -0
- package/api/theme-edit/_vet.mjs +114 -8
- package/api/theme-edit/theme-edit.type.d.mts +34 -2
- package/api/theme-edit/theme-edit.type.mjs +18 -3
- package/api/theme-edit/themeEditHow.doc.mjs +1 -1
- package/api/theme-edit/themeEditNew.doc.d.mts +0 -1
- package/api/theme-edit/themeEditNew.doc.mjs +7 -4
- package/api/theme-edit/themeEditPreviewApp.doc.mjs +3 -3
- package/api/theme-edit/themeEditPreviewRemove.doc.mjs +2 -2
- package/api/upgrade/run/run.mjs +4 -3
- package/api/upgrade/upgrade.mjs +16 -1
- package/assets/codemods/integration-discovery.mjs +2 -1
- package/assets/codemods/integration-runner.mjs +1 -1
- package/assets/codemods/jscodeshift.d.ts +1 -1
- package/assets/codemods/run-codemod.mjs +151 -18
- package/assets/codemods/runner.mjs +1 -4
- package/assets/codemods/transforms/next/index.mjs +11 -1
- package/assets/codemods/transforms/next/migrate-item-swipe-actions-to-swipe.mjs +394 -0
- package/assets/component-list.generated.json +1 -0
- package/assets/docs/author-a-theme.doc.mjs +2 -0
- package/assets/docs/theme.doc.dense.mjs +76 -7
- package/assets/docs/theme.doc.mjs +66 -2
- package/assets/docs/theme.doc.zh.mjs +51 -1
- package/assets/docs/tree/check-your-docs.doc.mjs +1 -1
- package/assets/docs/tree/checks.doc.mjs +2 -2
- package/assets/docs/tree/cli-command.doc.mjs +2 -3
- package/assets/docs/tree/document-the-theme.doc.mjs +1 -1
- package/assets/docs/tree/font-setup.doc.mjs +1 -1
- package/assets/docs/tree/fonts-and-assets.doc.mjs +1 -1
- package/assets/docs/tree/render-pages.doc.mjs +46 -5
- package/assets/docs/tree/share-a-page.doc.mjs +157 -0
- package/assets/docs/tree/single-component.doc.mjs +4 -0
- package/assets/docs/tree/template-doc-overview.doc.mjs +1 -1
- package/assets/docs/tree/test-in-an-app.doc.mjs +1 -1
- package/assets/docs/tree/write-good-templates.doc.mjs +1 -1
- package/assets/docs/use-a-theme.doc.mjs +2 -2
- package/assets/docs-routes.generated.json +1 -0
- package/assets/docs.generated.json +2 -2
- package/assets/search-catalog.generated.json +2 -0
- package/assets/self-audit.generated.json +1 -1
- package/assets/templates/blocks/components/ChatComposerInput/useChatDictationHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/ChatComposerInput/useChatDictationHookUsage.tsx +38 -0
- package/assets/templates/blocks/components/ChatComposerInput/useSpeechRecognitionHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/ChatComposerInput/useSpeechRecognitionHookUsage.tsx +43 -0
- package/assets/templates/blocks/components/Hooks/useContainerRevealHookUsage.tsx +2 -2
- package/assets/templates/blocks/components/SyntaxTheme/useSyntaxThemeHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/SyntaxTheme/useSyntaxThemeHookUsage.tsx +36 -0
- package/assets/templates/components.generated.json +1 -1
- package/assets/templates/pages/ai-chat/template.doc.mjs +5 -4
- package/assets/templates/pages/ai-chat-landing/page.tsx +31 -4
- package/assets/templates/pages/ai-chat-landing/template.doc.mjs +5 -1
- package/assets/templates/pages/blank/template.doc.mjs +1 -1
- package/assets/templates/pages/canvas-editor/template.doc.mjs +4 -2
- package/assets/templates/pages/centered-hero/template.doc.mjs +9 -1
- package/assets/templates/pages/classic-gallery/template.doc.mjs +1 -1
- package/assets/templates/pages/contact-form/template.doc.mjs +2 -1
- package/assets/templates/pages/dashboard/template.doc.mjs +3 -2
- package/assets/templates/pages/dashboard-alert-rail/page.tsx +1 -1
- package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +2 -1
- package/assets/templates/pages/dashboard-cohort-funnel/page.tsx +1 -1
- package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +2 -1
- package/assets/templates/pages/dashboard-comparison/page.tsx +2 -2
- package/assets/templates/pages/dashboard-composition/template.doc.mjs +2 -1
- package/assets/templates/pages/dashboard-progress/page.tsx +1 -1
- package/assets/templates/pages/dashboard-progress/template.doc.mjs +6 -3
- package/assets/templates/pages/detail-page/page.tsx +60 -7
- package/assets/templates/pages/detail-page/template.doc.mjs +10 -3
- package/assets/templates/pages/documentation/template.doc.mjs +4 -1
- package/assets/templates/pages/documentation-design/template.doc.mjs +7 -1
- package/assets/templates/pages/documentation-technical/page.tsx +13 -13
- package/assets/templates/pages/documentation-technical/template.doc.mjs +7 -1
- package/assets/templates/pages/editor/page.tsx +14 -2
- package/assets/templates/pages/editor/template.doc.mjs +2 -8
- package/assets/templates/pages/file-explorer/page.tsx +9 -0
- package/assets/templates/pages/file-explorer/template.doc.mjs +1 -1
- package/assets/templates/pages/form-two-column/template.doc.mjs +4 -3
- package/assets/templates/pages/form-wizard/template.doc.mjs +5 -3
- package/assets/templates/pages/form-wizard-vertical/page.tsx +23 -3
- package/assets/templates/pages/gallery-hero/template.doc.mjs +4 -2
- package/assets/templates/pages/ide/page.tsx +33 -2
- package/assets/templates/pages/kanban-board/page.tsx +12 -2
- package/assets/templates/pages/kanban-board/template.doc.mjs +1 -9
- package/assets/templates/pages/library/template.doc.mjs +4 -1
- package/assets/templates/pages/login/template.doc.mjs +2 -1
- package/assets/templates/pages/login-card/page.tsx +16 -0
- package/assets/templates/pages/login-card/template.doc.mjs +2 -1
- package/assets/templates/pages/login-split/page.tsx +19 -6
- package/assets/templates/pages/login-split/template.doc.mjs +2 -1
- package/assets/templates/pages/login-sso/template.doc.mjs +4 -2
- package/assets/templates/pages/messaging-shell/template.doc.mjs +6 -0
- package/assets/templates/pages/mixed-gallery/template.doc.mjs +2 -1
- package/assets/templates/pages/payment-form/page.tsx +30 -4
- package/assets/templates/pages/product-detail/page.tsx +26 -2
- package/assets/templates/pages/product-detail/template.doc.mjs +4 -2
- package/assets/templates/pages/product-gallery/template.doc.mjs +2 -1
- package/assets/templates/pages/settings-dialog/page.tsx +162 -12
- package/assets/templates/pages/settings-dialog/template.doc.mjs +2 -1
- package/assets/templates/pages/settings-sidebar/template.doc.mjs +2 -1
- package/assets/templates/pages/shell-nav/template.doc.mjs +4 -2
- package/assets/templates/pages/shell-side-nav/page.tsx +11 -3
- package/assets/templates/pages/shell-side-nav/template.doc.mjs +5 -3
- package/assets/templates/pages/shell-top-nav/template.doc.mjs +2 -1
- package/assets/templates/pages/side-gallery/template.doc.mjs +9 -1
- package/assets/templates/pages/table-filter/page.tsx +9 -0
- package/assets/templates/pages/table-filter/template.doc.mjs +9 -8
- package/assets/templates/pages/table-grouped/page.tsx +161 -133
- package/assets/templates/pages/table-grouped/template.doc.mjs +4 -2
- package/assets/templates/pages/table-page/page.tsx +14 -1
- package/assets/templates/pages/table-page/template.doc.mjs +5 -4
- package/assets/templates/pages/table-tree/template.doc.mjs +6 -3
- package/assets/templates/pages/theme-showcase/template.doc.mjs +2 -9
- package/assets/templates/pages/work-item-detail/page.tsx +47 -7
- package/assets/templates/pages/work-item-detail/template.doc.mjs +1 -0
- package/assets/theme.template.ts +9 -2
- package/authoring/debug/parse.d.mts +3 -3
- package/authoring/doctypes/_schema.d.mts +9 -9
- package/authoring/doctypes/command/command.doc.mjs +1 -1
- package/authoring/doctypes/component/categories.d.mts +37 -0
- package/authoring/doctypes/component/categories.mjs +54 -0
- package/authoring/doctypes/template/template.doc.mjs +1 -1
- package/authoring/doctypes/template/type.ts +9 -0
- package/authoring/example/example.doc.d.mts +12 -0
- package/authoring/example/example.doc.mjs +69 -0
- package/authoring/example/preview.d.mts +92 -0
- package/authoring/example/preview.mjs +994 -0
- package/authoring/example/type.ts +102 -0
- package/authoring/index.d.mts +1 -0
- package/authoring/index.d.ts +12 -0
- package/authoring/index.mjs +3 -1
- package/authoring/integration/integration.doc.mjs +8 -0
- package/authoring/integration/schema.d.mts +24 -1
- package/authoring/integration/schema.mjs +126 -4
- package/authoring/integration/type.ts +14 -0
- package/clients/cli/bin/astryx.mjs +6 -9
- package/clients/cli/build-id.generated.json +1 -1
- package/clients/cli/commands/component.doc.mjs +1 -1
- package/clients/cli/commands/component.mjs +22 -3
- package/clients/cli/commands/discover.mjs +70 -3
- package/clients/cli/commands/docs.doc.mjs +7 -1
- package/clients/cli/commands/docs.mjs +44 -6
- package/clients/cli/commands/doctor.mjs +84 -16
- package/clients/cli/commands/experimental/render.mjs +42 -1
- package/clients/cli/commands/experimental/theme.mjs +1032 -134
- package/clients/cli/commands/experimental-render.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +3 -3
- package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +87 -1
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +10 -3
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-preview.doc.mjs +2 -1
- package/clients/cli/commands/experimental-theme-remove.doc.mjs +4 -4
- package/clients/cli/commands/experimental-theme.doc.mjs +5 -1
- package/clients/cli/commands/search.doc.mjs +2 -1
- package/clients/cli/commands/search.mjs +6 -1
- package/clients/cli/commands/template.doc.mjs +1 -1
- package/clients/cli/commands/template.mjs +15 -2
- package/clients/cli/commands/theme-add.doc.mjs +1 -1
- package/clients/cli/commands/theme-build.doc.mjs +5 -1
- package/clients/cli/commands/theme-list.doc.mjs +1 -1
- package/clients/cli/commands/theme-remove.doc.mjs +13 -5
- package/clients/cli/commands/theme.doc.mjs +1 -1
- package/clients/cli/commands/theme.mjs +849 -441
- package/clients/cli/commands/upgrade.mjs +46 -8
- package/clients/cli/index.mjs +9 -19
- package/clients/cli/lib/cli-error.mjs +2 -1
- package/clients/cli/lib/component-format.mjs +205 -98
- package/clients/cli/lib/hook-format.mjs +9 -19
- package/clients/cli/lib/json-shim.mjs +265 -29
- package/clients/cli/lib/manifest.mjs +3 -2
- package/clients/cli/lib/stray-option.mjs +478 -0
- package/clients/cli/lib/unknown-command.mjs +353 -0
- package/clients/cli/manifest.generated.json +1 -1
- package/foundation/agent-docs/agent-docs.mjs +1 -1
- package/foundation/config/project.d.mts +8 -0
- package/foundation/config/project.mjs +26 -29
- package/foundation/config/theme-state.d.mts +31 -2
- package/foundation/config/theme-state.mjs +140 -8
- package/foundation/discovery/authoring-self-docs.mjs +1 -0
- package/foundation/discovery/cli-self-doc-names.d.mts +13 -0
- package/foundation/discovery/cli-self-doc-names.mjs +51 -0
- package/foundation/discovery/cli-self-docs.d.mts +0 -2
- package/foundation/discovery/cli-self-docs.mjs +2 -15
- package/foundation/discovery/component-discovery.d.mts +11 -0
- package/foundation/discovery/component-discovery.mjs +59 -10
- package/foundation/discovery/component-replacement.mjs +130 -1
- package/foundation/discovery/copied-passages.mjs +2 -1
- package/foundation/discovery/core-component-docs.d.mts +29 -0
- package/foundation/discovery/core-component-docs.mjs +83 -0
- package/foundation/discovery/core-theme-facts.d.mts +70 -0
- package/foundation/discovery/core-theme-facts.mjs +384 -0
- package/foundation/discovery/doc-types.mjs +4 -3
- package/foundation/discovery/docs-discovery.d.mts +66 -9
- package/foundation/discovery/docs-discovery.mjs +126 -60
- package/foundation/discovery/entry-name-files.d.mts +106 -0
- package/foundation/discovery/entry-name-files.mjs +354 -0
- package/foundation/discovery/hook-discovery.d.mts +18 -2
- package/foundation/discovery/hook-discovery.mjs +93 -42
- package/foundation/discovery/icon-definition-discovery.mjs +2 -1
- package/foundation/discovery/icon-set-checks.mjs +2 -1
- package/foundation/discovery/icon-set-discovery.mjs +2 -1
- package/foundation/discovery/integration-component-views.d.mts +15 -0
- package/foundation/discovery/integration-component-views.mjs +91 -0
- package/foundation/discovery/integration-doc-files.mjs +2 -1
- package/foundation/discovery/module-exports.d.mts +26 -1
- package/foundation/discovery/module-exports.mjs +114 -40
- package/foundation/discovery/name-roots.d.mts +38 -0
- package/foundation/discovery/name-roots.mjs +108 -0
- package/foundation/discovery/next-routes.d.mts +48 -0
- package/foundation/discovery/next-routes.mjs +181 -0
- package/foundation/discovery/package-exports.d.mts +10 -0
- package/foundation/discovery/package-exports.mjs +56 -3
- package/foundation/discovery/prop-drift.mjs +9 -9
- package/foundation/discovery/runner-allowlist.d.mts +1 -0
- package/foundation/discovery/runner-allowlist.mjs +2 -0
- package/foundation/discovery/stored-component-list.d.mts +43 -0
- package/foundation/discovery/stored-component-list.mjs +90 -0
- package/foundation/discovery/stored-search-catalog.d.mts +115 -0
- package/foundation/discovery/stored-search-catalog.mjs +297 -0
- package/foundation/discovery/stored-self-audit.d.mts +26 -10
- package/foundation/discovery/stored-self-audit.mjs +40 -18
- package/foundation/discovery/template-adapter.d.mts +49 -29
- package/foundation/discovery/template-adapter.mjs +89 -99
- package/foundation/discovery/template-destination.d.mts +28 -0
- package/foundation/discovery/template-destination.mjs +104 -0
- package/foundation/discovery/template-icons.mjs +2 -1
- package/foundation/discovery/template-ids.d.mts +69 -0
- package/foundation/discovery/template-ids.mjs +199 -0
- package/foundation/discovery/theme-discovery.d.mts +12 -0
- package/foundation/discovery/theme-discovery.mjs +34 -4
- package/foundation/discovery/theme-imports.d.mts +24 -0
- package/foundation/discovery/theme-imports.mjs +61 -4
- package/foundation/discovery/theming-targets.d.mts +13 -5
- package/foundation/discovery/theming-targets.mjs +41 -47
- package/foundation/doc-compiler/generated-levels.d.mts +43 -0
- package/foundation/doc-compiler/generated-levels.mjs +72 -0
- package/foundation/doc-compiler/import.mjs +7 -1
- package/foundation/doc-compiler/inputs.mjs +3 -2
- package/foundation/doc-compiler/literal-doc.d.mts +12 -0
- package/foundation/doc-compiler/literal-doc.mjs +322 -0
- package/foundation/doc-compiler/parse-readable.mjs +4 -1
- package/foundation/doc-compiler/stored-docs.d.mts +29 -0
- package/foundation/doc-compiler/stored-docs.mjs +63 -1
- package/foundation/doc-compiler/tree.d.mts +4 -84
- package/foundation/doc-compiler/tree.mjs +4 -62
- package/foundation/env/semver.mjs +3 -1
- package/foundation/fonts/font-stylesheet.d.mts +46 -0
- package/foundation/fonts/font-stylesheet.mjs +173 -0
- package/foundation/fs/cache-eviction.d.mts +21 -0
- package/foundation/fs/cache-eviction.mjs +73 -0
- package/foundation/fs/exact-codec.d.mts +12 -2
- package/foundation/fs/exact-codec.mjs +23 -6
- package/foundation/fs/file-protection.mjs +16 -5
- package/foundation/fs/gather-cache.d.mts +94 -4
- package/foundation/fs/gather-cache.mjs +671 -106
- package/foundation/fs/glob.d.mts +16 -0
- package/foundation/fs/glob.mjs +105 -0
- package/foundation/fs/jiti-cache.d.mts +19 -1
- package/foundation/fs/jiti-cache.mjs +130 -6
- package/foundation/fs/kept-tree.d.mts +80 -0
- package/foundation/fs/kept-tree.mjs +240 -0
- package/foundation/fs/listing-cache.d.mts +7 -0
- package/foundation/fs/listing-cache.mjs +10 -0
- package/foundation/fs/module-loader.d.mts +24 -2
- package/foundation/fs/module-loader.mjs +94 -21
- package/foundation/fs/path-safety.d.mts +11 -2
- package/foundation/fs/path-safety.mjs +108 -18
- package/foundation/fs/paths.d.mts +18 -0
- package/foundation/fs/paths.mjs +15 -2
- package/foundation/fs/read-record.d.mts +56 -7
- package/foundation/fs/read-record.mjs +280 -56
- package/foundation/fs/regular-file.d.mts +29 -0
- package/foundation/fs/regular-file.mjs +77 -0
- package/foundation/fs/stop-cleanup.d.mts +12 -0
- package/foundation/fs/stop-cleanup.mjs +66 -0
- package/foundation/identity/provider-identity.d.mts +6 -0
- package/foundation/identity/provider-identity.mjs +10 -1
- package/foundation/integrations/contribution-inventory.mjs +4 -3
- package/foundation/integrations/example-code.d.mts +63 -0
- package/foundation/integrations/example-code.mjs +416 -0
- package/foundation/integrations/integrations.d.mts +23 -1
- package/foundation/integrations/integrations.mjs +18 -1
- package/foundation/integrations/pack-state.d.mts +75 -0
- package/foundation/integrations/pack-state.mjs +314 -0
- package/foundation/integrations/public-imports.d.mts +9 -0
- package/foundation/integrations/public-imports.mjs +3 -2
- package/foundation/integrations/shipped-imports.d.mts +122 -0
- package/foundation/integrations/shipped-imports.mjs +497 -0
- package/foundation/integrations/validate-contributions.d.mts +0 -17
- package/foundation/integrations/validate-contributions.mjs +59 -333
- package/foundation/render/assets.mjs +52 -7
- package/foundation/render/charts.d.mts +78 -27
- package/foundation/render/charts.mjs +266 -90
- package/foundation/render/embedded-files.d.mts +6 -0
- package/foundation/render/embedded-files.mjs +25 -5
- package/foundation/render/embedded-imports.d.mts +70 -7
- package/foundation/render/embedded-imports.mjs +132 -41
- package/foundation/render/file-header.d.mts +66 -0
- package/foundation/render/file-header.mjs +118 -0
- package/foundation/render/host-answer.d.mts +18 -0
- package/foundation/render/host-answer.mjs +46 -0
- package/foundation/render/host-exit.d.mts +1 -0
- package/foundation/render/host-exit.mjs +6 -1
- package/foundation/render/html-reader.d.mts +55 -2
- package/foundation/render/html-reader.mjs +145 -26
- package/foundation/render/layers.d.mts +30 -0
- package/foundation/render/layers.mjs +158 -0
- package/foundation/render/markup-edits.d.mts +57 -0
- package/foundation/render/markup-edits.mjs +182 -0
- package/foundation/render/offline.d.mts +32 -0
- package/foundation/render/offline.mjs +56 -0
- package/foundation/render/page-host.mjs +29 -12
- package/foundation/render/page-worker.mjs +354 -21
- package/foundation/render/picture-chrome.d.mts +4 -0
- package/foundation/render/picture-chrome.mjs +192 -0
- package/foundation/render/picture-playwright.d.mts +4 -0
- package/foundation/render/picture-playwright.mjs +46 -0
- package/foundation/render/rebuild.mjs +2 -1
- package/foundation/render/render-page.d.mts +79 -5
- package/foundation/render/render-page.mjs +735 -109
- package/foundation/render/source-block.d.mts +85 -6
- package/foundation/render/source-block.mjs +211 -20
- package/foundation/render/ts-paths.d.mts +69 -6
- package/foundation/render/ts-paths.mjs +326 -40
- package/foundation/response/error-codes.d.mts +3 -1
- package/foundation/response/error-codes.d.ts +1 -0
- package/foundation/response/error-codes.doc.mjs +12 -1
- package/foundation/response/error-codes.mjs +11 -1
- package/foundation/response/response-types.doc.mjs +6 -6
- package/foundation/suggest/name-index.d.mts +148 -0
- package/foundation/suggest/name-index.mjs +317 -0
- package/foundation/suggest/other-command.d.mts +140 -0
- package/foundation/suggest/other-command.mjs +756 -0
- package/foundation/text/compare-text.d.mts +14 -0
- package/foundation/text/compare-text.mjs +68 -0
- package/foundation/text/css-escape.d.mts +18 -0
- package/foundation/text/css-escape.mjs +35 -0
- package/foundation/text/entry-names.d.mts +14 -0
- package/foundation/text/entry-names.mjs +14 -0
- package/foundation/text/string-utils.d.mts +46 -6
- package/foundation/text/string-utils.mjs +118 -20
- package/foundation/text/suggest-order.d.mts +47 -4
- package/foundation/text/suggest-order.mjs +174 -5
- package/foundation/xle/browser.d.mts +2 -2
- package/foundation/xle/expand.mjs +2 -1
- package/host/index.mjs +8 -6
- package/package.json +7 -6
|
@@ -13,10 +13,12 @@ import postcss from 'postcss';
|
|
|
13
13
|
import {
|
|
14
14
|
collectUnloadedFonts,
|
|
15
15
|
discoverDoctorThemes,
|
|
16
|
+
themeIdentifier,
|
|
16
17
|
discoverDoctorUnmigratedCopies,
|
|
17
18
|
corePeerRange,
|
|
18
19
|
findDoctorCoreDir,
|
|
19
20
|
doctorElementPropOrigins,
|
|
21
|
+
doctorRendersElement,
|
|
20
22
|
doctorStylesheetImports,
|
|
21
23
|
findDoctorInstalledPackage,
|
|
22
24
|
realDoctorFile,
|
|
@@ -32,15 +34,16 @@ import {
|
|
|
32
34
|
resolveRecordedTheme,
|
|
33
35
|
resolveThemeModule,
|
|
34
36
|
SOURCE_EXTENSIONS,
|
|
37
|
+
doctorStylesheetImportFile,
|
|
38
|
+
fileMark,
|
|
39
|
+
generatedSourceCommand,
|
|
35
40
|
isPrivateVarRefusal,
|
|
36
41
|
missingThemePackage,
|
|
37
42
|
packageInstallCommand,
|
|
38
43
|
themeBuild,
|
|
39
44
|
themeRecordOwner,
|
|
45
|
+
themeShippedImportFindings,
|
|
40
46
|
validateThemePrivateInputs,
|
|
41
|
-
GENERATED_MARKER,
|
|
42
|
-
APP_COPY_MARK,
|
|
43
|
-
EDITOR_GENERATED_MARK,
|
|
44
47
|
} from './_adapter.mjs';
|
|
45
48
|
import {
|
|
46
49
|
getCliInvocation,
|
|
@@ -117,7 +120,15 @@ function refreshThemeCommand(projectDir, run, available, slug, owner) {
|
|
|
117
120
|
}
|
|
118
121
|
const source = theme
|
|
119
122
|
? relative(projectDir, path.join(theme.sourceDir, theme.entry))
|
|
120
|
-
: projectPath(path.join(owner, slug, `${slug}Theme.ts`));
|
|
123
|
+
: projectPath(path.join(owner, slug, `${themeIdentifier(slug)}Theme.ts`));
|
|
124
|
+
// A source another command generates (its leading comment carries that
|
|
125
|
+
// command's mark), or a missing one that command writes: the fix is that
|
|
126
|
+
// command, which writes the source and its outputs together.
|
|
127
|
+
const by = generatedSourceCommand(path.resolve(projectDir, source));
|
|
128
|
+
if (by)
|
|
129
|
+
return /^astryx\s/.test(by)
|
|
130
|
+
? `${run} ${by.replace(/^astryx\s+/, '')}; ${run} theme add ${slug}`
|
|
131
|
+
: `Rebuild ${projectPath(path.dirname(source))}/ with ${by}, then run ${run} theme add ${slug}`;
|
|
121
132
|
return `${run} theme build ${source}; ${run} theme add ${slug}`;
|
|
122
133
|
}
|
|
123
134
|
|
|
@@ -225,12 +236,7 @@ function sourceImportEvidence(root, generatedModule) {
|
|
|
225
236
|
* @param {string} source
|
|
226
237
|
*/
|
|
227
238
|
function generatedThemeFile(source) {
|
|
228
|
-
|
|
229
|
-
/^\s*(?:\/\*[\s\S]*?\*\/|(?:\/\/[^\n]*(?:\n|$)\s*)+)/.exec(source)?.[0] ??
|
|
230
|
-
'';
|
|
231
|
-
return [GENERATED_MARKER, EDITOR_GENERATED_MARK, APP_COPY_MARK].some(m =>
|
|
232
|
-
leading.includes(m),
|
|
233
|
-
);
|
|
239
|
+
return fileMark(source) != null;
|
|
234
240
|
}
|
|
235
241
|
|
|
236
242
|
/**
|
|
@@ -447,19 +453,61 @@ function namedThemeFonts(files) {
|
|
|
447
453
|
return new Set(names.values());
|
|
448
454
|
}
|
|
449
455
|
|
|
450
|
-
/**
|
|
451
|
-
|
|
456
|
+
/**
|
|
457
|
+
* The families a font stylesheet loads with `@font-face`, following its
|
|
458
|
+
* local `@import`s (a relative file, or a package's stylesheet such as
|
|
459
|
+
* `@fontsource/inter/index.css`); `external` when it imports a URL
|
|
460
|
+
* (http, https, `//`), whose families doctor cannot read.
|
|
461
|
+
* @param {string} css
|
|
462
|
+
* @param {string} [file] the stylesheet's path, to resolve local imports
|
|
463
|
+
* @param {Set<string>} [seen]
|
|
464
|
+
*/
|
|
465
|
+
function fontStylesheetEvidence(css, file, seen = new Set()) {
|
|
452
466
|
const loaded = new Set();
|
|
453
467
|
let external = false;
|
|
468
|
+
let unread = false;
|
|
454
469
|
const root = postcss.parse(css);
|
|
455
470
|
root.walkAtRules(atRule => {
|
|
456
|
-
if (atRule.name.toLowerCase() === 'import')
|
|
471
|
+
if (atRule.name.toLowerCase() === 'import') {
|
|
472
|
+
const spec = [...doctorStylesheetImports(`@import ${atRule.params};`)][0];
|
|
473
|
+
if (!spec || /^(?:https?:)?\/\//i.test(spec)) {
|
|
474
|
+
external = true;
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
const target = file ? doctorStylesheetImportFile(spec, file) : null;
|
|
478
|
+
if (!target) {
|
|
479
|
+
// A local import doctor cannot follow may load the font: it
|
|
480
|
+
// cannot prove it either way.
|
|
481
|
+
unread = true;
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
if (seen.has(target)) return;
|
|
485
|
+
if (seen.size > 20) {
|
|
486
|
+
// Past the limit doctor follows, the rest is not proven either way.
|
|
487
|
+
unread = true;
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
seen.add(target);
|
|
491
|
+
try {
|
|
492
|
+
const inner = fontStylesheetEvidence(
|
|
493
|
+
readTextFile(target),
|
|
494
|
+
target,
|
|
495
|
+
seen,
|
|
496
|
+
);
|
|
497
|
+
for (const name of inner.loaded) loaded.add(name);
|
|
498
|
+
external ||= inner.external;
|
|
499
|
+
unread ||= inner.unread;
|
|
500
|
+
} catch {
|
|
501
|
+
unread = true;
|
|
502
|
+
}
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
457
505
|
if (atRule.name.toLowerCase() !== 'font-face') return;
|
|
458
506
|
atRule.walkDecls(/^font-family$/iu, declaration => {
|
|
459
507
|
loaded.add(normalizeFontName(declaration.value).toLowerCase());
|
|
460
508
|
});
|
|
461
509
|
});
|
|
462
|
-
return {loaded, external};
|
|
510
|
+
return {loaded, external, unread};
|
|
463
511
|
}
|
|
464
512
|
|
|
465
513
|
/** @param {import('postcss').Rule} rule @param {string} slug */
|
|
@@ -609,10 +657,18 @@ function definedThemeBase(init) {
|
|
|
609
657
|
* is reported as unconfirmed, never as missing. The scan reads app source only
|
|
610
658
|
* (no dependencies, build output, links or type-only imports) within the
|
|
611
659
|
* bounded source walk, and executes nothing.
|
|
660
|
+
*
|
|
661
|
+
* A package theme whose integration names the provider component that wires
|
|
662
|
+
* its themes (its manifest's `themeProvider`) is wired when the app renders
|
|
663
|
+
* that component (`wiredBy`): the theme whose stylesheet the app imports
|
|
664
|
+
* (its export, or a stylesheet of the package that is that theme's file),
|
|
665
|
+
* or the integration's only theme. A rendered provider with several themes
|
|
666
|
+
* and no stylesheet to tell them apart is unconfirmed, with the themes it
|
|
667
|
+
* may wire and the package's stylesheets the app imports.
|
|
612
668
|
* @param {string} cwd
|
|
613
669
|
* @returns {Promise<{
|
|
614
|
-
* wired: Array<{slug: string, owner: string, file: string}>,
|
|
615
|
-
* unconfirmed: Array<{file: string}>,
|
|
670
|
+
* wired: Array<{slug: string, owner: string, file: string, wiredBy?: string}>,
|
|
671
|
+
* unconfirmed: Array<{file: string, wiredBy?: string, themes?: string[], stylesheets?: string[]}>,
|
|
616
672
|
* }>}
|
|
617
673
|
*/
|
|
618
674
|
export async function themeImportWiring(cwd) {
|
|
@@ -651,6 +707,17 @@ export async function themeImportWiring(cwd) {
|
|
|
651
707
|
// package is installed (discovery also lists the CLI's bundled themes).
|
|
652
708
|
/** @type {ResolvedAppTheme[]} */
|
|
653
709
|
const themes = [];
|
|
710
|
+
/**
|
|
711
|
+
* The provider component each package theme's integration wires its themes
|
|
712
|
+
* with, by theme.
|
|
713
|
+
* @type {Map<ResolvedAppTheme, {export: string, from: string}>}
|
|
714
|
+
*/
|
|
715
|
+
const providerOf = new Map();
|
|
716
|
+
/**
|
|
717
|
+
* The folder each such theme's descriptor is in, links resolved.
|
|
718
|
+
* @type {Map<ResolvedAppTheme, string>}
|
|
719
|
+
*/
|
|
720
|
+
const folderOf = new Map();
|
|
654
721
|
for (const theme of available) {
|
|
655
722
|
let resolved;
|
|
656
723
|
try {
|
|
@@ -664,9 +731,30 @@ export async function themeImportWiring(cwd) {
|
|
|
664
731
|
}
|
|
665
732
|
if (resolved.source === 'local' || installedDir(resolved.owner)) {
|
|
666
733
|
themes.push(resolved);
|
|
734
|
+
if (theme.provider) {
|
|
735
|
+
providerOf.set(resolved, theme.provider);
|
|
736
|
+
folderOf.set(
|
|
737
|
+
resolved,
|
|
738
|
+
realDoctorFile(theme.sourceDir) ?? theme.sourceDir,
|
|
739
|
+
);
|
|
740
|
+
}
|
|
667
741
|
}
|
|
668
742
|
}
|
|
669
743
|
if (themes.length === 0) return none;
|
|
744
|
+
/** The providers the themes name, once each, with the themes each wires. */
|
|
745
|
+
/** @type {Map<string, {provider: {export: string, from: string}, themes: ResolvedAppTheme[], file: string | null, stylesheets: Array<{spec: string, target: string | null}>}>} */
|
|
746
|
+
const providers = new Map();
|
|
747
|
+
for (const [theme, provider] of providerOf) {
|
|
748
|
+
const key = `${provider.export}\u0000${provider.from}`;
|
|
749
|
+
const entry = providers.get(key) ?? {
|
|
750
|
+
provider,
|
|
751
|
+
themes: [],
|
|
752
|
+
file: null,
|
|
753
|
+
stylesheets: [],
|
|
754
|
+
};
|
|
755
|
+
entry.themes.push(theme);
|
|
756
|
+
providers.set(key, entry);
|
|
757
|
+
}
|
|
670
758
|
/**
|
|
671
759
|
* The theme a `Theme` value's origin is, or null.
|
|
672
760
|
* @param {{file: string, name: string} | null} origin
|
|
@@ -687,12 +775,14 @@ export async function themeImportWiring(cwd) {
|
|
|
687
775
|
if (named.length === 1) return named[0];
|
|
688
776
|
return owned.length === 1 ? owned[0] : null;
|
|
689
777
|
};
|
|
690
|
-
/** @type {Map<string, {slug: string, owner: string, file: string}>} */
|
|
778
|
+
/** @type {Map<string, {slug: string, owner: string, file: string, wiredBy?: string}>} */
|
|
691
779
|
const wired = new Map();
|
|
692
780
|
const keyOf = (/** @type {ResolvedAppTheme} */ theme) =>
|
|
693
781
|
`${theme.owner}\u0000${theme.slug}`;
|
|
694
782
|
/** @type {Set<string>} */
|
|
695
783
|
const unconfirmed = new Set();
|
|
784
|
+
/** @type {Array<{file: string, wiredBy: string, themes: string[], stylesheets: string[]}>} */
|
|
785
|
+
const unconfirmedProviders = [];
|
|
696
786
|
for (const file of listProjectSourceFiles(projectDir, '', {
|
|
697
787
|
stylesheets: true,
|
|
698
788
|
})) {
|
|
@@ -702,7 +792,44 @@ export async function themeImportWiring(cwd) {
|
|
|
702
792
|
} catch {
|
|
703
793
|
continue;
|
|
704
794
|
}
|
|
795
|
+
// A file the CLI generates (a theme build, the editor's files) imports
|
|
796
|
+
// its base to extend it, never to render it: it wires nothing.
|
|
797
|
+
if (generatedThemeFile(source)) continue;
|
|
705
798
|
const shown = relative(projectDir, file);
|
|
799
|
+
for (const entry of providers.values()) {
|
|
800
|
+
if (
|
|
801
|
+
entry.file == null &&
|
|
802
|
+
path.extname(file) !== '.css' &&
|
|
803
|
+
source.includes(entry.provider.export) &&
|
|
804
|
+
source.includes(entry.provider.from) &&
|
|
805
|
+
doctorRendersElement(file, {
|
|
806
|
+
sources: new Set([entry.provider.from]),
|
|
807
|
+
name: entry.provider.export,
|
|
808
|
+
})
|
|
809
|
+
)
|
|
810
|
+
entry.file = shown;
|
|
811
|
+
// A stylesheet the app imports from the provider's package: the
|
|
812
|
+
// package's theme stylesheet, wherever the package keeps it.
|
|
813
|
+
for (const owner of new Set(entry.themes.map(theme => theme.owner))) {
|
|
814
|
+
// Only text that names the package and a stylesheet is parsed.
|
|
815
|
+
if (!source.includes(`${owner}/`) || !source.includes('.css')) continue;
|
|
816
|
+
let specifiers;
|
|
817
|
+
try {
|
|
818
|
+
specifiers =
|
|
819
|
+
path.extname(file) === '.css'
|
|
820
|
+
? doctorStylesheetImports(source)
|
|
821
|
+
: moduleSpecifiers(source, {runtimeOnly: true});
|
|
822
|
+
} catch {
|
|
823
|
+
continue;
|
|
824
|
+
}
|
|
825
|
+
for (const spec of specifiers)
|
|
826
|
+
if (spec.startsWith(`${owner}/`) && /\.css$/u.test(spec))
|
|
827
|
+
entry.stylesheets.push({
|
|
828
|
+
spec,
|
|
829
|
+
target: doctorStylesheetImportFile(spec, file),
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
}
|
|
706
833
|
const candidates = themes.filter(
|
|
707
834
|
theme =>
|
|
708
835
|
!wired.has(keyOf(theme)) &&
|
|
@@ -718,6 +845,11 @@ export async function themeImportWiring(cwd) {
|
|
|
718
845
|
path.extname(file) === '.css'
|
|
719
846
|
? doctorStylesheetImports(source)
|
|
720
847
|
: moduleSpecifiers(source, {runtimeOnly: true});
|
|
848
|
+
// An import used only as a theme's `extends` (a theme source such
|
|
849
|
+
// as the editor's) renders nothing.
|
|
850
|
+
if (path.extname(file) !== '.css')
|
|
851
|
+
for (const from of extendOnlySpecifiers(parseModule(source)))
|
|
852
|
+
specifiers.delete(from);
|
|
721
853
|
} catch {
|
|
722
854
|
specifiers = new Set();
|
|
723
855
|
}
|
|
@@ -750,23 +882,112 @@ export async function themeImportWiring(cwd) {
|
|
|
750
882
|
}
|
|
751
883
|
}
|
|
752
884
|
}
|
|
885
|
+
// A rendered provider wires its integration's theme: the one whose
|
|
886
|
+
// stylesheet the app imports (its export, or any stylesheet of the
|
|
887
|
+
// package that is that theme's file), or the only one it has. With
|
|
888
|
+
// several and no stylesheet to tell them apart, which one it wires is not
|
|
889
|
+
// known.
|
|
890
|
+
for (const {
|
|
891
|
+
provider,
|
|
892
|
+
themes: owned,
|
|
893
|
+
file,
|
|
894
|
+
stylesheets,
|
|
895
|
+
} of providers.values()) {
|
|
896
|
+
if (file == null) continue;
|
|
897
|
+
const wiredBy = `${provider.export} from ${provider.from}`;
|
|
898
|
+
const files = new Set(
|
|
899
|
+
stylesheets.flatMap(x =>
|
|
900
|
+
x.target ? [realDoctorFile(x.target) ?? x.target] : [],
|
|
901
|
+
),
|
|
902
|
+
);
|
|
903
|
+
// A stylesheet of the package is a theme's when it is that theme's
|
|
904
|
+
// stylesheet export, a file inside that theme's own folder, or a file
|
|
905
|
+
// that stylesheet imports; it names a theme only when one theme claims
|
|
906
|
+
// it.
|
|
907
|
+
/** The files a theme's own stylesheet is or imports. @param {ResolvedAppTheme} theme */
|
|
908
|
+
const ownFiles = theme => {
|
|
909
|
+
const sheet = theme.stylesheetFile;
|
|
910
|
+
const real = realDoctorFile(sheet) ?? sheet;
|
|
911
|
+
const css = readTextFileIfExists(sheet) ?? '';
|
|
912
|
+
return [
|
|
913
|
+
real,
|
|
914
|
+
...[...doctorStylesheetImports(css)].flatMap(spec => {
|
|
915
|
+
const target = doctorStylesheetImportFile(spec, sheet);
|
|
916
|
+
return target ? [realDoctorFile(target) ?? target] : [];
|
|
917
|
+
}),
|
|
918
|
+
];
|
|
919
|
+
};
|
|
920
|
+
const claims = new Map(
|
|
921
|
+
owned.map(theme => {
|
|
922
|
+
const folder = folderOf.get(theme);
|
|
923
|
+
const own = new Set(ownFiles(theme));
|
|
924
|
+
return [
|
|
925
|
+
theme,
|
|
926
|
+
[...files].filter(
|
|
927
|
+
f =>
|
|
928
|
+
own.has(f) ||
|
|
929
|
+
(folder != null && f.startsWith(`${folder}${path.sep}`)),
|
|
930
|
+
),
|
|
931
|
+
];
|
|
932
|
+
}),
|
|
933
|
+
);
|
|
934
|
+
const claimedBy = (/** @type {string} */ f) =>
|
|
935
|
+
owned.filter(theme => claims.get(theme)?.includes(f));
|
|
936
|
+
const imported = owned.filter(
|
|
937
|
+
theme =>
|
|
938
|
+
wired.has(keyOf(theme)) ||
|
|
939
|
+
(claims.get(theme) ?? []).some(f => claimedBy(f).length === 1),
|
|
940
|
+
);
|
|
941
|
+
if (imported.length > 0) {
|
|
942
|
+
for (const theme of imported)
|
|
943
|
+
wired.set(keyOf(theme), {
|
|
944
|
+
slug: theme.slug,
|
|
945
|
+
owner: theme.owner,
|
|
946
|
+
file,
|
|
947
|
+
wiredBy,
|
|
948
|
+
});
|
|
949
|
+
} else if (owned.length === 1) {
|
|
950
|
+
wired.set(keyOf(owned[0]), {
|
|
951
|
+
slug: owned[0].slug,
|
|
952
|
+
owner: owned[0].owner,
|
|
953
|
+
file,
|
|
954
|
+
wiredBy,
|
|
955
|
+
});
|
|
956
|
+
} else {
|
|
957
|
+
unconfirmedProviders.push({
|
|
958
|
+
file,
|
|
959
|
+
wiredBy,
|
|
960
|
+
themes: owned.map(theme => theme.slug),
|
|
961
|
+
stylesheets: [...new Set(stylesheets.map(x => x.spec))],
|
|
962
|
+
});
|
|
963
|
+
}
|
|
964
|
+
}
|
|
753
965
|
// In discovery order, so the report does not depend on the file walk.
|
|
754
966
|
return {
|
|
755
967
|
wired: themes.flatMap(theme => {
|
|
756
968
|
const found = wired.get(keyOf(theme));
|
|
757
|
-
return found ? [found] : [];
|
|
969
|
+
return found ? [/** @type {any} */ (found)] : [];
|
|
758
970
|
}),
|
|
759
|
-
unconfirmed: [
|
|
971
|
+
unconfirmed: [
|
|
972
|
+
...[...unconfirmed].sort().map(file => ({file})),
|
|
973
|
+
...unconfirmedProviders,
|
|
974
|
+
],
|
|
760
975
|
};
|
|
761
976
|
}
|
|
762
977
|
|
|
763
978
|
/**
|
|
764
979
|
* The pass message's list of themes wired by import, each with the file that
|
|
765
980
|
* imports it.
|
|
766
|
-
* @param {Array<{slug: string, file: string}>} wired
|
|
981
|
+
* @param {Array<{slug: string, file: string, wiredBy?: string}>} wired
|
|
767
982
|
*/
|
|
768
983
|
function wiredByImportList(wired) {
|
|
769
|
-
const shown = wired
|
|
984
|
+
const shown = wired
|
|
985
|
+
.slice(0, 5)
|
|
986
|
+
.map(({slug, file, wiredBy}) =>
|
|
987
|
+
wiredBy
|
|
988
|
+
? `${slug} (wired by ${wiredBy} in ${file})`
|
|
989
|
+
: `${slug} (${file})`,
|
|
990
|
+
);
|
|
770
991
|
const more = wired.length - shown.length;
|
|
771
992
|
return more > 0 ? `${shown.join(', ')} and ${more} more` : shown.join(', ');
|
|
772
993
|
}
|
|
@@ -781,7 +1002,7 @@ function wiredByImportList(wired) {
|
|
|
781
1002
|
* reports the overall result of the app-theme checks.
|
|
782
1003
|
* @param {string} cwd
|
|
783
1004
|
* @param {DoctorCheck[]} appChecks - the checks {@link checkAppThemes} returned
|
|
784
|
-
* @param {{wired: Array<{slug: string, file: string}>, unconfirmed: Array<{file: string}>}} [wiring] -
|
|
1005
|
+
* @param {{wired: Array<{slug: string, file: string, wiredBy?: string}>, unconfirmed: Array<{file: string, wiredBy?: string, themes?: string[], stylesheets?: string[]}>}} [wiring] -
|
|
785
1006
|
* what {@link themeImportWiring} returned
|
|
786
1007
|
* @returns {DoctorCheck}
|
|
787
1008
|
*/
|
|
@@ -848,6 +1069,32 @@ export function checkThemes(
|
|
|
848
1069
|
|
|
849
1070
|
const run = getCliInvocation(cwd);
|
|
850
1071
|
const packages = listDoctorThemePackages(cwd);
|
|
1072
|
+
// A rendered provider that wires one of several themes, none of them told
|
|
1073
|
+
// apart by an imported stylesheet: a theme is wired, but which one is not
|
|
1074
|
+
// known.
|
|
1075
|
+
const providerUnknown = wiring.unconfirmed.filter(entry => entry.wiredBy);
|
|
1076
|
+
const traceUnknown = wiring.unconfirmed.filter(entry => !entry.wiredBy);
|
|
1077
|
+
if (
|
|
1078
|
+
wiredByImport.length === 0 &&
|
|
1079
|
+
providerUnknown.length > 0 &&
|
|
1080
|
+
!appPackageNamesTheme(cwd)
|
|
1081
|
+
) {
|
|
1082
|
+
// Which stylesheet of the package the app imports is named, never
|
|
1083
|
+
// called missing: doctor only cannot match it to one theme.
|
|
1084
|
+
const shown = providerUnknown
|
|
1085
|
+
.map(entry =>
|
|
1086
|
+
entry.stylesheets?.length
|
|
1087
|
+
? `${entry.file} renders ${entry.wiredBy}, which wires one of ${(entry.themes ?? []).join(', ')}, and the app imports ${entry.stylesheets.join(', ')} from that package; doctor could not tell which of those themes ${entry.stylesheets.length > 1 ? 'they are' : 'it is'}`
|
|
1088
|
+
: `${entry.file} renders ${entry.wiredBy}, which wires one of ${(entry.themes ?? []).join(', ')}; doctor could not tell which, because the app imports none of their stylesheets`,
|
|
1089
|
+
)
|
|
1090
|
+
.join('; ');
|
|
1091
|
+
return {
|
|
1092
|
+
id: 'themes',
|
|
1093
|
+
label,
|
|
1094
|
+
status: 'info',
|
|
1095
|
+
message: `${shown}.`,
|
|
1096
|
+
};
|
|
1097
|
+
}
|
|
851
1098
|
if (packages.length === 0 && wiredByImport.length > 0) {
|
|
852
1099
|
return {
|
|
853
1100
|
id: 'themes',
|
|
@@ -874,13 +1121,13 @@ export function checkThemes(
|
|
|
874
1121
|
message: `Theme package(s) installed (${names}); wired by import: ${wiredByImportList(wiredByImport)}.`,
|
|
875
1122
|
};
|
|
876
1123
|
}
|
|
877
|
-
if (!appPackageNamesTheme(cwd) &&
|
|
878
|
-
const files =
|
|
1124
|
+
if (!appPackageNamesTheme(cwd) && traceUnknown.length > 0) {
|
|
1125
|
+
const files = traceUnknown.map(({file}) => file).join(', ');
|
|
879
1126
|
return {
|
|
880
1127
|
id: 'themes',
|
|
881
1128
|
label,
|
|
882
1129
|
status: 'info',
|
|
883
|
-
message: `Theme package(s) installed (${names}); ${files} pass${
|
|
1130
|
+
message: `Theme package(s) installed (${names}); ${files} pass${traceUnknown.length === 1 ? 'es' : ''} a theme to Theme that doctor could not trace to a theme import, so it could not confirm which theme is wired.`,
|
|
884
1131
|
fix: `If no theme is applied, add one with \`${run} theme add <slug>\`.`,
|
|
885
1132
|
};
|
|
886
1133
|
}
|
|
@@ -901,6 +1148,31 @@ export function checkThemes(
|
|
|
901
1148
|
};
|
|
902
1149
|
}
|
|
903
1150
|
|
|
1151
|
+
/**
|
|
1152
|
+
* The app-theme checks with what the wiring scan found: an app with no
|
|
1153
|
+
* generated theme module whose theme its integration's provider wires is
|
|
1154
|
+
* themed, so the `theme-management` check says so and offers no `theme add`.
|
|
1155
|
+
* @param {DoctorCheck[]} appChecks - the checks {@link checkAppThemes} returned
|
|
1156
|
+
* @param {{wired: Array<{slug: string, file: string, wiredBy?: string}>}} wiring -
|
|
1157
|
+
* what {@link themeImportWiring} returned
|
|
1158
|
+
* @returns {DoctorCheck[]}
|
|
1159
|
+
*/
|
|
1160
|
+
export function withProviderWiring(appChecks, wiring) {
|
|
1161
|
+
const byProvider = wiring.wired.filter(entry => entry.wiredBy);
|
|
1162
|
+
if (byProvider.length === 0) return appChecks;
|
|
1163
|
+
const shown = byProvider
|
|
1164
|
+
.map(entry => `${entry.slug} is wired by ${entry.wiredBy} in ${entry.file}`)
|
|
1165
|
+
.join('; ');
|
|
1166
|
+
return appChecks.map(check => {
|
|
1167
|
+
if (check.id !== 'theme-management') return check;
|
|
1168
|
+
const {fix: _fix, ...rest} = check;
|
|
1169
|
+
return {
|
|
1170
|
+
...rest,
|
|
1171
|
+
message: `The CLI manages no themes: ${shown}, the provider its package wires its themes with.`,
|
|
1172
|
+
};
|
|
1173
|
+
});
|
|
1174
|
+
}
|
|
1175
|
+
|
|
904
1176
|
/**
|
|
905
1177
|
* Run all ten app-theme checks.
|
|
906
1178
|
* @param {string} cwd
|
|
@@ -963,6 +1235,12 @@ export async function checkAppThemes(cwd) {
|
|
|
963
1235
|
const resolved = [];
|
|
964
1236
|
/** @type {Array<{slug: string, owner: string, message: string}>} */
|
|
965
1237
|
const resolutionProblems = [];
|
|
1238
|
+
/**
|
|
1239
|
+
* Added package themes whose module loads but names a file the package
|
|
1240
|
+
* does not ship.
|
|
1241
|
+
* @type {Array<{slug: string, owner: string, message: string}>}
|
|
1242
|
+
*/
|
|
1243
|
+
const unshippedImports = [];
|
|
966
1244
|
const ownerCounts = new Map();
|
|
967
1245
|
for (const theme of available) {
|
|
968
1246
|
const owner = themeRecordOwner(theme);
|
|
@@ -1019,6 +1297,18 @@ export async function checkAppThemes(cwd) {
|
|
|
1019
1297
|
});
|
|
1020
1298
|
continue;
|
|
1021
1299
|
}
|
|
1300
|
+
// Loading the module in Node does not prove an app can build it: a
|
|
1301
|
+
// stylesheet loads as an empty module, so its imports are never read.
|
|
1302
|
+
// A relative import that names no file the package ships is a warning:
|
|
1303
|
+
// the module itself loads.
|
|
1304
|
+
const unshipped = themeShippedImportFindings(resolvedTheme);
|
|
1305
|
+
if (unshipped.length > 0) {
|
|
1306
|
+
unshippedImports.push({
|
|
1307
|
+
slug,
|
|
1308
|
+
owner,
|
|
1309
|
+
message: `Theme "${slug}" from ${owner}: its built module loads, but it or its stylesheet names a file the package does not ship, so an app's bundler cannot build it: ${unshipped.map(finding => finding.message).join(' ')}`,
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1022
1312
|
resolved.push(resolvedTheme);
|
|
1023
1313
|
}
|
|
1024
1314
|
}
|
|
@@ -1066,14 +1356,48 @@ export async function checkAppThemes(cwd) {
|
|
|
1066
1356
|
label: 'Theme owners and built imports',
|
|
1067
1357
|
status: 'fail',
|
|
1068
1358
|
message: discoveryError.message,
|
|
1069
|
-
|
|
1359
|
+
// The added theme the broken folder holds, by its name.
|
|
1360
|
+
fix: (() => {
|
|
1361
|
+
const named = ownerEntries.find(([slug]) =>
|
|
1362
|
+
new RegExp(
|
|
1363
|
+
`(^|[\\s/"'(])${slug.replace(/[-]/g, '\\-')}([\\s/"').,:]|$)`,
|
|
1364
|
+
).test(discoveryError.message),
|
|
1365
|
+
)?.[0];
|
|
1366
|
+
if (!named)
|
|
1367
|
+
return 'Fix or move what the message names, then run doctor again.';
|
|
1368
|
+
// A theme another command generates: that command writes it again
|
|
1369
|
+
// (its fix is no `theme build`).
|
|
1370
|
+
const owner = String(state.themes[named]);
|
|
1371
|
+
const fix = isLocalThemeOwner(owner)
|
|
1372
|
+
? refreshThemeCommand(state.projectDir, run, [], named, owner)
|
|
1373
|
+
: null;
|
|
1374
|
+
return fix && !fix.includes(' theme build ')
|
|
1375
|
+
? fix
|
|
1376
|
+
: `Fix or move what the message names, then run ${run} theme add ${named}`;
|
|
1377
|
+
})(),
|
|
1070
1378
|
});
|
|
1071
1379
|
} else if (resolutionProblems.length > 0) {
|
|
1072
1380
|
checks.push({
|
|
1073
1381
|
id: 'theme-owners',
|
|
1074
1382
|
label: 'Theme owners and built imports',
|
|
1075
1383
|
status: 'fail',
|
|
1076
|
-
message: resolutionProblems
|
|
1384
|
+
message: resolutionProblems
|
|
1385
|
+
.map(problem =>
|
|
1386
|
+
// A theme another command generates is not rebuilt with `theme
|
|
1387
|
+
// build`: its fix names that command, so its message does not.
|
|
1388
|
+
refreshThemeCommand(
|
|
1389
|
+
state.projectDir,
|
|
1390
|
+
run,
|
|
1391
|
+
available,
|
|
1392
|
+
problem.slug,
|
|
1393
|
+
problem.owner,
|
|
1394
|
+
).includes(' theme build ')
|
|
1395
|
+
? problem.message
|
|
1396
|
+
: problem.message
|
|
1397
|
+
.replace(/\s*Run `[^`]*theme build[^`]*` and try again\./, '')
|
|
1398
|
+
.replace(/\s*Rebuild it with `[^`]*theme build[^`]*`\.?/, ''),
|
|
1399
|
+
)
|
|
1400
|
+
.join(' '),
|
|
1077
1401
|
fix: resolutionProblems
|
|
1078
1402
|
.map(problem =>
|
|
1079
1403
|
refreshThemeCommand(
|
|
@@ -1086,12 +1410,20 @@ export async function checkAppThemes(cwd) {
|
|
|
1086
1410
|
)
|
|
1087
1411
|
.join(' '),
|
|
1088
1412
|
});
|
|
1413
|
+
} else if (unshippedImports.length > 0) {
|
|
1414
|
+
checks.push({
|
|
1415
|
+
id: 'theme-owners',
|
|
1416
|
+
label: 'Theme owners and built imports',
|
|
1417
|
+
status: 'warn',
|
|
1418
|
+
message: unshippedImports.map(each => each.message).join(' '),
|
|
1419
|
+
fix: `Install a release of ${[...new Set(unshippedImports.map(each => each.owner))].join(', ')} that ships the named file, or ask its owner to publish one.`,
|
|
1420
|
+
});
|
|
1089
1421
|
} else {
|
|
1090
1422
|
checks.push({
|
|
1091
1423
|
id: 'theme-owners',
|
|
1092
1424
|
label: 'Theme owners and built imports',
|
|
1093
1425
|
status: 'pass',
|
|
1094
|
-
message: `${resolved.length} added theme${resolved.length === 1 ? '' : 's'} resolve to built modules and stylesheets,
|
|
1426
|
+
message: `${resolved.length} added theme${resolved.length === 1 ? '' : 's'} resolve to built modules and stylesheets, every built module loads, and every relative import of a package theme names a file its package ships.`,
|
|
1095
1427
|
});
|
|
1096
1428
|
}
|
|
1097
1429
|
|
|
@@ -1231,8 +1563,14 @@ export async function checkAppThemes(cwd) {
|
|
|
1231
1563
|
);
|
|
1232
1564
|
if (!availableTheme) continue;
|
|
1233
1565
|
try {
|
|
1566
|
+
const sourceFile = path.join(
|
|
1567
|
+
availableTheme.sourceDir,
|
|
1568
|
+
availableTheme.entry,
|
|
1569
|
+
);
|
|
1570
|
+
// Every added local theme is compared, a copy another command
|
|
1571
|
+
// generates included; only its fix names that command.
|
|
1234
1572
|
const receipt = await themeBuild(
|
|
1235
|
-
|
|
1573
|
+
sourceFile,
|
|
1236
1574
|
{check: true},
|
|
1237
1575
|
{cwd: state.projectDir, projectCore: true},
|
|
1238
1576
|
);
|
|
@@ -1469,6 +1807,8 @@ export async function checkAppThemes(cwd) {
|
|
|
1469
1807
|
|
|
1470
1808
|
const fontFailures = [];
|
|
1471
1809
|
const externalFontWarnings = [];
|
|
1810
|
+
/** Families behind a local font import doctor could not follow. */
|
|
1811
|
+
const unreadFontWarnings = [];
|
|
1472
1812
|
const missingFontWarnings = [];
|
|
1473
1813
|
let generatedImports = null;
|
|
1474
1814
|
try {
|
|
@@ -1509,6 +1849,7 @@ export async function checkAppThemes(cwd) {
|
|
|
1509
1849
|
try {
|
|
1510
1850
|
const evidence = fontStylesheetEvidence(
|
|
1511
1851
|
readTextFile(theme.fontStylesheetFile),
|
|
1852
|
+
theme.fontStylesheetFile,
|
|
1512
1853
|
);
|
|
1513
1854
|
const missing = [...names].filter(
|
|
1514
1855
|
name => !evidence.loaded.has(name.toLowerCase()),
|
|
@@ -1516,6 +1857,8 @@ export async function checkAppThemes(cwd) {
|
|
|
1516
1857
|
if (missing.length === 0) continue;
|
|
1517
1858
|
if (evidence.external) {
|
|
1518
1859
|
externalFontWarnings.push(`${theme.slug}: ${missing.join(', ')}`);
|
|
1860
|
+
} else if (evidence.unread) {
|
|
1861
|
+
unreadFontWarnings.push(`${theme.slug}: ${missing.join(', ')}`);
|
|
1519
1862
|
} else {
|
|
1520
1863
|
fontFailures.push({theme, message: missing.join(', ')});
|
|
1521
1864
|
}
|
|
@@ -1553,6 +1896,11 @@ export async function checkAppThemes(cwd) {
|
|
|
1553
1896
|
);
|
|
1554
1897
|
}
|
|
1555
1898
|
}
|
|
1899
|
+
if (unreadFontWarnings.length > 0) {
|
|
1900
|
+
fontWarningMessages.push(
|
|
1901
|
+
`Font imports doctor could not follow prevent proof for ${unreadFontWarnings.join('; ')}.`,
|
|
1902
|
+
);
|
|
1903
|
+
}
|
|
1556
1904
|
if (externalFontWarnings.length > 0) {
|
|
1557
1905
|
fontWarningMessages.push(
|
|
1558
1906
|
`External font imports prevent proof for ${externalFontWarnings.join('; ')}.`,
|
package/api/hook/_adapter.d.mts
CHANGED
|
@@ -10,15 +10,21 @@
|
|
|
10
10
|
export function resolveCoreDir(cwd: string): string;
|
|
11
11
|
/**
|
|
12
12
|
* Resolve a single hook's authored doc by name, or throw ERR_UNKNOWN_HOOK with
|
|
13
|
-
* fuzzy (levenshtein) suggestions.
|
|
14
|
-
*
|
|
13
|
+
* fuzzy (levenshtein) suggestions. When the name matches a component,
|
|
14
|
+
* template or docs topic exactly, folded or by its last segment, the
|
|
15
|
+
* suggestions also hold the command that reads it: right after the
|
|
16
|
+
* suggestions that match the name at its tier or a better one
|
|
17
|
+
* (foundation/suggest/other-command.mjs withOtherCommand), the list keeping
|
|
18
|
+
* its length. Shared by the detail and detail.params leaves, which both start
|
|
19
|
+
* from a resolved hook doc.
|
|
15
20
|
* @param {string} coreDir
|
|
16
21
|
* @param {string} name
|
|
17
|
-
* @param {{zh?: boolean, lang?: string|null}} [opts]
|
|
22
|
+
* @param {{zh?: boolean, lang?: string|null, cwd?: string}} [opts]
|
|
18
23
|
* @returns {Promise<import('./hook.type.mjs').HookDoc>}
|
|
19
24
|
*/
|
|
20
|
-
export function resolveHookDoc(coreDir: string, name: string, { zh, lang }?: {
|
|
25
|
+
export function resolveHookDoc(coreDir: string, name: string, { zh, lang, cwd }?: {
|
|
21
26
|
zh?: boolean;
|
|
22
27
|
lang?: string | null;
|
|
28
|
+
cwd?: string;
|
|
23
29
|
}): Promise<import("./hook.type.mjs").HookDoc>;
|
|
24
30
|
export { CORE_PROVIDER_ID as CORE_PACKAGE } from "../../foundation/identity/providers.mjs";
|