@astryxdesign/cli 0.1.7 → 0.1.8-canary.07362a9
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/CHANGELOG.md +40 -0
- package/README.md +115 -19
- package/{src/api → api/blog}/blog.mjs +42 -6
- package/{src/api → api/blog}/blog.test.mjs +2 -2
- package/api/build/build.mjs +92 -0
- package/api/build/build.test.mjs +92 -0
- package/{src/api → api/component}/component.mjs +49 -26
- package/{src/api → api/discover}/discover.mjs +55 -18
- package/{src/api → api/docs}/docs.mjs +47 -21
- package/{src/api → api/doctor}/doctor.mjs +13 -10
- package/{src/api → api}/error.mjs +2 -2
- package/{src/api → api/hook}/hook.mjs +11 -11
- package/{src/api → api}/index.mjs +16 -9
- package/{src/api → api/integration}/validate-integration.mjs +48 -15
- package/{src/api → api/integration}/validate-integration.test.mjs +1 -1
- package/{src/api → api/layout}/layout.mjs +66 -17
- package/{src/api → api/layout}/layout.test.mjs +1 -1
- package/{src/api → api/search}/search.mjs +71 -12
- package/api/swizzle/swizzle.mjs +283 -0
- package/{src/commands → api/swizzle}/swizzle.test.mjs +26 -1
- package/{src/api → api/template}/template-integration.test.mjs +2 -2
- package/{src/api → api/template}/template-suffix.test.mjs +3 -3
- package/{src/api → api/template}/template.mjs +96 -19
- package/{src/api → api/theme}/theme-add.mjs +35 -7
- package/{src → authoring}/codemod.mjs +6 -6
- package/{src → authoring}/config.test.mjs +1 -1
- package/{src → authoring}/doc.mjs +1 -1
- package/{src → authoring}/doc.test.mjs +1 -1
- package/{src → authoring}/template.mjs +1 -1
- package/bin/astryx.mjs +12 -10
- package/{src → cli}/commands/blog.mjs +48 -7
- package/{src → cli}/commands/build-theme.mjs +133 -115
- package/cli/commands/build.mjs +172 -0
- package/cli/commands/cli-postinstall.test.mjs +42 -0
- package/{src → cli}/commands/component/index.mjs +52 -25
- package/{src → cli}/commands/component-ownership.test.mjs +3 -3
- package/{src → cli}/commands/component-package.test.mjs +1 -1
- package/{src → cli}/commands/component-resolution.test.mjs +2 -2
- package/{src → cli}/commands/discover.mjs +23 -12
- package/{src → cli}/commands/docs.mjs +42 -10
- package/{src → cli}/commands/docs.test.mjs +1 -1
- package/{src → cli}/commands/doctor.mjs +3 -3
- package/{src → cli}/commands/doctor.test.mjs +2 -2
- package/{src → cli}/commands/ensure-core-built.mjs +3 -2
- package/{src → cli}/commands/external-showcase.test.mjs +1 -1
- package/{src → cli}/commands/hook/index.mjs +40 -17
- package/{src → cli}/commands/import-hint-correctness.test.mjs +1 -1
- package/cli/commands/init.mjs +195 -0
- package/{src → cli}/commands/init.next-steps.test.mjs +1 -1
- package/cli/commands/interactive-guard.test.mjs +66 -0
- package/{src → cli}/commands/json-contract.test.mjs +2 -2
- package/{src → cli}/commands/layout.mjs +59 -19
- package/{src → cli}/commands/search.mjs +22 -15
- package/{src → cli}/commands/search.test.mjs +1 -1
- package/cli/commands/setup-nudge.test.mjs +108 -0
- package/cli/commands/swizzle.mjs +103 -0
- package/{src → cli}/commands/template.mjs +84 -53
- package/{src → cli}/commands/template.path-safety.test.mjs +2 -2
- package/{src → cli}/commands/upgrade.integration-policy.test.mjs +1 -1
- package/{src → cli}/commands/upgrade.mjs +291 -77
- package/cli/commands/upgrade.test.mjs +314 -0
- package/{src → cli}/commands/validate-integration.mjs +17 -37
- package/{src → cli}/index.mjs +55 -19
- package/{src/codemods → codemods}/__tests__/registry.test.mjs +1 -0
- package/{src/codemods → codemods}/ensure-jscodeshift.mjs +12 -28
- package/{src/codemods → codemods}/integration-discovery.mjs +6 -3
- package/{src/codemods → codemods}/integration-discovery.test.mjs +1 -1
- package/{src/codemods → codemods}/integration-runner.mjs +8 -3
- package/{src/codemods → codemods}/registry.mjs +4 -1
- package/{src/codemods → codemods}/run-codemod.mjs +18 -11
- package/{src/codemods → codemods}/runner.mjs +24 -14
- package/{src/codemods → codemods}/transforms/v0.0.10/remove-size-props.mjs +9 -4
- package/{src/codemods → codemods}/transforms/v0.0.12/add-is-icon-only.mjs +27 -22
- package/{src/codemods → codemods}/transforms/v0.0.13/icon-name-deprecations.mjs +12 -5
- package/{src/codemods → codemods}/transforms/v0.0.13/rename-attachments-to-drawer.mjs +15 -8
- package/{src/codemods → codemods}/transforms/v0.0.13/toolbar-density-to-size.mjs +10 -4
- package/{src/codemods → codemods}/transforms/v0.0.14/rename-action-props.mjs +11 -5
- package/{src/codemods → codemods}/transforms/v0.0.14/rename-section-wash-to-muted.mjs +11 -6
- package/{src/codemods → codemods}/transforms/v0.0.14/rename-status-variants.mjs +15 -10
- package/{src/codemods → codemods}/transforms/v0.0.15/migrate-item-children-to-endcontent.mjs +13 -8
- package/{src/codemods → codemods}/transforms/v0.0.15/migrate-selector-children-to-render-option.mjs +18 -13
- package/{src/codemods → codemods}/transforms/v0.0.15/migrate-theme-selectors-to-data-attrs.mjs +8 -4
- package/{src/codemods → codemods}/transforms/v0.0.15/rename-date-picker-to-input.mjs +11 -6
- package/{src/codemods → codemods}/transforms/v0.0.15/rename-imperative-ref-to-handleRef.mjs +6 -1
- package/{src/codemods → codemods}/transforms/v0.0.15/rename-isStreaming-to-isStopShown.mjs +6 -1
- package/{src/codemods → codemods}/transforms/v0.0.15/rename-stack-element-to-as.mjs +8 -3
- package/{src/codemods → codemods}/transforms/v0.0.2/migrate-badge-dot-to-statusdot.mjs +17 -10
- package/{src/codemods → codemods}/transforms/v0.0.2/migrate-gap-to-numeric.mjs +7 -1
- package/{src/codemods → codemods}/transforms/v0.0.2/migrate-isFullBleed-to-padding.mjs +9 -4
- package/{src/codemods → codemods}/transforms/v0.0.2/migrate-useXDSIcon-to-getIcon.mjs +12 -7
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-banner-endButton-to-endContent.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-form-tooltip-startIcon.mjs +8 -2
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-isShown-to-isOpen.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-selector-items-to-options.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-sidenav-header-to-heading.mjs +11 -4
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-topnav-title-to-heading.mjs +10 -4
- package/{src/codemods → codemods}/transforms/v0.0.2/unify-uncontrolled-to-defaultX.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.0.2/unify-visibility-to-onOpenChange.mjs +10 -5
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-badge-children-to-label.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-collapse-to-collapsible.mjs +9 -3
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-radius-tokens.mjs +11 -5
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-shadow-tokens.mjs +13 -6
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-skeleton-radius.mjs +7 -1
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-token-names.mjs +11 -5
- package/{src/codemods → codemods}/transforms/v0.0.7/rename-banner-variant-to-container.mjs +8 -3
- package/{src/codemods → codemods}/transforms/v0.0.8/migrate-token-renames.mjs +15 -8
- package/{src/codemods → codemods}/transforms/v0.0.8/rename-endslot-to-endcontent.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/drop-xds-prefix-imports.test.mjs +42 -7
- package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/migrate-xds-module-specifiers.test.mjs +43 -0
- package/{src/codemods → codemods}/transforms/v0.1.0/drop-xds-prefix-imports.mjs +117 -13
- package/{src/codemods → codemods}/transforms/v0.1.0/migrate-xds-css-surfaces.mjs +21 -17
- package/{src/codemods → codemods}/transforms/v0.1.0/migrate-xds-declare-module.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.1.0/migrate-xds-module-specifiers.mjs +86 -15
- package/{src/codemods → codemods}/transforms/v0.1.2/rename-text-color-active-to-accent.mjs +15 -9
- package/{src/codemods → codemods}/transforms/v0.1.3/migrate-layout-components-to-experimental.mjs +17 -12
- package/{src/codemods → codemods}/transforms/v0.1.5/rename-switch-label-spacing-default-to-hug.mjs +15 -9
- package/{src/codemods → codemods}/transforms/v0.1.7/migrate-table-tableprops-to-direct-props.mjs +17 -10
- package/{src/codemods → codemods}/transforms/v0.1.7/rename-table-renderprops-styles-to-xstyle.mjs +18 -13
- package/codemods/transforms/v0.1.8/__tests__/rename-avatar-size-scale.test.mjs +161 -0
- package/codemods/transforms/v0.1.8/index.mjs +19 -0
- package/codemods/transforms/v0.1.8/rename-avatar-size-scale.mjs +239 -0
- package/docs/cli-integrations.doc.mjs +150 -0
- package/docs/elevation.doc.mjs +79 -1
- package/docs/getting-started.doc.mjs +9 -9
- package/docs/internationalization.doc.mjs +92 -46
- package/docs/migration.doc.mjs +18 -18
- package/docs/principles.doc.dense.mjs +1 -1
- package/docs/principles.doc.mjs +6 -6
- package/docs/principles.doc.zh.mjs +1 -1
- package/docs/styling-libraries.doc.mjs +3 -3
- package/docs/styling.doc.mjs +4 -4
- package/docs/theme.doc.dense.mjs +2 -2
- package/docs/theme.doc.mjs +7 -7
- package/docs/theme.doc.zh.mjs +1 -1
- package/docs/tokens.doc.mjs +1 -1
- package/docs/working-with-ai.doc.mjs +19 -19
- package/{src/commands → lib/agent-docs}/agent-docs.mjs +164 -29
- package/{src/commands → lib/agent-docs}/agent-docs.path-safety.test.mjs +1 -1
- package/{src/commands → lib/agent-docs}/agent-docs.test.mjs +123 -10
- package/{src/lib → lib}/cli-error.mjs +2 -2
- package/{src/lib → lib}/component-discovery.mjs +44 -2
- package/{src/lib → lib}/component-format.mjs +67 -25
- package/{src/lib → lib}/component-loader.mjs +27 -13
- package/{src/lib → lib}/componentDocOverlay.test.mjs +0 -1
- package/{src/lib → lib}/error-codes.test.mjs +1 -1
- package/{src/lib → lib}/hook-discovery.mjs +14 -1
- package/{src/lib → lib}/hook-format.mjs +29 -5
- package/{src/lib → lib}/integration-warnings.mjs +2 -2
- package/{src/lib → lib}/integrations.mjs +20 -0
- package/{src/lib → lib}/integrations.test.mjs +1 -1
- package/{src/lib → lib}/json-contract.test.mjs +1 -1
- package/{src/lib → lib}/json-shim.mjs +11 -6
- package/{src/lib → lib}/json-shim.test.mjs +1 -1
- package/{src/lib → lib}/json.mjs +3 -3
- package/{src/lib → lib}/levenshtein.mjs +6 -0
- package/{src/lib → lib}/manifest.mjs +7 -5
- package/{src/lib → lib}/manifest.test.mjs +2 -2
- package/{src/lib → lib}/module-loader.mjs +1 -0
- package/{src/lib → lib}/package-scanner.mjs +47 -0
- package/{src/lib → lib}/project.mjs +48 -18
- package/{src/lib → lib}/project.test.mjs +1 -1
- package/{src/lib → lib}/resolve-theme.mjs +5 -0
- package/{src/lib → lib}/string-utils.mjs +15 -0
- package/lib/term-log.mjs +57 -0
- package/{src/lib → lib}/xle/browser.mjs +18 -8
- package/{src/lib → lib}/xle/expand.mjs +155 -22
- package/{src/lib → lib}/xle/parse.mjs +119 -13
- package/{src/lib → lib}/xle/print.mjs +54 -14
- package/{src/lib → lib}/xle/registry-core.mjs +28 -3
- package/{src/lib → lib}/xle/registry.mjs +9 -4
- package/{src/lib → lib}/xle/splice.mjs +13 -2
- package/{src/lib → lib}/xle/validate.mjs +95 -14
- package/lib/xle/xle-ast.d.ts +214 -0
- package/package.json +37 -28
- package/scripts/postinstall.mjs +74 -0
- package/templates/blocks/components/Avatar/AvatarFallbackChain.tsx +4 -4
- package/templates/blocks/components/Avatar/AvatarGroup.tsx +2 -2
- package/templates/blocks/components/Avatar/AvatarInitialsFallback.tsx +1 -1
- package/templates/blocks/components/Avatar/AvatarShowcase.tsx +5 -5
- package/templates/blocks/components/Avatar/AvatarUserCard.tsx +1 -1
- package/templates/blocks/components/Avatar/AvatarWithImage.tsx +4 -4
- package/templates/blocks/components/Avatar/AvatarWithStatus.tsx +3 -3
- package/templates/blocks/components/AvatarGroup/AvatarGroupShowcase.tsx +2 -2
- package/templates/blocks/components/AvatarGroupOverflow/AvatarGroupOverflowCustomText.tsx +1 -1
- package/templates/blocks/components/AvatarGroupOverflow/AvatarGroupOverflowDefault.tsx +1 -1
- package/templates/blocks/components/AvatarGroupOverflow/AvatarGroupOverflowShowcase.tsx +2 -2
- package/templates/blocks/components/AvatarStatusDot/AvatarStatusDotShowcase.tsx +3 -3
- package/templates/blocks/components/AvatarStatusDot/AvatarStatusDotVariants.tsx +3 -3
- package/templates/blocks/components/Banner/BannerFloating.doc.mjs +14 -0
- package/templates/blocks/components/Banner/BannerFloating.tsx +16 -0
- package/templates/blocks/components/Button/ButtonFloating.doc.mjs +14 -0
- package/templates/blocks/components/Button/ButtonFloating.tsx +37 -0
- package/templates/blocks/components/ButtonGroup/ButtonGroupFloating.doc.mjs +14 -0
- package/templates/blocks/components/ButtonGroup/ButtonGroupFloating.tsx +23 -0
- package/templates/blocks/components/Card/CardElevations.doc.mjs +14 -0
- package/templates/blocks/components/Card/CardElevations.tsx +32 -0
- package/templates/blocks/components/Card/ClickableCardElevated.doc.mjs +14 -0
- package/templates/blocks/components/Card/ClickableCardElevated.tsx +21 -0
- package/templates/blocks/components/Card/SelectableCardElevated.doc.mjs +14 -0
- package/templates/blocks/components/Card/SelectableCardElevated.tsx +37 -0
- package/templates/blocks/components/Carousel/CarouselSnap.tsx +1 -1
- package/templates/blocks/components/ChatComposer/ChatComposerFlat.doc.mjs +14 -0
- package/templates/blocks/components/ChatComposer/ChatComposerFlat.tsx +75 -0
- package/templates/blocks/components/ChatMessage/ChatMessageAvatarName.tsx +2 -2
- package/templates/blocks/components/ChatMessage/ChatMessageMultiBubble.tsx +1 -1
- package/templates/blocks/components/ChatMessageBubble/ChatMessageBubbleGrouping.tsx +1 -1
- package/templates/blocks/components/ChatMessageBubble/ChatMessageBubbleMetadata.tsx +1 -1
- package/templates/blocks/components/ChatMessageList/ChatMessageListDensity.tsx +5 -9
- package/templates/blocks/components/ChatMessageList/ChatMessageListFullFeatured.tsx +1 -1
- package/templates/blocks/components/CodeBlock/CodeBlockTerminal.tsx +1 -1
- package/templates/blocks/components/HoverCard/HoverCardShowcase.tsx +1 -1
- package/templates/blocks/components/IconButton/IconButtonFloating.doc.mjs +14 -0
- package/templates/blocks/components/IconButton/IconButtonFloating.tsx +37 -0
- package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.doc.mjs +19 -0
- package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +46 -0
- package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.doc.mjs +14 -0
- package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.tsx +33 -0
- package/templates/blocks/components/Item/ItemWithMedia.tsx +2 -2
- package/templates/blocks/components/ListItem/ListItemWithMedia.tsx +2 -2
- package/templates/blocks/components/OverflowList/OverflowListCappedToolbar.doc.mjs +14 -0
- package/templates/blocks/components/OverflowList/OverflowListCappedToolbar.tsx +39 -0
- package/templates/blocks/components/OverflowList/OverflowListMultiRowTags.doc.mjs +14 -0
- package/templates/blocks/components/OverflowList/OverflowListMultiRowTags.tsx +44 -0
- package/templates/blocks/components/Pagination/PaginationDotsCarousel.tsx +2 -6
- package/templates/blocks/components/Stack/StackFillItem.tsx +2 -6
- package/templates/blocks/components/TabList/TabListTabsWithActions.doc.mjs +1 -1
- package/templates/blocks/components/TabList/TabListTabsWithActions.tsx +2 -7
- package/templates/blocks/components/Table/TableRowStatusTable.doc.mjs +14 -0
- package/templates/blocks/components/Table/TableRowStatusTable.tsx +59 -0
- package/templates/blocks/components/Thumbnail/ThumbnailDisabled.tsx +6 -1
- package/templates/blocks/components/Thumbnail/ThumbnailGallery.tsx +1 -0
- package/templates/blocks/components/Thumbnail/ThumbnailRemovable.tsx +1 -0
- package/templates/blocks/components/TypeaheadItem/TypeaheadItemShowcase.tsx +1 -1
- package/templates/pages/ai-chat/page.tsx +4 -4
- package/templates/pages/dashboard-portfolio/page.tsx +3 -11
- package/templates/pages/detail-page/page.tsx +5 -12
- package/templates/pages/documentation-design/page.tsx +1 -1
- package/templates/pages/messaging-shell/page.tsx +6 -8
- package/templates/pages/table-grouped/page.tsx +9 -14
- package/templates/pages/table-page/page.tsx +7 -9
- package/templates/pages/table-page-heatmap-status/page.tsx +5 -13
- package/{src/types → types}/api.contract.assert.ts +17 -8
- package/{src/types → types}/api.d.ts +110 -9
- package/{src/types → types}/base.d.ts +40 -4
- package/types/build.d.ts +53 -0
- package/types/codemod.d.ts +166 -0
- package/{src/types → types}/component.d.ts +1 -1
- package/{src/types → types}/discover.d.ts +1 -1
- package/{src/types → types}/docs.d.ts +1 -4
- package/{src/types → types}/hook.d.ts +1 -1
- package/{src/types → types}/index.d.ts +1 -0
- package/types/jscodeshift.d.ts +19 -0
- package/types/layout.d.ts +74 -0
- package/{src/types → types}/swizzle.d.ts +4 -0
- package/{src/types → types}/template-api.d.ts +4 -1
- package/types/theme.d.ts +53 -0
- package/types/upgrade.d.ts +108 -0
- package/utils/package-manager.mjs +178 -0
- package/utils/package-manager.test.mjs +220 -0
- package/{src/utils → utils}/path-safety.mjs +0 -18
- package/{src/utils → utils}/paths.mjs +4 -1
- package/{src/utils → utils}/update-check.mjs +5 -4
- package/{src/utils → utils}/update-check.test.mjs +3 -3
- package/docs/integration-authoring.md +0 -105
- package/src/commands/build.mjs +0 -196
- package/src/commands/init.mjs +0 -288
- package/src/commands/interactive-guard.test.mjs +0 -69
- package/src/commands/swizzle.mjs +0 -440
- package/src/commands/upgrade.test.mjs +0 -160
- package/src/types/codemod.d.ts +0 -81
- package/src/types/theme.d.ts +0 -23
- package/src/types/upgrade.d.ts +0 -64
- package/src/utils/interactive.mjs +0 -76
- package/src/utils/interactive.test.mjs +0 -70
- package/src/utils/package-manager.mjs +0 -74
- package/src/utils/package-manager.test.mjs +0 -113
- /package/{src/api → api/docs}/docOverlays.test.mjs +0 -0
- /package/{src/api → api/integration}/integration-block-exports.test.mjs +0 -0
- /package/{src/api → api/template}/template.test.mjs +0 -0
- /package/{src → authoring}/codemod.test.mjs +0 -0
- /package/{src → authoring}/config.mjs +0 -0
- /package/{src → authoring}/integration.mjs +0 -0
- /package/{src → authoring}/template.test.mjs +0 -0
- /package/{src → cli}/cli-exit-codes.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.color-scheme.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.import-path.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.path-safety.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.prose.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.variants.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.watch.test.mjs +0 -0
- /package/{src → cli}/commands/component.test.mjs +0 -0
- /package/{src → cli}/commands/detail-levels.test.mjs +0 -0
- /package/{src → cli}/commands/swizzle.path-safety.test.mjs +0 -0
- /package/{src → cli}/commands/swizzle.routing.test.mjs +0 -0
- /package/{src → cli}/commands/template.test.mjs +0 -0
- /package/{src → cli}/commands/upgrade.config-ordering.test.mjs +0 -0
- /package/{src → cli}/commands/validate-integration.test.mjs +0 -0
- /package/{src → cli}/update-hint-commands.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/rename-imperative-ref-to-handleRef.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/rename-isStreaming-to-isStopShown.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/rename-section-wash-to-muted.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/runner.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/toolbar-density-to-size.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/validation.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.10/__tests__/remove-size-props.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.10/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.12/__tests__/add-is-icon-only.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.12/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.13/__tests__/icon-name-deprecations.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.13/__tests__/rename-attachments-to-drawer.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.13/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.14/__tests__/rename-action-props.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.14/__tests__/rename-status-variants.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.14/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/migrate-item-children-to-endcontent.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/migrate-selector-children-to-render-option.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/migrate-theme-selectors-to-data-attrs.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/rename-date-picker-to-input.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/rename-stack-element-to-as.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-badge-dot-to-statusdot.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-gap-to-numeric.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-isFullBleed-to-padding.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-useXDSIcon-to-getIcon.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-banner-endButton-to-endContent.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-form-tooltip-startIcon.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-isShown-to-isOpen.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-selector-items-to-options.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-sidenav-header-to-heading.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-topnav-title-to-heading.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/unify-uncontrolled-to-defaultX.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/unify-visibility-to-onOpenChange.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-collapse-to-collapsible.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-radius-tokens.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-shadow-tokens.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-skeleton-radius.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-token-names.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.7/__tests__/rename-banner-variant-to-container.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.7/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.8/__tests__/migrate-token-renames.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.8/__tests__/rename-endslot-to-endcontent.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.8/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/migrate-xds-css-surfaces.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/migrate-xds-declare-module.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/v0.1.0-ordering.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.0/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.2/__tests__/rename-text-color-active-to-accent.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.2/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.3/__tests__/migrate-layout-components-to-experimental.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.3/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.5/__tests__/rename-switch-label-spacing-default-to-hug.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.5/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.7/__tests__/migrate-table-tableprops-to-direct-props.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.7/__tests__/rename-table-renderprops-styles-to-xstyle.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.7/index.mjs +0 -0
- /package/{src/lib → lib}/cli-error.test.mjs +0 -0
- /package/{src/lib → lib}/component-discovery.importpath.test.mjs +0 -0
- /package/{src/lib → lib}/component-format.test.mjs +0 -0
- /package/{src/lib → lib}/component-loader.test.mjs +0 -0
- /package/{src/lib → lib}/config-cache.mjs +0 -0
- /package/{src/lib → lib}/config-cache.test.mjs +0 -0
- /package/{src/lib → lib}/config-schema.mjs +0 -0
- /package/{src/lib → lib}/error-codes.mjs +0 -0
- /package/{src/lib → lib}/integration-warnings.test.mjs +0 -0
- /package/{src/lib → lib}/module-loader.test.mjs +0 -0
- /package/{src/lib → lib}/node-version.mjs +0 -0
- /package/{src/lib → lib}/node-version.test.mjs +0 -0
- /package/{src/lib → lib}/parse.mjs +0 -0
- /package/{src/lib → lib}/site.mjs +0 -0
- /package/{src/lib → lib}/xle/browser.d.ts +0 -0
- /package/{src/lib → lib}/xle/xle.test.mjs +0 -0
- /package/{src/schemas → schemas}/doc-schema.mjs +0 -0
- /package/{src/schemas → schemas}/template-schema.mjs +0 -0
- /package/{src/types → types}/config.d.ts +0 -0
- /package/{src/types → types}/doc.d.ts +0 -0
- /package/{src/types → types}/doctor.d.ts +0 -0
- /package/{src/types → types}/error-codes.d.ts +0 -0
- /package/{src/types → types}/integration.d.ts +0 -0
- /package/{src/types → types}/manifest.d.ts +0 -0
- /package/{src/types → types}/search.d.ts +0 -0
- /package/{src/types → types}/template.d.ts +0 -0
- /package/{src/types → types}/validate-integration.d.ts +0 -0
- /package/{src/utils → utils}/github.mjs +0 -0
- /package/{src/utils → utils}/path-safety.test.mjs +0 -0
- /package/{src/utils → utils}/paths.test.mjs +0 -0
- /package/{src/utils → utils}/semver.mjs +0 -0
- /package/{src/utils → utils}/semver.test.mjs +0 -0
|
@@ -29,9 +29,12 @@ const IMPORT_RE =
|
|
|
29
29
|
* default, namespace, and side-effect imports (incl. simple multiline named
|
|
30
30
|
* lists). Returns {imports, rest} where rest is the source with those import
|
|
31
31
|
* lines removed.
|
|
32
|
+
* @param {string} source
|
|
33
|
+
* @returns {{imports: import('./xle-ast').ParsedImport[], rest: string}}
|
|
32
34
|
*/
|
|
33
35
|
export function parseImportStatements(source) {
|
|
34
36
|
const lines = source.split('\n');
|
|
37
|
+
/** @type {import('./xle-ast').ParsedImport[]} */
|
|
35
38
|
const imports = [];
|
|
36
39
|
const kept = [];
|
|
37
40
|
for (let i = 0; i < lines.length; i++) {
|
|
@@ -74,7 +77,7 @@ export function parseImportStatements(source) {
|
|
|
74
77
|
*
|
|
75
78
|
* @param {string} source - raw block TSX
|
|
76
79
|
* @param {string} fallbackName - PascalCase name to use if no export name found
|
|
77
|
-
* @returns {
|
|
80
|
+
* @returns {import('./xle-ast').PreparedSpliceModule | null}
|
|
78
81
|
*/
|
|
79
82
|
export function prepareSpliceModule(source, fallbackName) {
|
|
80
83
|
const {imports, rest} = parseImportStatements(source);
|
|
@@ -106,6 +109,8 @@ export function prepareSpliceModule(source, fallbackName) {
|
|
|
106
109
|
/**
|
|
107
110
|
* Merge a parsed import list into an emitter import map.
|
|
108
111
|
* The map is Map<source, {named:Set, types:Set, default?:string, namespace?:string, sideEffect?:bool}>.
|
|
112
|
+
* @param {Map<string, import('./xle-ast').ImportEntry>} map
|
|
113
|
+
* @param {import('./xle-ast').ParsedImport[]} imports
|
|
109
114
|
*/
|
|
110
115
|
export function mergeImports(map, imports) {
|
|
111
116
|
for (const imp of imports) {
|
|
@@ -113,6 +118,7 @@ export function mergeImports(map, imports) {
|
|
|
113
118
|
map.set(imp.source, {named: new Set(), types: new Set(), default: null, namespace: null, sideEffect: false});
|
|
114
119
|
}
|
|
115
120
|
const entry = map.get(imp.source);
|
|
121
|
+
if (!entry) continue;
|
|
116
122
|
if (imp.sideEffect) entry.sideEffect = true;
|
|
117
123
|
if (imp.default) entry.default = imp.default;
|
|
118
124
|
if (imp.namespace) entry.namespace = imp.namespace;
|
|
@@ -120,7 +126,12 @@ export function mergeImports(map, imports) {
|
|
|
120
126
|
}
|
|
121
127
|
}
|
|
122
128
|
|
|
123
|
-
/**
|
|
129
|
+
/**
|
|
130
|
+
* Render one merged import entry to a statement string.
|
|
131
|
+
* @param {string} source
|
|
132
|
+
* @param {import('./xle-ast').ImportEntry} entry
|
|
133
|
+
* @returns {string}
|
|
134
|
+
*/
|
|
124
135
|
export function renderImport(source, entry) {
|
|
125
136
|
if (entry.sideEffect && !entry.default && !entry.namespace && entry.named.size === 0 && entry.types.size === 0) {
|
|
126
137
|
return `import '${source}';`;
|
|
@@ -19,7 +19,10 @@ import {levenshteinDistance} from '../levenshtein.mjs';
|
|
|
19
19
|
import {KEY_ALIASES} from './parse.mjs';
|
|
20
20
|
import {resolveComponent} from './registry-core.mjs';
|
|
21
21
|
|
|
22
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Boolean flag synonyms — agent-frequency spellings of isX/hasX props.
|
|
24
|
+
* @type {Record<string, string>}
|
|
25
|
+
*/
|
|
23
26
|
const FLAG_SYNONYMS = {
|
|
24
27
|
req: 'isRequired', opt: 'isOptional', dis: 'isDisabled',
|
|
25
28
|
scroll: 'isScrollable', divider: 'hasDivider', dividers: 'hasDivider',
|
|
@@ -30,6 +33,12 @@ const FLAG_SYNONYMS = {
|
|
|
30
33
|
/** Props the expander treats as the node's primary text payload, in order. */
|
|
31
34
|
export const PAYLOAD_PROPS = ['label', 'title', 'heading'];
|
|
32
35
|
|
|
36
|
+
/**
|
|
37
|
+
* @param {string} input
|
|
38
|
+
* @param {string[]} candidates
|
|
39
|
+
* @param {number} [max]
|
|
40
|
+
* @returns {string[]}
|
|
41
|
+
*/
|
|
33
42
|
function suggest(input, candidates, max = 4) {
|
|
34
43
|
const lower = input.toLowerCase();
|
|
35
44
|
return candidates
|
|
@@ -45,6 +54,7 @@ function suggest(input, candidates, max = 4) {
|
|
|
45
54
|
.map(s => s.name);
|
|
46
55
|
}
|
|
47
56
|
|
|
57
|
+
/** @param {string} name */
|
|
48
58
|
function normalizeBlockKey(name) {
|
|
49
59
|
return name.toLowerCase().replace(/[^a-z0-9]/g, '');
|
|
50
60
|
}
|
|
@@ -53,6 +63,9 @@ function normalizeBlockKey(name) {
|
|
|
53
63
|
* Resolve a word to a prop assignment via, in order: synonym table,
|
|
54
64
|
* exact boolean prop, is/has-prefixed boolean prop, unique enum value.
|
|
55
65
|
* Returns {prop, value} or null.
|
|
66
|
+
* @param {import('./xle-ast').RegistryComponent} component
|
|
67
|
+
* @param {string} word
|
|
68
|
+
* @returns {{prop: string, value: string|boolean, ambiguous?: undefined} | {ambiguous: string[], prop?: undefined, value?: undefined} | null}
|
|
56
69
|
*/
|
|
57
70
|
function resolveWord(component, word) {
|
|
58
71
|
const synonym = FLAG_SYNONYMS[word];
|
|
@@ -67,6 +80,7 @@ function resolveWord(component, word) {
|
|
|
67
80
|
if (pref && pref.isBoolean) return {prop: prefix + cap, value: true};
|
|
68
81
|
}
|
|
69
82
|
// Unique enum membership across all enum-typed props.
|
|
83
|
+
/** @type {string[]} */
|
|
70
84
|
const hits = [];
|
|
71
85
|
for (const prop of component.props.values()) {
|
|
72
86
|
if (prop.enumValues && prop.enumValues.includes(word)) hits.push(prop.name);
|
|
@@ -76,7 +90,12 @@ function resolveWord(component, word) {
|
|
|
76
90
|
return null;
|
|
77
91
|
}
|
|
78
92
|
|
|
79
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* Map axis-neutral j=/a= keys onto the component's real alignment props.
|
|
95
|
+
* @param {import('./xle-ast').RegistryComponent} component
|
|
96
|
+
* @param {string} key
|
|
97
|
+
* @returns {string}
|
|
98
|
+
*/
|
|
80
99
|
function resolveAxisKey(component, key) {
|
|
81
100
|
const main = key === '__mainAxis';
|
|
82
101
|
if (component.name === 'VStack') return main ? 'vAlign' : 'hAlign';
|
|
@@ -87,9 +106,14 @@ function resolveAxisKey(component, key) {
|
|
|
87
106
|
return generic;
|
|
88
107
|
}
|
|
89
108
|
|
|
90
|
-
/**
|
|
109
|
+
/**
|
|
110
|
+
* Grid's `columns` object shorthand: {min,max,fit|fill} → real keys.
|
|
111
|
+
* @param {import('./xle-ast').XLEValue} value
|
|
112
|
+
* @returns {import('./xle-ast').XLEValue}
|
|
113
|
+
*/
|
|
91
114
|
function normalizeColumnsObject(value) {
|
|
92
115
|
if (typeof value !== 'object' || value == null || Array.isArray(value)) return value;
|
|
116
|
+
/** @type {Record<string, import('./xle-ast').XLEValue>} */
|
|
93
117
|
const out = {};
|
|
94
118
|
for (const [k, v] of Object.entries(value)) {
|
|
95
119
|
if (k === 'min') out.minWidth = v;
|
|
@@ -100,19 +124,35 @@ function normalizeColumnsObject(value) {
|
|
|
100
124
|
}
|
|
101
125
|
|
|
102
126
|
export class Validation {
|
|
127
|
+
/**
|
|
128
|
+
* @param {import('./xle-ast').Registry} registry
|
|
129
|
+
* @param {import('./browser').XLEBlock[]} [blocks]
|
|
130
|
+
* @param {{loose?: boolean}} [options]
|
|
131
|
+
*/
|
|
103
132
|
constructor(registry, blocks, {loose = false} = {}) {
|
|
104
133
|
this.registry = registry;
|
|
105
134
|
this.blocks = blocks || [];
|
|
106
135
|
this.blockIndex = new Map(this.blocks.map(b => [normalizeBlockKey(b.dirName), b]));
|
|
107
136
|
this.loose = loose;
|
|
137
|
+
/** @type {import('./xle-ast').RawIssue[]} */
|
|
108
138
|
this.errors = [];
|
|
139
|
+
/** @type {import('./xle-ast').RawIssue[]} */
|
|
109
140
|
this.warnings = [];
|
|
110
141
|
}
|
|
111
142
|
|
|
143
|
+
/**
|
|
144
|
+
* @param {import('./xle-ast').XLENode} node
|
|
145
|
+
* @param {string} message
|
|
146
|
+
* @param {string[]} [suggestions]
|
|
147
|
+
*/
|
|
112
148
|
error(node, message, suggestions = []) {
|
|
113
149
|
this.errors.push({message, line: node.line, col: node.col, suggestions});
|
|
114
150
|
}
|
|
115
151
|
|
|
152
|
+
/**
|
|
153
|
+
* @param {import('./xle-ast').XLENode} node
|
|
154
|
+
* @param {string} message
|
|
155
|
+
*/
|
|
116
156
|
warn(node, message) {
|
|
117
157
|
this.warnings.push({message, line: node.line, col: node.col});
|
|
118
158
|
}
|
|
@@ -121,6 +161,10 @@ export class Validation {
|
|
|
121
161
|
return [...this.registry.aliases.keys(), ...this.registry.componentNames];
|
|
122
162
|
}
|
|
123
163
|
|
|
164
|
+
/**
|
|
165
|
+
* @param {import('./xle-ast').XLENode} node
|
|
166
|
+
* @param {import('./xle-ast').XLENode | null} parent
|
|
167
|
+
*/
|
|
124
168
|
bindNode(node, parent) {
|
|
125
169
|
// Anonymous block reference ({block} with no host element).
|
|
126
170
|
if (!node.name && node.hint) {
|
|
@@ -134,7 +178,7 @@ export class Validation {
|
|
|
134
178
|
this.error(
|
|
135
179
|
node,
|
|
136
180
|
`Unknown component or alias '${node.name}'`,
|
|
137
|
-
suggest(node.name, this.nameCandidates()),
|
|
181
|
+
suggest(node.name ?? '', this.nameCandidates()),
|
|
138
182
|
);
|
|
139
183
|
node.bound = null;
|
|
140
184
|
} else {
|
|
@@ -148,6 +192,10 @@ export class Validation {
|
|
|
148
192
|
for (const child of node.children) this.bindAny(child, node);
|
|
149
193
|
}
|
|
150
194
|
|
|
195
|
+
/**
|
|
196
|
+
* @param {import('./xle-ast').XLEItem} item
|
|
197
|
+
* @param {import('./xle-ast').XLENode | null} parent
|
|
198
|
+
*/
|
|
151
199
|
bindAny(item, parent) {
|
|
152
200
|
if (item.kind === 'group') {
|
|
153
201
|
for (const child of item.children) this.bindAny(child, parent);
|
|
@@ -156,7 +204,12 @@ export class Validation {
|
|
|
156
204
|
}
|
|
157
205
|
}
|
|
158
206
|
|
|
207
|
+
/**
|
|
208
|
+
* @param {import('./xle-ast').XLENode} node
|
|
209
|
+
* @param {import('./xle-ast').RegistryComponent} component
|
|
210
|
+
*/
|
|
159
211
|
bindAttrs(node, component) {
|
|
212
|
+
if (!node.bound) return;
|
|
160
213
|
if (component.undocumented) {
|
|
161
214
|
// No prop metadata for this export — bind raw and tell the author
|
|
162
215
|
// nothing was checked, rather than rejecting valid props.
|
|
@@ -200,7 +253,7 @@ export class Validation {
|
|
|
200
253
|
this.error(
|
|
201
254
|
node,
|
|
202
255
|
`'!${attr.key}' does not match a boolean prop of ${component.name}`,
|
|
203
|
-
suggest(attr.key, [...component.props.keys()].filter(p => component.props.get(p)
|
|
256
|
+
suggest(attr.key, [...component.props.keys()].filter(p => component.props.get(p)?.isBoolean)),
|
|
204
257
|
);
|
|
205
258
|
} else {
|
|
206
259
|
node.bound.props.set(hit.prop, false);
|
|
@@ -209,7 +262,13 @@ export class Validation {
|
|
|
209
262
|
}
|
|
210
263
|
}
|
|
211
264
|
|
|
265
|
+
/**
|
|
266
|
+
* @param {import('./xle-ast').XLENode} node
|
|
267
|
+
* @param {import('./xle-ast').RegistryComponent} component
|
|
268
|
+
* @param {import('./xle-ast').KvAttr} attr
|
|
269
|
+
*/
|
|
212
270
|
bindKv(node, component, attr) {
|
|
271
|
+
if (!node.bound) return;
|
|
213
272
|
let key = attr.key.split('.')[0];
|
|
214
273
|
key = KEY_ALIASES[key] ?? key;
|
|
215
274
|
|
|
@@ -253,7 +312,12 @@ export class Validation {
|
|
|
253
312
|
node.bound.props.set(key, value);
|
|
254
313
|
}
|
|
255
314
|
|
|
315
|
+
/**
|
|
316
|
+
* @param {import('./xle-ast').XLENode} node
|
|
317
|
+
* @param {import('./xle-ast').RegistryComponent} component
|
|
318
|
+
*/
|
|
256
319
|
bindMods(node, component) {
|
|
320
|
+
if (!node.bound) return;
|
|
257
321
|
for (const mod of node.enumMods) {
|
|
258
322
|
const hit = resolveWord(component, mod);
|
|
259
323
|
if (!hit || hit.ambiguous) {
|
|
@@ -273,33 +337,45 @@ export class Validation {
|
|
|
273
337
|
}
|
|
274
338
|
}
|
|
275
339
|
|
|
340
|
+
/**
|
|
341
|
+
* @param {import('./xle-ast').XLENode} node
|
|
342
|
+
* @param {import('./xle-ast').RegistryComponent} component
|
|
343
|
+
*/
|
|
276
344
|
bindSlots(node, component) {
|
|
345
|
+
if (!node.bound) return;
|
|
277
346
|
for (const slot of node.slots) {
|
|
278
347
|
const prop = component.props.get(slot.key);
|
|
279
348
|
if (!prop) {
|
|
280
349
|
this.error(
|
|
281
350
|
node,
|
|
282
351
|
`${component.name} has no slot prop '${slot.key}'`,
|
|
283
|
-
suggest(slot.key, [...component.props.keys()].filter(k => component.props.get(k)
|
|
352
|
+
suggest(slot.key, [...component.props.keys()].filter(k => component.props.get(k)?.isNode)),
|
|
284
353
|
);
|
|
285
354
|
continue;
|
|
286
355
|
}
|
|
287
356
|
if (!prop.isNode && !prop.isFunction) {
|
|
288
357
|
this.warn(node, `${component.name}.${slot.key} is typed '${prop.type}' — slot value may not fit`);
|
|
289
358
|
}
|
|
290
|
-
|
|
291
|
-
|
|
359
|
+
const sv = slot.value;
|
|
360
|
+
if (sv && typeof sv === 'object' && 'subexpr' in sv) {
|
|
361
|
+
for (const sub of sv.subexpr) this.bindAny(sub, node);
|
|
292
362
|
}
|
|
293
|
-
if (
|
|
363
|
+
if (sv && typeof sv === 'object' && 'hint' in sv) this.bindHintRef(node, sv.hint);
|
|
294
364
|
node.bound.slots.push(slot);
|
|
295
365
|
}
|
|
296
366
|
}
|
|
297
367
|
|
|
368
|
+
/** @param {import('./xle-ast').XLENode} node */
|
|
298
369
|
bindHint(node) {
|
|
299
370
|
this.bindHintRef(node, node.hint);
|
|
300
371
|
}
|
|
301
372
|
|
|
373
|
+
/**
|
|
374
|
+
* @param {import('./xle-ast').XLENode} node
|
|
375
|
+
* @param {import('./xle-ast').Hint | null} hint
|
|
376
|
+
*/
|
|
302
377
|
bindHintRef(node, hint) {
|
|
378
|
+
if (!hint) return;
|
|
303
379
|
const block = this.blockIndex.get(normalizeBlockKey(hint.name));
|
|
304
380
|
if (block) {
|
|
305
381
|
hint.block = {name: block.dirName, description: block.description, category: block.category};
|
|
@@ -308,7 +384,7 @@ export class Validation {
|
|
|
308
384
|
const nearest = suggest(
|
|
309
385
|
normalizeBlockKey(hint.name),
|
|
310
386
|
[...this.blockIndex.keys()],
|
|
311
|
-
).map(k => this.blockIndex.get(k)
|
|
387
|
+
).map(k => this.blockIndex.get(k)?.dirName).filter(/** @returns {d is string} */ (d) => d != null);
|
|
312
388
|
if (this.loose) {
|
|
313
389
|
this.warn(node, `Unknown block '{${hint.name}}' — emitting a TODO placeholder (running with --loose)`);
|
|
314
390
|
} else {
|
|
@@ -320,6 +396,11 @@ export class Validation {
|
|
|
320
396
|
}
|
|
321
397
|
}
|
|
322
398
|
|
|
399
|
+
/**
|
|
400
|
+
* @param {import('./xle-ast').XLENode} node
|
|
401
|
+
* @param {import('./xle-ast').RegistryComponent} component
|
|
402
|
+
* @param {import('./xle-ast').XLENode | null} parent
|
|
403
|
+
*/
|
|
323
404
|
checkPairings(node, component, parent) {
|
|
324
405
|
const parentName = parent?.bound?.component?.name ?? parent?.name;
|
|
325
406
|
if (component.name === 'AppShell' && parent) {
|
|
@@ -337,11 +418,11 @@ export class Validation {
|
|
|
337
418
|
/**
|
|
338
419
|
* Validate (and bind) a parsed document in place.
|
|
339
420
|
*
|
|
340
|
-
* @param {
|
|
341
|
-
* @param {
|
|
342
|
-
* @param {
|
|
421
|
+
* @param {import('./xle-ast').XLEDoc} doc
|
|
422
|
+
* @param {import('./xle-ast').Registry} registry - from buildRegistry()
|
|
423
|
+
* @param {import('./browser').XLEBlock[]} [blocks] - from template discovery (dirName et al)
|
|
343
424
|
* @param {{loose?: boolean}} [options]
|
|
344
|
-
* @returns {{errors:
|
|
425
|
+
* @returns {{errors: import('./xle-ast').RawIssue[], warnings: import('./xle-ast').RawIssue[]}}
|
|
345
426
|
*/
|
|
346
427
|
export function validate(doc, registry, blocks, options = {}) {
|
|
347
428
|
const v = new Validation(registry, blocks, options);
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** Shared XLE/XLO AST + registry type surface for the .mjs pipeline. */
|
|
4
|
+
|
|
5
|
+
/** A key=value attribute token. */
|
|
6
|
+
export interface KvAttr {
|
|
7
|
+
kind: 'kv';
|
|
8
|
+
key: string;
|
|
9
|
+
value: XLEValue;
|
|
10
|
+
raw?: string;
|
|
11
|
+
line: number;
|
|
12
|
+
col: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** A bare flag attribute token (e.g. `scroll`). */
|
|
16
|
+
export interface FlagAttr {
|
|
17
|
+
kind: 'flag';
|
|
18
|
+
key: string;
|
|
19
|
+
line: number;
|
|
20
|
+
col: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** A negated flag attribute token (e.g. `!scroll`). */
|
|
24
|
+
export interface NegAttr {
|
|
25
|
+
kind: 'neg';
|
|
26
|
+
key: string;
|
|
27
|
+
line: number;
|
|
28
|
+
col: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type Attr = KvAttr | FlagAttr | NegAttr;
|
|
32
|
+
|
|
33
|
+
/** Parsed `{name +flag :arg}` block hint body. */
|
|
34
|
+
export interface Hint {
|
|
35
|
+
name: string;
|
|
36
|
+
flags: string[];
|
|
37
|
+
arg: string | null;
|
|
38
|
+
/** Set by the validator when the hint resolves to a known block. */
|
|
39
|
+
block?: {name: string; description?: string; category?: string};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** An idref value like `#foo`. */
|
|
43
|
+
export interface IdRef {
|
|
44
|
+
idref: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** A sub-expression value carrying parsed items. */
|
|
48
|
+
export interface SubExprValue {
|
|
49
|
+
subexpr: XLEItem[];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** A hint value nested inside a slot. */
|
|
53
|
+
export interface HintValue {
|
|
54
|
+
hint: Hint;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** The value of a slot token. */
|
|
58
|
+
export type SlotValue = string | IdRef | SubExprValue | HintValue | null;
|
|
59
|
+
|
|
60
|
+
/** A slot token (`@key=...`). */
|
|
61
|
+
export interface Slot {
|
|
62
|
+
kind: 'slot';
|
|
63
|
+
key: string;
|
|
64
|
+
value: SlotValue;
|
|
65
|
+
line: number;
|
|
66
|
+
col: number;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Any scalar/structured value an attribute or prop can hold. */
|
|
70
|
+
export type XLEValue =
|
|
71
|
+
| string
|
|
72
|
+
| number
|
|
73
|
+
| boolean
|
|
74
|
+
| IdRef
|
|
75
|
+
| {subexpr: XLEItem[]}
|
|
76
|
+
| {hint: Hint}
|
|
77
|
+
| {__expr: string}
|
|
78
|
+
| XLEValue[]
|
|
79
|
+
| {[key: string]: XLEValue};
|
|
80
|
+
|
|
81
|
+
/** A raw prop entry from a component's `.doc.mjs`. */
|
|
82
|
+
export interface DocProp {
|
|
83
|
+
name: string;
|
|
84
|
+
type?: string;
|
|
85
|
+
required?: boolean;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** Registry prop metadata. */
|
|
89
|
+
export interface RegistryProp {
|
|
90
|
+
name: string;
|
|
91
|
+
type: string;
|
|
92
|
+
required: boolean;
|
|
93
|
+
enumValues: Array<string | number> | null;
|
|
94
|
+
isBoolean: boolean;
|
|
95
|
+
isFunction: boolean;
|
|
96
|
+
isNode: boolean;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** A resolved registry component entry. */
|
|
100
|
+
export interface RegistryComponent {
|
|
101
|
+
name: string;
|
|
102
|
+
exportName: string;
|
|
103
|
+
dirName: string;
|
|
104
|
+
importPath: string;
|
|
105
|
+
undocumented?: boolean;
|
|
106
|
+
props: Map<string, RegistryProp>;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** The hydrated registry shape used by validate()/expand(). */
|
|
110
|
+
export interface Registry {
|
|
111
|
+
components: Map<string, RegistryComponent>;
|
|
112
|
+
aliases: Map<string, string>;
|
|
113
|
+
componentNames: string[];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** Binding info attached to a node by the validator. */
|
|
117
|
+
export interface BoundInfo {
|
|
118
|
+
component: RegistryComponent;
|
|
119
|
+
props: Map<string, XLEValue>;
|
|
120
|
+
slots: Slot[];
|
|
121
|
+
stray: unknown[];
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** A parsed element node. */
|
|
125
|
+
export interface XLENode {
|
|
126
|
+
kind: 'node';
|
|
127
|
+
name: string | null;
|
|
128
|
+
id: string | null;
|
|
129
|
+
enumMods: string[];
|
|
130
|
+
payload: string | null;
|
|
131
|
+
payload2: string | null;
|
|
132
|
+
attrs: Attr[];
|
|
133
|
+
slots: Slot[];
|
|
134
|
+
hint: Hint | null;
|
|
135
|
+
repeat: number | null;
|
|
136
|
+
selected: boolean;
|
|
137
|
+
children: XLEItem[];
|
|
138
|
+
line: number;
|
|
139
|
+
col: number;
|
|
140
|
+
/** Set by validate(); null when the name could not be resolved. */
|
|
141
|
+
bound?: BoundInfo | null;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** A parenthesized grouping term. */
|
|
145
|
+
export interface XLEGroup {
|
|
146
|
+
kind: 'group';
|
|
147
|
+
repeat: number | null;
|
|
148
|
+
children: XLEItem[];
|
|
149
|
+
line: number;
|
|
150
|
+
col: number;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** Any AST item: an element node or a group. */
|
|
154
|
+
export type XLEItem = XLENode | XLEGroup;
|
|
155
|
+
|
|
156
|
+
/** The parsed document. */
|
|
157
|
+
export interface XLEDoc {
|
|
158
|
+
roots: XLEItem[];
|
|
159
|
+
overlays: XLEItem[];
|
|
160
|
+
form: 'compact' | 'outline';
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** A parsed import statement (from splice.mjs). */
|
|
164
|
+
export interface ParsedImport {
|
|
165
|
+
source: string;
|
|
166
|
+
isType: boolean;
|
|
167
|
+
default: string | null;
|
|
168
|
+
namespace: string | null;
|
|
169
|
+
named: string[];
|
|
170
|
+
sideEffect: boolean;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** A merged import map entry (emitter imports). */
|
|
174
|
+
export interface ImportEntry {
|
|
175
|
+
named: Set<string>;
|
|
176
|
+
types: Set<string>;
|
|
177
|
+
default: string | null;
|
|
178
|
+
namespace: string | null;
|
|
179
|
+
sideEffect: boolean;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** A prepared block module for splicing. */
|
|
183
|
+
export interface PreparedSpliceModule {
|
|
184
|
+
componentName: string;
|
|
185
|
+
imports: ParsedImport[];
|
|
186
|
+
body: string;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** A prepared block module reference (import or splice mode). */
|
|
190
|
+
export interface BlockModule {
|
|
191
|
+
mode: 'import' | 'splice';
|
|
192
|
+
componentName: string;
|
|
193
|
+
importPath: string;
|
|
194
|
+
source: string;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** Emitter emission context. */ export interface EmitContext {
|
|
198
|
+
inStack?: boolean;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/** A scaffolded useState entry. */
|
|
202
|
+
export interface StateEntry {
|
|
203
|
+
name: string;
|
|
204
|
+
setter: string;
|
|
205
|
+
initial: string;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/** Internal validation issue (pre-formatting). */
|
|
209
|
+
export interface RawIssue {
|
|
210
|
+
message: string;
|
|
211
|
+
line?: number;
|
|
212
|
+
col?: number;
|
|
213
|
+
suggestions?: string[];
|
|
214
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8-canary.07362a9",
|
|
4
4
|
"displayName": "CLI",
|
|
5
5
|
"description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
@@ -32,57 +32,64 @@
|
|
|
32
32
|
"exports": {
|
|
33
33
|
".": "./bin/astryx.mjs",
|
|
34
34
|
"./json": {
|
|
35
|
-
"types": "./
|
|
36
|
-
"import": "./
|
|
35
|
+
"types": "./types/index.d.ts",
|
|
36
|
+
"import": "./lib/parse.mjs"
|
|
37
37
|
},
|
|
38
38
|
"./api": {
|
|
39
|
-
"types": "./
|
|
40
|
-
"import": "./
|
|
39
|
+
"types": "./types/api.d.ts",
|
|
40
|
+
"import": "./api/index.mjs"
|
|
41
41
|
},
|
|
42
42
|
"./config": {
|
|
43
|
-
"types": "./
|
|
44
|
-
"import": "./
|
|
43
|
+
"types": "./types/config.d.ts",
|
|
44
|
+
"import": "./authoring/config.mjs"
|
|
45
45
|
},
|
|
46
46
|
"./integration": {
|
|
47
|
-
"types": "./
|
|
48
|
-
"import": "./
|
|
47
|
+
"types": "./types/integration.d.ts",
|
|
48
|
+
"import": "./authoring/integration.mjs"
|
|
49
49
|
},
|
|
50
50
|
"./doc": {
|
|
51
|
-
"types": "./
|
|
52
|
-
"import": "./
|
|
51
|
+
"types": "./types/doc.d.ts",
|
|
52
|
+
"import": "./authoring/doc.mjs"
|
|
53
53
|
},
|
|
54
54
|
"./template": {
|
|
55
|
-
"types": "./
|
|
56
|
-
"import": "./
|
|
55
|
+
"types": "./types/template-api.d.ts",
|
|
56
|
+
"import": "./authoring/template.mjs"
|
|
57
57
|
},
|
|
58
58
|
"./codemod": {
|
|
59
|
-
"types": "./
|
|
60
|
-
"import": "./
|
|
59
|
+
"types": "./types/codemod.d.ts",
|
|
60
|
+
"import": "./authoring/codemod.mjs"
|
|
61
61
|
},
|
|
62
62
|
"./xle": {
|
|
63
|
-
"types": "./
|
|
64
|
-
"import": "./
|
|
63
|
+
"types": "./lib/xle/browser.d.ts",
|
|
64
|
+
"import": "./lib/xle/browser.mjs"
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
67
|
"files": [
|
|
68
68
|
"bin",
|
|
69
|
-
"
|
|
69
|
+
"api",
|
|
70
|
+
"cli",
|
|
71
|
+
"codemods",
|
|
72
|
+
"authoring",
|
|
73
|
+
"lib",
|
|
74
|
+
"utils",
|
|
75
|
+
"types",
|
|
76
|
+
"schemas",
|
|
77
|
+
"scripts/postinstall.mjs",
|
|
70
78
|
"templates",
|
|
71
79
|
"docs",
|
|
72
80
|
"CHANGELOG.md"
|
|
73
81
|
],
|
|
74
82
|
"dependencies": {
|
|
75
|
-
"@clack/prompts": "^1.7.0",
|
|
76
83
|
"commander": "^12.1.0",
|
|
77
84
|
"jiti": "^2.7.0",
|
|
78
85
|
"jscodeshift": "^17.3.0",
|
|
79
86
|
"zod": "^4.4.3"
|
|
80
87
|
},
|
|
81
88
|
"peerDependencies": {
|
|
82
|
-
"@astryxdesign/charts": "
|
|
83
|
-
"@astryxdesign/core": "
|
|
84
|
-
"@astryxdesign/lab": "
|
|
85
|
-
"@astryxdesign/theme-neutral": "
|
|
89
|
+
"@astryxdesign/charts": "0.1.8-canary.07362a9",
|
|
90
|
+
"@astryxdesign/core": "0.1.8-canary.07362a9",
|
|
91
|
+
"@astryxdesign/lab": "0.1.8-canary.07362a9",
|
|
92
|
+
"@astryxdesign/theme-neutral": "0.1.8-canary.07362a9",
|
|
86
93
|
"gpt-tokenizer": "^3.4.0"
|
|
87
94
|
},
|
|
88
95
|
"peerDependenciesMeta": {
|
|
@@ -100,15 +107,17 @@
|
|
|
100
107
|
}
|
|
101
108
|
},
|
|
102
109
|
"devDependencies": {
|
|
103
|
-
"@astryxdesign/charts": "
|
|
104
|
-
"@astryxdesign/core": "
|
|
105
|
-
"@astryxdesign/lab": "
|
|
106
|
-
"@astryxdesign/theme-neutral": "
|
|
110
|
+
"@astryxdesign/charts": "0.1.8-canary.07362a9",
|
|
111
|
+
"@astryxdesign/core": "0.1.8-canary.07362a9",
|
|
112
|
+
"@astryxdesign/lab": "0.1.8-canary.07362a9",
|
|
113
|
+
"@astryxdesign/theme-neutral": "0.1.8-canary.07362a9",
|
|
107
114
|
"gpt-tokenizer": "^3.4.0"
|
|
108
115
|
},
|
|
109
116
|
"scripts": {
|
|
110
117
|
"astryx": "node bin/astryx.mjs",
|
|
118
|
+
"postinstall": "node scripts/postinstall.mjs",
|
|
111
119
|
"typecheck:template-docs": "tsc --project tsconfig.template-docs.json",
|
|
112
|
-
"typecheck:json-api": "tsc --project tsconfig.json-api.json && tsc --project tsconfig.api-contract.json"
|
|
120
|
+
"typecheck:json-api": "tsc --project tsconfig.json-api.json && tsc --project tsconfig.api-contract.json",
|
|
121
|
+
"typecheck:strict": "tsc --project tsconfig.strict.json"
|
|
113
122
|
}
|
|
114
123
|
}
|