@astryxdesign/cli 0.7.16 → 0.7.17-canary.g16fe6a8
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 +12 -0
- package/api/build/_adapter.mjs +51 -34
- package/api/build/blocks/blocks.d.mts +7 -5
- package/api/build/blocks/blocks.mjs +113 -26
- 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 +4 -2
- package/api/build/kit/rank.mjs +125 -24
- package/api/build/kit/start.d.mts +5 -4
- package/api/build/kit/start.mjs +12 -8
- package/api/build/kit/weights.d.mts +39 -3
- package/api/build/kit/weights.json +1 -1
- package/api/build/kit/weights.mjs +340 -43
- 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 +48 -0
- package/api/build/kit/words.mjs +90 -1
- package/api/component/__fixtures__/resolutions/modules.txt +4 -5
- package/api/component/list/list.d.mts +1 -1
- package/api/component/list/list.mjs +48 -6
- package/api/discover/_adapter.d.mts +1 -1
- package/api/discover/search/search.mjs +3 -2
- package/api/docs/_adapter.d.mts +28 -2
- package/api/docs/_adapter.mjs +249 -10
- 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 +27 -5
- package/api/doctor/_adapter.mjs +83 -10
- package/api/doctor/built-checks.mjs +40 -14
- package/api/doctor/doctor.d.mts +4 -3
- package/api/doctor/doctor.mjs +14 -7
- package/api/doctor/theme-checks.mjs +121 -17
- 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/authoring-checks.mjs +6 -6
- 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/validate-integration.mjs +19 -1
- package/api/integration/validate-integration.type.d.mts +9 -0
- package/api/integration/validate-integration.type.mjs +1 -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 +52 -0
- package/api/render/render.type.mjs +31 -1
- package/api/search/ORDERING.md +1 -1
- package/api/search/_adapter.d.mts +9 -0
- package/api/search/_adapter.mjs +85 -0
- package/api/search/_candidate-score.mjs +51 -32
- 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 +5 -0
- package/api/search/_lexical.mjs +8 -2
- 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/theme/_adapter.mjs +12 -1
- package/api/theme/build/build.d.mts +132 -1
- package/api/theme/build/build.mjs +482 -157
- 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 +44 -5
- package/api/theme/build/font-warning.mjs +118 -10
- package/api/theme/build/icon-imports.mjs +51 -9
- package/api/theme/theme.type.d.mts +10 -0
- package/api/theme/theme.type.mjs +7 -1
- package/api/theme-edit/_adapter.d.mts +115 -4
- package/api/theme-edit/_adapter.mjs +997 -83
- package/api/theme-edit/_catalog.d.mts +20 -2
- package/api/theme-edit/_catalog.mjs +50 -10
- package/api/theme-edit/_check.d.mts +75 -24
- package/api/theme-edit/_check.mjs +2672 -422
- package/api/theme-edit/_color.d.mts +10 -0
- package/api/theme-edit/_color.mjs +54 -1
- package/api/theme-edit/_compiler.d.mts +1 -0
- package/api/theme-edit/_compiler.mjs +133 -15
- package/api/theme-edit/_context.d.mts +14 -3
- package/api/theme-edit/_context.mjs +225 -65
- package/api/theme-edit/_css.d.mts +14 -0
- package/api/theme-edit/_css.mjs +46 -1
- package/api/theme-edit/_edit.d.mts +54 -4
- package/api/theme-edit/_edit.mjs +2966 -286
- package/api/theme-edit/_how-commands.d.mts +72 -1
- package/api/theme-edit/_how-commands.mjs +770 -9
- package/api/theme-edit/_how-question.d.mts +82 -5
- package/api/theme-edit/_how-question.mjs +6983 -701
- package/api/theme-edit/_how.d.mts +2 -1
- package/api/theme-edit/_how.mjs +237 -41
- 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 +303 -0
- package/api/theme-edit/_normal.mjs +1517 -0
- package/api/theme-edit/_palette.d.mts +12 -0
- package/api/theme-edit/_palette.mjs +37 -4
- package/api/theme-edit/_part-words.d.mts +31 -0
- package/api/theme-edit/_part-words.mjs +126 -0
- package/api/theme-edit/_parts.d.mts +28 -2
- package/api/theme-edit/_parts.mjs +267 -31
- package/api/theme-edit/_preview-app.d.mts +7 -13
- package/api/theme-edit/_preview-app.mjs +814 -406
- package/api/theme-edit/_preview.d.mts +116 -16
- package/api/theme-edit/_preview.mjs +649 -152
- package/api/theme-edit/_project.d.mts +22 -1
- package/api/theme-edit/_project.mjs +83 -3
- package/api/theme-edit/_settings.d.mts +467 -42
- package/api/theme-edit/_settings.mjs +3527 -468
- package/api/theme-edit/_tables.d.mts +21 -0
- package/api/theme-edit/_tables.mjs +97 -3
- 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 +16 -2
- package/api/theme-edit/theme-edit.type.mjs +6 -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/assets/codemods/integration-discovery.mjs +2 -1
- package/assets/codemods/run-codemod.mjs +87 -7
- 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 +1 -0
- package/assets/docs/theme.doc.dense.mjs +2 -2
- package/assets/docs/theme.doc.mjs +1 -1
- package/assets/docs/tree/check-your-docs.doc.mjs +1 -1
- package/assets/docs/tree/checks.doc.mjs +1 -1
- package/assets/docs/tree/cli-command.doc.mjs +2 -3
- package/assets/docs/tree/render-pages.doc.mjs +44 -3
- 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/use-a-theme.doc.mjs +1 -1
- 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/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/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/template.doc.mjs +2 -1
- package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +2 -1
- package/assets/templates/pages/dashboard-composition/template.doc.mjs +2 -1
- package/assets/templates/pages/dashboard-progress/template.doc.mjs +6 -3
- 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/template.doc.mjs +7 -1
- package/assets/templates/pages/editor/template.doc.mjs +2 -8
- 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/gallery-hero/template.doc.mjs +4 -2
- package/assets/templates/pages/ide/page.tsx +24 -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/template.doc.mjs +2 -1
- 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/mixed-gallery/template.doc.mjs +2 -1
- 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/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/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/template.doc.mjs +9 -8
- package/assets/templates/pages/table-grouped/template.doc.mjs +4 -2
- 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/template.doc.mjs +1 -0
- package/assets/theme.template.ts +6 -0
- package/authoring/debug/parse.d.mts +3 -3
- package/authoring/doctypes/_schema.d.mts +3 -3
- 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/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/docs.doc.mjs +7 -1
- package/clients/cli/commands/docs.mjs +3 -1
- package/clients/cli/commands/doctor.mjs +32 -14
- package/clients/cli/commands/experimental/render.mjs +42 -1
- package/clients/cli/commands/experimental/theme.mjs +573 -119
- 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 +1 -1
- 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 +1 -1
- 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.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.mjs +4 -2
- package/clients/cli/commands/theme-build.doc.mjs +5 -1
- package/clients/cli/commands/theme.doc.mjs +1 -1
- package/clients/cli/commands/theme.mjs +718 -438
- package/clients/cli/commands/upgrade.mjs +42 -7
- package/clients/cli/index.mjs +1 -1
- 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 +132 -24
- package/clients/cli/lib/manifest.mjs +3 -2
- package/clients/cli/manifest.generated.json +1 -1
- package/foundation/agent-docs/agent-docs.mjs +1 -1
- package/foundation/config/theme-state.d.mts +13 -1
- package/foundation/config/theme-state.mjs +47 -7
- package/foundation/discovery/authoring-self-docs.mjs +1 -0
- package/foundation/discovery/component-discovery.d.mts +11 -0
- package/foundation/discovery/component-discovery.mjs +56 -8
- 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/doc-types.mjs +4 -3
- package/foundation/discovery/entry-name-files.d.mts +43 -0
- package/foundation/discovery/entry-name-files.mjs +264 -0
- package/foundation/discovery/hook-discovery.d.mts +8 -2
- package/foundation/discovery/hook-discovery.mjs +22 -8
- 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-doc-files.mjs +2 -1
- 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 +38 -18
- package/foundation/discovery/template-adapter.d.mts +53 -1
- package/foundation/discovery/template-adapter.mjs +176 -12
- package/foundation/discovery/template-icons.mjs +2 -1
- package/foundation/discovery/theme-discovery.mjs +31 -4
- package/foundation/discovery/theme-imports.d.mts +14 -0
- package/foundation/discovery/theme-imports.mjs +43 -1
- package/foundation/discovery/theming-targets.d.mts +6 -5
- package/foundation/discovery/theming-targets.mjs +31 -47
- package/foundation/doc-compiler/import.mjs +7 -1
- package/foundation/doc-compiler/inputs.mjs +3 -2
- package/foundation/doc-compiler/parse-readable.mjs +4 -1
- package/foundation/doc-compiler/stored-docs.d.mts +22 -0
- package/foundation/doc-compiler/stored-docs.mjs +49 -0
- package/foundation/env/semver.mjs +3 -1
- package/foundation/fonts/font-stylesheet.d.mts +38 -0
- package/foundation/fonts/font-stylesheet.mjs +141 -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 +4 -3
- package/foundation/fs/gather-cache.d.mts +62 -4
- package/foundation/fs/gather-cache.mjs +517 -91
- package/foundation/fs/jiti-cache.d.mts +19 -1
- package/foundation/fs/jiti-cache.mjs +130 -6
- package/foundation/fs/kept-tree.d.mts +60 -0
- package/foundation/fs/kept-tree.mjs +154 -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/paths.d.mts +18 -0
- package/foundation/fs/paths.mjs +15 -2
- package/foundation/fs/read-record.d.mts +9 -0
- package/foundation/fs/read-record.mjs +19 -11
- 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/public-imports.d.mts +9 -0
- package/foundation/integrations/public-imports.mjs +3 -2
- package/foundation/integrations/validate-contributions.mjs +17 -45
- package/foundation/render/embedded-files.d.mts +6 -0
- package/foundation/render/embedded-files.mjs +25 -5
- package/foundation/render/embedded-imports.d.mts +39 -7
- package/foundation/render/embedded-imports.mjs +66 -27
- 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/markup-edits.d.mts +57 -0
- package/foundation/render/markup-edits.mjs +182 -0
- package/foundation/render/page-host.mjs +29 -12
- package/foundation/render/page-worker.mjs +121 -13
- package/foundation/render/picture-chrome.d.mts +4 -0
- package/foundation/render/picture-chrome.mjs +185 -0
- package/foundation/render/picture-playwright.d.mts +4 -0
- package/foundation/render/picture-playwright.mjs +34 -0
- package/foundation/render/rebuild.mjs +2 -1
- package/foundation/render/render-page.d.mts +35 -3
- package/foundation/render/render-page.mjs +641 -96
- 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 +2 -2
- 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/string-utils.d.mts +3 -2
- package/foundation/text/string-utils.mjs +18 -4
- package/foundation/text/suggest-order.d.mts +9 -0
- package/foundation/text/suggest-order.mjs +15 -1
- package/foundation/xle/expand.mjs +2 -1
- package/host/index.mjs +8 -6
- package/package.json +7 -6
package/api/docs/docs.d.mts
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
* @param {string} [options.lang]
|
|
9
9
|
* @param {boolean} [options.zh]
|
|
10
10
|
* @param {boolean} [options.dense]
|
|
11
|
+
* @param {boolean} [options.list] return the topic list, the same as giving
|
|
12
|
+
* no topic; docs() refuses a topic or section beside it
|
|
11
13
|
* @param {boolean} [options.index] return the topic's section index instead of
|
|
12
14
|
* the whole doc
|
|
13
15
|
* @param {number | 'all'} [options.depth] how many levels below a docs-tree
|
|
@@ -27,6 +29,7 @@ export function docs(topic?: string, section?: string, options?: {
|
|
|
27
29
|
lang?: string | undefined;
|
|
28
30
|
zh?: boolean | undefined;
|
|
29
31
|
dense?: boolean | undefined;
|
|
32
|
+
list?: boolean | undefined;
|
|
30
33
|
index?: boolean | undefined;
|
|
31
34
|
depth?: number | "all" | undefined;
|
|
32
35
|
detail?: "compact" | "full" | "brief" | undefined;
|
package/api/docs/docs.doc.mjs
CHANGED
|
@@ -78,6 +78,12 @@ export const doc = {
|
|
|
78
78
|
description:
|
|
79
79
|
'Return the token-efficient dense doc variant. It is written to be read whole, so it returns the whole doc.',
|
|
80
80
|
},
|
|
81
|
+
{
|
|
82
|
+
name: 'options.list',
|
|
83
|
+
type: 'boolean',
|
|
84
|
+
description:
|
|
85
|
+
'Return the topic list, the same as giving no topic. It takes no topic or section.',
|
|
86
|
+
},
|
|
81
87
|
{
|
|
82
88
|
name: 'options.index',
|
|
83
89
|
type: 'boolean',
|
|
@@ -133,7 +139,7 @@ export const doc = {
|
|
|
133
139
|
throws: [
|
|
134
140
|
{
|
|
135
141
|
code: 'ERR_INVALID_ARGUMENT',
|
|
136
|
-
when: "depth is not a whole number of levels or 'all'",
|
|
142
|
+
when: "depth is not a whole number of levels or 'all', or list is set with a topic or section",
|
|
137
143
|
},
|
|
138
144
|
{
|
|
139
145
|
code: 'ERR_INVALID_DETAIL',
|
package/api/docs/docs.mjs
CHANGED
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
* docs(route) -> node -> docs.node
|
|
14
14
|
* docs(route, undefined, {depth: 2}) -> node -> docs.node, two levels
|
|
15
15
|
*
|
|
16
|
+
* `list` names the list read. It is the same as no topic, so docs() refuses
|
|
17
|
+
* a topic or section beside it instead of dropping it.
|
|
18
|
+
*
|
|
16
19
|
* A topic read returns the whole doc, as it always has; `index` returns its
|
|
17
20
|
* sections, so a reader can open one by its key (spec:AST-047). The CLI's text
|
|
18
21
|
* view lists the sections by default. A route names a node
|
|
@@ -114,6 +117,8 @@ function depthRead(options) {
|
|
|
114
117
|
* @param {string} [options.lang]
|
|
115
118
|
* @param {boolean} [options.zh]
|
|
116
119
|
* @param {boolean} [options.dense]
|
|
120
|
+
* @param {boolean} [options.list] return the topic list, the same as giving
|
|
121
|
+
* no topic; docs() refuses a topic or section beside it
|
|
117
122
|
* @param {boolean} [options.index] return the topic's section index instead of
|
|
118
123
|
* the whole doc
|
|
119
124
|
* @param {number | 'all'} [options.depth] how many levels below a docs-tree
|
|
@@ -148,6 +153,13 @@ export async function docs(topic, section, options = {}) {
|
|
|
148
153
|
*/
|
|
149
154
|
async function docsRead(topic, section, options = {}) {
|
|
150
155
|
const read = depthRead(options);
|
|
156
|
+
if (options.list && (topic || section)) {
|
|
157
|
+
throw new AstryxError(
|
|
158
|
+
'Ask for the topic list or one topic, not both: --list takes no topic or section.',
|
|
159
|
+
undefined,
|
|
160
|
+
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
161
|
+
);
|
|
162
|
+
}
|
|
151
163
|
if (!topic) return list(options);
|
|
152
164
|
const found = await resolveDocsArgument(topic, options);
|
|
153
165
|
if (found.kind === 'node') {
|
package/api/docs/docs.type.d.mts
CHANGED
|
@@ -376,6 +376,11 @@ export type DocsOptions = {
|
|
|
376
376
|
lang?: string | undefined;
|
|
377
377
|
zh?: boolean | undefined;
|
|
378
378
|
dense?: boolean | undefined;
|
|
379
|
+
/**
|
|
380
|
+
* return the topic list, the same as giving no
|
|
381
|
+
* topic; docs() refuses a topic or section beside it
|
|
382
|
+
*/
|
|
383
|
+
list?: boolean | undefined;
|
|
379
384
|
/**
|
|
380
385
|
* return a topic's section index instead of its
|
|
381
386
|
* whole doc
|
package/api/docs/docs.type.mjs
CHANGED
|
@@ -245,6 +245,8 @@
|
|
|
245
245
|
* @property {string} [lang]
|
|
246
246
|
* @property {boolean} [zh]
|
|
247
247
|
* @property {boolean} [dense]
|
|
248
|
+
* @property {boolean} [list] return the topic list, the same as giving no
|
|
249
|
+
* topic; docs() refuses a topic or section beside it
|
|
248
250
|
* @property {boolean} [index] return a topic's section index instead of its
|
|
249
251
|
* whole doc
|
|
250
252
|
* @property {number | 'all'} [depth] how many levels below a docs-tree
|
package/api/docs/node/node.mjs
CHANGED
|
@@ -295,7 +295,7 @@ export function typedEdges(tree, node) {
|
|
|
295
295
|
export async function node(route, options = {}) {
|
|
296
296
|
const found = await resolveDocsArgument(route, options);
|
|
297
297
|
if (found.kind !== 'node')
|
|
298
|
-
throw await unknownTopicError(route, found.catalog);
|
|
298
|
+
throw await unknownTopicError(route, found.catalog, options);
|
|
299
299
|
return {
|
|
300
300
|
type: 'docs.node',
|
|
301
301
|
// The docs tree names each node's npm package as its provider.
|
|
@@ -5,19 +5,26 @@
|
|
|
5
5
|
* A doctor check that reads only files, kept between runs through the kept
|
|
6
6
|
* gather (foundation/fs/gather-cache.mjs): a later `doctor` with every file,
|
|
7
7
|
* folder, module and environment variable it read unchanged reads the check
|
|
8
|
-
* back. Only the docs checks go through here; a
|
|
9
|
-
* time, the network or anything else the stamps do
|
|
8
|
+
* back. Only the docs checks and the theme-wiring scan go through here; a
|
|
9
|
+
* check that depends on the time, the network or anything else the stamps do
|
|
10
|
+
* not see never does.
|
|
10
11
|
* @template T
|
|
11
12
|
* @param {{name: string, cwd: string, coreDir: string | null}} where - The
|
|
12
13
|
* check, the project folder, and the Core folder the project loads.
|
|
13
14
|
* @param {() => Promise<T>} check
|
|
15
|
+
* @param {{encode: (value: any) => any, decode: (stored: any) => any, valid?: (value: any) => boolean}} [codec]
|
|
16
|
+
* How the value is kept: a check record unless given.
|
|
14
17
|
* @returns {Promise<T>}
|
|
15
18
|
*/
|
|
16
19
|
export function keptFileCheck<T>({ name, cwd, coreDir }: {
|
|
17
20
|
name: string;
|
|
18
21
|
cwd: string;
|
|
19
22
|
coreDir: string | null;
|
|
20
|
-
}, check: () => Promise<T
|
|
23
|
+
}, check: () => Promise<T>, codec?: {
|
|
24
|
+
encode: (value: any) => any;
|
|
25
|
+
decode: (stored: any) => any;
|
|
26
|
+
valid?: (value: any) => boolean;
|
|
27
|
+
}): Promise<T>;
|
|
21
28
|
/**
|
|
22
29
|
* Package written to the generated app record for one discovered theme.
|
|
23
30
|
* @param {import('../../foundation/discovery/theme-discovery.mjs').DiscoveredTheme} theme
|
|
@@ -88,6 +95,16 @@ export function doctorElementPropOrigins(file: string, element: Parameters<typeo
|
|
|
88
95
|
* @returns {Set<string>}
|
|
89
96
|
*/
|
|
90
97
|
export function doctorStylesheetImports(css: string): Set<string>;
|
|
98
|
+
/**
|
|
99
|
+
* The file a local stylesheet `@import` names, from the stylesheet that
|
|
100
|
+
* imports it: a relative path, or a package's file as Node resolves it
|
|
101
|
+
* (`@fontsource/inter/index.css`). Null for a URL (http, https, `//`) or an
|
|
102
|
+
* import that does not resolve.
|
|
103
|
+
* @param {string} specifier
|
|
104
|
+
* @param {string} fromFile
|
|
105
|
+
* @returns {string | null}
|
|
106
|
+
*/
|
|
107
|
+
export function doctorStylesheetImportFile(specifier: string, fromFile: string): string | null;
|
|
91
108
|
/**
|
|
92
109
|
* The `@astryxdesign/core` range a package's peerDependencies declare, and
|
|
93
110
|
* whether it accepts `coreVersion` (spec:AST-017/FR12). The one rule every
|
|
@@ -284,7 +301,13 @@ export function builtIntegrationPackages(target: string, cwd: string): string[];
|
|
|
284
301
|
export { placeholderFixes } from "../../foundation/discovery/template-icons.mjs";
|
|
285
302
|
export { installCommandFor as packageInstallCommand } from "../../foundation/discovery/template-needs.mjs";
|
|
286
303
|
export { resolveRecordedTheme } from "../theme/theme.mjs";
|
|
304
|
+
export { themeIdentifier } from "../theme/_fork.mjs";
|
|
287
305
|
export { collectUnloadedFonts } from "../theme/build/font-warning.mjs";
|
|
306
|
+
export namespace THEME_WIRING_CODEC {
|
|
307
|
+
function encode(value: any): any;
|
|
308
|
+
function decode(value: any): any;
|
|
309
|
+
function valid(value: any): any;
|
|
310
|
+
}
|
|
288
311
|
export const SOURCE_EXTENSIONS: Set<string>;
|
|
289
312
|
export { displayHomePath };
|
|
290
313
|
/** `doctor --built` reads at most this many files, of at most this size. */
|
|
@@ -299,6 +322,5 @@ import { stateLockHolder } from '../../foundation/release/global-state.mjs';
|
|
|
299
322
|
import { displayHomePath } from '../../foundation/agent-docs/computer-agent-text.mjs';
|
|
300
323
|
export { iconUseCommand, unlistedIconSets } from "../../foundation/discovery/icon-set-discovery.mjs";
|
|
301
324
|
export { isLocalThemeOwner, planThemeAppWrite, readThemeState, resolveThemeModule } from "../../foundation/config/theme-state.mjs";
|
|
302
|
-
export {
|
|
303
|
-
export { APP_COPY_MARK, EDITOR_GENERATED_MARK } from "../theme-edit/_marks.mjs";
|
|
325
|
+
export { fileMark, generatedSourceCommand, isPrivateVarRefusal, missingThemePackage, themeBuild, validateThemePrivateInputs } from "../theme/build/build.mjs";
|
|
304
326
|
export { AUTHORING_AUDIT, authoringAudit, authoringAuditData } from "./_authoring-audit.mjs";
|
package/api/doctor/_adapter.mjs
CHANGED
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
} from '../../foundation/agent-docs/computer-agent-text.mjs';
|
|
40
40
|
import {computerAgentTextSettings} from '../../foundation/env/user-settings.mjs';
|
|
41
41
|
import * as fs from 'node:fs';
|
|
42
|
+
import {createRequire} from 'node:module';
|
|
42
43
|
import {placeholderUses} from '../../foundation/discovery/template-icons.mjs';
|
|
43
44
|
export {placeholderFixes} from '../../foundation/discovery/template-icons.mjs';
|
|
44
45
|
export {
|
|
@@ -69,6 +70,7 @@ import {
|
|
|
69
70
|
findProjectCoreDir,
|
|
70
71
|
findInstalledPackage,
|
|
71
72
|
} from '../../foundation/fs/paths.mjs';
|
|
73
|
+
import {compareText} from '../../foundation/text/compare-text.mjs';
|
|
72
74
|
export {
|
|
73
75
|
isLocalThemeOwner,
|
|
74
76
|
planThemeAppWrite,
|
|
@@ -76,15 +78,16 @@ export {
|
|
|
76
78
|
resolveThemeModule,
|
|
77
79
|
} from '../../foundation/config/theme-state.mjs';
|
|
78
80
|
export {
|
|
79
|
-
|
|
81
|
+
fileMark,
|
|
82
|
+
generatedSourceCommand,
|
|
80
83
|
isPrivateVarRefusal,
|
|
81
84
|
missingThemePackage,
|
|
82
85
|
themeBuild,
|
|
83
86
|
validateThemePrivateInputs,
|
|
84
87
|
} from '../theme/build/build.mjs';
|
|
85
|
-
export {APP_COPY_MARK, EDITOR_GENERATED_MARK} from '../theme-edit/_marks.mjs';
|
|
86
88
|
export {installCommandFor as packageInstallCommand} from '../../foundation/discovery/template-needs.mjs';
|
|
87
89
|
export {resolveRecordedTheme} from '../theme/theme.mjs';
|
|
90
|
+
export {themeIdentifier} from '../theme/_fork.mjs';
|
|
88
91
|
export {collectUnloadedFonts} from '../theme/build/font-warning.mjs';
|
|
89
92
|
|
|
90
93
|
// What the authoring-docs check reads (./_authoring-audit.mjs), reached only
|
|
@@ -113,26 +116,57 @@ const CHECK_CODEC = {
|
|
|
113
116
|
* A doctor check that reads only files, kept between runs through the kept
|
|
114
117
|
* gather (foundation/fs/gather-cache.mjs): a later `doctor` with every file,
|
|
115
118
|
* folder, module and environment variable it read unchanged reads the check
|
|
116
|
-
* back. Only the docs checks go through here; a
|
|
117
|
-
* time, the network or anything else the stamps do
|
|
119
|
+
* back. Only the docs checks and the theme-wiring scan go through here; a
|
|
120
|
+
* check that depends on the time, the network or anything else the stamps do
|
|
121
|
+
* not see never does.
|
|
118
122
|
* @template T
|
|
119
123
|
* @param {{name: string, cwd: string, coreDir: string | null}} where - The
|
|
120
124
|
* check, the project folder, and the Core folder the project loads.
|
|
121
125
|
* @param {() => Promise<T>} check
|
|
126
|
+
* @param {{encode: (value: any) => any, decode: (stored: any) => any, valid?: (value: any) => boolean}} [codec]
|
|
127
|
+
* How the value is kept: a check record unless given.
|
|
122
128
|
* @returns {Promise<T>}
|
|
123
129
|
*/
|
|
124
|
-
export function keptFileCheck(
|
|
125
|
-
|
|
126
|
-
|
|
130
|
+
export function keptFileCheck(
|
|
131
|
+
{name, cwd, coreDir},
|
|
132
|
+
check,
|
|
133
|
+
codec = CHECK_CODEC,
|
|
134
|
+
) {
|
|
135
|
+
// Only a recorded run (`doctor` from the bin, with or without `--built`)
|
|
136
|
+
// reads or keeps one: a hosted run names its commands its own way, so it
|
|
137
|
+
// always checks.
|
|
127
138
|
if (!recordedRun()) return check();
|
|
128
139
|
return persistedGather(
|
|
129
140
|
// With the command name the checks print commands with.
|
|
130
141
|
['doctor-check', name, cwd, coreDir, getCliInvocation(cwd)],
|
|
131
142
|
check,
|
|
132
|
-
|
|
143
|
+
codec,
|
|
133
144
|
);
|
|
134
145
|
}
|
|
135
146
|
|
|
147
|
+
/**
|
|
148
|
+
* The theme-wiring scan's result ({@link themeImportWiring}), kept exactly,
|
|
149
|
+
* with its shape.
|
|
150
|
+
*/
|
|
151
|
+
export const THEME_WIRING_CODEC = {
|
|
152
|
+
encode: (/** @type {any} */ value) => value,
|
|
153
|
+
decode: (/** @type {any} */ value) => value,
|
|
154
|
+
valid: (/** @type {any} */ value) =>
|
|
155
|
+
value != null &&
|
|
156
|
+
Array.isArray(value.wired) &&
|
|
157
|
+
Array.isArray(value.unconfirmed) &&
|
|
158
|
+
value.wired.every(
|
|
159
|
+
(/** @type {any} */ w) =>
|
|
160
|
+
w != null &&
|
|
161
|
+
typeof w.slug === 'string' &&
|
|
162
|
+
typeof w.owner === 'string' &&
|
|
163
|
+
typeof w.file === 'string',
|
|
164
|
+
) &&
|
|
165
|
+
value.unconfirmed.every(
|
|
166
|
+
(/** @type {any} */ u) => u != null && typeof u.file === 'string',
|
|
167
|
+
),
|
|
168
|
+
};
|
|
169
|
+
|
|
136
170
|
/**
|
|
137
171
|
* Package written to the generated app record for one discovered theme.
|
|
138
172
|
* @param {import('../../foundation/discovery/theme-discovery.mjs').DiscoveredTheme} theme
|
|
@@ -250,7 +284,7 @@ export function findIconPlaceholders(projectDir) {
|
|
|
250
284
|
uses: uses.length,
|
|
251
285
|
});
|
|
252
286
|
}
|
|
253
|
-
return found.sort((a, b) => a.file
|
|
287
|
+
return found.sort((a, b) => compareText(a.file, b.file));
|
|
254
288
|
}
|
|
255
289
|
|
|
256
290
|
/** @param {string} projectDir */
|
|
@@ -306,6 +340,45 @@ export function doctorStylesheetImports(css) {
|
|
|
306
340
|
return new Set(cssImports(css));
|
|
307
341
|
}
|
|
308
342
|
|
|
343
|
+
/**
|
|
344
|
+
* The file a local stylesheet `@import` names, from the stylesheet that
|
|
345
|
+
* imports it: a relative path, or a package's file as Node resolves it
|
|
346
|
+
* (`@fontsource/inter/index.css`). Null for a URL (http, https, `//`) or an
|
|
347
|
+
* import that does not resolve.
|
|
348
|
+
* @param {string} specifier
|
|
349
|
+
* @param {string} fromFile
|
|
350
|
+
* @returns {string | null}
|
|
351
|
+
*/
|
|
352
|
+
export function doctorStylesheetImportFile(specifier, fromFile) {
|
|
353
|
+
if (/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(specifier)) return null;
|
|
354
|
+
const isFile = (/** @type {string} */ f) => {
|
|
355
|
+
try {
|
|
356
|
+
return fs.statSync(f).isFile();
|
|
357
|
+
} catch {
|
|
358
|
+
return false;
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
// A bare name is a file beside the stylesheet first (`@import
|
|
362
|
+
// "faces.css"`, as a browser reads it), then a package.
|
|
363
|
+
const beside = path.resolve(path.dirname(fromFile), specifier);
|
|
364
|
+
if (isFile(beside)) return beside;
|
|
365
|
+
if (/^\.{1,2}\//.test(specifier)) return null;
|
|
366
|
+
try {
|
|
367
|
+
// Packages resolve from where the stylesheet really is (a linked
|
|
368
|
+
// install, as pnpm makes, keeps its own dependencies there).
|
|
369
|
+
let real = fromFile;
|
|
370
|
+
try {
|
|
371
|
+
real = fs.realpathSync(fromFile);
|
|
372
|
+
} catch {
|
|
373
|
+
real = fromFile;
|
|
374
|
+
}
|
|
375
|
+
const file = createRequire(real).resolve(specifier);
|
|
376
|
+
return isFile(file) ? file : null;
|
|
377
|
+
} catch {
|
|
378
|
+
return null;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
309
382
|
/**
|
|
310
383
|
* The `@astryxdesign/core` range a package's peerDependencies declare, and
|
|
311
384
|
* whether it accepts `coreVersion` (spec:AST-017/FR12). The one rule every
|
|
@@ -725,7 +798,7 @@ export function readBuiltPath(target, {fileLimit = BUILT_FILE_LIMIT} = {}) {
|
|
|
725
798
|
} catch {
|
|
726
799
|
continue;
|
|
727
800
|
}
|
|
728
|
-
entries.sort((a, b) => a.name
|
|
801
|
+
entries.sort((a, b) => compareText(a.name, b.name));
|
|
729
802
|
for (const entry of entries) {
|
|
730
803
|
const full = path.join(dir, entry.name);
|
|
731
804
|
if (entry.isDirectory()) {
|
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
} from './_adapter.mjs';
|
|
32
32
|
import {formatCliCommand} from '../../foundation/env/package-manager.mjs';
|
|
33
33
|
import {babelParse as parseModule} from '../../foundation/runtime/lazy-dependencies.mjs';
|
|
34
|
+
import {compareText} from '../../foundation/text/compare-text.mjs';
|
|
34
35
|
|
|
35
36
|
/** Source files, read for imports and JSX. */
|
|
36
37
|
const SOURCE_EXT = new Set(['.tsx', '.jsx', '.ts', '.js', '.mjs', '.cjs']);
|
|
@@ -71,6 +72,7 @@ function hasJsx(text) {
|
|
|
71
72
|
sourceType: 'unambiguous',
|
|
72
73
|
plugins,
|
|
73
74
|
errorRecovery: true,
|
|
75
|
+
attachComment: false,
|
|
74
76
|
});
|
|
75
77
|
break;
|
|
76
78
|
} catch {
|
|
@@ -254,14 +256,24 @@ let lineCache = {text: null, starts: [0]};
|
|
|
254
256
|
* @param {string} text
|
|
255
257
|
*/
|
|
256
258
|
function withoutComments(text, ext = '', parsed = commentRanges(text, ext)) {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
259
|
+
return parsed ? blankRanges(text, parsed) : scanOutComments(text);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Text with each range blanked, every character but a line break made a
|
|
264
|
+
* space, so every offset and line stays where it was.
|
|
265
|
+
* @param {string} text
|
|
266
|
+
* @param {Array<[number, number]>} ranges in order, none overlapping
|
|
267
|
+
*/
|
|
268
|
+
function blankRanges(text, ranges) {
|
|
269
|
+
let out = '';
|
|
270
|
+
let at = 0;
|
|
271
|
+
for (const [start, end] of ranges) {
|
|
272
|
+
out +=
|
|
273
|
+
text.slice(at, start) + text.slice(start, end).replace(/[^\n]/g, ' ');
|
|
274
|
+
at = end;
|
|
263
275
|
}
|
|
264
|
-
return
|
|
276
|
+
return out + text.slice(at);
|
|
265
277
|
}
|
|
266
278
|
|
|
267
279
|
/**
|
|
@@ -287,6 +299,8 @@ function parseSource(text, ext) {
|
|
|
287
299
|
sourceType: 'unambiguous',
|
|
288
300
|
plugins,
|
|
289
301
|
errorRecovery: true,
|
|
302
|
+
// The checks read the file's list of comments, never a node's.
|
|
303
|
+
attachComment: false,
|
|
290
304
|
});
|
|
291
305
|
} catch {
|
|
292
306
|
// try the next set of syntax plugins
|
|
@@ -311,15 +325,24 @@ function commentRanges(text, ext, ast = parseSource(text, ext)) {
|
|
|
311
325
|
);
|
|
312
326
|
}
|
|
313
327
|
|
|
328
|
+
/**
|
|
329
|
+
* Whether a source can hold a `require()` or `import()` call: the word
|
|
330
|
+
* `require`, `import` followed by a parenthesis or a comment, or a Unicode
|
|
331
|
+
* escape, which can spell `require`. A source with none of these has no such
|
|
332
|
+
* call, so its syntax tree is not walked for one.
|
|
333
|
+
*/
|
|
334
|
+
const MAY_CALL = /\brequire\b|\bimport\s*(?:\(|\/[*/]|<!--|-->)|\\u/;
|
|
335
|
+
|
|
314
336
|
/**
|
|
315
337
|
* The imports a parsed source file makes, read from its syntax tree so that
|
|
316
338
|
* an import written in a string, a template literal or JSX text (a code
|
|
317
339
|
* sample on a page) is not one: import and export-from declarations, and
|
|
318
340
|
* `require()` and `import()` of a string.
|
|
319
341
|
* @param {any} ast
|
|
342
|
+
* @param {string} source the file's text
|
|
320
343
|
* @returns {{spec: string, names: string[], at: number}[]}
|
|
321
344
|
*/
|
|
322
|
-
function astImports(ast) {
|
|
345
|
+
function astImports(ast, source) {
|
|
323
346
|
/** @type {{spec: string, names: string[], at: number}[]} */
|
|
324
347
|
const found = [];
|
|
325
348
|
for (const node of ast.program.body) {
|
|
@@ -354,7 +377,7 @@ function astImports(ast) {
|
|
|
354
377
|
}
|
|
355
378
|
}
|
|
356
379
|
/** @type {any[]} */
|
|
357
|
-
const stack = [ast.program];
|
|
380
|
+
const stack = MAY_CALL.test(source) ? [ast.program] : [];
|
|
358
381
|
while (stack.length > 0) {
|
|
359
382
|
const node = stack.pop();
|
|
360
383
|
if (!node || typeof node.type !== 'string') continue;
|
|
@@ -384,7 +407,8 @@ function astImports(ast) {
|
|
|
384
407
|
* @param {string} text
|
|
385
408
|
*/
|
|
386
409
|
function scanOutComments(text) {
|
|
387
|
-
|
|
410
|
+
/** @type {Array<[number, number]>} */
|
|
411
|
+
const comments = [];
|
|
388
412
|
/** @type {string | null} the quote of the string being read */
|
|
389
413
|
let quote = null;
|
|
390
414
|
for (let i = 0; i < text.length; i++) {
|
|
@@ -405,10 +429,10 @@ function scanOutComments(text) {
|
|
|
405
429
|
next === '/'
|
|
406
430
|
? (text.indexOf('\n', i) + 1 || text.length + 1) - 1
|
|
407
431
|
: (text.indexOf('*/', i + 2) + 1 || text.length - 1) + 1;
|
|
408
|
-
|
|
432
|
+
comments.push([i, end]);
|
|
409
433
|
i = end - 1;
|
|
410
434
|
}
|
|
411
|
-
return
|
|
435
|
+
return blankRanges(text, comments);
|
|
412
436
|
}
|
|
413
437
|
|
|
414
438
|
/**
|
|
@@ -634,7 +658,9 @@ export function scanBuilt(target, packages, {fileLimit} = {}) {
|
|
|
634
658
|
const astryxNames = new Set();
|
|
635
659
|
const iconNames = new Set();
|
|
636
660
|
let fileImports = 0;
|
|
637
|
-
for (const {spec, names, at} of ast
|
|
661
|
+
for (const {spec, names, at} of ast
|
|
662
|
+
? astImports(ast, raw)
|
|
663
|
+
: importsOf(text)) {
|
|
638
664
|
if (isAstryxSpecifier(spec, packages)) {
|
|
639
665
|
fileImports++;
|
|
640
666
|
imported.add(
|
|
@@ -691,7 +717,7 @@ export function scanBuilt(target, packages, {fileLimit} = {}) {
|
|
|
691
717
|
}
|
|
692
718
|
}
|
|
693
719
|
scan.packages = [...imported].sort();
|
|
694
|
-
scan.findings.sort((a, b) => a.file
|
|
720
|
+
scan.findings.sort((a, b) => compareText(a.file, b.file) || a.line - b.line);
|
|
695
721
|
return scan;
|
|
696
722
|
}
|
|
697
723
|
|
package/api/doctor/doctor.d.mts
CHANGED
|
@@ -310,9 +310,10 @@ export function checkComputerIntegrationsAvailable({ installed, candidates, inst
|
|
|
310
310
|
elsewhere?: boolean;
|
|
311
311
|
}): DoctorCheck;
|
|
312
312
|
/**
|
|
313
|
-
* Where `search` and `build` keep their gathered catalog between runs,
|
|
314
|
-
*
|
|
315
|
-
* run
|
|
313
|
+
* Where `search` and `build` keep their gathered catalog between runs, how
|
|
314
|
+
* much it holds, and the most it and jiti's transpile cache hold; and, in a
|
|
315
|
+
* run under Yarn Plug'n'Play's loader, that the run keeps none
|
|
316
|
+
* (runsUnderPnp). Left out of a checkout, which keeps none.
|
|
316
317
|
* @returns {DoctorCheck | null}
|
|
317
318
|
*/
|
|
318
319
|
export function checkGatherCache(): DoctorCheck | null;
|
package/api/doctor/doctor.mjs
CHANGED
|
@@ -101,6 +101,7 @@ import {
|
|
|
101
101
|
} from '../../foundation/agent-docs/computer-agent-text.mjs';
|
|
102
102
|
import {
|
|
103
103
|
keptFileCheck,
|
|
104
|
+
THEME_WIRING_CODEC,
|
|
104
105
|
alignCommand,
|
|
105
106
|
addCliCommandFor,
|
|
106
107
|
computerAgentTextState,
|
|
@@ -2309,9 +2310,10 @@ async function runComputerChecks(cwd) {
|
|
|
2309
2310
|
}
|
|
2310
2311
|
|
|
2311
2312
|
/**
|
|
2312
|
-
* Where `search` and `build` keep their gathered catalog between runs,
|
|
2313
|
-
*
|
|
2314
|
-
* run
|
|
2313
|
+
* Where `search` and `build` keep their gathered catalog between runs, how
|
|
2314
|
+
* much it holds, and the most it and jiti's transpile cache hold; and, in a
|
|
2315
|
+
* run under Yarn Plug'n'Play's loader, that the run keeps none
|
|
2316
|
+
* (runsUnderPnp). Left out of a checkout, which keeps none.
|
|
2315
2317
|
* @returns {DoctorCheck | null}
|
|
2316
2318
|
*/
|
|
2317
2319
|
export function checkGatherCache() {
|
|
@@ -2322,7 +2324,7 @@ export function checkGatherCache() {
|
|
|
2322
2324
|
id: 'gather-cache',
|
|
2323
2325
|
label: 'Kept catalog cache',
|
|
2324
2326
|
status: 'info',
|
|
2325
|
-
message: `search, build, component, template, theme, discover, docs and doctor keep what they gather (search's catalogs, each integration's check results, template discovery's records, integrations' theme records, and doctor's docs checks) in ${summary.dir} (${summary.entries} ${summary.entries === 1 ? 'entry' : 'entries'}, ${size})${summary.pnp ? ", but not in a run under Yarn Plug'n'Play's loader, such as `yarn astryx`, which gathers every time" : ''}; each is used only while nothing it read has changed, and deleting the folder clears it.`,
|
|
2327
|
+
message: `search, build, component, template, theme, discover, docs and doctor keep what they gather (search's catalogs, each integration's check results, template discovery's records, the component list, integrations' theme records, the docs not-found hint's name summaries, the CLI's own docs tree, and doctor's docs checks and theme-wiring scan) in ${summary.dir} (${summary.entries} ${summary.entries === 1 ? 'entry' : 'entries'}, ${size})${summary.pnp ? ", but not in a run under Yarn Plug'n'Play's loader, such as `yarn astryx`, which gathers every time" : ''}; each is used only while nothing it read has changed, and deleting the folder clears it. The folder holds at most ${summary.limitBytes / (1024 * 1024)} MB and removes its oldest entries first, as does the transpile cache in ${summary.jitiDir}, which keeps every copy written in the last day, or read in the last day where the file system records reads.`,
|
|
2326
2328
|
};
|
|
2327
2329
|
}
|
|
2328
2330
|
|
|
@@ -2555,10 +2557,15 @@ export async function runChecks(options = {}) {
|
|
|
2555
2557
|
if (check) checks.push(check);
|
|
2556
2558
|
if (fn === checkVersionAlignment) {
|
|
2557
2559
|
const appThemeChecks = await checkAppThemes(cwd);
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2560
|
+
// The wiring scan reads only files and modules (the app's source, the
|
|
2561
|
+
// themes and the packages that declare them) and runs nothing, so it is
|
|
2562
|
+
// kept like the docs checks.
|
|
2563
|
+
const wiring = await keptFileCheck(
|
|
2564
|
+
{name: 'theme-wiring', cwd, coreDir: coreDir ?? null},
|
|
2565
|
+
() => themeImportWiring(cwd),
|
|
2566
|
+
THEME_WIRING_CODEC,
|
|
2561
2567
|
);
|
|
2568
|
+
checks.push(checkThemes(cwd, appThemeChecks, wiring), ...appThemeChecks);
|
|
2562
2569
|
checks.push(await checkConfig(ctx));
|
|
2563
2570
|
}
|
|
2564
2571
|
}
|