@astryxdesign/cli 0.6.3-canary.ebaebc4 → 0.6.3-canary.ee13359
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 +114 -77
- package/api/blog/blog.doc.mjs +1 -0
- package/api/build/build.doc.mjs +4 -3
- package/api/build/build.test.mjs +14 -3
- package/api/build/build.type.d.mts +35 -1
- package/api/build/build.type.mjs +24 -3
- package/api/build/help/help.d.mts +8 -5
- package/api/build/help/help.mjs +56 -6
- package/api/component/_adapter.d.mts +6 -12
- package/api/component/_adapter.mjs +20 -10
- package/api/component/component.doc.mjs +13 -3
- package/api/component/component.mjs +91 -14
- package/api/component/component.test.mjs +38 -0
- package/api/component/component.type.d.mts +16 -5
- package/api/component/component.type.mjs +13 -5
- package/api/component/detail/blocks/blocks.d.mts +2 -1
- package/api/component/detail/blocks/blocks.mjs +4 -3
- package/api/component/list/list.d.mts +0 -5
- package/api/component/list/list.mjs +40 -11
- package/api/discover/discover.doc.mjs +2 -1
- package/api/docs/_adapter.d.mts +210 -34
- package/api/docs/_adapter.mjs +674 -134
- package/api/docs/detail/detail.mjs +11 -3
- package/api/docs/detail/section/section.mjs +24 -13
- package/api/docs/detail/section/section.test.mjs +15 -6
- package/api/docs/docs.d.mts +5 -3
- package/api/docs/docs.doc.mjs +36 -15
- package/api/docs/docs.mjs +44 -8
- package/api/docs/docs.test.mjs +158 -4
- package/api/docs/docs.type.d.mts +165 -2
- package/api/docs/docs.type.mjs +101 -3
- package/api/docs/index/index.mjs +11 -3
- package/api/docs/index/index.test.mjs +1 -1
- package/api/docs/integration-tree.test.mjs +547 -0
- package/api/docs/integrationDocs.test.mjs +14 -14
- package/api/docs/list/list.mjs +28 -12
- package/api/docs/node/node.d.mts +43 -0
- package/api/docs/node/node.mjs +192 -0
- package/api/doctor/doctor.d.mts +54 -4
- package/api/doctor/doctor.doc.mjs +1 -0
- package/api/doctor/doctor.mjs +327 -16
- package/api/doctor/doctor.test.mjs +420 -7
- package/api/gap-report/gap-report.doc.mjs +8 -4
- package/api/hook/_adapter.mjs +19 -5
- package/api/hook/hook.doc.mjs +1 -0
- package/api/hook/list/list.d.mts +1 -1
- package/api/hook/list/list.mjs +69 -17
- package/api/index.d.mts +1 -1
- package/api/index.mjs +1 -0
- package/api/init/init.doc.mjs +6 -1
- package/api/init/init.test.mjs +41 -1
- package/api/init/remove/remove.mjs +1 -1
- package/api/init/run/run.mjs +20 -10
- package/api/integration/add-contribution.component-names.test.mjs +120 -0
- package/api/integration/add-contribution.d.mts +2 -1
- package/api/integration/add-contribution.mjs +125 -12
- package/api/integration/add-contribution.test.mjs +254 -3
- package/api/integration/add-theme.mjs +34 -64
- package/api/integration/add-theme.test.mjs +105 -21
- package/api/integration/authoring-checks.mjs +108 -31
- package/api/integration/authoring-checks.test.mjs +171 -6
- package/api/integration/authoring-checks.type.d.mts +3 -1
- package/api/integration/authoring-checks.type.mjs +3 -1
- package/api/integration/integration-authoring.type.d.mts +2 -0
- package/api/integration/integration-authoring.type.mjs +2 -0
- package/api/integration/integration-block-exports.test.mjs +10 -6
- package/api/integration/integrationAdd.doc.mjs +14 -4
- package/api/integration/integrationAddAgentDoc.doc.mjs +1 -0
- package/api/integration/integrationAddCodemod.doc.mjs +1 -0
- package/api/integration/integrationAddComponent.doc.mjs +2 -1
- package/api/integration/integrationAddDoc.doc.mjs +8 -1
- package/api/integration/integrationAddTemplate.doc.mjs +1 -0
- package/api/integration/integrationAddTheme.doc.mjs +6 -5
- package/api/integration/integrationComponentConflicts.doc.mjs +1 -0
- package/api/integration/integrationDocConflicts.doc.mjs +2 -1
- package/api/integration/integrationPackCheck.doc.mjs +2 -1
- package/api/integration/integrationTemplateConflicts.doc.mjs +7 -5
- package/api/integration/pack-check.mjs +34 -0
- package/api/integration/pack-check.test.mjs +138 -47
- package/api/integration/pack-check.type.d.mts +26 -2
- package/api/integration/pack-check.type.mjs +14 -1
- package/api/integration/summarizeIssues.doc.mjs +1 -0
- package/api/integration/validate-integration-fixes.test.mjs +1389 -0
- package/api/integration/validate-integration.mjs +52 -102
- package/api/integration/validate-integration.test.mjs +179 -26
- package/api/integration/validate-unread-theme-folders.test.mjs +110 -0
- package/api/integration/validateIntegration.doc.mjs +3 -2
- package/api/json/assertResponse.doc.mjs +1 -0
- package/api/json/envelope-types.test.mjs +76 -0
- package/api/json/index.ts +2 -0
- package/api/json/isError.doc.mjs +1 -0
- package/api/json/parseResponse.doc.mjs +3 -2
- package/api/layout/_adapter.mjs +20 -5
- package/api/layout/expand/expand.mjs +7 -5
- package/api/layout/expand/expand.path-safety.test.mjs +53 -0
- package/api/layout/grammar/grammar.mjs +2 -1
- package/api/layout/layoutCheck.doc.mjs +1 -0
- package/api/layout/layoutExpand.doc.mjs +2 -1
- package/api/layout/layoutGrammar.doc.mjs +1 -0
- package/api/search/search-return-type.test.mjs +54 -0
- package/api/search/search.d.mts +28 -10
- package/api/search/search.doc.mjs +8 -2
- package/api/search/search.mjs +334 -38
- package/api/search/search.test.mjs +124 -1
- package/api/search/search.type.d.mts +13 -1
- package/api/search/search.type.mjs +4 -1
- package/api/swizzle/copy/copy.mjs +28 -11
- package/api/swizzle/swizzle.doc.mjs +2 -1
- package/api/template/copy/copy.mjs +17 -23
- package/api/template/copy/copy.test.mjs +17 -0
- package/api/template/list/list.mjs +1 -0
- package/api/template/template-integration.test.mjs +1022 -3
- package/api/template/template-suffix.test.mjs +41 -21
- package/api/template/template.doc.mjs +30 -8
- package/api/template/template.mjs +45 -8
- package/api/template/template.type.d.mts +6 -8
- package/api/template/template.type.mjs +3 -2
- package/api/theme/_adapter.d.mts +2 -3
- package/api/theme/_adapter.mjs +4 -5
- package/api/theme/add/add.binary.test.mjs +84 -0
- package/api/theme/add/add.mjs +20 -3
- package/api/theme/add/add.staging.test.mjs +66 -0
- package/api/theme/add/add.test.mjs +14 -1
- package/api/theme/build/build.mjs +114 -37
- package/api/theme/build/build.public-component-vars.test.mjs +1 -1
- package/api/theme/build/build.receipt-doc.test.mjs +111 -0
- package/api/theme/build/font-warning.mjs +3 -3
- package/api/theme/build/font-warning.test.mjs +5 -2
- package/api/theme/generateTonalPalette.doc.mjs +1 -0
- package/api/theme/integration-themes.test.mjs +39 -28
- package/api/theme/list/list.test.mjs +19 -20
- package/api/theme/listThemes.doc.mjs +6 -5
- package/api/theme/palette/generate/generate.mjs +7 -2
- package/api/theme/palette/generate/generate.test.mjs +96 -0
- package/api/theme/palette/generate/generator.mjs +8 -1
- package/api/theme/palette/generate/generator.test.mjs +10 -0
- package/api/theme/template/template.mjs +11 -2
- package/api/theme/template/template.test.mjs +20 -0
- package/api/theme/themeAdd.doc.mjs +4 -3
- package/api/theme/themeBuild.doc.mjs +8 -4
- package/api/theme/themeList.doc.mjs +6 -3
- package/api/theme/themeListAvailable.doc.mjs +5 -3
- package/api/theme/themePaletteGenerate.doc.mjs +1 -0
- package/api/theme/themeTargets.doc.mjs +1 -0
- package/api/theme/themeTemplate.doc.mjs +6 -2
- package/api/upgrade/_adapter.d.mts +32 -5
- package/api/upgrade/_adapter.mjs +124 -73
- package/api/upgrade/list/list.mjs +2 -1
- package/api/upgrade/list/list.test.mjs +73 -0
- package/api/upgrade/provider-agreement.test.mjs +152 -0
- package/api/upgrade/run/run.mjs +356 -59
- package/api/upgrade/status/status.mjs +2 -2
- package/api/upgrade/upgrade.doc.mjs +8 -2
- package/api/upgrade/upgrade.type.d.mts +38 -0
- package/api/upgrade/upgrade.type.mjs +16 -0
- package/assets/codemods/__tests__/runner.test.mjs +330 -8
- package/assets/codemods/integration-discovery.mjs +8 -2
- package/assets/codemods/integration-discovery.test.mjs +15 -0
- package/assets/codemods/integration-runner.mjs +56 -4
- package/assets/codemods/integration-runner.protection.test.mjs +153 -0
- package/assets/codemods/run-codemod.mjs +177 -34
- package/assets/codemods/runner.mjs +350 -102
- package/assets/codemods/term-log.mjs +32 -8
- package/assets/codemods/term-log.test.mjs +19 -1
- package/assets/codemods/transform-prop.mjs +109 -0
- package/assets/codemods/transform-prop.test.mjs +95 -0
- package/assets/codemods/transforms/next/__tests__/migrate-native-picker-to-presentation.test.mjs +63 -0
- package/assets/codemods/transforms/next/__tests__/migrate-theme-catalog-to-descriptors.test.mjs +220 -0
- package/assets/codemods/transforms/next/index.mjs +19 -1
- package/assets/codemods/transforms/next/migrate-native-picker-to-presentation.mjs +148 -0
- package/assets/codemods/transforms/next/migrate-theme-catalog-to-descriptors.mjs +141 -0
- package/assets/codemods/transforms/v0.0.14/__tests__/rename-status-variants.test.mjs +86 -165
- package/assets/codemods/transforms/v0.0.14/rename-status-variants.mjs +72 -210
- package/assets/codemods/transforms/v0.1.8/__tests__/rename-avatar-size-scale.test.mjs +83 -115
- package/assets/codemods/transforms/v0.1.8/rename-avatar-size-scale.mjs +57 -186
- package/assets/codemods/transforms/v0.6.0/__tests__/next-codemods.test.mjs +47 -0
- package/assets/codemods/transforms/v0.6.0/rename-resizable-pixel-bounds.mjs +57 -10
- package/assets/docs/getting-started.doc.mjs +2 -2
- package/assets/docs/principles.doc.mjs +6 -6
- package/assets/docs/styling-libraries.doc.mjs +2 -2
- package/assets/docs/styling.doc.mjs +4 -4
- package/assets/docs/theme.doc.mjs +4 -4
- package/assets/docs/tokens.doc.mjs +1 -1
- package/assets/docs/tree/api.doc.mjs +30 -0
- package/assets/docs/tree/cli.doc.mjs +23 -0
- package/assets/docs/tree/commands.doc.mjs +25 -0
- package/assets/docs/{cli-integrations.doc.mjs → tree/integrations.doc.mjs} +66 -38
- package/assets/docs/tree/integrations.test.mjs +62 -0
- package/assets/docs/tree/writing-docs.doc.mjs +286 -0
- package/assets/templates/blocks/components/DateInput/DateInputDateRange.tsx +1 -1
- package/assets/templates/blocks/components/Item/ItemDocumentTabs.doc.mjs +14 -0
- package/assets/templates/blocks/components/Item/ItemDocumentTabs.tsx +100 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaInlineRail.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaInlineRail.tsx +61 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaOverscrollChaining.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaOverscrollChaining.tsx +126 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaShowcase.doc.mjs +15 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaShowcase.tsx +86 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyGroupHeaders.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyGroupHeaders.tsx +99 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyPassthrough.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyPassthrough.tsx +122 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaTwoAxisBoard.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaTwoAxisBoard.tsx +95 -0
- package/assets/templates/blocks/components/TimeInput/TimeInputConstrained.tsx +1 -0
- package/assets/templates/pages/table-tree/page.tsx +1704 -0
- package/assets/templates/pages/table-tree/template.doc.mjs +12 -0
- package/assets/templates/themes/butter/butterTheme.doc.mjs +11 -0
- package/assets/templates/themes/chocolate/chocolateTheme.doc.mjs +11 -0
- package/assets/templates/themes/gothic/gothicTheme.doc.mjs +11 -0
- package/assets/templates/themes/matcha/matchaTheme.doc.mjs +11 -0
- package/assets/templates/themes/neutral/neutralTheme.doc.mjs +11 -0
- package/assets/templates/themes/stone/stoneTheme.doc.mjs +11 -0
- package/assets/templates/themes/y2k/y2kTheme.doc.mjs +11 -0
- package/authoring/codemod/codemod.doc.mjs +1 -1
- package/authoring/codemod/type.ts +12 -0
- package/authoring/config/config.doc.mjs +2 -2
- package/authoring/config/debug-composition.test.mjs +92 -0
- package/authoring/config/type.ts +15 -3
- package/authoring/debug/debug.doc.d.mts +11 -0
- package/authoring/debug/debug.doc.mjs +182 -0
- package/authoring/debug/parse.d.mts +3 -3
- package/authoring/doctypes/_schema.d.mts +71 -141
- package/authoring/doctypes/_schema.mjs +29 -2
- package/authoring/doctypes/base/graph-fields.doc.mjs +8 -6
- package/authoring/doctypes/base/type.ts +6 -5
- package/authoring/doctypes/command/command.doc.mjs +1 -1
- package/authoring/doctypes/command/type.ts +2 -2
- package/authoring/doctypes/component/type.ts +2 -2
- package/authoring/doctypes/doctypes-new.test.mjs +48 -6
- package/authoring/doctypes/enum/enum.doc.mjs +1 -1
- package/authoring/doctypes/enum/type.ts +1 -1
- package/authoring/doctypes/function/function.doc.mjs +3 -2
- package/authoring/doctypes/function/type.ts +3 -2
- package/authoring/doctypes/hook/type.ts +2 -2
- package/authoring/doctypes/load-contract.test.mjs +3 -2
- package/authoring/doctypes/namespace/namespace.doc.mjs +6 -10
- package/authoring/doctypes/namespace/parse.test.mjs +23 -25
- package/authoring/doctypes/namespace/type.ts +5 -2
- package/authoring/doctypes/parse.d.mts +4 -2
- package/authoring/doctypes/parse.mjs +10 -5
- package/authoring/doctypes/reference/reference.doc.mjs +7 -5
- package/authoring/doctypes/reference/type.ts +12 -10
- package/authoring/doctypes/schema/schema.doc.mjs +1 -1
- package/authoring/doctypes/schema/type.ts +1 -2
- package/authoring/doctypes/template/parse.d.mts +2 -0
- package/authoring/doctypes/template/parse.mjs +4 -0
- package/authoring/doctypes/template/parse.test.mjs +18 -0
- package/authoring/doctypes/template/template.doc.mjs +9 -3
- package/authoring/doctypes/template/type.ts +8 -0
- package/authoring/doctypes/theme/parse.d.mts +35 -0
- package/authoring/doctypes/theme/parse.mjs +76 -0
- package/authoring/doctypes/theme/theme.doc.d.mts +9 -0
- package/authoring/doctypes/theme/theme.doc.mjs +79 -0
- package/authoring/doctypes/theme/type.ts +42 -0
- package/authoring/doctypes/types.ts +2 -1
- package/authoring/gap-report/gap-report.doc.d.mts +12 -0
- package/authoring/gap-report/gap-report.doc.mjs +183 -0
- package/authoring/identity/identity.doc.mjs +2 -2
- package/authoring/index.d.mts +1 -0
- package/authoring/index.d.ts +7 -4
- package/authoring/index.mjs +2 -1
- package/authoring/integration/integration.doc.mjs +2 -2
- package/authoring/integration/type.ts +4 -10
- package/clients/cli/__tests__/cliManifest.test.ts +27 -29
- package/clients/cli/command-load-failure.test.mjs +83 -0
- package/clients/cli/commands/blog.doc.mjs +1 -1
- package/clients/cli/commands/blog.mjs +23 -8
- package/clients/cli/commands/blog.test.mjs +42 -1
- package/clients/cli/commands/build-theme.adaptations.test.mjs +100 -1
- package/clients/cli/commands/build-theme.ascii-output.test.mjs +161 -0
- package/clients/cli/commands/build-theme.flag-docs.test.mjs +110 -0
- package/clients/cli/commands/build-theme.mjs +16 -50
- package/clients/cli/commands/build-theme.path-safety.test.mjs +86 -1
- package/clients/cli/commands/build-theme.variants.test.mjs +76 -0
- package/clients/cli/commands/build.doc.mjs +5 -2
- package/clients/cli/commands/build.exit-codes-doc.test.mjs +50 -0
- package/clients/cli/commands/build.mjs +37 -49
- package/clients/cli/commands/build.playbook.test.mjs +75 -0
- package/clients/cli/commands/build.text-fields.test.mjs +40 -0
- package/clients/cli/commands/component/index.mjs +3 -8
- package/clients/cli/commands/component-ownership.test.mjs +3 -3
- package/clients/cli/commands/component-package.test.mjs +46 -0
- package/clients/cli/commands/component-resolution.test.mjs +21 -0
- package/clients/cli/commands/component.doc.mjs +1 -1
- package/clients/cli/commands/component.test.mjs +19 -0
- package/clients/cli/commands/detail-levels.test.mjs +2 -2
- package/clients/cli/commands/discover.broken-integration.test.mjs +52 -5
- package/clients/cli/commands/discover.components-flag.test.mjs +97 -0
- package/clients/cli/commands/discover.doc.mjs +5 -3
- package/clients/cli/commands/discover.mjs +4 -4
- package/clients/cli/commands/discover.text-projection.test.mjs +103 -0
- package/clients/cli/commands/docs.doc.mjs +21 -9
- package/clients/cli/commands/docs.mjs +182 -68
- package/clients/cli/commands/docs.test.mjs +120 -16
- package/clients/cli/commands/doctor-integration-components.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +3 -3
- package/clients/cli/commands/doctor-integration-templates.doc.mjs +15 -8
- package/clients/cli/commands/doctor-integration-validate.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration.package-json.test.mjs +53 -0
- package/clients/cli/commands/doctor-integration.test.mjs +83 -8
- package/clients/cli/commands/doctor.doc.mjs +1 -1
- package/clients/cli/commands/doctor.mjs +30 -25
- package/clients/cli/commands/doctor.test.mjs +42 -0
- package/clients/cli/commands/gap-report.doc.mjs +17 -6
- package/clients/cli/commands/gap-report.test.mjs +72 -0
- package/clients/cli/commands/hook/index.mjs +7 -17
- package/clients/cli/commands/hook.doc.mjs +1 -1
- package/clients/cli/commands/hook.text-projection.test.mjs +45 -0
- package/clients/cli/commands/init.doc.mjs +20 -9
- package/clients/cli/commands/init.flag-help.test.mjs +153 -0
- package/clients/cli/commands/integration-add.controls.test.mjs +132 -0
- package/clients/cli/commands/integration-add.doc.mjs +32 -6
- package/clients/cli/commands/integration-pack.doc.mjs +1 -1
- package/clients/cli/commands/integration-real-world.test.mjs +3 -9
- package/clients/cli/commands/integration.doc.mjs +1 -1
- package/clients/cli/commands/integration.mjs +1 -0
- package/clients/cli/commands/interactive-guard.test.mjs +101 -24
- package/clients/cli/commands/json-contract.test.mjs +33 -0
- package/clients/cli/commands/layout-check.doc.mjs +15 -4
- package/clients/cli/commands/layout-expand.doc.mjs +22 -5
- package/clients/cli/commands/layout-grammar.doc.mjs +1 -1
- package/clients/cli/commands/layout.doc.mjs +3 -3
- package/clients/cli/commands/layout.mjs +21 -9
- package/clients/cli/commands/layout.path-help.test.mjs +33 -0
- package/clients/cli/commands/layout.stdin-cap.test.mjs +47 -0
- package/clients/cli/commands/layout.text-fields.test.mjs +39 -0
- package/clients/cli/commands/manifest.doc.mjs +1 -1
- package/clients/cli/commands/no-prompt-wording.test.mjs +94 -0
- package/clients/cli/commands/search.doc.mjs +7 -4
- package/clients/cli/commands/search.mjs +28 -9
- package/clients/cli/commands/search.test.mjs +75 -0
- package/clients/cli/commands/setup-nudge.test.mjs +6 -0
- package/clients/cli/commands/swizzle.doc.mjs +3 -2
- package/clients/cli/commands/swizzle.path-safety.test.mjs +42 -0
- package/clients/cli/commands/template.doc.mjs +52 -13
- package/clients/cli/commands/template.flag-help.test.mjs +117 -0
- package/clients/cli/commands/template.mjs +4 -91
- package/clients/cli/commands/template.path-help.test.mjs +40 -0
- package/clients/cli/commands/text-json-parity.test.mjs +719 -0
- package/clients/cli/commands/theme-add.doc.mjs +4 -3
- package/clients/cli/commands/theme-build.doc.mjs +8 -7
- package/clients/cli/commands/theme-list.doc.mjs +2 -2
- package/clients/cli/commands/theme-palette-generate.doc.mjs +3 -3
- package/clients/cli/commands/theme-palette-generate.test.mjs +19 -0
- package/clients/cli/commands/theme-palette.doc.mjs +1 -1
- package/clients/cli/commands/theme-targets.behavior.test.mjs +4 -3
- package/clients/cli/commands/theme-targets.doc.mjs +1 -1
- package/clients/cli/commands/theme-template.behavior.test.mjs +12 -0
- package/clients/cli/commands/theme-template.doc.mjs +2 -2
- package/clients/cli/commands/theme.doc.mjs +1 -1
- package/clients/cli/commands/upgrade.ascii-output.test.mjs +87 -0
- package/clients/cli/commands/upgrade.doc.mjs +20 -8
- package/clients/cli/commands/upgrade.file-protection.test.mjs +228 -0
- package/clients/cli/commands/upgrade.flag-help.test.mjs +188 -0
- package/clients/cli/commands/upgrade.hook-output.test.mjs +88 -0
- package/clients/cli/commands/upgrade.mjs +29 -7
- package/clients/cli/formatters/index.mjs +2 -0
- package/clients/cli/formatters/index.test.mjs +6 -0
- package/clients/cli/index.mjs +21 -30
- package/clients/cli/latest-version-env.test.mjs +50 -0
- package/clients/cli/lib/cli-error.test.mjs +7 -0
- package/clients/cli/lib/component-format.mjs +9 -9
- package/clients/cli/lib/component-format.test.mjs +1 -1
- package/clients/cli/lib/define-command.mjs +32 -6
- package/clients/cli/lib/doc-text-ascii.test.mjs +82 -0
- package/clients/cli/lib/exit-codes.test.mjs +97 -0
- package/clients/cli/lib/hook-format.mjs +19 -10
- package/clients/cli/lib/json-shim.mjs +38 -2
- package/clients/cli/lib/json-shim.test.mjs +83 -0
- package/clients/cli/lib/manifest.d.ts +2 -0
- package/clients/cli/lib/manifest.mjs +31 -2
- package/clients/cli/lib/manifest.test.mjs +17 -0
- package/foundation/agent-docs/agent-docs.d.mts +4 -0
- package/foundation/agent-docs/agent-docs.mjs +70 -3
- package/foundation/agent-docs/agent-docs.path-safety.test.mjs +266 -4
- package/foundation/agent-docs/agent-docs.test.mjs +10 -1
- package/foundation/config/integration-debug.test.mjs +28 -3
- package/foundation/config/project-themes.test.mjs +11 -19
- package/foundation/config/project.d.mts +20 -11
- package/foundation/config/project.mjs +246 -89
- package/foundation/config/project.test.mjs +270 -21
- package/foundation/discovery/authoring-self-docs.d.mts +6 -0
- package/foundation/discovery/authoring-self-docs.mjs +17 -7
- package/foundation/discovery/authoring-self-docs.test.mjs +20 -9
- package/foundation/discovery/authoring-surface.d.mts +74 -0
- package/foundation/discovery/authoring-surface.mjs +525 -0
- package/foundation/discovery/authoring-surface.test.mjs +392 -0
- package/foundation/discovery/cli-self-docs.d.mts +119 -0
- package/foundation/discovery/cli-self-docs.mjs +490 -0
- package/foundation/discovery/cli-self-docs.test.mjs +375 -0
- package/foundation/discovery/component-discovery.d.mts +38 -0
- package/foundation/discovery/component-discovery.mjs +48 -0
- package/foundation/discovery/component-loader.d.mts +35 -38
- package/foundation/discovery/component-loader.mjs +53 -222
- package/foundation/discovery/docs-discovery.d.mts +108 -10
- package/foundation/discovery/docs-discovery.mjs +191 -30
- package/foundation/discovery/docs-discovery.test.mjs +71 -32
- package/foundation/discovery/docs-output-budget.d.mts +2 -2
- package/foundation/discovery/docs-output-budget.mjs +1 -1
- package/foundation/discovery/docs-section-key.d.mts +28 -10
- package/foundation/discovery/docs-section-key.mjs +134 -33
- package/foundation/discovery/docs-section-key.test.mjs +41 -19
- package/foundation/discovery/template-adapter.d.mts +113 -11
- package/foundation/discovery/template-adapter.fixture-refs.test.mjs +248 -0
- package/foundation/discovery/template-adapter.integration-isolation.test.mjs +94 -0
- package/foundation/discovery/template-adapter.mjs +772 -82
- package/foundation/discovery/template-adapter.test.mjs +57 -0
- package/foundation/discovery/theme-discovery.d.mts +67 -7
- package/foundation/discovery/theme-discovery.mjs +916 -186
- package/foundation/discovery/theme-discovery.test.mjs +613 -219
- package/foundation/doc-compiler/bundle.d.mts +47 -0
- package/foundation/doc-compiler/bundle.mjs +278 -0
- package/foundation/doc-compiler/bundle.test.mjs +266 -0
- package/foundation/doc-compiler/compile.d.mts +220 -39
- package/foundation/doc-compiler/compile.mjs +311 -15
- package/foundation/doc-compiler/diagnostics.d.mts +126 -0
- package/foundation/doc-compiler/diagnostics.mjs +305 -0
- package/foundation/doc-compiler/doc-compiler.test.mjs +28 -1
- package/foundation/doc-compiler/doc-loads.test.mjs +1642 -0
- package/foundation/doc-compiler/import.d.mts +24 -0
- package/foundation/doc-compiler/import.mjs +59 -0
- package/foundation/doc-compiler/inputs.d.mts +102 -0
- package/foundation/doc-compiler/inputs.mjs +291 -0
- package/foundation/doc-compiler/inputs.test.mjs +299 -0
- package/foundation/doc-compiler/ir.d.mts +13 -0
- package/foundation/doc-compiler/ir.mjs +196 -12
- package/foundation/doc-compiler/lenses.d.mts +3 -2
- package/foundation/doc-compiler/lenses.mjs +2 -1
- package/foundation/doc-compiler/links.d.mts +135 -0
- package/foundation/doc-compiler/links.mjs +253 -0
- package/foundation/doc-compiler/links.test.mjs +139 -0
- package/foundation/doc-compiler/lower-doc.test.mjs +495 -0
- package/foundation/doc-compiler/overlays.d.mts +37 -0
- package/foundation/doc-compiler/overlays.mjs +206 -0
- package/foundation/doc-compiler/parse-readable.d.mts +9 -0
- package/foundation/doc-compiler/parse-readable.mjs +29 -0
- package/foundation/doc-compiler/read.d.mts +127 -0
- package/foundation/doc-compiler/read.mjs +325 -0
- package/foundation/doc-compiler/read.test.mjs +313 -0
- package/foundation/doc-compiler/source.d.mts +33 -0
- package/foundation/doc-compiler/source.mjs +128 -0
- package/foundation/doc-compiler/tree.d.mts +288 -0
- package/foundation/doc-compiler/tree.mjs +876 -0
- package/foundation/doc-compiler/tree.test.mjs +598 -0
- package/foundation/fs/file-protection.d.mts +33 -0
- package/foundation/fs/file-protection.mjs +825 -0
- package/foundation/fs/file-protection.test.mjs +250 -0
- package/foundation/fs/module-loader.d.mts +1 -0
- package/foundation/fs/module-loader.mjs +50 -1
- package/foundation/fs/module-loader.stdout.test.mjs +332 -0
- package/foundation/fs/path-safety.d.mts +3 -2
- package/foundation/fs/path-safety.mjs +49 -19
- package/foundation/fs/path-safety.test.mjs +50 -0
- package/foundation/fs/publish-file-hardlink-unavailable.test.mjs +129 -94
- package/foundation/integrations/autolink.d.mts +58 -1
- package/foundation/integrations/autolink.mjs +143 -52
- package/foundation/integrations/autolink.test.mjs +1 -1
- package/foundation/integrations/cli-requirement.d.mts +45 -0
- package/foundation/integrations/cli-requirement.mjs +154 -0
- package/foundation/integrations/cli-requirement.test.mjs +109 -0
- package/foundation/integrations/contribution-fixes.d.mts +145 -0
- package/foundation/integrations/contribution-fixes.mjs +1284 -0
- package/foundation/integrations/contribution-inventory.d.mts +3 -2
- package/foundation/integrations/contribution-inventory.mjs +27 -24
- package/foundation/integrations/contribution-inventory.test.mjs +86 -27
- package/foundation/integrations/integration-warnings.d.mts +9 -2
- package/foundation/integrations/integration-warnings.mjs +51 -26
- package/foundation/integrations/integration-warnings.test.mjs +74 -1
- package/foundation/integrations/integrations.d.mts +3 -0
- package/foundation/integrations/integrations.mjs +11 -97
- package/foundation/integrations/provider-ledger.test.mjs +275 -0
- package/foundation/integrations/provider-resolution.d.mts +152 -0
- package/foundation/integrations/provider-resolution.mjs +576 -0
- package/foundation/integrations/provider-resolution.test.mjs +369 -0
- package/foundation/integrations/theme-descriptor.d.mts +8 -0
- package/foundation/integrations/theme-descriptor.mjs +44 -0
- package/foundation/integrations/validate-contributions.mjs +121 -29
- package/foundation/response/base.d.ts +8 -4
- package/foundation/response/error-codes.d.mts +3 -1
- package/foundation/response/error-codes.d.ts +2 -0
- package/foundation/response/error-codes.doc.mjs +13 -4
- package/foundation/response/error-codes.mjs +8 -2
- package/foundation/response/error-codes.test.mjs +137 -10
- package/foundation/response/json-contract.test.mjs +11 -0
- package/foundation/response/json.d.mts +4 -2
- package/foundation/response/json.mjs +8 -10
- package/foundation/response/response-types.doc.mjs +22 -17
- package/foundation/response/response-types.doc.test.mjs +158 -0
- package/foundation/response/response.doc.mjs +1 -1
- package/foundation/text/string-utils.mjs +22 -10
- package/foundation/xle/expand.d.mts +2 -0
- package/foundation/xle/expand.mjs +4 -3
- package/foundation/xle/expand.test.mjs +54 -0
- package/foundation/xle/xle.test.mjs +13 -0
- package/package.json +10 -9
- package/assets/templates/themes/manifest.json +0 -95
- package/clients/cli/lib/update-check.mjs +0 -83
- package/clients/cli/lib/update-check.test.mjs +0 -137
- package/clients/cli/update-hint-commands.test.mjs +0 -54
|
@@ -224,10 +224,10 @@ function staleBuildOutputs(writes, cwd) {
|
|
|
224
224
|
/** @param {Array<{dest: string, content: string}>} writes */
|
|
225
225
|
function writeBuildOutputs(writes) {
|
|
226
226
|
if (writes.length === 0) return;
|
|
227
|
-
fs.mkdirSync(path.dirname(writes[0].dest), {recursive: true});
|
|
228
227
|
/** @type {Array<{tmp: string, dest: string}>} */
|
|
229
228
|
const staged = [];
|
|
230
229
|
try {
|
|
230
|
+
fs.mkdirSync(path.dirname(writes[0].dest), {recursive: true});
|
|
231
231
|
for (const write of writes) {
|
|
232
232
|
const tmp = `${write.dest}.${process.pid}.tmp`;
|
|
233
233
|
fs.writeFileSync(tmp, write.content);
|
|
@@ -1871,7 +1871,7 @@ function validatePrivateVars(themeDef) {
|
|
|
1871
1871
|
if (prop.startsWith('--_')) {
|
|
1872
1872
|
errors.push(
|
|
1873
1873
|
`Component "${component}" (${[key, ...path].join(' ')}) sets private var "${prop}". ` +
|
|
1874
|
-
`Private vars (--_*) are internal
|
|
1874
|
+
`Private vars (--_*) are internal; use standard CSS properties ` +
|
|
1875
1875
|
`(e.g. borderRadius, padding) instead. The pipeline expands them automatically.`,
|
|
1876
1876
|
);
|
|
1877
1877
|
}
|
|
@@ -1931,20 +1931,7 @@ function getThemeComponentLayers(themeDef) {
|
|
|
1931
1931
|
*/
|
|
1932
1932
|
function validateCustomHeadingTypes(themeDef) {
|
|
1933
1933
|
const layers = getThemeComponentLayers(themeDef);
|
|
1934
|
-
const customTypes =
|
|
1935
|
-
for (const {components} of layers) {
|
|
1936
|
-
const headingRules = components.heading;
|
|
1937
|
-
if (!headingRules || typeof headingRules !== 'object') continue;
|
|
1938
|
-
|
|
1939
|
-
for (const key of Object.keys(headingRules)) {
|
|
1940
|
-
for (const pair of key.split('+')) {
|
|
1941
|
-
const colon = pair.indexOf(':');
|
|
1942
|
-
if (colon === -1 || pair.slice(0, colon) !== 'type') continue;
|
|
1943
|
-
const value = pair.slice(colon + 1);
|
|
1944
|
-
if (value && !BUILTIN_HEADING_TYPES.has(value)) customTypes.add(value);
|
|
1945
|
-
}
|
|
1946
|
-
}
|
|
1947
|
-
}
|
|
1934
|
+
const customTypes = customHeadingTypes(themeDef);
|
|
1948
1935
|
|
|
1949
1936
|
const errors = [];
|
|
1950
1937
|
for (const type of customTypes) {
|
|
@@ -1971,10 +1958,65 @@ function validateCustomHeadingTypes(themeDef) {
|
|
|
1971
1958
|
return errors;
|
|
1972
1959
|
}
|
|
1973
1960
|
|
|
1961
|
+
/**
|
|
1962
|
+
* Custom Heading type names declared on the root or media-surface component
|
|
1963
|
+
* maps: the names the generated `HeadingTypeMap` augmentation enrolls.
|
|
1964
|
+
*
|
|
1965
|
+
* @param {{components?: Record<string, Record<string, unknown>>}} themeDef
|
|
1966
|
+
* @returns {Set<string>}
|
|
1967
|
+
*/
|
|
1968
|
+
function customHeadingTypes(themeDef) {
|
|
1969
|
+
/** @type {Set<string>} */
|
|
1970
|
+
const customTypes = new Set();
|
|
1971
|
+
for (const {components} of getThemeComponentLayers(themeDef)) {
|
|
1972
|
+
const headingRules = components.heading;
|
|
1973
|
+
if (!headingRules || typeof headingRules !== 'object') continue;
|
|
1974
|
+
|
|
1975
|
+
for (const key of Object.keys(headingRules)) {
|
|
1976
|
+
for (const pair of key.split('+')) {
|
|
1977
|
+
const colon = pair.indexOf(':');
|
|
1978
|
+
if (colon === -1 || pair.slice(0, colon) !== 'type') continue;
|
|
1979
|
+
const value = pair.slice(colon + 1);
|
|
1980
|
+
if (value && !BUILTIN_HEADING_TYPES.has(value)) customTypes.add(value);
|
|
1981
|
+
}
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
return customTypes;
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1987
|
+
/**
|
|
1988
|
+
* Custom Heading types with no standalone rule in the generated CSS. A type
|
|
1989
|
+
* whose every declaration the compiler dropped still passes the source check,
|
|
1990
|
+
* and its augmentation would then name a type that has no styles.
|
|
1991
|
+
*
|
|
1992
|
+
* @param {Set<string>} types
|
|
1993
|
+
* @param {string} css - Generated root component and media-surface rules.
|
|
1994
|
+
* @returns {string[]}
|
|
1995
|
+
*/
|
|
1996
|
+
function headingTypesWithoutEmittedRule(types, css) {
|
|
1997
|
+
/** @type {string[]} */
|
|
1998
|
+
const missing = [];
|
|
1999
|
+
for (const type of types) {
|
|
2000
|
+
const selector = `.astryx-heading[data-type="${type}"]`;
|
|
2001
|
+
let emitted = false;
|
|
2002
|
+
for (
|
|
2003
|
+
let at = css.indexOf(selector);
|
|
2004
|
+
at !== -1 && !emitted;
|
|
2005
|
+
at = css.indexOf(selector, at + 1)
|
|
2006
|
+
) {
|
|
2007
|
+
// A following attribute is a combined selector, not the standalone rule.
|
|
2008
|
+
emitted = css[at + selector.length] !== '[';
|
|
2009
|
+
}
|
|
2010
|
+
if (!emitted) missing.push(type);
|
|
2011
|
+
}
|
|
2012
|
+
return missing;
|
|
2013
|
+
}
|
|
2014
|
+
|
|
1974
2015
|
/**
|
|
1975
2016
|
* Return true when a style object contains a declaration that the theme
|
|
1976
|
-
* generator can emit. Empty pseudo blocks do not count: they
|
|
1977
|
-
* and would leave the generated type augmentation
|
|
2017
|
+
* generator can emit. Empty pseudo blocks and blank values do not count: they
|
|
2018
|
+
* produce no usable CSS and would leave the generated type augmentation
|
|
2019
|
+
* without a usable rule.
|
|
1978
2020
|
*
|
|
1979
2021
|
* @param {unknown} styles
|
|
1980
2022
|
* @returns {boolean}
|
|
@@ -1988,7 +2030,12 @@ function hasUsableStyleDeclaration(styles) {
|
|
|
1988
2030
|
if (hasUsableStyleDeclaration(value)) return true;
|
|
1989
2031
|
continue;
|
|
1990
2032
|
}
|
|
1991
|
-
if (
|
|
2033
|
+
if (
|
|
2034
|
+
value !== undefined &&
|
|
2035
|
+
value !== null &&
|
|
2036
|
+
typeof value !== 'object' &&
|
|
2037
|
+
String(value).trim() !== ''
|
|
2038
|
+
) {
|
|
1992
2039
|
return true;
|
|
1993
2040
|
}
|
|
1994
2041
|
}
|
|
@@ -2163,14 +2210,14 @@ async function themeBuildInternal(
|
|
|
2163
2210
|
const noticeMessages = [];
|
|
2164
2211
|
for (const w of warnings) {
|
|
2165
2212
|
warningMessages.push(w);
|
|
2166
|
-
logger.warn(`
|
|
2213
|
+
logger.warn(` [warn] ${w}`);
|
|
2167
2214
|
}
|
|
2168
2215
|
|
|
2169
2216
|
// Validate no private vars are set directly
|
|
2170
2217
|
const privateVarErrors = validatePrivateVars(themeDef);
|
|
2171
2218
|
for (const e of privateVarErrors) {
|
|
2172
2219
|
warningMessages.push(e);
|
|
2173
|
-
logger.error(`
|
|
2220
|
+
logger.error(` [error] ${e}`);
|
|
2174
2221
|
}
|
|
2175
2222
|
if (privateVarErrors.length > 0) {
|
|
2176
2223
|
logger.error(
|
|
@@ -2196,7 +2243,7 @@ async function themeBuildInternal(
|
|
|
2196
2243
|
// capability exports are checked against what the theme actually asks for.
|
|
2197
2244
|
if (!_defineTheme || !_generateThemeRulesSplit) {
|
|
2198
2245
|
throw new AstryxError(
|
|
2199
|
-
'Could not load @astryxdesign/core/theme
|
|
2246
|
+
'Could not load @astryxdesign/core/theme: `astryx theme build` requires a ' +
|
|
2200
2247
|
'built, resolvable @astryxdesign/core so it emits the same CSS as the ' +
|
|
2201
2248
|
'runtime <Theme>. Build @astryxdesign/core first (e.g. `pnpm -F @astryxdesign/core ' +
|
|
2202
2249
|
'build`)' +
|
|
@@ -2385,10 +2432,29 @@ async function themeBuildInternal(
|
|
|
2385
2432
|
for (const message of droppedDeclarations) {
|
|
2386
2433
|
const w = `Declaration ${message}. The generated CSS omits it; fix the value in the theme source.`;
|
|
2387
2434
|
warningMessages.push(w);
|
|
2388
|
-
logger.warn(`
|
|
2435
|
+
logger.warn(` [warn] ${w}`);
|
|
2436
|
+
}
|
|
2437
|
+
const unemittedHeadingTypes = headingTypesWithoutEmittedRule(
|
|
2438
|
+
customHeadingTypes(themeDef),
|
|
2439
|
+
`${component.join('\n')}\n${onMediaCss}`,
|
|
2440
|
+
);
|
|
2441
|
+
if (unemittedHeadingTypes.length > 0) {
|
|
2442
|
+
throw new AstryxError(
|
|
2443
|
+
unemittedHeadingTypes
|
|
2444
|
+
.map(
|
|
2445
|
+
type =>
|
|
2446
|
+
`Custom Heading type "${type}" has no declaration the theme ` +
|
|
2447
|
+
`compiler could emit: every declaration in its standalone ` +
|
|
2448
|
+
`"type:${type}" rule was dropped. Give that rule at least one ` +
|
|
2449
|
+
'valid declaration.',
|
|
2450
|
+
)
|
|
2451
|
+
.join('\n'),
|
|
2452
|
+
undefined,
|
|
2453
|
+
ERROR_CODES.ERR_THEME_INVALID,
|
|
2454
|
+
);
|
|
2389
2455
|
}
|
|
2390
2456
|
if (cssParts.length === 0) {
|
|
2391
|
-
logger.log('No overrides found
|
|
2457
|
+
logger.log('No overrides found; nothing to build.');
|
|
2392
2458
|
return null;
|
|
2393
2459
|
}
|
|
2394
2460
|
// The data-token defaults are theme-independent and go in @layer
|
|
@@ -2439,7 +2505,18 @@ async function themeBuildInternal(
|
|
|
2439
2505
|
// Guard: relative paths must not escape cwd via `../`. Absolute paths are
|
|
2440
2506
|
// trusted (the user explicitly controls where output goes, like gcc -o).
|
|
2441
2507
|
if (!path.isAbsolute(options.out)) {
|
|
2442
|
-
|
|
2508
|
+
try {
|
|
2509
|
+
assertWithin(options.out, cwd, {label: 'output path'});
|
|
2510
|
+
} catch (err) {
|
|
2511
|
+
if (err instanceof PathSafetyError) {
|
|
2512
|
+
throw new AstryxError(
|
|
2513
|
+
err.message,
|
|
2514
|
+
undefined,
|
|
2515
|
+
ERROR_CODES.ERR_PATH_TRAVERSAL,
|
|
2516
|
+
);
|
|
2517
|
+
}
|
|
2518
|
+
throw err;
|
|
2519
|
+
}
|
|
2443
2520
|
}
|
|
2444
2521
|
} else {
|
|
2445
2522
|
outPath = path.join(path.dirname(filePath), `${baseName}.css`);
|
|
@@ -2548,10 +2625,10 @@ async function themeBuildInternal(
|
|
|
2548
2625
|
const stale = staleBuildOutputs(writes, cwd);
|
|
2549
2626
|
const upToDate = stale.length === 0;
|
|
2550
2627
|
if (upToDate) {
|
|
2551
|
-
logger.log(`\n
|
|
2628
|
+
logger.log(`\n[ok] Theme outputs are up to date with ${sourceRelative}.`);
|
|
2552
2629
|
} else {
|
|
2553
2630
|
logger.error(
|
|
2554
|
-
`\n
|
|
2631
|
+
`\n[fail] ${stale.length} theme output(s) are out of date with ${sourceRelative}:`,
|
|
2555
2632
|
);
|
|
2556
2633
|
for (const s of stale) {
|
|
2557
2634
|
logger.error(
|
|
@@ -2573,17 +2650,17 @@ async function themeBuildInternal(
|
|
|
2573
2650
|
|
|
2574
2651
|
writeBuildOutputs(writes);
|
|
2575
2652
|
|
|
2576
|
-
logger.log(`\n
|
|
2653
|
+
logger.log(`\n[ok] ${path.relative(cwd, outPath)}`);
|
|
2577
2654
|
logger.log(
|
|
2578
2655
|
` ${tokenCount} token overrides, ${componentCount} component overrides`,
|
|
2579
2656
|
);
|
|
2580
2657
|
logger.log(` ${size} KB`);
|
|
2581
|
-
logger.log(
|
|
2582
|
-
logger.log(
|
|
2658
|
+
logger.log(`[ok] ${path.relative(cwd, jsPath)}`);
|
|
2659
|
+
logger.log(`[ok] ${path.relative(cwd, dtsPath)}`);
|
|
2583
2660
|
if (variantDtsPath && variantDecl) {
|
|
2584
2661
|
const augCount = (variantDecl.match(/': true;/g) || []).length;
|
|
2585
2662
|
logger.log(
|
|
2586
|
-
|
|
2663
|
+
`[ok] ${path.relative(cwd, variantDtsPath)} (${augCount} type augmentations)`,
|
|
2587
2664
|
);
|
|
2588
2665
|
}
|
|
2589
2666
|
|
|
@@ -2593,7 +2670,7 @@ async function themeBuildInternal(
|
|
|
2593
2670
|
const cssImport = importSpecifier(relOutDir, cssBase) + '.css';
|
|
2594
2671
|
const exportName = `${toIdentifier(baseName)}Theme`;
|
|
2595
2672
|
logger.log(`
|
|
2596
|
-
Install in your app (paths are relative to a file in src
|
|
2673
|
+
Install in your app (paths are relative to a file in src/; adjust if yours lives elsewhere):
|
|
2597
2674
|
|
|
2598
2675
|
import { ${exportName} } from '${jsImport}';
|
|
2599
2676
|
import '${cssImport}';
|
|
@@ -2625,7 +2702,7 @@ Or with a <link> tag:
|
|
|
2625
2702
|
// Adaptation rules are resolved theme writes in their own right, so a family
|
|
2626
2703
|
// named only inside one needs the same notice as one named at the root.
|
|
2627
2704
|
for (const family of unloadedFonts) {
|
|
2628
|
-
const msg = `Font "${family}" is named by this theme but not loaded
|
|
2705
|
+
const msg = `Font "${family}" is named by this theme but not loaded; add a <link> or @font-face in your app (recipe: astryx docs typography)`;
|
|
2629
2706
|
noticeMessages.push(msg);
|
|
2630
2707
|
logger.log(` note: ${msg}`);
|
|
2631
2708
|
}
|
|
@@ -2919,11 +2996,11 @@ export async function themeBuildFamily(
|
|
|
2919
2996
|
const upToDate = stale.length === 0;
|
|
2920
2997
|
if (upToDate) {
|
|
2921
2998
|
logger.log(
|
|
2922
|
-
`\n
|
|
2999
|
+
`\n[ok] Theme family outputs are up to date with ${sourceRelative}.`,
|
|
2923
3000
|
);
|
|
2924
3001
|
} else {
|
|
2925
3002
|
logger.error(
|
|
2926
|
-
`\n
|
|
3003
|
+
`\n[fail] ${stale.length} theme family output(s) are out of date:`,
|
|
2927
3004
|
);
|
|
2928
3005
|
for (const entry of stale) {
|
|
2929
3006
|
logger.error(
|
|
@@ -2943,7 +3020,7 @@ export async function themeBuildFamily(
|
|
|
2943
3020
|
};
|
|
2944
3021
|
}
|
|
2945
3022
|
writeBuildOutputs(writes);
|
|
2946
|
-
for (const output of Object.values(outputs)) logger.log(
|
|
3023
|
+
for (const output of Object.values(outputs)) logger.log(`[ok] ${output}`);
|
|
2947
3024
|
const themeBindings = members.map(member => bindings.get(member.theme.name));
|
|
2948
3025
|
const relOutDir = path.relative(cwd, outDir) || '.';
|
|
2949
3026
|
const jsImport = importSpecifier(relOutDir, baseName);
|
|
@@ -2961,7 +3038,7 @@ Or load the same stylesheet natively:
|
|
|
2961
3038
|
];
|
|
2962
3039
|
const notices = unloadedFonts.map(
|
|
2963
3040
|
family =>
|
|
2964
|
-
`Font "${family}" is named by this theme family but not loaded
|
|
3041
|
+
`Font "${family}" is named by this theme family but not loaded; add a <link> or @font-face in your app (recipe: astryx docs typography)`,
|
|
2965
3042
|
);
|
|
2966
3043
|
for (const notice of notices) logger.log(` note: ${notice}`);
|
|
2967
3044
|
return {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* next one is covered without touching this file.
|
|
20
20
|
*
|
|
21
21
|
* Asserted on the receipt's `warnings` rather than on a rejection: a private
|
|
22
|
-
* var is reported (logged
|
|
22
|
+
* var is reported (logged `[error]`, collected into the receipt) and the build then
|
|
23
23
|
* emits its CSS and resolves anyway. Asserting a throw would pass for the
|
|
24
24
|
* wrong reason — it never throws, which is why a throwaway build read as a
|
|
25
25
|
* pass on the first version of #5214.
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Every field `themeBuild()` returns is named in its FunctionDoc and in the
|
|
5
|
+
* response-types doc.
|
|
6
|
+
*
|
|
7
|
+
* The receipt is a stable machine-readable response, so each field needs
|
|
8
|
+
* consumer documentation, not only a typedef. The fields are read off a real
|
|
9
|
+
* build, so a field added to the receipt without documentation fails here.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import {describe, it, expect, beforeAll, afterEach} from 'vitest';
|
|
13
|
+
import * as fs from 'node:fs';
|
|
14
|
+
import * as os from 'node:os';
|
|
15
|
+
import * as path from 'node:path';
|
|
16
|
+
import {themeBuild} from './build.mjs';
|
|
17
|
+
import {doc} from '../themeBuild.doc.mjs';
|
|
18
|
+
import {doc as responseTypes} from '../../../foundation/response/response-types.doc.mjs';
|
|
19
|
+
import {ensureCoreBuilt} from '../../../clients/cli/commands/ensure-core-built.mjs';
|
|
20
|
+
|
|
21
|
+
/** @type {string[]} */
|
|
22
|
+
const dirs = [];
|
|
23
|
+
|
|
24
|
+
beforeAll(() => {
|
|
25
|
+
ensureCoreBuilt();
|
|
26
|
+
}, 200_000);
|
|
27
|
+
|
|
28
|
+
afterEach(() => {
|
|
29
|
+
for (const dir of dirs.splice(0)) {
|
|
30
|
+
fs.rmSync(dir, {recursive: true, force: true});
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
/** @returns {string} a temp dir holding a theme that exercises every field */
|
|
35
|
+
function themeDir() {
|
|
36
|
+
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-receipt-doc-'));
|
|
37
|
+
dirs.push(dir);
|
|
38
|
+
fs.writeFileSync(
|
|
39
|
+
path.join(dir, 'ocean.mjs'),
|
|
40
|
+
`export default {
|
|
41
|
+
name: 'ocean',
|
|
42
|
+
tokens: {'--color-background-body': '#ffffff', '--font-family-body': '"Inter", sans-serif'},
|
|
43
|
+
components: {progressbar: {base: {color: 'red'}}},
|
|
44
|
+
};
|
|
45
|
+
`,
|
|
46
|
+
);
|
|
47
|
+
return dir;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** @param {string} type */
|
|
51
|
+
function returnsDescription(type) {
|
|
52
|
+
const entry = doc.returns?.find(r => r.type === type);
|
|
53
|
+
expect(entry, `themeBuild doc has no ${type} return`).toBeDefined();
|
|
54
|
+
return /** @type {{description: string}} */ (entry).description;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** @param {string} description @param {string[]} fields */
|
|
58
|
+
function undocumented(description, fields) {
|
|
59
|
+
return fields.filter(
|
|
60
|
+
field => !new RegExp(String.raw`\b${field}\b`).test(description),
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
describe('themeBuild() consumer docs name every receipt field', () => {
|
|
65
|
+
it('theme.build', async () => {
|
|
66
|
+
const dir = themeDir();
|
|
67
|
+
const result = await themeBuild('ocean.mjs', {}, {cwd: dir});
|
|
68
|
+
|
|
69
|
+
expect(result?.type).toBe('theme.build');
|
|
70
|
+
const data = /** @type {Record<string, any>} */ (result?.data);
|
|
71
|
+
// The theme is chosen so the optional arrays are non-empty.
|
|
72
|
+
expect(data.warnings.length).toBeGreaterThan(0);
|
|
73
|
+
expect(data.notices.length).toBeGreaterThan(0);
|
|
74
|
+
|
|
75
|
+
const fields = [
|
|
76
|
+
...Object.keys(data),
|
|
77
|
+
...Object.keys(data.outputs),
|
|
78
|
+
'variantsDts',
|
|
79
|
+
];
|
|
80
|
+
expect(undocumented(returnsDescription('theme.build'), fields)).toEqual([]);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('theme.build in the response-types doc', async () => {
|
|
84
|
+
const dir = themeDir();
|
|
85
|
+
const result = await themeBuild('ocean.mjs', {}, {cwd: dir});
|
|
86
|
+
const data = /** @type {Record<string, any>} */ (result?.data);
|
|
87
|
+
const member = responseTypes.members.find(m => m.value === 'theme.build');
|
|
88
|
+
expect(member, 'response-types has no theme.build member').toBeDefined();
|
|
89
|
+
|
|
90
|
+
const fields = [
|
|
91
|
+
...Object.keys(data),
|
|
92
|
+
...Object.keys(data.outputs),
|
|
93
|
+
'variantsDts',
|
|
94
|
+
];
|
|
95
|
+
expect(
|
|
96
|
+
undocumented(/** @type {{description: string}} */ (member).description, fields),
|
|
97
|
+
).toEqual([]);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it('theme.build.check', async () => {
|
|
101
|
+
const dir = themeDir();
|
|
102
|
+
const result = await themeBuild('ocean.mjs', {check: true}, {cwd: dir});
|
|
103
|
+
|
|
104
|
+
expect(result?.type).toBe('theme.build.check');
|
|
105
|
+
const data = /** @type {Record<string, any>} */ (result?.data);
|
|
106
|
+
const fields = [...Object.keys(data), ...Object.keys(data.stale[0])];
|
|
107
|
+
expect(
|
|
108
|
+
undocumented(returnsDescription('theme.build.check'), fields),
|
|
109
|
+
).toEqual([]);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
@@ -211,11 +211,11 @@ export function formatFontLoadingHelp(themeName, families) {
|
|
|
211
211
|
const first = families[0];
|
|
212
212
|
const slug = first.toLowerCase().replace(/ /g, '-');
|
|
213
213
|
return `
|
|
214
|
-
|
|
215
|
-
The built CSS only sets font-family
|
|
214
|
+
[note] Theme "${themeName}" names fonts it does not load: ${named}
|
|
215
|
+
The built CSS only sets font-family; load these in your app, or every
|
|
216
216
|
browser quietly falls back.
|
|
217
217
|
|
|
218
|
-
Google Fonts (add :wght
|
|
218
|
+
Google Fonts (add :wght@... axes as your theme's weights require):
|
|
219
219
|
|
|
220
220
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
221
221
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
@@ -227,12 +227,15 @@ describe('formatFontLoadingHelp', () => {
|
|
|
227
227
|
const help = formatFontLoadingHelp('ocean', ['Fraunces', 'JetBrains Mono']);
|
|
228
228
|
|
|
229
229
|
it('names the theme and every family in the headline', () => {
|
|
230
|
-
expect(help).toContain('
|
|
231
|
-
expect(help).toContain('ocean');
|
|
230
|
+
expect(help).toContain('[note] Theme "ocean"');
|
|
232
231
|
expect(help).toContain('"Fraunces"');
|
|
233
232
|
expect(help).toContain('"JetBrains Mono"');
|
|
234
233
|
});
|
|
235
234
|
|
|
235
|
+
it('is plain ASCII', () => {
|
|
236
|
+
expect(help).not.toMatch(/[\u0080-\uffff]/);
|
|
237
|
+
});
|
|
238
|
+
|
|
236
239
|
it('includes the Google Fonts recipe: preconnect pair + the exact css2 URL', () => {
|
|
237
240
|
expect(help).toContain(
|
|
238
241
|
'<link rel="preconnect" href="https://fonts.googleapis.com"',
|
|
@@ -7,18 +7,14 @@ import {themeAdd} from './add/add.mjs';
|
|
|
7
7
|
|
|
8
8
|
let tmpDir;
|
|
9
9
|
|
|
10
|
-
function installThemeIntegration(
|
|
11
|
-
packageName,
|
|
12
|
-
slug,
|
|
13
|
-
source = 'export const oceanTheme = {};\n',
|
|
14
|
-
extraFiles = {},
|
|
15
|
-
) {
|
|
10
|
+
function installThemeIntegration(packageName, slug, source, extraFiles = {}) {
|
|
16
11
|
const packageDir = path.join(
|
|
17
12
|
tmpDir,
|
|
18
13
|
'node_modules',
|
|
19
14
|
...packageName.split('/'),
|
|
20
15
|
);
|
|
21
16
|
const themeDir = path.join(packageDir, 'themes', slug);
|
|
17
|
+
const stem = `${slug.replace(/-([a-z0-9])/gu, (_, character) => character.toUpperCase())}Theme`;
|
|
22
18
|
fs.mkdirSync(themeDir, {recursive: true});
|
|
23
19
|
fs.writeFileSync(
|
|
24
20
|
path.join(packageDir, 'package.json'),
|
|
@@ -26,26 +22,21 @@ function installThemeIntegration(
|
|
|
26
22
|
);
|
|
27
23
|
fs.writeFileSync(
|
|
28
24
|
path.join(packageDir, 'astryx.integration.mjs'),
|
|
29
|
-
`export default {themes: './themes'}
|
|
25
|
+
`export default {themes: './themes'};
|
|
26
|
+
`,
|
|
30
27
|
);
|
|
31
28
|
fs.writeFileSync(
|
|
32
|
-
path.join(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
exportName: 'oceanTheme',
|
|
43
|
-
files: ['oceanTheme.ts', ...Object.keys(extraFiles)],
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
}),
|
|
29
|
+
path.join(themeDir, `${stem}.doc.mjs`),
|
|
30
|
+
`/** @type {import('@astryxdesign/cli/authoring').ThemeDoc} */
|
|
31
|
+
export default {type: 'theme', name: '${slug}', displayName: '${slug === 'neutral' ? 'Neutral Plus' : 'Ocean'}', description: 'Integration-owned theme.', maintained: true};
|
|
32
|
+
`,
|
|
33
|
+
);
|
|
34
|
+
fs.writeFileSync(
|
|
35
|
+
path.join(themeDir, `${stem}.ts`),
|
|
36
|
+
source ??
|
|
37
|
+
`export const ${stem} = {};
|
|
38
|
+
`,
|
|
47
39
|
);
|
|
48
|
-
fs.writeFileSync(path.join(themeDir, 'oceanTheme.ts'), source);
|
|
49
40
|
for (const [relativePath, contents] of Object.entries(extraFiles)) {
|
|
50
41
|
const file = path.join(themeDir, relativePath);
|
|
51
42
|
fs.mkdirSync(path.dirname(file), {recursive: true});
|
|
@@ -85,23 +76,43 @@ describe('themeAdd with integration themes', () => {
|
|
|
85
76
|
).toContain('oceanTheme');
|
|
86
77
|
});
|
|
87
78
|
|
|
88
|
-
it('copies
|
|
79
|
+
it('copies the complete nested integration theme directory', async () => {
|
|
89
80
|
installThemeIntegration(
|
|
90
81
|
'@acme/themes',
|
|
91
82
|
'ocean',
|
|
92
83
|
"import {oceanBlue} from './tokens/colors';\nexport const oceanTheme = {oceanBlue};\n",
|
|
93
|
-
{
|
|
84
|
+
{
|
|
85
|
+
'tokens/colors.ts': "export const oceanBlue = '#0064e0';\n",
|
|
86
|
+
'receipts/palette.json': '{"version":1}\n',
|
|
87
|
+
},
|
|
94
88
|
);
|
|
95
89
|
|
|
96
90
|
const result = await themeAdd('ocean', {cwd: tmpDir});
|
|
97
91
|
|
|
98
|
-
expect(result.data.files).toEqual([
|
|
92
|
+
expect(result.data.files).toEqual([
|
|
93
|
+
'oceanTheme.ts',
|
|
94
|
+
'oceanTheme.doc.mjs',
|
|
95
|
+
'receipts/palette.json',
|
|
96
|
+
'tokens/colors.ts',
|
|
97
|
+
]);
|
|
98
|
+
expect(
|
|
99
|
+
fs.readFileSync(
|
|
100
|
+
path.join(tmpDir, 'src', 'themes', 'ocean', 'oceanTheme.doc.mjs'),
|
|
101
|
+
'utf-8',
|
|
102
|
+
),
|
|
103
|
+
).toContain("type: 'theme'");
|
|
99
104
|
expect(
|
|
100
105
|
fs.readFileSync(
|
|
101
106
|
path.join(tmpDir, 'src', 'themes', 'ocean', 'tokens', 'colors.ts'),
|
|
102
107
|
'utf-8',
|
|
103
108
|
),
|
|
104
109
|
).toContain('oceanBlue');
|
|
110
|
+
expect(
|
|
111
|
+
fs.readFileSync(
|
|
112
|
+
path.join(tmpDir, 'src', 'themes', 'ocean', 'receipts', 'palette.json'),
|
|
113
|
+
'utf-8',
|
|
114
|
+
),
|
|
115
|
+
).toBe('{"version":1}\n');
|
|
105
116
|
});
|
|
106
117
|
|
|
107
118
|
it('rejects a nested destination symlink that escapes the project', async () => {
|
|
@@ -146,7 +157,7 @@ describe('themeAdd with integration themes', () => {
|
|
|
146
157
|
expect(result.data.package).toBe('@acme/themes');
|
|
147
158
|
});
|
|
148
159
|
|
|
149
|
-
it('reports a selected installed package with a corrupted theme
|
|
160
|
+
it('reports a selected installed package with a corrupted theme directory', async () => {
|
|
150
161
|
installThemeIntegration(
|
|
151
162
|
'@acme/themes',
|
|
152
163
|
'ocean',
|
|
@@ -170,7 +181,7 @@ describe('themeAdd with integration themes', () => {
|
|
|
170
181
|
themeAdd('ocean', {cwd: tmpDir, package: '@acme/themes'}),
|
|
171
182
|
).rejects.toMatchObject({
|
|
172
183
|
code: 'ERR_THEME_INVALID',
|
|
173
|
-
message: expect.stringContaining('tokens/colors
|
|
184
|
+
message: expect.stringContaining('./tokens/colors'),
|
|
174
185
|
});
|
|
175
186
|
});
|
|
176
187
|
|
|
@@ -9,8 +9,13 @@ import {BUNDLED_THEME_PACKAGE} from '../../../foundation/discovery/theme-discove
|
|
|
9
9
|
let tmpDir;
|
|
10
10
|
|
|
11
11
|
function installThemeIntegration(packageName = '@acme/themes', slug = 'ocean') {
|
|
12
|
-
const packageDir = path.join(
|
|
12
|
+
const packageDir = path.join(
|
|
13
|
+
tmpDir,
|
|
14
|
+
'node_modules',
|
|
15
|
+
...packageName.split('/'),
|
|
16
|
+
);
|
|
13
17
|
const themeDir = path.join(packageDir, 'themes', slug);
|
|
18
|
+
const stem = `${slug.replace(/-([a-z0-9])/gu, (_, character) => character.toUpperCase())}Theme`;
|
|
14
19
|
fs.mkdirSync(themeDir, {recursive: true});
|
|
15
20
|
fs.writeFileSync(
|
|
16
21
|
path.join(packageDir, 'package.json'),
|
|
@@ -18,28 +23,19 @@ function installThemeIntegration(packageName = '@acme/themes', slug = 'ocean') {
|
|
|
18
23
|
);
|
|
19
24
|
fs.writeFileSync(
|
|
20
25
|
path.join(packageDir, 'astryx.integration.mjs'),
|
|
21
|
-
`export default {themes: './themes'}
|
|
26
|
+
`export default {themes: './themes'};
|
|
27
|
+
`,
|
|
22
28
|
);
|
|
23
29
|
fs.writeFileSync(
|
|
24
|
-
path.join(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
{
|
|
29
|
-
slug,
|
|
30
|
-
displayName: 'Ocean',
|
|
31
|
-
description: 'Blue and calm.',
|
|
32
|
-
maintained: true,
|
|
33
|
-
entry: 'oceanTheme.ts',
|
|
34
|
-
exportName: 'oceanTheme',
|
|
35
|
-
files: ['oceanTheme.ts'],
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
}),
|
|
30
|
+
path.join(themeDir, `${stem}.doc.mjs`),
|
|
31
|
+
`/** @type {import('@astryxdesign/cli/authoring').ThemeDoc} */
|
|
32
|
+
export default {type: 'theme', name: '${slug}', displayName: 'Ocean', description: 'Blue and calm.', maintained: true};
|
|
33
|
+
`,
|
|
39
34
|
);
|
|
40
35
|
fs.writeFileSync(
|
|
41
|
-
path.join(themeDir,
|
|
42
|
-
|
|
36
|
+
path.join(themeDir, `${stem}.ts`),
|
|
37
|
+
`export const ${stem} = {};
|
|
38
|
+
`,
|
|
43
39
|
);
|
|
44
40
|
}
|
|
45
41
|
|
|
@@ -47,7 +43,10 @@ beforeEach(() => {
|
|
|
47
43
|
tmpDir = fs.mkdtempSync(path.join(process.cwd(), '.astryx-theme-list-'));
|
|
48
44
|
fs.writeFileSync(
|
|
49
45
|
path.join(tmpDir, 'package.json'),
|
|
50
|
-
JSON.stringify({
|
|
46
|
+
JSON.stringify({
|
|
47
|
+
name: 'consumer',
|
|
48
|
+
dependencies: {'@acme/themes': '^1.0.0'},
|
|
49
|
+
}),
|
|
51
50
|
);
|
|
52
51
|
});
|
|
53
52
|
|
|
@@ -9,25 +9,26 @@ export const doc = {
|
|
|
9
9
|
type: 'function',
|
|
10
10
|
kind: 'api',
|
|
11
11
|
name: 'listThemes',
|
|
12
|
+
namespace: 'cli/api',
|
|
12
13
|
displayName: 'listThemes()',
|
|
13
|
-
summary: 'Read the CLI bundled-theme
|
|
14
|
+
summary: 'Read the CLI bundled-theme descriptors.',
|
|
14
15
|
description:
|
|
15
|
-
'Reads templates/themes
|
|
16
|
+
'Reads the typed same-stem descriptors under templates/themes and returns normalized entries synchronously. This low-level helper keeps its historical bundled-only contract; project-aware themeList() and themeAdd() also discover source themes from installed integrations.',
|
|
16
17
|
importPath: '@astryxdesign/cli/api',
|
|
17
18
|
signature: 'listThemes(): BundledTheme[]',
|
|
18
|
-
keywords: ['theme', 'themes', '
|
|
19
|
+
keywords: ['theme', 'themes', 'descriptor', 'bundled', 'adapter', 'list'],
|
|
19
20
|
params: [],
|
|
20
21
|
returns: [
|
|
21
22
|
{
|
|
22
23
|
type: 'BundledTheme[]',
|
|
23
24
|
description:
|
|
24
|
-
'The bundled
|
|
25
|
+
'The normalized bundled descriptor entries: slug, displayName, description, maintained, entry, exportName, and files.',
|
|
25
26
|
},
|
|
26
27
|
],
|
|
27
28
|
throws: [
|
|
28
29
|
{
|
|
29
30
|
code: 'ERR_NO_SOURCE',
|
|
30
|
-
when: 'the bundled
|
|
31
|
+
when: 'the bundled descriptors are missing, invalid, or have missing source files',
|
|
31
32
|
},
|
|
32
33
|
],
|
|
33
34
|
examples: [
|