@astryxdesign/cli 0.7.16 → 0.7.17-canary.g335a172
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.mjs +69 -16
- package/api/build/kit/start.d.mts +5 -4
- package/api/build/kit/start.mjs +12 -8
- package/api/build/kit/weights.d.mts +16 -3
- package/api/build/kit/weights.json +1 -1
- package/api/build/kit/weights.mjs +251 -35
- 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 +26 -2
- package/api/docs/_adapter.mjs +219 -6
- 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/_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 +60 -0
- package/api/theme/build/build.mjs +210 -54
- package/api/theme/build/font-warning.d.mts +8 -0
- package/api/theme/build/font-warning.mjs +19 -0
- package/api/theme/theme.type.d.mts +10 -0
- package/api/theme/theme.type.mjs +7 -1
- package/api/theme-edit/_adapter.d.mts +55 -0
- package/api/theme-edit/_adapter.mjs +673 -42
- package/api/theme-edit/_check.d.mts +28 -22
- package/api/theme-edit/_check.mjs +1858 -312
- package/api/theme-edit/_color.d.mts +10 -0
- package/api/theme-edit/_color.mjs +49 -1
- package/api/theme-edit/_compiler.mjs +9 -0
- package/api/theme-edit/_context.mjs +60 -3
- package/api/theme-edit/_css.mjs +21 -1
- package/api/theme-edit/_edit.d.mts +22 -0
- package/api/theme-edit/_edit.mjs +1533 -92
- package/api/theme-edit/_how-commands.d.mts +57 -0
- package/api/theme-edit/_how-commands.mjs +587 -1
- package/api/theme-edit/_how-question.d.mts +78 -0
- package/api/theme-edit/_how-question.mjs +4716 -235
- package/api/theme-edit/_how.mjs +134 -8
- package/api/theme-edit/_marks.d.mts +31 -5
- package/api/theme-edit/_marks.mjs +57 -5
- package/api/theme-edit/_normal.d.mts +219 -0
- package/api/theme-edit/_normal.mjs +1041 -0
- package/api/theme-edit/_palette.mjs +10 -4
- package/api/theme-edit/_parts.d.mts +8 -0
- package/api/theme-edit/_parts.mjs +103 -2
- package/api/theme-edit/_playwright-picture.d.mts +4 -0
- package/api/theme-edit/_playwright-picture.mjs +34 -0
- package/api/theme-edit/_preview-app.d.mts +7 -1
- package/api/theme-edit/_preview-app.mjs +394 -74
- package/api/theme-edit/_preview.d.mts +69 -8
- package/api/theme-edit/_preview.mjs +531 -108
- package/api/theme-edit/_settings.d.mts +243 -6
- package/api/theme-edit/_settings.mjs +2415 -147
- package/api/theme-edit/_tables.d.mts +6 -0
- package/api/theme-edit/_tables.mjs +44 -1
- package/api/theme-edit/_vet.d.mts +18 -0
- package/api/theme-edit/_vet.mjs +32 -0
- package/api/theme-edit/theme-edit.type.d.mts +10 -1
- package/api/theme-edit/theme-edit.type.mjs +4 -1
- package/api/theme-edit/themeEditHow.doc.mjs +1 -1
- package/api/theme-edit/themeEditNew.doc.mjs +1 -1
- 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/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/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 +2 -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 +145 -16
- 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 +2 -2
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +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/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 +183 -6
- 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 +77 -21
- 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/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-self-audit.d.mts +26 -10
- package/foundation/discovery/stored-self-audit.mjs +38 -18
- package/foundation/discovery/template-adapter.d.mts +52 -0
- package/foundation/discovery/template-adapter.mjs +176 -12
- package/foundation/discovery/template-icons.mjs +2 -1
- package/foundation/discovery/theme-discovery.mjs +3 -2
- package/foundation/discovery/theme-imports.d.mts +14 -0
- package/foundation/discovery/theme-imports.mjs +43 -1
- package/foundation/discovery/theming-targets.mjs +3 -2
- 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 +31 -0
- package/foundation/fonts/font-stylesheet.mjs +115 -0
- package/foundation/fs/cache-eviction.d.mts +21 -0
- package/foundation/fs/cache-eviction.mjs +73 -0
- package/foundation/fs/file-protection.mjs +4 -3
- package/foundation/fs/gather-cache.d.mts +25 -4
- package/foundation/fs/gather-cache.mjs +164 -55
- 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/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/rebuild.mjs +2 -1
- package/foundation/render/render-page.d.mts +35 -3
- package/foundation/render/render-page.mjs +316 -42
- 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/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
|
@@ -66,6 +66,50 @@ export function integrationDocCommands(integration: any): Promise<import("../../
|
|
|
66
66
|
* @returns {Promise<boolean>}
|
|
67
67
|
*/
|
|
68
68
|
export function projectUsesIconSets(cwd: string): Promise<boolean>;
|
|
69
|
+
/**
|
|
70
|
+
* @typedef {object} LoadedExampleScope
|
|
71
|
+
* @property {boolean} found whether an integration manifest loaded
|
|
72
|
+
* @property {string | null} name
|
|
73
|
+
* @property {string | null} version
|
|
74
|
+
* @property {import('../../authoring/example/type.ts').ExampleScope | null} scope
|
|
75
|
+
* @property {string} [reason] why there is no scope
|
|
76
|
+
* @property {string} [incomplete] why names Core or React give were not read
|
|
77
|
+
*/
|
|
78
|
+
/**
|
|
79
|
+
* The scope a package's component examples are read against: the local
|
|
80
|
+
* package rooted at `cwd` (no `pkg`), or a package installed beside it.
|
|
81
|
+
* Throws when `pkg` is not a bare package name.
|
|
82
|
+
* @param {string | undefined} pkg
|
|
83
|
+
* @param {string} cwd
|
|
84
|
+
* @returns {Promise<LoadedExampleScope>}
|
|
85
|
+
*/
|
|
86
|
+
export function loadExampleScope(pkg: string | undefined, cwd: string): Promise<LoadedExampleScope>;
|
|
87
|
+
/**
|
|
88
|
+
* Each of the package's component examples that cannot run on its own, as a
|
|
89
|
+
* note with its fix, and the examples that could not be judged.
|
|
90
|
+
* @param {any} integration a loaded integration
|
|
91
|
+
*/
|
|
92
|
+
export function integrationExampleCode(integration: any): Promise<{
|
|
93
|
+
notes: ExampleCodeNote[];
|
|
94
|
+
unchecked: ExampleCodeUnchecked[];
|
|
95
|
+
}>;
|
|
96
|
+
export type LoadedExampleScope = {
|
|
97
|
+
/**
|
|
98
|
+
* whether an integration manifest loaded
|
|
99
|
+
*/
|
|
100
|
+
found: boolean;
|
|
101
|
+
name: string | null;
|
|
102
|
+
version: string | null;
|
|
103
|
+
scope: import("../../authoring/example/type.ts").ExampleScope | null;
|
|
104
|
+
/**
|
|
105
|
+
* why there is no scope
|
|
106
|
+
*/
|
|
107
|
+
reason?: string | undefined;
|
|
108
|
+
/**
|
|
109
|
+
* why names Core or React give were not read
|
|
110
|
+
*/
|
|
111
|
+
incomplete?: string | undefined;
|
|
112
|
+
};
|
|
69
113
|
import { findCopiedPassages } from '../../foundation/discovery/copied-passages.mjs';
|
|
70
114
|
import { findFluff } from '../../foundation/discovery/doc-fluff.mjs';
|
|
71
115
|
import { findStrayPointers } from '../../foundation/discovery/stray-pointers.mjs';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @file The integration subject's access to the environment (INV21): reading
|
|
5
5
|
* one package's component docs and sources with the project's own TypeScript,
|
|
6
|
-
* and its
|
|
6
|
+
* its topics, and the scope its examples are read against.
|
|
7
7
|
*
|
|
8
8
|
* @input a loaded integration and the directory the command runs in
|
|
9
9
|
* @output the reports the integration checks attach to their results
|
|
@@ -23,6 +23,15 @@ import {findCopiedPassages} from '../../foundation/discovery/copied-passages.mjs
|
|
|
23
23
|
import {findFluff} from '../../foundation/discovery/doc-fluff.mjs';
|
|
24
24
|
import {findDocCommands} from '../../foundation/discovery/runner-commands.mjs';
|
|
25
25
|
import {findStrayPointers} from '../../foundation/discovery/stray-pointers.mjs';
|
|
26
|
+
import {findPackageRoot} from '../../foundation/fs/paths.mjs';
|
|
27
|
+
import {
|
|
28
|
+
loadLocalIntegration,
|
|
29
|
+
resolveInstalledIntegrationDir,
|
|
30
|
+
} from '../../foundation/integrations/integrations.mjs';
|
|
31
|
+
import {
|
|
32
|
+
exampleCodeCheck,
|
|
33
|
+
exampleScopeFor,
|
|
34
|
+
} from '../../foundation/integrations/example-code.mjs';
|
|
26
35
|
|
|
27
36
|
/**
|
|
28
37
|
* Each component doc's props compared with the component's TypeScript props,
|
|
@@ -174,3 +183,70 @@ export async function projectUsesIconSets(cwd) {
|
|
|
174
183
|
return false;
|
|
175
184
|
}
|
|
176
185
|
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* @typedef {object} LoadedExampleScope
|
|
189
|
+
* @property {boolean} found whether an integration manifest loaded
|
|
190
|
+
* @property {string | null} name
|
|
191
|
+
* @property {string | null} version
|
|
192
|
+
* @property {import('../../authoring/example/type.ts').ExampleScope | null} scope
|
|
193
|
+
* @property {string} [reason] why there is no scope
|
|
194
|
+
* @property {string} [incomplete] why names Core or React give were not read
|
|
195
|
+
*/
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* The scope a package's component examples are read against: the local
|
|
199
|
+
* package rooted at `cwd` (no `pkg`), or a package installed beside it.
|
|
200
|
+
* Throws when `pkg` is not a bare package name.
|
|
201
|
+
* @param {string | undefined} pkg
|
|
202
|
+
* @param {string} cwd
|
|
203
|
+
* @returns {Promise<LoadedExampleScope>}
|
|
204
|
+
*/
|
|
205
|
+
export async function loadExampleScope(pkg, cwd) {
|
|
206
|
+
const packageDir = pkg
|
|
207
|
+
? resolveInstalledIntegrationDir(pkg, cwd)
|
|
208
|
+
: findPackageRoot(cwd);
|
|
209
|
+
/** @type {any} */
|
|
210
|
+
let integration = null;
|
|
211
|
+
/** @type {string | undefined} */
|
|
212
|
+
let reason;
|
|
213
|
+
if (packageDir) {
|
|
214
|
+
try {
|
|
215
|
+
integration = await loadLocalIntegration(packageDir);
|
|
216
|
+
} catch (err) {
|
|
217
|
+
reason = /** @type {Error} */ (err).message;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
if (integration?.__loadError) reason = integration.__loadError;
|
|
221
|
+
if (!integration || reason) {
|
|
222
|
+
return {
|
|
223
|
+
found: false,
|
|
224
|
+
name: integration?.name ?? null,
|
|
225
|
+
version: integration?.version ?? null,
|
|
226
|
+
scope: null,
|
|
227
|
+
reason:
|
|
228
|
+
reason ??
|
|
229
|
+
(packageDir
|
|
230
|
+
? `No astryx.integration.{ts,mjs,js} next to the package.json in ${packageDir}.`
|
|
231
|
+
: 'No package.json found.'),
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
const read = await exampleScopeFor(integration);
|
|
235
|
+
return {
|
|
236
|
+
found: true,
|
|
237
|
+
name: integration.name ?? null,
|
|
238
|
+
version: integration.version ?? null,
|
|
239
|
+
scope: read.scope,
|
|
240
|
+
...(read.reason ? {reason: read.reason} : {}),
|
|
241
|
+
...(read.incomplete ? {incomplete: read.incomplete} : {}),
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Each of the package's component examples that cannot run on its own, as a
|
|
247
|
+
* note with its fix, and the examples that could not be judged.
|
|
248
|
+
* @param {any} integration a loaded integration
|
|
249
|
+
*/
|
|
250
|
+
export function integrationExampleCode(integration) {
|
|
251
|
+
return exampleCodeCheck(integration);
|
|
252
|
+
}
|
|
@@ -58,6 +58,7 @@ import {
|
|
|
58
58
|
import {rootProblem} from '../../foundation/integrations/validate-contributions.mjs';
|
|
59
59
|
import {normalizeProviderId} from '../../foundation/identity/provider-identity.mjs';
|
|
60
60
|
import {shellArg} from '../../foundation/text/shell-arg.mjs';
|
|
61
|
+
import {compareText} from '../../foundation/text/compare-text.mjs';
|
|
61
62
|
|
|
62
63
|
/**
|
|
63
64
|
* The provider ID a package without a name is checked under: a valid bare
|
|
@@ -215,7 +216,7 @@ async function templateConflicts(pkg, options) {
|
|
|
215
216
|
}
|
|
216
217
|
for (const matches of coreById.values()) {
|
|
217
218
|
matches.sort((a, b) =>
|
|
218
|
-
`${a.type}:${a.name}
|
|
219
|
+
compareText(`${a.type}:${a.name}`, `${b.type}:${b.name}`),
|
|
219
220
|
);
|
|
220
221
|
}
|
|
221
222
|
|
|
@@ -279,7 +280,8 @@ async function templateConflicts(pkg, options) {
|
|
|
279
280
|
}
|
|
280
281
|
}
|
|
281
282
|
conflicts.sort((a, b) =>
|
|
282
|
-
|
|
283
|
+
compareText(
|
|
284
|
+
`${a.id}:${'relationship' in a ? a.relationship : ''}`,
|
|
283
285
|
`${b.id}:${'relationship' in b ? b.relationship : ''}`,
|
|
284
286
|
),
|
|
285
287
|
);
|
|
@@ -388,7 +390,7 @@ async function componentConflicts(pkg, options) {
|
|
|
388
390
|
'If you keep it, always select it with --package.',
|
|
389
391
|
command: `${run} component ${shellArg(component.name)} --package ${shellArg(name)}`,
|
|
390
392
|
}))
|
|
391
|
-
.sort((a, b) => a.name
|
|
393
|
+
.sort((a, b) => compareText(a.name, b.name));
|
|
392
394
|
|
|
393
395
|
return {
|
|
394
396
|
type: 'integration.component-conflicts',
|
|
@@ -561,9 +563,7 @@ async function docConflicts(pkg, options) {
|
|
|
561
563
|
}
|
|
562
564
|
}
|
|
563
565
|
findings.sort((a, b) =>
|
|
564
|
-
`${a.topic}:${a.relationship}
|
|
565
|
-
`${b.topic}:${b.relationship}`,
|
|
566
|
-
),
|
|
566
|
+
compareText(`${a.topic}:${a.relationship}`, `${b.topic}:${b.relationship}`),
|
|
567
567
|
);
|
|
568
568
|
|
|
569
569
|
// The same graph checks `astryx doctor` runs in a project: the namespaces
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
|
+
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The scope a package's component examples are read against: the components
|
|
6
|
+
* it documents with their imports, the components and hooks Core documents,
|
|
7
|
+
* React's exports, the packages it declares, and its server-only modules and
|
|
8
|
+
* async components. `found` is false when no integration manifest loads.
|
|
9
|
+
*
|
|
10
|
+
* @param {string} [pkg] installed package name; omit for the package at cwd
|
|
11
|
+
* @param {import('./example-scope.type.mjs').IntegrationExampleScopeOptions} [options]
|
|
12
|
+
* @returns {Promise<import('./example-scope.type.mjs').IntegrationExampleScopeResponse>}
|
|
13
|
+
*/
|
|
14
|
+
export function integrationExampleScope(pkg?: string, options?: import("./example-scope.type.mjs").IntegrationExampleScopeOptions): Promise<import("./example-scope.type.mjs").IntegrationExampleScopeResponse>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file `integrationExampleScope()`: the scope Doctor reads a package's
|
|
5
|
+
* component examples against, as JSON a catalog can store.
|
|
6
|
+
* @input A package: the local one rooted at `cwd`, or one installed beside
|
|
7
|
+
* it by name.
|
|
8
|
+
* @output An `integration.example-scope` envelope: the package's identity and
|
|
9
|
+
* its ExampleScope, or why there is none.
|
|
10
|
+
* @position api/integration; the subject's adapter builds the scope with
|
|
11
|
+
* the `exampleScopeFor` that `validateIntegration` runs, so a preview tool
|
|
12
|
+
* that reads examples with it and `previewableExample` judges each one as
|
|
13
|
+
* Doctor does.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import {loadExampleScope} from './_adapter.mjs';
|
|
17
|
+
import {AstryxError} from '../error.mjs';
|
|
18
|
+
import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
|
|
19
|
+
|
|
20
|
+
const TYPE = /** @type {const} */ ('integration.example-scope');
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The scope a package's component examples are read against: the components
|
|
24
|
+
* it documents with their imports, the components and hooks Core documents,
|
|
25
|
+
* React's exports, the packages it declares, and its server-only modules and
|
|
26
|
+
* async components. `found` is false when no integration manifest loads.
|
|
27
|
+
*
|
|
28
|
+
* @param {string} [pkg] installed package name; omit for the package at cwd
|
|
29
|
+
* @param {import('./example-scope.type.mjs').IntegrationExampleScopeOptions} [options]
|
|
30
|
+
* @returns {Promise<import('./example-scope.type.mjs').IntegrationExampleScopeResponse>}
|
|
31
|
+
*/
|
|
32
|
+
export async function integrationExampleScope(pkg, options = {}) {
|
|
33
|
+
const {cwd = process.cwd()} = options;
|
|
34
|
+
try {
|
|
35
|
+
return {type: TYPE, data: await loadExampleScope(pkg, cwd)};
|
|
36
|
+
} catch (err) {
|
|
37
|
+
if (!pkg) throw err;
|
|
38
|
+
throw new AstryxError(
|
|
39
|
+
/** @type {Error} */ (err).message,
|
|
40
|
+
[],
|
|
41
|
+
ERROR_CODES.ERR_INVALID_ARGUMENT,
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
|
+
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Options for `integrationExampleScope()`.
|
|
6
|
+
*/
|
|
7
|
+
export type IntegrationExampleScopeOptions = {
|
|
8
|
+
/**
|
|
9
|
+
* the folder the local package or `node_modules` is
|
|
10
|
+
* found from
|
|
11
|
+
*/
|
|
12
|
+
cwd?: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The scope a package's component examples are read against, as JSON. The
|
|
16
|
+
* shape is a contract: a release may add a field, and never renames, removes
|
|
17
|
+
* or retypes one, so a stored scope stays readable.
|
|
18
|
+
*/
|
|
19
|
+
export type IntegrationExampleScopeResponse = {
|
|
20
|
+
type: "integration.example-scope";
|
|
21
|
+
data: {
|
|
22
|
+
found: boolean;
|
|
23
|
+
name: string | null;
|
|
24
|
+
version: string | null;
|
|
25
|
+
scope: import("../../authoring/example/type.ts").ExampleScope | null;
|
|
26
|
+
reason?: string;
|
|
27
|
+
incomplete?: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file Colocated types for `integrationExampleScope()`, the scope a
|
|
5
|
+
* package's component examples are read against. `ExampleScope` itself is the
|
|
6
|
+
* authoring contract in `authoring/example/type.ts`.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Options for `integrationExampleScope()`.
|
|
11
|
+
* @typedef {object} IntegrationExampleScopeOptions
|
|
12
|
+
* @property {string} [cwd] the folder the local package or `node_modules` is
|
|
13
|
+
* found from
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The scope a package's component examples are read against, as JSON. The
|
|
18
|
+
* shape is a contract: a release may add a field, and never renames, removes
|
|
19
|
+
* or retypes one, so a stored scope stays readable.
|
|
20
|
+
* @typedef {object} IntegrationExampleScopeResponse
|
|
21
|
+
* @property {'integration.example-scope'} type
|
|
22
|
+
* @property {{found: boolean, name: string | null, version: string | null, scope: import('../../authoring/example/type.ts').ExampleScope | null, reason?: string, incomplete?: string}} data
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
|
+
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @file FunctionDoc for `integrationExampleScope()`. Colocated with the API
|
|
6
|
+
* function it documents; the shape source of truth stays in
|
|
7
|
+
* `example-scope.type.mjs` and `authoring/example/type.ts`.
|
|
8
|
+
* @position packages/cli/api/integration — function documentation
|
|
9
|
+
*/
|
|
10
|
+
/** @type {import('@astryxdesign/cli/authoring').FunctionDoc} */
|
|
11
|
+
export const doc: import("@astryxdesign/cli/authoring").FunctionDoc;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file FunctionDoc for `integrationExampleScope()`. Colocated with the API
|
|
5
|
+
* function it documents; the shape source of truth stays in
|
|
6
|
+
* `example-scope.type.mjs` and `authoring/example/type.ts`.
|
|
7
|
+
* @position packages/cli/api/integration — function documentation
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** @type {import('@astryxdesign/cli/authoring').FunctionDoc} */
|
|
11
|
+
export const doc = {
|
|
12
|
+
type: 'function',
|
|
13
|
+
kind: 'api',
|
|
14
|
+
name: 'integrationExampleScope',
|
|
15
|
+
namespace: 'cli/api',
|
|
16
|
+
displayName: 'integrationExampleScope()',
|
|
17
|
+
summary:
|
|
18
|
+
"The scope Doctor reads a package's component examples against, as JSON.",
|
|
19
|
+
description:
|
|
20
|
+
"Builds the ExampleScope `validateIntegration` reads a package's component examples against: the components the package documents, each with the import an app uses for it; the components and hooks the Core installed beside it documents; the exports of the React it resolves; the packages its package.json declares in `dependencies`, `peerDependencies` and `optionalDependencies`; its own import specifiers whose module imports `server-only`; and its async components. The scope is plain JSON, so a catalog can store it beside the package, and a preview tool that reads each example with it and `previewableExample` from `@astryxdesign/cli/authoring` judges each example as Doctor does. It reads the local package rooted at cwd (no `pkg`), or a package installed beside cwd (`pkg` given). It loads the package's doc modules, as Doctor does.",
|
|
21
|
+
importPath: '@astryxdesign/cli/api',
|
|
22
|
+
signature:
|
|
23
|
+
'integrationExampleScope(pkg?: string, options?: IntegrationExampleScopeOptions): Promise<IntegrationExampleScopeResponse>',
|
|
24
|
+
keywords: [
|
|
25
|
+
'integration',
|
|
26
|
+
'example',
|
|
27
|
+
'preview',
|
|
28
|
+
'scope',
|
|
29
|
+
'previewable',
|
|
30
|
+
'catalog',
|
|
31
|
+
],
|
|
32
|
+
params: [
|
|
33
|
+
{
|
|
34
|
+
name: 'pkg',
|
|
35
|
+
type: 'string',
|
|
36
|
+
description:
|
|
37
|
+
'Installed package name; omit for the package rooted at cwd.',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'options.cwd',
|
|
41
|
+
type: 'string',
|
|
42
|
+
description: 'Folder the local package or `node_modules` is found from.',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
returns: [
|
|
46
|
+
{
|
|
47
|
+
type: 'integration.example-scope',
|
|
48
|
+
description:
|
|
49
|
+
'The envelope: `data.found` (false when no integration manifest loads, and then `data.reason` says why), `data.name` and `data.version` of the package, and `data.scope`: the ExampleScope ({packageName, packageNames: [{name, import}], coreNames: [{name, import}], reactNames, dependencies, serverOnlyModules, serverComponents}), or null with `data.reason` when package.json has no name. `data.incomplete` says why the names Core or React give could not be read: the scope then lists none of them, so a reader must not report a name the scope leaves out. This JSON shape is a contract, so a stored scope stays readable: a release may add a field, and never renames, removes or retypes one.',
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
examples: [
|
|
53
|
+
{
|
|
54
|
+
label: 'Read examples as Doctor does',
|
|
55
|
+
code: "import {integrationExampleScope} from '@astryxdesign/cli/api';\nimport {previewableExample} from '@astryxdesign/cli/authoring';\n\nconst {data} = await integrationExampleScope('@acme/widgets');\nconst read = previewableExample(example, data.scope);",
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
related: ['validateIntegration'],
|
|
59
|
+
};
|
|
@@ -50,6 +50,7 @@ import {integrationDocConsistency} from '../../foundation/discovery/doc-consiste
|
|
|
50
50
|
import {
|
|
51
51
|
integrationDocCommands,
|
|
52
52
|
integrationDocTargets,
|
|
53
|
+
integrationExampleCode,
|
|
53
54
|
projectUsesIconSets,
|
|
54
55
|
} from './_adapter.mjs';
|
|
55
56
|
import {
|
|
@@ -89,6 +90,7 @@ import {formatCliCommand} from '../../foundation/env/package-manager.mjs';
|
|
|
89
90
|
import {cliPeerVersionProblem} from '../../foundation/integrations/cli-peer-version.mjs';
|
|
90
91
|
import {publicImportIssues} from '../../foundation/integrations/public-imports.mjs';
|
|
91
92
|
import {runChoice} from '../../foundation/release/run-context.mjs';
|
|
93
|
+
import {compareText} from '../../foundation/text/compare-text.mjs';
|
|
92
94
|
|
|
93
95
|
/** The running CLI is outside the package's `@astryxdesign/cli` peer range. */
|
|
94
96
|
const CLI_PEER_VERSION = 'cli_peer_version';
|
|
@@ -254,7 +256,7 @@ async function findUnreachableContributionIssues(
|
|
|
254
256
|
try {
|
|
255
257
|
entries = fs
|
|
256
258
|
.readdirSync(dir, {withFileTypes: true})
|
|
257
|
-
.sort((a, b) => a.name
|
|
259
|
+
.sort((a, b) => compareText(a.name, b.name));
|
|
258
260
|
} catch (err) {
|
|
259
261
|
// One folder the user running astryx cannot read must not end the whole
|
|
260
262
|
// validation: name it and keep checking the rest of the package.
|
|
@@ -891,6 +893,11 @@ export async function validateIntegration(pkg, options = {}) {
|
|
|
891
893
|
const examples = integration
|
|
892
894
|
? await componentExamplesCheck(integration)
|
|
893
895
|
: undefined;
|
|
896
|
+
// Component doc examples that are not `kind: 'setup'` but cannot run on
|
|
897
|
+
// their own, by the rule a live preview uses.
|
|
898
|
+
const exampleCode = integration
|
|
899
|
+
? await integrationExampleCode(integration)
|
|
900
|
+
: undefined;
|
|
894
901
|
// What a catalog needs to list the package: a logo, and an example of
|
|
895
902
|
// its components.
|
|
896
903
|
const listing = integration
|
|
@@ -920,6 +927,7 @@ export async function validateIntegration(pkg, options = {}) {
|
|
|
920
927
|
each.notes.map(note => ({...note, next: true})),
|
|
921
928
|
),
|
|
922
929
|
...(examples?.notes ?? []).map(note => ({...note, next: true})),
|
|
930
|
+
...(exampleCode?.notes ?? []).map(note => ({...note, next: true})),
|
|
923
931
|
// What a catalog needs to list the package is information only:
|
|
924
932
|
// these notes fail no check, under any flag.
|
|
925
933
|
...(listing?.notes ?? []),
|
|
@@ -995,6 +1003,16 @@ export async function validateIntegration(pkg, options = {}) {
|
|
|
995
1003
|
...(result.found && result.publicImports
|
|
996
1004
|
? {publicImports: result.publicImports}
|
|
997
1005
|
: {}),
|
|
1006
|
+
// Examples whose names could not be judged, when there are any.
|
|
1007
|
+
...(exampleCode && exampleCode.unchecked.length > 0
|
|
1008
|
+
? {
|
|
1009
|
+
exampleCode: {
|
|
1010
|
+
status: 'checked',
|
|
1011
|
+
findings: [],
|
|
1012
|
+
unchecked: exampleCode.unchecked,
|
|
1013
|
+
},
|
|
1014
|
+
}
|
|
1015
|
+
: {}),
|
|
998
1016
|
},
|
|
999
1017
|
};
|
|
1000
1018
|
}
|
|
@@ -92,6 +92,15 @@ export type ValidateIntegrationResponse = {
|
|
|
92
92
|
}>;
|
|
93
93
|
};
|
|
94
94
|
publicImports?: PublicImportsReport;
|
|
95
|
+
exampleCode?: {
|
|
96
|
+
status: "checked";
|
|
97
|
+
findings: [];
|
|
98
|
+
unchecked: Array<{
|
|
99
|
+
file: string;
|
|
100
|
+
example: string;
|
|
101
|
+
reason: string;
|
|
102
|
+
}>;
|
|
103
|
+
};
|
|
95
104
|
templateIcons?: {
|
|
96
105
|
status: "checked";
|
|
97
106
|
findings: [];
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
* "healthy" — the two are otherwise byte-identical.
|
|
40
40
|
* @typedef {object} ValidateIntegrationResponse
|
|
41
41
|
* @property {'integration.validate'} type
|
|
42
|
-
* @property {{validated: boolean, name: string | null, version: string | null, issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[], notes?: Array<{code: string, message: string, next?: boolean}>, docTypes?: DocTypesReport, docNames?: DocNamesReport, blockComponents?: BlockComponentsReport, exampleAssets?: {status: 'checked', findings: [], unchecked: Array<{file: string, asset: string, reason: string}>}, publicImports?: PublicImportsReport, templateIcons?: {status: 'checked', findings: [], unchecked: Array<{file: string, icon: string, module: string, reason: string}>}, iconSets?: IconSetCoverage[], olderCliNotes?: OlderCliNote[]}} data
|
|
42
|
+
* @property {{validated: boolean, name: string | null, version: string | null, issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[], notes?: Array<{code: string, message: string, next?: boolean}>, docTypes?: DocTypesReport, docNames?: DocNamesReport, blockComponents?: BlockComponentsReport, exampleAssets?: {status: 'checked', findings: [], unchecked: Array<{file: string, asset: string, reason: string}>}, publicImports?: PublicImportsReport, exampleCode?: {status: 'checked', findings: [], unchecked: Array<{file: string, example: string, reason: string}>}, templateIcons?: {status: 'checked', findings: [], unchecked: Array<{file: string, icon: string, module: string, reason: string}>}, iconSets?: IconSetCoverage[], olderCliNotes?: OlderCliNote[]}} data
|
|
43
43
|
* `iconSets` is experimental: it may change or be removed in a patch
|
|
44
44
|
* release.
|
|
45
45
|
* `notes`: information beside the issues. A note fails nothing by default;
|
|
@@ -62,7 +62,7 @@ export const doc = {
|
|
|
62
62
|
{
|
|
63
63
|
type: 'integration.validate',
|
|
64
64
|
description:
|
|
65
|
-
"The result envelope: `data.validated`, false when nothing was validated — with no `package.json` at all, `data.issues` carries one `no_package` error-severity issue so the command exits 1; with a `package.json` but no integration manifest, `data.issues` is empty, which means \"not looked at\", not \"healthy\"; `data.name` and `data.version` of the validated package (both null when `data.validated` is false; `data.name` is `(local package)` when the local package.json has no readable name), plus `data.issues`, an AstryxIntegrationIssue[] of {code, severity: `warning` | `error`, message, fix?, file?, line?}: `fix` is the change that resolves the issue, and `file` and `line` where it is, relative to the package, when the check knows them; and `data.notes` when there are any: {code, message, next?} information beside the issues; a note fails nothing by default, and one with `next: true` counts as a warning under `integration check --next`, fails `integration check --strict --next`, and fails `--strict` from the next minor release. Notes include `invalid_cli_command` for a `cliCommand` that was ignored as malformed and `cli_peer_version` when the running CLI is outside the `@astryxdesign/cli` peer range of the package, and the package layout findings added after the last minor release, each with its fix in the message: `duplicate_component_doc`, `symlinked_root`, `unreadable_file`, `invalid_package_json` (no `name` or `version`), `no_provider_id`, and `source_without_component_doc` for a doc whose file name differs from its source only in letter case where the two still pair; and `doc_name_mismatch` and `unknown_block_component` (see `docNames` and `blockComponents`); they become warnings in the next minor release. For the commands a topic writes, `runner_command` (written with a package runner), `plain_command` (written bare), `package_manager_command` (written for one package manager) and `doc_token` (a token that does not parse) notes each give the file, line and the token to write. A `doc_target_not_found` note names a doc whose `replaces` or `extends` names no topic and no guide of the CLI's docs or the package's own (such as a namespace, with the guides below it), so it changes nothing unless an app also installs a package that provides it, and a `doc_section_unplaced` note a section whose `before` or `after` names no section of the topic or guide it extends, so it is added at the end, and a `duplicate_guide_replacement` note two docs of the package that replace one guide, of which only the last is read; they become warnings in the next minor release. When the manifest loads, `data.docTypes` holds the doc type check: `status` (`checked` | `skipped`), `reason` when skipped, `typescript`, `docs` (doc values checked), `findings` ({doc, line, export, type, field, problem: `unknown_field` | `missing_field` | `wrong_type`, severity: `warning`, message, fix}), `unchecked` ({doc, reason}: a doc that could not be fully checked, or a root its reader cannot read), and `fixtures` when the components or docs root holds test fixture docs under `__tests__`: how many, none of them checked. When the manifest loads, `data.docNames` lists the component doc names it could not judge: `status` (`checked`), `findings` (always empty; a doc name the module its import names provably does not export is a `doc_name_mismatch` note, with its fix in the message) and `unchecked` ({file, name, reason}: a doc whose `name` differs from the name it is listed under and whose source exports cannot all be read, such as a re-export from another package). When the manifest loads, `data.blockComponents` lists the component names templates give in `exampleFor` or `componentsUsed` that could not be judged: `status` (`checked`), `findings` (always empty; a name neither the package nor Core has, and the template does not import, is an `unknown_block_component` note, with its fix in the message) and `unchecked` ({file, name, reason}: a name the template may reach through anything other than named imports and re-exports from Core, React, StyleX, local helpers or the entry of the package itself, such as an import from another package, a default or namespace import, an alias of or member read off an imported binding, require() or a dynamic import(), or a local module that cannot be read, or any name Core would have to resolve when Core is not installed). Since 0.7.3 each import apps cannot use is a note in `data.notes`, its fix inside the message, listed only: it does not fail this command or `integration check --strict`, and fails `--strict` from the next minor release. The codes are `component_import_not_exported`, `component_import_other_package`, `component_import_missing_name`, `example_import_not_exported`, `example_import_missing_name`, `template_import_not_exported`, `template_import_outside_root`, `template_private_import`, `template_import_missing_name` and `template_no_default_export`. Since 0.7.4 the examples a package ships are checked the same way: `component_without_example` (a published component no block template shows with `exampleFor` and `isShowcase: true`, or names in `alsoShowcaseFor`), `template_category` (a template category written as a path, such as `components/X`), `showcase_not_standalone` (a showcase that imports server-only code or reads `process.env` past `NODE_ENV`) and `template_asset_not_packed` (a `new URL(…, import.meta.url)` asset that is missing, or that `npm pack --dry-run` leaves out of the package). When npm cannot list the package's files, an asset no `files` entry can reach is still a note, and any other is listed in `data.exampleAssets` (`{status: 'checked', findings: [], unchecked}`, present only when it lists any) as {file, asset, reason}; `integration check` counts them as not compared. Since 0.7.15 two notes, without `next`, say what a catalog needs to list the package, each with its fix in the message; they fail no check under any flag: `package_without_logo` (the integration file's `logo.light`, or a `logo.dark` that is set, names no file in the package that is a PNG, JPEG, WebP or shapes-only SVG of at most 512 KB and that npm packs; when the integration file has no `logo`, package.json `marketplace.logo` is read the same way) and `package_without_example` (the package contributes components, other than the ones `component_without_example` exempts, but no block template sets `isShowcase: true` with `exampleFor`, or `alsoShowcaseFor`; a package of themes, docs or codemods alone needs none). A logo npm cannot be asked about is listed in `data.exampleAssets` with `file` set to the file that names it. When the manifest loads, `data.publicImports` is `{status: 'checked', findings: [], unchecked}`: `unchecked` lists each import the check could not judge, as {file, specifier, reason}, the reason starting `example <label>:` for an import in a component example: an `exports` target not built yet; a module whose export list cannot be read in full (CommonJS, or a declaration file it cannot read); a root import in a package with no `exports` (the root module `main` names is not read); every name an import (other than a component doc's own component) names that its module does not export, while a TypeScript file in the package has a `declare module` block for a relative path or the package's own name or a subpath of it, which can add names to that module (a `declare module` in a comment, `declare global`, a wildcard such as `'*.css'`, and another package's name do not count; a file whose text has `declare module` but that cannot be parsed counts); the same for every such name when the package has more than 5,000 files to search for that block; a deep path into build output not built yet in a package with no `exports`; a template import of Core when `@astryxdesign/core` is not installed beside the package (a `packages/core` of the workspace under another name does not count); every import of the package's own name when package.json has no `name` or a `name` that is not a bare package name; one entry for the whole check when package.json cannot be read; and an import of a subpath whose `exports` entry has only a `types` target, unless it is `import type`, every binding is an inline `type`, or every name it imports is a type its types file declares: a value import of a name that file does not declare as a type, a namespace or side-effect import, or any import when the types file cannot be read (it may be build output). `integration check` counts the unchecked as not compared; they never fail it. `data.olderCliNotes` ({file, kind: `template` | `namespace`, field, message}), for the local package, lists each descriptor field a release before 0.7.4 refuses while the package's CLI peer range admits one, such as `stability` on a template or namespace doc; it is present only when it has entries, is never counted, and never fails a check.",
|
|
65
|
+
"The result envelope: `data.validated`, false when nothing was validated — with no `package.json` at all, `data.issues` carries one `no_package` error-severity issue so the command exits 1; with a `package.json` but no integration manifest, `data.issues` is empty, which means \"not looked at\", not \"healthy\"; `data.name` and `data.version` of the validated package (both null when `data.validated` is false; `data.name` is `(local package)` when the local package.json has no readable name), plus `data.issues`, an AstryxIntegrationIssue[] of {code, severity: `warning` | `error`, message, fix?, file?, line?}: `fix` is the change that resolves the issue, and `file` and `line` where it is, relative to the package, when the check knows them; and `data.notes` when there are any: {code, message, next?} information beside the issues; a note fails nothing by default, and one with `next: true` counts as a warning under `integration check --next`, fails `integration check --strict --next`, and fails `--strict` from the next minor release. Notes include `invalid_cli_command` for a `cliCommand` that was ignored as malformed and `cli_peer_version` when the running CLI is outside the `@astryxdesign/cli` peer range of the package, and the package layout findings added after the last minor release, each with its fix in the message: `duplicate_component_doc`, `symlinked_root`, `unreadable_file`, `invalid_package_json` (no `name` or `version`), `no_provider_id`, and `source_without_component_doc` for a doc whose file name differs from its source only in letter case where the two still pair; and `doc_name_mismatch` and `unknown_block_component` (see `docNames` and `blockComponents`); they become warnings in the next minor release. For the commands a topic writes, `runner_command` (written with a package runner), `plain_command` (written bare), `package_manager_command` (written for one package manager) and `doc_token` (a token that does not parse) notes each give the file, line and the token to write. A `doc_target_not_found` note names a doc whose `replaces` or `extends` names no topic and no guide of the CLI's docs or the package's own (such as a namespace, with the guides below it), so it changes nothing unless an app also installs a package that provides it, and a `doc_section_unplaced` note a section whose `before` or `after` names no section of the topic or guide it extends, so it is added at the end, and a `duplicate_guide_replacement` note two docs of the package that replace one guide, of which only the last is read; they become warnings in the next minor release. When the manifest loads, `data.docTypes` holds the doc type check: `status` (`checked` | `skipped`), `reason` when skipped, `typescript`, `docs` (doc values checked), `findings` ({doc, line, export, type, field, problem: `unknown_field` | `missing_field` | `wrong_type`, severity: `warning`, message, fix}), `unchecked` ({doc, reason}: a doc that could not be fully checked, or a root its reader cannot read), and `fixtures` when the components or docs root holds test fixture docs under `__tests__`: how many, none of them checked. When the manifest loads, `data.docNames` lists the component doc names it could not judge: `status` (`checked`), `findings` (always empty; a doc name the module its import names provably does not export is a `doc_name_mismatch` note, with its fix in the message) and `unchecked` ({file, name, reason}: a doc whose `name` differs from the name it is listed under and whose source exports cannot all be read, such as a re-export from another package). When the manifest loads, `data.blockComponents` lists the component names templates give in `exampleFor` or `componentsUsed` that could not be judged: `status` (`checked`), `findings` (always empty; a name neither the package nor Core has, and the template does not import, is an `unknown_block_component` note, with its fix in the message) and `unchecked` ({file, name, reason}: a name the template may reach through anything other than named imports and re-exports from Core, React, StyleX, local helpers or the entry of the package itself, such as an import from another package, a default or namespace import, an alias of or member read off an imported binding, require() or a dynamic import(), or a local module that cannot be read, or any name Core would have to resolve when Core is not installed). Since 0.7.3 each import apps cannot use is a note in `data.notes`, its fix inside the message, listed only: it does not fail this command or `integration check --strict`, and fails `--strict` from the next minor release. The codes are `component_import_not_exported`, `component_import_other_package`, `component_import_missing_name`, `example_import_not_exported`, `example_import_missing_name`, `template_import_not_exported`, `template_import_outside_root`, `template_private_import`, `template_import_missing_name` and `template_no_default_export`. Since 0.7.4 the examples a package ships are checked the same way: `component_without_example` (a published component no block template shows with `exampleFor` and `isShowcase: true`, or names in `alsoShowcaseFor`), `template_category` (a template category written as a path, such as `components/X`), `showcase_not_standalone` (a showcase that imports server-only code or reads `process.env` past `NODE_ENV`) and `template_asset_not_packed` (a `new URL(…, import.meta.url)` asset that is missing, or that `npm pack --dry-run` leaves out of the package). When npm cannot list the package's files, an asset no `files` entry can reach is still a note, and any other is listed in `data.exampleAssets` (`{status: 'checked', findings: [], unchecked}`, present only when it lists any) as {file, asset, reason}; `integration check` counts them as not compared. Since 0.7.15 two notes, without `next`, say what a catalog needs to list the package, each with its fix in the message; they fail no check under any flag: `package_without_logo` (the integration file's `logo.light`, or a `logo.dark` that is set, names no file in the package that is a PNG, JPEG, WebP or shapes-only SVG of at most 512 KB and that npm packs; when the integration file has no `logo`, package.json `marketplace.logo` is read the same way) and `package_without_example` (the package contributes components, other than the ones `component_without_example` exempts, but no block template sets `isShowcase: true` with `exampleFor`, or `alsoShowcaseFor`; a package of themes, docs or codemods alone needs none). A logo npm cannot be asked about is listed in `data.exampleAssets` with `file` set to the file that names it. When the manifest loads, `data.publicImports` is `{status: 'checked', findings: [], unchecked}`: `unchecked` lists each import the check could not judge, as {file, specifier, reason}, the reason starting `example <label>:` for an import in a component example: an `exports` target not built yet; a module whose export list cannot be read in full (CommonJS, or a declaration file it cannot read); a root import in a package with no `exports` (the root module `main` names is not read); every name an import (other than a component doc's own component) names that its module does not export, while a TypeScript file in the package has a `declare module` block for a relative path or the package's own name or a subpath of it, which can add names to that module (a `declare module` in a comment, `declare global`, a wildcard such as `'*.css'`, and another package's name do not count; a file whose text has `declare module` but that cannot be parsed counts); the same for every such name when the package has more than 5,000 files to search for that block; a deep path into build output not built yet in a package with no `exports`; a template import of Core when `@astryxdesign/core` is not installed beside the package (a `packages/core` of the workspace under another name does not count); every import of the package's own name when package.json has no `name` or a `name` that is not a bare package name; one entry for the whole check when package.json cannot be read; and an import of a subpath whose `exports` entry has only a `types` target, unless it is `import type`, every binding is an inline `type`, or every name it imports is a type its types file declares: a value import of a name that file does not declare as a type, a namespace or side-effect import, or any import when the types file cannot be read (it may be build output). `integration check` counts the unchecked as not compared; they never fail it. Each component example that is not `kind: 'setup'` but cannot run on its own, by the rule `previewableExample` in `@astryxdesign/cli/authoring` defines (the rule a live preview follows), is a note with `next: true` and its fix in the message: `example_does_not_compile` (not a TSX module, such as a top-level `return` or code that stops partway), `example_renders_nothing` (no default export, no component, and no JSX at its end), `example_undefined_name` (a name it never defines or imports that is not a component the package documents, a component or hook Core documents, a React export, or a browser global), `example_server_only` (an import of code that runs only on a server, a module of the package that imports `server-only` included, an async component of the package, which only a server renders, or a read of `process.env` past `NODE_ENV`) and `example_import_unresolvable` (a relative path, or a package the package does not declare). `data.exampleCode` (`{status: 'checked', findings: [], unchecked}`, present only when it lists any) lists as {file, example, reason} each example the check could not judge: its names, when Core's docs or React cannot be read beside the package, or the example itself, when it cannot be read; `integration check` counts them as not compared. `data.olderCliNotes` ({file, kind: `template` | `namespace`, field, message}), for the local package, lists each descriptor field a release before 0.7.4 refuses while the package's CLI peer range admits one, such as `stability` on a template or namespace doc; it is present only when it has entries, is never counted, and never fails a check.",
|
|
66
66
|
},
|
|
67
67
|
],
|
|
68
68
|
examples: [
|